The git patch below makes the sed s/// "i" flag a synonym for the "I" flag.
These flags cause case to be ignored when matching.

GNU sed accepts both "i" and "I". Also, POSIX recently accepted standardizing 
"i" as the flag name:
  http://austingroupbugs.net/view.php?id=779

--- David A. Wheeler

>From c205e463b006b72edac639e784a5100b2eb70243 Mon Sep 17 00:00:00 2001
From: "David A. Wheeler" <dwheeler@localhost.localdomain>
Date: Thu, 5 Dec 2013 20:42:17 -0500
Subject: [PATCH] sed: accept s///i as a synonym for s///I ("ignore case")

Signed-off-by: David A. Wheeler <dwhee...@dwheeler.com>
---
 editors/sed.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/editors/sed.c b/editors/sed.c
index 31fb103..e18e48a 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -381,7 +381,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char 
*substr)
 
        /*
         * A substitution command should look something like this:
-        *    s/match/replace/ #gIpw
+        *    s/match/replace/ #giIpw
         *    ||     |        |||
         *    mandatory       optional
         */
@@ -429,6 +429,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char 
*substr)
                        break;
                }
                /* Ignore case (gnu exension) */
+               case 'i':
                case 'I':
                        cflags |= REG_ICASE;
                        break;
-- 
1.8.3.1

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to