summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/grep.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/grep.c b/src/grep.c
index c5ea6f0..bf1b70f 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -86,8 +86,10 @@ int main(int argc, char **argv)
flags |= 1U << strchr(optpat, b)-optpat;
if (b-'e'<2U) addpats(argv[0], b, optarg);
}
- if (!argv[optind]) usage();
- if (!head) addpats(argv[0], 'e', argv[optind++]);
+ if (!head) {
+ if (!argv[optind]) usage();
+ addpats(argv[0], 'e', argv[optind++]);
+ }
if (!(flags & FLAG_F)) {
int re_opts = (flags & FLAG_E)