summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2019-06-17 00:23:04 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2019-06-17 00:23:04 +0000
commit4158ca770f5d55462459819d374a6d8dddd7288b (patch)
tree65bc10fd60d2cbe8bcff0b64abf009ba45972fea /usr.bin
parentf4cf4c69c9ee825f9de3baeddc89c7d3ca7c98da (diff)
Add -c option for passing LOG_CONS to syslog(3).
(Option choice matches NetBSD) ok deraadt@ jmc@ benno@ kn@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/logger/logger.112
-rw-r--r--usr.bin/logger/logger.c9
2 files changed, 14 insertions, 7 deletions
diff --git a/usr.bin/logger/logger.1 b/usr.bin/logger/logger.1
index 5ba821f8e65..d2057a471e4 100644
--- a/usr.bin/logger/logger.1
+++ b/usr.bin/logger/logger.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: logger.1,v 1.21 2013/06/05 17:35:12 tedu Exp $
+.\" $OpenBSD: logger.1,v 1.22 2019/06/17 00:23:03 guenther Exp $
.\" $NetBSD: logger.1,v 1.4 1994/12/22 06:26:59 jtc Exp $
.\"
.\" Copyright (c) 1983, 1990, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)logger.1 8.1 (Berkeley) 6/6/93
.\"
-.Dd $Mdocdate: June 5 2013 $
+.Dd $Mdocdate: June 17 2019 $
.Dt LOGGER 1
.Os
.Sh NAME
@@ -38,7 +38,7 @@
.Nd make entries in the system log
.Sh SYNOPSIS
.Nm logger
-.Op Fl is
+.Op Fl cis
.Op Fl f Ar file
.Op Fl p Ar pri
.Op Fl t Ar tag
@@ -52,6 +52,10 @@ system log module.
.Pp
The options are as follows:
.Bl -tag -width "-f file"
+.It Fl c
+If unable to pass the message to
+.Xr syslogd 8 ,
+attempt to write the message to the console.
.It Fl f Ar file
Read from the specified
.Ar file .
@@ -102,5 +106,5 @@ utility is compliant with the
specification.
.Pp
The flags
-.Op Fl ifpst
+.Op Fl cfipst
are extensions to that specification.
diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c
index 2ddee3a68b3..04500a9d4b8 100644
--- a/usr.bin/logger/logger.c
+++ b/usr.bin/logger/logger.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logger.c,v 1.17 2016/03/28 18:18:52 chl Exp $ */
+/* $OpenBSD: logger.c,v 1.18 2019/06/17 00:23:03 guenther Exp $ */
/* $NetBSD: logger.c,v 1.4 1994/12/22 06:27:00 jtc Exp $ */
/*
@@ -61,8 +61,11 @@ main(int argc, char *argv[])
tag = NULL;
pri = LOG_NOTICE;
logflags = 0;
- while ((ch = getopt(argc, argv, "f:ip:st:")) != -1)
+ while ((ch = getopt(argc, argv, "cf:ip:st:")) != -1)
switch(ch) {
+ case 'c': /* log to console */
+ logflags |= LOG_CONS;
+ break;
case 'f': /* file to log */
if (freopen(optarg, "r", stdin) == NULL) {
(void)fprintf(stderr, "logger: %s: %s.\n",
@@ -180,6 +183,6 @@ void
usage(void)
{
(void)fprintf(stderr,
- "usage: logger [-is] [-f file] [-p pri] [-t tag] [message ...]\n");
+ "usage: logger [-cis] [-f file] [-p pri] [-t tag] [message ...]\n");
exit(1);
}