aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-19 10:28:32 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-05-19 10:28:32 +0000
commitf02efd11c963c6c06540878d8f6ac3fc97d381c2 (patch)
treed1a35b7560110848aa9f88187acdd5f37e349138
parent5e25ddb7d369b6785ec3aaa96cbc0521c22aeb0d (diff)
downloadbusybox-f02efd11c963c6c06540878d8f6ac3fc97d381c2.tar.gz
- improve readability
-rw-r--r--util-linux/dmesg.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 9e834ffd3..b399ab247 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -6,7 +6,7 @@
* Copyright 2006 Rob Landley <rob@landley.net>
* Copyright 2006 Bernhard Fischer <rep.nop@aon.at>
*
- * Licensed under GPLv2, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
#include <sys/klog.h>
@@ -18,17 +18,22 @@ int dmesg_main(int argc ATTRIBUTE_UNUSED, char **argv)
int len;
char *buf;
char *size, *level;
- int flags = getopt32(argv, "cs:n:", &size, &level);
+ unsigned flags = getopt32(argv, "cs:n:", &size, &level);
+ enum {
+ OPT_c = 1<<0,
+ OPT_s = 1<<1,
+ OPT_n = 1<<2
+ };
- if (flags & 4) {
+ if (flags & OPT_n) {
if (klogctl(8, NULL, xatoul_range(level, 0, 10)))
bb_perror_msg_and_die("klogctl");
return EXIT_SUCCESS;
}
- len = (flags & 2) ? xatoul_range(size, 2, INT_MAX) : 16384;
+ len = (flags & OPT_s) ? xatoul_range(size, 2, INT_MAX) : 16384;
buf = xmalloc(len);
- len = klogctl(3 + (flags & 1), buf, len);
+ len = klogctl(3 + (flags & OPT_c), buf, len);
if (len < 0)
bb_perror_msg_and_die("klogctl");
if (len == 0)