summaryrefslogtreecommitdiff
path: root/sed.c
diff options
context:
space:
mode:
authorMark Whitley2000-07-14 00:13:52 +0000
committerMark Whitley2000-07-14 00:13:52 +0000
commit02008346c0e278701945652cd5fac5239c96891c (patch)
tree5d84a2fcec7a8297e5426f92590bd4b22b65b9b9 /sed.c
parent94074a980c3f72e3765fcb43f1056b509ec800b5 (diff)
downloadbusybox-02008346c0e278701945652cd5fac5239c96891c.zip
busybox-02008346c0e278701945652cd5fac5239c96891c.tar.gz
Added error checking for edit commands; only a beginning address can be
specified.
Diffstat (limited to 'sed.c')
-rw-r--r--sed.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sed.c b/sed.c
index 1eea128..115783f 100644
--- a/sed.c
+++ b/sed.c
@@ -361,8 +361,11 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
parse_subst_cmd(sed_cmd, &cmdstr[idx]);
/* special-case handling for (a)ppend, (i)nsert, and (c)hange */
- if (strchr("aic", cmdstr[idx]))
+ if (strchr("aic", cmdstr[idx])) {
+ if (sed_cmd->end_line || sed_cmd->end_match)
+ fatalError("only a beginning address can be specified for edit commands\n");
parse_edit_cmd(sed_cmd, &cmdstr[idx]);
+ }
}
static void add_cmd_str(const char *cmdstr)