Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/logger support the LOG_CONS/LOG_NDELAY.



details:   https://anonhg.NetBSD.org/src/rev/ca4c58467b93
branches:  trunk
changeset: 779030:ca4c58467b93
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 26 21:11:24 2012 +0000

description:
support the LOG_CONS/LOG_NDELAY.

diffstat:

 usr.bin/logger/logger.1 |  18 +++++++++++++-----
 usr.bin/logger/logger.c |  14 ++++++++++----
 2 files changed, 23 insertions(+), 9 deletions(-)

diffs (112 lines):

diff -r 37d525c0ef5b -r ca4c58467b93 usr.bin/logger/logger.1
--- a/usr.bin/logger/logger.1   Thu Apr 26 19:59:36 2012 +0000
+++ b/usr.bin/logger/logger.1   Thu Apr 26 21:11:24 2012 +0000
@@ -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 @@
 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 @@
 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 @@
 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  .
diff -r 37d525c0ef5b -r ca4c58467b93 usr.bin/logger/logger.c
--- a/usr.bin/logger/logger.c   Thu Apr 26 19:59:36 2012 +0000
+++ b/usr.bin/logger/logger.c   Thu Apr 26 21:11:24 2012 +0000
@@ -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 @@
 #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 @@
        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 @@
                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 @@
 {
 
        (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);



Home | Main Index | Thread Index | Old Index