Remove stray exit() in the regress test.
[oweals/opkg-lede.git] / tests / libopkg_test.c
index 67e4103d1ac99d62d5d8ac9b0920ed8fc73a5254..31a22b0b51df2d7a16617be4d2b5a164e7ccbdf4 100644 (file)
@@ -1,9 +1,11 @@
-#include <opkg.h>
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <libgen.h>
 
+#include <opkg.h>
+
+int opkg_state_changed;
 pkg_t *find_pkg = NULL;
 
 
@@ -60,6 +62,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 +73,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);
 }
 
 
@@ -149,7 +152,7 @@ main (int argc, char **argv)
   }
 
   setenv("OFFLINE_ROOT", "/tmp", 0);
+
   if (opkg_new ()) {
          printf("opkg_new() failed. This sucks.\n");
          print_error_list();
@@ -221,7 +224,7 @@ main (int argc, char **argv)
         }
       }
       break;
-          
+
     case 'r':
       if (argv[1][1] == 'e')
       {