|
|
@ -48,7 +48,7 @@ static char * |
|
|
|
get_arg( conffile_t *cfile, int required, int *comment ) |
|
|
|
get_arg( conffile_t *cfile, int required, int *comment ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char *ret, *p, *t; |
|
|
|
char *ret, *p, *t; |
|
|
|
int quoted; |
|
|
|
int escaped, quoted; |
|
|
|
char c; |
|
|
|
char c; |
|
|
|
|
|
|
|
|
|
|
|
p = cfile->rest; |
|
|
|
p = cfile->rest; |
|
|
@ -64,9 +64,14 @@ get_arg( conffile_t *cfile, int required, int *comment ) |
|
|
|
} |
|
|
|
} |
|
|
|
ret = 0; |
|
|
|
ret = 0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
for (quoted = 0, ret = t = p; c; c = *p) { |
|
|
|
for (escaped = 0, quoted = 0, ret = t = p; c; c = *p) { |
|
|
|
p++; |
|
|
|
p++; |
|
|
|
if (c == '"') |
|
|
|
if (escaped && c >= 32) { |
|
|
|
|
|
|
|
escaped = 0; |
|
|
|
|
|
|
|
*t++ = c; |
|
|
|
|
|
|
|
} else if (c == '\\') |
|
|
|
|
|
|
|
escaped = 1; |
|
|
|
|
|
|
|
else if (c == '"') |
|
|
|
quoted ^= 1; |
|
|
|
quoted ^= 1; |
|
|
|
else if (!quoted && isspace( (unsigned char) c )) |
|
|
|
else if (!quoted && isspace( (unsigned char) c )) |
|
|
|
break; |
|
|
|
break; |
|
|
@ -74,6 +79,11 @@ get_arg( conffile_t *cfile, int required, int *comment ) |
|
|
|
*t++ = c; |
|
|
|
*t++ = c; |
|
|
|
} |
|
|
|
} |
|
|
|
*t = 0; |
|
|
|
*t = 0; |
|
|
|
|
|
|
|
if (escaped) { |
|
|
|
|
|
|
|
error( "%s:%d: unterminated escape sequence\n", cfile->file, cfile->line ); |
|
|
|
|
|
|
|
cfile->err = 1; |
|
|
|
|
|
|
|
ret = 0; |
|
|
|
|
|
|
|
} |
|
|
|
if (quoted) { |
|
|
|
if (quoted) { |
|
|
|
error( "%s:%d: missing closing quote\n", cfile->file, cfile->line ); |
|
|
|
error( "%s:%d: missing closing quote\n", cfile->file, cfile->line ); |
|
|
|
cfile->err = 1; |
|
|
|
cfile->err = 1; |
|
|
|