diff options
author | David du Colombier <0intro@gmail.com> | 2018-10-01 17:20:35 +0200 |
---|---|---|
committer | David du Colombier <0intro@gmail.com> | 2018-10-01 17:20:35 +0200 |
commit | 93c75d2bad341af383520409fd354dcff3f2c279 (patch) | |
tree | 3415e4a1fccbbac536c50af7ba2918bcca1db848 /src | |
parent | de3b6d5848d5361490ed049154985d01dd5068f9 (diff) | |
download | plan9port-93c75d2bad341af383520409fd354dcff3f2c279.tar.gz plan9port-93c75d2bad341af383520409fd354dcff3f2c279.tar.bz2 plan9port-93c75d2bad341af383520409fd354dcff3f2c279.zip |
grep: update from Plan 9
This change fixes a segfault in grep -e when no argument
has been provided. Thanks to Sean Hinchee for reporting
this issue.
Fixes #186.
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/grep/main.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/grep/main.c b/src/cmd/grep/main.c index d37aeb10..a847d73f 100644 --- a/src/cmd/grep/main.c +++ b/src/cmd/grep/main.c @@ -5,7 +5,7 @@ char *validflags = "bchiLlnsv"; void usage(void) { - fprint(2, "usage: grep [-%s] [-f file] [-e expr] [file ...]\n", validflags); + fprint(2, "usage: grep [-%s] [-e pattern] [-f patternfile] [file ...]\n", validflags); exits("usage"); } @@ -31,12 +31,12 @@ main(int argc, char *argv[]) case 'e': flags['e']++; lineno = 0; - str2top(ARGF()); + str2top(EARGF(usage())); break; case 'f': flags['f']++; - filename = ARGF(); + filename = EARGF(usage()); rein = Bopen(filename, OREAD); if(rein == 0) { fprint(2, "grep: can't open %s: %r\n", filename); |