summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-03-30 16:41:13 -0500
committerDan McGee <dan@archlinux.org>2008-03-30 16:41:13 -0500
commit5f17ac8150906ce7aa05b28fdbd1a94cbe021ccc (patch)
treefa498ae7c2712408eb7ba137aec5995159439e9f /src
parent4b8ada818e21aae43b4f54f146ffa215fdb9213e (diff)
downloadpacman-5f17ac8150906ce7aa05b28fdbd1a94cbe021ccc.tar.xz
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 <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/query.c14
-rw-r--r--src/pacman/sync.c14
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 */