ubase

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

commit 76614ae86b9b8a3d0fa3e75f8d1ada3df33d7d66
parent f6cf690aa212922c4c1b97027d16728d8a8ee99d
Author: sin <sin@2f30.org>
Date:   Wed, 14 Aug 2013 14:34:57 +0100

Support -C for dmesg(1)

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

diff --git a/dmesg.c b/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;