improved log parsing
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 4 May 2008 09:17:16 +0000 (09:17 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 4 May 2008 09:17:16 +0000 (09:17 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@83 251d49ef-1d17-4917-a970-b30cf55b089b

cll1-0.6.h
prometheus.c

index d139fc6f2cc528ecb1ae48e9c38cec2ac4d97784..3660561ba83451a65bf33a87cf3ded9ff6d8e9f5 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <time.h>
 #include <unistd.h>
+#include <ctype.h>
 
 /* Section For Dummies part 1, updated 2004-05-07 by xCh. */
 
 
 /* Section For Dummies part 1, updated 2004-05-07 by xCh. */
 
index 0beef7a866ae1ee45fb786d270338ebdeafc7497..d8eaef2d44f4dee405ef9d603ce9b082cffdca43 100644 (file)
 \r
 #include "cll1-0.6.h"\r
 \r
 \r
 #include "cll1-0.6.h"\r
 \r
-const char *version="0.7.9.2"; /*0.7.9 will be last development, 0.8.0 first stable */\r
+const char *version="0.7.9-c"; \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
 /* ======= All path names are defined here (for RPM patch) =======  */\r
 \r
 \r
 /* ======= All path names are defined here (for RPM patch) =======  */\r
 \r
@@ -436,7 +440,7 @@ void get_config(char *config_filename)
  /* are supplied values meaningful ?*/\r
  if(line<=0 || up<=0)\r
  {\r
  /* are supplied values meaningful ?*/\r
  if(line<=0 || up<=0)\r
  {\r
-  puts("Illegal value of wan bandwidth: 0 kbps.");\r
+  puts("Illegal value of LAN or WAN bandwidth: 0 kbps.");\r
   reject_config_and_exit(config_filename);\r
  }\r
 }\r
   reject_config_and_exit(config_filename);\r
  }\r
 }\r
@@ -684,6 +688,7 @@ void parse_ip_log(int argc, char **argv)
 \r
  sprintf(str,"%s %s/*.log",ls,log_dir);\r
  shell(str);\r
 \r
  sprintf(str,"%s %s/*.log",ls,log_dir);\r
  shell(str);\r
+\r
  input(str,STRLEN)\r
  {\r
   ptr=strrchr(str,'\n');\r
  input(str,STRLEN)\r
  {\r
   ptr=strrchr(str,'\n');\r
@@ -698,12 +703,19 @@ void parse_ip_log(int argc, char **argv)
    {\r
     case 2: name=ptr;break;\r
     case 3: traffic=atol(ptr);break;\r
    {\r
     case 2: name=ptr;break;\r
     case 3: traffic=atol(ptr);break;\r
-    case 7: valid_columns(ptr2,ptr,' ',col2) switch(col2)\r
+    /* column number   - was 7, now 9...*/\r
+    case 7:\r
+    case 8:\r
+    case 9: if (isalnum(*ptr)) /* alphanumeric string = date, just one*/\r
             {\r
             {\r
-             case 2: if(any_month || eq(ptr2,month)) m_ok=1; break;\r
-             case 5: if(eq(ptr2,year)) y_ok=1; break;\r
+              valid_columns(ptr2,ptr,' ',col2) switch(col2)\r
+              {\r
+               case 2: if(any_month || eq(ptr2,month)) m_ok=1; break;\r
+               case 5: if(eq(ptr2,year)) y_ok=1; break;\r
+              }\r
             }\r
    }\r
             }\r
    }\r
+   \r
    if(y_ok && m_ok) \r
    {\r
     traffic_month+=traffic;\r
    if(y_ok && m_ok) \r
    {\r
     traffic_month+=traffic;\r
@@ -711,6 +723,7 @@ void parse_ip_log(int argc, char **argv)
    }\r
   }\r
   done;\r
    }\r
   }\r
   done;\r
+\r
   if(accept_month)\r
   {\r
    create(iplog,IpLog);\r
   if(accept_month)\r
   {\r
    create(iplog,IpLog);\r
This page took 0.160191 seconds and 4 git commands to generate.