From 5f17ac8150906ce7aa05b28fdbd1a94cbe021ccc Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 30 Mar 2008 16:41:13 -0500 Subject: Enable display of multiple groups in -Ss and -Qs output Not too complicated of a fix, but just adds some code to loop over the entire group list and space it out. Signed-off-by: Dan McGee --- src/pacman/query.c | 14 +++++++++++--- src/pacman/sync.c | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/pacman/query.c b/src/pacman/query.c index 251c6faa..90ff3773 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -175,9 +175,17 @@ static int query_search(alpm_list_t *targets) if (!config->quiet) { if((grp = alpm_pkg_get_groups(pkg)) != NULL) { - /* TODO handle multiple groups */ - const char *group = alpm_list_getdata(grp); - printf(" (%s)", group); + alpm_list_t *k; + printf(" ("); + for(k = grp; k; k = alpm_list_next(k)) { + const char *group = alpm_list_getdata(k); + printf("%s", group); + if(alpm_list_next(k)) { + /* only print a spacer if there are more groups */ + printf(" "); + } + } + printf(")"); } /* we need a newline and initial indent first */ diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 5f2451a8..5c627393 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -351,10 +351,18 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) } if (!config->quiet) { - /* TODO package in multiple groups needs to be handled, do a loop */ if((grp = alpm_pkg_get_groups(pkg)) != NULL) { - const char *group = alpm_list_getdata(grp); - printf(" (%s)", group); + alpm_list_t *k; + printf(" ("); + for(k = grp; k; k = alpm_list_next(k)) { + const char *group = alpm_list_getdata(k); + printf("%s", group); + if(alpm_list_next(k)) { + /* only print a spacer if there are more groups */ + printf(" "); + } + } + printf(")"); } /* we need a newline and initial indent first */ -- cgit v1.2.3-70-g09d2