aboutsummaryrefslogtreecommitdiff
path: root/dmesg.c
diff options
context:
space:
mode:
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 aa26f5836..e38fd5555 100644
--- a/dmesg.c
+++ b/dmesg.c
@@ -44,10 +44,15 @@ int dmesg_main( int argc, char** argv )
44 int level = 0; 44 int level = 0;
45 int lastc; 45 int lastc;
46 int cmd = 3; 46 int cmd = 3;
47 int stopDoingThat;
48
49 argc--;
50 argv++;
47 51
48 /* Parse any options */ 52 /* Parse any options */
49 while (argc && **argv == '-') { 53 while (argc && **argv == '-') {
50 while (*++(*argv)) 54 stopDoingThat = FALSE;
55 while (stopDoingThat == FALSE && *++(*argv)) {
51 switch (**argv) { 56 switch (**argv) {
52 case 'c': 57 case 'c':
53 cmd = 4; 58 cmd = 4;
@@ -57,19 +62,22 @@ int dmesg_main( int argc, char** argv )
57 if (--argc == 0) 62 if (--argc == 0)
58 goto end; 63 goto end;
59 level = atoi (*(++argv)); 64 level = atoi (*(++argv));
60 --argc; 65 if (--argc > 0)
61 ++argv; 66 ++argv;
67 stopDoingThat = TRUE;
62 break; 68 break;
63 case 's': 69 case 's':
64 if (--argc == 0) 70 if (--argc == 0)
65 goto end; 71 goto end;
66 bufsize = atoi (*(++argv)); 72 bufsize = atoi (*(++argv));
67 --argc; 73 if (--argc > 0)
68 ++argv; 74 ++argv;
75 stopDoingThat = TRUE;
69 break; 76 break;
70 default: 77 default:
71 goto end; 78 goto end;
72 } 79 }
80 }
73 } 81 }
74 82
75 if (argc > 1) { 83 if (argc > 1) {