From 0db8e99319ee2e9798ba7fb58a7666791cf81414 Mon Sep 17 00:00:00 2001 From: xchaos Date: Thu, 11 Oct 2012 23:47:17 +0000 Subject: [PATCH] serious bug fixed git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@205 251d49ef-1d17-4917-a970-b30cf55b089b --- cll1-0.6.2.h | 2 +- htmlandlogs.c | 6 +----- json.c | 12 +++++++----- prometheus.c | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cll1-0.6.2.h b/cll1-0.6.2.h index 37a6ab5..6b2214b 100644 --- a/cll1-0.6.2.h +++ b/cll1-0.6.2.h @@ -35,7 +35,7 @@ #define not ! #define and && -#define or && +#define or || #define TRUE 1 #define FALSE 0 #define loop while(1) diff --git a/htmlandlogs.c b/htmlandlogs.c index 73a3d0f..98af96c 100644 --- a/htmlandlogs.c +++ b/htmlandlogs.c @@ -50,7 +50,7 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview) { int i; char *str; - FILE *f=fopen(html,"w"); + FILE *f=fopen(html, "w"); string(str,STRLEN); if(f > 0) @@ -58,10 +58,6 @@ void write_htmlandlogs(char *html, char *d, int total, int just_preview) int count=1; i=0; - /*-----------------------------------------------------------------*/ - printf("Writing statistics summary into HTML page %s ...\n", html); - /*-----------------------------------------------------------------*/ - if(use_jquery_popups) { fprintf(f,"\n", jquery_url); diff --git a/json.c b/json.c index c9c63f0..0d8b514 100644 --- a/json.c +++ b/json.c @@ -12,6 +12,7 @@ void write_json_traffic(char *json) { int jsoncount=0; fprintf(f, "{\n"); + for_each(ip, ips) { if( ip->lmsid > 0 @@ -21,11 +22,12 @@ void write_json_traffic(char *json) { fprintf(f, ",\n"); } - fprintf(f, " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu,\ - \"min\":%d, \"max\":%d, \"limit\":%d, \"realquota\":%Lu, \"credit\":%Lu, \"dailyquota\":%ld }", - ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload, - ip->min, ip->desired, ip->max, ip->realquota, ip->credit, - (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))); + fprintf(f, + " \"%s\":{ \"lms\": %d, \"ip\":\"%s\", \"total\":%Lu, \"down\":%Lu, \"proxy\":%Lu, \"up\":%Lu, \ +\"min\":%d, \"max\":%d, \"limit\":%d, \"realquota\":%Lu, \"credit\":%Lu, \"dailyquota\":%ld }", + ip->name, ip->lmsid, ip->addr, ip->traffic, ip->direct, ip->proxy, ip->upload, + ip->min, ip->desired, ip->max, ip->realquota, ip->credit, + (ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))); jsoncount++; } } diff --git a/prometheus.c b/prometheus.c index 2eda259..780b158 100644 --- a/prometheus.c +++ b/prometheus.c @@ -1086,7 +1086,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); /*-----------------------------------------------------------------*/ printf("Writing statistics into HTML page %s ...\n", html); /*-----------------------------------------------------------------*/ - write_htmlandlogs(json_traffic,d,total, just_preview); + write_htmlandlogs(html, d,total, just_preview); if(just_preview) { -- 2.30.2