diff options
author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-09-23 13:44:03 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2005-09-23 13:44:03 +0000 |
commit | c96b703ab08bfa61be4b8a1c034405576ead53ac (patch) | |
tree | 5a7a9c97649bbeb5fe091315eaf45eb7a6504ba7 | |
parent | cf40d8175b230e01eef7a1a0d1c7cb8d1409dab5 (diff) | |
download | busybox-w32-c96b703ab08bfa61be4b8a1c034405576ead53ac.tar.gz busybox-w32-c96b703ab08bfa61be4b8a1c034405576ead53ac.tar.bz2 busybox-w32-c96b703ab08bfa61be4b8a1c034405576ead53ac.zip |
SUSv3 -q compatibily exit status correction for grep
-rw-r--r-- | findutils/grep.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index c3feb2018..986804553 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -376,7 +376,7 @@ extern int grep_main(int argc, char **argv) | |||
376 | if (file == NULL) { | 376 | if (file == NULL) { |
377 | if (!suppress_err_msgs) | 377 | if (!suppress_err_msgs) |
378 | bb_perror_msg("%s", cur_file); | 378 | bb_perror_msg("%s", cur_file); |
379 | error_open_count++; | 379 | error_open_count++; |
380 | } else { | 380 | } else { |
381 | matched += grep_file(file); | 381 | matched += grep_file(file); |
382 | if(matched < 0) { | 382 | if(matched < 0) { |
@@ -398,7 +398,7 @@ extern int grep_main(int argc, char **argv) | |||
398 | } | 398 | } |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | if(error_open_count) | 401 | if(be_quiet) |
402 | return 2; | 402 | return error_open_count ? 2 : 0; |
403 | return !matched; /* invert return value 0 = success, 1 = failed */ | 403 | return !matched; /* invert return value 0 = success, 1 = failed */ |
404 | } | 404 | } |