bug#22911: Minor doc changes to clarify the use of multiple -e, -f

2016-04-10 Thread Paul Eggert
Thanks for the bug report. I installed the attached, which is not quite the same 
as the patches you suggested, but which should address the issues.
From 0269180966fe6e084b8d8af1a61a3d521ad7e081 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Sun, 10 Apr 2016 21:27:35 -0700
Subject: [PATCH] grep: minor doc tweaks inspired by Debian
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Santiago Ruano Rincón in: http://bugs.gnu.org/22911
* doc/grep.in.1:
* doc/grep.texi (Matching Control, grep Programs)
(Regular Expressions):
Document -e, -f, and PCRE more carefully.
---
 doc/grep.in.1 | 18 +++---
 doc/grep.texi | 18 ++
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/doc/grep.in.1 b/doc/grep.in.1
index ade11b4..1a3b7d2 100644
--- a/doc/grep.in.1
+++ b/doc/grep.in.1
@@ -98,9 +98,7 @@ as a basic regular expression (BRE, see below).
 This is the default.
 .TP
 .BR \-P ", " \-\^\-perl\-regexp
-Interpret
-.I PATTERN
-as a Perl regular expression (PCRE, see below).
+Interpret the pattern as a Perl-compatible regular expression (PCRE).
 This is highly experimental and
 .B "grep \-P"
 may warn of unimplemented features.
@@ -110,14 +108,20 @@ may warn of unimplemented features.
 Use
 .I PATTERN
 as the pattern.
-This can be used to specify multiple search patterns,
-or to protect a pattern beginning with a hyphen
-.RB ( \- ).
+If this option is used multiple times or is combined with the
+.B \-f
+.RB ( \-\-file )
+option, search for all patterns given.
+This option can be used to protect a pattern beginning with \*(lq\-\*(rq.
 .TP
 .BI \-f " FILE" "\fR,\fP \-\^\-file=" FILE
 Obtain patterns from
 .IR FILE ,
 one per line.
+If this option is used multiple times or is combined with the
+.B \-e
+.RB ( \-\-regexp )
+option, search for all patterns given.
 The empty file contains zero patterns, and therefore matches nothing.
 .TP
 .BR \-i ", " \-\^\-ignore\-case
@@ -545,7 +549,7 @@ extended syntaxes.
 In other implementations, basic regular expressions are less powerful.
 The following description applies to extended regular expressions;
 differences for basic regular expressions are summarized afterwards.
-Perl regular expressions give additional functionality, and are
+Perl-compatible regular expressions give additional functionality, and are
 documented in pcresyntax(3) and pcrepattern(3), but work only if
 PCRE is available in the system.
 .PP
diff --git a/doc/grep.texi b/doc/grep.texi
index 4e0e48e..80768dd 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -175,8 +175,8 @@ This version number should be included in all bug reports.
 @opindex --regexp=@var{pattern}
 @cindex pattern list
 Use @var{pattern} as the pattern.
-This can be used to specify multiple search patterns,
-or to protect a pattern beginning with a @samp{-}.
+If this option is used multiple times or is combined with the
+@option{-f} (@option{--file}) option, search for all patterns given.
 (@option{-e} is specified by POSIX.)
 
 @item -f @var{file}
@@ -185,6 +185,8 @@ or to protect a pattern beginning with a @samp{-}.
 @opindex --file
 @cindex pattern from file
 Obtain patterns from @var{file}, one per line.
+If this option is used multiple times or is combined with the
+@option{-e} (@option{--regexp}) option, search for all patterns given.
 The empty file contains zero patterns, and therefore matches nothing.
 (@option{-f} is specified by POSIX.)
 
@@ -1116,8 +1118,8 @@ expressions), separated by newlines, any of which is to 
be matched.
 @itemx --perl-regexp
 @opindex -P
 @opindex --perl-regexp
-@cindex matching Perl regular expressions
-Interpret the pattern as a Perl regular expression.
+@cindex matching Perl-compatible regular expressions
+Interpret the pattern as a Perl-compatible regular expression (PCRE).
 This is highly experimental and
 @samp{grep@ -P} may warn of unimplemented features.
 
@@ -1142,16 +1144,16 @@ Regular expressions are constructed analogously to 
arithmetic expressions,
 by using various operators to combine smaller expressions.
 @command{grep} understands
 three different versions of regular expression syntax:
-``basic,'' (BRE) ``extended'' (ERE) and ``perl''.
+``basic'' (BRE), ``extended'' (ERE) and ``perl'' (PCRE).
 In GNU @command{grep},
 there is no difference in available functionality between the basic and
 extended syntaxes.
 In other implementations, basic regular expressions are less powerful.
 The following description applies to extended regular expressions;
 differences for basic regular expressions are summarized afterwards.
-Perl regular expressions give additional functionality, and are
-documented in the @i{pcresyntax}(3) and @i{pcrepattern}(3) manual pages,
-but work only if PCRE is available in the system.
+Perl-compatible regular expressions give additional functionality, and
+are documented in the @i{pcresyntax}(3) and @i{pcrepattern}(3) manual
+pages, but work only if PCRE is available in the system

bug#22911: Minor doc changes to clarify the use of multiple -e, -f

2016-03-04 Thread Santiago Ruano Rincón
And now that I'm cleaning the patches applied to the debian package,
here is another tiny patch.

Cheers,

Santiago
>From 1c86cafdc67c157ce8744da0b32151d1e0f77545 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Santiago=20Ruano=20Rinc=C3=B3n?= 
Date: Fri, 4 Mar 2016 20:01:48 +0100
Subject: [PATCH] doc: consistent PCRE doc between grep.1.in and grep.texi

---
 doc/grep.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/grep.texi b/doc/grep.texi
index 8883b27..39d6276 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -1102,7 +1102,7 @@ expressions), separated by newlines, any of which is to be matched.
 @opindex -P
 @opindex --perl-regexp
 @cindex matching Perl regular expressions
