summaryrefslogtreecommitdiff
path: root/editors/sed.c
diff options
context:
space:
mode:
authorMatt Kraai2002-04-01 16:17:37 +0000
committerMatt Kraai2002-04-01 16:17:37 +0000
commit5c69cd84ffe92b3b51d1ca766c34b5cd028dd0ca (patch)
tree7a6647361bb85fdf621cab6e222b07643b8e905d /editors/sed.c
parent75ce8d7c8886886a2852ccfc44a962f43e1e8a71 (diff)
downloadbusybox-5c69cd84ffe92b3b51d1ca766c34b5cd028dd0ca.zip
busybox-5c69cd84ffe92b3b51d1ca766c34b5cd028dd0ca.tar.gz
* editors/sed.c (process_file): Stop processing deleted lines.
* testsuite/sed/sed-does-not-substitute-in-delete-line: New.
Diffstat (limited to 'editors/sed.c')
-rw-r--r--editors/sed.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 31b9de0..5edcd48 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -659,6 +659,7 @@ static void process_file(FILE *file)
/* we are currently within the beginning & ending address range */
still_in_range
) {
+ int deleted = 0;
/*
* actual sedding
@@ -671,6 +672,7 @@ static void process_file(FILE *file)
case 'd':
altered++;
+ deleted = 1;
break;
case 's':
@@ -772,6 +774,9 @@ static void process_file(FILE *file)
else {
still_in_range = 1;
}
+
+ if (deleted)
+ break;
}
}