From 4158ca770f5d55462459819d374a6d8dddd7288b Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Mon, 17 Jun 2019 00:23:04 +0000 Subject: Add -c option for passing LOG_CONS to syslog(3). (Option choice matches NetBSD) ok deraadt@ jmc@ benno@ kn@ --- usr.bin/logger/logger.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'usr.bin/logger/logger.c') 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); } -- cgit v1.2.3