ubase

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

commit 8f3dabf349b599a257772a8c7dcf0d3307095b7c
parent ab975053c9fd97911c481e46f0ef09c5037020a3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri Feb  6 15:10:34 +0100

dmesg: fix usage and code-style

Diffstat:
dmesg.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