diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-06-12 17:41:22 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-06-12 17:41:22 +0000 |
commit | 10dcf9ba53d805e99de469414f6eb4607090ac6e (patch) | |
tree | 32b894b24049f47530951802c63eb2f46c9923d8 | |
parent | 34a26c048fdf0a40932b855df78641c571361466 (diff) |
Make the flags field truly optional.
-rw-r--r-- | usr.bin/newsyslog/newsyslog.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/usr.bin/newsyslog/newsyslog.c b/usr.bin/newsyslog/newsyslog.c index a739d436a3d..c07364b9f94 100644 --- a/usr.bin/newsyslog/newsyslog.c +++ b/usr.bin/newsyslog/newsyslog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newsyslog.c,v 1.31 2000/06/10 02:49:41 millert Exp $ */ +/* $OpenBSD: newsyslog.c,v 1.32 2000/06/12 17:41:21 millert Exp $ */ /* * Copyright (c) 1999 Todd C. Miller <Todd.Miller@courtesan.com> @@ -88,7 +88,7 @@ provided "as is" without express or implied warranty. */ #ifndef lint -static char rcsid[] = "$OpenBSD: newsyslog.c,v 1.31 2000/06/10 02:49:41 millert Exp $"; +static char rcsid[] = "$OpenBSD: newsyslog.c,v 1.32 2000/06/12 17:41:21 millert Exp $"; #endif /* not lint */ #ifndef CONF @@ -494,20 +494,33 @@ parse_file(nentries) else working->hours = -1; - q = parse = sob(++parse); /* Optional field */ - *(parse = son(parse)) = '\0'; working->flags = 0; - while (q && *q && !isspace(*q)) { - if ((*q == 'Z') || (*q == 'z')) - working->flags |= CE_COMPACT; - else if ((*q == 'B') || (*q == 'b')) - working->flags |= CE_BINARY; - else if ((*q == 'M') || (*q == 'm')) - working->flags |= CE_MONITOR; - else - errx(1, "Illegal flag in config file: %c", *q); - q++; - } + q = sob(++parse); /* Optional field */ + if (*q == 'Z' || *q == 'z' || *q == 'B' || *q == 'b' || + *q == 'M' || *q == 'm') { + *(parse = son(q)) = '\0'; + while (*q) { + switch (*q) { + case 'Z': + case 'z': + working->flags |= CE_COMPACT; + break; + case 'B': + case 'b': + working->flags |= CE_BINARY; + break; + case 'M': + case 'm': + working->flags |= CE_MONITOR; + break; + default: + errx(1, "Illegal flag in config file: %c", *q); + break; + } + q++; + } + } else + parse--; /* no flags so undo */ working->whom = NULL; if (working->flags & CE_MONITOR) { /* Optional field */ |