...Need to print just a few more newlines.
diff --git a/sed.c b/sed.c
index 21614fc..1c22770 100644
--- a/sed.c
+++ b/sed.c
@@ -579,7 +579,10 @@
 
 	/* 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 @@
 	switch (sed_cmd->cmd) {
 
 		case 'p':
-			fputs(line, stdout);
+			puts(line);
 			break;
 
 		case 'd':