ahem
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 4 May 2008 10:04:04 +0000 (10:04 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 4 May 2008 10:04:04 +0000 (10:04 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@85 251d49ef-1d17-4917-a970-b30cf55b089b

prometheus.c

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