From ad4cb1299f009eb3885b2feb7a26851b5e57dac6 Mon Sep 17 00:00:00 2001 From: xchaos Date: Sun, 20 Nov 2011 23:20:33 +0000 Subject: [PATCH] LMS id do mesicnich a rocnich statistik git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@148 251d49ef-1d17-4917-a970-b30cf55b089b --- prometheus.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/prometheus.c b/prometheus.c index 3cc2662..5a0939f 100644 --- a/prometheus.c +++ b/prometheus.c @@ -646,7 +646,7 @@ void run_restore(void) /* == This function strips extra characters after IP address and stores it = */ -void parse_ip(char *str) +void parse_ip(struct IP *ip, char *str) { char *ptr,*ipaddr=NULL,*ipname=NULL,*lmsid=NULL; @@ -839,20 +839,30 @@ void parse_ip_log(int argc, char **argv) f=fopen(str,"w"); if(f) { - fprintf(f,"\n ",month,year); + fprintf(f,"
%s %sData transfersMin.speed
\n ",month,year); for_each(iplog,iplogs) { if(iplog->traffic) { - fprintf(f,"\n", - i++, iplog->name, iplog->traffic, iplog->traffic>>10, iplog->guaranted); + fprintf(f,"\n", + iplog->traffic, iplog->traffic>>10, iplog->guaranted); total+=iplog->traffic>>10; iplog->i=i; iplog->l=total; } } - fprintf(f,"\n", total, line); + fprintf(f,"\n", total, line); fputs("
%s %slmsData transfersMin.speed
%d%s%ld M%ld G%ld kbps
%d%s", i++, iplog->name); + if(iplog->lmsid > 0) + { + /*base URL will be configurable soon ... */ + fprintf(f,"%04d\n", iplog->lmsid, iplog->lmsid); + } + else if(iplog->lmsid == 0) + { + fputs("-------",f); + } + fprintf(f,"%ld M%ld G%ld kbps
Total:%ld GB%Ld kbps
Total:%ld GB%Ld kbps
\n", f); if(i>10) @@ -1023,7 +1033,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if(substring) { substring+=8; //"sharing-" - parse_ip(str); + parse_ip(ip, str); ip_count++; ip->sharing=substring; ip->keyword=defaultkeyword; /* settings for default keyword */ @@ -1039,7 +1049,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if_exists(keyword,keywords,(substring=strstr(str,keyword->key))) { - parse_ip(str); + parse_ip(ip, str); ip_count++; ip->keyword=keyword; keyword->ip_count++; @@ -1606,7 +1616,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } else if(ip->lmsid == 0) { - fputs("------",f); + fputs("-------",f); } fputs("\n",f); } -- 2.30.2