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 | |
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.
-rw-r--r-- | util-linux/Config.in | 20 | ||||
-rw-r--r-- | util-linux/dmesg.c | 23 |
2 files changed, 40 insertions, 3 deletions
diff --git a/util-linux/Config.in b/util-linux/Config.in index 501ed6bfc..65d670824 100644 --- a/util-linux/Config.in +++ b/util-linux/Config.in | |||
@@ -17,6 +17,26 @@ config CONFIG_DMESG | |||
17 | are also logged to the system console. Enable this option if you | 17 | are also logged to the system console. Enable this option if you |
18 | wish to enable the 'dmesg' utility. | 18 | wish to enable the 'dmesg' utility. |
19 | 19 | ||
20 | config CONFIG_FEATURE_DMESG_PRETTY | ||
21 | bool "pretty dmesg output" | ||
22 | default y | ||
23 | depends on CONFIG_DMESG | ||
24 | help | ||
25 | If you wish to scrub the syslog level from the output, say 'Y' here. | ||
26 | The syslog level is a string prefixed to every line with the form "<#>". | ||
27 | |||
28 | With this option you will see: | ||
29 | # dmesg | ||
30 | Linux version 2.6.17.4 ..... | ||
31 | BIOS-provided physical RAM map: | ||
32 | BIOS-e820: 0000000000000000 - 000000000009f000 (usable) | ||
33 | |||
34 | Without this option you will see: | ||
35 | # dmesg | ||
36 | <5>Linux version 2.6.17.4 ..... | ||
37 | <6>BIOS-provided physical RAM map: | ||
38 | <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable) | ||
39 | |||
20 | config CONFIG_FBSET | 40 | config CONFIG_FBSET |
21 | bool "fbset" | 41 | bool "fbset" |
22 | default n | 42 | default n |
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; |