parse_eol is buggy. It should skip leading whitespace but doesn't.
Simple patch:
while(isspace((unsigned char)*token))
token++;
before the assignment.
Should probably check if there is anything left of the string..
Something like this:
void
parse_eol(char *volatile *var)
{
| unsigned char *token = strtok(NULL, null_string);
safe_free(*var);
+ while(isspace(*token))
+ token++;
| if (token == NULL || strlen(token) == 0)
self_destruct();
*var = xstrdup(token);
}
Robert Collins wrote:
>
> Is there any expected problems trimming whitespace at the beginning of
> the token in functions like parse_eol?
>
> I'm finding that if I have two spaces on a config line:
> filter_config onunload search string
> the parsed string is " string", rather thatn "string"
>
> Rob
Received on Tue Jan 30 2001 - 02:26:11 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:26 MST