diff options
author | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-12-09 01:37:09 (EST) |
---|---|---|
committer | graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2009-12-09 01:37:09 (EST) |
commit | ce1cfe7ce2042f7ff959e0a71760f926e1b47aeb (patch) | |
tree | 2f124644420ec8300f1e4c06a53de13d95678329 /tests | |
parent | 6642bca1751d698f9098adf80c069c84bbc7aa52 (diff) |
Implement list all command. Print full version string.
git-svn-id: http://opkg.googlecode.com/svn/trunk@478 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libopkg_test.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/libopkg_test.c b/tests/libopkg_test.c index 073a9a7..2b42a2d 100644 --- a/tests/libopkg_test.c +++ b/tests/libopkg_test.c @@ -25,10 +25,24 @@ char *errors[10] = { void progress_callback (const opkg_progress_data_t *progress, void *data) { - printf ("\r%s %3d%%", (char*) data, progress->percentage); + printf ("\r%s %3d%%\n", (char*) data, progress->percentage); fflush (stdout); } +static void list_pkg(pkg_t *pkg) +{ + char *v = pkg_version_str_alloc(pkg); + printf ("%s - %s\n", pkg->name, v); + free(v); +} + +void +package_list_installed_callback (pkg_t *pkg, void *data) +{ + if (pkg->state_status == SS_INSTALLED) + list_pkg(pkg); +} + void package_list_callback (pkg_t *pkg, void *data) { @@ -53,7 +67,7 @@ package_list_callback (pkg_t *pkg, void *data) void package_list_upgradable_callback (pkg_t *pkg, void *data) { - printf ("%s - %s\n", pkg->name, pkg->version); + list_pkg(pkg); } void @@ -213,6 +227,7 @@ main (int argc, char **argv) break; case 'i': printf ("Listing installed packages...\n"); + opkg_list_packages (package_list_installed_callback, NULL); break; default: printf ("Unknown list option \"%s\"", argv[2]); |