02110-1301 USA
*/
+#include <libintl.h>
+#define _(String) gettext(String)
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "html.h"
#include "io.h"
+#include "log.h"
#include "lp.h"
#include "lp_ws.h"
#include "ppastats.h"
f = fopen(path, "w");
if (!f) {
- fprintf(stderr, "ERROR: failed to open: %s\n", path);
+ log_err(_("failed to open: %s"), path);
return ;
}
f = fopen(path, "w");
if (!f) {
- fprintf(stderr, "ERROR: failed to open: %s\n", path);
+ log_err(_("failed to open: %s"), path);
return ;
}
json = ppa_to_json(ppa);
json_path = path_new(dir, "index", ".json");
- if (debug)
- printf("DEBUG: generating %s\n", json_path);
+
+ log_debug(_("generating %s"), json_path);
json_object_to_file(json_path, json);
json_object_put(json);
free(json_path);
json_path = path_new(dir, pkg->name, ".json");
json = pkg_to_json(ppa, pkg);
- if (debug)
- printf("DEBUG: generating %s\n", json_path);
+ log_debug(_("generating %s"), json_path);
+
json_object_to_file(json_path, json);
json_object_put(json);
free(json_path);
1);
sprintf(script, "ppastats_pkg(\"%s%s\");", pkg->name, ".json");
- if (debug)
- printf("DEBUG: generating %s\n", path);
+ log_debug(_("generating %s"), path);
create_html(path, pkg->name, HTML_PKG_TEMPLATE, script);
free(path);
for (i = 0; i < 7; i++) {
f_dst = path_append(output_dir, www_files[2*i+1]);
- if (debug)
- printf("DEBUG: copying %s %s\n",
- www_files[2*i], f_dst);
+ log_debug(_("copying %s %s"), www_files[2*i], f_dst);
fcopy(www_files[2*i], f_dst);
free(f_dst);