From 93c75d2bad341af383520409fd354dcff3f2c279 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 1 Oct 2018 17:20:35 +0200 Subject: 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. --- src/cmd/grep/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/cmd/grep') 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); -- cgit v1.2.3