-Interpret the pattern as a Perl regular expression.
+Interpret the pattern as a Perl regular expression (PCRE).
 This is highly experimental and
 @samp{grep@ -P} may warn of unimplemented features.
 
@@ -1127,7 +1127,7 @@ Regular expressions are constructed analogously to arithmetic expressions,
 by using various operators to combine smaller expressions.
 @command{grep} understands
 three different versions of regular expression syntax:
-``basic,'' (BRE) ``extended'' (ERE) and ``perl''.
+``basic,'' (BRE) ``extended'' (ERE) and ``perl'' (PCRE).
 In GNU @command{grep},
 there is no difference in available functionality between the basic and
 extended syntaxes.
-- 
2.4.6



bug#22911: Minor doc changes to clarify the use of multiple -e,-f

2016-03-04 Thread Santiago Ruano Rincón
Hi,

Please consider this patch to clarify the use of multiple -e and -f
options in grep. I think the current documentation is inconsistent with
grep behaviour and POSIX man page for grep.

This patch is intended to close another long-standing bug reported in
Debian: https://bugs.debian.org/356120

Cheers,

Santiago
>From 3e6c7dbb30aa51c08d5b5fd8143051055dc26a43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Santiago=20Ruano=20Rinc=C3=B3n?= 
Date: Fri, 4 Mar 2016 17:52:43 +0100
Subject: [PATCH] doc/ multiple -e,-f arguments

---
 doc/grep.in.1 | 16 ++--
 doc/grep.texi |  6 --
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/doc/grep.in.1 b/doc/grep.in.1
index ade11b4..4713228 100644
--- a/doc/grep.in.1
+++ b/doc/grep.in.1
@@ -35,10 +35,9 @@ grep, egrep, fgrep \- print lines matching a pattern
 .B grep
 .RI [ OPTIONS ]
 .RB [ \-e
-.I PATTERN
-|
-.B \-f
-.IR FILE ]
+.IR PATTERN ].\|.\|.
+.RB [ \-f
+.IR FILE ].\|.\|.
 .RI [ FILE .\|.\|.]
 .
 .SH DESCRIPTION
@@ -110,8 +109,10 @@ may warn of unimplemented features.
 Use
 .I PATTERN
 as the pattern.
-This can be used to specify multiple search patterns,
-or to protect a pattern beginning with a hyphen
+Multiple
+.BR \-e
+can be used to specify different search patterns.
+This option is also useful to protect a pattern beginning with a hyphen
 .RB ( \- ).
 .TP
 .BI \-f " FILE" "\fR,\fP \-\^\-file=" FILE
@@ -119,6 +120,9 @@ Obtain patterns from
 .IR FILE ,
 one per line.
 The empty file contains zero patterns, and therefore matches nothing.
+Multiple
+.BR \-f
+can be used to specify different files.
 .TP
 .BR \-i ", " \-\^\-ignore\-case
 Ignore case distinctions in both the
diff --git a/doc/grep.texi b/doc/grep.texi
index 8883b27..1ad31c7 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -175,8 +175,9 @@ This version number should be included in all bug reports.
 @opindex --regexp=@var{pattern}
 @cindex pattern list
 Use @var{pattern} as the pattern.
-This can be used to specify multiple search patterns,
-or to protect a pattern beginning with a @samp{-}.
+Multiple @option{-e} can be used to specify different search patterns.
+This option is also useful  to protect a pattern beginning with a
+@samp{-}.
 (@option{-e} is specified by POSIX.)
 
 @item -f @var{file}
@@ -186,6 +187,7 @@ or to protect a pattern beginning with a @samp{-}.
 @cindex pattern from file
 Obtain patterns from @var{file}, one per line.
 The empty file contains zero patterns, and therefore matches nothing.
+Multiple @option{-f} can be used to specify different files.
 (@option{-f} is specified by POSIX.)
 
 @item -i
-- 
2.4.6