diff --git a/qpkg/qpkg.c b/qpkg/qpkg.c index 76d6834..a4799b7 100644 --- a/qpkg/qpkg.c +++ b/qpkg/qpkg.c @@ -32,22 +32,24 @@ int debug = 0; static void list_all_packages(void) { const struct jrb *n; + const struct pkg *pkg; - for (n = jrb_first(packages->root); n; n = jrb_next(n)) { + for (n = jrb_first(packages->root); n != jrb_nil(packages->root); + n = jrb_next(n)) { const struct id *id = n->key; - struct pkg *pkg = n->val; - printf("%.*s", (int) id->len, id->s); - if (!pkg) - printf(" (virtual)"); - else { - if (pkg->version) - printf(" (%.*s)", - (int) pkg->version->len, pkg->version->s); - if (pkg->more) - printf(" +++"); + for (pkg = n->val; pkg; pkg = pkg->more) { + printf("%.*s", ID2PF(id)); + if (!pkg) + printf(" (virtual)"); + else { + if (pkg->version) + printf(" (%.*s)", ID2PF(pkg->version)); + if (pkg->more) + printf(" +++"); + } + printf("\n"); } - printf("\n"); } } @@ -62,7 +64,7 @@ static void list_one_package(const char *name) exit(1); } for (pkg = n->val; pkg; pkg = pkg->more) - printf("%.*s\n", (int) pkg->version->len, pkg->version->s); + printf("%.*s\n", ID2PF(pkg->version)); }