diff options
author | Rob Landley <rob@landley.net> | 2006-07-27 16:40:55 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-07-27 16:40:55 +0000 |
commit | 446129adaed302eb499fb2a1e55b5d72ece98386 (patch) | |
tree | 2f7f97237a4c90dee9d9e2d7f107d7f633a6f5e3 /util-linux/dmesg.c | |
parent | 52c7d7ebf3ed05f24147210aa969b69bdabcc135 (diff) | |
download | busybox-w32-446129adaed302eb499fb2a1e55b5d72ece98386.tar.gz busybox-w32-446129adaed302eb499fb2a1e55b5d72ece98386.tar.bz2 busybox-w32-446129adaed302eb499fb2a1e55b5d72ece98386.zip |
Add back in non-ifdef version of FEATURE_PRETTY_PRINT, and get the attribution
right this time.
Diffstat (limited to '')
-rw-r--r-- | util-linux/dmesg.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 2b59ee23d..34519dfd1 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c | |||
@@ -3,7 +3,8 @@ | |||
3 | * | 3 | * |
4 | * dmesg - display/control kernel ring buffer. | 4 | * dmesg - display/control kernel ring buffer. |
5 | * | 5 | * |
6 | * Copyring 2006 Rob Landley <rob@landley.net> | 6 | * Copyright 2006 Rob Landley <rob@landley.net> |
7 | * Copyright 2006 Bernhard Fischer <rep.nop@aon.at> | ||
7 | * | 8 | * |
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 9 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ | 10 | */ |
@@ -28,8 +29,24 @@ int dmesg_main(int argc, char *argv[]) | |||
28 | buf = xmalloc(len); | 29 | buf = xmalloc(len); |
29 | if (0 > (len = klogctl(3 + (flags & 1), buf, len))) | 30 | if (0 > (len = klogctl(3 + (flags & 1), buf, len))) |
30 | bb_perror_msg_and_die("klogctl"); | 31 | bb_perror_msg_and_die("klogctl"); |
31 | write(1,buf,len); | 32 | |
32 | if (len && buf[len-1]!='\n') putchar('\n'); | 33 | // Skip <#> at the start of lines, and make sure we end with a newline. |
34 | |||
35 | if (ENABLE_FEATURE_DMESG_PRETTY) { | ||
36 | int last = '\n'; | ||
37 | int in; | ||
38 | |||
39 | for (in = 0; in<len;) { | ||
40 | if (last == '\n' && buf[in] == '<') in += 3; | ||
41 | else putchar(last = buf[in++]); | ||
42 | } | ||
43 | if (last != '\n') putchar('\n'); | ||
44 | } else { | ||
45 | write(1,buf,len); | ||
46 | if (len && buf[len-1]!='\n') putchar('\n'); | ||
47 | } | ||
48 | |||
49 | if (ENABLE_FEATURE_CLEAN_UP) free(buf); | ||
33 | } | 50 | } |
34 | 51 | ||
35 | return 0; | 52 | return 0; |