Re: parse functions

From: Robert Collins <robert.collins@dont-contact.us>
Date: Tue, 30 Jan 2001 20:29:41 +1100

Great. Thats more comprehensive than what'd I'd done.. thanks.

Rob

----- Original Message -----
From: "Henrik Nordstrom" <hno@hem.passagen.se>
To: "Robert Collins" <robert.collins@itdomain.com.au>
Cc: "Squid-Dev (E-mail)" <squid-dev@squid-cache.org>
Sent: Tuesday, January 30, 2001 8:11 PM
Subject: Re: parse functions

> 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:29:05 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:26 MST