From a3e628f1c9f3e7ddfd447d599611729aefc736bb Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Fri, 31 Oct 2014 21:28:07 +0200 Subject: [PATCH] Print disco to stderr instead of stdout. --- client/common/common.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/client/common/common.c b/client/common/common.c index 3366c2c..d8125cd 100644 --- a/client/common/common.c +++ b/client/common/common.c @@ -12,8 +12,8 @@ static void disco_trap(int sig) { (void)sig; - printf("\e[?25h\n"); - fflush(stdout); + fprintf(stderr, "\e[?25h"); + fflush(stderr); exit(EXIT_FAILURE); } @@ -29,18 +29,18 @@ disco(void) sigaction(SIGINT, &action, NULL); uint32_t cc, c = 80; - printf("\e[?25l"); + fprintf(stderr, "\e[?25l"); while (1) { for (uint32_t i = 1; i < c - 1; ++i) { - printf("\r %*s%s %s %s ", (i > c / 2 ? c - i : i), " ", ((i % 2) ? ""), ((i % 4) ? "DISCO" : " "), ((i %2) ? "\\o>" : ""), ((i % 2) ? "*" : "•")); - for (cc = 2; cc < (i > c / 2 ? c - i : i); ++cc) printf(((i % 2) ? "^" : "'")); - fflush(stdout); + fprintf(stderr, "\r %*s%s %s %s ", (i > c / 2 ? c - i : i), " ", ((i % 2) ? ""), ((i % 4) ? "DISCO" : " "), ((i %2) ? "\\o>" : ""), ((i % 2) ? "*" : "•")); + for (cc = 2; cc < (i > c / 2 ? c - i : i); ++cc) fprintf(stderr, ((i % 2) ? "^" : "'")); + fflush(stderr); usleep(140 * 1000); } } - printf("\e[?25h"); + fprintf(stderr, "\e[?25h"); exit(EXIT_SUCCESS); }