mirror of git://git.suckless.org/sbase
Add support for changing the console level in dmesg(1)
This commit is contained in:
parent
301044f834
commit
4ce785f36e
7
dmesg.c
7
dmesg.c
|
@ -12,6 +12,7 @@ static int dmesg_show(int fd, const void *buf, size_t n);
|
||||||
enum {
|
enum {
|
||||||
SYSLOG_ACTION_READ_ALL = 3,
|
SYSLOG_ACTION_READ_ALL = 3,
|
||||||
SYSLOG_ACTION_CLEAR = 5,
|
SYSLOG_ACTION_CLEAR = 5,
|
||||||
|
SYSLOG_ACTION_CONSOLE_LEVEL = 8,
|
||||||
SYSLOG_ACTION_SIZE_BUFFER = 10
|
SYSLOG_ACTION_SIZE_BUFFER = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ main(int argc, char *argv[])
|
||||||
char *buf;
|
char *buf;
|
||||||
int cflag = 0;
|
int cflag = 0;
|
||||||
int rflag = 0;
|
int rflag = 0;
|
||||||
|
long level;
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
case 'C':
|
case 'C':
|
||||||
|
@ -40,6 +42,11 @@ main(int argc, char *argv[])
|
||||||
case 'r':
|
case 'r':
|
||||||
rflag = 1;
|
rflag = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
level = estrtol(EARGF(usage()), 10);
|
||||||
|
if (klogctl(SYSLOG_ACTION_CONSOLE_LEVEL, NULL, level) < 0)
|
||||||
|
eprintf("klogctl:");
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
} ARGEND;
|
} ARGEND;
|
||||||
|
|
Loading…
Reference in New Issue