[hackers] [ubase] dmesg: fix usage and code-style || Hiltjo Posthuma
commit 1c7b96de5570bc1219c6d2378ff0d055a20ae591
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Fri Feb 6 15:10:34 2015 +0100
dmesg: fix usage and code-style
diff --git a/dmesg.c b/dmesg.c
index 1c3f5c6..fff1461 100644
--- a/dmesg.c
+++ b/dmesg.c
_AT_@ -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,
_AT_@ -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
_AT_@ -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
Received on Fri Feb 06 2015 - 16:16:29 CET
This archive was generated by hypermail 2.3.0
: Fri Feb 06 2015 - 16:24:21 CET