From 457653ccff4e635e33aea51ce7f3ca0747740fba Mon Sep 17 00:00:00 2001 From: Peter Kallden Date: Wed, 21 Jan 2004 18:17:20 +0000 Subject: [PATCH] next_arg modified to support escaping of needles with backslash. ( you may need two dep. on your shell. ) git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@570 423420c4-83ab-492f-b58f-81f9feb106b5 --- rdesktop.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/rdesktop.c b/rdesktop.c index 66a9787..6fe0443 100644 --- a/rdesktop.c +++ b/rdesktop.c @@ -749,13 +749,22 @@ char * next_arg(char *src, char needle) { char *nextval; + char *p; // EOS if (*src == (char) 0x00) return 0; - // more args available. - nextval = strchr(src, needle); + p = src; + // skip escaped needles. + while( (nextval = strchr(p, needle) ) ) + { + if( *(nextval-1) != '\\' ) + break; + p = nextval +1; + } + + // more args available if (nextval) { *nextval = (char) 0x00;