summaryrefslogtreecommitdiff
path: root/usr.bin/logger/logger.c
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/logger/logger.c
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/logger/logger.c')
-rw-r--r--usr.bin/logger/logger.c9
1 files changed, 6 insertions, 3 deletions
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);
}