Always print a newline after a matching substitution.
authorMatt Kraai <kraai@debian.org>
Thu, 17 May 2001 01:02:58 +0000 (01:02 -0000)
committerMatt Kraai <kraai@debian.org>
Thu, 17 May 2001 01:02:58 +0000 (01:02 -0000)
editors/sed.c
sed.c

index 1c22770..16e8e18 100644 (file)
@@ -577,12 +577,7 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, const char *line)
                        break;
        }
 
-       /* if there's anything left of the line, print it */
-       if (*hackline)
-               puts(hackline);
-       /* otherwise, we need to print a newline */
-       else
-               printf("\n");
+       puts(hackline);
 
        /* cleanup */
        free(regmatch);
diff --git a/sed.c b/sed.c
index 1c22770..16e8e18 100644 (file)
--- a/sed.c
+++ b/sed.c
@@ -577,12 +577,7 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, const char *line)
                        break;
        }
 
-       /* if there's anything left of the line, print it */
-       if (*hackline)
-               puts(hackline);
-       /* otherwise, we need to print a newline */
-       else
-               printf("\n");
+       puts(hackline);
 
        /* cleanup */
        free(regmatch);