X-Git-Url: https://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=blobdiff_plain;f=prometheus.c;h=5b90528c7bad21025eb4c6bd12c08ae29f9ff623;hp=8a567a173671e6be1758b5f88d11a43facf48b52;hb=2d1141371d8f714276b8b17ff3d55a5dfc91b900;hpb=5a8f2e77c57c7c7f2fcf1ef5933a0a771dd57777 diff --git a/prometheus.c b/prometheus.c index 8a567a1..5b90528 100644 --- a/prometheus.c +++ b/prometheus.c @@ -33,32 +33,34 @@ #include "cll1-0.6.h" -const char *version="0.7.9-c"; +const char *version = "0.7.9-c"; /* Version numbers: 0.7.9 will be last development ("beta"), 0.8.0 first stable */ /* Debian(RPM) package versions/patchlevels: 0.7.9-2, 0.8.0-1, 0.8.0-2, etc. */ /* C source code development versions ("beta"): 0.7.9-a, 0.8.1-b, etc. */ /* C source code release versions: 0.8.0, 0.8.2, 0.8.4, etc. */ +const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2008 Michael Polak, Arachne Labs
\n"; + /* ======= All path names are defined here (for RPM patch) ======= */ -char *tc = "/sbin/tc"; /* requires tc with HTB support */ -char *iptables = "/sbin/iptables"; /* requires iptables utility */ -char *iptablessave = "/sbin/iptables-save"; /* not yet required */ +char *tc = "/sbin/tc"; /* requires tc with HTB support */ +char *iptables = "/sbin/iptables"; /* requires iptables utility */ +char *iptablessave = "/sbin/iptables-save"; /* not yet required */ char *iptablesrestore = "/sbin/iptables-restore"; /* requires iptables-restore */ -char *ls = "/bin/ls"; /* this is not user configurable :-) */ +char *ls = "/bin/ls"; /* this is not user configurable :-) */ -char *config = "/etc/prometheus/prometheus.conf"; /* main configuration file */ -char *hosts = "/etc/prometheus/hosts"; /* per-IP bandwidth definition file */ +char *config = "/etc/prometheus/prometheus.conf"; /* main configuration file */ +char *hosts = "/etc/prometheus/hosts"; /* per-IP bandwidth definition file */ -char *iptablesfile = "/var/spool/prometheus.iptables"; /* temporary file for iptables-restore*/ -char *credit = "/var/lib/misc/prometheus.credit"; /* credit log file */ -char *html = "/var/www/traffic.html"; /* hall of fame filename */ -char *preview = "/var/www/preview.html"; /* hall of fame preview */ -char *cmdlog = "/var/log/prometheuslog"; /* command log filename */ -char *log_dir = "/var/www/logs/"; /* log directory pathname, ended with slash */ -char *log_url = "logs/"; /* log directory relative URI prefix (partial URL) */ -char *html_log_dir = "/var/www/logs/html/"; +char *iptablesfile = "/var/spool/prometheus.iptables"; /* temporary file for iptables-restore*/ +char *credit = "/var/lib/misc/prometheus.credit"; /* credit log file */ +char *html = "/var/www/traffic.html"; /* hall of fame filename */ +char *preview = "/var/www/preview.html"; /* hall of fame preview */ +char *cmdlog = "/var/log/prometheuslog"; /* command log filename */ +char *log_dir = "/var/www/logs/"; /* log directory pathname, ended with slash */ +char *log_url = "logs/"; /* log directory relative URI prefix (partial URL) */ +char *html_log_dir = "/var/www/logs/html/"; /* ======= Help screen is hopefuly self-documenting part of code :-) ======= */ @@ -707,7 +709,7 @@ void parse_ip_log(int argc, char **argv) case 7: case 8: case 9: - case 10: if (isalnum(*ptr)) /* alphanumeric string = date, just one*/ + case 10: if (isalpha(*ptr)) /* character, not numeric string = date, just one*/ { valid_columns(ptr2,ptr,' ',col2) switch(col2) { @@ -755,7 +757,8 @@ void parse_ip_log(int argc, char **argv) total+=iplog->traffic>>10; } fprintf(f,"Total:%ld GB%Ld kbps\n", total, line); - fputs("\n",f); + fputs("\n", f); + fprintf(f, stats_html_signature, version); fclose(f); puts(" done."); } @@ -1467,9 +1470,9 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); fprintf(f,"All users, all traffic\n"); fprintf(f,"%d100 %%%Lu M100 %%\n",active_classes,total); - fputs("\n",f); + fputs("\n", f); } - fprintf(f,"Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2008 Michael Polak, Arachne Labs
\n",version); + fprintf(f, stats_html_signature, version); fclose(f); }