diff options
author | Shiz <hi@shiz.me> | 2017-04-10 08:47:22 +0200 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2017-04-24 22:42:29 +0000 |
commit | 5ba27c90007b2441f1fe35365c753a5365f3a2de (patch) | |
tree | c6c325f10bf9f276af37747c69634ba2be760365 /src/print.c | |
parent | 515f31eb528326c2275c08f7a0373e1529b4fb3e (diff) | |
download | apk-tools-5ba27c90007b2441f1fe35365c753a5365f3a2de.tar.gz apk-tools-5ba27c90007b2441f1fe35365c753a5365f3a2de.tar.bz2 apk-tools-5ba27c90007b2441f1fe35365c753a5365f3a2de.tar.xz apk-tools-5ba27c90007b2441f1fe35365c753a5365f3a2de.zip |
print: print warnings and errors to stderr
Diffstat (limited to 'src/print.c')
-rw-r--r-- | src/print.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/print.c b/src/print.c index 5df51f3..6608152 100644 --- a/src/print.c +++ b/src/print.c @@ -157,17 +157,28 @@ const char *apk_error_str(int error) } } +static void log(FILE *dest, const char *prefix, const char *format, va_list va) +{ + if (prefix != NULL) + fprintf(dest, "%s", prefix); + vfprintf(dest, format, va); + fprintf(dest, "\n"); + fflush(dest); + apk_progress_force = 1; +} + void apk_log(const char *prefix, const char *format, ...) { va_list va; - - if (prefix != NULL) - fprintf(stdout, "%s", prefix); va_start(va, format); - vfprintf(stdout, format, va); + log(stdout, prefix, format, va); va_end(va); - fprintf(stdout, "\n"); - fflush(stdout); - apk_progress_force = 1; } +void apk_log_err(const char *prefix, const char *format, ...) +{ + va_list va; + va_start(va, format); + log(stderr, prefix, format, va); + va_end(va); +} |