SUSv3 -q compatibily exit status correction for grep again

This commit is contained in:
"Vladimir N. Oleynik" 2005-09-23 13:50:24 +00:00
parent c96b703ab0
commit bf4497406f

View File

@ -398,7 +398,9 @@ extern int grep_main(int argc, char **argv)
}
#endif
if(be_quiet)
return error_open_count ? 2 : 0;
if(be_quiet && matched)
return 0;
if(error_open_count)
return 2;
return !matched; /* invert return value 0 = success, 1 = failed */
}