From: oes Date: Wed, 23 May 2001 12:27:33 +0000 (+0000) Subject: Fixed ugly indentation of my last changes X-Git-Tag: v_2_9_9~504 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=bcb66fd2d9147c58039e5d562c66c7332c1cd7e7;ds=sidebyside Fixed ugly indentation of my last changes --- diff --git a/loaders.c b/loaders.c index a485d935..8a24af2f 100644 --- a/loaders.c +++ b/loaders.c @@ -1,4 +1,4 @@ -const char loaders_rcs[] = "$Id: loaders.c,v 1.4 2001/05/22 18:56:28 oes Exp $"; +const char loaders_rcs[] = "$Id: loaders.c,v 1.5 2001/05/23 10:39:05 oes Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loaders.c,v $ @@ -35,6 +35,13 @@ const char loaders_rcs[] = "$Id: loaders.c,v 1.4 2001/05/22 18:56:28 oes Exp $"; * * Revisions : * $Log: loaders.c,v $ + * Revision 1.5 2001/05/23 10:39:05 oes + * - Added support for escaping the comment character + * in config files by a backslash + * - Added support for line continuation in config + * files + * - Fixed a buffer overflow bug with long config lines + * * Revision 1.4 2001/05/22 18:56:28 oes * CRLF -> LF * @@ -733,7 +740,7 @@ char *read_config_line(char *buf, int buflen, FILE *fp, struct file_list *fs) char linebuf[BUFSIZ]; int contflag = 0; - *buf = '\0'; + *buf = '\0'; while (fgets(linebuf, sizeof(linebuf), fp)) { @@ -757,27 +764,27 @@ char *read_config_line(char *buf, int buflen, FILE *fp, struct file_list *fs) } /* Line continuation? Trim escape and set flag. */ - if ((p != linebuf) && (*--p == '\\')) - { - contflag = 1; - *p = '\0'; - } + if ((p != linebuf) && (*--p == '\\')) + { + contflag = 1; + *p = '\0'; + } /* If there's a comment char.. */ if ((p = strpbrk(linebuf, "#")) != NULL) { - /* ..and it's escaped, left-shift the line over the escape. */ - if ((p != linebuf) && (*(p-1) == '\\')) - { - q = p-1; - while ((*q++ = *p++) != '\0') /* nop */; - } - /* Else, chop off the rest of the line */ - else - { - *p = '\0'; - } - } + /* ..and it's escaped, left-shift the line over the escape. */ + if ((p != linebuf) && (*(p-1) == '\\')) + { + q = p-1; + while ((*q++ = *p++) != '\0') /* nop */; + } + /* Else, chop off the rest of the line */ + else + { + *p = '\0'; + } + } /* Trim leading whitespace */ p = linebuf; @@ -818,16 +825,16 @@ char *read_config_line(char *buf, int buflen, FILE *fp, struct file_list *fs) /* More paranoia. This if statement is always true. */ if (*linebuf) { - strncat(buf, linebuf, buflen - strlen(buf)); - if (contflag) - { - contflag = 0; - continue; - } - else - { - return buf; - } + strncat(buf, linebuf, buflen - strlen(buf)); + if (contflag) + { + contflag = 0; + continue; + } + else + { + return buf; + } } } }