mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Tweak quoting code
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20713 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e954fdf3cc
commit
ec1cd5da1e
1 changed files with 4 additions and 4 deletions
|
@ -4167,7 +4167,7 @@ quoteArg(const char *arg)
|
||||||
int in;
|
int in;
|
||||||
int out = 0;
|
int out = 0;
|
||||||
int quote = 0;
|
int quote = 0;
|
||||||
char *ptr = objc_malloc(i*2+3);
|
char *ptr = malloc(len*2+3);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for white space ... if present, must quote argument.
|
* Check for white space ... if present, must quote argument.
|
||||||
|
@ -4210,10 +4210,10 @@ quoteArg(const char *arg)
|
||||||
// Copy the original backslashes
|
// Copy the original backslashes
|
||||||
while (in < pos)
|
while (in < pos)
|
||||||
{
|
{
|
||||||
ptr[out++] = '\\';
|
ptr[out++] = arg[in++];
|
||||||
}
|
}
|
||||||
// Copy the character after the backslashes
|
// Copy the character after the backslashes
|
||||||
if (in < end)
|
if (in < len)
|
||||||
{
|
{
|
||||||
ptr[out++] = arg[in];
|
ptr[out++] = arg[in];
|
||||||
}
|
}
|
||||||
|
@ -4235,7 +4235,7 @@ quoteArg(const char *arg)
|
||||||
ptr[out++] = '"';
|
ptr[out++] = '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr[pos] = '\0';
|
ptr[out] = '\0';
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue