X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=smartfilter.c;h=33ce33d9c81a1c744e8f713246dca24216659d6c;hb=af961877f77041289e246d781798043a71df386c;hp=df900f2f9639e63cf1e45b457127d9865699145e;hpb=05a933cce0f9e7d35fd4e82f5167c1bde202fb8c;p=thirdparty%2Fsarg.git diff --git a/smartfilter.c b/smartfilter.c index df900f2..33ce33d 100644 --- a/smartfilter.c +++ b/smartfilter.c @@ -1,6 +1,6 @@ /* * SARG Squid Analysis Report Generator http://sarg.sourceforge.net - * 1998, 2013 + * 1998, 2015 * * SARG donations: * please look at http://sarg.sourceforge.net/donations.php @@ -53,48 +53,48 @@ void smartfilter_report(void) 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); } @@ -123,13 +123,13 @@ void smartfilter_report(void) 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) { @@ -145,13 +145,13 @@ void smartfilter_report(void) } fputs("\n\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); } @@ -206,7 +206,7 @@ void smartfilter_report(void) fputs("\n\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) { @@ -219,13 +219,13 @@ void smartfilter_report(void) } fputs("\n\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); }