diff options
| author | Maxim Sobolev <sobomax@FreeBSD.org> | 2002-12-11 01:19:56 +0000 |
|---|---|---|
| committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2002-12-11 01:19:56 +0000 |
| commit | f2562be03ec3a562cd0cff8f28488766169feb6c (patch) | |
| tree | 870b63ef70e61483e9bda8e2d78ce04e4efcd4a8 | |
| parent | 5e7972fe3229e9cc0d9094a1510e6e54618864ce (diff) | |
Notes
| -rw-r--r-- | usr.sbin/newsyslog/Makefile | 2 | ||||
| -rw-r--r-- | usr.sbin/newsyslog/newsyslog.8 | 8 | ||||
| -rw-r--r-- | usr.sbin/newsyslog/newsyslog.c | 16 |
3 files changed, 21 insertions, 5 deletions
diff --git a/usr.sbin/newsyslog/Makefile b/usr.sbin/newsyslog/Makefile index ab06f3a5041f..7312f101ff04 100644 --- a/usr.sbin/newsyslog/Makefile +++ b/usr.sbin/newsyslog/Makefile @@ -3,6 +3,6 @@ PROG= newsyslog MAN= newsyslog.8 -WARNS?= 2 +WARNS?= 4 .include <bsd.prog.mk> diff --git a/usr.sbin/newsyslog/newsyslog.8 b/usr.sbin/newsyslog/newsyslog.8 index f55986b20895..03f540b43e1e 100644 --- a/usr.sbin/newsyslog/newsyslog.8 +++ b/usr.sbin/newsyslog/newsyslog.8 @@ -79,7 +79,11 @@ that should be handled by .Nm . Each line has five mandatory fields and four optional fields, with whitespace separating each field. Blank lines or lines beginning with -``#'' are ignored. The fields of the configuration file are as +``#'' are ignored. If ``#'' is placed in the middle of the line, +``#'' character and the rest of the line after it is ignored. +To prevent special meaning, the ``#'' may be escaped with ``\\'', +in this case preceding ``\\'' is removed and ``#'' treated as ordinary +character. The fields of the configuration file are as follows: .Pp .Bl -tag -width indent @@ -297,7 +301,7 @@ to archive all filenames matching this pattern using the same options. See .Xr glob 3 -for details on matching rules. +for details on syntax and matching rules. .It Ar path_to_pid_file This optional field specifies the file name to read to find the daemon process id. If this diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index e6e89b030551..cfc983b6ac20 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -290,7 +290,7 @@ parse_file(char **files) { FILE *f; char line[BUFSIZ], *parse, *q; - char *errline, *group; + char *cp, *errline, *group; char **p; struct conf_entry *first, *working; struct passwd *pass; @@ -306,9 +306,21 @@ parse_file(char **files) if (!f) err(1, "%s", conf); while (fgets(line, BUFSIZ, f)) { - if ((line[0] == '\n') || (line[0] == '#')) + if ((line[0] == '\n') || (line[0] == '#') || + (strlen(line) == 0)) continue; errline = strdup(line); + for (cp = line + 1; *cp != '\0'; cp++) { + if (*cp != '#') + continue; + if (*(cp - 1) == '\\') { + strcpy(cp - 1, cp); + cp--; + continue; + } + *cp = '\0'; + break; + } q = parse = missing_field(sob(line), errline); parse = son(line); |
