/* process the flags */
sed_cmd->which_match = 1;
+ dbg("s flags:'%s'", substr + idx + 1);
while (substr[++idx]) {
+ dbg("s flag:'%c'", substr[idx]);
/* Parse match number */
if (isdigit(substr[idx])) {
if (match[0] != '^') {
const char *pos = substr + idx;
/* FIXME: error check? */
sed_cmd->which_match = (unsigned)strtol(substr+idx, (char**) &pos, 10);
- idx = pos - substr;
+ idx = pos - substr - 1;
}
continue;
}
case '}':
goto out;
default:
+ dbg("s bad flags:'%s'", substr + idx);
bb_error_msg_and_die("bad option in substitution expression");
}
}
continuation
"
+testing "sed s///NUM test" \
+ "sed -e 's/a/b/2; s/a/c/g'" \
+ "cb\n" "" "aa\n"
+
# testing "description" "commands" "result" "infile" "stdin"
exit $FAILCOUNT