mirror of
git://git.suckless.org/ubase
synced 2024-12-22 14:42:41 +00:00
Support -C for dmesg(1)
This commit is contained in:
parent
f6cf690aa2
commit
76614ae86b
7
dmesg.c
7
dmesg.c
@ -11,13 +11,14 @@ static int dmesg_show(int fd, const void *buf, size_t n);
|
||||
|
||||
enum {
|
||||
SYSLOG_ACTION_READ_ALL = 3,
|
||||
SYSLOG_ACTION_CLEAR = 5,
|
||||
SYSLOG_ACTION_SIZE_BUFFER = 10
|
||||
};
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s\n", argv0);
|
||||
eprintf("usage: [-C] %s\n", argv0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -27,6 +28,10 @@ main(int argc, char *argv[])
|
||||
char *buf;
|
||||
|
||||
ARGBEGIN {
|
||||
case 'C':
|
||||
if (klogctl(SYSLOG_ACTION_CLEAR, NULL, 0) < 0)
|
||||
eprintf("klogctl:");
|
||||
return 0;
|
||||
default:
|
||||
usage();
|
||||
} ARGEND;
|
||||
|
Loading…
Reference in New Issue
Block a user