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
This commit is contained in:
Peter Kallden 2004-01-21 18:17:20 +00:00
parent 00af04fa57
commit 457653ccff

View File

@ -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;