ubase

suckless linux base utils
git clone git://git.2f30.org/ubase.git
Log | Files | Refs | README | LICENSE

commit 4ce785f36e3b378d2d8d03c9ce058d5bee249a64
parent 301044f8346ce2deee547bfce2f7134718b10cc5
Author: sin <sin@2f30.org>
Date:   Mon Sep 23 15:13:01 +0100

Add support for changing the console level in dmesg(1)

Diffstat:
dmesg.c | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/dmesg.c b/dmesg.c @@ -12,6 +12,7 @@ static int dmesg_show(int fd, const void *buf, size_t n); enum { SYSLOG_ACTION_READ_ALL = 3, SYSLOG_ACTION_CLEAR = 5, + SYSLOG_ACTION_CONSOLE_LEVEL = 8, SYSLOG_ACTION_SIZE_BUFFER = 10 }; @@ -28,6 +29,7 @@ main(int argc, char *argv[]) char *buf; int cflag = 0; int rflag = 0; + long level; ARGBEGIN { case 'C': @@ -40,6 +42,11 @@ main(int argc, char *argv[]) case 'r': rflag = 1; break; + case 'n': + level = estrtol(EARGF(usage()), 10); + if (klogctl(SYSLOG_ACTION_CONSOLE_LEVEL, NULL, level) < 0) + eprintf("klogctl:"); + return 0; default: usage(); } ARGEND;