summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd/syslogd.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1998-06-10 04:34:56 +0000
committerjulian <julian@FreeBSD.org>1998-06-10 04:34:56 +0000
commit538c54fd9e27ac35ca3365167e7978a19cce6a14 (patch)
treee05188214d574c48c1c094849bcf92e73bc2b805 /usr.sbin/syslogd/syslogd.c
parentaa1c40519a99461008e57eb85b0d52a508042021 (diff)
downloadFreeBSD-src-538c54fd9e27ac35ca3365167e7978a19cce6a14.zip
FreeBSD-src-538c54fd9e27ac35ca3365167e7978a19cce6a14.tar.gz
Allow syslogd to separate out kernel log messages with a known
category. e.g. separate out ipfw entries to a separate file. Reviewed by: (briefly) phk Submitted by: archie@whistle.com Obtained from: Whistle source tree
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r--usr.sbin/syslogd/syslogd.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 3cd6353..7497648 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -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.31 1998/05/07 00:39:56 brian Exp $";
+ "$Id: syslogd.c,v 1.32 1998/05/19 12:02:41 phk Exp $";
#endif /* not lint */
/*
@@ -543,10 +543,9 @@ printsys(msg)
int c, pri, flags;
char *lp, *p, *q, line[MAXLINE + 1];
- (void)strcpy(line, bootfile);
- (void)strcat(line, ": ");
- lp = line + strlen(line);
for (p = msg; *p != '\0'; ) {
+
+ /* Get message priority, if any */
flags = SYNC_FILE | ADDDATE; /* fsync file after write */
pri = DEFSPRI;
if (*p == '<') {
@@ -561,6 +560,18 @@ printsys(msg)
}
if (pri &~ (LOG_FACMASK|LOG_PRIMASK))
pri = DEFSPRI;
+
+ /* See if kernel provided a prefix; if not, use kernel name */
+ for (q = p; *q && isalnum(*q); q++);
+ if (*q == ':') {
+ lp = line;
+ } else {
+ (void)strcpy(line, bootfile);
+ (void)strcat(line, ": ");
+ lp = line + strlen(line);
+ }
+
+ /* Append message body to prefix */
q = lp;
while (*p != '\0' && (c = *p++) != '\n' &&
q < &line[MAXLINE])
OpenPOWER on IntegriCloud