...Need to print just a few more newlines.
authorMark Whitley <markw@lineo.com>
Mon, 14 May 2001 20:44:26 +0000 (20:44 -0000)
committerMark Whitley <markw@lineo.com>
Mon, 14 May 2001 20:44:26 +0000 (20:44 -0000)
editors/sed.c
sed.c

index 21614fc77749d2ac5dc0e4133bb06040a85e6326..1c227704ecc7135500896918618a597510038039 100644 (file)
@@ -579,7 +579,10 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, const char *line)
 
        /* if there's anything left of the line, print it */
        if (*hackline)
-               fputs(hackline, stdout);
+               puts(hackline);
+       /* otherwise, we need to print a newline */
+       else
+               printf("\n");
 
        /* cleanup */
        free(regmatch);
@@ -594,7 +597,7 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line)
        switch (sed_cmd->cmd) {
 
                case 'p':
-                       fputs(line, stdout);
+                       puts(line);
                        break;
 
                case 'd':
diff --git a/sed.c b/sed.c
index 21614fc77749d2ac5dc0e4133bb06040a85e6326..1c227704ecc7135500896918618a597510038039 100644 (file)
--- a/sed.c
+++ b/sed.c
@@ -579,7 +579,10 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, const char *line)
 
        /* if there's anything left of the line, print it */
        if (*hackline)
-               fputs(hackline, stdout);
+               puts(hackline);
+       /* otherwise, we need to print a newline */
+       else
+               printf("\n");
 
        /* cleanup */
        free(regmatch);
@@ -594,7 +597,7 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line)
        switch (sed_cmd->cmd) {
 
                case 'p':
-                       fputs(line, stdout);
+                       puts(line);
                        break;
 
                case 'd':