aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/editors/sed.c b/editors/sed.c
index e18e48ab5..e1b8352fd 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -395,7 +395,9 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char *substr)
395 /* process the flags */ 395 /* process the flags */
396 396
397 sed_cmd->which_match = 1; 397 sed_cmd->which_match = 1;
398 dbg("s flags:'%s'", substr + idx + 1);
398 while (substr[++idx]) { 399 while (substr[++idx]) {
400 dbg("s flag:'%c'", substr[idx]);
399 /* Parse match number */ 401 /* Parse match number */
400 if (isdigit(substr[idx])) { 402 if (isdigit(substr[idx])) {
401 if (match[0] != '^') { 403 if (match[0] != '^') {
@@ -403,7 +405,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char *substr)
403 const char *pos = substr + idx; 405 const char *pos = substr + idx;
404/* FIXME: error check? */ 406/* FIXME: error check? */
405 sed_cmd->which_match = (unsigned)strtol(substr+idx, (char**) &pos, 10); 407 sed_cmd->which_match = (unsigned)strtol(substr+idx, (char**) &pos, 10);
406 idx = pos - substr; 408 idx = pos - substr - 1;
407 } 409 }
408 continue; 410 continue;
409 } 411 }
@@ -443,6 +445,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char *substr)
443 case '}': 445 case '}':
444 goto out; 446 goto out;
445 default: 447 default:
448 dbg("s bad flags:'%s'", substr + idx);
446 bb_error_msg_and_die("bad option in substitution expression"); 449 bb_error_msg_and_die("bad option in substitution expression");
447 } 450 }
448 } 451 }