mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-15 06:29:22 +02:00
qpkg: improve "qpkg ... list"
- qpkg.c (list_all_packages): jrb indicates end-of-tree with pointer to jrb_nil(), not NULL - qpkg.c (list_all_packages, list_one_package): use ID2PF - qpkg.c (list_all_packages): iterate over versions
This commit is contained in:
parent
dd8bb6eecd
commit
b0c29c4d7a
28
qpkg/qpkg.c
28
qpkg/qpkg.c
@ -32,22 +32,24 @@ int debug = 0;
|
|||||||
static void list_all_packages(void)
|
static void list_all_packages(void)
|
||||||
{
|
{
|
||||||
const struct jrb *n;
|
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;
|
const struct id *id = n->key;
|
||||||
struct pkg *pkg = n->val;
|
|
||||||
|
|
||||||
printf("%.*s", (int) id->len, id->s);
|
for (pkg = n->val; pkg; pkg = pkg->more) {
|
||||||
if (!pkg)
|
printf("%.*s", ID2PF(id));
|
||||||
printf(" (virtual)");
|
if (!pkg)
|
||||||
else {
|
printf(" (virtual)");
|
||||||
if (pkg->version)
|
else {
|
||||||
printf(" (%.*s)",
|
if (pkg->version)
|
||||||
(int) pkg->version->len, pkg->version->s);
|
printf(" (%.*s)", ID2PF(pkg->version));
|
||||||
if (pkg->more)
|
if (pkg->more)
|
||||||
printf(" +++");
|
printf(" +++");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ static void list_one_package(const char *name)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
for (pkg = n->val; pkg; pkg = pkg->more)
|
for (pkg = n->val; pkg; pkg = pkg->more)
|
||||||
printf("%.*s\n", (int) pkg->version->len, pkg->version->s);
|
printf("%.*s\n", ID2PF(pkg->version));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user