Fixed option parsing. Grep would continue grepping, even when given a bad /
authorMark Whitley <markw@lineo.com>
Mon, 9 Apr 2001 23:00:07 +0000 (23:00 -0000)
committerMark Whitley <markw@lineo.com>
Mon, 9 Apr 2001 23:00:07 +0000 (23:00 -0000)
invalid option. Closes bug #1146.

findutils/grep.c
grep.c

index 475b4ef212c1e79950609fc990331587df785638..8c67976470682f7e61b027d657f4d8259faeeafc 100644 (file)
@@ -232,6 +232,8 @@ extern int grep_main(int argc, char **argv)
                                before_buf = (char **)calloc(lines_before, sizeof(char *));
                                break;
 #endif /* BB_FEATURE_GREP_CONTEXT */
+                       default:
+                               show_usage();
                }
        }
 
diff --git a/grep.c b/grep.c
index 475b4ef212c1e79950609fc990331587df785638..8c67976470682f7e61b027d657f4d8259faeeafc 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -232,6 +232,8 @@ extern int grep_main(int argc, char **argv)
                                before_buf = (char **)calloc(lines_before, sizeof(char *));
                                break;
 #endif /* BB_FEATURE_GREP_CONTEXT */
+                       default:
+                               show_usage();
                }
        }