/*
* SARG Squid Analysis Report Generator http://sarg.sourceforge.net
- * 1998, 2010
+ * 1998, 2012
*
* SARG donations:
* please look at http://sarg.sourceforge.net/donations.php
}
if((fp_in=fopen(wdirname,"r"))==NULL) {
- debuga(_("(repday) Cannot open log file %s\n"),wdirname);
+ debuga(_("(repday) Cannot open log file %s: %s\n"),wdirname,strerror(errno));
exit(EXIT_FAILURE);
}
fclose(fp_in);
if((fp_ou=fopen(arqout,"w"))==NULL) {
- debuga(_("(repday) Cannot open log file %s\n"),arqout);
+ debuga(_("(repday) Cannot open log file %s: %s\n"),arqout,strerror(errno));
exit(EXIT_FAILURE);
}
label=_("BYTES");
fputs("<table class=\"report\" cellpadding=\"0\" cellspacing=\"2\">\n", fp_ou);
fputs("<tr><th class=\"header_c\"></th>",fp_ou);
- for( i = 0; i < hours.len; i++ )
- fprintf(fp_ou, "<td class=\"header_c\">%02d%s<br>%s</td>\n", hours.list[ i ], _("H"), label );
+ for( i = 0; i < hours.len; i++ ) {
+ /* TRANSLATORS: It is an hour in the hourly report */
+ sprintf(data,_("%02dH"),hours.list[ i ]);
+ fprintf(fp_ou, "<td class=\"header_c\">%s<br>%s</td>\n", data, label );
+ }
fprintf(fp_ou, "<td class=\"header_c\">%s<br>%s</td></tr>\n", _("TOTAL"), label );
memset(tttime,0,sizeof(tttime));
}
fprintf(fp_ou, "<td class=\"header_r\">%s</td></tr>\n",fixnum(tt,1));
fputs("</table>\n",fp_ou);
+#ifdef ENABLE_DOUBLE_CHECK_DATA
+ if (tt!=uinfo->nbytes) {
+ debuga(_("Total downloaded bytes is %"PRIi64" instead of %"PRIi64" in the hourly report of user %s\n"),
+ (int64_t)tt,(int64_t)uinfo->nbytes,uinfo->label);
+ exit(EXIT_FAILURE);
+ }
+#endif
}
if((datetimeby & DATETIME_ELAP)!=0) {
label=_("H:M:S");
fputs("<table class=\"report\" cellpadding=\"0\" cellspacing=\"2\">\n", fp_ou);
fputs("<tr><th class=\"header_c\"></th>",fp_ou);
- for( i = 0; i < hours.len; i++ )
- fprintf(fp_ou, "<td class=\"header_c\">%02d%s<br>%s</td>\n", hours.list[ i ], _("H"), label );
+ for( i = 0; i < hours.len; i++ ) {
+ sprintf(data,_("%02dH"),hours.list[ i ]);
+ fprintf(fp_ou, "<td class=\"header_c\">%s<br>%s</td>\n", data, label );
+ }
fprintf(fp_ou, "<td class=\"header_c\">%s<br>%s</td></tr>\n", _("TOTAL"), label );
memset(tttime,0,sizeof(tttime));
}
fprintf(fp_ou, "<td class=\"header_r\">%s</td></tr>\n",fixtime(tt));
fputs("</table>\n",fp_ou);
+#ifdef ENABLE_DOUBLE_CHECK_DATA
+ if (tt!=uinfo->elap) {
+ debuga(_("Total elapsed time is %"PRIi64" instead of %"PRIi64" in the hourly report of user %s\n"),
+ (int64_t)tt,(int64_t)uinfo->elap,uinfo->label);
+ exit(EXIT_FAILURE);
+ }
+#endif
}
if (write_html_trailer(fp_ou)<0)
debuga(_("Write error in file %s\n"),arqout);
- if (fclose(fp_ou)==EOF)
- debuga(_("Failed to close file %s - %s\n"),arqout,strerror(errno));
+ if (fclose(fp_ou)==EOF) {
+ debuga(_("Write error in %s: %s\n"),arqout,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
return;
}