From 0cff7c6bdf5461c3286edc940aabb88d63345381 Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Thu, 25 Oct 2007 02:31:28 +0200 Subject: Add alpm_dep_get_string method Public alpm_dep_get_string function is introduced, which converts a pmdepend_t structure to printable string in %DEPENDS% format. This function is now used in pacman to print dependency error messages. Signed-off-by: Dan McGee --- src/pacman/add.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/pacman/add.c') diff --git a/src/pacman/add.c b/src/pacman/add.c index 0b59a236..f883a6bd 100644 --- a/src/pacman/add.c +++ b/src/pacman/add.c @@ -137,26 +137,14 @@ int pacman_add(alpm_list_t *targets) for(i = data; i; i = alpm_list_next(i)) { pmdepmissing_t *miss = alpm_list_getdata(i); pmdepend_t *dep = alpm_miss_get_dep(miss); + char *depstring = alpm_dep_get_string(dep); /* TODO indicate if the error was a virtual package or not: * :: %s: requires %s, provided by %s */ printf(_(":: %s: requires %s\n"), alpm_miss_get_target(miss), - alpm_dep_get_name(dep)); - switch(alpm_dep_get_mod(dep)) { - case PM_DEP_MOD_ANY: - break; - case PM_DEP_MOD_EQ: - printf("=%s", alpm_dep_get_version(dep)); - break; - case PM_DEP_MOD_GE: - printf(">=%s", alpm_dep_get_version(dep)); - break; - case PM_DEP_MOD_LE: - printf("<=%s", alpm_dep_get_version(dep)); - break; - } - printf("\n"); + depstring); + free(depstring); } break; case PM_ERR_CONFLICTING_DEPS: -- cgit v1.2.3-24-g4f1b