summaryrefslogtreecommitdiff
path: root/dmesg.c
diff options
context:
space:
mode:
authorErik Andersen1999-12-29 22:19:46 +0000
committerErik Andersen1999-12-29 22:19:46 +0000
commit1266a13e1f687d34052ae7e2469048d035633e58 (patch)
treedc70d49434faf03d25c199ebbb3d360d95e5fac5 /dmesg.c
parenta89910829c73c5ed4f30eecb181d7b3087ca4f74 (diff)
downloadbusybox-1266a13e1f687d34052ae7e2469048d035633e58.zip
busybox-1266a13e1f687d34052ae7e2469048d035633e58.tar.gz
* sed now supports addresses (numeric or regexp, with negation) and
has an append command, thanks to Marco Pantaleoni <panta@prosa.it> * Fixed dmesg. It wasn't parsing its options (-n or -s) properly. * Some cosmetic fixes to ls output formatting to make it behave more like GNU ls. -Erik
Diffstat (limited to 'dmesg.c')
-rw-r--r--dmesg.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/dmesg.c b/dmesg.c
index aa26f58..e38fd55 100644
--- a/dmesg.c
+++ b/dmesg.c
@@ -44,10 +44,15 @@ int dmesg_main( int argc, char** argv )
int level = 0;
int lastc;
int cmd = 3;
+ int stopDoingThat;
+
+ argc--;
+ argv++;
/* Parse any options */
while (argc && **argv == '-') {
- while (*++(*argv))
+ stopDoingThat = FALSE;
+ while (stopDoingThat == FALSE && *++(*argv)) {
switch (**argv) {
case 'c':
cmd = 4;
@@ -57,19 +62,22 @@ int dmesg_main( int argc, char** argv )
if (--argc == 0)
goto end;
level = atoi (*(++argv));
- --argc;
- ++argv;
+ if (--argc > 0)
+ ++argv;
+ stopDoingThat = TRUE;
break;
case 's':
if (--argc == 0)
goto end;
bufsize = atoi (*(++argv));
- --argc;
- ++argv;
+ if (--argc > 0)
+ ++argv;
+ stopDoingThat = TRUE;
break;
default:
goto end;
}
+ }
}
if (argc > 1) {