version 1.17, 2016/03/28 18:18:52 |
version 1.18, 2019/06/17 00:23:03 |
|
|
tag = NULL; |
tag = NULL; |
pri = LOG_NOTICE; |
pri = LOG_NOTICE; |
logflags = 0; |
logflags = 0; |
while ((ch = getopt(argc, argv, "f:ip:st:")) != -1) |
while ((ch = getopt(argc, argv, "cf:ip:st:")) != -1) |
switch(ch) { |
switch(ch) { |
|
case 'c': /* log to console */ |
|
logflags |= LOG_CONS; |
|
break; |
case 'f': /* file to log */ |
case 'f': /* file to log */ |
if (freopen(optarg, "r", stdin) == NULL) { |
if (freopen(optarg, "r", stdin) == NULL) { |
(void)fprintf(stderr, "logger: %s: %s.\n", |
(void)fprintf(stderr, "logger: %s: %s.\n", |
|
|
usage(void) |
usage(void) |
{ |
{ |
(void)fprintf(stderr, |
(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); |
exit(1); |
} |
} |