index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2014-09-28 17:45:35 -0400 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-09-30 12:56:21 +1000 |
commit | b52ed49d75ff77ef4f6ad2bef576184bda9b98d0 (patch) | |
tree | b4c7f71acf22f05302ebaf76967f18521a713275 /src/util/testpkg.c | |
parent | 31b98626003fec9e33483152552906a601c072d4 (diff) |
-rw-r--r-- | src/util/testpkg.c | 14 |
diff --git a/src/util/testpkg.c b/src/util/testpkg.c index 39807feb..cc7d9c2b 100644 --- a/src/util/testpkg.c +++ b/src/util/testpkg.c @@ -23,20 +23,18 @@ #include <alpm.h> -static void output_cb(alpm_event_log_t *event) +__attribute__((format(printf, 2, 0))) +static void output_cb(alpm_loglevel_t level, const char *fmt, va_list args) { - if(event->type != ALPM_EVENT_LOG) { + if(fmt[0] == '\0') { return; } - if(event->fmt[0] == '\0') { - return; - } - switch(event->level) { + switch(level) { case ALPM_LOG_ERROR: printf("error: "); break; case ALPM_LOG_WARNING: printf("warning: "); break; default: return; /* skip other messages */ } - vprintf(event->fmt, event->args); + vprintf(fmt, args); } int main(int argc, char *argv[]) @@ -61,7 +59,7 @@ int main(int argc, char *argv[]) } /* let us get log messages from libalpm */ - alpm_option_set_eventcb(handle, (alpm_cb_event) output_cb); + alpm_option_set_logcb(handle, output_cb); /* set gpgdir to default */ alpm_option_set_gpgdir(handle, GPGDIR); |