ubase

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

commit 1c7b96de5570bc1219c6d2378ff0d055a20ae591
parent 4855f188c129740840a11f7b74f23739eaa69b06
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri,  6 Feb 2015 15:10:34 +0100

dmesg: fix usage and code-style

Diffstat:
Mdmesg.c | 33++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/dmesg.c b/dmesg.c @@ -8,8 +8,6 @@ #include "util.h" -static void dmesg_show(const void *buf, size_t n); - enum { SYSLOG_ACTION_READ_ALL = 3, SYSLOG_ACTION_CLEAR = 5, @@ -18,9 +16,22 @@ enum { }; static void +dmesg_show(const void *buf, size_t n) +{ + const char *p = buf; + ssize_t r; + + r = write(1, p, n); + if (r < 0) + eprintf("write:"); + if (r > 0 && p[r - 1] != '\n') + putchar('\n'); +} + +static void usage(void) { - eprintf("usage: [-Ccr] [-n level] %s\n", argv0); + eprintf("usage: %s [-Ccr] [-n level]\n", argv0); } int @@ -67,17 +78,4 @@ main(int argc, char *argv[]) free(buf); return 0; -} - -static void -dmesg_show(const void *buf, size_t n) -{ - const char *p = buf; - ssize_t r; - - r = write(1, p, n); - if (r < 0) - eprintf("write:"); - if (r > 0 && p[r - 1] != '\n') - putchar('\n'); -} +} +\ No newline at end of file