Skip to content

Commit 288f526

Browse files
committed
vlogger: behave like logger(1) if argv[0] is "logger"
1 parent 3db879b commit 288f526

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

vlogger.8

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414
.Sh DESCRIPTION
1515
The
1616
.Nm
17-
utility writes messages to the system log.
17+
utility writes messages to the system log or an arbitrary executable.
1818
.Pp
19-
With
20-
.Ar message
21-
arguments
19+
If
2220
.Nm
23-
will always write messages to the system log.
21+
is executed as
22+
.Nm logger
23+
it will always use the system log and behave like the regular
24+
.Xr logger 1 .
25+
.Pp
2426
Without
2527
.Ar message
2628
arguments
@@ -36,8 +38,10 @@ executable exists
3638
.Nm
3739
executes it with
3840
.Ar tag ,
39-
level
40-
and priority as arguments,
41+
.Ar level
42+
and
43+
.Ar facility
44+
as arguments,
4145
replacing the
4246
.Nm
4347
process.
@@ -117,7 +121,7 @@ environment variable.
117121
.It Ar message
118122
Write the
119123
.Ar message
120-
to the log.
124+
to the system log.
121125
.El
122126
.Sh FACILITIES
123127
.Bl -tag -width 11n -compact

vlogger.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <unistd.h>
77
#include <limits.h>
88

9+
extern char *__progname;
10+
911
static char pwd[PATH_MAX];
1012

1113
typedef struct {
@@ -99,6 +101,9 @@ main(int argc, char *argv[])
99101
level = LOG_NOTICE;
100102
}
101103
}
104+
} else if (strcmp(__progname, "logger") == 0) {
105+
/* behave just like logger(1) and only use syslog */
106+
Sflag++;
102107
}
103108

104109
while ((c = getopt(argc, argv, "f:ip:Sst:")) != -1)

0 commit comments

Comments
 (0)