index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | src/pacman/callback.c | 26 | ||||
-rw-r--r-- | src/pacman/remove.c | 2 | ||||
-rw-r--r-- | src/pacman/sync.c | 14 | ||||
-rw-r--r-- | src/pacman/util.c | 17 | ||||
-rw-r--r-- | src/pacman/util.h | 1 |
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index edd5b398..d0887cb7 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -244,7 +244,7 @@ void cb_event(alpm_event_t event, void *data1, void *data2) fputs((const char *)data1, stdout); break; case ALPM_EVENT_RETRIEVE_START: - printf(_(":: Retrieving packages ...\n")); + colon_printf(_("Retrieving packages ...\n")); break; case ALPM_EVENT_DISKSPACE_START: if(config->noprogressbar) { @@ -252,7 +252,7 @@ void cb_event(alpm_event_t event, void *data1, void *data2) } break; case ALPM_EVENT_OPTDEP_REQUIRED: - printf(_(":: %s optionally requires %s\n"), alpm_pkg_get_name(data1), + colon_printf(_("%s optionally requires %s\n"), alpm_pkg_get_name(data1), alpm_dep_compute_string(data2)); break; case ALPM_EVENT_DATABASE_MISSING: @@ -290,14 +290,14 @@ void cb_question(alpm_question_t event, void *data1, void *data2, switch(event) { case ALPM_QUESTION_INSTALL_IGNOREPKG: if(!config->op_s_downloadonly) { - *response = yesno(_(":: %s is in IgnorePkg/IgnoreGroup. Install anyway?"), + *response = yesno(_("%s is in IgnorePkg/IgnoreGroup. Install anyway?"), alpm_pkg_get_name(data1)); } else { *response = 1; } break; case ALPM_QUESTION_REPLACE_PKG: - *response = yesno(_(":: Replace %s with %s/%s?"), + *response = yesno(_("Replace %s with %s/%s?"), alpm_pkg_get_name(data1), (char *)data3, alpm_pkg_get_name(data2)); @@ -306,12 +306,12 @@ void cb_question(alpm_question_t event, void *data1, void *data2, /* data parameters: target package, local package, conflict (strings) */ /* print conflict only if it contains new information */ if(strcmp(data1, data3) == 0 || strcmp(data2, data3) == 0) { - *response = noyes(_(":: %s and %s are in conflict. Remove %s?"), + *response = noyes(_("%s and %s are in conflict. Remove %s?"), (char *)data1, (char *)data2, (char *)data2); } else { - *response = noyes(_(":: %s and %s are in conflict (%s). Remove %s?"), + *response = noyes(_("%s and %s are in conflict (%s). Remove %s?"), (char *)data1, (char *)data2, (char *)data3, @@ -328,9 +328,9 @@ void cb_question(alpm_question_t event, void *data1, void *data2, (char *)alpm_pkg_get_name(i->data)); count++; } - printf(_n( - ":: The following package cannot be upgraded due to unresolvable dependencies:\n", - ":: The following packages cannot be upgraded due to unresolvable dependencies:\n", + colon_printf(_n( + "The following package cannot be upgraded due to unresolvable dependencies:\n", + "The following packages cannot be upgraded due to unresolvable dependencies:\n", count)); list_display(" ", namelist, getcols(fileno(stdout))); printf("\n"); @@ -346,7 +346,7 @@ void cb_question(alpm_question_t event, void *data1, void *data2, alpm_list_t *providers = data1; size_t count = alpm_list_count(providers); char *depstring = alpm_dep_compute_string((alpm_depend_t *)data2); - printf(_(":: There are %zd providers available for %s:\n"), count, + colon_printf(_("There are %zd providers available for %s:\n"), count, depstring); free(depstring); select_display(providers); @@ -355,7 +355,7 @@ void cb_question(alpm_question_t event, void *data1, void *data2, break; case ALPM_QUESTION_LOCAL_NEWER: if(!config->op_s_downloadonly) { - *response = yesno(_(":: %s-%s: local version is newer. Upgrade anyway?"), + *response = yesno(_("%s-%s: local version is newer. Upgrade anyway?"), alpm_pkg_get_name(data1), alpm_pkg_get_version(data1)); } else { @@ -363,7 +363,7 @@ void cb_question(alpm_question_t event, void *data1, void *data2, } break; case ALPM_QUESTION_CORRUPTED_PKG: - *response = yesno(_(":: File %s is corrupted (%s).\n" + *response = yesno(_("File %s is corrupted (%s).\n" "Do you want to delete it?"), (char *)data1, alpm_strerror(*(alpm_errno_t *)data2)); @@ -380,7 +380,7 @@ void cb_question(alpm_question_t event, void *data1, void *data2, revoked = " (revoked)"; } - *response = yesno(_(":: Import PGP key %d%c/%s, \"%s\", created: %s%s?"), + *response = yesno(_("Import PGP key %d%c/%s, \"%s\", created: %s%s?"), key->length, key->pubkey_algo, key->fingerprint, key->uid, created, revoked); } break; diff --git a/src/pacman/remove.c b/src/pacman/remove.c index 943a555f..8cf3ebc5 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -119,7 +119,7 @@ int pacman_remove(alpm_list_t *targets) for(i = data; i; i = alpm_list_next(i)) { alpm_depmissing_t *miss = i->data; char *depstring = alpm_dep_compute_string(miss->depend); - printf(_(":: %s: requires %s\n"), miss->target, depstring); + colon_printf(_("%s: requires %s\n"), miss->target, depstring); free(depstring); } break; diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 8d38edf6..7b54cba2 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -592,7 +592,7 @@ static int process_group(alpm_list_t *dbs, const char *group, int error) } if(config->print == 0) { - printf(_(":: There are %d members in group %s:\n"), count, + colon_printf(_("There are %d members in group %s:\n"), count, group); select_display(pkgs); char *array = malloc(count); @@ -717,7 +717,7 @@ static int sync_trans(alpm_list_t *targets) } if(config->op_s_upgrade) { - printf(_(":: Starting full system upgrade...\n")); + colon_printf(_("Starting full system upgrade...\n")); alpm_logaction(config->handle, PACMAN_CALLER_PREFIX, "starting full system upgrade\n"); if(alpm_sync_sysupgrade(config->handle, config->op_s_upgrade >= 2) == -1) { @@ -744,14 +744,14 @@ int sync_prepare_execute(void) case ALPM_ERR_PKG_INVALID_ARCH: for(i = data; i; i = alpm_list_next(i)) { const char *pkg = i->data; - printf(_(":: package %s does not have a valid architecture\n"), pkg); + colon_printf(_("package %s does not have a valid architecture\n"), pkg); } break; case ALPM_ERR_UNSATISFIED_DEPS: for(i = data; i; i = alpm_list_next(i)) { alpm_depmissing_t *miss = i->data; char *depstring = alpm_dep_compute_string(miss->depend); - printf(_(":: %s: requires %s\n"), miss->target, depstring); + colon_printf(_("%s: requires %s\n"), miss->target, depstring); free(depstring); } break; @@ -760,11 +760,11 @@ int sync_prepare_execute(void) alpm_conflict_t *conflict = i->data; /* only print reason if it contains new information */ if(conflict->reason->mod == ALPM_DEP_MOD_ANY) { - printf(_(":: %s and %s are in conflict\n"), + colon_printf(_("%s and %s are in conflict\n"), conflict->package1, conflict->package2); } else { char *reason = alpm_dep_compute_string(conflict->reason); - printf(_(":: %s and %s are in conflict (%s)\n"), + colon_printf(_("%s and %s are in conflict (%s)\n"), conflict->package1, conflict->package2, reason); free(reason); } @@ -889,7 +889,7 @@ int pacman_sync(alpm_list_t *targets) if(config->op_s_sync) { /* grab a fresh package list */ - printf(_(":: Synchronizing package databases...\n")); + colon_printf(_("Synchronizing package databases...\n")); alpm_logaction(config->handle, PACMAN_CALLER_PREFIX, "synchronizing package lists\n"); if(!sync_synctree(config->op_s_sync, sync_dbs)) { diff --git a/src/pacman/util.c b/src/pacman/util.c index 3270c746..182450bf 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1219,8 +1219,7 @@ static void display_repo_list(const char *dbname, alpm_list_t *list, { const char *prefix = " "; - printf(":: "); - printf(_("Repository %s\n"), dbname); + colon_printf(_("Repository %s\n"), dbname); list_display(prefix, list, cols); } @@ -1461,6 +1460,7 @@ static int question(short preset, char *fmt, va_list args) fflush(stdout); fflush(stderr); + fprintf(stream, ":: "); vfprintf(stream, fmt, args); if(preset) { @@ -1522,6 +1522,19 @@ int noyes(char *fmt, ...) return ret; } +int colon_printf(const char *fmt, ...) +{ + int ret; + va_list args; + + fputs(":: ", stdout); + va_start(args, fmt); + ret = vprintf(fmt, args); + va_end(args); + + return ret; +} + int pm_printf(alpm_loglevel_t level, const char *format, ...) { int ret; diff --git a/src/pacman/util.h b/src/pacman/util.h index 2d1e6989..f579b7ec 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -72,6 +72,7 @@ void print_packages(const alpm_list_t *packages); void select_display(const alpm_list_t *pkglist); int select_question(int count); int multiselect_question(char *array, int count); +int colon_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); int yesno(char *fmt, ...) __attribute__((format(printf, 1, 2))); int noyes(char *fmt, ...) __attribute__((format(printf, 1, 2))); |