@@ -3898,7 +3898,7 @@ struct Grep {
38983898#if defined(WITH_STDIN_DRAIN) && !defined(OS_WIN)
38993899
39003900 // drain stdin when non-seekable file such as a pipe until eof, unless option -q is used
3901- if (file_in == stdin && !flag_quiet && !feof(stdin) && fseek(stdin, 0, SEEK_END) < 0 && errno != EINVAL)
3901+ if (file_in == stdin && !flag_quiet && !flag_files_with_matches && flag_max_count == 0 && ! feof(stdin) && fseek(stdin, 0, SEEK_END) < 0 && errno != EINVAL)
39023902 {
39033903 char buf[16384];
39043904 while (input.get(buf, sizeof(buf)) > 0)
@@ -14381,10 +14381,9 @@ void help(std::ostream& out)
1438114381 is written.\n\
1438214382 -l, --files-with-matches\n\
1438314383 Only the names of files containing selected lines are written to\n\
14384- standard output. ugrep will only search a file until a match has\n\
14385- been found, making searches potentially less expensive. Pathnames\n\
14386- are listed once per file searched. If the standard input is\n\
14387- searched, the string ``(standard input)'' is written.\n\
14384+ standard output. Pathnames are listed once per file searched. If\n\
14385+ the standard input is searched, the string ``(standard input)'' is\n\
14386+ written. Stop reading input upon the first match.\n\
1438814387 --label=LABEL\n\
1438914388 Displays the LABEL value when input is read from standard input\n\
1439014389 where a file name would normally be printed in the output.\n\
@@ -14403,7 +14402,7 @@ void help(std::ostream& out)
1440314402 with options -O and -t. Every file on the search path is read,\n\
1440414403 making recursive searches potentially more expensive.\n\
1440514404 -m [MIN,][MAX], --min-count=MIN, --max-count=MAX\n\
14406- Require MIN matches, stop after MAX matches when specified. Output \n\
14405+ Require MIN matches, stop reading input after MAX matches, output \n\
1440714406 MIN to MAX matches. For example, -m1 outputs the first match and\n\
1440814407 -cm1, (with a comma) counts nonzero matches. When -u or --ungroup\n\
1440914408 is specified, each individual match counts. See also option -K.\n\
0 commit comments