From b3d79de121685182a66900c82d35a10175971135 Mon Sep 17 00:00:00 2001 From: ticktock35 Date: Mon, 15 Dec 2008 00:13:12 -0500 Subject: opkg: implement package listing in new libopkg git-svn-id: http://opkg.googlecode.com/svn/trunk@90 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'tests') 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); } -- cgit v0.9.1