summaryrefslogtreecommitdiffstats
path: root/term-utils/write.c
diff options
context:
space:
mode:
authorSami Kerola2016-05-14 17:40:45 +0200
committerSami Kerola2016-07-04 00:34:55 +0200
commita8031743eaea418a9512c426f5678ea53e943ceb (patch)
treee296507304d16e8c3f51c73f9c46bd7e277fa10f /term-utils/write.c
parentwrite: make timestamp to be obviously just a clock time (diff)
downloadkernel-qcow2-util-linux-a8031743eaea418a9512c426f5678ea53e943ceb.tar.gz
kernel-qcow2-util-linux-a8031743eaea418a9512c426f5678ea53e943ceb.tar.xz
kernel-qcow2-util-linux-a8031743eaea418a9512c426f5678ea53e943ceb.zip
write: remove PUTC macro
Function like macros make following the execution flow unnecessarily difficult, and deserves to be removed. Requested-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
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
}
/*