diff --git a/dmesg.c b/dmesg.c index acccee5..bb72d3b 100644 --- a/dmesg.c +++ b/dmesg.c @@ -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; }