aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2020-03-27 16:57:24 -0700
committerRob Landley <rob@landley.net>2020-03-28 00:57:53 -0500
commit92975af3f2654b179178994dce9b12ffaf00cc05 (patch)
tree1f9acb9b6eeaabf9098bab3dead26b8b770bb663 /toys
parenta775773f6e5ae476e611eea74446c096991221c0 (diff)
downloadtoybox-92975af3f2654b179178994dce9b12ffaf00cc05.tar.gz
sed s///: support POSIX I as synonym for i
POSIX chose I rather than i as the case-insensitive flag for s///, because apparently more seds support I than i. We're allegedly alone in only supporting i. (On the Mac, sed supports neither.) Strictly this isn't *currently* in POSIX, but it's been accepted for issue 8. Bug: https://austingroupbugs.net/view.php?id=779#c2050
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/sed.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/sed.c b/toys/posix/sed.c
index fa40dbf5..0896959f 100644
--- a/toys/posix/sed.c
+++ b/toys/posix/sed.c
@@ -143,7 +143,7 @@ config SED
[0-9] A number, substitute only that occurrence of pattern
g Global, substitute all occurrences of pattern
- i Ignore case when matching
+ i/I Ignore case when matching
p Print the line if match was found and replaced
w [file] Write (append) line to file if match replaced
@@ -897,6 +897,7 @@ resume_s:
if (isspace(*line) && *line != '\n') continue;
if (0 <= (l = stridx("igp", *line))) command->sflags |= 1<<l;
+ else if (*line == 'I') command->sflags |= 1<<0;
else if (!(command->sflags>>3) && 0<(l = strtol(line, &line, 10))) {
command->sflags |= l << 3;
line--;