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 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
);
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
);
46 char accdia
[11], acchora
[9], accip
[MAXLEN
], *accurl
;
47 char oldaccdia
[11], oldacchora
[9], oldaccip
[MAXLEN
];
48 char wdirname
[MAXLEN
];
50 char oldmsg
[50], acccode
[MAXLEN
/2 - 1], oldacccode
[MAXLEN
/2 - 1], user
[MAX_USER_LEN
];
51 char ipantes
[MAXLEN
], nameantes
[MAXLEN
];
52 char accsmart
[MAXLEN
];
53 char crc2
[MAXLEN
/2 -1];
54 char siteind
[MAX_TRUNCATED_URL
];
57 char oldaccdiatt
[11],oldacchoratt
[9];
60 char u2
[MAX_USER_LEN
];
61 long long int nbytes
=0;
62 long long int nelap
=0;
64 long long int rtotal
=0;
65 long long int incache
=0;
66 long long int oucache
=0;
67 long long int accbytes
, accelap
;
70 struct dirent
*direntp
;
71 const char logext
[]=".log";
72 const char *sort_field
;
73 const char *sort_order
;
80 struct getwordstruct gwarea
;
82 struct userinfostruct
*uinfo
,*puinfo
;
87 if (vrfydir(&period
, addr
, site
, us
, email
)<0) {
88 debuga(_("Cannot create the output directory name containing the period as part of the name\n"));
93 debugaz("outdirname",outdirname
);
96 if(UserAgentLog
[0] != '\0' && email
[0] == '\0') useragent();
98 snprintf(wdirname
,sizeof(wdirname
),"%s/sarg-general",outdirname
);
99 if((fp_gen
=MY_FOPEN(wdirname
,"w"))==NULL
){
100 debuga(_("(report) Cannot open file %s\n"),wdirname
);
107 if ((dirp
= opendir(tmp
)) == NULL
) {
108 debuga(_("Failed to open directory %s - %s\n"),tmp
,strerror(errno
));
111 while ((direntp
= readdir( dirp
)) != NULL
) {
112 dlen
=strlen(direntp
->d_name
)-(sizeof(logext
)-1);
113 if (dlen
<0) continue;
114 if((strcmp(direntp
->d_name
+dlen
,logext
) != 0) ||
115 (strncmp(direntp
->d_name
,"download.log",12) == 0) ||
116 (strncmp(direntp
->d_name
,"denied.log",10) == 0) ||
117 (strncmp(direntp
->d_name
,"authfail.log.unsort",19) == 0))
119 if (snprintf(tmp3
,sizeof(tmp3
),"%s/%s",tmp
,direntp
->d_name
)>=sizeof(tmp3
)) {
120 debuga(_("(report) directory entry too long: %s/%s\n"),tmp
,direntp
->d_name
);
123 if((fp_in
=MY_FOPEN(tmp3
,"r"))==NULL
){
124 debuga(_("(report) Cannot open file %s\n"),tmp
);
129 if (dlen
>=sizeof(user
)) continue;
130 strncpy(user
,direntp
->d_name
,dlen
);
136 uinfo
=userinfo_find_from_file(user
);
138 debuga(_("Ignoring unknown user file %s\n"),user
);
141 strcpy(u2
,uinfo
->id
);
142 if(Ip2Name
&& uinfo
->id_is_ip
) {
144 ip2name(u2
,sizeof(u2
));
145 strcpy(nameantes
,u2
);
147 user_find(uinfo
->label
,MAX_USER_LEN
, u2
);
149 maketmp(user
,tmp
,debug
,indexonly
);
150 maketmp_hour(user
,tmp
,indexonly
);
151 sort_labels(&sort_field
,&sort_order
);
156 memset(oldaccdiatt
,0,sizeof(oldaccdiatt
));
157 memset(oldacchoratt
,0,sizeof(oldacchoratt
));
160 if ((line
=longline_create())==NULL
) {
161 debuga(_("Not enough memory to read the downloaded files\n"));
165 while((buf
=longline_read(fp_in
,line
))!=NULL
) {
166 getword_start(&gwarea
,buf
);
167 if (getword(accdia
,sizeof(accdia
),&gwarea
,'\t')<0 || getword(acchora
,sizeof(acchora
),&gwarea
,'\t')<0 ||
168 getword(accip
,sizeof(accip
),&gwarea
,'\t')<0 ||
169 getword_ptr(buf
,&accurl
,&gwarea
,'\t')<0 || getword_atoll(&accbytes
,&gwarea
,'\t')<0 ||
170 getword(acccode
,sizeof(acccode
),&gwarea
,'\t')<0) {
171 debuga(_("There is a broken record or garbage in file %s\n"),tmp3
);
174 if(strncmp(acccode
,"TCP_DENIED/407",14) == 0) continue;
175 if (getword_atoll(&accelap
,&gwarea
,'\t')<0) {
176 debuga(_("There is a broken elapsed time in file %s\n"),tmp3
);
179 if (getword_skip(20000,&gwarea
,'"')<0 || getword(accsmart
,sizeof(accsmart
),&gwarea
,'"')<0) {
180 debuga(_("There is a broken smart info in file %s\n"),tmp3
);
184 if(accsmart
[0] != '\0') {
186 grava_SmartFilter(outdirname
,uinfo
->id
,accip
,accdia
,acchora
,accurl
,accsmart
);
190 if(strcmp(accip
,ipantes
) != 0) {
191 strcpy(ipantes
,accip
);
192 ip2name(accip
,sizeof(accip
));
193 strcpy(nameantes
,accip
);
194 } else strcpy(accip
,nameantes
);
197 gravatmp_hora(outdirname
,uinfo
,accdia
,acchora
,accelap
,accbytes
,indexonly
);
200 gravaporuser(uinfo
,outdirname
,accurl
,accip
,accdia
,acchora
,accbytes
,accelap
,indexonly
);
204 url_len
=strlen(accurl
);
205 if (!oldurl
|| url_len
>=ourl_size
) {
207 oldurl
=realloc(oldurl
,ourl_size
);
209 debuga(_("Not enough memory to store the url\n"));
213 strcpy(oldurl
,accurl
);
214 strcpy(oldacccode
,acccode
);
216 strcpy(oldaccip
,accip
);
217 strcpy(oldaccdia
,accdia
);
218 strcpy(oldacchora
,acchora
);
222 same_url
=(strcmp(oldurl
,accurl
) == 0);
224 if(site
[0] != '\0') {
226 if(strstr(oldacccode
,"DENIED") != 0)
227 strcpy(oldmsg
,"DENIED");
230 gravatmp(puinfo
,oldurl
,nacc
,nbytes
,oldmsg
,nelap
,indexonly
,incache
,oucache
);
231 gravager(fp_gen
,puinfo
,nacc
,oldurl
,nbytes
,oldaccip
,oldacchora
,oldaccdia
,nelap
,incache
,oucache
);
239 if(!same_url
|| new_user
){
240 if(strstr(oldacccode
,"DENIED") != 0)
241 strcpy(oldmsg
,"DENIED");
244 gravatmp(puinfo
,oldurl
,nacc
,nbytes
,oldmsg
,nelap
,indexonly
,incache
,oucache
);
245 gravager(fp_gen
,puinfo
,nacc
,oldurl
,nbytes
,oldaccip
,oldacchora
,oldaccdia
,nelap
,incache
,oucache
);
257 if ((ReportType
& REPORT_TYPE_SITE_USER_TIME_DATE
) != 0 &&
258 (!oldurltt
|| strcmp(oldurltt
,accurl
) || strcmp(oldaccdiatt
,accdia
) || strcmp(oldacchoratt
,acchora
))) {
261 snprintf(arqtt
,sizeof(arqtt
),"%s/%s",outdirname
,uinfo
->filename
);
262 if(access(arqtt
, R_OK
) != 0)
264 url_to_file(accurl
,siteind
,sizeof(siteind
));
265 snprintf(arqtt
,sizeof(arqtt
),"%s/%s/tt%s-%s.html",outdirname
,uinfo
->filename
,uinfo
->filename
,siteind
);
266 if ((fp_tt
= fopen(arqtt
, "w")) == 0) {
267 debuga(_("(report) Cannot open file %s\n"),arqtt
);
274 sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s", \
275 FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
277 sprintf(httplink,"<font size=%s><a href=\"http://%s\">%s</a>",FontSize,accurl,accurl);
280 write_html_header(fp_tt
,(IndexTree
== INDEX_TREE_DATE
) ? 4 : 2,_("Site access report"),HTML_JS_NONE
);
281 fprintf(fp_tt
,"<tr><td class=\"header_c\">%s: %s</td></tr>\n",_("Period"),period
.html
);
282 fprintf(fp_tt
,"<tr><td class=\"header_c\">%s: %s</td></tr>\n",_("User"),uinfo
->label
);
283 fputs("<tr><td class=\"header_c\">",fp_tt
);
284 fprintf(fp_tt
,_("Sort: %s, %s"),sort_field
,sort_order
);
285 fputs("</td></tr>\n",fp_tt
);
286 fprintf(fp_tt
,"<tr><th class=\"header_c\">%s</th></tr>\n",_("User"));
287 close_html_header(fp_tt
);
289 fputs("<div class=\"report\"><table cellpadding=\"0\" cellspacing=\"2\">\n",fp_tt
);
290 strncpy(tmp4
,_("DATE/TIME"),4);
292 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);
295 fputs("<tr><td class=\"data\">",fp_tt
);
296 output_html_string(fp_tt
,accurl
,100);
297 fprintf(fp_tt
,"</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",accdia
,acchora
);
299 url_len
=strlen(accurl
);
300 if (!oldurltt
|| url_len
>=ourltt_size
) {
301 ourltt_size
=url_len
+1;
302 oldurltt
=realloc(oldurltt
,ourltt_size
);
304 debuga(_("Not enough memory to store the url\n"));
308 strcpy(oldurltt
,accurl
);
309 strcpy(oldaccdiatt
,accdia
);
310 strcpy(oldacchoratt
,acchora
);
313 strcpy(crc2
,acccode
);
314 str
=strchr(crc2
,'/');
316 if(strstr(crc2
,"MISS") != 0)
318 else incache
+=accbytes
;
322 day_totalize(tmp
,puinfo
,indexonly
);
326 strcpy(oldacccode
,acccode
);
327 strcpy(oldaccip
,accip
);
329 url_len
=strlen(accurl
);
330 if (url_len
>=ourl_size
) {
332 oldurl
=realloc(oldurl
,ourl_size
);
334 debuga(_("Not enough memory to store the url\n"));
338 strcpy(oldurl
,accurl
);
340 strcpy(oldaccdia
,accdia
);
341 strcpy(oldacchora
,acchora
);
345 longline_destroy(&line
);
346 if (oldurltt
) free(oldurltt
);
352 if(strstr(oldacccode
,"DENIED") != 0)
353 strcpy(oldmsg
,"DENIED");
356 gravatmp(puinfo
,oldurl
,nacc
,nbytes
,oldmsg
,nelap
,indexonly
,incache
,oucache
);
357 gravager(fp_gen
,puinfo
,nacc
,oldurl
,nbytes
,oldaccip
,oldacchora
,oldaccdia
,nelap
,incache
,oucache
);
361 if (puinfo
) day_totalize(tmp
,puinfo
,indexonly
);
365 totalger(outdirname
, debug
, outdir
);
367 if(email
[0] == '\0') {
368 if((ReportType
& REPORT_TYPE_DOWNLOADS
) != 0) download_report();
370 if(DansGuardianConf
[0] != '\0') {
378 if((ReportType
& REPORT_TYPE_TOPSITES
) != 0) topsites();
380 if((ReportType
& REPORT_TYPE_SITES_USERS
) != 0) siteuser();
385 if(smartfilter
) smartfilter_report();
387 if(DansGuardianConf
[0] != '\0') dansguardian_report();
391 if((ReportType
& REPORT_TYPE_USERS_SITES
) != 0) htmlrel();
395 if(SuccessfulMsg
) debuga(_("Successful report generated on %s\n"),outdirname
);
397 geramail(outdirname
, debug
, outdir
, email
, tmp
);
399 if((strcmp(email
,"stdout") != 0) && SuccessfulMsg
)
400 debuga(_("Successful report generated and sent to %s\n"),email
);
404 index_only(outdirname
, debug
);
407 removetmp(outdirname
);
411 static void maketmp(const char *user
, const char *dirname
, int debug
, int indexonly
)
414 char wdirname
[MAXLEN
];
416 if(indexonly
) return;
417 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
419 if(debug
) debuga(_("Making file: %s/%s\n"),tmp
,user
);
420 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.utmp",tmp
,user
)>=sizeof(wdirname
)) {
421 debuga(_("Temporary file name too long: %s/%s.utmp\n"),tmp
,user
);
425 if((fp_ou
=fopen(wdirname
,"w"))==NULL
){
426 debuga(_("(report) Cannot open file %s\n"),wdirname
);
435 static void maketmp_hour(const char *user
, const char *dirname
, int indexonly
)
438 char wdirname
[MAXLEN
];
440 if(indexonly
) return;
441 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
442 if(datetimeby
==0) return;
444 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.htmp",tmp
,user
)>=sizeof(wdirname
)) {
445 debuga(_("Temporary file name too long: %s/%s.htmp\n"),tmp
,user
);
449 if((fp_ou
=fopen(wdirname
,"w"))==NULL
){
450 debuga(_("(report-1) Cannot open file %s - %s\n"),wdirname
,strerror(errno
));
459 static 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
)
462 char wdirname
[MAXLEN
];
464 if(indexonly
) return;
465 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
467 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.utmp",tmp
,uinfo
->filename
)>=sizeof(wdirname
)) {
468 debuga(_("Temporary file name too long: %s/%s.utmp\n"),tmp
,uinfo
->filename
);
472 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
473 debuga(_("(report) Cannot open file %s\n"),wdirname
);
478 This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable
479 to print a long long int unless it is exactly 64-bits long.
481 fprintf(fp_ou
,"%"PRIu64
"\t%"PRIu64
"\t%s\t%s\t%"PRIu64
"\t%"PRIu64
"\t%"PRIu64
"\n",(uint64_t)nacc
,(uint64_t)nbytes
,oldurl
,oldmsg
,(uint64_t)nelap
,(uint64_t)incache
,(uint64_t)oucache
);
483 if (fclose(fp_ou
)==EOF
) {
484 debuga(_("Failed to close file %s - %s\n"),wdirname
,strerror(errno
));
490 fputs("</table>\n</div>\n",fp_tt
);
491 fputs("</body>\n</html>\n",fp_tt
);
499 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
)
502 char wdirname
[MAXLEN
];
505 if(indexonly
|| ((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) || datetimeby
==0) return;
507 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.htmp",tmp
,uinfo
->filename
)>=sizeof(wdirname
)) {
508 debuga(_("Path too long %s/%s.htmp\n"),tmp
,uinfo
->filename
);
512 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
513 debuga(_("(report-2) Cannot open file %s - %s\n"),wdirname
,strerror(errno
));
518 fprintf(fp_ou
,"%s\t%d",data
,hour
);
519 if((datetimeby
& DATETIME_BYTE
)!=0) fprintf(fp_ou
,"\t%"PRIu64
,(uint64_t)bytes
);
520 if((datetimeby
& DATETIME_ELAP
)!=0) fprintf(fp_ou
,"\t%"PRIu64
,(uint64_t)elap
);
523 if (fclose(fp_ou
)==EOF
) {
524 debuga(_("Failed to close file %s - %s\n"),wdirname
,strerror(errno
));
532 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
)
535 char wdirname
[MAXLEN
];
537 if(indexonly
|| ((ReportType
& REPORT_TYPE_USERS_SITES
) == 0)) return;
539 if (snprintf(wdirname
,sizeof(wdirname
),"%s/%s.ip",tmp
,uinfo
->filename
)>=sizeof(wdirname
)) {
540 debuga(_("Path too long %s/%s.ip\n"),tmp
,uinfo
->filename
);
544 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
545 debuga(_("(report) Cannot open file %s\n"),wdirname
);
550 This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable
551 to print a long long int unless it is exactly 64-bits long.
553 fprintf(fp_ou
,"%s\t%s\t%s\t%s\t%"PRIu64
"\t%"PRIu64
"\n",ip
,url
,data
,hora
,(uint64_t)tam
,(uint64_t)elap
);
561 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
)
564 This complicated printf is due to Microsoft's inability to comply with any standard. Msvcrt is unable
565 to print a long long int unless it is exactly 64-bits long.
567 fprintf(fp_gen
,"%s\t%"PRIu64
"\t%"PRIu64
"\t%s\t%s\t%s\t%s\t%"PRIu64
"\t%"PRIu64
"\t%"PRIu64
"\n",uinfo
->id
,(uint64_t)nacc
,(uint64_t)nbytes
,url
,ip
,hora
,dia
,(uint64_t)nelap
,(uint64_t)incache
,(uint64_t)oucache
);
571 int ger_read(char *buffer
,struct generalitemstruct
*item
,const char *filename
)
575 long long int number
;
577 if (strncmp(buffer
,"TOTAL\t",6)==0) {
582 if (*buffer
== '-') {
585 } else if (*buffer
== '+') {
589 while (isdigit(*buffer
))
590 number
=(number
* 10) + (*buffer
++)-'0';
592 debuga(_("Invalid total number of accesses in %s\n"),filename
);
596 item
->nacc
=number
*sign
;
599 if (*buffer
== '-') {
602 } else if (*buffer
== '+') {
606 while (isdigit(*buffer
))
607 number
=(number
* 10) + (*buffer
++)-'0';
609 debuga(_("Invalid total size in %s\n"),filename
);
613 item
->nbytes
=number
*sign
;
616 if (*buffer
== '-') {
619 } else if (*buffer
== '+') {
623 while (isdigit(*buffer
))
624 number
=(number
* 10) + (*buffer
++)-'0';
626 debuga(_("Invalid total elapsed time in %s\n"),filename
);
630 item
->nelap
=number
*sign
;
633 if (*buffer
== '-') {
636 } else if (*buffer
== '+') {
640 while (isdigit(*buffer
))
641 number
=(number
* 10) + (*buffer
++)-'0';
643 debuga(_("Invalid total cache hit in %s\n"),filename
);
647 item
->incache
=number
*sign
;
650 if (*buffer
== '-') {
653 } else if (*buffer
== '+') {
657 while (isdigit(*buffer
))
658 number
=(number
* 10) + (*buffer
++)-'0';
660 debuga(_("Invalid total cache miss in %s\n"),filename
);
663 item
->oucache
=number
*sign
;
668 for (i
=0 ; i
<MAX_USER_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
670 debuga(_("User name too long or invalid in %s\n"),filename
);
676 if (*buffer
== '-') {
679 } else if (*buffer
== '+') {
683 while (isdigit(*buffer
))
684 number
=(number
* 10) + (*buffer
++)-'0';
686 debuga(_("Invalid number of accesses in %s\n"),filename
);
690 item
->nacc
=number
*sign
;
693 if (*buffer
== '-') {
696 } else if (*buffer
== '+') {
700 while (isdigit(*buffer
))
701 number
=(number
* 10) + (*buffer
++)-'0';
703 debuga(_("Invalid number of bytes in %s\n"),filename
);
707 item
->nbytes
=number
*sign
;
710 while ((unsigned char)*buffer
>=' ') buffer
++;
712 debuga(_("URL too long or invalid in %s\n"),filename
);
718 for (i
=0 ; i
<MAX_IP_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
720 debuga(_("IP address too long or invalid in %s\n"),filename
);
726 for (i
=0 ; i
<MAX_DATETIME_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
728 debuga(_("Time too long or invalid in %s\n"),filename
);
734 for (i
=0 ; i
<MAX_DATETIME_LEN
-1 && (unsigned char)*buffer
>=' ' ; i
++) buffer
++;
736 debuga(_("Date too long or invalid in %s\n"),filename
);
742 if (*buffer
== '-') {
745 } else if (*buffer
== '+') {
749 while (isdigit(*buffer
))
750 number
=(number
* 10) + (*buffer
++)-'0';
752 debuga(_("Invalid elapsed time in %s\n"),filename
);
756 item
->nelap
=number
*sign
;
759 if (*buffer
== '-') {
762 } else if (*buffer
== '+') {
766 while (isdigit(*buffer
))
767 number
=(number
* 10) + (*buffer
++)-'0';
769 debuga(_("Invalid cache hit size in %s\n"),filename
);
773 item
->incache
=number
*sign
;
776 if (*buffer
== '-') {
779 } else if (*buffer
== '+') {
783 while (isdigit(*buffer
))
784 number
=(number
* 10) + (*buffer
++)-'0';
786 debuga(_("Invalid cache miss size in %s\n"),filename
);
789 item
->oucache
=number
*sign
;
794 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
)
797 char wdirname
[MAXLEN
];
799 sprintf(wdirname
,"%s/smartfilter.unsort",dirname
);
801 if((fp_ou
=MY_FOPEN(wdirname
,"a"))==NULL
){
802 debuga(_("(report) Cannot open file %s\n"),wdirname
);
806 fprintf(fp_ou
,"%s\t%s\t%s\t%s\t%s\t%s\n",user
,data
,hora
,ip
,url
,smart
);
807 fputs("</body>\n</html>\n",fp_tt
);