summaryrefslogtreecommitdiffstats
path: root/term-utils/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'term-utils/write.c')
-rw-r--r--term-utils/write.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/term-utils/write.c b/term-utils/write.c
index 696a7a795..40be5c2de 100644
--- a/term-utils/write.c
+++ b/term-utils/write.c
@@ -220,18 +220,13 @@ static void signal_handler(int signo)
*/
static void write_line(char *s)
{
- char c;
-
-#define PUTC(c) if (fputc_careful(c, stdout, '^') == EOF) \
- err(EXIT_FAILURE, _("carefulputc failed"));
while (*s) {
- c = *s++;
- if (c == '\n')
- PUTC('\r');
- PUTC(c);
+ const int c = *s++;
+
+ if ((c == '\n' && fputc_careful('\r', stdout, '^') == EOF)
+ || fputc_careful(c, stdout, '^') == EOF)
+ err(EXIT_FAILURE, _("carefulputc failed"));
}
- return;
-#undef PUTC
}
/*