logger: Add NetBSD -i option for LOG_PID
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
d3461fd6a3
commit
0aa57978ee
@ -32,7 +32,7 @@
|
||||
.Nd Send messages to system log, or a log file
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl chsv
|
||||
.Op Fl chisv
|
||||
.Op Fl f Ar FILE
|
||||
.Op Fl p Ar PRIO
|
||||
.Op Fl r Ar SIZE:NUM
|
||||
@ -65,8 +65,9 @@ accepts
|
||||
.Fl f-
|
||||
as an alias for
|
||||
.Ar stdout .
|
||||
.It Fl h
|
||||
Show program help.
|
||||
.It Fl i
|
||||
Log the process id of the logger process with each line
|
||||
.Ql ( LOG_PID ) .
|
||||
.It Fl p Ar PRIO
|
||||
Priority, numeric or
|
||||
.Ar facility.severity
|
||||
|
@ -183,6 +183,7 @@ static int usage(int code)
|
||||
"Write MESSAGE (or line-by-line stdin) to syslog, or file (with logrotate).\n"
|
||||
"\n"
|
||||
" -c Log to console (LOG_CONS) on failure\n"
|
||||
" -i Log the process ID of the logger process with each line (LOG_PID)\n"
|
||||
" -p PRIO Log message priority (numeric or facility.severity pair)\n"
|
||||
" -t TAG Log using the specified tag (defaults to user name)\n"
|
||||
" -s Log to stderr as well as the system log\n"
|
||||
@ -206,14 +207,14 @@ int main(int argc, char *argv[])
|
||||
int c, num = 5;
|
||||
int facility = LOG_USER;
|
||||
int severity = LOG_INFO;
|
||||
int log_opts = LOG_NDELAY | LOG_PID;
|
||||
int log_opts = LOG_NDELAY;
|
||||
int rotate = 0;
|
||||
off_t size = 200 * 1024;
|
||||
char *ident = NULL, *logfile = NULL;
|
||||
char *sockpath = NULL;
|
||||
char buf[512] = "";
|
||||
|
||||
while ((c = getopt(argc, argv, "?cf:p:r:st:u:v")) != EOF) {
|
||||
while ((c = getopt(argc, argv, "?cf:ip:r:st:u:v")) != EOF) {
|
||||
switch (c) {
|
||||
case 'c':
|
||||
log_opts |= LOG_CONS;
|
||||
@ -223,6 +224,10 @@ int main(int argc, char *argv[])
|
||||
logfile = optarg;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
log_opts |= LOG_PID;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if (parse_prio(optarg, &facility, &severity))
|
||||
return usage(1);
|
||||
|
Loading…
Reference in New Issue
Block a user