Module Name:    src
Committed By:   christos
Date:           Thu Apr 26 21:11:24 UTC 2012

Modified Files:
        src/usr.bin/logger: logger.1 logger.c

Log Message:
support the LOG_CONS/LOG_NDELAY.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/logger/logger.1
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/logger/logger.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/logger/logger.1
diff -u src/usr.bin/logger/logger.1:1.13 src/usr.bin/logger/logger.1:1.14
--- src/usr.bin/logger/logger.1:1.13	Thu Mar 22 03:58:19 2012
+++ src/usr.bin/logger/logger.1	Thu Apr 26 17:11:24 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: logger.1,v 1.13 2012/03/22 07:58:19 wiz Exp $
+.\"	$NetBSD: logger.1,v 1.14 2012/04/26 21:11:24 christos Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)logger.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd May 14, 2010
+.Dd April 26, 2012
 .Dt LOGGER 1
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd make entries in the system log
 .Sh SYNOPSIS
 .Nm
-.Op Fl is
+.Op Fl cins
 .Op Fl d Ar SD
 .Op Fl f Ar file
 .Op Fl m Ar msgid
@@ -53,6 +53,9 @@ system log module.
 Options:
 .Pp
 .Bl -tag -width "messageXX"
+.It Fl c
+Log to console
+.Dv ( LOG_CONS ) .
 .It Fl d Ar sd
 Log this in the structured data (SD) field.
 .Po
@@ -64,9 +67,13 @@ the shell.
 Log the specified file.
 .It Fl i
 Log the process id of the logger process
-with each line.
+with each line
+.Dv ( LOG_PID ) .
 .It Fl m Ar msgid
 The MSGID used for the message.
+.it Fl n
+Open log file immediately
+.Dv ( LOG_NDELAY ) .
 .It Fl p Ar pri
 Enter the message with the specified priority.
 The priority may be specified numerically or as a
@@ -82,7 +89,8 @@ facility.
 The default is
 .Dq user.notice .
 .It Fl s
-Log the message to standard error, as well as the system log.
+Log the message to standard error, as well as the system log
+.Dv ( LOG_PERROR ) .
 .It Fl t Ar tag
 Mark every line in the log with the specified
 .Ar tag  .

Index: src/usr.bin/logger/logger.c
diff -u src/usr.bin/logger/logger.c:1.15 src/usr.bin/logger/logger.c:1.16
--- src/usr.bin/logger/logger.c:1.15	Sun Sep  4 16:28:59 2011
+++ src/usr.bin/logger/logger.c	Thu Apr 26 17:11:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: logger.c,v 1.15 2011/09/04 20:28:59 joerg Exp $	*/
+/*	$NetBSD: logger.c,v 1.16 2012/04/26 21:11:24 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)logger.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: logger.c,v 1.15 2011/09/04 20:28:59 joerg Exp $");
+__RCSID("$NetBSD: logger.c,v 1.16 2012/04/26 21:11:24 christos Exp $");
 #endif /* not lint */
 
 #include <errno.h>
@@ -75,8 +75,11 @@ main(int argc, char *argv[])
 	tag = NULL;
 	pri = LOG_NOTICE;
 	logflags = 0;
-	while ((ch = getopt(argc, argv, "d:f:im:p:st:")) != -1)
+	while ((ch = getopt(argc, argv, "cd:f:im:np:st:")) != -1)
 		switch((char)ch) {
+		case 'c':	/* log to console */
+			logflags |= LOG_CONS;
+			break;
 		case 'd':		/* structured data field */
 			sd = optarg;
 			break;
@@ -90,6 +93,9 @@ main(int argc, char *argv[])
 		case 'm':		/* msgid field */
 			msgid = optarg;
 			break;
+		case 'n':		/* open log file immediately */
+			logflags |= LOG_NDELAY;
+			break;
 		case 'p':		/* priority */
 			pri = pencode(optarg);
 			break;
@@ -190,7 +196,7 @@ usage(void)
 {
 
 	(void)fprintf(stderr,
-	    "%s: [-is] [-f file] [-p pri] [-t tag] "
+	    "Usage: %s [-cins] [-f file] [-p pri] [-t tag] "
 	    "[-m msgid] [-d SD] [ message ... ]\n",
 	    getprogname());
 	exit(EXIT_FAILURE);

Reply via email to