aboutsummaryrefslogtreecommitdiff
path: root/editors/sed.c
diff options
context:
space:
mode:
authorkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-12-21 16:04:12 +0000
committerkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-12-21 16:04:12 +0000
commit76d11e694ea128811b5c1233caa848c86c49defc (patch)
tree19c76665ded18142165cf21d9cf168679ac86581 /editors/sed.c
parent82f5e3a18c93581a1765190af2a908897833e8f3 (diff)
downloadbusybox-w32-76d11e694ea128811b5c1233caa848c86c49defc.tar.gz
busybox-w32-76d11e694ea128811b5c1233caa848c86c49defc.tar.bz2
busybox-w32-76d11e694ea128811b5c1233caa848c86c49defc.zip
Ignore blanks before the first address and before the command.
git-svn-id: svn://busybox.net/trunk/busybox@3938 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'editors/sed.c')
-rw-r--r--editors/sed.c8
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
414 * part1 part2 part3 414 * part1 part2 part3
415 */ 415 */
416 416
417 /* skip initial whitespace */
418 while (isspace(cmdstr[idx]))
419 idx++;
420
417 /* first part (if present) is an address: either a number or a /regex/ */ 421 /* first part (if present) is an address: either a number or a /regex/ */
418 if (isdigit(cmdstr[idx]) || cmdstr[idx] == '/') 422 if (isdigit(cmdstr[idx]) || cmdstr[idx] == '/')
419 idx = get_address(sed_cmd, cmdstr, &sed_cmd->beg_line, &sed_cmd->beg_match); 423 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
422 if (cmdstr[idx] == ',') 426 if (cmdstr[idx] == ',')
423 idx += get_address(sed_cmd, &cmdstr[++idx], &sed_cmd->end_line, &sed_cmd->end_match); 427 idx += get_address(sed_cmd, &cmdstr[++idx], &sed_cmd->end_line, &sed_cmd->end_match);
424 428
429 /* skip whitespace before the command */
430 while (isspace(cmdstr[idx]))
431 idx++;
432
425 /* last part (mandatory) will be a command */ 433 /* last part (mandatory) will be a command */
426 if (cmdstr[idx] == '\0') 434 if (cmdstr[idx] == '\0')
427 error_msg_and_die("missing command"); 435 error_msg_and_die("missing command");