Initial stab at untangling the #include maze. Probably needs a second pass.
[oweals/opkg-lede.git] / tests / libopkg_test.c
index 67e4103d1ac99d62d5d8ac9b0920ed8fc73a5254..4d82a6721ae4898c6fb543eac9362251753dddd5 100644 (file)
@@ -1,9 +1,10 @@
-#include <opkg.h>
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <libgen.h>
 
+#include <opkg.h>
+
 pkg_t *find_pkg = NULL;
 
 
@@ -60,6 +61,7 @@ package_list_upgradable_callback (pkg_t *pkg, void *data)
 void
 print_package (pkg_t *pkg)
 {
+  char *v = pkg_version_str_alloc(pkg);
   printf (
       "Name:         %s\n"
       "Version:      %s\n"
@@ -70,14 +72,14 @@ print_package (pkg_t *pkg)
       "Size:         %ld\n"
       "Status:       %d\n",
       pkg->name,
-      pkg->version,
+      v,
       pkg->src->name,
       pkg->architecture,
       pkg->description,
-      pkg->tags,
+      pkg->tags? pkg->tags : "",
       pkg->size,
-      pkg->state_status
-      );
+      pkg->state_status);
+  free(v);
 }