diff options
author | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-15 00:13:12 (EST) |
---|---|---|
committer | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-15 00:13:12 (EST) |
commit | b3d79de121685182a66900c82d35a10175971135 (patch) | |
tree | a7bb0a5f9134b542af06aa3543c0c6e8dba985f1 /tests | |
parent | d1f5423230ce4b81db9c4433399c71065506dd82 (diff) |
opkg: implement package listing in new libopkg
git-svn-id: http://opkg.googlecode.com/svn/trunk@90 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libopkg_test.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/libopkg_test.c b/tests/libopkg_test.c index 79e33ab..ac61738 100644 --- a/tests/libopkg_test.c +++ b/tests/libopkg_test.c @@ -9,6 +9,22 @@ progress_callback (opkg_t *opkg, int percent, void *data) fflush (stdout); } +void +package_list_callback (opkg_t *opkg, opkg_package_t *pkg, void *data) +{ + static install_count = 0; + static total_count = 0; + + if (pkg->installed) + install_count++; + + total_count++; + + printf ("\rPackage count: %d Installed, %d Total Available", install_count, total_count); + fflush (stdout); + + opkg_package_free (pkg); +} int main (int argc, char **argv) @@ -37,5 +53,8 @@ main (int argc, char **argv) err = opkg_remove_package (opkg, "aspell", progress_callback, "Removing..."); printf ("\nopkg_remove_package returned %d\n", err); + opkg_list_packages (opkg, package_list_callback, NULL); + printf ("\n"); + opkg_free (opkg); } |