summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-05-24 02:18:14 -0400
committerRich Felker <dalias@aerifal.cx>2012-05-24 02:18:14 -0400
commitbab9382cf98b1592153ffb9c54791a3f719ac750 (patch)
tree1214eeae3210076e28ec24c1201d093d6c51cd8d
parentfb7e2c415899af562b7d5e080f8d06ffaed09586 (diff)
downloadnoxcuse-bab9382cf98b1592153ffb9c54791a3f719ac750.tar.gz
grep was broken with -e (wrongly exited with usage())
-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)