}\r
printf("Analysing traffic for %s %s ...\n",month,year);\r
\r
- sprintf(str,"%s %s/*.log",ls,log_dir);\r
+ /* sorry... next release of C<<1 header file will include for_path_files(name,path) { } macro */\r
+ sprintf(str,"%s %s/",ls,log_dir);\r
shell(str);\r
-\r
- input(str,STRLEN)\r
+ input(str,STRLEN) \r
{\r
- ptr=strrchr(str,'\n');\r
- if(ptr) *ptr='\0';\r
- printf("Parsing %s ...",str);\r
- accept_month=0;\r
- traffic_month=0;\r
- guaranted = 0;\r
- parse(str)\r
- {\r
- y_ok=m_ok=0; \r
- valid_columns(ptr,_,'\t',col) switch(col)\r
+ if(strstr(str,".log"))\r
{\r
- case 2: name = ptr;break;\r
- case 3: traffic = atol(ptr);break;\r
- /* column number - was 7, now 10...*/\r
- case 7:\r
- case 8:\r
- case 9:\r
- case 10: if (isalpha(*ptr)) /* character, not numeric string = date, just one*/\r
- {\r
- valid_columns(ptr2,ptr,' ',col2) switch(col2)\r
+ ptr=strrchr(str,'\n');\r
+ if(ptr) *ptr='\0';\r
+ printf("Parsing %s ...",str);\r
+ accept_month=0;\r
+ traffic_month=0;\r
+ guaranted = 0;\r
+ parse(str)\r
+ {\r
+ y_ok=m_ok=0; \r
+ valid_columns(ptr,_,'\t',col) switch(col)\r
+ {\r
+ case 2: name = ptr;break;\r
+ case 3: traffic = atol(ptr);break;\r
+ /* column number - was 7, now 10...*/\r
+ case 7:\r
+ case 8:\r
+ case 9:\r
+ case 10: if (isalpha(*ptr)) /* character, not numeric string = date, just one*/\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
- else\r
- {\r
- if(col == 7) guaranted = atol(ptr);\r
- }\r
- }\r
- \r
- if(y_ok && m_ok) \r
- {\r
- traffic_month += traffic;\r
- accept_month = 1;\r
- }\r
- }\r
- done;\r
+ else\r
+ {\r
+ if(col == 7) guaranted = atol(ptr);\r
+ }\r
+ }\r
+ \r
+ if(y_ok && m_ok) \r
+ {\r
+ traffic_month += traffic;\r
+ accept_month = 1;\r
+ }\r
+ }\r
+ done;\r
\r
- if(accept_month)\r
- {\r
- create(iplog,IpLog);\r
- iplog->name = name;\r
- iplog->guaranted = guaranted;\r
- iplog->traffic = traffic_month;\r
- insert(iplog,iplogs,desc_order_by,traffic);\r
- printf(" %ld MB\n",iplog->traffic);\r
- }\r
- else\r
- puts(" no records.");\r
+ if(accept_month)\r
+ {\r
+ create(iplog,IpLog);\r
+ iplog->name = name;\r
+ iplog->guaranted = guaranted;\r
+ iplog->traffic = traffic_month;\r
+ insert(iplog,iplogs,desc_order_by,traffic);\r
+ printf(" %ld MB\n",iplog->traffic);\r
+ }\r
+ else\r
+ puts(" no records.");\r
+ }\r
}\r
sprintf(str,"%s/%s-%s.html",html_log_dir,year,month);\r
printf("Writing %s ...",str);\r
\r
\r
/*-----------------------------------------------------------------*/\r
-/* Are you looking for int main (int argc, char **argv) ? :-)) */\r
+/* Are you looking for int main(int argc, char **argv) ? :-)) */\r
/*-----------------------------------------------------------------*/\r
\r
program\r