added --get-bpph-size to specify the size of the requests to get the list of binary...
[ppastats.git] / src / main.c
index 7bd87fc..8af2dc6 100644 (file)
@@ -37,7 +37,8 @@ static const char *program_name;
 
 static void display_published_binaries(const char *owner,
                                       const char *ppa,
-                                      const char *package_status)
+                                      const char *package_status,
+                                      int ws_size)
 {
        struct ppa_stats *ppastats;
        struct package_stats **packages;
@@ -45,7 +46,7 @@ static void display_published_binaries(const char *owner,
        struct distro_stats **distros;
        struct arch_stats **archs;
 
-       ppastats = create_ppa_stats(owner, ppa, package_status);
+       ppastats = create_ppa_stats(owner, ppa, package_status, ws_size);
        packages = ppastats->packages;
        while (packages && *packages) {
                struct package_stats *p = *packages;
@@ -94,6 +95,7 @@ static struct option long_options[] = {
        {"debug", no_argument, 0, 'd'},
        {"status", required_argument, 0, 's'},
        {"skip-js-css", no_argument, 0, 'S'},
+       {"get-bpph-size", required_argument, 0, 0},
        {0, 0, 0, 0}
 };
 
@@ -134,6 +136,9 @@ static void print_help()
 
        puts(_(
 " -S, --skip-js-css         skip installation of js and css files"));
+       puts(_(
+" --get-bpph-size=[s]       size of the replies of webservice requests to get\n"
+"                           the list of binary packages. Between 1 and 300."));
        puts("");
 
        printf(_("Report bugs to: %s\n"), PACKAGE_BUGREPORT);
@@ -144,7 +149,7 @@ static void print_help()
 int main(int argc, char **argv)
 {
        char *owner, *ppa, *package_status, *output_dir;
-       int optc, output_html, cmdok, install_static_files;
+       int optc, output_html, cmdok, install_static_files, ws_size, opti;
 
        program_name = argv[0];
 
@@ -157,10 +162,15 @@ int main(int argc, char **argv)
        output_dir = NULL;
        package_status = NULL;
        output_html = 0;
+       ws_size = -1;
 
        while ((optc = getopt_long(argc, argv, "vho:ds:S", long_options,
-                                  NULL)) != -1) {
+                                  &opti)) != -1) {
                switch (optc) {
+               case 0:
+                       if (!strcmp(long_options[opti].name, "get-bpph-size"))
+                               ws_size = atoi(optarg);
+                       break;
                case 'o':
                        output_html = 1;
                        output_dir = strdup(optarg);
@@ -198,9 +208,9 @@ int main(int argc, char **argv)
 
        if (output_html)
                ppa_to_html(owner, ppa, package_status, output_dir,
-                           install_static_files);
+                           install_static_files, ws_size);
        else
-               display_published_binaries(owner, ppa, package_status);
+               display_published_binaries(owner, ppa, package_status, ws_size);
 
        /* for valgrind.... */
        free(package_status);