* editors/sed.c (process_file): Stop processing deleted lines.
* testsuite/sed/sed-does-not-substitute-in-delete-line: New.
This commit is contained in:
parent
75ce8d7c88
commit
5c69cd84ff
@ -659,6 +659,7 @@ static void process_file(FILE *file)
|
|||||||
/* we are currently within the beginning & ending address range */
|
/* we are currently within the beginning & ending address range */
|
||||||
still_in_range
|
still_in_range
|
||||||
) {
|
) {
|
||||||
|
int deleted = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* actual sedding
|
* actual sedding
|
||||||
@ -671,6 +672,7 @@ static void process_file(FILE *file)
|
|||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
altered++;
|
altered++;
|
||||||
|
deleted = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
@ -772,6 +774,9 @@ static void process_file(FILE *file)
|
|||||||
else {
|
else {
|
||||||
still_in_range = 1;
|
still_in_range = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deleted)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
testsuite/sed/sed-does-not-substitute-in-deleted-line
Normal file
2
testsuite/sed/sed-does-not-substitute-in-deleted-line
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
echo foo | busybox sed -e /foo/d -e s/foo/bar/ >foo
|
||||||
|
cmp foo /dev/null
|
Loading…
x
Reference in New Issue
Block a user