aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-09-15 15:31:40 -0500
committerRob Landley <rob@landley.net>2019-09-15 15:31:40 -0500
commitd9b601e05630bc472c2f061d6d73b8a1ed415f90 (patch)
tree2f915d5601e798230661d62fd8a9845f495ff6d4 /toys
parentcd7487d66bf751a77665da353304f1c62f47605c (diff)
downloadtoybox-d9b601e05630bc472c2f061d6d73b8a1ed415f90.tar.gz
The ! changes I meant to check in last time were applied ot the wrong dir.
(oops.)
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/sed.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/toys/posix/sed.c b/toys/posix/sed.c
index d958ab70..1935417d 100644
--- a/toys/posix/sed.c
+++ b/toys/posix/sed.c
@@ -40,7 +40,7 @@ config SED
apply only to the specified line(s). Commands without an address apply to
every line. Addresses are of the form:
- [ADDRESS[,ADDRESS]]COMMAND
+ [ADDRESS[,ADDRESS]][!]COMMAND
The ADDRESS may be a decimal line number (starting at 1), a /regular
expression/ within a pair of forward slashes, or the character "$" which
@@ -69,6 +69,8 @@ config SED
Each COMMAND starts with a single character. The following commands take
no arguments:
+ ! Run this command when the test _didn't_ match.
+
{ Start a new command block, continuing until a corresponding "}".
Command blocks may nest. If the block has an address, commands within
the block are only run for lines within the block's address range.
@@ -821,11 +823,12 @@ static void parse_pattern(char **pline, long len)
while (isspace(*line)) line++;
if (!*line) break;
- while (*line == '!') {
+ if (*line == '!') {
command->not = 1;
line++;
}
while (isspace(*line)) line++;
+ if (!*line) break;
c = command->c = *(line++);
if (strchr("}:", c) && i) break;