diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-07-10 17:02:49 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-07-10 17:02:49 +0000 |
commit | 88ae4dea2b26c6ff7f11321fd139b96b7638da55 (patch) | |
tree | f7c2ffb086d2becdb2506909206a78aafed9a048 /usr.bin/grep/grep.c | |
parent | 3c2da0b399f449f80cde29a5ae4ba45a8414e3e7 (diff) |
grep should exit(2) on error, not exit(1) (1 means no matches found).
deraadt@ OK
Diffstat (limited to 'usr.bin/grep/grep.c')
-rw-r--r-- | usr.bin/grep/grep.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c index 939a706491d..6cfa2f7f61c 100644 --- a/usr.bin/grep/grep.c +++ b/usr.bin/grep/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.19 2003/07/10 16:51:12 deraadt Exp $ */ +/* $OpenBSD: grep.c,v 1.20 2003/07/10 17:02:48 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -190,7 +190,7 @@ read_patterns(char *fn) int nl; if ((f = fopen(fn, "r")) == NULL) - err(1, "%s", fn); + err(2, "%s", fn); nl = 0; while ((line = fgetln(f, &len)) != NULL) { if (*line == '\n') { @@ -205,7 +205,7 @@ read_patterns(char *fn) add_pattern(line, len); } if (ferror(f)) - err(1, "%s", fn); + err(2, "%s", fn); fclose(f); } @@ -426,7 +426,7 @@ main(int argc, char *argv[]) if ((c = regcomp(&r_pattern[i], pattern[i], cflags))) { regerror(c, &r_pattern[i], re_error, RE_ERROR_BUF); - errx(1, "%s", re_error); + errx(2, "%s", re_error); } } } |