#include "include/conf.h"
#include "include/defs.h"
+#ifdef ENABLE_DOUBLE_CHECK_DATA
+extern struct globalstatstruct globstat;
+#endif
+
void topsites(void)
{
FILE *fp_in, *fp_ou;
long long int tnbytes=0;
long long int tntime=0;
long long int twork1=0, twork2=0, twork3=0;
+#ifdef ENABLE_DOUBLE_CHECK_DATA
+ long long int ttnacc=0;
+ long long int ttnbytes=0;
+ long long int ttntime=0;
+#endif
int regs=0;
int cstatus;
int url_len;
tnacc+=item.nacc;
tnbytes+=item.nbytes;
tntime+=item.nelap;
+#ifdef ENABLE_DOUBLE_CHECK_DATA
+ ttnacc+=item.nacc;
+ ttnbytes+=item.nbytes;
+ ttntime+=item.nelap;
+#endif
}
fclose(fp_in);
- if (unlink(general2)) {
- debuga(_("Cannot delete %s - %s\n"),general2,strerror(errno));
- exit(EXIT_FAILURE);
- }
longline_destroy(&line);
if (ourl) {
fclose(fp_ou);
+#ifdef ENABLE_DOUBLE_CHECK_DATA
+ if (ttnacc!=globstat.nacc || ttnbytes!=globstat.nbytes || ttntime!=globstat.elap) {
+ debuga(_("Total statistics mismatch when reading %s to produce the top sites\n"),general2);
+ exit(EXIT_FAILURE);
+ }
+#endif
+
+ if (unlink(general2)) {
+ debuga(_("Cannot delete %s - %s\n"),general2,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
if((TopsitesSort & TOPSITE_SORT_CONNECT) != 0) {
sortf="-k 1,1 -k 2,2";
} else if((TopsitesSort & TOPSITE_SORT_BYTES) != 0) {