Preserve whether or not the line was previously altered when running a
authorMatt Kraai <kraai@debian.org>
Mon, 30 Jul 2001 14:05:58 +0000 (14:05 -0000)
committerMatt Kraai <kraai@debian.org>
Mon, 30 Jul 2001 14:05:58 +0000 (14:05 -0000)
subst command (discovery and patch by Jim Gleason).

editors/sed.c
sed.c

index 24b62e5fab6ba669c26c9f21faa018b5efe22c04..a18cfc7c306e0d444c61ddbc5714c444469a9ee7 100644 (file)
@@ -650,12 +650,12 @@ static void process_file(FILE *file)
 
                                                /* we print the line once, unless we were told to be quiet */
                                                if (!be_quiet)
-                                                       altered = do_subst_command(&sed_cmds[i], line);
+                                                       altered |= do_subst_command(&sed_cmds[i], line);
 
                                                /* we also print the line if we were given the 'p' flag
                                                 * (this is quite possibly the second printing) */
                                                if (sed_cmds[i].sub_p)
-                                                       altered = do_subst_command(&sed_cmds[i], line);
+                                                       altered |= do_subst_command(&sed_cmds[i], line);
 
                                                break;
 
diff --git a/sed.c b/sed.c
index 24b62e5fab6ba669c26c9f21faa018b5efe22c04..a18cfc7c306e0d444c61ddbc5714c444469a9ee7 100644 (file)
--- a/sed.c
+++ b/sed.c
@@ -650,12 +650,12 @@ static void process_file(FILE *file)
 
                                                /* we print the line once, unless we were told to be quiet */
                                                if (!be_quiet)
-                                                       altered = do_subst_command(&sed_cmds[i], line);
+                                                       altered |= do_subst_command(&sed_cmds[i], line);
 
                                                /* we also print the line if we were given the 'p' flag
                                                 * (this is quite possibly the second printing) */
                                                if (sed_cmds[i].sub_p)
-                                                       altered = do_subst_command(&sed_cmds[i], line);
+                                                       altered |= do_subst_command(&sed_cmds[i], line);
 
                                                break;