/*
* SARG Squid Analysis Report Generator http://sarg.sourceforge.net
- * 1998, 2013
+ * 1998, 2015
*
* SARG donations:
* please look at http://sarg.sourceforge.net/donations.php
ouser[0]='\0';
if (snprintf(smart_in,sizeof(smart_in),"%s/smartfilter.int_unsort",tmp)>=sizeof(smart_in)) {
- debuga(_("Path too long: "));
+ debuga(__FILE__,__LINE__,_("Path too long: "));
debuga_more("%s/smartfilter.int_unsort\n",tmp);
exit(EXIT_FAILURE);
}
if (snprintf(sites,sizeof(sites),"%s/sarg-sites",outdirname)>=sizeof(sites)) {
- debuga(_("Path too long: "));
+ debuga(__FILE__,__LINE__,_("Path too long: "));
debuga_more("%s/sarg-sites\n",outdirname);
exit(EXIT_FAILURE);
}
if (snprintf(smart_ou,sizeof(smart_ou),"%s/smartfilter.int_log",tmp)>=sizeof(smart_ou)) {
- debuga(_("Path too long: "));
+ debuga(__FILE__,__LINE__,_("Path too long: "));
debuga_more("%s/smartfilter.int_log\n",tmp);
exit(EXIT_FAILURE);
}
if (snprintf(report,sizeof(report),"%s/smartfilter.html",outdirname)>=sizeof(report)) {
- debuga(_("Path too long: "));
+ debuga(__FILE__,__LINE__,_("Path too long: "));
debuga_more("%s/smartfilter.html\n",outdirname);
exit(EXIT_FAILURE);
}
if (snprintf(csort,sizeof(csort),"sort -n -t \"\t\" -k 1,1 -k 2,2 -k 3,3 -o \"%s\" \"%s\"",smart_ou,smart_in)>=sizeof(csort)) {
- debuga(_("cannot build the sort command to sort file %s\n"),smart_in);
+ debuga(__FILE__,__LINE__,_("Cannot build the sort command to sort file \"%s\"\n"),smart_in);
exit(EXIT_FAILURE);
}
cstatus=system(csort);
if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
- debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus));
- debuga(_("sort command: %s\n"),csort);
+ debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEXITSTATUS(cstatus));
+ debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
exit(EXIT_FAILURE);
}
if((fp_in=fopen(smart_ou,"r"))==NULL) {
- debuga(_("Cannot open file \"%s\": %s\n"),smart_ou,strerror(errno));
- debuga(_("sort command: %s\n"),csort);
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),smart_ou,strerror(errno));
+ debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
exit(EXIT_FAILURE);
}
if (!KeepTempLog && unlink(smart_in)) {
- debuga(_("Cannot delete \"%s\": %s\n"),smart_in,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),smart_in,strerror(errno));
exit(EXIT_FAILURE);
}
if((fp_ou=fopen(report,"w"))==NULL) {
- debuga(_("Cannot open file \"%s\": %s\n"),report,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),report,strerror(errno));
exit(EXIT_FAILURE);
}
if (getword(user,sizeof(user),&gwarea,'\t')<0 || getword(data,sizeof(data),&gwarea,'\t')<0 ||
getword(hora,sizeof(hora),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0 ||
getword(url,sizeof(url),&gwarea,'\t')<0 || getword(smartcat,sizeof(smartcat),&gwarea,'\n')<0) {
- debuga(_("There is a broken record or garbage in file %s\n"),smart_ou);
+ debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),smart_ou);
exit(EXIT_FAILURE);
}
uinfo=userinfo_find_from_id(user);
if (!uinfo) {
- debuga(_("Unknown user ID %s in file %s\n"),user,smart_ou);
+ debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \"%s\"\n"),user,smart_ou);
exit(EXIT_FAILURE);
}
if(strcmp(ouser,user) != 0) {
}
fputs("</body>\n</html>\n",fp_user);
if (fclose(fp_user)==EOF) {
- debuga(_("Write error in \"%s\": %s\n"),smartuser,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),smartuser,strerror(errno));
exit(EXIT_FAILURE);
}
fp_user=NULL;
}
if ((fp_user = fopen(smartuser, "a")) == 0) {
- debuga(_("Cannot open file \"%s\": %s\n"),smartuser,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),smartuser,strerror(errno));
exit(EXIT_FAILURE);
}
fputs("</body>\n</html>\n",fp_user);
if (fclose(fp_ou)==EOF) {
- debuga(_("Write error in \"%s\": %s\n"),report,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),report,strerror(errno));
exit(EXIT_FAILURE);
}
if(fp_user) {
}
fputs("</body>\n</html>\n",fp_user);
if (fclose(fp_user)==EOF) {
- debuga(_("Write error in \"%s\": %s\n"),smartuser,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),smartuser,strerror(errno));
exit(EXIT_FAILURE);
}
}
if (!KeepTempLog && unlink(smart_ou)) {
- debuga(_("Cannot delete \"%s\": %s\n"),smart_ou,strerror(errno));
+ debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),smart_ou,strerror(errno));
exit(EXIT_FAILURE);
}