aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-23 17:53:15 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-23 17:53:15 +0200
commitf2f3730c332114e1d8034425ca7405d7c8e44f0d (patch)
tree95b6805c4ce730893543dedeaf538386e75bf8e5 /src
parentadd test + fix example in info manual (diff)
downloadlibpassphrase-f2f3730c332114e1d8034425ca7405d7c8e44f0d.tar.gz
libpassphrase-f2f3730c332114e1d8034425ca7405d7c8e44f0d.tar.bz2
libpassphrase-f2f3730c332114e1d8034425ca7405d7c8e44f0d.tar.xz
print to stderr rather than stdout
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/passphrase.c14
1 files changed, 7 insertions, 7 deletions
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;
}