diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/callback.c | 48 | ||||
-rw-r--r-- | src/pacman/util.c | 13 | ||||
-rw-r--r-- | src/pacman/util.h | 1 |
3 files changed, 62 insertions, 0 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 2540b73c..340a3a1c 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -288,6 +288,54 @@ void cb_event(alpm_event_t *event) } } break; + case ALPM_EVENT_PACNEW_CREATED: + { + alpm_event_pacnew_created_t *e = (alpm_event_pacnew_created_t *) event; + if(on_progress) { + char *string = NULL; + pm_sprintf(&string, ALPM_LOG_WARNING, _("%s installed as %s.pacnew\n"), + e->file, e->file); + if(string != NULL) { + output = alpm_list_add(output, string); + } + } else { + pm_printf(ALPM_LOG_WARNING, _("%s installed as %s.pacnew\n"), + e->file, e->file); + } + } + break; + case ALPM_EVENT_PACSAVE_CREATED: + { + alpm_event_pacsave_created_t *e = (alpm_event_pacsave_created_t *) event; + if(on_progress) { + char *string = NULL; + pm_sprintf(&string, ALPM_LOG_WARNING, _("%s saved as %s.pacsave\n"), + e->file, e->file); + if(string != NULL) { + output = alpm_list_add(output, string); + } + } else { + pm_printf(ALPM_LOG_WARNING, _("%s saved as %s.pacsave\n"), + e->file, e->file); + } + } + break; + case ALPM_EVENT_PACORIG_CREATED: + { + alpm_event_pacorig_created_t *e = (alpm_event_pacorig_created_t *) event; + if(on_progress) { + char *string = NULL; + pm_sprintf(&string, ALPM_LOG_WARNING, _("%s saved as %s.pacorig\n"), + e->file, e->file); + if(string != NULL) { + output = alpm_list_add(output, string); + } + } else { + pm_printf(ALPM_LOG_WARNING, _("%s saved as %s.pacorig\n"), + e->file, e->file); + } + } + break; /* all the simple done events, with fallthrough for each */ case ALPM_EVENT_FILECONFLICTS_DONE: case ALPM_EVENT_CHECKDEPS_DONE: diff --git a/src/pacman/util.c b/src/pacman/util.c index 91f8fb3b..d42e27b8 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1579,6 +1579,19 @@ int pm_asprintf(char **string, const char *format, ...) return ret; } +int pm_sprintf(char **string, alpm_loglevel_t level, const char *format, ...) +{ + int ret = 0; + va_list args; + + /* print the message using va_arg list */ + va_start(args, format); + ret = pm_vasprintf(string, level, format, args); + va_end(args); + + return ret; +} + int pm_vasprintf(char **string, alpm_loglevel_t level, const char *format, va_list args) { int ret = 0; diff --git a/src/pacman/util.h b/src/pacman/util.h index 94a6dc8b..4a31e89a 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -78,6 +78,7 @@ int noyes(const char *format, ...) __attribute__((format(printf, 1, 2))); int pm_printf(alpm_loglevel_t level, const char *format, ...) __attribute__((format(printf,2,3))); int pm_asprintf(char **string, const char *format, ...) __attribute__((format(printf,2,3))); int pm_vfprintf(FILE *stream, alpm_loglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0))); +int pm_sprintf(char **string, alpm_loglevel_t level, const char *format, ...) __attribute__((format(printf,3,4))); int pm_vasprintf(char **string, alpm_loglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0))); #endif /* _PM_UTIL_H */ |