Allow either tabs or spaces in configuration files.

PR:		8762
Submitted by:	Igor Roshchin <str@giganda.komkon.org>
This commit is contained in:
jkh 1998-12-04 06:49:20 +00:00
parent 9abfbf7ece
commit a4871f2fc3
2 changed files with 22 additions and 10 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)syslog.conf.5 8.1 (Berkeley) 6/9/93
.\" $Id: syslog.conf.5,v 1.10 1998/06/10 04:34:54 julian Exp $
.\" $Id: syslog.conf.5,v 1.11 1998/07/22 06:15:16 phk Exp $
.\"
.Dd June 9, 1993
.Dt SYSLOG.CONF 5
@ -62,7 +62,19 @@ The
.Em selector
field is separated from the
.Em action
field by one or more tab characters.
field by one or more tab characters or spaces.
.Pp
Note that if you use spaces as separators, your
.Em syslog.conf
might be incompatible with other Unices or Unix-like systems.
This functionality was added for the ease of configuration
(e.g. it is possible to cut-and-paste into
.Em syslog.conf
),
and to avoid possible mistakes. This change however preserves
backwards compatibility with the old style of the
.Em syslog.conf
(i.e. tab characters only).
.Pp
The
.Em Selectors

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#endif
static const char rcsid[] =
"$Id: syslogd.c,v 1.41 1998/08/25 21:16:47 julian Exp $";
"$Id: syslogd.c,v 1.42 1998/11/05 10:51:21 dg Exp $";
#endif /* not lint */
/*
@ -1366,12 +1366,12 @@ cfline(line, f, prog)
}
/* scan through the list of selectors */
for (p = line; *p && *p != '\t';) {
for (p = line; *p && *p != '\t' && *p != ' ';) {
int pri_done;
int pri_cmp;
/* find the end of this facility name list */
for (q = p; *q && *q != '\t' && *q++ != '.'; )
for (q = p; *q && *q != '\t' && *q != ' ' && *q++ != '.'; )
continue;
/* get the priority comparison */
@ -1403,12 +1403,12 @@ cfline(line, f, prog)
;
/* collect priority name */
for (bp = buf; *q && !strchr("\t,;", *q); )
for (bp = buf; *q && !strchr("\t,; ", *q); )
*bp++ = *q++;
*bp = '\0';
/* skip cruft */
while (strchr(", ;", *q))
while (strchr(",;", *q))
q++;
/* decode priority name */
@ -1425,8 +1425,8 @@ cfline(line, f, prog)
}
/* scan facilities */
while (*p && !strchr("\t.;", *p)) {
for (bp = buf; *p && !strchr("\t,;.", *p); )
while (*p && !strchr("\t.; ", *p)) {
for (bp = buf; *p && !strchr("\t,;. ", *p); )
*bp++ = *p++;
*bp = '\0';
@ -1455,7 +1455,7 @@ cfline(line, f, prog)
}
/* skip to action part */
while (*p == '\t')
while (*p == '\t' || *p == ' ')
p++;
switch (*p)