From 4db24ca28a31d1d0d97b30b186fd5255a0ae0113 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Tue, 23 Jan 2007 01:34:58 +0000 Subject: * Added some calloc calls to replace the malloc-then-set-to-zero functionality * Fixed -Ss output so as not to call alpm_list_getdata with a NULl list * Added a NULL check in alpm_list_getdata * Fixed alpm_list_add_sorted to properly handle a new / beginning insertions --- src/pacman/sync.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/pacman/sync.c') diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 7bb4a127..4df44087 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -248,14 +248,20 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets) continue; } for(j = ret; j; j = alpm_list_next(j)) { + char *group = NULL; + alpm_list_t *grp; pmpkg_t *pkg = alpm_list_getdata(j); - char *group = (char *)alpm_list_getdata(alpm_pkg_get_groups(pkg)); - printf("%s/%s %s %s%s%s\n ", - alpm_db_get_name(db), - alpm_pkg_get_name(pkg), - alpm_pkg_get_version(pkg), - (group ? " (" : ""), (group ? group : ""), (group ? ") " : "")); + printf("%s/%s %s", alpm_db_get_name(db), alpm_pkg_get_name(pkg), + alpm_pkg_get_version(pkg)); + + if((grp = alpm_pkg_get_groups(pkg)) != NULL) { + group = alpm_list_getdata(grp); + printf(" (%s)\n ", (char *)alpm_list_getdata(grp)); + } else { + printf("\n "); + } + indentprint(alpm_pkg_get_desc(pkg), 4); printf("\n\n"); } @@ -280,9 +286,12 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets) if(targets) { for(i = targets; i; i = alpm_list_next(i)) { + char *grpname = alpm_list_getdata(i); for(j = syncs; j; j = alpm_list_next(j)) { pmdb_t *db = alpm_list_getdata(j); - pmgrp_t *grp = alpm_db_readgrp(db, alpm_list_getdata(i)); + printf("searching '%s' for groups '%s'\n", alpm_db_get_name(db), grpname); + fflush(stdout); + pmgrp_t *grp = alpm_db_readgrp(db, grpname); if(grp) { MSG(NL, "%s\n", (char *)alpm_grp_get_name(grp)); -- cgit v1.2.3-24-g4f1b