aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/grep.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-03-13 22:21:13 -0700
committerRob Landley <rob@landley.net>2019-03-14 10:31:07 -0500
commitcaa5a3b131137d1063ea466e57204b9375701499 (patch)
treebcedf6547bef6368cde5bca82ac047a3dcaa1939 /toys/posix/grep.c
parent4157ed0625ff7b166adac36d97988716651fde9e (diff)
downloadtoybox-caa5a3b131137d1063ea466e57204b9375701499.tar.gz
grep: use TOYFLAG_ARGFAIL for grep too.
Also add a test, and add a test for timeout now it's been fixed.
Diffstat (limited to 'toys/posix/grep.c')
-rw-r--r--toys/posix/grep.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/posix/grep.c b/toys/posix/grep.c
index c9a30882..9239614f 100644
--- a/toys/posix/grep.c
+++ b/toys/posix/grep.c
@@ -10,9 +10,9 @@
* echo hello | grep -f </dev/null
*
-USE_GREP(NEWTOY(grep, "(color):;S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rsvwcl(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EFw]", TOYFLAG_BIN))
-USE_EGREP(OLDTOY(egrep, grep, TOYFLAG_BIN))
-USE_FGREP(OLDTOY(fgrep, grep, TOYFLAG_BIN))
+USE_GREP(NEWTOY(grep, "(color):;S(exclude)*M(include)*ZzEFHIab(byte-offset)h(no-filename)ino(only-matching)rsvwcl(files-with-matches)q(quiet)(silent)e*f*C#B#A#m#x[!wx][!EFw]", TOYFLAG_BIN|TOYFLAG_ARGFAIL(2)))
+USE_EGREP(OLDTOY(egrep, grep, TOYFLAG_BIN|TOYFLAG_ARGFAIL(2)))
+USE_FGREP(OLDTOY(fgrep, grep, TOYFLAG_BIN|TOYFLAG_ARGFAIL(2)))
config GREP
bool "grep"
@@ -22,7 +22,7 @@ config GREP
Show lines matching regular expressions. If no -e, first argument is
regular expression to match. With no files (or "-" filename) read stdin.
- Returns 0 if matched, 1 if no match found.
+ Returns 0 if matched, 1 if no match found, 2 for command errors.
-e Regex to match. (May be repeated.)
-f File listing regular expressions to match.