Subject: Re: bug#25651: closed (Re: bug#25651: Weird output of random files)

From: Paul Eggert <[email-masked]>
Date: Sun, 12 Feb 2017 13:45:16 -0800

[email-masked] wrote:
> This could be made a bit more consistent.

Fair enough, I installed the attached.
>From 96e100ad23ec85bf602064298bf86b22cb358525 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 12 Feb 2017 13:43:01 -0800
Subject: [PATCH] doc: clarify default input (Bug#25651)

* doc/grep.in.1:
* src/grep.c (usage): Clarify default input when -r.
* src/grep.c (usage): Do not bother documenting egrep and fgrep;
the manual is enough.
---
 doc/grep.in.1 | 20 ++++++++++++--------
 src/grep.c    | 16 ++++++----------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/doc/grep.in.1 b/doc/grep.in.1
index e3472f7..ed6382b 100644
--- a/doc/grep.in.1
+++ b/doc/grep.in.1
@@ -43,15 +43,19 @@ grep, egrep, fgrep \- print lines matching a pattern
 .
 .SH DESCRIPTION
 .B grep
-searches the named input
-.IR FILE s
-for lines containing a match to the given
-.IR PATTERN .
-If no files are specified, or if the file
+searches for
+.I PATTERN
+in each
+.IR FILE .
+A
+.I FILE
+of
 .RB "\*(lq" \- "\*(rq"
-is given,
-.B grep
-searches standard input.
+stands for standard input.
+If no
+.I FILE
+is given, recursive searches examine the working directory,
+and nonrecursive searches read standard input.
 By default,
 .B grep
 prints the matching lines.
diff --git a/src/grep.c b/src/grep.c
index 74acb0b..5bc4cd5 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1928,16 +1928,15 @@ usage (int status)
   else
     {
       printf (_("Usage: %s [OPTION]... PATTERN [FILE]...\n"), getprogname ());
-      printf (_("Search for PATTERN in each FILE or standard input.\n"));
-      printf (_("PATTERN is, by default, a basic regular expression (BRE).\n"));
+      printf (_("Search for PATTERN in each FILE.\n"));
       printf (_("\
 Example: %s -i 'hello world' menu.h main.c\n\
 \n\
-Regexp selection and interpretation:\n"), getprogname ());
+Pattern selection and interpretation:\n"), getprogname ());
       printf (_("\
-  -E, --extended-regexp     PATTERN is an extended regular expression (ERE)\n\
+  -E, --extended-regexp     PATTERN is an extended regular expression\n\
   -F, --fixed-strings       PATTERN is a set of newline-separated strings\n\
-  -G, --basic-regexp        PATTERN is a basic regular expression (BRE)\n\
+  -G, --basic-regexp        PATTERN is a basic regular expression (default)\n\
   -P, --perl-regexp         PATTERN is a Perl regular expression\n"));
   /* -X is deliberately undocumented.  */
       printf (_("\
@@ -2011,11 +2010,8 @@ Context control:\n\
                             (MSDOS/Windows)\n\
 \n"));
       printf (_("\
-'egrep' means 'grep -E'.  'fgrep' means 'grep -F'.\n\
-Direct invocation as either 'egrep' or 'fgrep' is deprecated.\n"));
-      printf (_("\
-When FILE is -, read standard input.  With no FILE, read . if a command-line\n\
--r is given, - otherwise.  If fewer than two FILEs are given, assume -h.\n\
+When FILE is '-', read standard input.  With no FILE, read '.' if\n\
+recursive, '-' otherwise.  With fewer than two FILEs, assume -h.\n\
 Exit status is 0 if any line is selected, 1 otherwise;\n\
 if any error occurs and -q is not given, the exit status is 2.\n"));
       emit_bug_reporting_address ();
-- 
2.7.4