diff options
author | Matt Kraai <kraai@debian.org> | 2001-12-21 16:04:12 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-12-21 16:04:12 +0000 |
commit | 70624846fdfb95ed3913d86cd5e72116791b9070 (patch) | |
tree | 19c76665ded18142165cf21d9cf168679ac86581 /editors | |
parent | 1fcc66e68550ca470074bf4e204efd9d418d8f9a (diff) | |
download | busybox-70624846fdfb95ed3913d86cd5e72116791b9070.tar.gz |
Ignore blanks before the first address and before the command.
Diffstat (limited to 'editors')
-rw-r--r-- | editors/sed.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/editors/sed.c b/editors/sed.c index 7f765842c..fe1c0dbae 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -414,6 +414,10 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd * part1 part2 part3 */ + /* skip initial whitespace */ + while (isspace(cmdstr[idx])) + idx++; + /* first part (if present) is an address: either a number or a /regex/ */ if (isdigit(cmdstr[idx]) || cmdstr[idx] == '/') idx = get_address(sed_cmd, cmdstr, &sed_cmd->beg_line, &sed_cmd->beg_match); @@ -422,6 +426,10 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd if (cmdstr[idx] == ',') idx += get_address(sed_cmd, &cmdstr[++idx], &sed_cmd->end_line, &sed_cmd->end_match); + /* skip whitespace before the command */ + while (isspace(cmdstr[idx])) + idx++; + /* last part (mandatory) will be a command */ if (cmdstr[idx] == '\0') error_msg_and_die("missing command"); |