projects
/
ppastats.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed style
[ppastats.git]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index
e1f17d5
..
4c84444
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-25,13
+25,15
@@
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
-#include "cache.h"
-#include "html.h"
-#include "http.h"
-#include "log.h"
-#include "lp_ws.h"
-#include "config.h"
-#include "ppastats.h"
+#include <cache.h>
+#include <config.h>
+#include <fcache.h>
+#include <html.h>
+#include <http.h>
+#include <lp_ws.h>
+#include <pio.h>
+#include <plog.h>
+#include <ppastats.h>
static const char *program_name;
static const char *program_name;
@@
-96,6
+98,7
@@
static struct option long_options[] = {
{"status", required_argument, 0, 's'},
{"skip-js-css", no_argument, 0, 'S'},
{"get-bpph-size", required_argument, 0, 0},
{"status", required_argument, 0, 's'},
{"skip-js-css", no_argument, 0, 'S'},
{"get-bpph-size", required_argument, 0, 0},
+ {"theme-dir", required_argument, 0, 't'},
{0, 0, 0, 0}
};
{0, 0, 0, 0}
};
@@
-128,6
+131,7
@@
static void print_help()
puts("");
puts(_(" -o, --output-dir=[PATH] generates HTML pages into 'PATH'"));
puts("");
puts(_(" -o, --output-dir=[PATH] generates HTML pages into 'PATH'"));
+ puts(_(" -t, --theme-dir=[PATH] set theme dir to 'PATH'"));
puts(_(
" -s, --status=[STATUS] retrieves only package of the given status\n"
puts(_(
" -s, --status=[STATUS] retrieves only package of the given status\n"
@@
-148,7
+152,7
@@
static void print_help()
int main(int argc, char **argv)
{
int main(int argc, char **argv)
{
- char *owner, *ppa, *package_status, *output_dir;
+ char *owner, *ppa, *package_status, *output_dir
, *theme_dir, *log, *tmp
;
int optc, output_html, cmdok, install_static_files, ws_size, opti;
program_name = argv[0];
int optc, output_html, cmdok, install_static_files, ws_size, opti;
program_name = argv[0];
@@
-163,8
+167,9
@@
int main(int argc, char **argv)
package_status = NULL;
output_html = 0;
ws_size = -1;
package_status = NULL;
output_html = 0;
ws_size = -1;
+ theme_dir = NULL;
- while ((optc = getopt_long(argc, argv, "vho:ds:S", long_options,
+ while ((optc = getopt_long(argc, argv, "vho:
t:
ds:S", long_options,
&opti)) != -1) {
switch (optc) {
case 0:
&opti)) != -1) {
switch (optc) {
case 0:
@@
-188,6
+193,10
@@
int main(int argc, char **argv)
if (optarg)
package_status = strdup(optarg);
break;
if (optarg)
package_status = strdup(optarg);
break;
+ case 't':
+ if (optarg)
+ theme_dir = strdup(optarg);
+ break;
case 'S':
install_static_files = 0;
break;
case 'S':
install_static_files = 0;
break;
@@
-198,25
+207,43
@@
int main(int argc, char **argv)
}
if (!cmdok || optind + 2 != argc) {
}
if (!cmdok || optind + 2 != argc) {
- fprintf(stderr, _("Try `%s --help' for more information.\n"),
+ fprintf(stderr,
+ _("Try `%s --help' for more information.\n"),
program_name);
exit(EXIT_FAILURE);
}
program_name);
exit(EXIT_FAILURE);
}
+ tmp = path_append(getenv("HOME"), ".ppastats");
+ log = path_append(tmp, "ppastats.log");
+ log_open(log);
+ free(tmp);
+ free(log);
+
owner = argv[optind];
ppa = argv[optind+1];
owner = argv[optind];
ppa = argv[optind+1];
- if (output_html)
- ppa_to_html(owner, ppa, package_status, output_dir,
- install_static_files, ws_size);
- else
+ if (output_html) {
+ if (theme_dir)
+ html_set_theme_dir(theme_dir);
+ else
+ html_set_theme_dir(DEFAULT_THEME_DIR);
+ ppa_to_html(owner,
+ ppa,
+ package_status,
+ output_dir,
+ install_static_files,
+ ws_size);
+ } else {
display_published_binaries(owner, ppa, package_status, ws_size);
display_published_binaries(owner, ppa, package_status, ws_size);
+ }
/* for valgrind.... */
free(package_status);
free(output_dir);
http_cleanup();
cache_cleanup();
/* for valgrind.... */
free(package_status);
free(output_dir);
http_cleanup();
cache_cleanup();
+ fcache_cleanup();
+ html_cleanup();
exit(EXIT_SUCCESS);
}
exit(EXIT_SUCCESS);
}