Fixed memory issue (patch submitted by Lekensteyn).
authorJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 3 Sep 2011 12:44:11 +0000 (12:44 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 3 Sep 2011 12:44:11 +0000 (12:44 +0000)
Added help for -s option.

NEWS
src/lp_ws.c
src/main.c

diff --git a/NEWS b/NEWS
index c3c953a..7ff7df5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+* v0.0.4
+** Fixed memory issue (patch submitted by Lekensteyn).
+** Added help for -s option.
+
 * v0.0.3
 ** Generated HTML pages for package versions.
 ** Added distro/arch information in package version page.
index 6c2e299..d6f4087 100644 (file)
@@ -121,23 +121,24 @@ json_object_to_binary_package_publishing_history_list
 
 struct binary_package_publishing_history * *
 get_binary_package_publishing_history_list(const char *archive_url,
-                                          const char *package_status)
+                                          const char *pkg_status)
 {
        struct json_object *o_next;
-       char *url = malloc(strlen(archive_url)+
-                          strlen(QUERY_GET_PUBLISHED_BINARIES)+
-                          strlen("&status=")+
-                          9+
-                          1);
+       char *url;
        json_object *o;
        void **result = NULL;
 
+       url = malloc(strlen(archive_url)+
+                    strlen(QUERY_GET_PUBLISHED_BINARIES)+
+                    (pkg_status ? strlen("&status=")+strlen(pkg_status) : 0)+
+                    1);
+
        strcpy(url, archive_url);
        strcat(url, QUERY_GET_PUBLISHED_BINARIES);
 
-       if (package_status) {
+       if (pkg_status) {
                strcat(url, "&status=");
-               strcat(url, package_status);
+               strcat(url, pkg_status);
        }
 
        while (url) {
index f7b615a..2314f81 100644 (file)
@@ -125,6 +125,11 @@ static void print_help()
   -o, --output_dir=[PATH]       \
 generates HTML pages into 'PATH'.");
 
+       puts("\
+  -s, --status=[STATUS]        retrieves only package of the given status\n\
+                               (possible values are: Pending, Published, \n\
+                               Superseded, Deleted or Obsolete).");
+
        puts("");
 
        printf("Report bugs to: %s\n", PACKAGE_BUGREPORT);