Fix empty line substitutions (noted by Joshua Hudson).
This commit is contained in:
parent
6ccdd8c122
commit
8470b9a85c
@ -589,8 +589,8 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, char **line)
|
|||||||
|
|
||||||
/* and now, as long as we've got a line to try matching and if we can match
|
/* and now, as long as we've got a line to try matching and if we can match
|
||||||
* the search string, we make substitutions */
|
* the search string, we make substitutions */
|
||||||
while (*hackline && (regexec(sed_cmd->sub_match, hackline,
|
while ((*hackline || !altered) && (regexec(sed_cmd->sub_match, hackline,
|
||||||
sed_cmd->num_backrefs+1, regmatch, 0) == 0) ) {
|
sed_cmd->num_backrefs+1, regmatch, 0) != REG_NOMATCH) ) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* print everything before the match */
|
/* print everything before the match */
|
||||||
|
4
sed.c
4
sed.c
@ -589,8 +589,8 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, char **line)
|
|||||||
|
|
||||||
/* and now, as long as we've got a line to try matching and if we can match
|
/* and now, as long as we've got a line to try matching and if we can match
|
||||||
* the search string, we make substitutions */
|
* the search string, we make substitutions */
|
||||||
while (*hackline && (regexec(sed_cmd->sub_match, hackline,
|
while ((*hackline || !altered) && (regexec(sed_cmd->sub_match, hackline,
|
||||||
sed_cmd->num_backrefs+1, regmatch, 0) == 0) ) {
|
sed_cmd->num_backrefs+1, regmatch, 0) != REG_NOMATCH) ) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* print everything before the match */
|
/* print everything before the match */
|
||||||
|
Loading…
Reference in New Issue
Block a user