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"
33 FILE *fp_in
, *fp_ou
, *fp_ip
, *fp_ip2
, *fp_usr
;
35 struct dirent
*direntp
;
36 long long int nnbytes
=0, unbytes
=0, tnbytes
=0, totbytes
=0, totbytes2
=0;
37 long long int totelap
=0, totelap2
=0, nnelap
=0, unelap
=0, tnelap
=0;
38 long long int incache
=0, oucache
=0, tnincache
=0, tnoucache
=0, twork
=0;
40 long long int ntotuser
;
41 long long int userbytes
, userelap
;
43 char arqin
[MAXLEN
], arqou
[MAXLEN
], arqper
[MAXLEN
], arqip
[MAXLEN
];
44 char *url
, tmsg
[50], csort
[MAXLEN
];
45 char user
[MAXLEN
], duser
[MAXLEN
];
46 char user_ip
[MAXLEN
], olduserip
[MAXLEN
], tmp2
[MAXLEN
], tmp3
[MAXLEN
];
47 char denied_report
[255];
53 long long int tnacc
=0, ttnacc
=0, unacc
=0;
54 double perc
=0, perc2
=0, ouperc
=0, inperc
=0;
57 const char txtext
[]=".txt";
59 char siteind
[MAX_TRUNCATED_URL
];
60 struct getwordstruct gwarea
;
62 struct generalitemstruct item
;
63 const struct userinfostruct
*uinfo
;
65 if((ReportType
& REPORT_TYPE_USERS_SITES
) == 0) return;
68 strcat(tmp2
,"/sargtmp.unsort");
71 strcat(tmp3
,"/sargtmp.log");
73 snprintf(arqper
,sizeof(arqper
),"%s/sarg-general",outdirname
);
74 if ((fp_in
= fopen(arqper
, "r")) == 0){
75 debuga(_("(html2) Cannot open file %s\n"),arqper
);
78 if ((line
=longline_create())==NULL
) {
79 debuga(_("Not enough memory to read file %s\n"),arqper
);
85 while((buf
=longline_read(fp_in
,line
))!=NULL
) {
86 ger_read(buf
,&item
,arqper
);
89 totbytes
+=item
.nbytes
;
94 longline_destroy(&line
);
96 snprintf(arqper
,sizeof(arqper
),"%s/sarg-users",outdirname
);
97 if ((fp_in
= fopen(arqper
, "r")) == 0){
98 debuga(_("(html11) Cannot open file %s\n"),arqper
);
101 if (!fgets(totuser
,sizeof(totuser
),fp_in
)) {
102 debuga(_("(html11) read error in %s\n"),arqper
);
106 ntotuser
=my_atoll(totuser
);
107 if (ntotuser
<=0) ntotuser
=1;
111 if ((dirp
= opendir(tmp
)) == NULL
) {
112 debuga(_("Failed to open directory %s - %s\n"),tmp
,strerror(errno
));
115 while ( (direntp
= readdir( dirp
)) != NULL
) {
116 dlen
=strlen(direntp
->d_name
)-(sizeof(txtext
)-1);
117 if (dlen
<0) continue;
118 if(strcmp(direntp
->d_name
+dlen
,txtext
) != 0)
123 if (dlen
>=sizeof(user
)) continue;
124 strncpy(user
,direntp
->d_name
,dlen
);
130 uinfo
=userinfo_find_from_file(user
);
132 debuga(_("Unknown user ID %s in directory %s\n"),user
,tmp
);
135 str
=strrchr(user
,'.');
137 strcpy(denied_report
,str
+1);
139 strcpy(denied_report
,user
);
141 if (snprintf(warea
,sizeof(warea
),"%s/%s",outdirname
,user
)>=sizeof(warea
)) {
142 debuga(_("Destination directory too long: %s/%s\n"),outdirname
,user
);
150 if (snprintf(arqin
,sizeof(arqin
),"%s/%s",tmp
,direntp
->d_name
)>=sizeof(arqin
)) {
151 debuga(_("Input file name too long: %s/%s\n"),tmp
,direntp
->d_name
);
154 if (snprintf(arqou
,sizeof(arqou
),"%s/%s/%s.html",outdirname
,uinfo
->filename
,uinfo
->filename
)>=sizeof(arqou
)) {
155 debuga(_("Output file name too long: %s/%s/%s.html\n"),outdirname
,uinfo
->filename
,uinfo
->filename
);
158 if (snprintf(duser
,sizeof(duser
),"%s/%s/denied_%s.html",tmp
,direntp
->d_name
,denied_report
)>=sizeof(duser
)) {
159 debuga(_("File name too long: %s/%s/denied_%s.html\n"),tmp
,direntp
->d_name
,denied_report
);
162 if(access(duser
, R_OK
) != 0)
163 denied_report
[0]='\0';
165 if ((fp_in
= fopen(arqin
, "r")) == 0){
166 debuga(_("(html3) Cannot open file %s\n"),arqin
);
170 if ((line
=longline_create())==NULL
) {
171 debuga(_("Not enough memory to read file %s\n"),arqin
);
180 while((buf
=longline_read(fp_in
,line
))!=NULL
) {
181 getword_start(&gwarea
,buf
);
182 if (getword_atoll(<emp
,&gwarea
,'\t')<0) {
183 debuga(_("There is a broken number of access in file %s\n"),arqin
);
187 if (getword_atoll(<emp
,&gwarea
,'\t')<0) {
188 debuga(_("There is a broken downloaded size in file %s\n"),arqin
);
192 if (getword_ptr(NULL
,NULL
,&gwarea
,'\t')<0) {
193 debuga(_("There is a broken url in file %s\n"),arqin
);
196 if (getword_skip(MAXLEN
,&gwarea
,'\t')<0) {
197 debuga(_("There is a broken access code in file %s\n"),arqin
);
200 if (getword_atoll(<emp
,&gwarea
,'\t')<0) {
201 debuga(_("There is a broken elapsed time in file %s\n"),arqin
);
205 if (getword_atoll(<emp
,&gwarea
,'\t')<0) {
206 debuga(_("There is a broken in-cache volume in file %s\n"),arqin
);
210 if (getword_atoll(<emp
,&gwarea
,'\n')<0) {
211 debuga(_("There is a broken out-cache volume in file %s\n"),arqin
);
219 if ((fp_ou
= fopen(arqou
, "w")) == 0){
220 debuga(_("(html5) Cannot open file %s\n"),arqou
);
224 write_html_header(fp_ou
,(IndexTree
== INDEX_TREE_DATE
) ? 4 : 2,_("User report"));
225 fprintf(fp_ou
,"<tr><td class=\"header_c\">%s: %s</td></tr>\n",_("Period"),period
.html
);
226 fprintf(fp_ou
,"<tr><td class=\"header_c\">%s: %s</td></tr>\n",_("User"),uinfo
->label
);
227 fprintf(fp_ou
,"<tr><td class=\"header_c\">%s: %s, %s</td></tr>\n",_("Sort"),UserSortField
,UserSortOrder
);
228 fprintf(fp_ou
,"<tr><th class=\"header_c\">%s</th></tr>\n",_("User report"));
229 close_html_header(fp_ou
);
231 fputs("<div class=\"report\"><table cellpadding=\"2\" cellspacing=\"1\">\n",fp_ou
);
233 if(denied_report
[0]!='\0') {
234 fprintf(fp_ou
,"<tr><td class=\"header_l\" colspan=\"11\"><a href=\"denied_%s.html\">%s</a> %s</td></tr>\n",denied_report
,_("SmartFilter"),_("Report"));
237 fprintf(fp_ou
,"<tr><th></th><th class=\"header_l\">%s</th>",_("ACCESSED SITE"));
239 if((UserReportFields
& USERREPORTFIELDS_CONNECT
) != 0)
240 fprintf(fp_ou
,"<th class=\"header_l\">%s</th>",_("CONNECT"));
241 if((UserReportFields
& USERREPORTFIELDS_BYTES
) != 0)
242 fprintf(fp_ou
,"<th class=\"header_l\">%s</th>",_("BYTES"));
243 if((UserReportFields
& USERREPORTFIELDS_SETYB
) != 0)
244 fprintf(fp_ou
,"<th class=\"header_l\">%%%s</th>",_("BYTES"));
245 if((UserReportFields
& USERREPORTFIELDS_IN_CACHE_OUT
) != 0)
246 fprintf(fp_ou
,"<th class=\"header_c\" colspan=\"2\">%s</th>",_("IN-CACHE-OUT"));
247 if((UserReportFields
& USERREPORTFIELDS_USED_TIME
) != 0)
248 fprintf(fp_ou
,"<th class=\"header_l\">%s</th>",_("ELAPSED TIME"));
249 if((UserReportFields
& USERREPORTFIELDS_MILISEC
) != 0)
250 fprintf(fp_ou
,"<th class=\"header_l\">%s</th>",_("MILLISEC"));
251 if((UserReportFields
& USERREPORTFIELDS_PTIME
) != 0)
252 fprintf(fp_ou
,"<th class=\"header_l\">%%%s</th>",_("TIME"));
254 fputs("</tr>\n",fp_ou
);
257 debuga(_("Making report: %s\n"),uinfo
->id
);
260 while((buf
=longline_read(fp_in
,line
))!=NULL
) {
261 getword_start(&gwarea
,buf
);
262 if (getword_atoll(&twork
,&gwarea
,'\t')<0) {
263 debuga(_("There is a broken number of access in file %s\n"),arqin
);
266 if (getword_atoll(&nnbytes
,&gwarea
,'\t')<0) {
267 debuga(_("There is a broken number of bytes in file %s\n"),arqin
);
270 if (getword_ptr(buf
,&url
,&gwarea
,'\t')<0) {
271 debuga(_("There is a broken url in file %s\n"),arqin
);
274 if (getword(tmsg
,sizeof(tmsg
),&gwarea
,'\t')<0) {
275 debuga(_("There is a broken access code in file %s\n"),arqin
);
278 if (getword_atoll(&nnelap
,&gwarea
,'\t')<0) {
279 debuga(_("There is a broken elapsed time in file %s\n"),arqin
);
282 if (getword_atoll(&incache
,&gwarea
,'\t')<0) {
283 debuga(_("There is a broken in cache column in file %s\n"),arqin
);
286 if (getword_atoll(&oucache
,&gwarea
,'\n')<0) {
287 debuga(_("There is a broken out of cache column in file %s (%d)\n"),arqin
,__LINE__
);
291 if(UserReportLimit
<=0 || count
<=UserReportLimit
) {
294 if(IndexTree
== INDEX_TREE_DATE
)
295 sprintf(tmp6
,"../%s",ImageFile
);
297 strcpy(tmp6
,"../../images");
299 if((ReportType
& REPORT_TYPE_SITE_USER_TIME_DATE
) != 0) {
300 url_to_file(url
,siteind
,sizeof(siteind
));
301 fprintf(fp_ou
,"<td class=\"data\"><a href=\"tt%s-%s.html\"><img src=\"%s/datetime.png\" title=\"%s\" alt=\"T\"></a></td>",uinfo
->filename
,siteind
,tmp6
,_("date/time report"));
303 fprintf(fp_ou
,"<td class=\"data\"></td>");
307 fprintf(fp_ou
,"<td class=\"data2\"><span style=\"color:%s;\">%s</span></td>",PrivacyStringColor
,PrivacyString
);
309 fputs("<td class=\"data2\">",fp_ou
);
310 if(BlockIt
[0]!='\0') {
311 fprintf(fp_ou
,"<a href=\"%s%s?url=",wwwDocumentRoot
,BlockIt
);
312 output_html_url(fp_ou
,url
);
313 fprintf(fp_ou
,"\"><img src=\"%s/sarg-squidguard-block.png\"></a> ",tmp6
);
315 fputs("<a href=\"http://",fp_ou
);
316 output_html_url(fp_ou
,url
);
318 output_html_string(fp_ou
,url
,100);
319 fputs("</a></td>",fp_ou
);
322 if((UserReportFields
& USERREPORTFIELDS_CONNECT
) != 0)
323 fprintf(fp_ou
,"<td class=\"data\">%s</td>",fixnum(twork
,1));
324 if((UserReportFields
& USERREPORTFIELDS_BYTES
) != 0)
325 fprintf(fp_ou
,"<td class=\"data\">%s</td>",fixnum(nnbytes
,1));
326 if((UserReportFields
& USERREPORTFIELDS_SETYB
) != 0) {
327 perc
=(tnbytes
) ? nnbytes
* 100. / tnbytes
: 0.;
328 fprintf(fp_ou
,"<td class=\"data\">%3.2lf%%</td>",perc
);
330 if((UserReportFields
& USERREPORTFIELDS_IN_CACHE_OUT
) != 0) {
331 inperc
=(nnbytes
) ? incache
* 100. / nnbytes
: 0.;
332 ouperc
=(nnbytes
) ? oucache
* 100. / nnbytes
: 0.;
333 fprintf(fp_ou
,"<td class=\"data\">%3.2lf%%</td><td class=\"data\">%3.2lf%%</td>",inperc
,ouperc
);
335 if((UserReportFields
& USERREPORTFIELDS_USED_TIME
) != 0)
336 fprintf(fp_ou
,"<td class=\"data\">%s</td>",buildtime(nnelap
));
337 if((UserReportFields
& USERREPORTFIELDS_MILISEC
) != 0)
338 fprintf(fp_ou
,"<td class=\"data\">%s</td>",fixnum2(nnelap
,1));
339 if((UserReportFields
& USERREPORTFIELDS_PTIME
) != 0) {
340 perc2
=(tnelap
) ? nnelap
* 100. / tnelap
: 0.;
341 fprintf(fp_ou
,"<td class=\"data\">%3.2lf%%</td>",perc2
);
344 if(strncmp(tmsg
,"OK",2) != 0)
345 fprintf(fp_ou
,"<td class=\"data\">%s</td>",_("DENIED"));
347 fputs("</tr>\n",fp_ou
);
352 if (snprintf(arqip
,sizeof(arqip
),"%s/%s.ip",tmp
,uinfo
->filename
)>=sizeof(arqip
)) {
353 debuga(_("File name too long: %s/%s.ip\n"),tmp
,uinfo
->filename
);
357 if ((fp_ip
= fopen(arqip
, "r")) == 0){
358 debuga(_("(html6) Cannot open file %s\n"),arqip
);
362 if ((fp_ip2
= MY_FOPEN(tmp2
, "a")) == 0){
363 debuga(_("(html7) Cannot open file %s\n"),tmp2
);
367 if ((line1
=longline_create())==NULL
) {
368 debuga(_("Not enough memory to read file %s\n"),arqip
);
371 while((buf
=longline_read(fp_ip
,line1
))!=NULL
) {
372 getword_start(&gwarea
,buf
);
373 if (getword(user_ip
,sizeof(user_ip
),&gwarea
,'\t')<0) {
374 debuga(_("Maybe you have a broken user IP in your %s file\n"),tmp3
);
377 if (getword_ptr(buf
,&user_url
,&gwarea
,'\t')<0) {
378 debuga(_("Maybe you have a broken url in your %s file\n"),tmp3
);
381 if (strncmp(user_url
,url
,strlen(url
))!=0) continue;
382 if (getword_skip(15,&gwarea
,'\t')<0) {
383 debuga(_("Maybe you have a broken day in your %s file\n"),tmp3
);
386 if (getword_skip(15,&gwarea
,'\t')<0) {
387 debuga(_("Maybe you have a broken time in your %s file\n"),tmp3
);
390 if (getword_atoll(&userbytes
,&gwarea
,'\t')<0) {
391 debuga(_("Maybe you have a broken size in your %s file\n"),tmp3
);
394 if (getword_atoll(&userelap
,&gwarea
,'\0')<0) {
395 debuga(_("Maybe you have a broken elapsed time in your %s file\n"),tmp3
);
398 fprintf(fp_ip2
,"%s\t%"PRIu64
"\t%"PRIu64
"\n",user_ip
,(uint64_t)userbytes
,(uint64_t)userelap
);
400 longline_destroy(&line1
);
405 sprintf(csort
,"sort -n -T \"%s\" -k 1,1 -k 2,2 -o \"%s\" \"%s\"",tmp
,tmp3
,tmp2
);
406 cstatus
=system(csort
);
407 if (!WIFEXITED(cstatus
) || WEXITSTATUS(cstatus
)) {
408 debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus
));
409 debuga(_("sort command: %s\n"),csort
);
413 if ((fp_ip
= MY_FOPEN(tmp3
, "r")) == 0) {
414 debuga(_("(html8) Cannot open file %s\n"),tmp3
);
420 if ((line1
=longline_create())==NULL
) {
421 debuga(_("Not enough memory to read file %s\n"),arqip
);
424 while((buf
=longline_read(fp_ip
,line1
))!=NULL
) {
425 getword_start(&gwarea
,buf
);
426 if (getword(user_ip
,sizeof(user_ip
),&gwarea
,'\t')<0) {
427 debuga(_("Maybe you have a broken user IP in your %s file\n"),tmp3
);
430 if (getword_atoll(&userbytes
,&gwarea
,'\t')<0) {
431 debuga(_("Maybe you have a broken size in your %s file\n"),tmp3
);
434 if (getword_atoll(&userelap
,&gwarea
,'\0')<0) {
435 debuga(_("Maybe you have a broken elapsed time in your %s file\n"),tmp3
);
438 if(strcmp(user_ip
,olduserip
) != 0) {
439 if (olduserip
[0]!='\0') {
440 fprintf(fp_ou
,"<tr><td></td><td class=\"data\">%s</td>",olduserip
);
441 if((UserReportFields
& USERREPORTFIELDS_CONNECT
) != 0)
442 fputs("<td></td>",fp_ou
);
443 if((UserReportFields
& USERREPORTFIELDS_BYTES
) != 0)
444 fprintf(fp_ou
,"<td class=\"data\">%s</td>",fixnum(unbytes
,1));
445 if((UserReportFields
& USERREPORTFIELDS_SETYB
) != 0)
446 fputs("<td></td>",fp_ou
);
447 if((UserReportFields
& USERREPORTFIELDS_IN_CACHE_OUT
) != 0)
448 fputs("</td><td></td><td></td>",fp_ou
);
449 if((UserReportFields
& USERREPORTFIELDS_USED_TIME
) != 0)
450 fprintf(fp_ou
,"<td class=\"data\">%s</td>",buildtime(unelap
));
451 if((UserReportFields
& USERREPORTFIELDS_MILISEC
) != 0)
452 fprintf(fp_ou
,"<td class=\"data\">%s</td>",fixnum2(unelap
,1));
453 fputs("</tr>\n",fp_ou
);
456 strcpy(olduserip
,user_ip
);
467 longline_destroy(&line1
);
472 if (olduserip
[0]!='\0') {
473 fprintf(fp_ou
,"<tr><td></td><td class=\"data\">%s</td>",olduserip
);
474 if((UserReportFields
& USERREPORTFIELDS_CONNECT
) != 0)
475 fputs("<td></td>",fp_ou
);
476 if((UserReportFields
& USERREPORTFIELDS_BYTES
) != 0)
477 fprintf(fp_ou
,"<td class=\"data\">%s</td>",fixnum(unbytes
,1));
478 if((UserReportFields
& USERREPORTFIELDS_SETYB
) != 0)
479 fputs("<td></td>",fp_ou
);
480 if((UserReportFields
& USERREPORTFIELDS_IN_CACHE_OUT
) != 0)
481 fputs("</td><td></td><td></td>",fp_ou
);
482 if((UserReportFields
& USERREPORTFIELDS_USED_TIME
) != 0)
483 fprintf(fp_ou
,"<td class=\"data\">%s</td>",buildtime(unelap
));
484 if((UserReportFields
& USERREPORTFIELDS_MILISEC
) != 0)
485 fprintf(fp_ou
,"<td class=\"data\">%s</td>",fixnum2(unelap
,1));
486 fputs("</tr>\n",fp_ou
);
496 longline_destroy(&line
);
502 if((UserReportFields
& USERREPORTFIELDS_TOTAL
) != 0) {
503 fprintf(fp_ou
,"<tr><th></th><th class=\"header_l\">%s</th>",_("TOTAL"));
504 if((UserReportFields
& USERREPORTFIELDS_CONNECT
) != 0)
505 fprintf(fp_ou
,"<th class=\"header_r\">%s</th>",fixnum(tnacc
,1));
506 if((UserReportFields
& USERREPORTFIELDS_BYTES
) != 0)
507 fprintf(fp_ou
,"<th class=\"header_r\">%s</th>",fixnum(tnbytes
,1));
508 if((UserReportFields
& USERREPORTFIELDS_SETYB
) != 0) {
509 perc
=(totbytes
) ? tnbytes
*100. / totbytes
:0.;
510 fprintf(fp_ou
,"<th class=\"header_r\">%3.2lf%%</th>",perc
);
512 if((UserReportFields
& USERREPORTFIELDS_IN_CACHE_OUT
) != 0) {
513 inperc
=(tnbytes
) ? tnincache
* 100. / tnbytes
: 0.;
514 ouperc
=(tnbytes
) ? tnoucache
* 100. / tnbytes
: 0.;
515 fprintf(fp_ou
,"<th class=\"header_r\">%3.2lf%%</th><th class=\"header_r\">%3.2lf%%</th>",inperc
,ouperc
);
517 if((UserReportFields
& USERREPORTFIELDS_USED_TIME
) != 0)
518 fprintf(fp_ou
,"<th class=\"header_r\">%s</th>",buildtime(tnelap
));
519 if((UserReportFields
& USERREPORTFIELDS_MILISEC
) != 0)
520 fprintf(fp_ou
,"<th class=\"header_r\">%s</th>",fixnum2(tnelap
,1));
521 if((UserReportFields
& USERREPORTFIELDS_PTIME
) != 0) {
522 perc2
=(totelap
) ? tnelap
* 100. / totelap
: 0.;
523 fprintf(fp_ou
,"<th class=\"header_r\">%3.2lf%%</th>",perc2
);
525 fputs("</tr>\n",fp_ou
);
528 if(PerUserLimit
> 0) {
529 if(tnbytes
> (PerUserLimit
*1000000)) {
531 if(access(PerUserLimitFile
, R_OK
) == 0) {
532 if((fp_usr
= fopen(PerUserLimitFile
, "r")) == 0) {
533 debuga(_("(html9) Cannot open file %s\n"),PerUserLimitFile
);
536 while(fgets(tmp6
,sizeof(tmp6
),fp_usr
)!=NULL
) {
538 if(strcmp(tmp6
,uinfo
->label
) == 0) {
547 if((fp_usr
= fopen(PerUserLimitFile
, "a")) == 0) {
548 debuga(_("(html10) Cannot open file %s\n"),PerUserLimitFile
);
551 fprintf(fp_usr
,"%s\n",uinfo
->label
);
555 debuga(_("User %s limit exceeded (%d MB). Added to file %s\n"),uinfo
->label
,PerUserLimit
,PerUserLimitFile
);
565 if ((ReportType
& REPORT_TYPE_TOPUSERS
) != 0 && (UserReportFields
& USERREPORTFIELDS_AVERAGE
) != 0) {
566 totbytes2
=totbytes
/ntotuser
;
567 totelap2
=totelap
/ntotuser
;
569 fprintf(fp_ou
,"<tr><th></th><th class=\"header_l\">%s</th>",_("AVERAGE"));
570 if((UserReportFields
& USERREPORTFIELDS_CONNECT
) != 0)
571 fprintf(fp_ou
,"<th class=\"header_r\">%s</th>",fixnum(ttnacc
/ntotuser
,1));
572 if((UserReportFields
& USERREPORTFIELDS_BYTES
) != 0)
573 fprintf(fp_ou
,"<th class=\"header_r\">%s</th>",fixnum(totbytes2
,1));
574 fprintf(fp_ou
,"<th></th><th></th><th></th>");
575 if((UserReportFields
& USERREPORTFIELDS_USED_TIME
) != 0)
576 fprintf(fp_ou
,"<th class=\"header_r\">%s</th>",buildtime(totelap2
));
577 if((UserReportFields
& USERREPORTFIELDS_MILISEC
) != 0)
578 fprintf(fp_ou
,"<th class=\"header_r\">%s</th>",fixnum2(totelap2
,1));
579 if((UserReportFields
& USERREPORTFIELDS_PTIME
) != 0) {
580 perc2
= (totelap
) ? totelap2
* 100. / totelap
: 0.;
581 fprintf(fp_ou
,"<th class=\"header_r\">%3.2lf%%</th>",perc2
);
583 fputs("</tr>\n",fp_ou
);
586 fputs("</table></div>\n",fp_ou
);
587 if (write_html_trailer(fp_ou
)<0)
588 debuga(_("Write error in file %s\n"),arqou
);
589 if (fclose(fp_ou
)==EOF
)
590 debuga(_("Failed to close file %s - %s\n"),arqou
,strerror(errno
));
595 (void)closedir(dirp
);