Allow ']' char in string of \s[] sequences, by adding a \ before

This commit is contained in:
Martin Duquesnoy
2012-01-27 18:26:18 +01:00
parent 2ad1e52051
commit aa71bf00f9
3 changed files with 13 additions and 6 deletions

View File

@@ -126,7 +126,7 @@ parse_args(char *str, char delim, char end, int narg, char *args[])
{
int i = 0;
for(args[0] = str; *str && *str != end && i < narg; ++str)
for(args[0] = str; *str && (*str != end || *(str - 1) == '\\') && i < narg; ++str)
if(*str == delim)
{
*str = '\0';