Re: GNU sed maintainers, please document GNU sed's "-E" option (which is now in POSIX)

"David A. Wheeler" <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
On Tue, 15 Oct 2013 21:17:42 +0200, [email protected] (Jose E. Marchesi) wrote:
> Hi David.
> 
> Thank you for submitting the patch.  Given that -E has been added to
> POSIX I see nothing wrong on documenting -E along with -r.

Great!

> Would you like to update your patch and resend it using git
> format-patch?
> 
> Thanks :)

Sure.  Here's the updated patch, with all changes requested, using git format-patch.

--- David A. Wheeler



P.S.: The changes requested were:
> Could you please provide a ChangeLog entry documenting the changes?
...
> Please replace `less backslashes' with `fewer backslashes' as Bruce suggested.
... (code snippet)
> That comment about -E being in POSIX is unnecessary.  Just remove the
> comment claiming that -E is not documented.
0001-Modify-documentation-to-note-sed-E-option-now-in.patch (text/x-diff, 7 KB)
From 589881b6f032988d9cb2475ea7b3dec66bf03b51 Mon Sep 17 00:00:00 2001
From: David A. Wheeler <[email protected]>
Date: Tue, 15 Oct 2013 23:36:49 -0400
Subject: [PATCH] Modify documentation to note sed "-E" option, now in POSIX, for EREs.

2013-10-15  David A. Wheeler <[email protected]>
        * doc/sed-in.texi: Document "-E" option to use EREs.
	  GNU sed already supported "-E" as an undocumented synonym
	  for "-r", but "-E" is now in POSIX.
	  See: http://austingroupbugs.net/view.php?id=528.
        * doc/sed.1: Likewise.
        * doc/sed.texi: Likewise.
        * doc/sed.x: Likewise.
        * sed/sed.c: Likewise.
---
 ChangeLog       |    9 +++++++++
 doc/sed-in.texi |   15 ++++++++++++---
 doc/sed.1       |   10 +++++++---
 doc/sed.texi    |   17 +++++++++++++----
 doc/sed.x       |    5 ++++-
 sed/sed.c       |    6 +++---
 6 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4e1a0c2..00bb6cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-10-15  David A. Wheeler <[email protected]>
+	* doc/sed-in.texi: Document "-E" option to use EREs.  GNU sed already
+	  supported "-E" as an undocumented synonym for "-r", but "-E" is now
+	  in POSIX.  See: http://austingroupbugs.net/view.php?id=528.
+	* doc/sed.1: Likewise.
+	* doc/sed.texi: Likewise.
+	* doc/sed.x: Likewise.
+	* sed/sed.c: Likewise.
+
 2013-10-06  Jose E. Marchesi  <[email protected]>
 
 	* basicdefs.h (PATH_MAX): Defined to some constant in case it is
diff --git a/doc/sed-in.texi b/doc/sed-in.texi
index 40ba70b..1ed602f 100644
--- a/doc/sed-in.texi
+++ b/doc/sed-in.texi
@@ -318,8 +318,10 @@ follow the link and edit the ultimate destination of the
 link.  The default behavior is to break the symbolic link,
 so that the link destination will not be modified.
 
-@item -r
+@item -E
+@itemx -r
 @itemx --regexp-extended
+@opindex -E
 @opindex -r
 @opindex --regexp-extended
 @cindex Extended regular expressions, choosing
@@ -327,8 +329,15 @@ so that the link destination will not be modified.
 Use extended regular expressions rather than basic
 regular expressions.  Extended regexps are those that
 @command{egrep} accepts; they can be clearer because they
