2 * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
6 * please look at http://sarg.sourceforge.net/donations.php
8 * http://sourceforge.net/projects/sarg/forums/forum/363374
9 * ---------------------------------------------------------------------
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
27 #include "include/conf.h"
28 #include "include/defs.h"
30 static FILE *fp_tt
=NULL
;
32 static void maketmp(const char *user
, const char *dirname
, int debug
, int indexonly
);
33 static void maketmp_hour(const char *user
, const char *dirname
, int indexonly
);
34 static void gravatmp_hora(const char *dirname
, const struct userinfostruct
*uinfo
, const char *data
, const char *hora
, long long int elap
, long long int accbytes
, int indexonly
);
35 static void gravatmpf(const struct userinfostruct
*uinfo
, const char *oldurl
, long long int nacc
, long long int nbytes
, const char *oldmsg
, long long int nelap
, int indexonly
, long long int incache
, long long int oucache
);
36 static void gravaporuser(const struct userinfostruct
*uinfo
, const char *dirname
, const char *url
, const char *ip
, const char *data
, const char *hora
, long long int tam
, long long int elap
, int indexonly
);
37 static void gravager(FILE *fp_gen
, const struct userinfostruct
*uinfo
, long long int nacc
, const char *url
, long long int nbytes
, const char *ip
, const char *hora
, const char *dia
, long long int nelap
, long long int incache
, long long int oucache
);
38 static void grava_SmartFilter(const char *dirname
, const char *user
, const char *ip
, const char *data
, const char *hora
, const char *url
, const char *smart
);
47 char accdia
[11], acchora
[9], accip
[MAXLEN
], *accurl
;
48 char oldaccdia
[11], oldacchora
[9], oldaccip
[MAXLEN
];
49 char wdirname
[MAXLEN
];
51 char oldmsg
[50], acccode
[MAXLEN
/2 - 1], oldacccode
[MAXLEN
/2 - 1], user
[MAX_USER_LEN
];
52 char ipantes
[MAXLEN
], nameantes
[MAXLEN
];
53 char accsmart
[MAXLEN
];
54 char crc2
[MAXLEN
/2 -1];
55 char siteind
[MAX_TRUNCATED_URL
];
58 char oldaccdiatt
[11],oldacchoratt
[9];
61 char u2
[MAX_USER_LEN
];
62 long long int nbytes
=0;
63 long long int nelap
=0;
65 long long int rtotal
=0;
66 long long int incache
=0;
67 long long int oucache
=0;
68 long long int accbytes
, accelap
;
71 struct dirent
*direntp
;
72 const char logext
[]=".log";
79 struct getwordstruct gwarea
;
80 struct longlinestruct line
;
81 struct userinfostruct
*uinfo
,*puinfo
;
86 sprintf(outdirname
, "%s%s", outdir
, period
);
87 vrfydir(period
, addr
, site
, us
, email
);
90 debugaz("outdirname",outdirname
);
93 gperiod(outdirname
,period
);
95 if(UserAgentLog
[0] != '\0' && email
[0] == '\0') useragent();
97 snprintf(wdirname
,sizeof(wdirname
),"%s/sarg-general",outdirname
);
98 if((fp_gen
=MY_FOPEN(wdirname
,"w"))==NULL
){
99 debuga(_("(report) Cannot open file %s\n"),wdirname
);
104 strncat(tmp
,"/sarg",5);
108 while ((direntp
= readdir( dirp
)) != NULL
) {
109 dlen
=strlen(direntp
->d_name
)-(sizeof(logext
)-1);
110 if (dlen
<0) continue;
111 if((strcmp(direntp
->d_name
+dlen
,logext
) != 0) ||
112 (strncmp(direntp
->d_name
,"download.log",12) == 0) ||
113 (strncmp(direntp
->d_name
,"denied.log",10) == 0) ||
114 (strncmp(direntp
->d_name
,"authfail.log.unsort",19) == 0))
116 if (snprintf(tmp3
,sizeof(tmp3
),"%s/%s",tmp
,direntp
->d_name
)>=sizeof(tmp3
)) {
117 fprintf(stderr
, "SARG: (report) directory entry too long: %s/%s\n",tmp
,direntp
->d_name
);
120 if((fp_in
=MY_FOPEN(tmp3
,"r"))==NULL
){
121 fprintf(stderr
, "SARG: (report) %s: %s\n",_("Cannot open file"),tmp
);
126 if (dlen
>=sizeof(user
)) continue;
127 strncpy(user
,direntp
->d_name
,dlen
);
133 uinfo
=userinfo_find_from_file(user
);
135 debuga(_("Ignoring unknown user file %s\n"),user
);
138 strcpy(u2
,uinfo
->id
);
139 if(Ip2Name
&& uinfo
->id_is_ip
) {
141 ip2name(u2
,sizeof(u2
));
142 strcpy(nameantes
,u2
);
144 user_find(uinfo
->label
,MAX_USER_LEN
, u2
);
146 maketmp(user
,tmp
,debug
,indexonly
);
147 maketmp_hour(user
,tmp
,indexonly
);
152 memset(oldaccdiatt
,0,sizeof(oldaccdiatt
));
153 memset(oldacchoratt
,0,sizeof(oldacchoratt
));
156 if (longline_prepare(&line
)<0) {
157 debuga(_("Not enough memory to read the downloaded files\n"));
161 while((buf
=longline_read(fp_in
,&line
))!=NULL
) {
162 getword_start(&gwarea
,buf
);
163 if (getword(accdia
,sizeof(accdia
),&gwarea
,'\t')<0 || getword(acchora
,sizeof(acchora
),&gwarea
,'\t')<0 ||
164 getword(accip
,sizeof(accip
),&gwarea
,'\t')<0 ||
165 getword_ptr(buf
,&accurl
,&gwarea
,'\t')<0 || getword_atoll(&accbytes
,&gwarea
,'\t')<0 ||
166 getword(acccode
,sizeof(acccode
),&gwarea
,'\t')<0) {
167 debuga(_("There is a broken record or garbage in file %s\n"),tmp3
);
170 if(strncmp(acccode
,"TCP_DENIED/407",14) == 0) continue;
171 if (getword_atoll(&accelap
,&gwarea
,'\t')<0) {
172 debuga(_("There is a broken elapsed time in file %s\n"),tmp3
);
175 if (getword_skip(20000,&gwarea
,'"')<0 || getword(accsmart
,sizeof(accsmart
),&gwarea
,'"')<0) {
176 debuga(_("There is a broken smart info in file %s\n"),tmp3
);
180 if(accsmart
[0] != '\0') {
182 grava_SmartFilter(outdirname
,uinfo
->id
,accip
,accdia
,acchora
,accurl
,accsmart
);
186 if(strcmp(accip
,ipantes
) != 0) {
187 strcpy(ipantes
,accip
);
188 ip2name(accip
,sizeof(accip
));
189 strcpy(nameantes
,accip
);
190 } else strcpy(accip
,nameantes
);
193 gravatmp_hora(outdirname
,uinfo
,accdia
,acchora
,accelap
,accbytes
,indexonly
);
196 gravaporuser(uinfo
,outdirname
,accurl
,accip
,accdia
,acchora
,accbytes
,accelap
,indexonly
);
200 url_len
=strlen(accurl
);
201 if (!oldurl
|| url_len
>=ourl_size
) {
203 oldurl
=realloc(oldurl
,ourl_size
);
205 debuga(_("Not enough memory to store the url\n"));
209 strcpy(oldurl
,accurl
);
210 strcpy(oldacccode
,acccode
);
212 strcpy(oldaccip
,accip
);
213 strcpy(oldaccdia
,accdia
);
214 strcpy(oldacchora
,acchora
);
218 same_url
=(strcmp(oldurl
,accurl
) == 0);
220 if(site
[0] != '\0') {
223 if(strstr(oldacccode
,"DENIED") != 0)
224 sprintf(oldmsg
,"%s",_("DENIED"));
225 gravatmp(puinfo
,oldurl
,nacc
,nbytes
,oldmsg
,nelap
,indexonly
,incache
,oucache
);
226 gravager(fp_gen
,puinfo
,nacc
,oldurl
,nbytes
,oldaccip
,oldacchora
,oldaccdia
,nelap
,incache
,oucache
);
234 if(!same_url
|| new_user
){
235 if(strstr(oldacccode
,"DENIED") != 0)
236 strcpy(oldmsg
,_("DENIED"));
239 gravatmp(puinfo
,oldurl
,nacc
,nbytes
,oldmsg
,nelap
,indexonly
,incache
,oucache
);
240 gravager(fp_gen
,puinfo
,nacc
,oldurl
,nbytes
,oldaccip
,oldacchora
,oldaccdia
,nelap
,incache
,oucache
);
252 if ((ReportType
& REPORT_TYPE_SITE_USER_TIME_DATE
) != 0 &&
253 (!oldurltt
|| strcmp(oldurltt
,accurl
) || strcmp(oldaccdiatt
,accdia
) || strcmp(oldacchoratt
,acchora
))) {
256 url_to_file(accurl
,siteind
,sizeof(siteind
));
257 snprintf(arqtt
,sizeof(arqtt
),"%s/%s",outdirname
,uinfo
->filename
);
258 if(access(arqtt
, R_OK
) != 0)
260 snprintf(arqtt
,sizeof(arqtt
),"%s/%s/tt%s-%s.html",outdirname
,uinfo
->filename
,uinfo
->filename
,siteind
);
261 if ((fp_tt
= fopen(arqtt
, "w")) == 0) {
262 fprintf(stderr
, "SARG: (report) %s: %s\n",_("Cannot open file"),arqtt
);
269 sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s", \
270 FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
272 sprintf(httplink,"<font size=%s><a href=\"http://%s\">%s</a>",FontSize,accurl,accurl);
275 write_html_header(fp_tt
,(IndexTree
== INDEX_TREE_DATE
) ? 4 : 2,_("Site access report"));
276 fprintf(fp_tt
,"<tr><td class=\"header_l\">%s: %s</td></tr>\n",_("Period"),period
);
277 fprintf(fp_tt
,"<tr><td class=\"header_l\">%s: %s</td></tr>\n",_("User"),uinfo
->label
);
278 fprintf(fp_tt
,"<tr><td class=\"header_l\">%s: %s, %s</td></tr>\n",_("Sort"),UserSortField
,UserSortOrder
);
279 fprintf(fp_tt
,"<tr><th class=\"header_c\">%s</th></tr>\n",_("User"));
280 close_html_header(fp_tt
);
282 fputs("<div class=\"report\"><table cellpadding=\"0\" cellspacing=\"2\">\n",fp_tt
);
283 fputs("<tr><td></td><td></td></tr>",fp_tt
);
284 strncpy(tmp4
,_("DATE/TIME"),4);
286 fprintf(fp_tt
,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",_("ACCESSED SITE"),tmp4
,_("DATE/TIME")+5);
289 fputs("<tr><td class=\"data\">",fp_tt
);
290 output_html_string(fp_tt
,accurl
,100);
291 fprintf(fp_tt
,"</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",accdia
,acchora
);
293 url_len
=strlen(accurl
);
294 if (!oldurltt
|| url_len
>=ourltt_size
) {
295 ourltt_size
=url_len
+1;
296 oldurltt
=realloc(oldurltt
,ourltt_size
);
298 debuga(_("Not enough memory to store the url\n"));
302 strcpy(oldurltt
,accurl
);
303 strcpy(oldaccdiatt
,accdia
);
304 strcpy(oldacchoratt
,acchora
);
307 strcpy(crc2
,acccode
);
308 str
=strchr(crc2
,'/');
310 if(strstr(crc2
,"MISS") != 0)
312 else incache
+=accbytes
;
316 day_totalize(tmp
,puinfo
,indexonly
);
320 strcpy(oldacccode
,acccode
);
321 strcpy(oldaccip
,accip
);
323 url_len
=strlen(accurl
);
324 if (url_len
>=ourl_size
) {
326 oldurl
=realloc(oldurl
,ourl_size
);
328 debuga(_("Not enough memory to store the url\n"));
332 strcpy(oldurl
,accurl
);
334 strcpy(oldaccdia
,accdia
);
335 strcpy(oldacchora
,acchora
);
339 longline_free(&line
);
340 if (oldurltt
) free(oldurltt
);
346 if(strstr(oldacccode
,"DENIED") != 0)
347 strcpy(oldmsg
,_("DENIED"));
350 gravatmpf(puinfo
,oldurl
,nacc
,nbytes
,oldmsg
,nelap
,indexonly
,incache
,oucache
);
351 gravager(fp_gen
,puinfo
,nacc
,oldurl
,nbytes
,oldaccip
,oldacchora
,oldaccdia
,nelap
,incache
,oucache
);
355 if (puinfo
) day_totalize(tmp
,puinfo
,indexonly
);
359 totalger(outdirname
, debug
, outdir
);
361 if(email
[0] == '\0') {
362 if((ReportType
& REPORT_TYPE_DOWNLOADS
) != 0) download_report();
364 if(DansGuardianConf
[0] != '\0') {
372 if((ReportType
& REPORT_TYPE_TOPSITES
) != 0) topsites();
374 if((ReportType
& REPORT_TYPE_SITES_USERS
) != 0) siteuser();
379 if(smartfilter
) smartfilter_report();
381 if(DansGuardianConf
[0] != '\0') dansguardian_report();
385 if((ReportType
& REPORT_TYPE_USERS_SITES
) != 0) htmlrel();
389 if(SuccessfulMsg
) debuga(_("Successful report generated on %s\n"),outdirname
);
391 geramail(outdirname
, debug
, outdir
, userip
, email
, TempDir
);
393 if((strcmp(email
,"stdout") != 0) && SuccessfulMsg
)
394 debuga(_("Successful report generated and sent to %s\n"),email
);
398 index_only(outdirname
, debug
);
402 2009-10-13(Frederic) This piece of code is never called so it is commented out for good.
403 if(strlen(email) < 0)
410 static void maketmp(const char *user
, const char *dirname
, int debug
, int indexonly
)
415 char wdirname
[MAXLEN
];
417 if(indexonly
) return;
418 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
420 if(debug
) debuga(_("Making file: %s/%s\n"),tmp
,user
);
421 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.utmp",tmp
,user
)>=sizeof(wdirname
)) {
422 debuga(_("Temporary file name too long: %s/%s.utmp\n"),tmp
,user
);
426 if((fp_ou
=fopen(wdirname
,"w"))==NULL
){
427 debuga(_("(report) Cannot open file %s\n"),wdirname
);
436 static void maketmp_hour(const char *user
, const char *dirname
, int indexonly
)
441 char wdirname
[MAXLEN
];
443 if(indexonly
) return;
444 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
446 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.htmp",tmp
,user
)>=sizeof(wdirname
)) {
447 debuga(_("Temporary file name too long: %s/%s.htmp\n"),tmp
,user
);
451 if((fp_ou
=fopen(wdirname
,"w"))==NULL
){
452 debuga(_("(report-1) Cannot open file %s - %s\n"),wdirname
,strerror(errno
));
461 void gravatmp(const struct userinfostruct
*uinfo
, const char *oldurl
, long long int nacc
, long long int nbytes
, const char *oldmsg
, long long int nelap
, int indexonly
, long long int incache
, long long int oucache
)
464 char wdirname
[MAXLEN
];
466 if(indexonly
) return;
467 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
469 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.utmp",tmp
,uinfo
->filename
)>=sizeof(wdirname
)) {
470 debuga(_("Temporary file name too long: %s/%s.utmp\n"),tmp
,uinfo
->filename
);
474 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
475 debuga(_("(report) Cannot open file %s\n"),wdirname
);
479 fprintf(fp_ou
,"%lld\t%lld\t%s\t%s\t%lld\t%lld\t%lld\n",nacc
,nbytes
,oldurl
,oldmsg
,nelap
,incache
,oucache
);
485 fputs("</table>\n</div>\n",fp_tt
);
486 fputs("</body>\n</html>\n",fp_tt
);
494 static void gravatmpf(const struct userinfostruct
*uinfo
,const char *oldurl
, long long int nacc
, long long int nbytes
, const char *oldmsg
, long long int nelap
, int indexonly
, long long int incache
, long long int oucache
)
497 char wdirname
[MAXLEN
];
499 if(indexonly
|| (ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
501 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.utmp",tmp
,uinfo
->filename
)>=sizeof(wdirname
)) {
502 debuga(_("Path too long %s/%s.utmp\n"),tmp
,uinfo
->filename
);
506 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
507 debuga(_("(report) Cannot open file %s\n"),wdirname
);
511 fprintf(fp_ou
,"%lld\t%lld\t%s\t%s\t%lld\t%lld\t%lld\n",nacc
,nbytes
,oldurl
,oldmsg
,nelap
,incache
,oucache
);
517 fputs("</table>\n",fp_tt
);
518 fputs("</body>\n</html>\n",fp_tt
);
527 static void gravatmp_hora(const char *dirname
, const struct userinfostruct
*uinfo
, const char *data
, const char *hora
, long long int elap
, long long int bytes
, int indexonly
)
531 char wdirname
[MAXLEN
];
533 if(indexonly
|| ((ReportType
& REPORT_TYPE_USERS_SITES
) == 0)) return;
535 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.htmp",tmp
,uinfo
->filename
)>=sizeof(wdirname
)) {
536 debuga(_("Path too long %s/%s.htmp\n"),tmp
,uinfo
->filename
);
540 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
541 debuga(_("(report-2) Cannot open file %s - %s\n"),wdirname
,strerror(errno
));
545 if(strcmp(datetimeby
,"bytes") == 0) fprintf(fp_ou
,"%s\t%s\t%lld\n",data
,hora
,bytes
);
546 else fprintf(fp_ou
,"%s\t%s\t%lld\n",data
,hora
,elap
);
554 static void gravaporuser(const struct userinfostruct
*uinfo
, const char *dirname
, const char *url
, const char *ip
, const char *data
, const char *hora
, long long int tam
, long long int elap
, int indexonly
)
558 char wdirname
[MAXLEN
];
560 if(indexonly
|| ((ReportType
& REPORT_TYPE_USERS_SITES
) == 0)) return;
562 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.ip",tmp
,uinfo
->filename
)>=sizeof(wdirname
)) {
563 debuga(_("Path too long %s/%s.ip\n"),tmp
,uinfo
->filename
);
567 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
568 debuga(_("(report) Cannot open file %s\n"),wdirname
);
572 fprintf(fp_ou
,"%s\t%s\t%s\t%s\t%lld\t%lld\n",ip
,url
,data
,hora
,tam
,elap
);
581 static void gravager(FILE *fp_gen
, const struct userinfostruct
*uinfo
, long long int nacc
, const char *url
, long long int nbytes
, const char *ip
, const char *hora
, const char *dia
, long long int nelap
, long long int incache
, long long int oucache
)
583 fprintf(fp_gen
,"%s\t%lld\t%lld\t%s\t%s\t%s\t%s\t%lld\t%lld\t%lld\n",uinfo
->id
,nacc
,nbytes
,url
,ip
,hora
,dia
,nelap
,incache
,oucache
);
587 int ger_read(char *buffer
,struct generalitemstruct
*item
,const char *filename
)
591 long long int number
;
593 if (strncmp(buffer
,"TOTAL\t",6)==0) {
598 if (*buffer
== '-') {
601 } else if (*buffer
== '+') {
605 while (isdigit(*buffer
))
606 number
=(number
* 10) + (*buffer
++)-'0';
608 debuga(_("Invalid total number of accesses in %s\n"),filename
);
612 item
->nacc
=number
*sign
;
615 if (*buffer
== '-') {
618 } else if (*buffer
== '+') {
622 while (isdigit(*buffer
))
623 number
=(number
* 10) + (*buffer
++)-'0';
625 debuga(_("Invalid total size in %s\n"),filename
);
629 item
->nbytes
=number
*sign
;
632 if (*buffer
== '-') {
635 } else if (*buffer
== '+') {
639 while (isdigit(*buffer
))
640 number
=(number
* 10) + (*buffer
++)-'0';
642 debuga(_("Invalid total elapsed time in %s\n"),filename
);
646 item
->nelap
=number
*sign
;
649 if (*buffer
== '-') {
652 } else if (*buffer
== '+') {
656 while (isdigit(*buffer
))
657 number
=(number
* 10) + (*buffer
++)-'0';
659 debuga(_("Invalid total cache hit in %s\n"),filename
);
663 item
->incache
=number
*sign
;
666 if (*buffer
== '-') {
669 } else if (*buffer
== '+') {
673 while (isdigit(*buffer
))
674 number
=(number
* 10) + (*buffer
++)-'0';
676 debuga(_("Invalid total cache miss in %s\n"),filename
);
679 item
->oucache
=number
*sign
;
684 for (i
=0 ; i
<MAX_USER_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
686 debuga(_("User name too long or invalid in %s\n"),filename
);
692 if (*buffer
== '-') {
695 } else if (*buffer
== '+') {
699 while (isdigit(*buffer
))
700 number
=(number
* 10) + (*buffer
++)-'0';
702 debuga(_("Invalid number of accesses in %s\n"),filename
);
706 item
->nacc
=number
*sign
;
709 if (*buffer
== '-') {
712 } else if (*buffer
== '+') {
716 while (isdigit(*buffer
))
717 number
=(number
* 10) + (*buffer
++)-'0';
719 debuga(_("Invalid number of bytes in %s\n"),filename
);
723 item
->nbytes
=number
*sign
;
726 while ((unsigned char)*buffer
>=' ') buffer
++;
728 debuga(_("URL too long or invalid in %s\n"),filename
);
734 for (i
=0 ; i
<MAX_IP_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
736 debuga(_("IP address too long or invalid in %s\n"),filename
);
742 for (i
=0 ; i
<MAX_DATETIME_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
744 debuga(_("Time too long or invalid in %s\n"),filename
);
750 for (i
=0 ; i
<MAX_DATETIME_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
752 debuga(_("Date too long or invalid in %s\n"),filename
);
758 if (*buffer
== '-') {
761 } else if (*buffer
== '+') {
765 while (isdigit(*buffer
))
766 number
=(number
* 10) + (*buffer
++)-'0';
768 debuga(_("Invalid elapsed time in %s\n"),filename
);
772 item
->nelap
=number
*sign
;
775 if (*buffer
== '-') {
778 } else if (*buffer
== '+') {
782 while (isdigit(*buffer
))
783 number
=(number
* 10) + (*buffer
++)-'0';
785 debuga(_("Invalid cache hit size in %s\n"),filename
);
789 item
->incache
=number
*sign
;
792 if (*buffer
== '-') {
795 } else if (*buffer
== '+') {
799 while (isdigit(*buffer
))
800 number
=(number
* 10) + (*buffer
++)-'0';
802 debuga(_("Invalid cache miss size in %s\n"),filename
);
805 item
->oucache
=number
*sign
;
810 static void grava_SmartFilter(const char *dirname
, const char *user
, const char *ip
, const char *data
, const char *hora
, const char *url
, const char *smart
)
814 char wdirname
[MAXLEN
];
816 sprintf(wdirname
,"%s/smartfilter.unsort",dirname
);
818 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
819 debuga(_("(report) Cannot open file %s\n"),wdirname
);
823 fprintf(fp_ou
,"%s\t%s\t%s\t%s\t%s\t%s\n",user
,data
,hora
,ip
,url
,smart
);
824 fputs("</body>\n</html>\n",fp_tt
);