[PATCH] sed: Document POSIX -E sed flag that selects EREs (as a synonym for -r)

David A. Wheeler dwheeler at dwheeler.com
Wed Oct 30 03:08:21 UTC 2013


From e4db14e51aba9e809b92ae4e5859be30363f59e9 Mon Sep 17 00:00:00 2001
From: David A. Wheeler <dwheeler at dwheeler.com>
Date: Tue, 29 Oct 2013 23:11:46 -0400
Subject: [PATCH] sed: Document POSIX -E sed flag that selects EREs (as a synonym for -r)

Document the sed "-E" flag that selects extended regular expressions
(EREs), e.g., so "--help" will show it.

Busybox already supports the POSIX/BSD sed option "-E" to select
extended regular expressions (EREs), as described here:
  http://austingroupbugs.net/view.php?id=528

Signed-off-by: David A. Wheeler <dwheeler at dwheeler.com>
---
 editors/sed.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/editors/sed.c b/editors/sed.c
index ef46284..0762827 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -56,18 +56,20 @@
  * Reference
  * http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html
  * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
+ * http://austingroupbugs.net/view.php?id=528
  */
 
 //usage:#define sed_trivial_usage
-//usage:       "[-inr] [-f FILE]... [-e CMD]... [FILE]...\n"
-//usage:       "or: sed [-inr] CMD [FILE]..."
+//usage:       "[-inEr] [-f FILE]... [-e CMD]... [FILE]...\n"
+//usage:       "or: sed [-inEr] CMD [FILE]..."
 //usage:#define sed_full_usage "\n\n"
 //usage:       "	-e CMD	Add CMD to sed commands to be executed"
 //usage:     "\n	-f FILE	Add FILE contents to sed commands to be executed"
 //usage:     "\n	-i[SFX]	Edit files in-place (otherwise sends to stdout)"
 //usage:     "\n		Optionally back files up, appending SFX"
 //usage:     "\n	-n	Suppress automatic printing of pattern space"
-//usage:     "\n	-r	Use extended regex syntax"
+//usage:     "\n	-E	Use extended regex (ERE) syntax (per POSIX)"
+//usage:     "\n	-r	Use ERE syntax (same as -E for backwards compatibility)"
 //usage:     "\n"
 //usage:     "\nIf no -e or -f, the first non-option argument is the sed command string."
 //usage:     "\nRemaining arguments are input files (stdin if none)."
@@ -1406,7 +1408,7 @@ int sed_main(int argc UNUSED_PARAM, char **argv)
 	static const char sed_longopts[] ALIGN1 =
 		/* name             has_arg             short */
 		"in-place\0"        Optional_argument   "i"
-		"regexp-extended\0" No_argument         "r"
+		"regexp-extended\0" No_argument         "E"
 		"quiet\0"           No_argument         "n"
 		"silent\0"          No_argument         "n"
 		"expression\0"      Required_argument   "e"
-- 
1.6.2.5

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-sed-Document-POSIX-E-sed-flag-that-selects-EREs-a.patch
Type: text/x-diff
Size: 2480 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20131029/ddb17ed3/attachment.bin>


More information about the busybox mailing list