-usually have less backslashes, but are a @acronym{GNU} extension
-and hence scripts that use them are not portable.
+usually have fewer backslashes.
+Historically this was a @acronym{GNU} extension,
+but the @option{-E}
+extension has since been added to the POSIX standard
+(http://austingroupbugs.net/view.php?id=528),
+so use @option{-E} for portability.
+GNU sed has accepted @option{-E} as an undocumented option for years,
+and *BSD seds have accepted @option{-E} for years as well,
+but scripts that use @option{-E} might not port to other older systems.
 @xref{Extended regexps, , Extended regular expressions}.
 
 @ifset PERL
diff --git a/doc/sed.1 b/doc/sed.1
index 7acbcd0..2f02e64 100644
--- a/doc/sed.1
+++ b/doc/sed.1
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.28.
-.TH SED "1" "February 2013" "sed 4.2.2" "User Commands"
+.TH SED "1" "October 2013" "sed 4.2.2" "User Commands"
 .SH NAME
 sed \- stream editor for filtering and transforming text
 .SH SYNOPSIS
@@ -48,9 +48,10 @@ specify the desired line-wrap length for the `l' command
 .IP
 disable all GNU extensions.
 .HP
-\fB\-r\fR, \fB\-\-regexp\-extended\fR
+\fB\-E\fR, \fB\-r\fR, \fB\-\-regexp\-extended\fR
 .IP
-use extended regular expressions in the script.
+use extended regular expressions in the script
+(for portability use POSIX \fB\-E\fR).
 .HP
 \fB\-s\fR, \fB\-\-separate\fR
 .IP
@@ -367,6 +368,9 @@ and similarly for
 .BR \ea ,
 .BR \et ,
 and other sequences.
+The \fI-E\fP option switches to using extended regular expressions instead;
+the -E option has been supported for years by GNU sed, and is now
+included in POSIX.
 .SH BUGS
 .PP
 E-mail bug reports to
diff --git a/doc/sed.texi b/doc/sed.texi
index 2bee542..a86ac6d 100644
--- a/doc/sed.texi
+++ b/doc/sed.texi
@@ -319,8 +319,10 @@ follow the link and edit the ultimate destination of the
 link.  The default behavior is to break the symbolic link,
 so that the link destination will not be modified.
 
-@item -r
+@item -E
+@itemx -r
 @itemx --regexp-extended
+@opindex -E
 @opindex -r
 @opindex --regexp-extended
 @cindex Extended regular expressions, choosing
@@ -328,8 +330,15 @@ so that the link destination will not be modified.
 Use extended regular expressions rather than basic
 regular expressions.  Extended regexps are those that
 @command{egrep} accepts; they can be clearer because they
-usually have less backslashes, but are a @acronym{GNU} extension
-and hence scripts that use them are not portable.
+usually have fewer backslashes.
+Historically this was a @acronym{GNU} extension,
+but the @option{-E}
+extension has since been added to the POSIX standard
+(http://austingroupbugs.net/view.php?id=528),
+so use @option{-E} for portability.
+GNU sed has accepted @option{-E} as an undocumented option for years,
+and *BSD seds have accepted @option{-E} for years as well,
+but scripts that use @option{-E} might not port to other older systems.
 @xref{Extended regexps, , Extended regular expressions}.
 
 @ifset PERL
@@ -814,7 +823,7 @@ operators.
 @item \@var{digit}
 Matches the @var{digit}-th @code{\(@dots{}\)} parenthesized
 subexpression in the regular expression.  This is called a @dfn{back
-reference}.  Subexpressions are implicitly numbered by counting
+reference}.  Subexpressions are implicity numbered by counting
 occurrences of @code{\(} left-to-right.
 
 @item \n
diff --git a/doc/sed.x b/doc/sed.x
index 433d52f..401bd88 100644
--- a/doc/sed.x
+++ b/doc/sed.x
@@ -4,7 +4,7 @@ sed \- a Stream EDitor
 .nf
 sed [-V] [--version] [--help] [-n] [--quiet] [--silent]
     [-l N] [--line-length=N] [-u] [--unbuffered]
-    [-r] [--regexp-extended] 
+    [-E] [-r] [--regexp-extended]
     [-e script] [--expression=script]
     [-f script-file] [--file=script-file]
     [script-if-no-other-script]
@@ -312,6 +312,9 @@ and similarly for
 .BR \ea ,
 .BR \et ,
 and other sequences.
+The \fI-E\fP option switches to using extended regular expressions instead;
+the -E option has been supported for years by GNU sed, and is now
+included in POSIX.
 
 [SEE ALSO]
 .BR awk (1),
diff --git a/sed/sed.c b/sed/sed.c
index af985e6..cff1505 100644
--- a/sed/sed.c
+++ b/sed/sed.c
@@ -125,8 +125,9 @@ Usage: %s [OPTION]... {script-only-if-no-other-script} [input-file]...\n\
                  specify the desired line-wrap length for the `l' command\n"));
   fprintf(out, _("  --posix\n\
                  disable all GNU extensions.\n"));
-  fprintf(out, _("  -r, --regexp-extended\n\
-                 use extended regular expressions in the script.\n"));
+  fprintf(out, _("  -E, -r, --regexp-extended\n\
+                 use extended regular expressions in the script\n\
+                 (for portability use POSIX -E).\n"));
 #ifdef REG_PERL
   fprintf(out, PERL_HELP);
 #endif
@@ -277,7 +278,6 @@ main(argc, argv)
 	  write_mode = "wb";
 	  break;
 
-	/* Undocumented, for compatibility with BSD sed.  */
 	case 'E':
 	case 'r':
 	  if (extended_regexp_flags)
-- 
1.6.2.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.