/* 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);
switch (sed_cmd->cmd) {
case 'p':
- fputs(line, stdout);
+ puts(line);
break;
case 'd':
/* 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);
switch (sed_cmd->cmd) {
case 'p':
- fputs(line, stdout);
+ puts(line);
break;
case 'd':