projects
/
ppastats.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
retry on network failure during url fetch
[ppastats.git]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index
662a87e
..
94cf696
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-31,7
+31,9
@@
int debug;
static const char *program_name;
int debug;
static const char *program_name;
-static void display_published_binaries(const char *owner, const char *ppa)
+static void display_published_binaries(const char *owner,
+ const char *ppa,
+ const char *package_status)
{
struct ppa_stats *ppastats;
struct package_stats **packages;
{
struct ppa_stats *ppastats;
struct package_stats **packages;
@@
-39,7
+41,7
@@
static void display_published_binaries(const char *owner, const char *ppa)
struct distro_stats **distros;
struct arch_stats **archs;
struct distro_stats **distros;
struct arch_stats **archs;
- ppastats = create_ppa_stats(owner, ppa);
+ ppastats = create_ppa_stats(owner, ppa
, package_status
);
packages = ppastats->packages;
while (packages && *packages) {
struct package_stats *p = *packages;
packages = ppastats->packages;
while (packages && *packages) {
struct package_stats *p = *packages;
@@
-84,8
+86,10
@@
static void display_published_binaries(const char *owner, const char *ppa)
static struct option long_options[] = {
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
static struct option long_options[] = {
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
- {"
html", no_argument, 0, 't
'},
+ {"
output-dir", required_argument, 0, 'o
'},
{"debug", no_argument, 0, 'd'},
{"debug", no_argument, 0, 'd'},
+ {"status", required_argument, 0, 's'},
+ {"skip-js-css", no_argument, 0, 'S'},
{0, 0, 0, 0}
};
{0, 0, 0, 0}
};
@@
-97,7
+101,7
@@
License GPLv2: GNU GPL version 2 or later \
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n",
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n",
- "201
0-201
1");
+ "2011");
}
static void print_help()
}
static void print_help()
@@
-119,9
+123,16
@@
static void print_help()
puts("");
puts("\
puts("");
puts("\
- -
t, --html
\
-generates
an HTML output
.");
+ -
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("\
+ -S, --skip-js-css skip installation of js and css files");
puts("");
printf("Report bugs to: %s\n", PACKAGE_BUGREPORT);
puts("");
printf("Report bugs to: %s\n", PACKAGE_BUGREPORT);
@@
-135,15
+146,19
@@
int main(int argc, char **argv)
char *owner, *ppa;
int optc;
int output_html = 0;
char *owner, *ppa;
int optc;
int output_html = 0;
+ char *package_status = NULL;
int cmdok = 1;
int cmdok = 1;
+ char *output_dir = NULL;
+ int install_static_files = 1;
program_name = argv[0];
program_name = argv[0];
- while ((optc = getopt_long(argc, argv, "vh
td
", long_options,
+ while ((optc = getopt_long(argc, argv, "vh
o:ds:S
", long_options,
NULL)) != -1) {
switch (optc) {
NULL)) != -1) {
switch (optc) {
- case '
t
':
+ case '
o
':
output_html = 1;
output_html = 1;
+ output_dir = strdup(optarg);
break;
case 'd':
debug = 1;
break;
case 'd':
debug = 1;
@@
-154,6
+169,13
@@
int main(int argc, char **argv)
case 'v':
print_version();
exit(EXIT_SUCCESS);
case 'v':
print_version();
exit(EXIT_SUCCESS);
+ case 's':
+ if (optarg)
+ package_status = strdup(optarg);
+ break;
+ case 'S':
+ install_static_files = 0;
+ break;
default:
cmdok = 0;
break;
default:
cmdok = 0;
break;
@@
-170,11
+192,14
@@
int main(int argc, char **argv)
ppa = argv[optind+1];
if (output_html)
ppa = argv[optind+1];
if (output_html)
- ppa_to_html(owner, ppa);
+ ppa_to_html(owner, ppa, package_status, output_dir,
+ install_static_files);
else
else
- display_published_binaries(owner, ppa);
+ display_published_binaries(owner, ppa
, package_status
);
/* for valgrind.... */
/* for valgrind.... */
+ free(package_status);
+ free(output_dir);
lp_ws_cleanup();
cache_cleanup();
lp_ws_cleanup();
cache_cleanup();