diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-07-27 11:18:36 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-07-27 11:18:36 +0000 |
commit | eac0c069385430901357de0d511cbf5d9e4d12a6 (patch) | |
tree | 072c5adc7d97de9e37eca13fafca1e6c93a16d8c | |
parent | 0b7dfb5ae73bcc29f1d5dfdb1b37c5b1d34b5904 (diff) | |
download | busybox-w32-eac0c069385430901357de0d511cbf5d9e4d12a6.tar.gz busybox-w32-eac0c069385430901357de0d511cbf5d9e4d12a6.tar.bz2 busybox-w32-eac0c069385430901357de0d511cbf5d9e4d12a6.zip |
allow people to display dmesg output without syslog levels
-rw-r--r-- | util-linux/Config.in | 20 | ||||
-rw-r--r-- | util-linux/dmesg.c | 22 |
2 files changed, 39 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..ecfd90668 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 | * | ||
4 | * dmesg - display/control kernel ring buffer. | 3 | * dmesg - display/control kernel ring buffer. |
5 | * | 4 | * |
6 | * Copyring 2006 Rob Landley <rob@landley.net> | 5 | * Copyright 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,8 +28,24 @@ 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 | write(1,buf,len); | 31 | |
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); | ||
32 | if (len && buf[len-1]!='\n') putchar('\n'); | 45 | if (len && buf[len-1]!='\n') putchar('\n'); |
46 | #endif | ||
47 | |||
48 | if (ENABLE_FEATURE_CLEAN_UP) free(buf); | ||
33 | } | 49 | } |
34 | 50 | ||
35 | return 0; | 51 | return 0; |