Add -c flag for dmesg

This commit is contained in:
sin 2013-08-16 14:59:53 +01:00
parent 7f301a0825
commit f2285a1a35

View File

@ -18,7 +18,7 @@ enum {
static void
usage(void)
{
eprintf("usage: [-C] %s\n", argv0);
eprintf("usage: [-Cc] %s\n", argv0);
}
int
@ -26,12 +26,16 @@ main(int argc, char *argv[])
{
int n;
char *buf;
int cflag = 0;
ARGBEGIN {
case 'C':
if (klogctl(SYSLOG_ACTION_CLEAR, NULL, 0) < 0)
eprintf("klogctl:");
return 0;
case 'c':
cflag = 1;
break;
default:
usage();
} ARGEND;
@ -52,6 +56,9 @@ main(int argc, char *argv[])
if (n < 0)
eprintf("dmesg_show:");
if (cflag && klogctl(SYSLOG_ACTION_CLEAR, NULL, 0) < 0)
eprintf("klogctl:");
free(buf);
return 0;
}