diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-07-27 15:02:58 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-07-27 15:02:58 +0000 |
commit | 8769cad0b33b2af5dcfdee9e44bb34d798f8ddcb (patch) | |
tree | e437146af41940b454be0d82181b5e37241b315e /util-linux/dmesg.c | |
parent | 6216530ade2ae38e20b816e1a6afc71dd83b3063 (diff) | |
download | busybox-w32-8769cad0b33b2af5dcfdee9e44bb34d798f8ddcb.tar.gz busybox-w32-8769cad0b33b2af5dcfdee9e44bb34d798f8ddcb.tar.bz2 busybox-w32-8769cad0b33b2af5dcfdee9e44bb34d798f8ddcb.zip |
There's no excuse for adding new #ifdefs to the code like that. None at all.
git-svn-id: svn://busybox.net/trunk/busybox@15752 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-rw-r--r-- | util-linux/dmesg.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index ecfd90668..2b59ee23d 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * | ||
3 | * dmesg - display/control kernel ring buffer. | 4 | * dmesg - display/control kernel ring buffer. |
4 | * | 5 | * |
5 | * Copyright 2006 Rob Landley <rob@landley.net> | 6 | * Copyring 2006 Rob Landley <rob@landley.net> |
6 | * Copyright 2006 Erik Andersen <andersen@codepoet.org> | ||
7 | * | 7 | * |
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ | 9 | */ |
@@ -28,24 +28,8 @@ int dmesg_main(int argc, char *argv[]) | |||
28 | buf = xmalloc(len); | 28 | buf = xmalloc(len); |
29 | if (0 > (len = klogctl(3 + (flags & 1), buf, len))) | 29 | if (0 > (len = klogctl(3 + (flags & 1), buf, len))) |
30 | bb_perror_msg_and_die("klogctl"); | 30 | bb_perror_msg_and_die("klogctl"); |
31 | 31 | write(1,buf,len); | |
32 | #ifdef CONFIG_FEATURE_DMESG_PRETTY | ||
33 | { | ||
34 | char newline = '\n'; | ||
35 | int i; | ||
36 | for (i=0; i<len; ++i) { | ||
37 | if (newline == '\n' && buf[i] == '<') | ||
38 | i += 3; /* skip <#> */ | ||
39 | putchar(newline=buf[i]); | ||
40 | } | ||
41 | if (newline != '\n') putchar('\n'); | ||
42 | } | ||
43 | #else | ||
44 | write(1, buf, len); | ||
45 | if (len && buf[len-1]!='\n') putchar('\n'); | 32 | if (len && buf[len-1]!='\n') putchar('\n'); |
46 | #endif | ||
47 | |||
48 | if (ENABLE_FEATURE_CLEAN_UP) free(buf); | ||
49 | } | 33 | } |
50 | 34 | ||
51 | return 0; | 35 | return 0; |