Use xbps_regpkgdb_foreach_pkg_cb() where needed.
This commit is contained in:
parent
7bfcdee791
commit
32597d85c1
@ -190,11 +190,6 @@ main(int argc, char **argv)
|
|||||||
if (argc < 1 || argc > 2)
|
if (argc < 1 || argc > 2)
|
||||||
usage(xhp);
|
usage(xhp);
|
||||||
|
|
||||||
if (xhp->regpkgdb_dictionary == NULL) {
|
|
||||||
printf("No packages currently installed.\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
lpc.check_state = true;
|
lpc.check_state = true;
|
||||||
lpc.state = 0;
|
lpc.state = 0;
|
||||||
if (argv[1]) {
|
if (argv[1]) {
|
||||||
@ -219,9 +214,12 @@ main(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* Find the longest pkgver string to pretty print the output.
|
* Find the longest pkgver string to pretty print the output.
|
||||||
*/
|
*/
|
||||||
lpc.pkgver_len = find_longest_pkgver(xhp->regpkgdb_dictionary);
|
lpc.pkgver_len = find_longest_pkgver(NULL);
|
||||||
rv = xbps_callback_array_iter_in_dict(xhp->regpkgdb_dictionary,
|
rv = xbps_regpkgdb_foreach_pkg_cb(list_pkgs_in_dict, &lpc);
|
||||||
"packages", list_pkgs_in_dict, &lpc);
|
if (rv == ENOENT) {
|
||||||
|
printf("No packages currently registered.\n");
|
||||||
|
rv = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (strcasecmp(argv[0], "install") == 0) {
|
} else if (strcasecmp(argv[0], "install") == 0) {
|
||||||
/* Installs a binary package and required deps. */
|
/* Installs a binary package and required deps. */
|
||||||
@ -368,8 +366,7 @@ main(int argc, char **argv)
|
|||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
usage(xhp);
|
usage(xhp);
|
||||||
|
|
||||||
rv = xbps_callback_array_iter_in_dict(xhp->regpkgdb_dictionary,
|
rv = xbps_regpkgdb_foreach_pkg_cb(list_manual_pkgs, NULL);
|
||||||
"packages", list_manual_pkgs, NULL);
|
|
||||||
|
|
||||||
} else if (strcasecmp(argv[0], "show-revdeps") == 0) {
|
} else if (strcasecmp(argv[0], "show-revdeps") == 0) {
|
||||||
/*
|
/*
|
||||||
|
@ -190,8 +190,12 @@ find_longest_pkgver(prop_dictionary_t d)
|
|||||||
{
|
{
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
(void)xbps_callback_array_iter_in_dict(d, "packages",
|
if (prop_object_type(d) == PROP_TYPE_DICTIONARY)
|
||||||
_find_longest_pkgver_cb, &len);
|
(void)xbps_callback_array_iter_in_dict(d, "packages",
|
||||||
|
_find_longest_pkgver_cb, &len);
|
||||||
|
else
|
||||||
|
(void)xbps_regpkgdb_foreach_pkg_cb(
|
||||||
|
_find_longest_pkgver_cb, &len);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user