ubase

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

commit f2285a1a3548f24b34f5a3ba105f64b315e84e87
parent 7f301a0825536738f555bca0c2f7a960c35a116c
Author: sin <sin@2f30.org>
Date:   Fri, 16 Aug 2013 14:59:53 +0100

Add -c flag for dmesg

Diffstat:
Mdmesg.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 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; }