(parse_conf): Ignore leading whitespace. Use feof_unlocked instead of feof. (add_dir): Ignire trailing whitespace.

This commit is contained in:
Ulrich Drepper 2003-04-08 04:20:29 +00:00
parent 0a7cfefb94
commit 69acbe9f1d
1 changed files with 16 additions and 8 deletions

View File

@ -342,13 +342,15 @@ add_dir (const char *line)
entry->flag = FLAG_ANY; entry->flag = FLAG_ANY;
} }
/* Canonify path: for now only remove trailing slashes. */ /* Canonify path: for now only remove leading and trailing
whitespace and the trailing slashes slashes. */
i = strlen (entry->path) - 1; i = strlen (entry->path) - 1;
while (isspace (entry->path[i]) && i > 0)
entry->path[i--] = '\0';
while (entry->path[i] == '/' && i > 0) while (entry->path[i] == '/' && i > 0)
{ entry->path[i--] = '\0';
entry->path[i] = '\0';
--i;
}
if (stat64 (entry->path, &stat_buf)) if (stat64 (entry->path, &stat_buf))
{ {
@ -963,12 +965,18 @@ parse_conf (const char *filename)
make it terminating the line. */ make it terminating the line. */
*strchrnul (line, '#') = '\0'; *strchrnul (line, '#') = '\0';
/* Remove leading whitespace. NUL is no whitespace character. */
char *cp = line;
while (isspace (*cp))
++cp;
/* If the line is blank it is ignored. */ /* If the line is blank it is ignored. */
if (line[0] == '\0') if (cp[0] == '\0')
continue; continue;
add_dir (line); add_dir (cp);
} while (!feof (file)); }
while (!feof_unlocked (file));
/* Free buffer and close file. */ /* Free buffer and close file. */
free (line); free (line);