diff options
author | Glenn L McGrath | 2003-09-16 01:46:36 +0000 |
---|---|---|
committer | Glenn L McGrath | 2003-09-16 01:46:36 +0000 |
commit | 204ff1cea49c958846cd49175fa9318b81b5756f (patch) | |
tree | a64e6ce8f21b19abda79932248d3439ed3e016e5 /editors/sed.c | |
parent | 96fd1b98f19cd97a534406554f83ae5cab87b3ac (diff) | |
download | busybox-204ff1cea49c958846cd49175fa9318b81b5756f.zip busybox-204ff1cea49c958846cd49175fa9318b81b5756f.tar.gz |
Fix a bug that creapt in recently with substitution subprinting, and add
a test for it.
Diffstat (limited to 'editors/sed.c')
-rw-r--r-- | editors/sed.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/editors/sed.c b/editors/sed.c index da15c4d..a5a9d41 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -914,7 +914,6 @@ static void process_file(FILE * file) #endif /* we print the pattern_space once, unless we were told to be quiet */ substituted |= do_subst_command(sed_cmd, &pattern_space); - #ifdef CONFIG_FEATURE_SED_EMBEDED_NEWLINE /* undo HACK: escape newlines twice so regex can match them */ { @@ -930,10 +929,10 @@ static void process_file(FILE * file) || (sed_cmd->next->cmd != 's'))) { force_print = 1; } - /* we also print the line if we were given the 'p' flag * (this is quite possibly the second printing) */ - if ((sed_cmd->sub_p) && altered) { +// if ((sed_cmd->sub_p) && (!altered || substituted)) { + if ((sed_cmd->sub_p) && (altered || substituted)) { puts(pattern_space); } break; |