From f2f3730c332114e1d8034425ca7405d7c8e44f0d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 23 Apr 2014 17:53:15 +0200 Subject: print to stderr rather than stdout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/passphrase.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/passphrase.c b/src/passphrase.c index 679e1fa..6496701 100644 --- a/src/passphrase.c +++ b/src/passphrase.c @@ -57,10 +57,10 @@ static inline char* xrealloc(char* array, size_t cur_size, size_t new_size) # define xprintf(...) /* do nothing */ # define xflush() /* do nothing */ #elif defined(PASSPHRASE_MOVE) || defined(PASSPHRASE_STAR) -# define xprintf printf -# define xflush() fflush(stdout) +# define xprintf(format, ...) fprintf(stderr, format, __VA_ARGS__) +# define xflush() fflush(stderr) #else -# define xflush() fflush(stdout) +# define xflush() fflush(stderr) #endif @@ -333,10 +333,10 @@ char* passphrase_read(void) n++; *(rc + len) = 0; if (n) - printf("\033[s\033[H\033[K%s\033[%liD\033[01;34m%s\033[00m\033[u", rc, n, rc + point); + fprintf(stderr, "\033[s\033[H\033[K%s\033[%liD\033[01;34m%s\033[00m\033[u", rc, n, rc + point); else - printf("\033[s\033[H\033[K%s\033[01;34m%s\033[00m\033[u", rc, rc + point); - fflush(stdout); + fprintf(stderr, "\033[s\033[H\033[K%s\033[01;34m%s\033[00m\033[u", rc, rc + point); + fflush(stderr); } #endif } @@ -346,7 +346,7 @@ char* passphrase_read(void) *(rc + len) = 0; #if !defined(PASSPHRASE_ECHO) || defined(PASSPHRASE_MOVE) - printf("\n"); + fprintf(stderr, "\n"); #endif return rc; } -- cgit v1.2.3-70-g09d2