about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2018-06-22 15:13:16 +0200
committerDuncaen <mail@duncano.de>2018-06-22 16:53:50 +0200
commit999b1ba166f508aa950adbe0445b0ac847971173 (patch)
tree5be6693b60c7cb23d88c4a5f0a4b6e9ecc02487d
parent64acdc39935548eeca43fd3c31a6e59faa008a9b (diff)
downloadrunit-void-999b1ba166f508aa950adbe0445b0ac847971173.tar.gz
runit-void-999b1ba166f508aa950adbe0445b0ac847971173.tar.xz
runit-void-999b1ba166f508aa950adbe0445b0ac847971173.zip
vlogger: pass level and facility to /etc/vlogger
-rw-r--r--vlogger.88
-rw-r--r--vlogger.c12
2 files changed, 17 insertions, 3 deletions
diff --git a/vlogger.8 b/vlogger.8
index cae3b12..aa7780f 100644
--- a/vlogger.8
+++ b/vlogger.8
@@ -128,8 +128,12 @@ deprecated synonym for
 .It /etc/vlogger
 An optional executable file that is used to to handle the messages.
 It is executed with
-.Ar tag
-as first argument and replaces the
+.Ar tag ,
+.Ar level
+and
+.Ar facility
+as arguments
+and replaces the
 .Nm
 process.
 .El
diff --git a/vlogger.c b/vlogger.c
index 0393bc8..e3a548e 100644
--- a/vlogger.c
+++ b/vlogger.c
@@ -112,7 +112,17 @@ usage:
 		}
 
 	if (!Sflag && access("/etc/vlogger", X_OK) != -1) {
-		execl("/etc/vlogger", argv0, tag, (char *)0);
+		CODE *cp;
+		const char *sfacility, *slevel;
+		for (cp = prioritynames; cp->c_name; cp++) {
+			if (cp->c_val == level)
+				slevel = cp->c_name;
+		}
+		for (cp = facilitynames; cp->c_name; cp++) {
+			if (cp->c_val == facility)
+				sfacility = cp->c_name;
+		}
+		execl("/etc/vlogger", argv0, tag, slevel, sfacility, (char *)0);
 		fprintf(stderr, "vlogger: exec: %s\n", strerror(errno));
 		exit(1);
 	}