]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Display the source of the message displayed on stderr
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Sun, 26 Apr 2015 15:52:54 +0000 (17:52 +0200)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Sun, 26 Apr 2015 15:52:54 +0000 (17:52 +0200)
Messages that have been merged in previous commits cannot be distinguished
from each other. It makes debugging more difficult.

To solve this problem, when sarg is run with -zzz, the source file name
and the line number is displayed in the message prefix. It makes it easy to
look at the corresponding source code and understand why the message was
printed.

46 files changed:
alias.c
auth.c
authfail.c
convlog.c
dansguardian_log.c
dansguardian_report.c
datafile.c
decomp.c
denied.c
dichotomic.c
download.c
email.c
exclude.c
getconf.c
grepday.c
html.c
include/defs.h
index.c
indexonly.c
ip2name.c
ip2name_dns.c
ip2name_exec.c
lastlog.c
log.c
longline.c
readlog.c
readlog_common.c
readlog_extlog.c
readlog_sarg.c
readlog_squid.c
realtime.c
redirector.c
repday.c
report.c
siteuser.c
smartfilter.c
sort.c
splitlog.c
topsites.c
topuser.c
totday.c
url.c
useragent.c
userinfo.c
usertab.c
util.c

diff --git a/alias.c b/alias.c
index c4b94f967db6b8c98f69c39413adb6c2251844d4..a7293b242fbef12b665de8fdde7221a89ae0c6ac 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -247,7 +247,7 @@ static int Alias_StoreName(struct AliasStruct *AliasData,const char *name,const
        prev_alias=NULL;
        for (alias=AliasData->First ; alias ; alias=alias->Next) {
                if (alias->Type==ALIASTYPE_Name && !strcmp(Name,alias->Name.Mask)) {
-                       debuga(_("Duplicate aliasing directive for name %s\n"),Name);
+                       debuga(__FILE__,__LINE__,_("Duplicate aliasing directive for name %s\n"),Name);
                        return(0);
                }
                prev_alias=alias;
@@ -256,7 +256,7 @@ static int Alias_StoreName(struct AliasStruct *AliasData,const char *name,const
        // insert into the list
        new_alias=malloc(sizeof(*new_alias));
        if (!new_alias) {
-               debuga(_("Not enough memory to store the user name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the user name aliasing directives\n"));
                return(-1);
        }
        new_alias->Type=ALIASTYPE_Name;
@@ -264,7 +264,7 @@ static int Alias_StoreName(struct AliasStruct *AliasData,const char *name,const
        new_alias->Name.Wildcards=wildcards;
        new_alias->Name.Mask=StringBuffer_Store(AliasData->StringBuffer,Name);
        if (!new_alias->Name.Mask) {
-               debuga(_("Not enough memory to store the user name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the user name aliasing directives\n"));
                free(new_alias);
                return(-1);
        }
@@ -272,7 +272,7 @@ static int Alias_StoreName(struct AliasStruct *AliasData,const char *name,const
        len=(int)(ReplaceE-Replace);
        new_alias->Alias=StringBuffer_StoreLength(AliasData->StringBuffer,Replace,len);
        if (!new_alias->Alias) {
-               debuga(_("Not enough memory to store the user name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the user name aliasing directives\n"));
                free(new_alias);
                return(-1);
        }
@@ -324,10 +324,10 @@ static int Alias_StoreIpv4(struct AliasStruct *AliasData,unsigned char *ipv4,int
                        int bit=alias->Ipv4.NBits%8;
                        if ((byte<1 || memcmp(ipv4,alias->Ipv4.Ip,byte)==0) && (bit==0 || (ipv4[byte] ^ alias->Ipv4.Ip[byte]) & (0xFFU<<(8-bit)))==0) {
                                if (nbits==alias->Ipv4.NBits)
-                                       debuga(_("Duplicate aliasing directive for IPv4 address %d.%d.%d.%d/%d\n"),
+                                       debuga(__FILE__,__LINE__,_("Duplicate aliasing directive for IPv4 address %d.%d.%d.%d/%d\n"),
                                                   ipv4[0],ipv4[1],ipv4[2],ipv4[3],nbits);
                                else
-                                       debuga(_("IPv4 aliasing directive ignored for IPv4 address %d.%d.%d.%d/%d as it is"
+                                       debuga(__FILE__,__LINE__,_("IPv4 aliasing directive ignored for IPv4 address %d.%d.%d.%d/%d as it is"
                                                         " narrower than a previous one (%d.%d.%d.%d/%d\n"),
                                                   ipv4[0],ipv4[1],ipv4[2],ipv4[3],nbits,
                                                        alias->Ipv4.Ip[0],alias->Ipv4.Ip[1],alias->Ipv4.Ip[2],alias->Ipv4.Ip[3],
@@ -341,7 +341,7 @@ static int Alias_StoreIpv4(struct AliasStruct *AliasData,unsigned char *ipv4,int
        // insert into the list
        new_alias=malloc(sizeof(*new_alias));
        if (!new_alias) {
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                return(-1);
        }
        new_alias->Type=ALIASTYPE_Ipv4;
@@ -353,7 +353,7 @@ static int Alias_StoreIpv4(struct AliasStruct *AliasData,unsigned char *ipv4,int
                len=(int)(ReplaceE-Replace);
                tmp=malloc(len+2);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        free(new_alias);
                        return(-1);
                }
@@ -368,7 +368,7 @@ static int Alias_StoreIpv4(struct AliasStruct *AliasData,unsigned char *ipv4,int
                new_alias->Alias=StringBuffer_Store(AliasData->StringBuffer,tmp);
        }
        if (!new_alias->Alias) {
-               debuga(_("Not enough memory to store the IPv4 aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the IPv4 aliasing directives\n"));
                free(new_alias);
                return(-1);
        }
@@ -420,10 +420,10 @@ static int Alias_StoreIpv6(struct AliasStruct *AliasData,unsigned short *ipv6,in
                        int bit=alias->Ipv6.NBits%16;
                        if ((word<1 || memcmp(ipv6,alias->Ipv6.Ip,word*2)==0) && (bit==0 || (ipv6[word] ^ alias->Ipv6.Ip[word]) & (0xFFFFU<<(16-bit)))==0) {
                                if (nbits==alias->Ipv6.NBits)
-                                       debuga(_("Duplicate aliasing directive for IPv6 address %x:%x:%x:%x:%x:%x:%x:%x/%d\n"),
+                                       debuga(__FILE__,__LINE__,_("Duplicate aliasing directive for IPv6 address %x:%x:%x:%x:%x:%x:%x:%x/%d\n"),
                                                   ipv6[0],ipv6[1],ipv6[2],ipv6[3],ipv6[4],ipv6[5],ipv6[6],ipv6[7],nbits);
                                else
-                                       debuga(_("IPv6 aliasing directive ignored for IPv6 address %x:%x:%x:%x:%x:%x:%x:%x/%d as it is"
+                                       debuga(__FILE__,__LINE__,_("IPv6 aliasing directive ignored for IPv6 address %x:%x:%x:%x:%x:%x:%x:%x/%d as it is"
                                                         " narrower than a previous one (%x:%x:%x:%x:%x:%x:%x:%x/%d\n"),
                                                   ipv6[0],ipv6[1],ipv6[2],ipv6[3],ipv6[4],ipv6[5],ipv6[6],ipv6[7],nbits,
                                                        alias->Ipv6.Ip[0],alias->Ipv6.Ip[1],alias->Ipv6.Ip[2],alias->Ipv6.Ip[3],alias->Ipv6.Ip[4],
@@ -437,7 +437,7 @@ static int Alias_StoreIpv6(struct AliasStruct *AliasData,unsigned short *ipv6,in
        // insert into the list
        new_alias=malloc(sizeof(*new_alias));
        if (!new_alias) {
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                return(-1);
        }
        new_alias->Type=ALIASTYPE_Ipv6;
@@ -448,7 +448,7 @@ static int Alias_StoreIpv6(struct AliasStruct *AliasData,unsigned short *ipv6,in
                len=ReplaceE-Replace;
                tmp=malloc(len+2);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        free(new_alias);
                        return(-1);
                }
@@ -463,7 +463,7 @@ static int Alias_StoreIpv6(struct AliasStruct *AliasData,unsigned short *ipv6,in
                new_alias->Alias=StringBuffer_Store(AliasData->StringBuffer,tmp);
        }
        if (!new_alias->Alias) {
-               debuga(_("Not enough memory to store the IPv6 aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the IPv6 aliasing directives\n"));
                free(new_alias);
                return(-1);
        }
@@ -503,14 +503,14 @@ static int Alias_StoreRegexp(struct AliasStruct *AliasData,char *buf)
        for (End=buf ; *End && *End!=Delimiter ; End++) {
                if (*End=='\\') {
                        if (End[1]=='\0') {
-                               debuga(_("Invalid NUL character found in regular expression\n"));
+                               debuga(__FILE__,__LINE__,_("Invalid NUL character found in regular expression\n"));
                                return(-1);
                        }
                        End++; //ignore the escaped character
                }
        }
        if (*End!=Delimiter) {
-               debuga(_("Unterminated regular expression\n"));
+               debuga(__FILE__,__LINE__,_("Unterminated regular expression\n"));
                return(-1);
        }
        *End++='\0';
@@ -523,21 +523,21 @@ static int Alias_StoreRegexp(struct AliasStruct *AliasData,char *buf)
        // store it
        new_alias=malloc(sizeof(*new_alias));
        if (!new_alias) {
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                return(-1);
        }
        new_alias->Type=ALIASTYPE_Pcre;
        new_alias->Next=NULL;
        new_alias->Regex.Re=pcre_compile(buf,0,&PcreError,&ErrorOffset,NULL);
        if (new_alias->Regex.Re==NULL) {
-               debuga(_("Failed to compile the regular expression \"%s\": %s\n"),buf,PcreError);
+               debuga(__FILE__,__LINE__,_("Failed to compile the regular expression \"%s\": %s\n"),buf,PcreError);
                free(new_alias);
                return(-1);
        }
        len=strlen(Replace);
        tmp=malloc(len+2);
        if (!tmp) {
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                pcre_free(new_alias->Regex.Re);
                return(-1);
        }
@@ -547,7 +547,7 @@ static int Alias_StoreRegexp(struct AliasStruct *AliasData,char *buf)
        new_alias->Alias=StringBuffer_Store(AliasData->StringBuffer,tmp);
        free(tmp);
        if (!new_alias->Alias) {
-               debuga(_("Not enough memory to store the regex aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the regex aliasing directives\n"));
                free(new_alias);
                return(-1);
        }
@@ -596,7 +596,7 @@ int Alias_Store(struct AliasStruct *AliasData,char *String)
                if (Alias_StoreRegexp(AliasData,String+3)<0)
                        return(-1);
 #else
-               debuga(_("PCRE not compiled in therefore the regular expressions are not available to alias items\n"));
+               debuga(__FILE__,__LINE__,_("PCRE not compiled in therefore the regular expressions are not available to alias items\n"));
                return(-1);
 #endif
        }
@@ -631,19 +631,19 @@ void Alias_PrintList(struct AliasStruct *AliasData)
                switch (alias->Type)
                {
                        case ALIASTYPE_Name:
-                               debuga(_("  %s => %s\n"),alias->Name.Mask,alias->Alias);
+                               debuga(__FILE__,__LINE__,_("  %s => %s\n"),alias->Name.Mask,alias->Alias);
                                break;
                        case ALIASTYPE_Ipv4:
-                               debuga(_("  %d.%d.%d.%d/%d => %s\n"),alias->Ipv4.Ip[0],alias->Ipv4.Ip[1],alias->Ipv4.Ip[2],
+                               debuga(__FILE__,__LINE__,_("  %d.%d.%d.%d/%d => %s\n"),alias->Ipv4.Ip[0],alias->Ipv4.Ip[1],alias->Ipv4.Ip[2],
                                                alias->Ipv4.Ip[3],alias->Ipv4.NBits,alias->Alias);
                                break;
                        case ALIASTYPE_Ipv6:
-                               debuga(_("  %x:%x:%x:%x:%x:%x:%x:%x/%d => %s\n"),alias->Ipv6.Ip[0],alias->Ipv6.Ip[1],alias->Ipv6.Ip[2],
+                               debuga(__FILE__,__LINE__,_("  %x:%x:%x:%x:%x:%x:%x:%x/%d => %s\n"),alias->Ipv6.Ip[0],alias->Ipv6.Ip[1],alias->Ipv6.Ip[2],
                                                alias->Ipv6.Ip[3],alias->Ipv6.Ip[4],alias->Ipv6.Ip[5],alias->Ipv6.Ip[6],alias->Ipv6.Ip[7],
                                                alias->Ipv6.NBits,alias->Alias);
                                break;
                        case ALIASTYPE_Pcre:
-                               debuga(_("  Re => %s\n"),alias->Alias);
+                               debuga(__FILE__,__LINE__,_("  Re => %s\n"),alias->Alias);
                                break;
                }
        }
diff --git a/auth.c b/auth.c
index 52513b2508500e80e2ee34f553686a42303d8088..2c0ee326e65d82dba0ab9524f6c293ecdf92a4ec 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -39,17 +39,17 @@ void htaccess(const struct userinfostruct *uinfo)
                return;
 
        if (snprintf(htname,sizeof(htname),"%s/%s/.htaccess",outdirname,uinfo->filename)>=sizeof(htname)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s/.htaccess\n",outdirname,uinfo->filename);
                exit(EXIT_FAILURE);
        }
        if((fp_auth=fopen(htname,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),htname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),htname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((fp_in=fopen(AuthUserTemplateFile,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),AuthUserTemplateFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),AuthUserTemplateFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -63,11 +63,11 @@ void htaccess(const struct userinfostruct *uinfo)
                        }
        }
        if (fclose(fp_auth)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),htname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),htname,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),AuthUserTemplateFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),AuthUserTemplateFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index 1d4ccc7073895c8aa04d413999768d2dadbf293c..4069998bc90be7385acc868a0ba4888de2715d09 100644 (file)
@@ -43,17 +43,17 @@ Open a file to store the authentication failure.
 void authfail_open(void)
 {
        if ((ReportType & REPORT_TYPE_AUTH_FAILURES) == 0) {
-               if (debugz>=LogLevel_Process) debugaz(_("Authentication failures report not produced as it is not requested\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Authentication failures report not produced as it is not requested\n"));
                return;
        }
        if (Privacy) {
-               if (debugz>=LogLevel_Process) debugaz(_("Authentication failures report not produced because privacy option is active\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Authentication failures report not produced because privacy option is active\n"));
                return;
        }
 
        snprintf(authfail_unsort,sizeof(authfail_unsort),"%s/authfail.int_unsort",tmp);
        if ((fp_authfail=MY_FOPEN(authfail_unsort,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),authfail_unsort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),authfail_unsort,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
@@ -83,7 +83,7 @@ void authfail_close(void)
        if (fp_authfail)
        {
                if (fclose(fp_authfail)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),authfail_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),authfail_unsort,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                fp_authfail=NULL;
@@ -138,14 +138,14 @@ void authfail_report(void)
 
        if (!authfail_exists) {
                if (!KeepTempLog && authfail_unsort[0]!='\0' && unlink(authfail_unsort))
-                       debuga(_("Failed to delete \"%s\": %s\n"),authfail_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to delete \"%s\": %s\n"),authfail_unsort,strerror(errno));
 
                authfail_unsort[0]='\0';
-               if (debugz>=LogLevel_Process) debugaz(_("Authentication failures report not produced because it is empty\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Authentication failures report not produced because it is empty\n"));
                return;
        }
        if (debugz>=LogLevel_Process)
-               debuga(_("Creating authentication failures report...\n"));
+               debuga(__FILE__,__LINE__,_("Creating authentication failures report...\n"));
 
        snprintf(authfail_sort,sizeof(authfail_sort),"%s/authfail.int_log",tmp);
        snprintf(report,sizeof(report),"%s/authfail.html",outdirname);
@@ -153,23 +153,23 @@ void authfail_report(void)
        snprintf(csort,sizeof(csort),"sort -b -t \"\t\" -T \"%s\" -k 3,3 -k 5,5 -o \"%s\" \"%s\"", tmp, authfail_sort, authfail_unsort);
        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=MY_FOPEN(authfail_sort,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),authfail_sort,strerror(errno));
-               debuga(_("sort command: %s\n"),csort);
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),authfail_sort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
                exit(EXIT_FAILURE);
        }
        if (!KeepTempLog && unlink(authfail_unsort)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),authfail_unsort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),authfail_unsort,strerror(errno));
                exit(EXIT_FAILURE);
        }
        authfail_unsort[0]='\0';
 
        if((fp_ou=MY_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);
        }
 
@@ -184,30 +184,30 @@ void authfail_report(void)
        fprintf(fp_ou,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE"));
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),authfail_sort);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),authfail_sort);
                exit(EXIT_FAILURE);
        }
 
        while((buf=longline_read(fp_in,line))!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(data,sizeof(data),&gwarea,'\t')<0) {
-                       debuga(_("Invalid date in file \"%s\"\n"),authfail_sort);
+                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),authfail_sort);
                        exit(EXIT_FAILURE);
                }
                if (getword(hora,sizeof(hora),&gwarea,'\t')<0) {
-                       debuga(_("Invalid time in file \"%s\"\n"),authfail_sort);
+                       debuga(__FILE__,__LINE__,_("Invalid time in file \"%s\"\n"),authfail_sort);
                        exit(EXIT_FAILURE);
                }
                if (getword(user,sizeof(user),&gwarea,'\t')<0) {
-                       debuga(_("Invalid user ID in file \"%s\"\n"),authfail_sort);
+                       debuga(__FILE__,__LINE__,_("Invalid user ID in file \"%s\"\n"),authfail_sort);
                        exit(EXIT_FAILURE);
                }
                if (getword(ip,sizeof(ip),&gwarea,'\t')<0) {
-                       debuga(_("Invalid IP address in file \"%s\"\n"),authfail_sort);
+                       debuga(__FILE__,__LINE__,_("Invalid IP address in file \"%s\"\n"),authfail_sort);
                        exit(EXIT_FAILURE);
                }
                if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
-                       debuga(_("Invalid url in file \"%s\"\n"),authfail_sort);
+                       debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),authfail_sort);
                        exit(EXIT_FAILURE);
                }
                if (sscanf(data,"%d/%d/%d",&day,&month,&year)!=3) continue;
@@ -216,7 +216,7 @@ void authfail_report(void)
 
                uinfo=userinfo_find_from_id(user);
                if (!uinfo) {
-                       debuga(_("Unknown user ID %s in file \"%s\"\n"),user,authfail_sort);
+                       debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \"%s\"\n"),user,authfail_sort);
                        exit(EXIT_FAILURE);
                }
 
@@ -265,7 +265,7 @@ void authfail_report(void)
                fputs("</td></th>\n",fp_ou);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),authfail_sort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),authfail_sort,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -276,12 +276,12 @@ void authfail_report(void)
        fputs("</table></div>\n",fp_ou);
        write_html_trailer(fp_ou);
        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 (!KeepTempLog && unlink(authfail_sort)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),authfail_sort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),authfail_sort,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -295,13 +295,13 @@ void authfail_cleanup(void)
 {
        if (fp_authfail) {
                if (fclose(fp_authfail)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),authfail_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),authfail_unsort,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                fp_authfail=NULL;
        }
        if(authfail_unsort[0]) {
                if (!KeepTempLog && unlink(authfail_unsort)==-1)
-                       debuga(_("Failed to delete \"%s\": %s\n"),authfail_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to delete \"%s\": %s\n"),authfail_unsort,strerror(errno));
        }
 }
index 8838733ef28e59979288751c1973db7f2f7d93c4..b66a572daae09167357c418a5f3bf1c9cf6199d0 100644 (file)
--- a/convlog.c
+++ b/convlog.c
@@ -43,19 +43,19 @@ void convlog(const char *arq, char df, int dfrom, int duntil)
                arq="/var/log/squid/access.log";
 
        if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),arq,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),arq,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),arq);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),arq);
                exit(EXIT_FAILURE);
        }
 
        while((buf=longline_read(fp_in,line))!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(data,sizeof(data),&gwarea,' ')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),arq);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),arq);
                        exit(EXIT_FAILURE);
                }
                tt=atoi(data);
@@ -79,7 +79,7 @@ void convlog(const char *arq, char df, int dfrom, int duntil)
 
        longline_destroy(&line);
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),arq,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),arq,strerror(errno));
                exit(EXIT_FAILURE);
        }
 }
index 3b4b1d208b91e7c1659d2e97744390adf888d465..1f678bbdc4dadfcfbef335db1f9b298f6d2d97ca 100644 (file)
@@ -53,17 +53,17 @@ void dansguardian_log(void)
        snprintf(guard_ou,sizeof(guard_ou),"%s/dansguardian.int_log",tmp);
 
        if(access(DansGuardianConf, R_OK) != 0) {
-               debuga(_("Cannot open file \"%s\": %s\n"),DansGuardianConf,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),DansGuardianConf,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_guard=fopen(DansGuardianConf,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),DansGuardianConf,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),DansGuardianConf,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_FOPEN(guard_in,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),guard_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),guard_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -74,24 +74,24 @@ void dansguardian_log(void)
                if(strstr(buf,"loglocation ") != 0) {
                        getword_start(&gwarea,buf);
                        if (getword_skip(MAXLEN,&gwarea,'\'')<0 || getword(loglocation,sizeof(loglocation),&gwarea,'\'')<0) {
-                               debuga(_("Invalid record in file \"%s\"\n"),DansGuardianConf);
+                               debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),DansGuardianConf);
                                exit(EXIT_FAILURE);
                        }
-                       if (debug) debuga(_("Using the dansguardian log file \"%s\" found in your configuration file \"%s\"\n"),
+                       if (debug) debuga(__FILE__,__LINE__,_("Using the dansguardian log file \"%s\" found in your configuration file \"%s\"\n"),
                                loglocation,DansGuardianConf);
                        break;
                }
        }
        if (fclose(fp_guard)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),DansGuardianConf,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),DansGuardianConf,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if(debug)
-               debuga(_("Reading DansGuardian log file \"%s\"\n"),loglocation);
+               debuga(__FILE__,__LINE__,_("Reading DansGuardian log file \"%s\"\n"),loglocation);
 
        if((fp_in=MY_FOPEN(loglocation,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),loglocation,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),loglocation,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -101,32 +101,32 @@ void dansguardian_log(void)
                getword_start(&gwarea,buf);
                if (getword_atoi(&year,&gwarea,'.')<0 || getword_atoi(&mon,&gwarea,'.')<0 ||
                    getword_atoi(&day,&gwarea,' ')<0) {
-                       debuga(_("Invalid date in file \"%s\"\n"),loglocation);
+                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoi(&hour,&gwarea,':')<0 || getword(minsec,sizeof(minsec),&gwarea,' ')<0) {
-                       debuga(_("Invalid time in file \"%s\"\n"),loglocation);
+                       debuga(__FILE__,__LINE__,_("Invalid time in file \"%s\"\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
                if (getword(user,sizeof(user),&gwarea,' ')<0) {
-                       debuga(_("Invalid user in file \"%s\"\n"),loglocation);
+                       debuga(__FILE__,__LINE__,_("Invalid user in file \"%s\"\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
                if (getword(ip,sizeof(ip),&gwarea,' ')<0) {
-                       debuga(_("Invalid IP address in file \"%s\"\n"),loglocation);
+                       debuga(__FILE__,__LINE__,_("Invalid IP address in file \"%s\"\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
                if (getword_skip(MAXLEN,&gwarea,'/')<0 || getword_skip(MAXLEN,&gwarea,'/')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),loglocation);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
                if (getword_ptr(buf,&url,&gwarea,' ')<0) {
-                       debuga(_("Invalid url in file \"%s\"\n"),loglocation);
+                       debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
                if (getword_skip(255,&gwarea,' ')<0 ||
                    getword(code1,sizeof(code1),&gwarea,' ')<0 || getword(code2,sizeof(code2),&gwarea,' ')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),loglocation);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),loglocation);
                        exit(EXIT_FAILURE);
                }
                idata = year*10000+mon*100+day;
@@ -145,26 +145,26 @@ void dansguardian_log(void)
        }
 
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),loglocation,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),loglocation,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),guard_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),guard_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if(debug)
-               debuga(_("Sorting file \"%s\"\n"),guard_ou);
+               debuga(__FILE__,__LINE__,_("Sorting file \"%s\"\n"),guard_ou);
 
        snprintf(tmp6,sizeof(tmp6),"sort -t \"\t\" -k 1,1 -k 2,2 -k 4,4 \"%s\" -o \"%s\"",guard_in, guard_ou);
        cstatus=system(tmp6);
        if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
-               debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus));
-               debuga(_("sort command: %s\n"),tmp6);
+               debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEXITSTATUS(cstatus));
+               debuga(__FILE__,__LINE__,_("sort command: %s\n"),tmp6);
                exit(EXIT_FAILURE);
        }
        if (!KeepTempLog && unlink(guard_in)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),guard_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),guard_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 }
index f73460ef2b9e055b6b740db1ef40379e4270fa9b..08c2a57abf3afaf9224ceb95c2b3b7ef75de3ab4 100644 (file)
@@ -61,20 +61,20 @@ void dansguardian_report(void)
        snprintf(dansguardian_in,sizeof(dansguardian_in),"%s/dansguardian.int_log",tmp);
        if(!dansguardian_count) {
                if (!KeepTempLog && unlink(dansguardian_in))
-                       debuga(_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
-               if (debugz>=LogLevel_Process) debugaz(_("Dansguardian report not generated because it is empty\n"));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Dansguardian report not generated because it is empty\n"));
                return;
        }
 
        sprintf(report,"%s/dansguardian.html",outdirname);
 
        if((fp_in=MY_FOPEN(dansguardian_in,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),dansguardian_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),dansguardian_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_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);
        }
 
@@ -92,15 +92,15 @@ void dansguardian_report(void)
                getword_start(&gwarea,buf);
                if (getword(user,sizeof(user),&gwarea,'\t')<0 || getword(date2,sizeof(date2),&gwarea,'\t')<0 ||
                    getword(hour,sizeof(hour),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),dansguardian_in);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),dansguardian_in);
                        exit(EXIT_FAILURE);
                }
                if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
-                       debuga(_("Invalid url in file \"%s\"\n"),dansguardian_in);
+                       debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),dansguardian_in);
                        exit(EXIT_FAILURE);
                }
                if (getword(rule,sizeof(rule),&gwarea,'\n')<0) {
-                       debuga(_("Invalid rule in file \"%s\"\n"),dansguardian_in);
+                       debuga(__FILE__,__LINE__,_("Invalid rule in file \"%s\"\n"),dansguardian_in);
                        exit(EXIT_FAILURE);
                }
 
@@ -160,7 +160,7 @@ void dansguardian_report(void)
                fprintf(fp_ou,"</td><td class=\"data2\">%s</td></tr>\n",rule);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),dansguardian_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),dansguardian_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -170,12 +170,12 @@ void dansguardian_report(void)
        fputs("</table></div>\n",fp_ou);
        write_html_trailer(fp_ou);
        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 (!KeepTempLog && unlink(dansguardian_in)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),dansguardian_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index 2bb02a0d05f6649bdcc349ddae3c0796e6c63736..f1203483fee04f2996dd257071f7c1d1fc1cacd9 100644 (file)
@@ -70,7 +70,7 @@ void data_file(char *tmp)
 
        uscan=userinfo_startscan();
        if (uscan == NULL) {
-               debuga(_("Cannot enumerate the user list\n"));
+               debuga(__FILE__,__LINE__,_("Cannot enumerate the user list\n"));
                exit(EXIT_FAILURE);
        }
        while ( (uinfo = userinfo_advancescan(uscan)) != NULL ) {
@@ -82,22 +82,22 @@ void data_file(char *tmp)
                }
                user_find(userlabel,MAX_USER_LEN, u2);
                userinfo_label(uinfo,userlabel);
-               if(debug) debuga(_("Reading user file \"%s/%s\"\n"),tmp,uinfo->filename);
+               if(debug) debuga(__FILE__,__LINE__,_("Reading user file \"%s/%s\"\n"),tmp,uinfo->filename);
 
                sort_users_log(tmp,debug,uinfo);
                if (snprintf(tmp3,sizeof(tmp3),"%s/%s.user_log",tmp,uinfo->filename)>=sizeof(tmp3)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/%s.user_log\n",tmp,uinfo->filename);
                        exit(EXIT_FAILURE);
                }
 
                if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){
-                       debuga(_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 
                if ((line=longline_create())==NULL) {
-                       debuga(_("Not enough memory to read file \"%s\"\n"),tmp3);
+                       debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),tmp3);
                        exit(EXIT_FAILURE);
                }
 
@@ -109,11 +109,11 @@ void data_file(char *tmp)
                            getword(accip,sizeof(accip),&gwarea,'\t')<0 ||
                            getword_ptr(buf,&accurl,&gwarea,'\t')<0 || getword_atoll(&accbytes,&gwarea,'\t')<0 ||
                            getword(acccode,sizeof(acccode),&gwarea,'\t')<0 || getword_atoll(&accelap,&gwarea,'\t')<0) {
-                               debuga(_("Invalid record in file \"%s\"\n"),tmp3);
+                               debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),tmp3);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_skip(20000,&gwarea,'"')<0 || getword(accsmart,sizeof(accsmart),&gwarea,'"')<0) {
-                               debuga(_("Invalid smart info in file \"%s\"\n"),tmp3);
+                               debuga(__FILE__,__LINE__,_("Invalid smart info in file \"%s\"\n"),tmp3);
                                exit(EXIT_FAILURE);
                        }
 
@@ -132,7 +132,7 @@ void data_file(char *tmp)
                                        ourl_size=url_len+1;
                                        oldurl=realloc(oldurl,ourl_size);
                                        if (!oldurl) {
-                                               debuga(_("Not enough memory to store the url\n"));
+                                               debuga(__FILE__,__LINE__,_("Not enough memory to store the url\n"));
                                                exit(EXIT_FAILURE);
                                        }
                                }
@@ -148,7 +148,7 @@ void data_file(char *tmp)
 
                        if(!same_url || new_user){
                                if(!fp_ou && (fp_ou=MY_FOPEN(DataFile,"w"))==NULL){
-                                       debuga(_("Cannot open file \"%s\": %s\n"),DataFile,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),DataFile,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
                                saverecs(fp_ou,uinfo,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache);
@@ -177,7 +177,7 @@ void data_file(char *tmp)
                                        ourl_size=url_len+1;
                                        oldurl=realloc(oldurl,ourl_size);
                                        if (!oldurl) {
-                                               debuga(_("Not enough memory to store the url\n"));
+                                               debuga(__FILE__,__LINE__,_("Not enough memory to store the url\n"));
                                                exit(EXIT_FAILURE);
                                        }
                                }
@@ -191,7 +191,7 @@ void data_file(char *tmp)
                }
 
                if (fclose(fp_in)==EOF) {
-                       debuga(_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                longline_destroy(&line);
@@ -199,12 +199,12 @@ void data_file(char *tmp)
        userinfo_stopscan(uscan);
        if (oldurl) free(oldurl);
        if (fp_ou && fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),DataFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),DataFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if(debug)
-               debuga(_("Datafile %s written successfully\n"),DataFile);
+               debuga(__FILE__,__LINE__,_("Datafile %s written successfully\n"),DataFile);
 }
 
 void saverecs(FILE *fp_ou, const struct userinfostruct *uinfo, long long int nacc, char *url, long long int nbytes, char *ip, char *hora, char *dia, long long int nelap, long long int incache, long long int oucache)
index 46813f17ad84f2b1649e06834e1d97b63f0c8a09..0b4b01b3c85a451217b190d3bc14bac62e082cd4 100644 (file)
--- a/decomp.c
+++ b/decomp.c
@@ -58,27 +58,27 @@ FILE *decomp(const char *arq, bool *pipe)
                 TRANSLATORS: The last %s is the command used to uncompress
                 the log file such as zcat ou bzip2.
                 */
-               debuga(_("Decompressing log file \"%s\" with %s\n"),arq,"zcat");
+               debuga(__FILE__,__LINE__,_("Decompressing log file \"%s\" with %s\n"),arq,"zcat");
                if (snprintf(cmd,sizeof(cmd),"zcat \"%s\"",arq)>=sizeof(cmd)) {
-                       debuga(_("decompression command too long for log file %s\n"),arq);
+                       debuga(__FILE__,__LINE__,_("decompression command too long for log file %s\n"),arq);
                        exit(EXIT_FAILURE);
                }
                *pipe=true;
                fi=popen(cmd,"r");
        }
        else if(arqlen>4 && strcmp(arq+arqlen-4,".bz2") == 0) {
-               debuga(_("Decompressing log file \"%s\" with %s\n"),arq,"bzcat");
+               debuga(__FILE__,__LINE__,_("Decompressing log file \"%s\" with %s\n"),arq,"bzcat");
                if (snprintf(cmd,sizeof(cmd),"bzcat \"%s\"",arq)>=sizeof(cmd)) {
-                       debuga(_("decompression command too long for log file %s\n"),arq);
+                       debuga(__FILE__,__LINE__,_("decompression command too long for log file %s\n"),arq);
                        exit(EXIT_FAILURE);
                }
                *pipe=true;
                fi=popen(cmd,"r");
        }
        else if(arqlen>2 && strcmp(arq+arqlen-2,".Z") == 0) {
-               debuga(_("Decompressing log file \"%s\" with %s\n"),arq,"zcat");
+               debuga(__FILE__,__LINE__,_("Decompressing log file \"%s\" with %s\n"),arq,"zcat");
                if (snprintf(cmd,sizeof(cmd),"zcat \"%s\"",arq)>=sizeof(cmd)) {
-                       debuga(_("decompression command too long for log file %s\n"),arq);
+                       debuga(__FILE__,__LINE__,_("decompression command too long for log file %s\n"),arq);
                        exit(EXIT_FAILURE);
                }
                *pipe=true;
index 6f4d78b461c2535ac263dcf526ad824edc645ed9..9044b0384f4d0d2f42b4c23e8603e1bb07774fe8 100644 (file)
--- a/denied.c
+++ b/denied.c
@@ -43,17 +43,17 @@ Open a file to store the denied accesses.
 void denied_open(void)
 {
        if ((ReportType & REPORT_TYPE_DENIED) == 0) {
-               if (debugz>=LogLevel_Process) debugaz(_("Denied report not produced as it is not requested\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Denied report not produced as it is not requested\n"));
                return;
        }
        if (Privacy) {
-               if (debugz>=LogLevel_Process) debugaz(_("Denied report not produced because privacy option is active\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Denied report not produced because privacy option is active\n"));
                return;
        }
 
        snprintf(denied_unsort,sizeof(denied_unsort),"%s/denied.int_unsort",tmp);
        if ((fp_denied=MY_FOPEN(denied_unsort,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),denied_unsort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),denied_unsort,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
@@ -82,7 +82,7 @@ void denied_close(void)
 {
        if (fp_denied) {
                if (fclose(fp_denied)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),denied_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),denied_unsort,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                fp_denied=NULL;
@@ -139,30 +139,30 @@ void gen_denied_report(void)
 
        if (!denied_exists) {
                if (!KeepTempLog && denied_unsort[0]!='\0' && unlink(denied_unsort))
-                       debuga(_("Cannot delete \"%s\": %s\n"),denied_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),denied_unsort,strerror(errno));
                denied_unsort[0]='\0';
-               if (debugz>=LogLevel_Process) debugaz(_("Denied report not produced because it is empty\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Denied report not produced because it is empty\n"));
                return;
        }
        if (debugz>=LogLevel_Process)
-               debuga(_("Creating denied accesses report...\n"));
+               debuga(__FILE__,__LINE__,_("Creating denied accesses report...\n"));
 
        if (snprintf(denied_sort,sizeof(denied_sort),"%s/denied.int_log",tmp)>=sizeof(denied_sort)) {
-               debuga(_("Temporary directory path too long to sort the denied accesses\n"));
+               debuga(__FILE__,__LINE__,_("Temporary directory path too long to sort the denied accesses\n"));
                exit(EXIT_FAILURE);
        }
        if (snprintf(csort,sizeof(csort),"sort -T \"%s\" -t \"\t\" -k 3,3 -k 5,5 -o \"%s\" \"%s\"",tmp,denied_sort,denied_unsort)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),denied_unsort,denied_sort);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),denied_unsort,denied_sort);
                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 (unlink(denied_unsort)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),denied_unsort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),denied_unsort,strerror(errno));
                exit(EXIT_FAILURE);
        }
        denied_unsort[0]='\0';
@@ -170,12 +170,12 @@ void gen_denied_report(void)
        sprintf(report,"%s/denied.html",outdirname);
 
        if((fp_in=MY_FOPEN(denied_sort,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),denied_sort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),denied_sort,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_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);
        }
 
@@ -190,7 +190,7 @@ void gen_denied_report(void)
        fprintf(fp_ou,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE"));
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),denied_sort);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),denied_sort);
                exit(EXIT_FAILURE);
        }
 
@@ -198,11 +198,11 @@ void gen_denied_report(void)
                getword_start(&gwarea,buf);
                if (getword(data,sizeof(data),&gwarea,'\t')<0 || getword(hora,sizeof(hora),&gwarea,'\t')<0 ||
                    getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),denied_sort);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),denied_sort);
                        exit(EXIT_FAILURE);
                }
                if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
-                       debuga(_("Invalid url in file \"%s\"\n"),denied_sort);
+                       debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),denied_sort);
                        exit(EXIT_FAILURE);
                }
                if (sscanf(data,"%d/%d/%d",&day,&month,&year)!=3) continue;
@@ -211,7 +211,7 @@ void gen_denied_report(void)
 
                uinfo=userinfo_find_from_id(user);
                if (!uinfo) {
-                       debuga(_("Unknown user ID %s in file \"%s\"\n"),user,denied_sort);
+                       debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \"%s\"\n"),user,denied_sort);
                        exit(EXIT_FAILURE);
                }
 
@@ -263,7 +263,7 @@ void gen_denied_report(void)
                fputs("</td></tr>\n",fp_ou);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),denied_sort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),denied_sort,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -274,12 +274,12 @@ void gen_denied_report(void)
        fputs("</table></div>\n",fp_ou);
        write_html_trailer(fp_ou);
        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 (!KeepTempLog && unlink(denied_sort)==-1)
-               debuga(_("Cannot delete \"%s\": %s\n"),denied_sort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),denied_sort,strerror(errno));
 
        return;
 }
@@ -291,13 +291,13 @@ void denied_cleanup(void)
 {
        if (fp_denied){
                if (fclose(fp_denied)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),denied_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),denied_unsort,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                fp_denied=NULL;
        }
        if (!KeepTempLog && denied_unsort[0]) {
                if (unlink(denied_unsort)==-1)
-                       debuga(_("Failed to delete \"%s\": %s\n"),denied_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to delete \"%s\": %s\n"),denied_unsort,strerror(errno));
        }
 }
index b6c777f765e8ea86ca3438d10d5aa69000e5ecc2..50304988302c76070a2131b6fc02480584d3e4b8 100644 (file)
@@ -158,7 +158,7 @@ bool Dichotomic_Insert(DichotomicObject Obj,const char *key, const char *value)
                Items=realloc(Obj->Items,Obj->NAllocated*sizeof(*Items));
                if (!Items)
                {
-                       debuga(_("Not enough memory to store the key/value pair %s/%s\n"),key,value);
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the key/value pair %s/%s\n"),key,value);
                        exit(EXIT_FAILURE);
                }
                Obj->Items=Items;
@@ -173,7 +173,7 @@ bool Dichotomic_Insert(DichotomicObject Obj,const char *key, const char *value)
        Obj->Items[Position].Value=strdup(value);
        if (!Obj->Items[Position].Key || !Obj->Items[Position].Value)
        {
-               debuga(_("Not enough memory to store the key/value pair %s/%s\n"),key,value);
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the key/value pair %s/%s\n"),key,value);
                exit(EXIT_FAILURE);
        }
        Obj->NItems++;
index f37bb7e11c60f4a5c6b805d7d008ea99bbf0e847..103c6fa2f5cff63495100b648bade377c22bc219 100644 (file)
@@ -61,17 +61,17 @@ Open a file to store the denied accesses.
 void download_open(void)
 {
        if ((ReportType & REPORT_TYPE_DOWNLOADS) == 0) {
-               if (debugz>=LogLevel_Process) debugaz(_("Download report not produced as it is not requested\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Download report not produced as it is not requested\n"));
                return;
        }
        if (Privacy) {
-               if (debugz>=LogLevel_Process) debugaz(_("Download report not produced because privacy option is active\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Download report not produced because privacy option is active\n"));
                return;
        }
 
        snprintf(download_unsort,sizeof(download_unsort),"%s/download.int_unsort",tmp);
        if ((fp_download=MY_FOPEN(download_unsort,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),download_unsort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),download_unsort,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
@@ -102,7 +102,7 @@ void download_close(void)
        if (fp_download)
        {
                if (fclose(fp_download)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),download_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),download_unsort,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                fp_download=NULL;
@@ -137,18 +137,18 @@ static void download_sort(const char *report_in)
        clen=snprintf(csort,sizeof(csort),"sort -T \"%s\" -t \"\t\" -k 3,3 -k 1,1 -k 2,2 -k 5,5 -o \"%s\" \"%s\"",
                        tmp, report_in, download_unsort);
        if (clen>=sizeof(csort)) {
-               debuga(_("Path too long to sort file \"%s\"\n"),download_unsort);
+               debuga(__FILE__,__LINE__,_("Path too long to sort file \"%s\"\n"),download_unsort);
                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 (!KeepTempLog) {
                if (unlink(download_unsort)) {
-                       debuga(_("Cannot delete \"%s\": %s\n"),download_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),download_unsort,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                download_unsort[0]='\0';
@@ -186,14 +186,14 @@ void download_report(void)
 
        if (!download_exists) {
                if (!KeepTempLog && download_unsort[0]!='\0' && unlink(download_unsort))
-                       debuga(_("Cannot delete \"%s\": %s\n"),download_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),download_unsort,strerror(errno));
                download_unsort[0]='\0';
-               if (debugz>=LogLevel_Process) debugaz(_("No downloaded files to report\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("No downloaded files to report\n"));
                return;
        }
 
        if (debugz>=LogLevel_Process)
-               debuga(_("Creating download report...\n"));
+               debuga(__FILE__,__LINE__,_("Creating download report...\n"));
        ouser[0]='\0';
        ouser2[0]='\0';
 
@@ -205,12 +205,12 @@ void download_report(void)
        snprintf(report,sizeof(report),"%s/download.html",outdirname);
 
        if((fp_in=MY_FOPEN(report_in,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),report_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),report_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_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);
        }
 
@@ -225,7 +225,7 @@ void download_report(void)
        fprintf(fp_ou,"<tr><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th><th class=\"header_l\">%s</th></tr>\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE"));
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),report_in);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),report_in);
                exit(EXIT_FAILURE);
        }
 
@@ -233,11 +233,11 @@ void download_report(void)
                getword_start(&gwarea,buf);
                if (getword(data,sizeof(data),&gwarea,'\t')<0 || getword(hora,sizeof(hora),&gwarea,'\t')<0 ||
                    getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),report_in);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),report_in);
                        exit(EXIT_FAILURE);
                }
                if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
-                       debuga(_("Invalid url in file \"%s\"\n"),report_in);
+                       debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),report_in);
                        exit(EXIT_FAILURE);
                }
                if (sscanf(data,"%d/%d/%d",&day,&month,&year)!=3) continue;
@@ -246,7 +246,7 @@ void download_report(void)
 
                uinfo=userinfo_find_from_id(user);
                if (!uinfo) {
-                       debuga(_("Unknown user ID %s in file \"%s\"\n"),user,report_in);
+                       debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \"%s\"\n"),user,report_in);
                        exit(EXIT_FAILURE);
                }
                new_user=false;
@@ -297,7 +297,7 @@ void download_report(void)
                fputs("</td></tr>\n",fp_ou);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),report_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),report_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -305,12 +305,12 @@ void download_report(void)
        fputs("</table></div>\n",fp_ou);
        write_html_trailer(fp_ou);
        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 (!KeepTempLog && unlink(report_in)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),report_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),report_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -351,7 +351,7 @@ void set_download_suffix(const char *list)
 
        DownloadSuffix=strdup(list);
        if (!DownloadSuffix) {
-               debuga(_("Download suffix list too long\n"));
+               debuga(__FILE__,__LINE__,_("Download suffix list too long\n"));
                exit(EXIT_FAILURE);
        }
        j = 1;
@@ -359,7 +359,7 @@ void set_download_suffix(const char *list)
                if (list[i] == ',') j++;
        DownloadSuffixIndex=malloc(j*sizeof(char *));
        if (!DownloadSuffixIndex) {
-               debuga(_("Too many download suffixes\n"));
+               debuga(__FILE__,__LINE__,_("Too many download suffixes\n"));
                exit(EXIT_FAILURE);
        }
 
@@ -453,13 +453,13 @@ void download_cleanup(void)
 {
        if (fp_download) {
                if (fclose(fp_download)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),download_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),download_unsort,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                fp_download=NULL;
        }
        if (download_unsort[0]) {
                if (unlink(download_unsort)==-1)
-                       debuga(_("Failed to delete \"%s\": %s\n"),download_unsort,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to delete \"%s\": %s\n"),download_unsort,strerror(errno));
        }
 }
diff --git a/email.c b/email.c
index d4bd1dc289b50ce26156bdc62f02a61bb24f7682..0f9cd9a2b72c2be0a2f6f2cf474779d2854d6fa6 100644 (file)
--- a/email.c
+++ b/email.c
@@ -58,13 +58,13 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
 
        snprintf(wger,sizeof(wger),"%s/sarg-general",dirname);
        if((fp_in=fopen(wger,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),wger,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wger,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        snprintf(top2,sizeof(top2),"%s/top.tmp",dirname);
        if((fp_top2=fopen(top2,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),top2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -72,7 +72,7 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
        totuser=0;
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),wger);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),wger);
                exit(EXIT_FAILURE);
        }
 
@@ -103,7 +103,7 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
                tnelap+=item.nelap;
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),wger,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wger,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -120,41 +120,41 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
        }
 
        if (fclose(fp_top2)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),top2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),top2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
 #ifdef ENABLE_DOUBLE_CHECK_DATA
        if (ttnacc!=globstat.nacc || ttnbytes!=globstat.nbytes || ttnelap!=globstat.elap) {
-               debuga(_("Total statistics mismatch when reading \"%s\" to produce the email report\n"),wger);
+               debuga(__FILE__,__LINE__,_("Total statistics mismatch when reading \"%s\" to produce the email report\n"),wger);
                exit(EXIT_FAILURE);
        }
 #endif
 
        if (snprintf(csort,sizeof(csort),"sort -n -T \"%s\" -t \"\t\" -r -k 2,2 -o \"%s\" \"%s\"", TempDir, top1, top2)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),top2,top1);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),top2,top1);
                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 (!KeepTempLog && unlink(top2)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),top2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),top2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_top1=fopen(top1,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),top1,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top1,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        snprintf(top3,sizeof(top3),"%s/report",dirname);
        if((fp_top3=fopen(top3,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -191,25 +191,25 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
                fixendofline(warea);
                getword_start(&gwarea,warea);
                if (getword(user,sizeof(user),&gwarea,'\t')<0) {
-                       debuga(_("Invalid user ID in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid user ID in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&nbytes,&gwarea,'\t')<0) {
-                       debuga(_("Invalid number of bytes in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid number of bytes in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&nacc,&gwarea,'\t')<0) {
-                       debuga(_("Invalid number of accesses in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid number of accesses in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&elap,&gwarea,'\0')<0) {
-                       debuga(_("Invalid elapsed time in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
 
                uinfo=userinfo_find_from_id(user);
                if (!uinfo) {
-                       debuga(_("Unknown user ID %s in file \"%s\"\n"),user,top1);
+                       debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \"%s\"\n"),user,top1);
                        exit(EXIT_FAILURE);
                }
 
@@ -253,11 +253,11 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
 #endif
 
        if (fclose(fp_top1)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),top1,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),top1,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if (!KeepTempLog && unlink(top1)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),top1,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),top1,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -266,20 +266,20 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
        fprintf(fp_top3, "\n%s\n", asctime(local));
 
        if (fclose(fp_top3)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),top3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),top3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if(strcmp(email,"stdout") == 0) {
                if((fp_top3=fopen(top3,"r"))==NULL) {
-                       debuga(_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 
                while(fgets(warea,sizeof(warea),fp_top3)!=NULL)
                        fputs(warea,stdout);
                if (fclose(fp_top3)==EOF) {
-                       debuga(_("Read error in \"%s\": %s\n"),top3,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),top3,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        } else {
@@ -288,11 +288,11 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema
                strftime(Subject,sizeof(Subject),_("SARG report, %c"),local);
                snprintf(warea,sizeof(warea),"%s -s \"%s\" \"%s\" <\"%s\"",MailUtility,Subject,email,top3);
                if (debug)
-                       debuga(_("Sending mail with command: %s\n"),warea);
+                       debuga(__FILE__,__LINE__,_("Sending mail with command: %s\n"),warea);
                cstatus=system(warea);
                if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
-                       debuga(_("command return status %d\n"),WEXITSTATUS(cstatus));
-                       debuga(_("command: %s\n"),warea);
+                       debuga(__FILE__,__LINE__,_("command return status %d\n"),WEXITSTATUS(cstatus));
+                       debuga(__FILE__,__LINE__,_("command: %s\n"),warea);
                        exit(EXIT_FAILURE);
                }
        }
index 35f1722988e4d340702a833cf014ebdeb837a65f..29c1e296859e2c8642efbae44d07c811a43e2f65 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -79,7 +79,7 @@ static void store_exclude_ip4(unsigned char *addr,int nbits)
                ip4allocated+=5;
                temp=realloc(exclude_ip4,ip4allocated*sizeof(*temp));
                if (temp==NULL) {
-                       debuga(_("Not enough memory to store the exlcluded IP addresses\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the exlcluded IP addresses\n"));
                        exit(EXIT_FAILURE);
                }
                exclude_ip4=temp;
@@ -107,7 +107,7 @@ static void store_exclude_ip6(unsigned short *addr,int nbits)
                ip6allocated+=5;
                temp=realloc(exclude_ip6,ip6allocated*sizeof(*temp));
                if (temp==NULL) {
-                       debuga(_("Not enough memory to store the exlcluded IP addresses\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the exlcluded IP addresses\n"));
                        exit(EXIT_FAILURE);
                }
                exclude_ip6=temp;
@@ -158,7 +158,7 @@ static void store_exclude_url(const char *url,const char *next)
                nameallocated+=5;
                temp=realloc(exclude_name,nameallocated*sizeof(*temp));
                if (temp==NULL) {
-                       debuga(_("Not enough memory to store the excluded URLs\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the excluded URLs\n"));
                        exit(EXIT_FAILURE);
                }
                exclude_name=temp;
@@ -168,7 +168,7 @@ static void store_exclude_url(const char *url,const char *next)
        num_exclude_name++;
        item->url=malloc(length+1);
        if (!item->url) {
-               debuga(_("Not enough memory to store the excluded URLs\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the excluded URLs\n"));
                exit(EXIT_FAILURE);
        }
        safe_strcpy(item->url,url,length+1);
@@ -193,14 +193,14 @@ void gethexclude(const char *hexfile, int debug)
        const char *next;
 
        if(access(hexfile, R_OK) != 0) {
-               debuga(_("Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if(debug)
-               debuga(_("Loading exclude host file from \"%s\"\n"),hexfile);
+               debuga(__FILE__,__LINE__,_("Loading exclude host file from \"%s\"\n"),hexfile);
 
        if ((fp_ex = fopen(hexfile, "r")) == NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),hexfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -211,7 +211,7 @@ void gethexclude(const char *hexfile, int debug)
 
                type=extract_address_mask(buf,&name,ipv4,ipv6,&nbits,&next);
                if (type<0) {
-                       debuga(_("While reading \"%s\"\n"),hexfile);
+                       debuga(__FILE__,__LINE__,_("While reading \"%s\"\n"),hexfile);
                        exit(EXIT_FAILURE);
                }
 
@@ -225,7 +225,7 @@ void gethexclude(const char *hexfile, int debug)
        }
 
        if (fclose(fp_ex)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),hexfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),hexfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
@@ -314,30 +314,30 @@ void getuexclude(const char *uexfile, int debug)
        long int nreg=0;
 
        if(debug)
-               debuga(_("Loading exclude file from \"%s\"\n"),uexfile);
+               debuga(__FILE__,__LINE__,_("Loading exclude file from \"%s\"\n"),uexfile);
 
        if ((fp_ex = fopen(uexfile, "r")) == NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),uexfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),uexfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (fseek(fp_ex, 0, SEEK_END)==-1) {
-               debuga(_("Failed to move till the end of file \"%s\": %s\n"),uexfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Failed to move till the end of file \"%s\": %s\n"),uexfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
        nreg = ftell(fp_ex);
        if (nreg<0) {
-               debuga(_("Cannot get the size of file \"%s\"\n"),uexfile);
+               debuga(__FILE__,__LINE__,_("Cannot get the size of file \"%s\"\n"),uexfile);
                exit(EXIT_FAILURE);
        }
        nreg += 11;
        if (fseek(fp_ex, 0, SEEK_SET)==-1) {
-               debuga(_("Failed to rewind file \"%s\": %s\n"),uexfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Failed to rewind file \"%s\": %s\n"),uexfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((excludeuser=(char *) malloc(nreg))==NULL){
-               debuga(_("malloc error (%ld bytes required)\n"),nreg);
+               debuga(__FILE__,__LINE__,_("malloc error (%ld bytes required)\n"),nreg);
                exit(EXIT_FAILURE);
        }
 
@@ -354,7 +354,7 @@ void getuexclude(const char *uexfile, int debug)
        strcat(excludeuser,"*END* ");
 
        if (fclose(fp_ex)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),uexfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),uexfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index 2b0a1604171b28dda6cb62b90b3429bbd107fed1..8454e5d549b82e6dd4ec50d4de02ee6bffda3579 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -228,7 +228,7 @@ static int getparam_string(const char *param,char *buf,char *value,int value_siz
        while (*buf && (unsigned char)*buf<=' ') buf++;
 
        if (strlen(buf)>=value_size) {
-               debuga(_("The string value of parameter \"%s\" is too long\n"),param);
+               debuga(__FILE__,__LINE__,_("The string value of parameter \"%s\" is too long\n"),param);
                exit(EXIT_FAILURE);
        }
        strcpy(value,buf);
@@ -273,7 +273,7 @@ static int getparam_quoted(const char *param,char *buf,char *value,int value_siz
        while (*buf && (unsigned char)*buf<=' ') buf++;
 
        if (*buf != '\"') {
-               debuga(_("Missing double quote after parameter \"%s\"\n"),param);
+               debuga(__FILE__,__LINE__,_("Missing double quote after parameter \"%s\"\n"),param);
                exit(EXIT_FAILURE);
        }
        buf++;
@@ -285,7 +285,7 @@ static int getparam_quoted(const char *param,char *buf,char *value,int value_siz
        value[i]='\0';
 
        if (*buf != '\"') {
-               debuga(_("Missing double quote after parameter \"%s\" or value is more than %d bytes long\n"),param,value_size);
+               debuga(__FILE__,__LINE__,_("Missing double quote after parameter \"%s\" or value is more than %d bytes long\n"),param,value_size);
                exit(EXIT_FAILURE);
        }
        fixnone(value);
@@ -306,11 +306,11 @@ static int getparam_2words(const char *param,char *buf,char *word1,int word1_siz
        for (i=0 ; i<word1_size && *buf && (unsigned char)*buf>' ' ; i++)
                word1[i]=*buf++;
        if (i>=word1_size) {
-               debuga(_("The first word of parameter \"%s\" is more than %d bytes long\n"),param,word1_size-1);
+               debuga(__FILE__,__LINE__,_("The first word of parameter \"%s\" is more than %d bytes long\n"),param,word1_size-1);
                exit(EXIT_FAILURE);
        }
        if (*buf!=' ') {
-               debuga(_("Missing second word for parameter \"%s\"\n"),param);
+               debuga(__FILE__,__LINE__,_("Missing second word for parameter \"%s\"\n"),param);
                exit(EXIT_FAILURE);
        }
        word1[i]=0;
@@ -320,7 +320,7 @@ static int getparam_2words(const char *param,char *buf,char *word1,int word1_siz
        for (i=0 ; i<word2_size && *buf && (unsigned char)*buf>' ' ; i++)
                word2[i]=*buf++;
        if (i>=word2_size) {
-               debuga(_("The second word of parameter \"%s\" is more than %d bytes long\n"),param,word2_size-1);
+               debuga(__FILE__,__LINE__,_("The second word of parameter \"%s\" is more than %d bytes long\n"),param,word2_size-1);
                exit(EXIT_FAILURE);
        }
        word2[i]=0;
@@ -343,7 +343,7 @@ static int getparam_int(const char *param,char *buf,int *value)
 
        next=0;
        if (sscanf(buf,"%d%n",value,&next) != 1 || (unsigned char)buf[next] > ' ') {
-               debuga(_("The integer value of parameter \"%s\" is invalid\n"),param);
+               debuga(__FILE__,__LINE__,_("The integer value of parameter \"%s\" is invalid\n"),param);
                exit(EXIT_FAILURE);
        }
        return(1);
@@ -395,11 +395,11 @@ static int getparam_list(const char *param,struct param_list *options,int noptio
                }
                for (i=0 ; i<noptions && strcasecmp(buf,options[i].name) ; i++);
                if (i>=noptions) {
-                       debuga(_("Unknown value \"%s\" for parameter \"%s\"\n"),buf,param);
+                       debuga(__FILE__,__LINE__,_("Unknown value \"%s\" for parameter \"%s\"\n"),buf,param);
                        exit(EXIT_FAILURE);
                }
                if ((*value & options[i].exclude)!=0) {
-                       debuga(_("Value \"%s\" conflicts with other selected values for parameter \"%s\"\n"),buf,param);
+                       debuga(__FILE__,__LINE__,_("Value \"%s\" conflicts with other selected values for parameter \"%s\"\n"),buf,param);
                        exit(EXIT_FAILURE);
                }
                *value|=options[i].value;
@@ -430,7 +430,7 @@ static int getparam_sort(const char *param,struct sort_list *options,int noption
        }
        for (i=0 ; i<noptions && strcasecmp(buf,options[i].name) ; i++);
        if (i>=noptions) {
-               debuga(_("Unknown sort criterion \"%s\" for parameter \"%s\"\n"),buf,param);
+               debuga(__FILE__,__LINE__,_("Unknown sort criterion \"%s\" for parameter \"%s\"\n"),buf,param);
                exit(EXIT_FAILURE);
        }
        *value=options[i].value;
@@ -445,7 +445,7 @@ static int getparam_sort(const char *param,struct sort_list *options,int noption
                if (strcasecmp(order,"reverse")==0 || strcasecmp(order,"D")==0) {
                        *value|=SORT_REVERSE;
                } else if (strcasecmp(order,"normal")!=0 && strcasecmp(order,"A")!=0) {
-                       debuga(_("Unknown sort order \"%s\" for parameter \"%s\"\n"),order,param);
+                       debuga(__FILE__,__LINE__,_("Unknown sort order \"%s\" for parameter \"%s\"\n"),order,param);
                        exit(EXIT_FAILURE);
                }
        }
@@ -471,7 +471,7 @@ static int getparam_select(const char *param,struct select_list *options,int nop
        *buf='\0';
        for (i=0 ; i<noptions && strcasecmp(str,options[i].name) ; i++);
        if (i>=noptions) {
-               debuga(_("Unknown value \"%s\" for parameter \"%s\"\n"),str,param);
+               debuga(__FILE__,__LINE__,_("Unknown value \"%s\" for parameter \"%s\"\n"),str,param);
                exit(EXIT_FAILURE);
        }
        *value=options[i].value;
@@ -512,7 +512,7 @@ static int getparam_userlimit(const char *param,char *buf)
        do {
                while (*buf && (unsigned char)*buf>' ') buf++;
                if (*buf!=' ') {
-                       debuga(_("Missing limit in per_user_limit\n"));
+                       debuga(__FILE__,__LINE__,_("Missing limit in per_user_limit\n"));
                        exit(EXIT_FAILURE);
                }
                file_end=buf;
@@ -538,13 +538,13 @@ static int getparam_userlimit(const char *param,char *buf)
                                break;
                        }
                if (i<0) {
-                       debuga(_("Invalid output type in per_user_limit\n"));
+                       debuga(__FILE__,__LINE__,_("Invalid output type in per_user_limit\n"));
                        exit(EXIT_FAILURE);
                }
        }
 
        if (PerUserLimitsNumber>=MAX_USER_LIMITS) {
-               debuga(_("Too many per_user_limit\n"));
+               debuga(__FILE__,__LINE__,_("Too many per_user_limit\n"));
                exit(EXIT_FAILURE);
        }
        *file_end='\0';
@@ -636,7 +636,7 @@ static void parmtest(char *buf)
        if (is_param("date_format",buf)) {
                getword_start(&gwarea,buf);
                if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
-                       debuga(_("Invalid record in \"date_format\" parameter\n"));
+                       debuga(__FILE__,__LINE__,_("Invalid record in \"date_format\" parameter\n"));
                        exit(EXIT_FAILURE);
                }
                DateFormat=gwarea.current[0];
@@ -645,7 +645,7 @@ static void parmtest(char *buf)
 
        if (is_param("hours",buf)) {
                if( getnumlist( buf, &hours, 24, 24 ) ) {
-                       debuga(_("Error: Invalid syntax in hours tag!\n"));
+                       debuga(__FILE__,__LINE__,_("Error: Invalid syntax in hours tag!\n"));
                        exit( 1 );
                }
                return;
@@ -653,7 +653,7 @@ static void parmtest(char *buf)
 
        if (is_param("weekdays",buf)) {
                if( getnumlist( buf, &weekdays, 7, 7 ) ) {
-                       debuga(_("Error: Invalid syntax in weekdays tag!\n"));
+                       debuga(__FILE__,__LINE__,_("Error: Invalid syntax in weekdays tag!\n"));
                        exit( 1 );
                }
                return;
@@ -669,7 +669,7 @@ static void parmtest(char *buf)
                        if (!AccessLog)
                                AccessLog=FileList_Create();
                        if (!FileList_AddFile(AccessLog,FileName)) {
-                               debuga(_("Not enough memory to store the input log file names\n"));
+                               debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
                                exit(EXIT_FAILURE);
                        }
                }
@@ -679,7 +679,7 @@ static void parmtest(char *buf)
        if (is_param("redirector_log",buf)>0) {
                if (RedirectorLogFromCmdLine==0) {
                        if (NRedirectorLogs>=MAX_REDIRECTOR_LOGS) {
-                               debuga(_("Too many redirector log files in configuration file\n"));
+                               debuga(__FILE__,__LINE__,_("Too many redirector log files in configuration file\n"));
                                exit(EXIT_FAILURE);
                        }
                        getparam_string("redirector_log",buf,RedirectorLogs[NRedirectorLogs],MAX_REDIRECTOR_FILELEN);
@@ -827,14 +827,14 @@ static void parmtest(char *buf)
 
                if (is_absolute(wbuf)) {
                        if (strlen(wbuf)>=sizeof(AuthUserTemplateFile)) {
-                               debuga(_("Template file name is too long in parameter \"AuthUserTemplateFile\"\n"));
+                               debuga(__FILE__,__LINE__,_("Template file name is too long in parameter \"AuthUserTemplateFile\"\n"));
                                exit(EXIT_FAILURE);
                        }
                        safe_strcpy(AuthUserTemplateFile,wbuf,sizeof(AuthUserTemplateFile));
                } else {
                        safe_strcpy(dir,ConfigFile,sizeof(dir));
                        if (snprintf(AuthUserTemplateFile,sizeof(AuthUserTemplateFile),"%s/%s",dirname(dir),wbuf)>=sizeof(AuthUserTemplateFile)) {
-                               debuga(_("Template file name is too long in parameter \"AuthUserTemplateFile\"\n"));
+                               debuga(__FILE__,__LINE__,_("Template file name is too long in parameter \"AuthUserTemplateFile\"\n"));
                                exit(EXIT_FAILURE);
                        }
                }
@@ -852,7 +852,7 @@ static void parmtest(char *buf)
        if (getparam_bool("graphs",buf,&Graphs)>0) {
 #ifndef HAVE_GD
                if (Graphs)
-                       debugaz(_("No graphs available as sarg was not compiled with libgd. Set \"graphs\" to \"no\" in %s to disable this warning\n"),
+                       debugaz(__FILE__,__LINE__,_("No graphs available as sarg was not compiled with libgd. Set \"graphs\" to \"no\" in %s to disable this warning\n"),
                                ConfigFile);
 #endif
                return;
@@ -862,7 +862,7 @@ static void parmtest(char *buf)
 
        if (getparam_string("redirector_log_format",buf,RedirectorLogFormat,sizeof(RedirectorLogFormat))>0) return;
        if (getparam_string("squidguard_log_format",buf,RedirectorLogFormat,sizeof(RedirectorLogFormat))>0) {
-               debuga(_("squidguard_log_format is deprecated and has been replaced by redirector_log_format. Please update your configuration file.\n"));
+               debuga(__FILE__,__LINE__,_("squidguard_log_format is deprecated and has been replaced by redirector_log_format. Please update your configuration file.\n"));
                return;
        }
 
@@ -871,19 +871,19 @@ static void parmtest(char *buf)
                /*
                Due to an old bug in sarg before version 2.3, the option was having the opposite action than implied by the name.
                */
-               debuga(_("redirector_ignore_date is deprecated and has been replaced by redirector_filter_out_date that does the action implied by its name as opposed to redirector_ignore_date. Please update your configuration file.\n"));
+               debuga(__FILE__,__LINE__,_("redirector_ignore_date is deprecated and has been replaced by redirector_filter_out_date that does the action implied by its name as opposed to redirector_ignore_date. Please update your configuration file.\n"));
                RedirectorFilterOutDate=!RedirectorFilterOutDate;
                return;
        }
        if (getparam_bool("squidguard_ignore_date",buf,&RedirectorFilterOutDate)>0) {
-               debuga(_("squidguard_ignore_date is deprecated and has been replaced by redirector_filter_out_date that does the action implied by its name as opposed to squidguard_ignore_date. Please update your configuration file.\n"));
+               debuga(__FILE__,__LINE__,_("squidguard_ignore_date is deprecated and has been replaced by redirector_filter_out_date that does the action implied by its name as opposed to squidguard_ignore_date. Please update your configuration file.\n"));
                RedirectorFilterOutDate=!RedirectorFilterOutDate;
                return;
        }
 
        if (getparam_bool("dansguardian_filter_out_date",buf,&DansguardianFilterOutDate)>0) return;
        if (getparam_bool("dansguardian_ignore_date",buf,&DansguardianFilterOutDate)>0) {
-               debuga(_("dansguardian_ignore_date is deprecated and has been replaced by dansguardian_filter_out_date that does the action implied by its name as opposed to dansguardian_ignore_date. Please update your configuration file.\n"));
+               debuga(__FILE__,__LINE__,_("dansguardian_ignore_date is deprecated and has been replaced by dansguardian_filter_out_date that does the action implied by its name as opposed to dansguardian_ignore_date. Please update your configuration file.\n"));
                DansguardianFilterOutDate=!DansguardianFilterOutDate;
                return;
        }
@@ -940,12 +940,12 @@ static void parmtest(char *buf)
        if(strstr(buf,"byte_cost") != 0) {
                getword_start(&gwarea,buf);
                if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
-                       debuga(_("The \"byte_cost\" parameter of the configuration file is invalid\n"));
+                       debuga(__FILE__,__LINE__,_("The \"byte_cost\" parameter of the configuration file is invalid\n"));
                        exit(EXIT_FAILURE);
                }
                cost=atol(gwarea.current);
                if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
-                       debuga(_("The \"byte_cost\" parameter of the configuration file is invalid\n"));
+                       debuga(__FILE__,__LINE__,_("The \"byte_cost\" parameter of the configuration file is invalid\n"));
                        exit(EXIT_FAILURE);
                }
                nocost=my_atoll(gwarea.current);
@@ -963,10 +963,10 @@ void getconf(void)
        char buf[MAXLEN];
 
        if(debug)
-               debuga(_("Loading configuration from \"%s\"\n"),ConfigFile);
+               debuga(__FILE__,__LINE__,_("Loading configuration from \"%s\"\n"),ConfigFile);
 
        if ((fp_in = fopen(ConfigFile, "r")) == NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),ConfigFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),ConfigFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -981,7 +981,7 @@ void getconf(void)
        }
 
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),ConfigFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),ConfigFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
index 18f3fe24c8ad530869e06839347969235416e20a..99ba095192dafd57253463c6737f695a8f3ec293 100644 (file)
--- a/grepday.c
+++ b/grepday.c
@@ -141,7 +141,7 @@ static void Sarg_gdImageStringFT (struct GraphDataStruct *gdata, int fg, char *f
                if (sslen>gdata->string_size) {
                        sstring = (char *)realloc(gdata->string,sslen);
                        if (!sstring) {
-                               debuga(_("realloc error (%"PRIu64" bytes required)\n"),(uint64_t)sslen);
+                               debuga(__FILE__,__LINE__,_("realloc error (%"PRIu64" bytes required)\n"),(uint64_t)sslen);
                                exit(EXIT_FAILURE);
                        }
                        gdata->string=(char *)sstring;
@@ -154,7 +154,7 @@ static void Sarg_gdImageStringFT (struct GraphDataStruct *gdata, int fg, char *f
                str = string;
                sstr = sstring;
                if (iconv (localtoutf, (ICONV_CONST char **)&str, &slen, &sstr, &sslen)==-1) {
-                       debuga(_("iconv failed to convert string \"%s\" from %s to UTF-8: %s\n"),string,CharSet,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("iconv failed to convert string \"%s\" from %s to UTF-8: %s\n"),string,CharSet,strerror(errno));
                        sstring=(char *)string; //show something sensible on the graph
                }
        } else {
@@ -167,7 +167,7 @@ static void Sarg_gdImageStringFT (struct GraphDataStruct *gdata, int fg, char *f
        if (RefPos!=TRP_BottomLeft) {
                retval = gdImageStringFTEx (NULL, brect, fg, fontlist, ptsize, angle, 0, 0, sstring, gdFTEX_Unicode);
                if (retval) {
-                       debuga(_("libgd failed to calculate the bounding box of the text \"%s\": %s\n"),sstring,retval);
+                       debuga(__FILE__,__LINE__,_("libgd failed to calculate the bounding box of the text \"%s\": %s\n"),sstring,retval);
                        exit(EXIT_FAILURE);
                }
                /*
@@ -234,7 +234,7 @@ static void Sarg_gdImageStringFT (struct GraphDataStruct *gdata, int fg, char *f
        }
        retval = gdImageStringFTEx (gdata->im, brect, fg, fontlist, ptsize, angle, x, y, sstring, gdFTEX_Unicode);
        if (retval) {
-               debuga(_("libgd failed to render the text \"%s\": %s\n"),sstring,retval);
+               debuga(__FILE__,__LINE__,_("libgd failed to render the text \"%s\": %s\n"),sstring,retval);
                exit(EXIT_FAILURE);
        }
 }
@@ -292,11 +292,11 @@ static int greport_compute_yaxis(struct PlotStruct *pdata,struct GraphDataStruct
        double yscale;
 
        if (pdata->ymin<0.) {
-               debuga(_("Minimum for Y scale of the graph is out of range: %"PRId64"\n"),(int64_t)pdata->ymin);
+               debuga(__FILE__,__LINE__,_("Minimum for Y scale of the graph is out of range: %"PRId64"\n"),(int64_t)pdata->ymin);
                return(-1);
        }
        if (pdata->ymax<=0.) {
-               debuga(_("Maximum for Y scale of the graph is out of range: %"PRId64"\n"),(int64_t)pdata->ymax);
+               debuga(__FILE__,__LINE__,_("Maximum for Y scale of the graph is out of range: %"PRId64"\n"),(int64_t)pdata->ymax);
                return(-1);
        }
 
@@ -321,7 +321,7 @@ static int greport_compute_yaxis(struct PlotStruct *pdata,struct GraphDataStruct
                        break;
 
                default:
-                       debuga(_("Unknown type %d for Y axis scale\n"),pdata->ytype);
+                       debuga(__FILE__,__LINE__,_("Unknown type %d for Y axis scale\n"),pdata->ytype);
                        return(-1);
        }
        gdata->YTickSpace=10;
@@ -482,7 +482,7 @@ static void greport_plot(const struct userinfostruct *uinfo,struct PlotStruct *p
                gdata.color2 = gdImageColorAllocate(gdata.im,111,10,10);
                gdata.color3 = gdImageColorAllocate(gdata.im,166,10,10);
        } else {
-               debuga(_("Unknown color \"%s\" requested for the graph. Using orange instead\n"),GraphDaysBytesBarColor);
+               debuga(__FILE__,__LINE__,_("Unknown color \"%s\" requested for the graph. Using orange instead\n"),GraphDaysBytesBarColor);
                gdata.color1 = gdImageColorAllocate(gdata.im, 255, 233, 142);
                gdata.color2 = gdImageColorAllocate(gdata.im, 220, 163, 72);
                gdata.color3 = gdImageColorAllocate(gdata.im, 255, 198, 107);
@@ -611,17 +611,17 @@ static void greport_plot(const struct userinfostruct *uinfo,struct PlotStruct *p
 
        if (snprintf(graph,sizeof(graph),"%s/%s/%s",outdirname,uinfo->filename,pdata->pngfile)>=sizeof(graph)) {
                /* TRANSLATORS: The message is followed by the path that is too long. */
-               debuga(_("User name too long to manufacture file name "));
+               debuga(__FILE__,__LINE__,_("User name too long to manufacture file name "));
                debuga_more("%s/%s/%s\n",outdirname,uinfo->filename,pdata->pngfile);
                exit(EXIT_FAILURE);
        }
        if((pngout=fopen(graph,"wb"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),graph,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),graph,strerror(errno));
                exit(EXIT_FAILURE);
        }
        gdImagePng(gdata.im, pngout);
        if (fclose(pngout)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),graph,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),graph,strerror(errno));
        }
        gdImageDestroy(gdata.im);
 
@@ -635,24 +635,24 @@ void greport_prepare(void)
 #ifdef HAVE_GD
        if (!Graphs) {
                if (debugz>=LogLevel_Process)
-                       debugaz(_("Graphs disabled as requested in %s\n"),ConfigFile);
+                       debugaz(__FILE__,__LINE__,_("Graphs disabled as requested in %s\n"),ConfigFile);
                return;
        }
        if (GraphFont[0]=='\0') {
                if (debugz>=LogLevel_Process)
-                       debugaz(_("Graphs disabled as no font names were provided in %s\n"),ConfigFile);
+                       debugaz(__FILE__,__LINE__,_("Graphs disabled as no font names were provided in %s\n"),ConfigFile);
                return;
        }
 
        if(access(GraphFont, R_OK) != 0) {
-               debuga(_("Font name %s not found\n"),GraphFont);
+               debuga(__FILE__,__LINE__,_("Font name %s not found\n"),GraphFont);
                exit(EXIT_FAILURE);
        }
 
 #ifdef USE_ICONV
        localtoutf = iconv_open ("UTF-8", CharSet);
        if (localtoutf==(iconv_t)-1) {
-               debuga(_("iconv cannot convert from %s to UTF-8: %s\n"),CharSet,strerror(errno));
+               debuga(__FILE__,__LINE__,_("iconv cannot convert from %s to UTF-8: %s\n"),CharSet,strerror(errno));
        }
 #endif
 
@@ -677,7 +677,7 @@ void greport_day(const struct userinfostruct *uinfo)
        if (datetimeby==0) return;
        if (!Graphs || GraphFont[0]=='\0') return;
        if (snprintf(wdirname,sizeof(wdirname),"%s/%s.day",tmp,uinfo->filename)>=sizeof(wdirname)) {
-               debuga(_("User name too long to manufacture file name "));
+               debuga(__FILE__,__LINE__,_("User name too long to manufacture file name "));
                debuga_more("%s/%s.day\n",tmp,uinfo->filename);
                exit(EXIT_FAILURE);
        }
@@ -686,7 +686,7 @@ void greport_day(const struct userinfostruct *uinfo)
        }
 
        if((fp_in=fopen(wdirname,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -696,42 +696,42 @@ void greport_day(const struct userinfostruct *uinfo)
                fixendofline(buf);
                getword_start(&gwarea,buf);
                if (getword_atoll(&llday,&gwarea,'/')<0) {
-                       debuga(_("Invalid date in file \"%s\"\n"),wdirname);
+                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),wdirname);
                        exit(EXIT_FAILURE);
                }
                day=(int)llday;
                if (day<1 || day>31) continue;
                if (getword_skip(20,&gwarea,'\t')<0 || getword_skip(20,&gwarea,'\t')<0) {
-                       debuga(_("Invalid entry in file \"%s\"\n"),wdirname);
+                       debuga(__FILE__,__LINE__,_("Invalid entry in file \"%s\"\n"),wdirname);
                        exit(EXIT_FAILURE);
                }
                if ((datetimeby & DATETIME_BYTE)!=0) {
                        if (getword_atoll(&bytes,&gwarea,'\t')<0) {
-                               debuga(_("Invalid number of bytes in file \"%s\"\n"),wdirname);
+                               debuga(__FILE__,__LINE__,_("Invalid number of bytes in file \"%s\"\n"),wdirname);
                                exit(EXIT_FAILURE);
                        }
                        bytespoints[day-1]+=bytes;
                }
                if ((datetimeby & DATETIME_ELAP)!=0) {
                        if (getword_atoll(&elap,&gwarea,'\0')<0) {
-                               debuga(_("Invalid elapsed time in file \"%s\"\n"),wdirname);
+                               debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),wdirname);
                                exit(EXIT_FAILURE);
                        }
                        elappoints[day-1]+=elap;
                }
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (snprintf(wdirname,sizeof(wdirname),"%s/%s/graph.html",outdirname,uinfo->filename)>=sizeof(wdirname)) {
-               debuga(_("User name too long to manufacture file name "));
+               debuga(__FILE__,__LINE__,_("User name too long to manufacture file name "));
                debuga_more("%s/%s/%s\n",outdirname,uinfo->filename,"graph.html");
                exit(EXIT_FAILURE);
        }
        if ((fp_ou=fopen(wdirname,"wt"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
        write_html_head(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 4 : 2,_("Graph report"),HTML_JS_NONE);
@@ -767,7 +767,7 @@ void greport_day(const struct userinfostruct *uinfo)
 
        write_html_trailer(fp_ou);
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 #endif //HAVE_GD
diff --git a/html.c b/html.c
index 4a2a39e1ee064e8af13b398c77ea2432a7b3969f..2d78fac514d503c39b4c5ed72a639958c700e416 100644 (file)
--- a/html.c
+++ b/html.c
@@ -70,13 +70,13 @@ void htmlrel(void)
        userscan uscan;
 
        if (snprintf(tmp2,sizeof(tmp2),"%s/sargtmp.int_unsort",tmp)>=sizeof(tmp2)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/sargtmp.int_unsort\n",tmp);
                exit(EXIT_FAILURE);
        }
 
        if (snprintf(tmp3,sizeof(tmp3),"%s/sargtmp.int_log",tmp)>=sizeof(tmp3)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/sargtmp.int_log\n",tmp);
                exit(EXIT_FAILURE);
        }
@@ -94,12 +94,12 @@ void htmlrel(void)
                        for (i=0 ; i<PerUserLimitsNumber ; i++) {
                                FILE *fp_usr=fopen(PerUserLimits[i].File,"wt");
                                if (fp_usr==NULL) {
-                                       debuga(_("Cannot create empty per_user_limit file \"%s\": %s\n"),PerUserLimits[i].File,
+                                       debuga(__FILE__,__LINE__,_("Cannot create empty per_user_limit file \"%s\": %s\n"),PerUserLimits[i].File,
                                                   strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
                                if (fclose(fp_usr)==EOF) {
-                                       debuga(_("Write error in \"%s\": %s\n"),PerUserLimits[i].File,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),PerUserLimits[i].File,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
                        }
@@ -108,7 +108,7 @@ void htmlrel(void)
                case PUFC_AsRequired:
                        for (i=0 ; i<PerUserLimitsNumber ; i++) {
                                if (access(PerUserLimits[i].File,R_OK)==0 && unlink(PerUserLimits[i].File)==-1) {
-                                       debuga(_("Cannot delete \"%s\": %s\n"),PerUserLimits[i].File,
+                                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),PerUserLimits[i].File,
                                                   strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
@@ -118,12 +118,12 @@ void htmlrel(void)
 
        uscan=userinfo_startscan();
        if (uscan == NULL) {
-               debuga(_("Cannot enumerate the user list\n"));
+               debuga(__FILE__,__LINE__,_("Cannot enumerate the user list\n"));
                exit(EXIT_FAILURE);
        }
        while ( (uinfo = userinfo_advancescan(uscan)) != NULL ) {
                if (snprintf(warea,sizeof(warea),"%s/%s",outdirname,uinfo->filename)>=sizeof(warea)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/%s\n",outdirname,uinfo->filename);
                        exit(EXIT_FAILURE);
                }
@@ -135,29 +135,29 @@ void htmlrel(void)
 
                if (access(warea, R_OK) != 0) {
                        if (PortableMkDir(warea,0755)) {
-                               debuga(_("Cannot create directory \"%s\": %s\n"),warea,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot create directory \"%s\": %s\n"),warea,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                }
                tmpsort(uinfo);
 
                if (snprintf(arqin,sizeof(arqin),"%s/htmlrel.txt",tmp)>=sizeof(arqin)) {
-                       debuga(_("Input file name too long: %s/htmlrel.txt\n"),tmp);
+                       debuga(__FILE__,__LINE__,_("Input file name too long: %s/htmlrel.txt\n"),tmp);
                        exit(EXIT_FAILURE);
                }
                if ((fp_in = fopen(arqin, "r")) == 0){
                        if (uinfo->no_report) continue;
-                       debuga(_("Cannot open file \"%s\": %s\n"),arqin,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),arqin,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 
                if (snprintf(arqou,sizeof(arqou),"%s/%s/%s.html",outdirname,uinfo->filename,uinfo->filename)>=sizeof(arqou)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/%s/%s.html\n",outdirname,uinfo->filename,uinfo->filename);
                        exit(EXIT_FAILURE);
                }
                if (snprintf(duser,sizeof(duser),"%s/denied_%s.html",outdirname,uinfo->filename)>=sizeof(duser)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/denied_%s.html\n",outdirname,uinfo->filename);
                        exit(EXIT_FAILURE);
                }
@@ -167,7 +167,7 @@ void htmlrel(void)
                        have_denied_report=true;
 
                if ((line=longline_create())==NULL) {
-                       debuga(_("Not enough memory to read file \"%s\"\n"),arqin);
+                       debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),arqin);
                        exit(EXIT_FAILURE);
                }
 
@@ -182,35 +182,35 @@ void htmlrel(void)
                while((buf=longline_read(fp_in,line))!=NULL) {
                        getword_start(&gwarea,buf);
                        if (getword_atoll(&ltemp,&gwarea,'\t')<0) {
-                               debuga(_("Invalid number of accesses in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid number of accesses in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        tnacc+=ltemp;
                        if (getword_atoll(&ltemp,&gwarea,'\t')<0) {
-                               debuga(_("Invalid downloaded size in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid downloaded size in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        tnbytes+=ltemp;
                        if (getword_ptr(NULL,NULL,&gwarea,'\t')<0) {
-                               debuga(_("Invalid url in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_skip(MAXLEN,&gwarea,'\t')<0) {
-                               debuga(_("Invalid access code in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid access code in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_atoll(&ltemp,&gwarea,'\t')<0) {
-                               debuga(_("Invalid elapsed time in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        tnelap+=ltemp;
                        if (getword_atoll(&ltemp,&gwarea,'\t')<0) {
-                               debuga(_("Invalid in-cache size in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid in-cache size in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        tnincache+=ltemp;
                        if (getword_atoll(&ltemp,&gwarea,'\n')<0) {
-                               debuga(_("Invalid out-of-cache size in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid out-of-cache size in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        tnoucache+=ltemp;
@@ -219,7 +219,7 @@ void htmlrel(void)
                rewind(fp_in);
 
                if ((fp_ou = fopen(arqou, "w")) == 0){
-                       debuga(_("Cannot open file \"%s\": %s\n"),arqou,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),arqou,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 
@@ -264,7 +264,7 @@ void htmlrel(void)
                fputs("</tr></thead>\n",fp_ou);
 
                if(debug) {
-                       debuga(_("Making report %s\n"),uinfo->id);
+                       debuga(__FILE__,__LINE__,_("Making report %s\n"),uinfo->id);
                }
                count=0;
                arqip[0]='\0';
@@ -272,31 +272,31 @@ void htmlrel(void)
                while((buf=longline_read(fp_in,line))!=NULL) {
                        getword_start(&gwarea,buf);
                        if (getword_atoll(&twork,&gwarea,'\t')<0) {
-                               debuga(_("Invalid number of accesses in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid number of accesses in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_atoll(&nnbytes,&gwarea,'\t')<0) {
-                               debuga(_("Invalid number of bytes in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid number of bytes in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
-                               debuga(_("Invalid url in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        if (getword(tmsg,sizeof(tmsg),&gwarea,'\t')<0) {
-                               debuga(_("Invalid access code in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid access code in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_atoll(&nnelap,&gwarea,'\t')<0) {
-                               debuga(_("Invalid elapsed time in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_atoll(&incache,&gwarea,'\t')<0) {
-                               debuga(_("Invalid in-cache size in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid in-cache size in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_atoll(&oucache,&gwarea,'\n')<0) {
-                               debuga(_("Invalid out-of-cache size in file \"%s\"\n"),arqin);
+                               debuga(__FILE__,__LINE__,_("Invalid out-of-cache size in file \"%s\"\n"),arqin);
                                exit(EXIT_FAILURE);
                        }
 
@@ -370,56 +370,56 @@ void htmlrel(void)
                        } else if ((ReportType & REPORT_TYPE_SITE_USER_TIME_DATE) != 0) {
                                snprintf(warea,sizeof(warea),"%s/%s/tt.html",outdirname,uinfo->filename);
                                if (unlink(warea)!=0) {
-                                       debuga(_("Cannot delete \"%s\": %s\n"),warea,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),warea,strerror(errno));
                                }
                        }
 
                        if(iprel) {
                                if (snprintf(arqip,sizeof(arqip),"%s/%s.ip",tmp,uinfo->filename)>=sizeof(arqip)) {
-                                       debuga(_("Path too long: "));
+                                       debuga(__FILE__,__LINE__,_("Path too long: "));
                                        debuga_more("%s/%s.ip\n",tmp,uinfo->filename);
                                        exit(EXIT_FAILURE);
                                }
 
                                if ((fp_ip = fopen(arqip, "r")) == 0){
-                                       debuga(_("Cannot open file \"%s\": %s\n"),arqip,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),arqip,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
 
                                if ((fp_ip2 = MY_FOPEN(tmp2, "a")) == 0){
-                                       debuga(_("Cannot open file \"%s\": %s\n"),tmp2,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp2,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
 
                                if ((line1=longline_create())==NULL) {
-                                       debuga(_("Not enough memory to read file \"%s\"\n"),arqip);
+                                       debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),arqip);
                                        exit(EXIT_FAILURE);
                                }
                                while((buf=longline_read(fp_ip,line1))!=NULL) {
                                        getword_start(&gwarea,buf);
                                        if (getword(user_ip,sizeof(user_ip),&gwarea,'\t')<0) {
-                                               debuga(_("Invalid user IP in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid user IP in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        if (getword_ptr(buf,&user_url,&gwarea,'\t')<0) {
-                                               debuga(_("Invalid url in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        if (strncmp(user_url,url,strlen(url))!=0) continue;
                                        if (getword_skip(15,&gwarea,'\t')<0) {
-                                               debuga(_("Invalid day in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid day in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        if (getword_skip(15,&gwarea,'\t')<0) {
-                                               debuga(_("Invalid time in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid time in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        if (getword_atoll(&userbytes,&gwarea,'\t')<0) {
-                                               debuga(_("Invalid size in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid size in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        if (getword_atoll(&userelap,&gwarea,'\0')<0) {
-                                               debuga(_("Invalid elapsed time in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        fprintf(fp_ip2,"%s\t%"PRIu64"\t%"PRIu64"\n",user_ip,(uint64_t)userbytes,(uint64_t)userelap);
@@ -427,53 +427,53 @@ void htmlrel(void)
                                longline_destroy(&line1);
 
                                if (fclose(fp_ip2)==EOF) {
-                                       debuga(_("Write error in \"%s\": %s\n"),tmp2,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),tmp2,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
                                if (fclose(fp_ip)==EOF) {
-                                       debuga(_("Read error in \"%s\": %s\n"),arqip,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),arqip,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
 
                                if (snprintf(csort,sizeof(csort),"sort -n -t \"\t\" -T \"%s\" -k 1,1 -k 2,2 -o \"%s\" \"%s\"",tmp,tmp3,tmp2)>=sizeof(csort)) {
-                                       debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
+                                       debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
                                        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_ip = MY_FOPEN(tmp3, "r")) == 0) {
-                                       debuga(_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
 
                                if (unlink(tmp2)) {
-                                       debuga(_("Cannot delete \"%s\": %s\n"),tmp2,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp2,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
 
                                olduserip[0]='\0';
 
                                if ((line1=longline_create())==NULL) {
-                                       debuga(_("Not enough memory to read file \"%s\"\n"),arqip);
+                                       debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),arqip);
                                        exit(EXIT_FAILURE);
                                }
                                while((buf=longline_read(fp_ip,line1))!=NULL) {
                                        getword_start(&gwarea,buf);
                                        if (getword(user_ip,sizeof(user_ip),&gwarea,'\t')<0) {
-                                               debuga(_("Invalid user IP in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid user IP in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        if (getword_atoll(&userbytes,&gwarea,'\t')<0) {
-                                               debuga(_("Invalid size in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid size in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        if (getword_atoll(&userelap,&gwarea,'\0')<0) {
-                                               debuga(_("Invalid elapsed time in file \"%s\"\n"),tmp3);
+                                               debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),tmp3);
                                                exit(EXIT_FAILURE);
                                        }
                                        if(strcmp(user_ip,olduserip) != 0) {
@@ -504,13 +504,13 @@ void htmlrel(void)
                                }
 
                                if (fclose(fp_ip)==EOF) {
-                                       debuga(_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
                                longline_destroy(&line1);
 
                                if (unlink(tmp3)) {
-                                       debuga(_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
 
@@ -537,19 +537,19 @@ void htmlrel(void)
                }
 
                if (fclose(fp_in)==EOF) {
-                       debuga(_("Read error in \"%s\": %s\n"),arqin,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),arqin,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                longline_destroy(&line);
 
                if (iprel && arqip[0]) {
                        if (!KeepTempLog && unlink(arqip)) {
-                               debuga(_("Cannot delete \"%s\": %s\n"),arqip,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),arqip,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                }
                if (!KeepTempLog && unlink(arqin)) {
-                       debuga(_("Cannot delete \"%s\": %s\n"),arqin,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),arqin,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 
@@ -593,7 +593,7 @@ void htmlrel(void)
                                        FILE *fp_usr;
 
                                        if((fp_usr = fopen(PerUserLimits[i].File, "at")) == 0) {
-                                               debuga(_("Cannot open file \"%s\": %s\n"),PerUserLimits[i].File,strerror(errno));
+                                               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),PerUserLimits[i].File,strerror(errno));
                                                exit(EXIT_FAILURE);
                                        }
                                        switch (PerUserLimits[i].Output)
@@ -606,13 +606,13 @@ void htmlrel(void)
                                                        break;
                                        }
                                        if (fclose(fp_usr)==EOF) {
-                                               debuga(_("Write error in \"%s\": %s\n"),PerUserLimits[i].File,strerror(errno));
+                                               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),PerUserLimits[i].File,strerror(errno));
                                                exit(EXIT_FAILURE);
                                        }
                                        user_limit[maskid]|=mask;
 
                                        if(debug)
-                                               debuga(_("Limit exceeded for user %s (%d MB). Added to file \"%s\"\n"),uinfo->label,
+                                               debuga(__FILE__,__LINE__,_("Limit exceeded for user %s (%d MB). Added to file \"%s\"\n"),uinfo->label,
                                                           PerUserLimits[i].Limit,PerUserLimits[i].File);
                                }
                        }
@@ -645,7 +645,7 @@ void htmlrel(void)
                fputs("</table></div>\n",fp_ou);
                write_html_trailer(fp_ou);
                if (fclose(fp_ou)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),arqou,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),arqou,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 
index cd181e66db093389b32fbd83a8770c85f74ae511..369b56aed8440a12c69f34141dc7882ac8838d07 100644 (file)
@@ -374,9 +374,9 @@ void write_html_trailer(FILE *fp_ou);
 void output_html_string(FILE *fp_ou,const char *str,int maxlen);
 void output_html_url(FILE *fp_ou,const char *url);
 void output_html_link(FILE *fp_ou,const char *url,int maxlen);
-void debuga(const char *msg,...) __attribute__((format(printf,1,2)));
+void debuga(const char *File, int Line, const char *msg,...) __attribute__((format(printf,3,4)));
 void debuga_more(const char *msg,...) __attribute__((format(printf,1,2)));
-void debugaz(const char *msg,...) __attribute__((format(printf,1,2)));
+void debugaz(const char *File,int Line,const char *msg,...) __attribute__((format(printf,3,4)));
 void my_lltoa(unsigned long long int n, char *s, int ssize, int len);
 void url_module(const char *url, char *w2);
 void url_to_anchor(const char *url,char *anchor,int size);
diff --git a/index.c b/index.c
index e08826e45589e39246be35a148786293741ac2e6..d7ba1e72796be783d6021de64091cd9c9d7af89f 100644 (file)
--- a/index.c
+++ b/index.c
@@ -51,7 +51,7 @@ void make_index(void)
                sprintf(wdir,"%s"INDEX_HTML_FILE,outdir);
                if(access(wdir, R_OK) == 0) {
                        if (unlink(wdir)) {
-                               debuga(_("Cannot delete \"%s\": %s\n"),wdir,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),wdir,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                }
@@ -60,12 +60,12 @@ void make_index(void)
 
        if(debug) {
                // TRANSLATORS: The %s is the name of the html index file (index.html).
-               debuga(_("Making %s\n"),INDEX_HTML_FILE);
+               debuga(__FILE__,__LINE__,_("Making %s\n"),INDEX_HTML_FILE);
        }
 
        // convert any old report hierarchy
        if ((dirp = opendir(outdir)) == NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),outdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),outdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        while ((direntp = readdir( dirp )) != NULL) {
@@ -148,12 +148,12 @@ static long long int get_size(char *path,int path_size)
 
        path_len=strlen(path);
        if (path_len+2>=path_size) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s\n",path);
                exit(EXIT_FAILURE);
        }
        if ((dirp=opendir(path))==NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),path,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),path,strerror(errno));
                exit(EXIT_FAILURE);
        }
        path[path_len++]='/';
@@ -161,13 +161,13 @@ static long long int get_size(char *path,int path_size)
                if (direntp->d_name[0]=='.' && (direntp->d_name[1]=='\0' || (direntp->d_name[1]=='.' && direntp->d_name[2]=='\0'))) continue;
                name_len=strlen(direntp->d_name);
                if (path_len+name_len+1>=path_size) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s%s\n",path,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
                strcpy(path+path_len,direntp->d_name);
                if (MY_LSTAT(path,&statb) == -1) {
-                       debuga(_("Failed to get the statistics of file \"%s\": %s\n"),path,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to get the statistics of file \"%s\": %s\n"),path,strerror(errno));
                        continue;
                }
                if (S_ISDIR(statb.st_mode))
@@ -179,7 +179,7 @@ static long long int get_size(char *path,int path_size)
                                dir_allocated+=size;
                                dir_list=realloc(dir_list,dir_allocated);
                                if (!dir_list) {
-                                       debuga(_("Not enough memory to recurse into subdirectory \"%s\"\n"),path);
+                                       debuga(__FILE__,__LINE__,_("Not enough memory to recurse into subdirectory \"%s\"\n"),path);
                                        exit(EXIT_FAILURE);
                                }
                        }
@@ -246,12 +246,12 @@ static long long int make_date_index_day(char *monthdir,int monthdir_size,int or
 
        ndays=0;
        if ((dirp3 = opendir(monthdir)) == NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),monthdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),monthdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        monthdir_len=strlen(monthdir);
        if (monthdir_len+strlen(INDEX_HTML_FILE)+2>=monthdir_size) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s\n",monthdir,INDEX_HTML_FILE);
                exit(EXIT_FAILURE);
        }
@@ -260,13 +260,13 @@ static long long int make_date_index_day(char *monthdir,int monthdir_size,int or
                if (direntp->d_name[0]=='.' && (direntp->d_name[1]=='\0' || (direntp->d_name[1]=='.' && direntp->d_name[2]=='\0'))) continue;
                name_len=strlen(direntp->d_name);
                if (monthdir_len+name_len+1>=monthdir_size) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s%s\n",monthdir,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
                strcpy(monthdir+monthdir_len,direntp->d_name);
                if (MY_LSTAT(monthdir,&statb) == -1) {
-                       debuga(_("Failed to get the statistics of file \"%s\": %s\n"),monthdir,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to get the statistics of file \"%s\": %s\n"),monthdir,strerror(errno));
                        continue;
                }
                if (S_ISDIR(statb.st_mode))
@@ -282,7 +282,7 @@ static long long int make_date_index_day(char *monthdir,int monthdir_size,int or
                                d2=0;
                        }
                        if (ndays>=sizeof(daysort)/sizeof(daysort[0])) {
-                               debuga(_("Too many day directories in %s\nSupernumerary entries are ignored\n"),monthdir);
+                               debuga(__FILE__,__LINE__,_("Too many day directories in %s\nSupernumerary entries are ignored\n"),monthdir);
                                break;
                        }
                        day=(d1 << 5) | d2;
@@ -302,7 +302,7 @@ static long long int make_date_index_day(char *monthdir,int monthdir_size,int or
 
        strcpy(monthdir+monthdir_len,INDEX_HTML_FILE);
        if((fp_ou=fopen(monthdir,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),monthdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),monthdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        snprintf(title,sizeof(title),ngettext("SARG: report for %s/%s","SARG: reports for %s/%s",ndays),yearnum,monthnum);
@@ -345,7 +345,7 @@ static long long int make_date_index_day(char *monthdir,int monthdir_size,int or
        write_html_trailer(fp_ou);
        if (fclose(fp_ou)==EOF) {
                strcpy(monthdir+monthdir_len,INDEX_HTML_FILE);
-               debuga(_("Write error in \"%s\": %s\n"),monthdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),monthdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return(total_size);
@@ -364,7 +364,7 @@ static void name_month(int month,char *month_name,int month_size)
                                           N_("August"),N_("September"),N_("October"),N_("November"),N_("December")};
 
        if (month<1 || month>12) {
-               debuga(_("The internal list of month names is invalid. Please report this bug to the translator.\n"));
+               debuga(__FILE__,__LINE__,_("The internal list of month names is invalid. Please report this bug to the translator.\n"));
                exit(EXIT_FAILURE);
        }
        strncpy(month_name,_(m[month-1]),month_size-1);
@@ -406,12 +406,12 @@ static long long int make_date_index_month(char *yeardir,int yeardir_size,int or
 
        nmonths=0;
        if ((dirp2 = opendir(yeardir)) == NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),yeardir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),yeardir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        yeardir_len=strlen(yeardir);
        if (yeardir_len+strlen(INDEX_HTML_FILE)+2>=yeardir_size) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s\n",yeardir,INDEX_HTML_FILE);
                exit(EXIT_FAILURE);
        }
@@ -420,13 +420,13 @@ static long long int make_date_index_month(char *yeardir,int yeardir_size,int or
                if (direntp->d_name[0]=='.' && (direntp->d_name[1]=='\0' || (direntp->d_name[1]=='.' && direntp->d_name[2]=='\0'))) continue;
                name_len=strlen(direntp->d_name);
                if (yeardir_len+name_len+1>=yeardir_size) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s%s\n",yeardir,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
                strcpy(yeardir+yeardir_len,direntp->d_name);
                if (MY_LSTAT(yeardir,&statb) == -1) {
-                       debuga(_("Failed to get the statistics of file \"%s\": %s\n"),yeardir,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to get the statistics of file \"%s\": %s\n"),yeardir,strerror(errno));
                        continue;
                }
                if (S_ISDIR(statb.st_mode))
@@ -442,7 +442,7 @@ static long long int make_date_index_month(char *yeardir,int yeardir_size,int or
                                m2=0;
                        }
                        if (nmonths>=sizeof(monthsort)/sizeof(monthsort[0])) {
-                               debuga(_("Too many month directories in %s\nSupernumerary entries are ignored\n"),yeardir);
+                               debuga(__FILE__,__LINE__,_("Too many month directories in %s\nSupernumerary entries are ignored\n"),yeardir);
                                break;
                        }
                        month=(m1<<4) | m2;
@@ -462,7 +462,7 @@ static long long int make_date_index_month(char *yeardir,int yeardir_size,int or
 
        strcpy(yeardir+yeardir_len,INDEX_HTML_FILE);
        if((fp_ou=fopen(yeardir,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),yeardir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),yeardir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        snprintf(title,sizeof(title),ngettext("SARG: report for %s","SARG: reports for %s",nmonths),yearnum);
@@ -491,7 +491,7 @@ static long long int make_date_index_month(char *yeardir,int yeardir_size,int or
                }
                if (yeardir_len+strlen(monthnum)+1>=yeardir_size) {
                        yeardir[yeardir_len]='\0';
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s%s\n",yeardir,monthnum);
                        exit(EXIT_FAILURE);
                }
@@ -515,7 +515,7 @@ static long long int make_date_index_month(char *yeardir,int yeardir_size,int or
        write_html_trailer(fp_ou);
        if (fclose(fp_ou)==EOF) {
                strcpy(yeardir+yeardir_len,INDEX_HTML_FILE);
-               debuga(_("Write error in \"%s\": %s\n"),yeardir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),yeardir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return(total_size);
@@ -542,7 +542,7 @@ static void make_date_index(void)
 
        nyears=0;
        if ((dirp = opendir(outdir)) == NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),outdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),outdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        while ((direntp = readdir( dirp )) != NULL) {
@@ -584,11 +584,11 @@ static void make_date_index(void)
        order=(strcmp(IndexSortOrder,"A") == 0) ? 1 : -1;
 
        if (snprintf(yearindex,sizeof(yearindex),"%s"INDEX_HTML_FILE,outdir)>=sizeof(yearindex)) {
-               debuga(_("Resulting index file name too long. File name is \"%s/%s\""),outdir,INDEX_HTML_FILE);
+               debuga(__FILE__,__LINE__,_("Resulting index file name too long. File name is \"%s/%s\""),outdir,INDEX_HTML_FILE);
                exit(EXIT_FAILURE);
        }
        if((fp_ou=fopen(yearindex,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),yearindex,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),yearindex,strerror(errno));
                exit(EXIT_FAILURE);
        }
        write_html_header(fp_ou,0,ngettext("SARG report","SARG reports",nyears),HTML_JS_NONE);
@@ -601,7 +601,7 @@ static void make_date_index(void)
 
        yeardirlen=strlen(outdir);
        if (yeardirlen>=sizeof(yeardir)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s",outdir);
                exit(EXIT_FAILURE);
        }
@@ -634,7 +634,7 @@ static void make_date_index(void)
        fputs("</table></div>\n",fp_ou);
        write_html_trailer(fp_ou);
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),yearindex,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),yearindex,strerror(errno));
                exit(EXIT_FAILURE);
        }
 }
@@ -671,7 +671,7 @@ static void make_file_index(void)
        order=(strcmp(IndexSortOrder,"A") == 0) ? 1 : -1;
 
        if ((dirp = opendir(outdir)) == NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),outdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),outdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -681,12 +681,12 @@ static void make_file_index(void)
        while ((direntp = readdir( dirp )) != NULL) {
                if (strchr(direntp->d_name,'-') == 0) continue;
                if (obtdate(outdir,direntp->d_name,data)<0) {
-                       debuga(_("The directory \"%s%s\" looks like a report directory but doesn't contain a sarg-date file. You should delete it\n"),outdir,direntp->d_name);
+                       debuga(__FILE__,__LINE__,_("The directory \"%s%s\" looks like a report directory but doesn't contain a sarg-date file. You should delete it\n"),outdir,direntp->d_name);
                        continue;
                }
                item=malloc(sizeof(*item));
                if (!item) {
-                       debuga(_("not enough memory to sort the index\n"));
+                       debuga(__FILE__,__LINE__,_("not enough memory to sort the index\n"));
                        exit(EXIT_FAILURE);
                }
                if (df=='u') {
@@ -708,29 +708,29 @@ static void make_file_index(void)
                        */
                        getword_start(&gwarea,data);
                        if (getword_skip(16,&gwarea,' ')<0) {
-                               debuga(_("Invalid date in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
+                               debuga(__FILE__,__LINE__,_("Invalid date in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_multisep(mon,sizeof(mon),&gwarea,' ')<0) {
-                               debuga(_("Invalid date in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
+                               debuga(__FILE__,__LINE__,_("Invalid date in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_multisep(day,sizeof(day),&gwarea,' ')<0) {
-                               debuga(_("Invalid date in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
+                               debuga(__FILE__,__LINE__,_("Invalid date in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_multisep(hour,sizeof(hour),&gwarea,' ')<0) {
-                               debuga(_("Invalid time in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
+                               debuga(__FILE__,__LINE__,_("Invalid time in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
                                exit(EXIT_FAILURE);
                        }
                        do {
                                if (getword_multisep(year,sizeof(year),&gwarea,' ')<0) {
-                                       debuga(_("Invalid date in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
+                                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
                                        exit(EXIT_FAILURE);
                                }
                        } while (year[0] && !isdigit(year[0])); //skip time zone information with spaces until the year is found
                        if (sscanf(hour,"%d:%d:%d",&ihour,&iminute,&isecond)!=3) {
-                               debuga(_("Invalid time in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
+                               debuga(__FILE__,__LINE__,_("Invalid time in file \"%s%s/sarg-date\"\n"),outdir,direntp->d_name);
                                exit(EXIT_FAILURE);
                        }
                        buildymd(day,mon,year,ftime,sizeof(ftime));
@@ -738,7 +738,7 @@ static void make_file_index(void)
                }
                item->dirname=strdup(direntp->d_name);
                if (!item->dirname) {
-                       debuga(_("Not enough memory to store the directory name \"%s\" in the index\n"),direntp->d_name);
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the directory name \"%s\" in the index\n"),direntp->d_name);
                        exit(EXIT_FAILURE);
                }
                safe_strcpy(item->date,data,sizeof(item->date));
@@ -746,7 +746,7 @@ static void make_file_index(void)
                        nallocated+=10;
                        tempsort=realloc(sortlist,nallocated*sizeof(*item));
                        if (!tempsort) {
-                               debuga(_("not enough memory to sort the index\n"));
+                               debuga(__FILE__,__LINE__,_("not enough memory to sort the index\n"));
                                exit(EXIT_FAILURE);
                        }
                        sortlist=tempsort;
@@ -765,7 +765,7 @@ static void make_file_index(void)
        closedir( dirp );
 
        if((fp_ou=fopen(wdir,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),wdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        write_html_header(fp_ou,0,ngettext("SARG report","SARG reports",nsort),HTML_JS_SORTTABLE);
@@ -799,7 +799,7 @@ static void make_file_index(void)
        fputs("</table></div>\n",fp_ou);
        write_html_trailer(fp_ou);
        if (fclose(fp_ou)==EOF)
-               debuga(_("Write error in \"%s\": %s\n"),wdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),wdir,strerror(errno));
 
        if (sortlist) {
                for (i=0 ; i<nsort ; i++) {
@@ -884,7 +884,7 @@ static void file_index_to_date_index(const char *entry)
        ndirlen=sprintf(newdir,"%s%04d",outdir,y1);
        if (access(newdir, R_OK) != 0) {
                if (PortableMkDir(newdir,0755)) {
-                       debuga(_("Cannot create directory \"%s\": %s\n"),newdir,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot create directory \"%s\": %s\n"),newdir,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
@@ -892,7 +892,7 @@ static void file_index_to_date_index(const char *entry)
        else ndirlen+=sprintf(newdir+ndirlen,"/%02d",m1);
        if (access(newdir, R_OK) != 0) {
                if (PortableMkDir(newdir,0755)) {
-                       debuga(_("Cannot create directory \"%s\": %s\n"),newdir,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot create directory \"%s\": %s\n"),newdir,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
@@ -902,7 +902,7 @@ static void file_index_to_date_index(const char *entry)
 
        sprintf(olddir,"%s%s",outdir,entry);
        if (rename(olddir,newdir)) {
-               debuga(_("Error renaming \"%s\" to \"%s\": %s\n"),olddir,newdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Error renaming \"%s\" to \"%s\": %s\n"),olddir,newdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -913,7 +913,7 @@ static void file_index_to_date_index(const char *entry)
 
                sprintf(linkdir,"%simages",outdir);
                if (symlink(linkdir,newdir)) {
-                       debuga(_("Failed to create link \"%s\" to \"%s\": %s\n"),linkdir,newdir,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to create link \"%s\" to \"%s\": %s\n"),linkdir,newdir,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 #else
@@ -923,8 +923,8 @@ static void file_index_to_date_index(const char *entry)
                sprintf(cmd,"ln -s \"%simages\" \"%s/images\"",outdir,newdir);
                cstatus=system(cmd);
                if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
-                       debuga(_("command return status %d\n"),WEXITSTATUS(cstatus));
-                       debuga(_("command: %s\n"),cmd);
+                       debuga(__FILE__,__LINE__,_("command return status %d\n"),WEXITSTATUS(cstatus));
+                       debuga(__FILE__,__LINE__,_("command: %s\n"),cmd);
                        exit(EXIT_FAILURE);
                }
 #endif
@@ -1004,7 +1004,7 @@ static void date_index_to_file_index(const char *entry)
                        else continue;
                        sprintf(olddir,"%s%04d/%s/%s",outdir,y1,direntp2->d_name,direntp3->d_name);
                        if(rename(olddir,newdir)) {
-                               debuga(_("Error renaming \"%s\" to \"%s\": %s\n"),olddir,newdir,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Error renaming \"%s\" to \"%s\": %s\n"),olddir,newdir,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                }
index 52f459b3d9dddfb8869d4f71f26e10e2afbfadaa..b6d44bb00915f0f977b5b202f90110ff247be5b7 100644 (file)
@@ -35,7 +35,7 @@ void index_only(const char *dirname,int debug)
        char remove[MAXLEN];
 
        if ((dirp = opendir(dirname)) == NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),dirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),dirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
        while ( (direntp = readdir( dirp )) != NULL ){
@@ -43,11 +43,11 @@ void index_only(const char *dirname,int debug)
                        continue;
 
                if (snprintf(remove,sizeof(remove),"%s/%s",dirname,direntp->d_name)>=sizeof(remove)) {
-                       debuga(_("Name of the file to remove is too long. File name is \"%s/%s\"\n"),dirname,direntp->d_name);
+                       debuga(__FILE__,__LINE__,_("Name of the file to remove is too long. File name is \"%s/%s\"\n"),dirname,direntp->d_name);
                        continue;
                }
                if (unlink(remove) == -1) {
-                       debuga(_("Cannot delete \"%s\": %s\n"),remove,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),remove,strerror(errno));
                }
        }
 
index 48bf8062c289556f4714924681acf1aab8d87057..d30f3f787d73c798a3a87b76d7f0bcbeaedda227 100644 (file)
--- a/ip2name.c
+++ b/ip2name.c
@@ -63,12 +63,12 @@ static void ip2name_chainmodule(struct Ip2NameProcess *Module)
        struct Ip2NameProcess *Chain;
        struct Ip2NameProcess *Last;
 
-       if (debug) debuga(_("Chaining IP resolving module \"%s\"\n"),Module->Name);
+       if (debug) debuga(__FILE__,__LINE__,_("Chaining IP resolving module \"%s\"\n"),Module->Name);
 
        Last=NULL;
        for (Chain=FirstModule ; Chain ; Chain=Chain->Next) {
                if (Chain==Module) {
-                       debuga(_("Ignoring duplicate module \"%s\" to resolve an IP address\n"),Module->Name);
+                       debuga(__FILE__,__LINE__,_("Ignoring duplicate module \"%s\" to resolve an IP address\n"),Module->Name);
                        return;
                }
                Last=Chain;
@@ -106,7 +106,7 @@ static void ip2name_buildmoduleslist(const char *list)
                        }
                }
                if (ModuleIdx>=sizeof(ModulesList)/sizeof(*ModulesList)) {
-                       debuga(_("Unknown module \"%.*s\" to resolve the IP addresses\n"),length,candidate);
+                       debuga(__FILE__,__LINE__,_("Unknown module \"%.*s\" to resolve the IP addresses\n"),length,candidate);
                        exit(EXIT_FAILURE);
                }
                list=candidate+length;
@@ -130,7 +130,7 @@ static void ip2name_configmodule(const char *module)
                        // module found
                        if (ModulesList[ModuleIdx].Process) {
                                if (!ModulesList[ModuleIdx].Process->Configure) {
-                                       debuga(_("No option to configure for module %s\n"),ModulesList[ModuleIdx].Name);
+                                       debuga(__FILE__,__LINE__,_("No option to configure for module %s\n"),ModulesList[ModuleIdx].Name);
                                        exit(EXIT_FAILURE);
                                }
                                while (module[length] && (unsigned char)module[length]<=' ') length++;
@@ -186,7 +186,7 @@ void ip2name_forcedns(void)
                }
        }
        if (!DnsModule) {
-               if (debugz>=LogLevel_Process) debuga(_("No known module to resolve an IP address using the DNS\n"));
+               if (debugz>=LogLevel_Process) debuga(__FILE__,__LINE__,_("No known module to resolve an IP address using the DNS\n"));
                exit(EXIT_FAILURE);
        }
 
@@ -195,7 +195,7 @@ void ip2name_forcedns(void)
        for (Chain=FirstModule ; Chain && Chain!=DnsModule ; Chain=Chain->Next) {
                Last=Chain;
        }
-       if (debug) debuga(_("Chaining IP resolving module \"%s\"\n"),DnsModule->Name);
+       if (debug) debuga(__FILE__,__LINE__,_("Chaining IP resolving module \"%s\"\n"),DnsModule->Name);
        if (Last)
                Last->Next=DnsModule;
        else {
@@ -223,7 +223,7 @@ void ip2name(char *ip,int ip_len)
        if (!KnownIp) {
                KnownIp=Dichotomic_Create();
                if (!KnownIp) {
-                       debuga(_("Not enough memory to store the names corresponding to the IP address\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the names corresponding to the IP address\n"));
                        exit(EXIT_FAILURE);
                }
        }
@@ -276,14 +276,14 @@ void name2ip(char *name,int name_size)
        error=getaddrinfo(addr,NULL,NULL,&res);
        if (error) {
                freeaddrinfo(res);
-               debuga(_("Cannot resolve host name %s: %s\n"),name,gai_strerror(error));
+               debuga(__FILE__,__LINE__,_("Cannot resolve host name %s: %s\n"),name,gai_strerror(error));
                exit(EXIT_FAILURE);
        }
        if (res->ai_family==AF_INET) {
                struct sockaddr_in *s4=(struct sockaddr_in *)res->ai_addr;
                struct in_addr *sa=&s4->sin_addr;
                if (res->ai_addrlen<sizeof(*s4)) {
-                       debuga(_("Short structure returned by getaddrinfo for an IPv4 address: %d bytes instead of %d\n"),res->ai_addrlen,(int)sizeof(*s4));
+                       debuga(__FILE__,__LINE__,_("Short structure returned by getaddrinfo for an IPv4 address: %d bytes instead of %d\n"),res->ai_addrlen,(int)sizeof(*s4));
                        exit(EXIT_FAILURE);
                }
                inet_ntop(res->ai_family,sa,name,name_size);
@@ -291,12 +291,12 @@ void name2ip(char *name,int name_size)
                struct sockaddr_in6 *s6=(struct sockaddr_in6 *)res->ai_addr;
                struct in6_addr *sa6=&s6->sin6_addr;
                if (res->ai_addrlen<sizeof(*s6)) {
-                       debuga(_("Short structure returned by getaddrinfo for an IPv6 address: %d bytes instead of %d\n"),res->ai_addrlen,(int)sizeof(*s6));
+                       debuga(__FILE__,__LINE__,_("Short structure returned by getaddrinfo for an IPv6 address: %d bytes instead of %d\n"),res->ai_addrlen,(int)sizeof(*s6));
                        exit(EXIT_FAILURE);
                }
                inet_ntop(res->ai_family,sa6,name,name_size);
        } else {
-               debuga(_("Invalid address type %d returned when resolving host name \"%s\"\n"),res->ai_family,name);
+               debuga(__FILE__,__LINE__,_("Invalid address type %d returned when resolving host name \"%s\"\n"),res->ai_family,name);
        }
        freeaddrinfo(res);
 #else
@@ -320,7 +320,7 @@ void name2ip(char *name,int name_size)
        getword_start(&gwarea,inet_ntoa(ia));
        if (getword(n4,sizeof(n4),&gwarea,'.')<0 || getword(n3,sizeof(n3),&gwarea,'.')<0 ||
            getword(n2,sizeof(n2),&gwarea,'.')<0 || getword(n1,sizeof(n1),&gwarea,0)<0) {
-               debuga(_("Invalid IPv4 address \"%s\"\n"),gwarea.beginning);
+               debuga(__FILE__,__LINE__,_("Invalid IPv4 address \"%s\"\n"),gwarea.beginning);
                exit(EXIT_FAILURE);
        }
        snprintf(name,name_size,"%s.%s.%s.%s",n1,n2,n3,n4);
index f735c34465eb22cbb0b04b55737aaeb1ecbea4d2..73f00a4b95d69f6dfd5fd2baaa06f6a8283726f9 100644 (file)
@@ -90,7 +90,7 @@ static enum ip2name_retcode ip2name_dns(char *ip,int ip_len)
        if (error==EAI_NONAME)
                return(INRC_NotFound);
        if (error!=0) {
-               debuga(_("IP to name resolution (getnameinfo) on IP address \"%s\" failed with error %d - %s\n"),ip,error,gai_strerror(error));
+               debuga(__FILE__,__LINE__,_("IP to name resolution (getnameinfo) on IP address \"%s\" failed with error %d - %s\n"),ip,error,gai_strerror(error));
                return(INRC_Error);
        }
        safe_strcpy(ip,host,ip_len);
index d68bbaecfce01047bc68edcaa61327648040868f..11962d4936ffa55bfd63ae4318a7b328cb424195 100644 (file)
@@ -58,7 +58,7 @@ static void ip2name_execconfig(const char *name,const char *param)
 
        len=strlen(param);
        if (len>=sizeof(ExecCmd)) {
-               debuga(_("Command to execute to resolve the IP addresses is too long (maximum is %d bytes)\n"),(int)sizeof(ExecCmd));
+               debuga(__FILE__,__LINE__,_("Command to execute to resolve the IP addresses is too long (maximum is %d bytes)\n"),(int)sizeof(ExecCmd));
                exit(EXIT_FAILURE);
        }
        strcpy(ExecCmd,param);
@@ -83,7 +83,7 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len)
        size_t nread;
 
        if (ExecCmd[0]=='\0') {
-               debuga(_("No command to run to resolve an IP address. Please configure it in sarg.conf\n"));
+               debuga(__FILE__,__LINE__,_("No command to run to resolve an IP address. Please configure it in sarg.conf\n"));
                exit(EXIT_FAILURE);
        }
 
@@ -92,7 +92,7 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len)
        for (i=0 ; i<sizeof(ExecCmd) && ExecCmd[i] ; i++) {
                if (ExecCmd[i]=='%' && strncmp(ExecCmd+i+1,"IP",2)==0) {
                        if (j+len>=sizeof(cmd)) {
-                               debuga(_("IP address \"%s\" too long for the command to run\n"),ip);
+                               debuga(__FILE__,__LINE__,_("IP address \"%s\" too long for the command to run\n"),ip);
                                return(INRC_Error);
                        }
                        strcpy(cmd+j,ip);
@@ -100,7 +100,7 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len)
                        i+=2;
                } else {
                        if (j>=sizeof(cmd)) {
-                               debuga(_("IP address \"%s\" too long for the command to run\n"),ip);
+                               debuga(__FILE__,__LINE__,_("IP address \"%s\" too long for the command to run\n"),ip);
                                return(INRC_Error);
                        }
                        cmd[j++]=ExecCmd[i];
@@ -110,14 +110,14 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len)
 
        cmd_in=popen(cmd,"r");
        if (!cmd_in) {
-               debuga(_("Cannot run command %s\n"),cmd);
+               debuga(__FILE__,__LINE__,_("Cannot run command %s\n"),cmd);
                exit(EXIT_FAILURE);
        }
 
        nread=fread(buffer,1,sizeof(buffer),cmd_in);
 
        if (pclose(cmd_in)==-1) {
-               debuga(_("Command failed: %s\n"),cmd);
+               debuga(__FILE__,__LINE__,_("Command failed: %s\n"),cmd);
                exit(EXIT_FAILURE);
        }
 
index 55aeaa0d24fe31d0ce33a438212be0d9e06a966e..0ff25aa2c1b2a8435f8ca0c5b9482b414cf4709e 100644 (file)
--- a/lastlog.c
+++ b/lastlog.c
@@ -55,14 +55,14 @@ static struct DirEntry *AppendDirEntry(struct DirEntry *List,time_t CreationTime
 
        entry=malloc(sizeof(*entry));
        if (!entry) {
-               debuga(_("Not enough memory to store a report to purge\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store a report to purge\n"));
                DeleteDirList(List);
                return(NULL);
        }
        entry->Name=malloc((NameLen+1)*sizeof(char));
        if (!entry->Name) {
                free(entry);
-               debuga(_("Not enough memory to store a report to purge\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store a report to purge\n"));
                DeleteDirList(List);
                return(NULL);
        }
@@ -93,19 +93,19 @@ static struct DirEntry *BuildDirDateList(struct DirEntry *List,char *Path,int Pa
        int name_len;
 
        if ((dirp = opendir(Path)) == NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),Path,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),Path,strerror(errno));
                exit(EXIT_FAILURE);
        }
        while ((direntp = readdir( dirp )) != NULL )
        {
                name_len=strlen(direntp->d_name);
                if (RootPos+name_len+1>=PathSize) {
-                       debuga(_("Directory entry \"%s%s\" too long to purge the old reports\n"),Path,direntp->d_name);
+                       debuga(__FILE__,__LINE__,_("Directory entry \"%s%s\" too long to purge the old reports\n"),Path,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
                strcpy(Path+Length,direntp->d_name);
                if (stat(Path,&statb) == -1) {
-                       debuga(_("Failed to get the statistics of file \"%s\": %s\n"),Path,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to get the statistics of file \"%s\": %s\n"),Path,strerror(errno));
                        continue;
                }
                if (!S_ISDIR(statb.st_mode)) continue;
@@ -118,7 +118,7 @@ static struct DirEntry *BuildDirDateList(struct DirEntry *List,char *Path,int Pa
                                List=BuildDirDateList(List,Path,PathSize,RootPos,Length+name_len+1,1);
                                if (!List)
                                {
-                                       debuga(_("Old reports deletion not undertaken due to previous error\n"));
+                                       debuga(__FILE__,__LINE__,_("Old reports deletion not undertaken due to previous error\n"));
                                        break;
                                }
                        }
@@ -130,7 +130,7 @@ static struct DirEntry *BuildDirDateList(struct DirEntry *List,char *Path,int Pa
                                List=AppendDirEntry(List,statb.st_mtime,Path+RootPos,Length-RootPos+name_len);
                                if (!List)
                                {
-                                       debuga(_("Old reports deletion not undertaken due to previous error\n"));
+                                       debuga(__FILE__,__LINE__,_("Old reports deletion not undertaken due to previous error\n"));
                                        break;
                                }
                        }
@@ -153,24 +153,24 @@ static struct DirEntry *BuildDirList(const char *Path)
 
        name_pos=strlen(Path);
        if (name_pos>=sizeof(warea)) {
-               debuga(_("The directory name \"%s\" containing the old reports to purge is too long\n"),Path);
+               debuga(__FILE__,__LINE__,_("The directory name \"%s\" containing the old reports to purge is too long\n"),Path);
                exit(EXIT_FAILURE);
        }
        strcpy(warea,Path);
        if ((dirp = opendir(outdir)) == NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),outdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),outdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        while ((direntp = readdir( dirp )) != NULL )
        {
                name_len=strlen(direntp->d_name);
                if (name_pos+name_len+1>=sizeof(warea)) {
-                       debuga(_("Directory entry \"%s%s\" too long to purge the old reports\n"),Path,direntp->d_name);
+                       debuga(__FILE__,__LINE__,_("Directory entry \"%s%s\" too long to purge the old reports\n"),Path,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
                strcpy(warea+name_pos,direntp->d_name);
                if (stat(warea,&statb) == -1) {
-                       debuga(_("Failed to get the statistics of file \"%s\": %s\n"),warea,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Failed to get the statistics of file \"%s\": %s\n"),warea,strerror(errno));
                        continue;
                }
                if (!S_ISDIR(statb.st_mode)) continue;
@@ -179,7 +179,7 @@ static struct DirEntry *BuildDirList(const char *Path)
                        List=AppendDirEntry(List,statb.st_mtime,direntp->d_name,name_len);
                        if (!List)
                        {
-                               debuga(_("Old reports deletion not undertaken due to previous error\n"));
+                               debuga(__FILE__,__LINE__,_("Old reports deletion not undertaken due to previous error\n"));
                                break;
                        }
                }
@@ -190,7 +190,7 @@ static struct DirEntry *BuildDirList(const char *Path)
                        List=BuildDirDateList(List,warea,sizeof(warea),name_pos,name_pos+name_len+1,0);
                        if (!List)
                        {
-                               debuga(_("Old reports deletion not undertaken due to previous error\n"));
+                               debuga(__FILE__,__LINE__,_("Old reports deletion not undertaken due to previous error\n"));
                                break;
                        }
                }
@@ -212,7 +212,7 @@ static void DeleteEmptyDirs(char *Path,int PathSize,int BasePos)
                if (Dir-Path<=BasePos) break;
                *Dir='\0';
                if ((dirp = opendir(Path)) == NULL) {
-                       debuga(_("Cannot open directory \"%s\": %s\n"),Path,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),Path,strerror(errno));
                        return;
                }
                index=false;
@@ -232,21 +232,21 @@ static void DeleteEmptyDirs(char *Path,int PathSize,int BasePos)
                        break;
                }
                if (debug)
-                       debuga(_("Deleting empty directory \"%s\"\n"),Path);
+                       debuga(__FILE__,__LINE__,_("Deleting empty directory \"%s\"\n"),Path);
                if (index) {
                        if (strlen(Path)+strlen(INDEX_HTML_FILE)+2>=PathSize) {
-                               debuga(_("Buffer too small to delete index file \"%s/%s\""),Path,INDEX_HTML_FILE);
+                               debuga(__FILE__,__LINE__,_("Buffer too small to delete index file \"%s/%s\""),Path,INDEX_HTML_FILE);
                                exit(EXIT_FAILURE);
                        }
                        strcat(Path,"/"INDEX_HTML_FILE);
                        if (unlink(Path)==-1) {
-                               debuga(_("Failed to delete \"%s\": %s\n"),Path,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Failed to delete \"%s\": %s\n"),Path,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        *Dir='\0';
                }
                if (rmdir(Path)) {
-                       debuga(_("Cannot delete \"%s\": %s\n"),Path,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),Path,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
@@ -269,12 +269,12 @@ void mklastlog(const char *outdir)
 
        for (ptr=List ; ptr ; ptr=ptr->Next) ftot++;
        if (debug)
-               debuga(ngettext("%d report directory found\n","%d report directories found\n",ftot),ftot);
+               debuga(__FILE__,__LINE__,ngettext("%d report directory found\n","%d report directories found\n",ftot),ftot);
 
        if(ftot<=LastLog) {
                DeleteDirList(List);
                if (debug) {
-                       debuga(ngettext("No old reports to delete as only %d report currently exists\n",
+                       debuga(__FILE__,__LINE__,ngettext("No old reports to delete as only %d report currently exists\n",
                                                "No old reports to delete as only %d reports currently exist\n",ftot),ftot);
                }
                return;
@@ -282,22 +282,22 @@ void mklastlog(const char *outdir)
 
        ftot-=LastLog;
        if (debug)
-               debuga(ngettext("%d old report to delete\n","%d old reports to delete\n",ftot),ftot);
+               debuga(__FILE__,__LINE__,ngettext("%d old report to delete\n","%d old reports to delete\n",ftot),ftot);
 
        name_pos=strlen(outdir);
        if (name_pos>=sizeof(warea)) {
                DeleteDirList(List);
-               debuga(_("The directory name \"%s\" containing the old reports to purge is too long\n"),outdir);
+               debuga(__FILE__,__LINE__,_("The directory name \"%s\" containing the old reports to purge is too long\n"),outdir);
                exit(EXIT_FAILURE);
        }
        strcpy(warea,outdir);
        for (ptr=List ; ptr && ftot>0 ; ptr=ptr->Next)
        {
                if(debug)
-                       debuga(_("Removing old report file %s\n"),ptr->Name);
+                       debuga(__FILE__,__LINE__,_("Removing old report file %s\n"),ptr->Name);
                if (name_pos+strlen(ptr->Name)+1>=sizeof(warea)) {
                        DeleteDirList(List);
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s%s\n",outdir,ptr->Name);
                        exit(EXIT_FAILURE);
                }
diff --git a/log.c b/log.c
index 2c982cd892fc6325d68feaa412ed180a132c83a4..c38e74140c73d86e4ec052374b17decb2a7ac1b3 100644 (file)
--- a/log.c
+++ b/log.c
@@ -328,18 +328,18 @@ int main(int argc,char *argv[])
                                if (!AccessLog)
                                        AccessLog=FileList_Create();
                                if (!FileList_AddFile(AccessLog,optarg)) {
-                                       debuga(_("Not enough memory to store the input log file names\n"));
+                                       debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
                                        exit(EXIT_FAILURE);
                                }
                                AccessLogFromCmdLine++;
                                break;
                        case 'L':
                                if (NRedirectorLogs>MAX_REDIRECTOR_LOGS) {
-                                       debuga(_("Too many redirector logs passed on command line with option -L.\n"));
+                                       debuga(__FILE__,__LINE__,_("Too many redirector logs passed on command line with option -L.\n"));
                                        exit(EXIT_FAILURE);
                                }
                                if (strlen(optarg)>=MAX_REDIRECTOR_FILELEN) {
-                                       debuga(_("Redirector log file name too long passed on command line with opton -L: %s\n"),optarg);
+                                       debuga(__FILE__,__LINE__,_("Redirector log file name too long passed on command line with opton -L: %s\n"),optarg);
                                        exit(EXIT_FAILURE);
                                }
                                strcpy(RedirectorLogs[NRedirectorLogs],optarg);
@@ -370,7 +370,7 @@ int main(int argc,char *argv[])
 
                                if(strstr(optarg,"-") == 0) {
                                        if(sscanf(optarg,"%d:%d",&h1,&m1)!=2) {
-                                               debuga(_("Time period passed on the command line with option -t must be HH:MM\n"));
+                                               debuga(__FILE__,__LINE__,_("Time period passed on the command line with option -t must be HH:MM\n"));
                                                exit(EXIT_FAILURE);
                                        }
                                        ReadFilter.StartTime=h1*100+m1;
@@ -378,7 +378,7 @@ int main(int argc,char *argv[])
                                        snprintf(hm_str,sizeof(hm_str),"%02d:%02d",h1,m1);
                                } else {
                                        if(sscanf(optarg,"%d:%d-%d:%d",&h1,&m1,&h2,&m2)!=4) {
-                                               debuga(_("Time range passed on the command line with option -t must be HH:MM-HH:MM\n"));
+                                               debuga(__FILE__,__LINE__,_("Time range passed on the command line with option -t must be HH:MM-HH:MM\n"));
                                                exit(EXIT_FAILURE);
                                        }
                                        ReadFilter.StartTime=h1*100+m1;
@@ -406,7 +406,7 @@ int main(int argc,char *argv[])
                                debugz++;
                                break;
                        case ':':
-                               debuga(_("Option -%c requires an argument\n"),optopt);
+                               debuga(__FILE__,__LINE__,_("Option -%c requires an argument\n"),optopt);
                                exit(EXIT_FAILURE);
                        case '?':
                                usage(argv[0]);
@@ -431,18 +431,18 @@ int main(int argc,char *argv[])
                        AccessLog=FileList_Create();
                for (iarq=optind ; iarq<argc ; iarq++) {
                        if (!FileList_AddFile(AccessLog,argv[iarq])) {
-                               debuga(_("Not enough memory to store the input log file names\n"));
+                               debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
                                exit(EXIT_FAILURE);
                        }
                        AccessLogFromCmdLine++;
                }
        }
 
-       if(debug) debuga(_("Init\n"));
+       if(debug) debuga(__FILE__,__LINE__,_("Init\n"));
 
        if(ConfigFile[0] == '\0') snprintf(ConfigFile,sizeof(ConfigFile),"%s/sarg.conf",SYSCONFDIR);
        if(access(ConfigFile, R_OK) != 0) {
-               debuga(_("Cannot open file \"%s\": %s\n"),ConfigFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),ConfigFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -473,7 +473,7 @@ int main(int argc,char *argv[])
        if(AccessLog==NULL) {
                AccessLog=FileList_Create();
                if (!FileList_AddFile(AccessLog,"/var/log/squid/access.log")) {
-                       debuga(_("Not enough memory to store the input log file names\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
                        exit(EXIT_FAILURE);
                }
        }
@@ -560,7 +560,7 @@ int main(int argc,char *argv[])
        strcat(tmp,"/sarg");
 
        if (tmp[0]!='\0' && strncmp(outdir,tmp,strlen(tmp))==0) {
-               debuga(_("The output directory \"%s\" must be outside of the temporary directory \"%s\"\n"),outdir,tmp);
+               debuga(__FILE__,__LINE__,_("The output directory \"%s\" must be outside of the temporary directory \"%s\"\n"),outdir,tmp);
                exit(EXIT_FAILURE);
        }
 
@@ -573,7 +573,7 @@ int main(int argc,char *argv[])
        }
 
        if(access(tmp, R_OK) == 0) {
-               if (debug) debuga(_("Deleting temporary directory \"%s\"\n"),tmp);
+               if (debug) debuga(__FILE__,__LINE__,_("Deleting temporary directory \"%s\"\n"),tmp);
                emptytmpdir(tmp);
        }
        my_mkdir(tmp);
@@ -581,45 +581,45 @@ int main(int argc,char *argv[])
        if(debug) {
                const char *file;
 
-               debuga(_("Parameters:\n"));
-               debuga(_("          Hostname or IP address (-a) = %s\n"),addr);
-               debuga(_("                   Useragent log (-b) = %s\n"),uagent);
-               debuga(_("                    Exclude file (-c) = %s\n"),hexclude);
-               debuga(_("                 Date from-until (-d) = %s\n"),ReadFilter.DateRange);
-               debuga(_("   Email address to send reports (-e) = %s\n"),email);
-               debuga(_("                     Config file (-f) = %s\n"),ConfigFile);
+               debuga(__FILE__,__LINE__,_("Parameters:\n"));
+               debuga(__FILE__,__LINE__,_("          Hostname or IP address (-a) = %s\n"),addr);
+               debuga(__FILE__,__LINE__,_("                   Useragent log (-b) = %s\n"),uagent);
+               debuga(__FILE__,__LINE__,_("                    Exclude file (-c) = %s\n"),hexclude);
+               debuga(__FILE__,__LINE__,_("                 Date from-until (-d) = %s\n"),ReadFilter.DateRange);
+               debuga(__FILE__,__LINE__,_("   Email address to send reports (-e) = %s\n"),email);
+               debuga(__FILE__,__LINE__,_("                     Config file (-f) = %s\n"),ConfigFile);
                if (df=='e')
-                       debuga(_("                     Date format (-g) = Europe (dd/mm/yyyy)\n"));
+                       debuga(__FILE__,__LINE__,_("                     Date format (-g) = Europe (dd/mm/yyyy)\n"));
                else if (df=='u')
-                       debuga(_("                     Date format (-g) = USA (mm/dd/yyyy)\n"));
+                       debuga(__FILE__,__LINE__,_("                     Date format (-g) = USA (mm/dd/yyyy)\n"));
                else if (df=='w')
-                       debuga(_("                     Date format (-g) = Sites & Users (yyyy/ww)\n"));
-               debuga(_("                       IP report (-i) = %s\n"),(iprel) ? _("Yes") : _("No"));
-               debuga(_("            Keep temporary files (-k) = %s\n"),(KeepTempLog) ? _("Yes") : _("No"));
+                       debuga(__FILE__,__LINE__,_("                     Date format (-g) = Sites & Users (yyyy/ww)\n"));
+               debuga(__FILE__,__LINE__,_("                       IP report (-i) = %s\n"),(iprel) ? _("Yes") : _("No"));
+               debuga(__FILE__,__LINE__,_("            Keep temporary files (-k) = %s\n"),(KeepTempLog) ? _("Yes") : _("No"));
                FIter=FileListIter_Open(AccessLog);
                while ((file=FileListIter_NextWithMask(FIter))!=NULL)
-                       debuga(_("                       Input log (-l) = %s\n"),file);
+                       debuga(__FILE__,__LINE__,_("                       Input log (-l) = %s\n"),file);
                FileListIter_Close(FIter);
                for (iarq=0 ; iarq<NRedirectorLogs ; iarq++)
-                       debuga(_("                  Redirector log (-L) = %s\n"),RedirectorLogs[iarq]);
-               debuga(_("              Resolve IP Address (-n) = %s\n"),(Ip2Name) ? _("Yes") : _("No"));
-               debuga(_("                      Output dir (-o) = %s\n"),outdir);
-               debuga(_("Use Ip Address instead of userid (-p) = %s\n"),(UserIp) ? _("Yes") : _("No"));
-               debuga(_("                   Accessed site (-s) = %s\n"),site);
-               debuga(_("                            Time (-t) = %s\n"),hm_str);
-               debuga(_("                            User (-u) = %s\n"),us);
-               debuga(_("                   Temporary dir (-w) = %s\n"),tmp);
-               debuga(_("                  Debug messages (-x) = %s\n"),(debug) ? _("Yes") : _("No"));
-               debuga(_("                Process messages (-z) = %d\n"),debugz);
-               debuga(_(" Previous reports to keep (--lastlog) = %d\n"),LastLog);
-               debuga("\n");
+                       debuga(__FILE__,__LINE__,_("                  Redirector log (-L) = %s\n"),RedirectorLogs[iarq]);
+               debuga(__FILE__,__LINE__,_("              Resolve IP Address (-n) = %s\n"),(Ip2Name) ? _("Yes") : _("No"));
+               debuga(__FILE__,__LINE__,_("                      Output dir (-o) = %s\n"),outdir);
+               debuga(__FILE__,__LINE__,_("Use Ip Address instead of userid (-p) = %s\n"),(UserIp) ? _("Yes") : _("No"));
+               debuga(__FILE__,__LINE__,_("                   Accessed site (-s) = %s\n"),site);
+               debuga(__FILE__,__LINE__,_("                            Time (-t) = %s\n"),hm_str);
+               debuga(__FILE__,__LINE__,_("                            User (-u) = %s\n"),us);
+               debuga(__FILE__,__LINE__,_("                   Temporary dir (-w) = %s\n"),tmp);
+               debuga(__FILE__,__LINE__,_("                  Debug messages (-x) = %s\n"),(debug) ? _("Yes") : _("No"));
+               debuga(__FILE__,__LINE__,_("                Process messages (-z) = %d\n"),debugz);
+               debuga(__FILE__,__LINE__,_(" Previous reports to keep (--lastlog) = %d\n"),LastLog);
+               debuga(__FILE__,__LINE__,"\n");
        }
 
        if(debug)
-               debuga(_("sarg version: %s\n"),VERSION);
+               debuga(__FILE__,__LINE__,_("sarg version: %s\n"),VERSION);
 
 #ifdef ENABLE_DOUBLE_CHECK_DATA
-       debuga(_("Sarg compiled to report warnings if the output is inconsistent\n"));
+       debuga(__FILE__,__LINE__,_("Sarg compiled to report warnings if the output is inconsistent\n"));
 #endif
 
 #ifdef HAVE_RLIM_T
@@ -676,12 +676,12 @@ int main(int argc,char *argv[])
                strftime(date0,sizeof(date0),"%x",&Start);
                strftime(date1,sizeof(date1),"%x",&End);
                // TRANSLATORS: The %s are the start and end dates in locale format.
-               debuga(_("Period covered by log files: %s-%s\n"),date0,date1);
+               debuga(__FILE__,__LINE__,_("Period covered by log files: %s-%s\n"),date0,date1);
        }
 
        if (!LogStatus){
-               debuga(_("No records found\n"));
-               debuga(_("End\n"));
+               debuga(__FILE__,__LINE__,_("No records found\n"));
+               debuga(__FILE__,__LINE__,_("End\n"));
                userinfo_free();
                if(userfile) free(userfile);
                close_usertab();
@@ -694,13 +694,13 @@ int main(int argc,char *argv[])
                strftime(date0,sizeof(date0),"%x",&period.start);
                strftime(date1,sizeof(date1),"%x",&period.end);
                // TRANSLATORS: The %s are the start and end dates in locale format.
-               debuga(_("Period extracted from log files: %s-%s\n"),date0,date1);
+               debuga(__FILE__,__LINE__,_("Period extracted from log files: %s-%s\n"),date0,date1);
        }
        if (ReadFilter.DateRange[0] != '\0') {
                getperiod_fromrange(&period,dfrom,duntil);
        }
        if (getperiod_buildtext(&period)<0) {
-               debuga(_("Failed to build the string representation of the date range\n"));
+               debuga(__FILE__,__LINE__,_("Failed to build the string representation of the date range\n"));
                exit(EXIT_FAILURE);
        }
 
@@ -732,18 +732,18 @@ int main(int argc,char *argv[])
 
        if (show_statis) {
                double elapsed=(double)end_time-(double)start_time;
-               debuga(_("Total execution time: %.0lf seconds\n"),elapsed);
+               debuga(__FILE__,__LINE__,_("Total execution time: %.0lf seconds\n"),elapsed);
                if (read_elapsed>0.) {
-                       debuga(_("Lines read: %lu lines in %.0lf seconds (%.0lf lines/s)\n"),lines_read,read_elapsed,(double)lines_read/read_elapsed);
+                       debuga(__FILE__,__LINE__,_("Lines read: %lu lines in %.0lf seconds (%.0lf lines/s)\n"),lines_read,read_elapsed,(double)lines_read/read_elapsed);
                }
                if (process_elapsed>0.) {
-                       debuga(_("Processed records: %lu records in %.0lf seconds (%.0lf records/s)\n"),records_kept,process_elapsed,(double)records_kept/process_elapsed);
-                       debuga(_("Users: %lu users in %.0lf seconds (%.0lf users/s)\n"),nusers,process_elapsed,(double)nusers/process_elapsed);
+                       debuga(__FILE__,__LINE__,_("Processed records: %lu records in %.0lf seconds (%.0lf records/s)\n"),records_kept,process_elapsed,(double)records_kept/process_elapsed);
+                       debuga(__FILE__,__LINE__,_("Users: %lu users in %.0lf seconds (%.0lf users/s)\n"),nusers,process_elapsed,(double)nusers/process_elapsed);
                }
        }
 
        if(debug)
-               debuga(_("End\n"));
+               debuga(__FILE__,__LINE__,_("End\n"));
 
        exit(EXIT_SUCCESS);
 }
@@ -757,30 +757,30 @@ static void getusers(const char *pwdfile, int debug)
        long int nreg=0;
 
        if(debug)
-               debuga(_("Loading password file \"%s\"\n"),pwdfile);
+               debuga(__FILE__,__LINE__,_("Loading password file \"%s\"\n"),pwdfile);
 
        if ((fp_usr = fopen(pwdfile, "r")) == NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),pwdfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),pwdfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (fseek(fp_usr, 0, SEEK_END)==-1) {
-               debuga(_("Failed to move till the end of file \"%s\": %s\n"),pwdfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Failed to move till the end of file \"%s\": %s\n"),pwdfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
        nreg = ftell(fp_usr);
        if (nreg<0) {
-               debuga(_("Cannot get the size of file \"%s\"\n"),pwdfile);
+               debuga(__FILE__,__LINE__,_("Cannot get the size of file \"%s\"\n"),pwdfile);
                exit(EXIT_FAILURE);
        }
        nreg = nreg+5000;
        if (fseek(fp_usr, 0, SEEK_SET)==-1) {
-               debuga(_("Failed to rewind file \"%s\": %s\n"),pwdfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Failed to rewind file \"%s\": %s\n"),pwdfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((userfile=(char *) malloc(nreg))==NULL){
-               debuga(_("malloc error (%ld bytes required)\n"),nreg);
+               debuga(__FILE__,__LINE__,_("malloc error (%ld bytes required)\n"),nreg);
                exit(EXIT_FAILURE);
        }
 
@@ -790,7 +790,7 @@ static void getusers(const char *pwdfile, int debug)
        while(fgets(buf,sizeof(buf),fp_usr)!=NULL) {
                str=strchr(buf,':');
                if (!str) {
-                       debuga(_("Invalid user in file \"%s\"\n"),pwdfile);
+                       debuga(__FILE__,__LINE__,_("Invalid user in file \"%s\"\n"),pwdfile);
                        exit(EXIT_FAILURE);
                }
                str[1]='\0';
@@ -798,7 +798,7 @@ static void getusers(const char *pwdfile, int debug)
        }
 
        if (fclose(fp_usr)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),pwdfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),pwdfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index e77f3dfc1b143ccaf6ec873ead562566fe071374..ff8b00005d18c0c3d403f0ab7ce670d1b9e0e6fa 100644 (file)
@@ -133,12 +133,12 @@ char *longline_read(FILE *fp_in,longline line)
                if (line->length>=line->size) {
                        line->size+=LINE_BUFFER_SIZE_INCREMENT;
                        if (line->size>=MAX_LINE_BUFFER_SIZE) {
-                               debuga(_("A text line is more than %d bytes long denoting a corrupted file\n"),MAX_LINE_BUFFER_SIZE);
+                               debuga(__FILE__,__LINE__,_("A text line is more than %d bytes long denoting a corrupted file\n"),MAX_LINE_BUFFER_SIZE);
                                exit(EXIT_FAILURE);
                        }
                        newbuf=realloc(line->buffer,line->size);
                        if (!newbuf) {
-                               debuga(_("Not enough memory to read one more line from the file\n"));
+                               debuga(__FILE__,__LINE__,_("Not enough memory to read one more line from the file\n"));
                                exit(EXIT_FAILURE);
                        }
                        line->buffer=newbuf;
@@ -151,7 +151,7 @@ char *longline_read(FILE *fp_in,longline line)
                                line->size++;
                                newbuf=realloc(line->buffer,line->size);
                                if (!newbuf) {
-                                       debuga(_("Not enough memory to read one more line from the file\n"));
+                                       debuga(__FILE__,__LINE__,_("Not enough memory to read one more line from the file\n"));
                                        exit(EXIT_FAILURE);
                                }
                                line->buffer=newbuf;
index f71da4ac2a1393ed04574a479baca56a85ffd1d7..dcbd2202e8c7dd354815e324bb7b929257408c2f 100644 (file)
--- a/readlog.c
+++ b/readlog.c
@@ -196,7 +196,7 @@ enum ReadLogReturnCodeEnum LogLine_Parse(struct LogLineStruct *log_line,struct R
                                if (debugz>=LogLevel_Process)
                                {
                                        /* TRANSLATORS: The argument is the log format name as translated by you. */
-                                       debuga(_("Log format identified as \"%s\" for %s\n"),_(log_line->current_format->Name),log_line->file_name);
+                                       debuga(__FILE__,__LINE__,_("Log format identified as \"%s\" for %s\n"),_(log_line->current_format->Name),log_line->file_name);
                                }
                                break;
                        }
@@ -204,27 +204,27 @@ enum ReadLogReturnCodeEnum LogLine_Parse(struct LogLineStruct *log_line,struct R
                if (x>=(int)(sizeof(LogFormats)/sizeof(*LogFormats)))
                {
                        if (++log_line->successive_errors>NumLogSuccessiveErrors) {
-                               debuga(ngettext("%d consecutive error found in the input log file %s\n",
+                               debuga(__FILE__,__LINE__,ngettext("%d consecutive error found in the input log file %s\n",
                                                                                                "%d consecutive errors found in the input log file %s\n",log_line->successive_errors),log_line->successive_errors,log_line->file_name);
                                exit(EXIT_FAILURE);
                        }
                        if (NumLogTotalErrors>=0 && ++log_line->total_errors>NumLogTotalErrors) {
-                               debuga(ngettext("%d error found in the input log file (last in %s)\n",
+                               debuga(__FILE__,__LINE__,ngettext("%d error found in the input log file (last in %s)\n",
                                                                                                "%d errors found in the input log file (last in %s)\n",log_line->total_errors),log_line->total_errors,log_line->file_name);
                                exit(EXIT_FAILURE);
                        }
-                       debuga(_("The following line read from %s could not be parsed and is ignored\n%s\n"),log_line->file_name,linebuf);
+                       debuga(__FILE__,__LINE__,_("The following line read from %s could not be parsed and is ignored\n%s\n"),log_line->file_name,linebuf);
                }
                else
                        log_line->successive_errors=0;
        }
 
        if (log_line->current_format_idx<0 || log_line->current_format==NULL) {
-               debuga(_("Sarg failed to determine the format of the input log file %s\n"),log_line->file_name);
+               debuga(__FILE__,__LINE__,_("Sarg failed to determine the format of the input log file %s\n"),log_line->file_name);
                exit(EXIT_FAILURE);
        }
        if (log_entry_status==RLRC_InternalError) {
-               debuga(_("Internal error encountered while processing %s\nSee previous message to know the reason for that error.\n"),log_line->file_name);
+               debuga(__FILE__,__LINE__,_("Internal error encountered while processing %s\nSee previous message to know the reason for that error.\n"),log_line->file_name);
                exit(EXIT_FAILURE);
        }
        return(log_entry_status);
@@ -279,27 +279,27 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
 
        if (arq[0]=='-' && arq[1]=='\0') {
                if(debug)
-                       debuga(_("Reading access log file: from stdin\n"));
+                       debuga(__FILE__,__LINE__,_("Reading access log file: from stdin\n"));
                fp_in=stdin;
                from_stdin=true;
        } else {
                if (Filter->DateRange[0]!='\0') {
                        if (stat(arq,&logstat)!=0) {
-                               debuga(_("Cannot get the modification time of input log file %s (%s). Processing it anyway\n"),arq,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot get the modification time of input log file %s (%s). Processing it anyway\n"),arq,strerror(errno));
                        } else {
                                struct tm *logtime=localtime(&logstat.st_mtime);
                                if ((logtime->tm_year+1900)*10000+(logtime->tm_mon+1)*100+logtime->tm_mday<dfrom) {
-                                       debuga(_("Ignoring old log file %s\n"),arq);
+                                       debuga(__FILE__,__LINE__,_("Ignoring old log file %s\n"),arq);
                                        return;
                                }
                        }
                }
                fp_in=decomp(arq,&from_pipe);
                if(fp_in==NULL) {
-                       debuga(_("Cannot open input log file \"%s\": %s\n"),arq,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open input log file \"%s\": %s\n"),arq,strerror(errno));
                        exit(EXIT_FAILURE);
                }
-               if(debug) debuga(_("Reading access log file: %s\n"),arq);
+               if(debug) debuga(__FILE__,__LINE__,_("Reading access log file: %s\n"),arq);
                from_stdin=false;
        }
 
@@ -334,7 +334,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),arq);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),arq);
                exit(EXIT_FAILURE);
        }
 
@@ -374,7 +374,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
                        getword_start(&gwarea,ExcludeString);
                        while(strchr(gwarea.current,':') != 0) {
                                if (getword_multisep(val1,sizeof(val1),&gwarea,':')<0) {
-                                       debuga(_("Invalid record in exclusion string\n"));
+                                       debuga(__FILE__,__LINE__,_("Invalid record in exclusion string\n"));
                                        exit(EXIT_FAILURE);
                                }
                                if((str=(char *) strstr(linebuf,val1)) != (char *) NULL ) {
@@ -412,27 +412,27 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
                                my_mkdir(ParsedOutputLog);
                        }
                        if (snprintf(SargLogFile,sizeof(SargLogFile),"%s/sarg_temp.log",ParsedOutputLog)>=sizeof(SargLogFile)) {
-                               debuga(_("Path too long: "));
+                               debuga(__FILE__,__LINE__,_("Path too long: "));
                                debuga_more("%s/sarg_temp.log\n",ParsedOutputLog);
                                exit(EXIT_FAILURE);
                        }
                        if((fp_log=MY_FOPEN(SargLogFile,"w"))==NULL) {
-                               debuga(_("Cannot open file \"%s\": %s\n"),SargLogFile,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),SargLogFile,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        fputs("*** SARG Log ***\n",fp_log);
                }
 
                if (log_entry.Ip==NULL) {
-                       debuga(_("Unknown input log file format: no IP addresses\n"));
+                       debuga(__FILE__,__LINE__,_("Unknown input log file format: no IP addresses\n"));
                        break;
                }
                if (log_entry.User==NULL) {
-                       debuga(_("Unknown input log file format: no user\n"));
+                       debuga(__FILE__,__LINE__,_("Unknown input log file format: no user\n"));
                        break;
                }
                if (log_entry.Url==NULL) {
-                       debuga(_("Unknown input log file format: no URL\n"));
+                       debuga(__FILE__,__LINE__,_("Unknown input log file format: no URL\n"));
                        break;
                }
 
@@ -468,7 +468,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
 
 
                if(strlen(log_entry.User) > MAX_USER_LEN) {
-                       if (debugz>=LogLevel_Process) debuga(_("User ID too long: %s\n"),log_entry.User);
+                       if (debugz>=LogLevel_Process) debuga(__FILE__,__LINE__,_("User ID too long: %s\n"),log_entry.User);
                        excluded_count[ER_UserNameTooLong]++;
                        totregsx++;
                        continue;
@@ -484,7 +484,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
                }
 
                if(vercode(log_entry.HttpCode)) {
-                       if (debugz>=LogLevel_Process) debuga(_("Excluded code: %s\n"),log_entry.HttpCode);
+                       if (debugz>=LogLevel_Process) debuga(__FILE__,__LINE__,_("Excluded code: %s\n"),log_entry.HttpCode);
                        excluded_count[ER_HttpCode]++;
                        totregsx++;
                        continue;
@@ -527,7 +527,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
                }
                if(Filter->HostFilter) {
                        if(!vhexclude(url)) {
-                               if (debugz>=LogLevel_Data) debuga(_("Excluded site: %s\n"),url);
+                               if (debugz>=LogLevel_Data) debuga(__FILE__,__LINE__,_("Excluded site: %s\n"),url);
                                excluded_count[ER_Url]++;
                                totregsx++;
                                continue;
@@ -591,7 +591,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
 
                if(Filter->UserFilter) {
                        if(!vuexclude(log_entry.User)) {
-                               if (debugz>=LogLevel_Process) debuga(_("Excluded user: %s\n"),log_entry.User);
+                               if (debugz>=LogLevel_Process) debuga(__FILE__,__LINE__,_("Excluded user: %s\n"),log_entry.User);
                                excluded_count[ER_IgnoredUser]++;
                                totregsx++;
                                continue;
@@ -630,7 +630,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
                if (!ufile) {
                        ufile=malloc(sizeof(*ufile));
                        if (!ufile) {
-                               debuga(_("Not enough memory to store the user %s\n"),log_entry.User);
+                               debuga(__FILE__,__LINE__,_("Not enough memory to store the user %s\n"),log_entry.User);
                                exit(EXIT_FAILURE);
                        }
                        memset(ufile,0,sizeof(*ufile));
@@ -664,7 +664,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
                                        if (ufile1->file!=NULL) {
                                                if (x>=maxopenfiles) {
                                                        if (fclose(ufile1->file)==EOF) {
-                                                               debuga(_("Write error in log file of user %s: %s\n"),ufile1->user->id,strerror(errno));
+                                                               debuga(__FILE__,__LINE__,_("Write error in log file of user %s: %s\n"),ufile1->user->id,strerror(errno));
                                                                exit(EXIT_FAILURE);
                                                        }
                                                        ufile1->file=NULL;
@@ -674,11 +674,11 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
                                }
                        }
                        if (snprintf (tmp3, sizeof(tmp3), "%s/%s.user_unsort", tmp, ufile->user->filename)>=sizeof(tmp3)) {
-                               debuga(_("Temporary user file name too long: %s/%s.user_unsort\n"), tmp, ufile->user->filename);
+                               debuga(__FILE__,__LINE__,_("Temporary user file name too long: %s/%s.user_unsort\n"), tmp, ufile->user->filename);
                                exit(EXIT_FAILURE);
                        }
                        if ((ufile->file = MY_FOPEN (tmp3, "a")) == NULL) {
-                               debuga(_("(log) Cannot open temporary file %s: %s\n"), tmp3, strerror(errno));
+                               debuga(__FILE__,__LINE__,_("(log) Cannot open temporary file %s: %s\n"), tmp3, strerror(errno));
                                exit (1);
                        }
                }
@@ -689,7 +689,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
                if (fprintf(ufile->file, "%s\t%s\t%s\t%s\t%"PRIu64"\t%s\t%ld\t%s\n",dia,hora,
                                                                log_entry.Ip,url,(uint64_t)log_entry.DataSize,
                                                                log_entry.HttpCode,log_entry.ElapsedTime,smartfilter)<=0) {
-                       debuga(_("Write error in the log file of user %s\n"),log_entry.User);
+                       debuga(__FILE__,__LINE__,_("Write error in the log file of user %s\n"),log_entry.User);
                        exit(EXIT_FAILURE);
                }
                records_kept++;
@@ -755,7 +755,7 @@ static void ReadOneLogFile(struct ReadLogDataStruct *Filter,const char *arq)
 static void DisplayExcludeCount(const char *Explain,enum ExcludeReasonEnum Reason)
 {
        if (excluded_count[Reason]>0) {
-               debuga("   %s: %lu\n",Explain,excluded_count[Reason]);
+               debuga(__FILE__,__LINE__,"   %s: %lu\n",Explain,excluded_count[Reason]);
        }
 }
 
@@ -796,18 +796,18 @@ int ReadLogFile(struct ReadLogDataStruct *Filter)
                char val4[4096];//val4 must not be bigger than SargLogFile without fixing the strcpy below
 
                if (fclose(fp_log)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),SargLogFile,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),SargLogFile,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                strftime(val2,sizeof(val2),"%d%m%Y_%H%M",&period.start);
                strftime(val1,sizeof(val1),"%d%m%Y_%H%M",&period.end);
                if (snprintf(val4,sizeof(val4),"%s/sarg-%s-%s.log",ParsedOutputLog,val2,val1)>=sizeof(val4)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/sarg-%s-%s.log\n",ParsedOutputLog,val2,val1);
                        exit(EXIT_FAILURE);
                }
                if (rename(SargLogFile,val4)) {
-                       debuga(_("failed to rename %s to %s - %s\n"),SargLogFile,val4,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("failed to rename %s to %s - %s\n"),SargLogFile,val4,strerror(errno));
                } else {
                        strcpy(SargLogFile,val4);
 
@@ -817,19 +817,19 @@ int ReadLogFile(struct ReadLogDataStruct *Filter)
                                necessary around the command name, put them in the configuration file.
                                */
                                if (snprintf(val1,sizeof(val1),"%s \"%s\"",ParsedOutputLogCompress,SargLogFile)>=sizeof(val1)) {
-                                       debuga(_("Command too long: %s \"%s\"\n"),ParsedOutputLogCompress,SargLogFile);
+                                       debuga(__FILE__,__LINE__,_("Command too long: %s \"%s\"\n"),ParsedOutputLogCompress,SargLogFile);
                                        exit(EXIT_FAILURE);
                                }
                                cstatus=system(val1);
                                if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
-                                       debuga(_("command return status %d\n"),WEXITSTATUS(cstatus));
-                                       debuga(_("command: %s\n"),val1);
+                                       debuga(__FILE__,__LINE__,_("command return status %d\n"),WEXITSTATUS(cstatus));
+                                       debuga(__FILE__,__LINE__,_("command: %s\n"),val1);
                                        exit(EXIT_FAILURE);
                                }
                        }
                }
                if(debug)
-                       debuga(_("Sarg parsed log saved as %s\n"),SargLogFile);
+                       debuga(__FILE__,__LINE__,_("Sarg parsed log saved as %s\n"),SargLogFile);
        }
 
        denied_close();
@@ -839,7 +839,7 @@ int ReadLogFile(struct ReadLogDataStruct *Filter)
        for (ufile=first_user_file ; ufile ; ufile=ufile1) {
                ufile1=ufile->next;
                if (ufile->file!=NULL && fclose(ufile->file)==EOF) {
-                       debuga(_("Write error in log file of user %s: %s\n"),ufile->user->id,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in log file of user %s: %s\n"),ufile->user->id,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                free(ufile);
@@ -848,11 +848,11 @@ int ReadLogFile(struct ReadLogDataStruct *Filter)
        if (debug) {
                unsigned long int totalcount=0;
 
-               debuga(_("   Records read: %ld, written: %ld, excluded: %ld\n"),totregsl,totregsg,totregsx);
+               debuga(__FILE__,__LINE__,_("   Records read: %ld, written: %ld, excluded: %ld\n"),totregsl,totregsg,totregsx);
 
                for (x=sizeof(excluded_count)/sizeof(*excluded_count)-1 ; x>=0 && excluded_count[x]>0 ; x--);
                if (x>=0) {
-                       debuga(_("Reasons for excluded entries:\n"));
+                       debuga(__FILE__,__LINE__,_("Reasons for excluded entries:\n"));
                        DisplayExcludeCount(_("User name too long"),ER_UserNameTooLong);
                        DisplayExcludeCount(_("Squid logged an incomplete query received from the client"),ER_IncompleteQuery);
                        DisplayExcludeCount(_("Log file turned over"),ER_LogfileTurnedOver);
@@ -881,13 +881,13 @@ int ReadLogFile(struct ReadLogDataStruct *Filter)
                                /* TRANSLATORS: It displays the number of lines found in the input log files
                                * for each supported log format. The log format name is the %s and is a string
                                * you translate somewhere else. */
-                               debuga(_("%s: %lu entries\n"),_(LogFormats[x]->Name),format_count[x]);
+                               debuga(__FILE__,__LINE__,_("%s: %lu entries\n"),_(LogFormats[x]->Name),format_count[x]);
                                totalcount+=format_count[x];
                        }
                }
 
                if (totalcount==0 && totregsg)
-                       debuga(_("Log with invalid format\n"));
+                       debuga(__FILE__,__LINE__,_("Log with invalid format\n"));
        }
 
        return((totregsg!=0) ? 1 : 0);
index 20715aa0b8d4bda11afe09a831007d19b4405631..b39ee9b9a313c5f8164f25144cd31e8f3223d98f 100644 (file)
@@ -188,7 +188,7 @@ static enum ReadLogReturnCodeEnum Common_ReadEntry(char *Line,struct ReadLogStru
 
        // check the entry time
        if (mktime(&Entry->EntryTime)==-1) {
-               debuga(_("Invalid date or time found in the common log file\n"));
+               debuga(__FILE__,__LINE__,_("Invalid date or time found in the common log file\n"));
                return(RLRC_InternalError);
        }
 
index 6a21850eba44385acc72c3c0819da523cc3f03bd..dd1542a83c00b31546fe4ada6d40c9ecc09d08c3 100644 (file)
@@ -101,7 +101,7 @@ static bool ExtLog_Fields(const char *columns)
        col=0;
        while (*columns) {
                if (col>=MAX_EXT_COLUMNS) {
-                       debuga(_("Too many columns found in an extended log format. The maximum allowed is %d but it can be changed if a bigger value is legitimate\n"),MAX_EXT_COLUMNS);
+                       debuga(__FILE__,__LINE__,_("Too many columns found in an extended log format. The maximum allowed is %d but it can be changed if a bigger value is legitimate\n"),MAX_EXT_COLUMNS);
                        exit(EXIT_FAILURE);
                }
                prefix=-1;
@@ -155,7 +155,7 @@ static bool ExtLog_Fields(const char *columns)
                columns+=len;
                while (*columns && (unsigned char)*columns<=' ') {
                        if (*columns!=col_sep) {
-                               debuga(_("Multiple column separators found between two columns in the \"fields\" directive of an extended log format\n"));
+                               debuga(__FILE__,__LINE__,_("Multiple column separators found between two columns in the \"fields\" directive of an extended log format\n"));
                                exit(EXIT_FAILURE);
                        }
                        columns++;
@@ -401,7 +401,7 @@ static enum ReadLogReturnCodeEnum ExtLog_ReadEntry(char *Line,struct ReadLogStru
        col=0;
        while (*Line) {
                if (col>=ExtColNumber) {
-                       debuga(_("Too many columns in an extended log file format: %d columns found when %d have been announced\n"),col,ExtColNumber);
+                       debuga(__FILE__,__LINE__,_("Too many columns in an extended log file format: %d columns found when %d have been announced\n"),col,ExtColNumber);
                        return(RLRC_Unknown);
                }
                col_id=ExtLog_WhichColumn(col);
@@ -453,13 +453,13 @@ static enum ReadLogReturnCodeEnum ExtLog_ReadEntry(char *Line,struct ReadLogStru
                col++;
        }
        if (col!=ExtColNumber) {
-               debuga(_("Only %d columns in an extended log file format when %d have been announced\n"),col,ExtColNumber);
+               debuga(__FILE__,__LINE__,_("Only %d columns in an extended log file format when %d have been announced\n"),col,ExtColNumber);
                return(RLRC_Unknown);
        }
 
        // check the entry time
        if (mktime(&Entry->EntryTime)==-1) {
-               debuga(_("Invalid date or time found in the extended log file\n"));
+               debuga(__FILE__,__LINE__,_("Invalid date or time found in the extended log file\n"));
                return(RLRC_InternalError);
        }
 
index 2dc1c6c0347dc4c0aa611293a0f886fcc069cc02..c60ff285d0f1340b3cefddf778f0b44abf2a9988 100644 (file)
@@ -72,7 +72,7 @@ static enum ReadLogReturnCodeEnum Sarg_ReadEntry(char *Line,struct ReadLogStruct
 
        if (strncmp(Line,"*** SARG Log ***",16)==0) {
                if (InvalidFileName) {
-                       debuga(_("The name of the file is invalid for a sarg log\n"));
+                       debuga(__FILE__,__LINE__,_("The name of the file is invalid for a sarg log\n"));
                        exit(EXIT_FAILURE);
                }
                getperiod_merge(&period,&SargPeriod);
@@ -156,7 +156,7 @@ static enum ReadLogReturnCodeEnum Sarg_ReadEntry(char *Line,struct ReadLogStruct
 
        // check the entry time
        if (mktime(&Entry->EntryTime)==-1) {
-               debuga(_("Invalid date or time found in the common log file\n"));
+               debuga(__FILE__,__LINE__,_("Invalid date or time found in the common log file\n"));
                return(RLRC_InternalError);
        }
 
index 7d4e1f1bd42d52c4f64557502a46a9d1d497f8fd..529abc9a5290c20e69332c9137fea30d2b6b5bf0 100644 (file)
@@ -128,7 +128,7 @@ static enum ReadLogReturnCodeEnum Squid_ReadEntry(char *Line,struct ReadLogStruc
        // now, the format is known with a good confidence. If the time doesn't decode, it is an error.
        tt=localtime(&log_time);
        if (tt==NULL) {
-               debuga(_("Cannot convert the timestamp from the squid log file\n"));
+               debuga(__FILE__,__LINE__,_("Cannot convert the timestamp from the squid log file\n"));
                return(RLRC_InternalError);
        }
        memcpy(&Entry->EntryTime,tt,sizeof(struct tm));
index a8d2019010f173bbd08123a63cdde5769260b4ca..704d6b49fde77d7ea95d8bd38ddd85b9da80c263 100644 (file)
@@ -67,7 +67,7 @@ static bool GetLatestModified(char *file_name,int file_name_size)
        while ((file=FileListIter_Next(FIter))!=NULL)
        {
                if (stat(file,&st)==-1) {
-                       debuga(_("Cannot stat \"%s\": %s\n"),file,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot stat \"%s\": %s\n"),file,strerror(errno));
                }
                if (!found)
                {
@@ -194,7 +194,7 @@ void realtime(void)
        StoredLogEntries=calloc(realtime_access_log_lines+1,sizeof(struct RealtimeReadLogStruct));
        if (!StoredLogEntries)
        {
-               debuga(_("Not enough memory to store %d records"),realtime_access_log_lines);
+               debuga(__FILE__,__LINE__,_("Not enough memory to store %d records"),realtime_access_log_lines);
                exit(EXIT_FAILURE);
        }
        /*
@@ -205,17 +205,17 @@ void realtime(void)
 
        if (!GetLatestModified(file_name,sizeof(file_name)))
        {
-               debuga(_("No log file to read the last %d lines from\n"),realtime_access_log_lines);
+               debuga(__FILE__,__LINE__,_("No log file to read the last %d lines from\n"),realtime_access_log_lines);
                exit(EXIT_FAILURE);
        }
        fp = fopen(file_name, "r");
        if (!fp) {
-               debuga(_("Cannot open file \"%s\": %s\n"),file_name,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),file_name,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),file_name);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),file_name);
                exit(EXIT_FAILURE);
        }
 
@@ -244,7 +244,7 @@ void realtime(void)
                if (NextIndex>realtime_access_log_lines) NextIndex=0;
        }
        if (fclose(fp)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),file_name,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),file_name,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
index b5b931ebcbf1eb4e7cf23fb57594b3db8a8706fc..60ab26e502704f7be02f0fed3778fd5cc0796f8f 100644 (file)
@@ -58,7 +58,7 @@ static void parse_log(FILE *fp_ou,char *buf)
                getword_start(&gwarea1,RedirectorLogFormat);
                leks[0]='\0';
                if (getword(leks,sizeof(leks),&gwarea1,'#')<0) {
-                       debuga(_("Invalid \"redirector_log_format\" option in your sarg.conf (too many characters before first tag)\n"));
+                       debuga(__FILE__,__LINE__,_("Invalid \"redirector_log_format\" option in your sarg.conf (too many characters before first tag)\n"));
                        exit(EXIT_FAILURE);
                }
                year=0;
@@ -72,16 +72,16 @@ static void parse_log(FILE *fp_ou,char *buf)
                full_url[0]='\0';
                while(strcmp(leks,"end") != 0) {
                        if (getword(leks,sizeof(leks),&gwarea1,'#')<0) {
-                               debuga(_("Invalid \"redirector_log_format\" option in your sarg.conf (missing # at end of tag)\n"));
+                               debuga(__FILE__,__LINE__,_("Invalid \"redirector_log_format\" option in your sarg.conf (missing # at end of tag)\n"));
                                exit(EXIT_FAILURE);
                        }
                        if (getword(sep,sizeof(sep),&gwarea1,'#')<0) {
-                               debuga(_("Invalid \"redirector_log_format\" option in your sarg.conf (too many characters in column separator)\n"));
+                               debuga(__FILE__,__LINE__,_("Invalid \"redirector_log_format\" option in your sarg.conf (too many characters in column separator)\n"));
                                exit(EXIT_FAILURE);
                        }
                        if(strcmp(leks,"end") != 0) {
                                if (getword_limit(res,sizeof(res),&gwarea,sep[0])<0) {
-                                       debuga(_("Parsing of tag \"%s\" in redirector log \"%s\" returned no result\n"),leks,wentp);
+                                       debuga(__FILE__,__LINE__,_("Parsing of tag \"%s\" in redirector log \"%s\" returned no result\n"),leks,wentp);
                                        RedirectorErrors++;
                                        return;
                                }
@@ -93,35 +93,35 @@ static void parse_log(FILE *fp_ou,char *buf)
                                        day=atoi(res);
                                } else if(strcmp(leks,"hour") == 0) {
                                        if (strlen(res)>=sizeof(hour)) {
-                                               debuga(_("Hour string too long in redirector log file \"%s\"\n"),wentp);
+                                               debuga(__FILE__,__LINE__,_("Hour string too long in redirector log file \"%s\"\n"),wentp);
                                                RedirectorErrors++;
                                                return;
                                        }
                                        strcpy(hour,res);
                                } else if(strcmp(leks,"source") == 0) {
                                        if (strlen(res)>=sizeof(source)) {
-                                               debuga(_("Banning source name too long in redirector log file \"%s\"\n"),wentp);
+                                               debuga(__FILE__,__LINE__,_("Banning source name too long in redirector log file \"%s\"\n"),wentp);
                                                RedirectorErrors++;
                                                return;
                                        }
                                        strcpy(source,res);
                                } else if(strcmp(leks,"list") == 0) {
                                        if (strlen(res)>=sizeof(list)) {
-                                               debuga(_("Banning list name too long in redirector log file \"%s\"\n"),wentp);
+                                               debuga(__FILE__,__LINE__,_("Banning list name too long in redirector log file \"%s\"\n"),wentp);
                                                RedirectorErrors++;
                                                return;
                                        }
                                        strcpy(list,res);
                                } else if(strcmp(leks,"ip") == 0) {
                                        if (strlen(res)>=sizeof(ip)) {
-                                               debuga(_("IP address too long in redirector log file \"%s\"\n"),wentp);
+                                               debuga(__FILE__,__LINE__,_("IP address too long in redirector log file \"%s\"\n"),wentp);
                                                RedirectorErrors++;
                                                return;
                                        }
                                        strcpy(ip,res);
                                } else if(strcmp(leks,"user") == 0) {
                                        if (strlen(res)>=sizeof(user)) {
-                                               debuga(_("User ID too long in redirector log file \"%s\"\n"),wentp);
+                                               debuga(__FILE__,__LINE__,_("User ID too long in redirector log file \"%s\"\n"),wentp);
                                                RedirectorErrors++;
                                                return;
                                        }
@@ -138,7 +138,7 @@ static void parse_log(FILE *fp_ou,char *buf)
        } else {
                if (getword_atoll(&lyear,&gwarea,'-')<0 || getword_atoll(&lmon,&gwarea,'-')<0 ||
                                getword_atoll(&lday,&gwarea,' ')<0) {
-                       debuga(_("Invalid date in file \"%s\"\n"),wentp);
+                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),wentp);
                        RedirectorErrors++;
                        return;
                }
@@ -146,32 +146,32 @@ static void parse_log(FILE *fp_ou,char *buf)
                mon=(int)lmon;
                day=(int)lday;
                if (getword(hour,sizeof(hour),&gwarea,' ')<0) {
-                       debuga(_("Invalid time in file \"%s\"\n"),wentp);
+                       debuga(__FILE__,__LINE__,_("Invalid time in file \"%s\"\n"),wentp);
                        RedirectorErrors++;
                        return;
                }
                if (getword_skip(MAXLEN,&gwarea,'(')<0 || getword(source,sizeof(source),&gwarea,'/')<0) {
-                       debuga(_("Invalid redirected source in file \"%s\"\n"),wentp);
+                       debuga(__FILE__,__LINE__,_("Invalid redirected source in file \"%s\"\n"),wentp);
                        RedirectorErrors++;
                        return;
                }
                if (getword(list,sizeof(list),&gwarea,'/')<0) {
-                       debuga(_("Invalid redirected list in file \"%s\"\n"),wentp);
+                       debuga(__FILE__,__LINE__,_("Invalid redirected list in file \"%s\"\n"),wentp);
                        RedirectorErrors++;
                        return;
                }
                if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword_limit(full_url,sizeof(full_url),&gwarea,' ')<0) {
-                       debuga(_("Invalid url in file \"%s\"\n"),wentp);
+                       debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),wentp);
                        RedirectorErrors++;
                        return;
                }
                if (getword(ip,sizeof(ip),&gwarea,'/')<0) {
-                       debuga(_("Invalid source IP in file \"%s\"\n"),wentp);
+                       debuga(__FILE__,__LINE__,_("Invalid source IP in file \"%s\"\n"),wentp);
                        RedirectorErrors++;
                        return;
                }
                if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword(user,sizeof(user),&gwarea,' ')<0) {
-                       debuga(_("Invalid user in file \"%s\"\n"),wentp);
+                       debuga(__FILE__,__LINE__,_("Invalid user in file \"%s\"\n"),wentp);
                        RedirectorErrors++;
                        return;
                }
@@ -228,7 +228,7 @@ static void read_log(const char *wentp, FILE *fp_ou,int dfrom,int duntil)
        longline line;
 
        if(debug) {
-               debuga(_("Reading redirector log file \"%s\"\n"),wentp);
+               debuga(__FILE__,__LINE__,_("Reading redirector log file \"%s\"\n"),wentp);
        }
 
        /* With squidGuard, you can log groups in only one log file.
@@ -255,22 +255,22 @@ static void read_log(const char *wentp, FILE *fp_ou,int dfrom,int duntil)
        nfiles_done++;
        files_done = realloc(files_done, nfiles_done*sizeof(char *));
        if (!files_done) {
-               debuga(_("Not enough memory to store the name of the new redirector log to be read - %s\n"),strerror(errno));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the name of the new redirector log to be read - %s\n"),strerror(errno));
                exit(EXIT_FAILURE);
        }
        files_done[nfiles_done-1] = strdup(wentp);
        if (!files_done[nfiles_done-1]) {
-               debuga(_("Not enough memory to store the name of the new redirector log to be read - %s\n"),strerror(errno));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the name of the new redirector log to be read - %s\n"),strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((fp_in=fopen(wentp,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),wentp,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wentp,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),wentp);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),wentp);
                exit(EXIT_FAILURE);
        }
 
@@ -278,7 +278,7 @@ static void read_log(const char *wentp, FILE *fp_ou,int dfrom,int duntil)
                parse_log(fp_ou,buf);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),wentp,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wentp,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -304,13 +304,13 @@ void redirector_log(void)
        str2 = user;
 
        if(SquidGuardConf[0] == '\0' && NRedirectorLogs == 0) {
-               if (debugz>=LogLevel_Process) debugaz(_("No redirector logs provided to produce that kind of report\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("No redirector logs provided to produce that kind of report\n"));
                return;
        }
 
        snprintf(guard_in,sizeof(guard_in),"%s/redirector.int_unsort",tmp);
        if((fp_ou=fopen(guard_in,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),guard_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),guard_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -322,12 +322,12 @@ void redirector_log(void)
                        read_log(RedirectorLogs[i],fp_ou,dfrom,duntil);
        } else {
                if(access(SquidGuardConf, R_OK) != 0) {
-                       debuga(_("Cannot open file \"%s\": %s\n"),SquidGuardConf,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),SquidGuardConf,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 
                if((fp_guard=fopen(SquidGuardConf,"r"))==NULL) {
-                       debuga(_("Cannot open file \"%s\": %s\n"),SquidGuardConf,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),SquidGuardConf,strerror(errno));
                        exit(EXIT_FAILURE);
                }
 
@@ -377,13 +377,13 @@ void redirector_log(void)
                        }
                }
                if (fclose(fp_guard)==EOF) {
-                       debuga(_("Read error in \"%s\": %s\n"),SquidGuardConf,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),SquidGuardConf,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
 
        if (fp_ou && fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),guard_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),guard_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -396,23 +396,23 @@ void redirector_log(void)
        if (redirector_count) {
                snprintf(redirector_sorted,sizeof(redirector_sorted),"%s/redirector.int_log",tmp);
                if(debug) {
-                       debuga(_("Sorting file \"%s\"\n"),redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Sorting file \"%s\"\n"),redirector_sorted);
                }
 
                if (snprintf(tmp6,sizeof(tmp6),"sort -t \"\t\" -k 1,1 -k 2,2 -k 4,4 \"%s\" -o \"%s\"",guard_in, redirector_sorted)>=sizeof(tmp6)) {
-                       debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),guard_in,redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),guard_in,redirector_sorted);
                        exit(EXIT_FAILURE);
                }
                cstatus=system(tmp6);
                if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
-                       debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus));
-                       debuga(_("sort command: %s\n"),tmp6);
+                       debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEXITSTATUS(cstatus));
+                       debuga(__FILE__,__LINE__,_("sort command: %s\n"),tmp6);
                        exit(EXIT_FAILURE);
                }
        }
 
        if (!KeepTempLog && unlink(guard_in)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),guard_in,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),guard_in,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
@@ -457,7 +457,7 @@ void redirector_report(void)
        if(!redirector_count) {
                if (debugz>=LogLevel_Process) {
                        if (redirector_sorted[0])
-                               debugaz(_("Redirector report not generated because it is empty\n"));
+                               debugaz(__FILE__,__LINE__,_("Redirector report not generated because it is empty\n"));
                }
                return;
        }
@@ -465,17 +465,17 @@ void redirector_report(void)
        snprintf(report,sizeof(report),"%s/redirector.html",outdirname);
 
        if((fp_in=fopen(redirector_sorted,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),redirector_sorted,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),redirector_sorted,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 ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),redirector_sorted);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),redirector_sorted);
                exit(EXIT_FAILURE);
        }
 
@@ -492,33 +492,33 @@ void redirector_report(void)
        while((buf=longline_read(fp_in,line))!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(user,sizeof(user),&gwarea,'\t')<0) {
-                       debuga(_("Invalid user in file \"%s\"\n"),redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Invalid user in file \"%s\"\n"),redirector_sorted);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&data2,&gwarea,'\t')<0) {
-                       debuga(_("Invalid date in file \"%s\"\n"),redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),redirector_sorted);
                        exit(EXIT_FAILURE);
                }
                if (getword(hora,sizeof(hora),&gwarea,'\t')<0) {
-                       debuga(_("Invalid time in file \"%s\"\n"),redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Invalid time in file \"%s\"\n"),redirector_sorted);
                        exit(EXIT_FAILURE);
                }
                if (getword(ip,sizeof(ip),&gwarea,'\t')<0) {
-                       debuga(_("Invalid IP address in file \"%s\"\n"),redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Invalid IP address in file \"%s\"\n"),redirector_sorted);
                        exit(EXIT_FAILURE);
                }
                if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
-                       debuga(_("Invalid url in file \"%s\"\n"),redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),redirector_sorted);
                        exit(EXIT_FAILURE);
                }
                if (getword(rule,sizeof(rule),&gwarea,'\n')<0) {
-                       debuga(_("Invalid rule in file \"%s\"\n"),redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Invalid rule in file \"%s\"\n"),redirector_sorted);
                        exit(EXIT_FAILURE);
                }
 
                uinfo=userinfo_find_from_id(user);
                if (!uinfo) {
-                       debuga(_("Unknown user ID %s in file \"%s\"\n"),user,redirector_sorted);
+                       debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \"%s\"\n"),user,redirector_sorted);
                        exit(EXIT_FAILURE);
                }
 
@@ -568,7 +568,7 @@ void redirector_report(void)
                fprintf(fp_ou,"</td><td class=\"data2\">%s</td></tr>\n",rule);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),redirector_sorted,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),redirector_sorted,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -588,12 +588,12 @@ void redirector_report(void)
        fputs("</div>\n",fp_ou);
        write_html_trailer(fp_ou);
        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 (!KeepTempLog && unlink(redirector_sorted)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),redirector_sorted,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),redirector_sorted,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index 6d5ec46c1e7ea3df09353b8a0de4493e3fc1b02e..bed4b7cb89d77f683ec642089cdeab7f25793d93 100644 (file)
--- a/repday.c
+++ b/repday.c
@@ -62,13 +62,13 @@ void report_day(const struct userinfostruct *uinfo)
        if(access(wdirname, R_OK) != 0) return;
 
        if (snprintf(arqout,sizeof(arqout),"%s/%s/d%s.html",outdirname,uinfo->filename,uinfo->filename)>=sizeof(arqout)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s/d%s.html\n",outdirname,uinfo->filename,uinfo->filename);
                exit(EXIT_FAILURE);
        }
 
        if((fp_in=fopen(wdirname,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -80,7 +80,7 @@ void report_day(const struct userinfostruct *uinfo)
                fixendofline(buf);
                getword_start(&gwarea,buf);
                if (getword(data,sizeof(data),&gwarea,'\t')<0) {
-                       debuga(_("Invalid date in file \"%s\"\n"),wdirname);
+                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),wdirname);
                        exit(EXIT_FAILURE);
                }
                if (sscanf(data,"%d/%d/%d",&day,&month,&year)!=3) continue;
@@ -89,14 +89,14 @@ void report_day(const struct userinfostruct *uinfo)
                for (dayidx=0 ; dayidx<ndaylist && daynum!=daylist[dayidx] ; dayidx++);
                if (dayidx>=ndaylist) {
                        if (dayidx>=sizeof(daylist)/sizeof(*daylist)) {
-                               debuga(_("Too many different dates in file \"%s\"\n"),wdirname);
+                               debuga(__FILE__,__LINE__,_("Too many different dates in file \"%s\"\n"),wdirname);
                                exit(EXIT_FAILURE);
                        }
                        daylist[ndaylist++]=daynum;
                }
 
                if (getword_atoll(&hour,&gwarea,'\t')<0) {
-                       debuga(_("Invalid time in file \"%s\"\n"),wdirname);
+                       debuga(__FILE__,__LINE__,_("Invalid time in file \"%s\"\n"),wdirname);
                        exit(EXIT_FAILURE);
                }
                ihour=(int)hour;
@@ -105,26 +105,26 @@ void report_day(const struct userinfostruct *uinfo)
                if ((datetimeby & DATETIME_BYTE)!=0) {
                        colsep=((datetimeby & DATETIME_ELAP)!=0) ? '\t' : '\0';
                        if (getword_atoll(&bytes,&gwarea,colsep)<0) {
-                               debuga(_("Invalid number of bytes in file \"%s\"\n"),wdirname);
+                               debuga(__FILE__,__LINE__,_("Invalid number of bytes in file \"%s\"\n"),wdirname);
                                exit(EXIT_FAILURE);
                        }
                        tbytes[i]+=bytes;
                }
                if ((datetimeby & DATETIME_ELAP)!=0) {
                        if (getword_atoll(&elap,&gwarea,'\0')<0) {
-                               debuga(_("Invalid elapsed time in file \"%s\"\n"),wdirname);
+                               debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),wdirname);
                                exit(EXIT_FAILURE);
                        }
                        telap[i]+=elap;
                }
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(arqout,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),arqout,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),arqout,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -187,7 +187,7 @@ void report_day(const struct userinfostruct *uinfo)
                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"),
+                       debuga(__FILE__,__LINE__,_("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);
                }
@@ -239,7 +239,7 @@ void report_day(const struct userinfostruct *uinfo)
                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"),
+                       debuga(__FILE__,__LINE__,_("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);
                }
@@ -248,7 +248,7 @@ void report_day(const struct userinfostruct *uinfo)
 
        write_html_trailer(fp_ou);
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),arqout,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),arqout,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
index 56edff97d0a218cba301023279572bf96466f147..df609f46a3088011a67c36310635f254750c8436 100644 (file)
--- a/report.c
+++ b/report.c
@@ -92,19 +92,19 @@ void gerarel(void)
        memset(&globstat,0,sizeof(globstat));
 
        if (vrfydir(&period, addr, site, us, email)<0) {
-               debuga(_("Cannot create the output directory name containing the period as part of the name\n"));
+               debuga(__FILE__,__LINE__,_("Cannot create the output directory name containing the period as part of the name\n"));
                exit(EXIT_FAILURE);
        }
 
        if(debugz>=LogLevel_Process){
-               debugaz(_("outdirname=%s\n"),outdirname);
+               debugaz(__FILE__,__LINE__,_("outdirname=%s\n"),outdirname);
        }
 
        if(UserAgentLog[0] != '\0' && email[0] == '\0') useragent();
 
        snprintf(wdirname,sizeof(wdirname),"%s/sarg-general",outdirname);
        if((fp_gen=MY_FOPEN(wdirname,"w"))==NULL){
-               debuga(_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -118,18 +118,18 @@ void gerarel(void)
 
        uscan=userinfo_startscan();
        if (uscan == NULL) {
-               debuga(_("Cannot enumerate the user list\n"));
+               debuga(__FILE__,__LINE__,_("Cannot enumerate the user list\n"));
                exit(EXIT_FAILURE);
        }
        while ((uinfo = userinfo_advancescan(uscan)) != NULL ) {
                sort_users_log(tmp,debug,uinfo);
                if (snprintf(tmp3,sizeof(tmp3),"%s/%s.user_log",tmp,uinfo->filename)>=sizeof(tmp3)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/%s.user_log\n",tmp,uinfo->filename);
                        exit(EXIT_FAILURE);
                }
                if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){
-                       debuga(_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                user=uinfo->filename;
@@ -163,7 +163,7 @@ void gerarel(void)
                oucache=0;
 
                if ((line=longline_create())==NULL) {
-                       debuga(_("Not enough memory to read file \"%s\"\n"),tmp3);
+                       debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),tmp3);
                        exit(EXIT_FAILURE);
                }
 
@@ -173,16 +173,16 @@ void gerarel(void)
                            getword(accip,sizeof(accip),&gwarea,'\t')<0 ||
                            getword_ptr(buf,&accurl,&gwarea,'\t')<0 || getword_atoll(&accbytes,&gwarea,'\t')<0 ||
                            getword(acccode,sizeof(acccode),&gwarea,'\t')<0) {
-                               debuga(_("Invalid record in file \"%s\"\n"),tmp3);
+                               debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),tmp3);
                                exit(EXIT_FAILURE);
                        }
                        if(strncmp(acccode,"TCP_DENIED/407",14) == 0) continue;
                        if (getword_atoll(&accelap,&gwarea,'\t')<0) {
-                               debuga(_("Invalid elapsed time in file \"%s\"\n"),tmp3);
+                               debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),tmp3);
                                exit(EXIT_FAILURE);
                        }
                        if (getword_skip(20000,&gwarea,'"')<0 || getword(accsmart,sizeof(accsmart),&gwarea,'"')<0) {
-                               debuga(_("Invalid smart info in file \"%s\"\n"),tmp3);
+                               debuga(__FILE__,__LINE__,_("Invalid smart info in file \"%s\"\n"),tmp3);
                                exit(EXIT_FAILURE);
                        }
 
@@ -210,7 +210,7 @@ void gerarel(void)
                                        ourl_size=url_len+1;
                                        oldurl=realloc(oldurl,ourl_size);
                                        if (!oldurl) {
-                                               debuga(_("Not enough memory to store the url\n"));
+                                               debuga(__FILE__,__LINE__,_("Not enough memory to store the url\n"));
                                                exit(EXIT_FAILURE);
                                        }
                                }
@@ -252,7 +252,7 @@ void gerarel(void)
                                                my_mkdir(arqtt);
                                        snprintf(arqtt,sizeof(arqtt),"%s/%s/tt.html",outdirname,uinfo->filename);
                                        if ((fp_tt = fopen(arqtt, "w")) == 0) {
-                                               debuga(_("Cannot open file \"%s\": %s\n"),arqtt,strerror(errno));
+                                               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),arqtt,strerror(errno));
                                                exit(EXIT_FAILURE);
                                        }
                                        ttopen=1;
@@ -295,7 +295,7 @@ void gerarel(void)
                                        ourltt_size=url_len+1;
                                        oldurltt=realloc(oldurltt,ourltt_size);
                                        if (!oldurltt) {
-                                               debuga(_("Not enough memory to store the url\n"));
+                                               debuga(__FILE__,__LINE__,_("Not enough memory to store the url\n"));
                                                exit(EXIT_FAILURE);
                                        }
                                }
@@ -321,7 +321,7 @@ void gerarel(void)
                                        ourl_size=url_len+1;
                                        oldurl=realloc(oldurl,ourl_size);
                                        if (!oldurl) {
-                                               debuga(_("Not enough memory to store the url\n"));
+                                               debuga(__FILE__,__LINE__,_("Not enough memory to store the url\n"));
                                                exit(EXIT_FAILURE);
                                        }
                                }
@@ -331,7 +331,7 @@ void gerarel(void)
                        strcpy(oldacchora,acchora);
                }
                if (fclose(fp_in)==EOF) {
-                       debuga(_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                longline_destroy(&line);
@@ -352,13 +352,13 @@ void gerarel(void)
                }
                if (fp_tmp) {
                        if (fclose(fp_tmp)==EOF) {
-                               debuga(_("Write error in \"%s\": %s\n"),uinfo->filename,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),uinfo->filename,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        fp_tmp=NULL;
                }
                if (!KeepTempLog && unlink(tmp3)) {
-                       debuga(_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
@@ -367,7 +367,7 @@ void gerarel(void)
 
        totalger(fp_gen,wdirname);
        if (fclose(fp_gen)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -376,7 +376,7 @@ void gerarel(void)
                        if(DansGuardianConf[0] != '\0')
                                dansguardian_log();
                        else if (debugz>=LogLevel_Process)
-                               debugaz(_("Dansguardian report not produced because no dansguardian configuration file was provided\n"));
+                               debugaz(__FILE__,__LINE__,_("Dansguardian report not produced because no dansguardian configuration file was provided\n"));
 
                        redirector_log();
                }
@@ -387,27 +387,27 @@ void gerarel(void)
                        if((ReportType & REPORT_TYPE_DOWNLOADS) != 0)
                                download_report();
                        else if (debugz>=LogLevel_Process)
-                               debugaz(_("Downloaded files report not requested in report_type\n"));
+                               debugaz(__FILE__,__LINE__,_("Downloaded files report not requested in report_type\n"));
 
                        if((ReportType & REPORT_TYPE_TOPSITES) != 0)
                                topsites();
                        else if (debugz>=LogLevel_Process)
-                               debugaz(_("Top sites report not requested in report_type\n"));
+                               debugaz(__FILE__,__LINE__,_("Top sites report not requested in report_type\n"));
 
                        if((ReportType & REPORT_TYPE_SITES_USERS) != 0)
                                siteuser();
                        else if (debugz>=LogLevel_Process)
-                               debugaz(_("Sites & users report not requested in report_type\n"));
+                               debugaz(__FILE__,__LINE__,_("Sites & users report not requested in report_type\n"));
 
                        if ((ReportType & REPORT_TYPE_DENIED) != 0)
                                gen_denied_report();
                        else if (debugz>=LogLevel_Process)
-                               debugaz(_("Denied accesses report not requested in report_type\n"));
+                               debugaz(__FILE__,__LINE__,_("Denied accesses report not requested in report_type\n"));
 
                        if ((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0)
                                authfail_report();
                        else if (debugz>=LogLevel_Process)
-                               debugaz(_("Authentication failures report not requested in report_type\n"));
+                               debugaz(__FILE__,__LINE__,_("Authentication failures report not requested in report_type\n"));
 
                        if(smartfilter) smartfilter_report();
 
@@ -419,17 +419,17 @@ void gerarel(void)
                        if((ReportType & REPORT_TYPE_USERS_SITES) != 0)
                                htmlrel();
                        else if (debugz>=LogLevel_Process)
-                               debugaz(_("User's detailed report not requested in report_type\n"));
+                               debugaz(__FILE__,__LINE__,_("User's detailed report not requested in report_type\n"));
                }
 
                make_index();
 
-               if(SuccessfulMsg) debuga(_("Successful report generated on %s\n"),outdirname);
+               if(SuccessfulMsg) debuga(__FILE__,__LINE__,_("Successful report generated on %s\n"),outdirname);
        } else {
                geramail(outdirname, debug, outdir, email, tmp);
 
                if((strcmp(email,"stdout") != 0) && SuccessfulMsg)
-                       debuga(_("Successful report generated and sent to %s\n"),email);
+                       debuga(__FILE__,__LINE__,_("Successful report generated and sent to %s\n"),email);
        }
 
        if(indexonly) index_only(outdirname, debug);
@@ -446,15 +446,15 @@ static FILE *maketmp(const char *user, const char *dirname, int debug)
        if((ReportType & REPORT_TYPE_USERS_SITES) == 0) return(NULL);
        if((ReportType & REPORT_TYPE_TOPUSERS) == 0) return(NULL);
 
-       if(debug) debuga(_("Making file %s/%s\n"),tmp,user);
+       if(debug) debuga(__FILE__,__LINE__,_("Making file %s/%s\n"),tmp,user);
        if (snprintf(wdirname,sizeof(wdirname),"%s/%s.utmp",tmp,user)>=sizeof(wdirname)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s.utmp\n",tmp,user);
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(wdirname,"w"))==NULL){
-               debuga(_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -481,7 +481,7 @@ static void closett(void)
                fputs("</table>\n</div>\n",fp_tt);
                fputs("</body>\n</html>\n",fp_tt);
                if (fclose(fp_tt)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),arqtt,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),arqtt,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                fp_tt=NULL;
@@ -496,13 +496,13 @@ static void gravaporuser(const struct userinfostruct *uinfo, const char *dirname
        if((ReportType & REPORT_TYPE_USERS_SITES) == 0) return;
 
        if (snprintf(wdirname,sizeof(wdirname),"%s/%s.ip",tmp,uinfo->filename)>=sizeof(wdirname)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s.ip\n",tmp,uinfo->filename);
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
-               debuga(_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -513,7 +513,7 @@ static void gravaporuser(const struct userinfostruct *uinfo, const char *dirname
        fprintf(fp_ou,"%s\t%s\t%s\t%s\t%"PRIu64"\t%"PRIu64"\n",ip,url,data,hora,(uint64_t)tam,(uint64_t)elap);
 
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -528,7 +528,7 @@ static void gravager(FILE *fp_gen,const char *filename, const struct userinfostr
        to print a long long int unless it is exactly 64-bits long.
        */
        if (fprintf(fp_gen,"%s\t%"PRIu64"\t%"PRIu64"\t%s\t%s\t%s\t%s\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\n",uinfo->id,(uint64_t)nacc,(uint64_t)nbytes,url,ip,hora,dia,(uint64_t)nelap,(uint64_t)incache,(uint64_t)oucache)<0) {
-               debuga(_("Write error in file \"%s\": %s\n"),filename,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in file \"%s\": %s\n"),filename,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -550,7 +550,7 @@ void totalger(FILE *fp_gen,const char *filename)
        to print a long long int unless it is exactly 64-bits long.
        */
        if (fprintf(fp_gen,"TOTAL\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\n",(uint64_t)globstat.nacc,(uint64_t)globstat.nbytes,(uint64_t)globstat.elap,(uint64_t)globstat.incache,(uint64_t)globstat.oucache)<0) {
-               debuga(_("Failed to write the total line in %s\n"),filename);
+               debuga(__FILE__,__LINE__,_("Failed to write the total line in %s\n"),filename);
                exit(EXIT_FAILURE);
        }
 }
@@ -576,7 +576,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\t') {
-                       debuga(_("Invalid total number of accesses in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid total number of accesses in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                buffer++;
@@ -593,7 +593,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\t') {
-                       debuga(_("Invalid total size in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid total size in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                buffer++;
@@ -610,7 +610,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\t') {
-                       debuga(_("Invalid total elapsed time in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid total elapsed time in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                buffer++;
@@ -627,7 +627,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\t') {
-                       debuga(_("Invalid total cache hit in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid total cache hit in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                buffer++;
@@ -644,7 +644,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\0') {
-                       debuga(_("Invalid total cache miss in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid total cache miss in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                item->oucache=number*sign;
@@ -654,7 +654,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                item->user=buffer;
                for (i=0 ; i<MAX_USER_LEN-1 && (unsigned char)*buffer>=' ' ; i++) buffer++;
                if (*buffer!='\t') {
-                       debuga(_("User name too long or invalid in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("User name too long or invalid in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                *buffer++='\0';
@@ -670,7 +670,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\t') {
-                       debuga(_("Invalid number of accesses in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid number of accesses in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                buffer++;
@@ -687,7 +687,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\t') {
-                       debuga(_("Invalid number of bytes in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid number of bytes in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                buffer++;
@@ -696,7 +696,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                item->url=buffer;
                while ((unsigned char)*buffer>=' ') buffer++;
                if (*buffer!='\t') {
-                       debuga(_("URL too long or invalid in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("URL too long or invalid in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                *buffer++='\0';
@@ -704,7 +704,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                item->ip=buffer;
                for (i=0 ; i<MAX_IP_LEN-1 && (unsigned char)*buffer>=' ' ; i++) buffer++;
                if (*buffer!='\t') {
-                       debuga(_("IP address too long or invalid in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("IP address too long or invalid in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                *buffer++='\0';
@@ -712,7 +712,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                item->time=buffer;
                for (i=0 ; i<MAX_DATETIME_LEN-1 && (unsigned char)*buffer>=' ' ; i++) buffer++;
                if (*buffer!='\t') {
-                       debuga(_("Time too long or invalid in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Time too long or invalid in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                *buffer++='\0';
@@ -720,7 +720,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                item->date=buffer;
                for (i=0 ; i<MAX_DATETIME_LEN-1 && (unsigned char)*buffer>=' ' ; i++) buffer++;
                if (*buffer!='\t') {
-                       debuga(_("Date too long or invalid in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Date too long or invalid in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                *buffer++='\0';
@@ -736,7 +736,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\t') {
-                       debuga(_("Invalid elapsed time in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                buffer++;
@@ -753,7 +753,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\t') {
-                       debuga(_("Invalid cache hit size in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid cache hit size in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                buffer++;
@@ -770,7 +770,7 @@ int ger_read(char *buffer,struct generalitemstruct *item,const char *filename)
                while (isdigit(*buffer))
                        number=(number * 10) + (*buffer++)-'0';
                if (*buffer!='\0') {
-                       debuga(_("Invalid cache miss size in file \"%s\"\n"),filename);
+                       debuga(__FILE__,__LINE__,_("Invalid cache miss size in file \"%s\"\n"),filename);
                        exit(EXIT_FAILURE);
                }
                item->oucache=number*sign;
@@ -784,13 +784,13 @@ static void grava_SmartFilter(const char *dirname, const char *user, const char
        char wdirname[MAXLEN];
 
        if (snprintf(wdirname,sizeof(wdirname),"%s/smartfilter.int_unsort",dirname)>=sizeof(wdirname)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/smartfilter.int_unsort\n",dirname);
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){
-               debuga(_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -798,7 +798,7 @@ static void grava_SmartFilter(const char *dirname, const char *user, const char
        fputs("</body>\n</html>\n",fp_tt);
 
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),wdirname,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),wdirname,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index 5a052ebb1c75bdf92a252bcb67d522e9a63170e8..31cecc493242167cf63f7397f66d7d97dd8359d2 100644 (file)
@@ -49,12 +49,12 @@ void siteuser(void)
        struct userinfostruct *uinfo;
 
        if(Privacy) {
-               if (debugz>=LogLevel_Process) debugaz(_("Sites & users report not generated because privacy option is on\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Sites & users report not generated because privacy option is on\n"));
                return;
        }
 
        if (debugz>=LogLevel_Process)
-               debuga(_("Creating report to list who visisted what site...\n"));
+               debuga(__FILE__,__LINE__,_("Creating report to list who visisted what site...\n"));
        nsitesusers = 0;
        sprintf(general,"%s/sarg-general",outdirname);
        sprintf(sites,"%s/sarg-sites",outdirname);
@@ -62,24 +62,24 @@ void siteuser(void)
        sprintf(report,"%s/siteuser.html",outdirname);
 
        if (snprintf(csort,sizeof(csort),"sort -t \"\t\" -k 4,4 -k 1,1 -o \"%s\" \"%s\"",general2,general)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),general,general2);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),general,general2);
                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(general2,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),general2,strerror(errno));
-               debuga(_("sort command: %s\n"),csort);
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),general2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
                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);
        }
 
@@ -109,7 +109,7 @@ void siteuser(void)
        topuser_link=((ReportType & REPORT_TYPE_USERS_SITES) != 0 && !indexonly);
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),general2);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),general2);
                exit(EXIT_FAILURE);
        }
 
@@ -118,7 +118,7 @@ void siteuser(void)
                if(item.total) continue;
                uinfo=userinfo_find_from_id(item.user);
                if (!uinfo) {
-                       debuga(_("Unknown user ID %s in file \"%s\"\n"),item.user,general2);
+                       debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \"%s\"\n"),item.user,general2);
                        exit(EXIT_FAILURE);
                }
 
@@ -138,7 +138,7 @@ void siteuser(void)
                                ourl_size=url_len+1;
                                ourl=realloc(ourl,ourl_size);
                                if (!ourl) {
-                                       debuga(_("Not enough memory to store the url\n"));
+                                       debuga(__FILE__,__LINE__,_("Not enough memory to store the url\n"));
                                        exit(EXIT_FAILURE);
                                }
                        }
@@ -176,7 +176,7 @@ void siteuser(void)
 
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),general2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),general2,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -187,14 +187,14 @@ void siteuser(void)
        if (ourl) free(ourl);
 
        if (!KeepTempLog && unlink(general2)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),general2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),general2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        fputs("</table></div>\n",fp_ou);
        write_html_trailer(fp_ou);
        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);
        }
 
index df45e2c2ea0d33de58f1791ce1a1d43989fb8e91..33ce33d9c81a1c744e8f713246dca24216659d6c 100644 (file)
@@ -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(_("Invalid record 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("</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);
                        }
 
@@ -206,7 +206,7 @@ void smartfilter_report(void)
        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) {
@@ -219,13 +219,13 @@ void smartfilter_report(void)
                }
                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);
        }
 
diff --git a/sort.c b/sort.c
index c4048ace042faf47ba9900b3baa3ad1b38ad49c2..f2802d438191080e4fc3e14d4b6dcb4070ad05f4 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -63,32 +63,32 @@ void tmpsort(const struct userinfostruct *uinfo)
                order="-r";
 
        if (snprintf(arqin,sizeof(arqin),"%s/%s.utmp",tmp,uinfo->filename)>=sizeof(arqin)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s.utmp\n",tmp,uinfo->filename);
                exit(EXIT_FAILURE);
        }
        if (snprintf(arqou,sizeof(arqou),"%s/htmlrel.txt",tmp)>=sizeof(arqou)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/htmlrel.txt\n",tmp);
                exit(EXIT_FAILURE);
        }
 
        if(debug) {
-               debuga(_("Sorting file \"%s\"\n"),arqin);
+               debuga(__FILE__,__LINE__,_("Sorting file \"%s\"\n"),arqin);
        }
 
        if (snprintf(csort,sizeof(csort),"sort -n -T \"%s\" -t \"\t\" %s -k %s -k %s -k %s -o \"%s\" \"%s\"",tmp,order,field1,field2,field3,arqou,arqin)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),arqin,arqou);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),arqin,arqou);
                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 (!KeepTempLog && unlink(arqin)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),arqin,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),arqin,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -118,7 +118,7 @@ void sort_users_log(const char *tmp, int debug,struct userinfostruct *uinfo)
 
        if(debug) {
                snprintf(csort,sizeof(csort),"%s/%s.user_unsort",tmp,uinfo->filename);
-               debuga(_("Sorting file \"%s\"\n"),csort);
+               debuga(__FILE__,__LINE__,_("Sorting file \"%s\"\n"),csort);
        }
 
        user=uinfo->filename;
@@ -126,24 +126,24 @@ void sort_users_log(const char *tmp, int debug,struct userinfostruct *uinfo)
                        tmp, tmp, user, tmp, user);
        if (clen>=sizeof(csort)) {
                /* TRANSLATORS: The message is followed by the command that is too long. */
-               debuga(_("User name too long to sort with command "));
+               debuga(__FILE__,__LINE__,_("User name too long to sort with command "));
                debuga_more("sort -T \"%s\" -t \"\t\" -k 4,4 -k 1,1 -k 2,2 -o \"%s/%s.user_log\" \"%s/%s.user_unsort\"",
                                        tmp, tmp, user, tmp, user);
                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 (snprintf(csort,sizeof(csort),"%s/%s.user_unsort",tmp,user)>=sizeof(csort)) {
-               debuga(_("User name too long to manufacture file name "));
+               debuga(__FILE__,__LINE__,_("User name too long to manufacture file name "));
                debuga_more("%s/%s.user_unsort\n",tmp,user);
                exit(EXIT_FAILURE);
        }
        if (!KeepTempLog && unlink(csort)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),csort,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),csort,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index 0e153dc7bb440fabdfafb314bddd92f37eb8f3ec..c8c9fa2924225091090d52bf569d5c3017116e57 100644 (file)
@@ -67,7 +67,7 @@ void splitlog(const char *arq, char df, int dfrom, int duntil, int convert, cons
                // '/' + '-YYYY-mm-dd' + '\0' == 13
                output_prefix_len=snprintf(output_file,sizeof(output_file)-12,"%s%s",outdir,splitprefix);
                if (output_prefix_len>=sizeof(output_file)-12) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s%s-YYYY-mm-dd\n",outdir,splitprefix);
                        exit(EXIT_FAILURE);
                }
@@ -80,12 +80,12 @@ void splitlog(const char *arq, char df, int dfrom, int duntil, int convert, cons
                arq="/var/log/squid/access.log";
 
        if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),arq,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),arq,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),arq);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),arq);
                exit(EXIT_FAILURE);
        }
        time(&min_tt);
@@ -93,7 +93,7 @@ void splitlog(const char *arq, char df, int dfrom, int duntil, int convert, cons
        while((buf=longline_read(fp_in,line))!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(data,sizeof(data),&gwarea,' ')<0) {
-                       debuga(_("Invalid date in file \"%s\"\n"),arq);
+                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),arq);
                        exit(EXIT_FAILURE);
                }
                tt=atoi(data);
@@ -110,7 +110,7 @@ void splitlog(const char *arq, char df, int dfrom, int duntil, int convert, cons
                        prev_month=t->tm_mon;
                        prev_day=t->tm_mday;
                        if (fp_ou && fclose(fp_ou)==EOF) {
-                               debuga(_("Write error in \"%s\": %s\n"),output_file,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),output_file,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        strftime(output_file+output_prefix_len, sizeof(output_file)-output_prefix_len, "-%Y-%m-%d", t);
@@ -120,7 +120,7 @@ void splitlog(const char *arq, char df, int dfrom, int duntil, int convert, cons
                        a second time.
                        */
                        if ((fp_ou=MY_FOPEN(output_file,(tt>=min_tt && tt<=max_tt) ? "a" : "w"))==NULL) {
-                               debuga(_("Cannot open file \"%s\": %s\n"),output_file,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),output_file,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        if (tt<min_tt) min_tt=tt;
@@ -141,12 +141,12 @@ void splitlog(const char *arq, char df, int dfrom, int duntil, int convert, cons
 
        longline_destroy(&line);
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),arq,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),arq,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if (autosplit && fp_ou) {
                if (fclose(fp_ou)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),output_file,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),output_file,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
index cab57e602f8258174f4b8f2d03de341c519ff06e..a102d8dbf6f9d25b15fd552207477816a9310990 100644 (file)
@@ -69,11 +69,11 @@ void topsites(void)
        struct generalitemstruct item;
 
        if(Privacy) {
-               if (debugz>=LogLevel_Process) debugaz(_("Top sites report not produced because privacy option is on\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("Top sites report not produced because privacy option is on\n"));
                return;
        }
        if (debugz>=LogLevel_Process)
-               debuga(_("Creating top sites report...\n"));
+               debuga(__FILE__,__LINE__,_("Creating top sites report...\n"));
 
        sprintf(general,"%s/sarg-general",outdirname);
        sprintf(sites,"%s/sarg-sites",outdirname);
@@ -83,29 +83,29 @@ void topsites(void)
        sprintf(report,"%s/topsites.html",outdirname);
 
        if (snprintf(csort,sizeof(csort),"sort -t \"\t\" -k 4,4 -k 1,1 -o \"%s\" \"%s\"",general2,general)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),general,general2);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),general,general2);
                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(general2,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),general2,strerror(errno));
-               debuga(_("sort command: %s\n"),csort);
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),general2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(general3,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),general3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),general3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),general2);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),general2);
                exit(EXIT_FAILURE);
        }
 
@@ -119,7 +119,7 @@ void topsites(void)
                                ourl_size=url_len+1;
                                ourl=realloc(ourl,ourl_size);
                                if (!ourl) {
-                                       debuga(_("Not enough memory to store the url\n"));
+                                       debuga(__FILE__,__LINE__,_("Not enough memory to store the url\n"));
                                        exit(EXIT_FAILURE);
                                }
                        }
@@ -138,7 +138,7 @@ void topsites(void)
                                ourl_size=url_len+1;
                                ourl=realloc(ourl,ourl_size);
                                if (!ourl) {
-                                       debuga(_("Not enough memory to store the url\n"));
+                                       debuga(__FILE__,__LINE__,_("Not enough memory to store the url\n"));
                                        exit(EXIT_FAILURE);
                                }
                        }
@@ -163,7 +163,7 @@ void topsites(void)
 #endif
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),general2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),general2,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -178,19 +178,19 @@ void topsites(void)
        }
 
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),general3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),general3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
 #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);
+               debuga(__FILE__,__LINE__,_("Total statistics mismatch when reading \"%s\" to produce the top sites\n"),general2);
                exit(EXIT_FAILURE);
        }
 #endif
 
        if (!KeepTempLog && unlink(general2)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),general2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),general2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -212,28 +212,28 @@ void topsites(void)
        }
 
        if (snprintf(csort,sizeof(csort),"sort -t \"\t\" %s -n %s -o \"%s\" \"%s\"",sortt,sortf,sites,general3)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),general3,sites);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),general3,sites);
                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(sites,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),sites,strerror(errno));
-               debuga(_("sort command: %s\n"),csort);
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),sites,strerror(errno));
+               debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
                exit(EXIT_FAILURE);
        }
 
        if (!KeepTempLog && unlink(general3)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),general3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),general3,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);
        }
 
@@ -269,27 +269,27 @@ void topsites(void)
        ntopsites = 0;
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),sites);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),sites);
                exit(EXIT_FAILURE);
        }
 
        while(regs<TopSitesNum && (buf=longline_read(fp_in,line))!=NULL) {
                getword_start(&gwarea,buf);
                if (getword_atoll(&nacc,&gwarea,'\t')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),sites);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),sites);
                        exit(EXIT_FAILURE);
                }
                if (nacc == 0) continue;
                if (getword_atoll(&nbytes,&gwarea,'\t')<0 || getword_atoll(&ntime,&gwarea,'\t')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),sites);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),sites);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoi(&nusers,&gwarea,'\t')<0) {
-                       debuga(_("Invalid number of users in file \"%s\"\n"),sites);
+                       debuga(__FILE__,__LINE__,_("Invalid number of users in file \"%s\"\n"),sites);
                        exit(EXIT_FAILURE);
                }
                if (getword_ptr(buf,&url,&gwarea,'\t')<0) {
-                       debuga(_("Invalid url in file \"%s\"\n"),sites);
+                       debuga(__FILE__,__LINE__,_("Invalid url in file \"%s\"\n"),sites);
                        exit(EXIT_FAILURE);
                }
 
@@ -320,7 +320,7 @@ void topsites(void)
                fprintf(fp_ou,">%s</td></tr>\n",fixnum(nusers,1));
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),sites,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),sites,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -328,7 +328,7 @@ void topsites(void)
        fputs("</table></div>\n",fp_ou);
        write_html_trailer(fp_ou);
        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);
        }
 
index 5bf5976e3df714da1ceb6c59b49ceda14cdccd3f..f272fa529afa9528fb03d8e42eeae2d46ba13e80 100644 (file)
--- a/topuser.c
+++ b/topuser.c
@@ -43,12 +43,12 @@ static void set_total_users(int totuser)
 
        snprintf(tusr,sizeof(tusr),"%s/sarg-users",outdirname);
        if((fp_ou=fopen(tusr,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),tusr,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tusr,strerror(errno));
                exit(EXIT_FAILURE);
        }
        fprintf(fp_ou,"%d\n",totuser);
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),tusr,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),tusr,strerror(errno));
                exit(EXIT_FAILURE);
        }
        globstat.totuser=totuser;
@@ -85,17 +85,17 @@ void topuser(void)
        struct userinfostruct *uinfo;
 
        if (debugz>=LogLevel_Process)
-               debuga(_("Creating top users report...\n"));
+               debuga(__FILE__,__LINE__,_("Creating top users report...\n"));
        ntopuser = 0;
        snprintf(wger,sizeof(wger),"%s/sarg-general",outdirname);
        if((fp_in=fopen(wger,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),wger,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wger,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        snprintf(top2,sizeof(top2),"%s/top.tmp",outdirname);
        if((fp_top2=fopen(top2,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),top2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -103,7 +103,7 @@ void topuser(void)
        totuser=0;
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),wger);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),wger);
                exit(EXIT_FAILURE);
        }
 
@@ -141,7 +141,7 @@ void topuser(void)
                tnoucache+=item.oucache;
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),wger,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wger,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -160,14 +160,14 @@ void topuser(void)
                ttnoucache+=tnoucache;
        }
        if (fclose(fp_top2)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),top2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),top2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
 #ifdef ENABLE_DOUBLE_CHECK_DATA
        if (ttnacc!=globstat.nacc || ttnbytes!=globstat.nbytes || ttnelap!=globstat.elap ||
            ttnincache!=globstat.incache || ttnoucache!=globstat.oucache) {
-               debuga(_("Total statistics mismatch when reading \"%s\" to produce the top users\n"),wger);
+               debuga(__FILE__,__LINE__,_("Total statistics mismatch when reading \"%s\" to produce the top users\n"),wger);
                exit(EXIT_FAILURE);
        }
 #endif
@@ -197,29 +197,29 @@ void topuser(void)
 
        snprintf(top1,sizeof(top1),"%s/top",outdirname);
        if (snprintf(csort,sizeof(csort),"sort -T \"%s\" -t \"\t\" %s %s -o \"%s\" \"%s\"", tmp, order, sfield, top1, top2)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),top2,top1);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),top2,top1);
                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_top1=fopen(top1,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),top1,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top1,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (!KeepTempLog && unlink(top2)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),top2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),top2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        snprintf(top3,sizeof(top3),"%s/"INDEX_HTML_FILE,outdirname);
        if((fp_top3=fopen(top3,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),top3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -258,10 +258,10 @@ void topuser(void)
        if ((ReportType & REPORT_TYPE_TOPUSERS) == 0) {
                fputs("</body>\n</html>\n",fp_top3);
                if (fclose (fp_top3)==EOF) {
-                       debuga(_("Write error in \"%s\": %s\n"),top3,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),top3,strerror(errno));
                        exit(EXIT_FAILURE);
                }
-               if (debugz>=LogLevel_Process) debugaz(_("No top users report because it is not configured in report_type\n"));
+               if (debugz>=LogLevel_Process) debugaz(__FILE__,__LINE__,_("No top users report because it is not configured in report_type\n"));
                return;
        }
 
@@ -309,34 +309,34 @@ void topuser(void)
        ntopuser = 0;
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),top1);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),top1);
                exit(EXIT_FAILURE);
        }
 
        while((warea=longline_read(fp_top1,line))!=NULL) {
                getword_start(&gwarea,warea);
                if (getword(user,sizeof(user),&gwarea,'\t')<0) {
-                       debuga(_("Invalid user in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid user in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&nbytes,&gwarea,'\t')<0) {
-                       debuga(_("Invalid number of bytes in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid number of bytes in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&nacc,&gwarea,'\t')<0) {
-                       debuga(_("Invalid number of accesses in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid number of accesses in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&elap,&gwarea,'\t')<0) {
-                       debuga(_("Invalid elapsed time in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid elapsed time in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&incac,&gwarea,'\t')<0) {
-                       debuga(_("Invalid in-cache size in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid in-cache size in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(&oucac,&gwarea,'\n')<0) {
-                       debuga(_("Invalid out-of-cache size in file \"%s\"\n"),top1);
+                       debuga(__FILE__,__LINE__,_("Invalid out-of-cache size in file \"%s\"\n"),top1);
                        exit(EXIT_FAILURE);
                }
                if(nacc < 1)
@@ -348,7 +348,7 @@ void topuser(void)
 
                uinfo=userinfo_find_from_id(user);
                if (!uinfo) {
-                       debuga(_("Unknown user ID %s in file \"%s\"\n"),user,top1);
+                       debuga(__FILE__,__LINE__,_("Unknown user ID %s in file \"%s\"\n"),user,top1);
                        exit(EXIT_FAILURE);
                }
                uinfo->topuser=1;
@@ -403,7 +403,7 @@ void topuser(void)
                        fprintf(fp_top3,"<td class=\"data\">%3.2lf%%</td><td class=\"data\">%3.2lf%%</td>",inperc,ouperc);
 #ifdef ENABLE_DOUBLE_CHECK_DATA
                        if ((inperc!=0. || ouperc!=0.) && fabs(inperc+ouperc-100.)>=0.01) {
-                               debuga(_("The total of the in-cache and cache-miss is not 100%% at position %d (user %s)\n"),posicao,uinfo->label);
+                               debuga(__FILE__,__LINE__,_("The total of the in-cache and cache-miss is not 100%% at position %d (user %s)\n"),posicao,uinfo->label);
                        }
 #endif
                }
@@ -427,11 +427,11 @@ void topuser(void)
                topcount++;
        }
        if (fclose(fp_top1)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),top1,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),top1,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if (!KeepTempLog && unlink(top1)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),top1,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),top1,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -460,7 +460,7 @@ void topuser(void)
                        fprintf(fp_top3,"<th class=\"header_r\">%3.2lf%%</th><th class=\"header_r\">%3.2lf%%</th>",inperc,ouperc);
 #ifdef ENABLE_DOUBLE_CHECK_DATA
                        if (fabs(inperc+ouperc-100.)>=0.01) {
-                               debuga(_("The total of the in-cache and cache-miss is not 100%%\n"));
+                               debuga(__FILE__,__LINE__,_("The total of the in-cache and cache-miss is not 100%%\n"));
                        }
 #endif
                }
@@ -504,7 +504,7 @@ void topuser(void)
        fputs("</table></div>\n",fp_top3);
        write_html_trailer(fp_top3);
        if (fclose(fp_top3)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),top3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),top3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index 8960a5ad5babe213398feaeda0aa335700b60e94..9d80b8ba74b7bd67f8da470273329594f045eb41 100644 (file)
--- a/totday.c
+++ b/totday.c
@@ -50,7 +50,7 @@ DayObject day_prepare(void)
        ddata=(DayObject)malloc(sizeof(*ddata));
        if (!ddata)
        {
-               debuga(_("Not enough memory to store the daily statistics\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the daily statistics\n"));
                exit(EXIT_FAILURE);
        }
 
@@ -102,16 +102,16 @@ void day_addpoint(DayObject ddata,const char *date, const char *time, long long
 
        if (!ddata) return;
        if (sscanf(date,"%d/%d/%d",&day,&month,&year)!=3) {
-               debuga(_("Invalid date \"%s\" for the hourly statistics\n"),date);
+               debuga(__FILE__,__LINE__,_("Invalid date \"%s\" for the hourly statistics\n"),date);
                exit(EXIT_FAILURE);
        }
        if (day<1 || day>31 || month<1 || month>12 || year>9999) {
-               debuga(_("Invalid date component in \"%s\" for the hourly statistics\n"),date);
+               debuga(__FILE__,__LINE__,_("Invalid date component in \"%s\" for the hourly statistics\n"),date);
                exit(EXIT_FAILURE);
        }
        hour=atoi(time);
        if (hour<0 || hour>=24) {
-               debuga(_("Invalid hour %d for the hourly statistics\n"),hour);
+               debuga(__FILE__,__LINE__,_("Invalid hour %d for the hourly statistics\n"),hour);
                exit(EXIT_FAILURE);
        }
        daynum=(year*10000)+(month*100)+day;
@@ -119,7 +119,7 @@ void day_addpoint(DayObject ddata,const char *date, const char *time, long long
        if (dayidx<0) {
                dayidx=ddata->ndaylist++;
                if (dayidx>=sizeof(ddata->daylist)/sizeof(*ddata->daylist)) {
-                       debuga(_("Too many different dates for the hourly statistics\n"));
+                       debuga(__FILE__,__LINE__,_("Too many different dates for the hourly statistics\n"));
                        exit(EXIT_FAILURE);
                }
                ddata->daylist[dayidx]=daynum;
@@ -151,13 +151,13 @@ void day_totalize(DayObject ddata,const char *tmp, const struct userinfostruct *
        if (!ddata) return;
 
        if (snprintf(arqout,sizeof(arqout),"%s/%s.day",tmp,uinfo->filename)>=sizeof(arqout)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s%s\n",tmp,uinfo->filename,".day");
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(arqout,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),arqout,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),arqout,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -165,7 +165,7 @@ void day_totalize(DayObject ddata,const char *tmp, const struct userinfostruct *
                if (ddata->bytes[i]==0 && ddata->elap[i]==0) continue;
                dayidx=i/24;
                if (dayidx>=sizeof(ddata->daylist)/sizeof(*ddata->daylist)) {
-                       debuga(_("Invalid day index found in the hourly statistics\n"));
+                       debuga(__FILE__,__LINE__,_("Invalid day index found in the hourly statistics\n"));
                        exit(EXIT_FAILURE);
                }
                hour=i%24;
@@ -180,7 +180,7 @@ void day_totalize(DayObject ddata,const char *tmp, const struct userinfostruct *
        }
 
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),arqout,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),arqout,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
@@ -198,12 +198,12 @@ void day_deletefile(const struct userinfostruct *uinfo)
        if (KeepTempLog) return;
 
        if (snprintf(arqout,sizeof(arqout),"%s/%s.day",tmp,uinfo->filename)>=sizeof(arqout)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/%s%s\n",tmp,uinfo->filename,".day");
                exit(EXIT_FAILURE);
        }
 
        if (unlink(arqout))
-               debuga(_("Cannot delete \"%s\": %s\n"),arqout,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),arqout,strerror(errno));
 }
 
diff --git a/url.c b/url.c
index 5c20132377688efe7a7ee8f0de26c0d870952b13..8c55610c57fb574762b15007b5ae5bd80f42ca2b 100644 (file)
--- a/url.c
+++ b/url.c
@@ -147,14 +147,14 @@ static int Alias_StoreName(const char *name,const char *next)
                NameEnd=++str;
                while (str<next && (unsigned char)*str>' ') {
                        if (*str=='*') {
-                               debuga(_("Host name alias \"%s*%s\" contains too many wildcards (*)\n"),NameBegin,NameEnd);
+                               debuga(__FILE__,__LINE__,_("Host name alias \"%s*%s\" contains too many wildcards (*)\n"),NameBegin,NameEnd);
                                return(-1);
                        }
                        str++;
                }
                NameEndE=str;
                if (NameEnd==NameEndE) {
-                       debuga(_("Host name alias \"%*s\" must not end with a wildcard\n"),(int)(next-name),name);
+                       debuga(__FILE__,__LINE__,_("Host name alias \"%*s\" must not end with a wildcard\n"),(int)(next-name),name);
                        return(-1);
                }
        } else {
@@ -181,7 +181,7 @@ static int Alias_StoreName(const char *name,const char *next)
                len=(int)(NameBeginE-NameBegin);
                tmp=malloc(len+1);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        return(-1);
                }
                memcpy(tmp,NameBegin,len);
@@ -193,7 +193,7 @@ static int Alias_StoreName(const char *name,const char *next)
                tmp=malloc(len+1);
                if (!tmp) {
                        if (NameBegin) free((void*)NameBegin);
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        return(-1);
                }
                memcpy(tmp,NameEnd,len);
@@ -217,7 +217,7 @@ static int Alias_StoreName(const char *name,const char *next)
        if (!new_alias) {
                if (NameBegin) free((void*)NameBegin);
                if (NameEnd) free((void*)NameEnd);
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                return(-1);
        }
        new_alias->MinLen=0;
@@ -241,7 +241,7 @@ static int Alias_StoreName(const char *name,const char *next)
                len=(int)(ReplaceE-Replace);
                tmp=malloc(len+2);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        return(-1);
                }
                tmp[0]=ALIAS_PREFIX;
@@ -251,7 +251,7 @@ static int Alias_StoreName(const char *name,const char *next)
        } else {
                tmp=malloc(new_alias->MinLen+2);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        return(-1);
                }
                tmp[0]=ALIAS_PREFIX;
@@ -317,7 +317,7 @@ static int Alias_StoreIpv4(unsigned char *ipv4,int nbits,const char *next)
        // insert into the list
        new_alias=malloc(sizeof(*new_alias));
        if (!new_alias) {
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                return(-1);
        }
        memcpy(new_alias->Ip,ipv4,4);
@@ -326,7 +326,7 @@ static int Alias_StoreIpv4(unsigned char *ipv4,int nbits,const char *next)
                len=(int)(ReplaceE-Replace);
                tmp=malloc(len+2);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        return(-1);
                }
                tmp[0]=ALIAS_PREFIX;
@@ -336,7 +336,7 @@ static int Alias_StoreIpv4(unsigned char *ipv4,int nbits,const char *next)
        } else {
                tmp=malloc(5*4+1);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        return(-1);
                }
                sprintf(tmp,"%c%d.%d.%d.%d/%d",ALIAS_PREFIX,ipv4[0],ipv4[1],ipv4[2],ipv4[3],nbits);
@@ -399,7 +399,7 @@ static int Alias_StoreIpv6(unsigned short *ipv6,int nbits,const char *next)
        // insert into the list
        new_alias=malloc(sizeof(*new_alias));
        if (!new_alias) {
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                return(-1);
        }
        memcpy(new_alias->Ip,ipv6,8*sizeof(unsigned short int));
@@ -408,7 +408,7 @@ static int Alias_StoreIpv6(unsigned short *ipv6,int nbits,const char *next)
                len=ReplaceE-Replace;
                tmp=malloc(len+2);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        return(-1);
                }
                tmp[0]=ALIAS_PREFIX;
@@ -418,7 +418,7 @@ static int Alias_StoreIpv6(unsigned short *ipv6,int nbits,const char *next)
        } else {
                tmp=malloc(5*8+5);
                if (!tmp) {
-                       debuga(_("Not enough memory to store the host name aliasing directives\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                        return(-1);
                }
                sprintf(tmp,"%c%x:%x:%x:%x:%x:%x:%x:%x/%d",ALIAS_PREFIX,ipv6[0],ipv6[1],ipv6[2],ipv6[3],ipv6[4],ipv6[5],ipv6[6],ipv6[7],nbits);
@@ -462,14 +462,14 @@ static int Alias_StoreRegexp(char *buf)
        for (End=buf ; *End && *End!=Delimiter ; End++) {
                if (*End=='\\') {
                        if (End[1]=='\0') {
-                               debuga(_("Invalid NUL character found in regular expression\n"));
+                               debuga(__FILE__,__LINE__,_("Invalid NUL character found in regular expression\n"));
                                return(-1);
                        }
                        End++; //ignore the escaped character
                }
        }
        if (*End!=Delimiter) {
-               debuga(_("Unterminated regular expression\n"));
+               debuga(__FILE__,__LINE__,_("Unterminated regular expression\n"));
                return(-1);
        }
        *End++='\0';
@@ -482,20 +482,20 @@ static int Alias_StoreRegexp(char *buf)
        // store it
        new_alias=malloc(sizeof(*new_alias));
        if (!new_alias) {
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                return(-1);
        }
        new_alias->Next=NULL;
        new_alias->Re=pcre_compile(buf,0,&PcreError,&ErrorOffset,NULL);
        if (new_alias->Re==NULL) {
-               debuga(_("Failed to compile the regular expression \"%s\": %s\n"),buf,PcreError);
+               debuga(__FILE__,__LINE__,_("Failed to compile the regular expression \"%s\": %s\n"),buf,PcreError);
                free(new_alias);
                return(-1);
        }
        len=strlen(Replace);
        tmp=malloc(len+2);
        if (!tmp) {
-               debuga(_("Not enough memory to store the host name aliasing directives\n"));
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the host name aliasing directives\n"));
                pcre_free(new_alias->Re);
                return(-1);
        }
@@ -547,7 +547,7 @@ static int Alias_Store(char *buf)
                        return(-1);
                return(0);
 #else
-               debuga(_("PCRE not compiled in therefore the regular expressions are not available in the host alias file\n"));
+               debuga(__FILE__,__LINE__,_("PCRE not compiled in therefore the regular expressions are not available in the host alias file\n"));
                return(-1);
 #endif
        }
@@ -578,28 +578,28 @@ void read_hostalias(const char *Filename)
        longline line;
        char *buf;
 
-       if (debug) debuga(_("Reading host alias file \"%s\"\n"),Filename);
+       if (debug) debuga(__FILE__,__LINE__,_("Reading host alias file \"%s\"\n"),Filename);
        fi=fopen(Filename,"rt");
        if (!fi) {
-               debuga(_("Cannot read host name alias file \"%s\": %s\n"),Filename,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot read host name alias file \"%s\": %s\n"),Filename,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),Filename);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),Filename);
                exit(EXIT_FAILURE);
        }
 
        while ((buf=longline_read(fi,line)) != NULL) {
                if (Alias_Store(buf)<0) {
-                       debuga(_("While reading \"%s\"\n"),Filename);
+                       debuga(__FILE__,__LINE__,_("While reading \"%s\"\n"),Filename);
                        exit(EXIT_FAILURE);
                }
        }
 
        longline_destroy(&line);
        if (fclose(fi)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),Filename,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),Filename,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -608,20 +608,20 @@ void read_hostalias(const char *Filename)
                struct hostalias_ipv4 *alias4;
                struct hostalias_ipv6 *alias6;
 
-               debuga(_("List of host names to alias:\n"));
+               debuga(__FILE__,__LINE__,_("List of host names to alias:\n"));
                for (alias1=FirstAliasName ; alias1 ; alias1=alias1->Next) {
                        if (alias1->HostName_Prefix && alias1->HostName_Suffix)
-                               debuga(_("  %s*%s => %s\n"),alias1->HostName_Prefix,alias1->HostName_Suffix,alias1->Alias);
+                               debuga(__FILE__,__LINE__,_("  %s*%s => %s\n"),alias1->HostName_Prefix,alias1->HostName_Suffix,alias1->Alias);
                        else if (alias1->HostName_Prefix)
-                               debuga(_("  %s => %s\n"),alias1->HostName_Prefix,alias1->Alias);
+                               debuga(__FILE__,__LINE__,_("  %s => %s\n"),alias1->HostName_Prefix,alias1->Alias);
                        else
-                               debuga(_("  *%s => %s\n"),alias1->HostName_Suffix,alias1->Alias);
+                               debuga(__FILE__,__LINE__,_("  *%s => %s\n"),alias1->HostName_Suffix,alias1->Alias);
                }
                for (alias4=FirstAliasIpv4 ; alias4 ; alias4=alias4->Next) {
-                       debuga(_("  %d.%d.%d.%d/%d => %s\n"),alias4->Ip[0],alias4->Ip[1],alias4->Ip[2],alias4->Ip[3],alias4->NBits,alias4->Alias);
+                       debuga(__FILE__,__LINE__,_("  %d.%d.%d.%d/%d => %s\n"),alias4->Ip[0],alias4->Ip[1],alias4->Ip[2],alias4->Ip[3],alias4->NBits,alias4->Alias);
                }
                for (alias6=FirstAliasIpv6 ; alias6 ; alias6=alias6->Next) {
-                       debuga(_("  %x:%x:%x:%x:%x:%x:%x:%x/%d => %s\n"),alias6->Ip[0],alias6->Ip[1],alias6->Ip[2],alias6->Ip[3],
+                       debuga(__FILE__,__LINE__,_("  %x:%x:%x:%x:%x:%x:%x:%x/%d => %s\n"),alias6->Ip[0],alias6->Ip[1],alias6->Ip[2],alias6->Ip[3],
                                alias6->Ip[4],alias6->Ip[5],alias6->Ip[6],alias6->Ip[7],alias6->NBits,alias6->Alias);
                }
        }
index 33dad902c20651235b1664a52cfbc04c1571fc4b..a3b5a4d4a3fed40475199a399710d87dcf892555 100644 (file)
@@ -62,17 +62,17 @@ void useragent(void)
        sprintf(tmp2,"%s/squagent.int_log",tmp);
 
        if((fp_in=fopen(UserAgentLog,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),UserAgentLog,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),UserAgentLog,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(tmp3,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if(debug) {
-               debuga(_("Reading useragent log \"%s\"\n"),UserAgentLog);
+               debuga(__FILE__,__LINE__,_("Reading useragent log \"%s\"\n"),UserAgentLog);
        }
 
        while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
@@ -80,13 +80,13 @@ void useragent(void)
                getword_start(&gwarea,buf);
                if (getword(ip,sizeof(ip),&gwarea,' ')<0 || getword_skip(MAXLEN,&gwarea,'[')<0 ||
                    getword(data,sizeof(data),&gwarea,' ')<0) {
-                       debuga(_("Invalid record in file \"%s\"\n"),UserAgentLog);
+                       debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),UserAgentLog);
                        exit(EXIT_FAILURE);
                }
                getword_start(&gwarea1,data);
                if (getword(day,sizeof(day),&gwarea1,'/')<0 || getword(month,sizeof(month),&gwarea1,'/')<0 ||
                    getword(year,sizeof(year),&gwarea1,':')<0) {
-                       debuga(_("Invalid date in file \"%s\"\n"),UserAgentLog);
+                       debuga(__FILE__,__LINE__,_("Invalid date in file \"%s\"\n"),UserAgentLog);
                        exit(EXIT_FAILURE);
                }
                buildymd(day,month,year,wdate,sizeof(wdate));
@@ -97,13 +97,13 @@ void useragent(void)
                        strcpy(idate,data);
                strcpy(fdate,data);
                if (getword_skip(MAXLEN,&gwarea,'"')<0 || getword(agent,sizeof(agent),&gwarea,'"')<0) {
-                       debuga(_("Invalid useragent in file \"%s\"\n"),UserAgentLog);
+                       debuga(__FILE__,__LINE__,_("Invalid useragent in file \"%s\"\n"),UserAgentLog);
                        exit(EXIT_FAILURE);
                }
 
                if(gwarea.current[0]!='\0') {
                        if (getword_skip(MAXLEN,&gwarea,' ')<0 || getword(user,sizeof(user),&gwarea,'\n')<0) {
-                               debuga(_("Invalid record in file \"%s\"\n"),UserAgentLog);
+                               debuga(__FILE__,__LINE__,_("Invalid record in file \"%s\"\n"),UserAgentLog);
                                exit(EXIT_FAILURE);
                        }
                        if(user[0] == '-')
@@ -119,51 +119,51 @@ void useragent(void)
        }
 
        if(debug) {
-               debuga(_("   Records read: %ld\n"),totregsl);
+               debuga(__FILE__,__LINE__,_("   Records read: %ld\n"),totregsl);
        }
 
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),tmp3,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),UserAgentLog,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),UserAgentLog,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if(debug) {
-               debuga(_("Sorting file \"%s\"\n"),tmp2);
+               debuga(__FILE__,__LINE__,_("Sorting file \"%s\"\n"),tmp2);
        }
 
        if (snprintf(csort,sizeof(csort),"sort -n -t \"\t\" -k 3,3 -k 2,2 -k 1,1 -o \"%s\" \"%s\"",tmp2,tmp3)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
                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(tmp2,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),tmp2,strerror(errno));
-               debuga(_("sort command: %s\n"),csort);
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
                exit(EXIT_FAILURE);
        }
 
        if (!KeepTempLog && unlink(tmp3)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        snprintf(hfile,sizeof(hfile),"%s/useragent.html", outdirname);
        if((fp_ht=fopen(hfile,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),hfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),hfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if(debug)
-               debuga(_("Making Useragent report\n"));
+               debuga(__FILE__,__LINE__,_("Making Useragent report\n"));
 
        write_html_header(fp_ht,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Squid Useragent's Report"),HTML_JS_NONE);
        fprintf(fp_ht,"<tr><th class=\"header_c\">%s</th></tr>\n",_("Squid Useragent's Report"));
@@ -180,7 +180,7 @@ void useragent(void)
        while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(ip,sizeof(ip),&gwarea,'\t')<0) {
-                       debuga(_("Invalid IP address in file \"%s\"\n"),tmp2);
+                       debuga(__FILE__,__LINE__,_("Invalid IP address in file \"%s\"\n"),tmp2);
                        exit(EXIT_FAILURE);
                }
 
@@ -193,11 +193,11 @@ void useragent(void)
                }
 
                if (getword(agent,sizeof(agent),&gwarea,'\t')<0) {
-                       debuga(_("Invalid useragent in file \"%s\"\n"),tmp2);
+                       debuga(__FILE__,__LINE__,_("Invalid useragent in file \"%s\"\n"),tmp2);
                        exit(EXIT_FAILURE);
                }
                if (getword(user,sizeof(user),&gwarea,'\t')<0) {
-                       debuga(_("Invalid user ID in file \"%s\"\n"),tmp2);
+                       debuga(__FILE__,__LINE__,_("Invalid user ID in file \"%s\"\n"),tmp2);
                        exit(EXIT_FAILURE);
                }
 
@@ -217,33 +217,33 @@ void useragent(void)
 
        fputs("</table>\n",fp_ht);
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),tmp2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (snprintf(csort,sizeof(csort),"sort -t \"\t\" -k 2,2 -o \"%s\" \"%s\"",tmp3,tmp2)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
                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(tmp3,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
-               debuga(_("sort command: %s\n"),csort);
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
                exit(EXIT_FAILURE);
        }
 
        if (!KeepTempLog && unlink(tmp2)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),tmp2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if((fp_ou=fopen(tmp2,"w"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),tmp2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -253,11 +253,11 @@ void useragent(void)
        while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
                getword_start(&gwarea,buf);
                if (getword(ip,sizeof(ip),&gwarea,'\t')<0) {
-                       debuga(_("Invalid IP address in file \"%s\"\n"),tmp3);
+                       debuga(__FILE__,__LINE__,_("Invalid IP address in file \"%s\"\n"),tmp3);
                        exit(EXIT_FAILURE);
                }
                if (getword(agent,sizeof(agent),&gwarea,'\t')<0) {
-                       debuga(_("Invalid useragent in file \"%s\"\n"),tmp3);
+                       debuga(__FILE__,__LINE__,_("Invalid useragent in file \"%s\"\n"),tmp3);
                        exit(EXIT_FAILURE);
                }
 
@@ -280,37 +280,37 @@ void useragent(void)
        agentot2+=agentot;
 
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),tmp2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),tmp2,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (!KeepTempLog && unlink(tmp3)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (snprintf(csort,sizeof(csort),"sort -n -r -k 1,1 -o \"%s\" \"%s\"",tmp3,tmp2)>=sizeof(csort)) {
-               debuga(_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
+               debuga(__FILE__,__LINE__,_("Sort command too long when sorting file \"%s\" to \"%s\"\n"),tmp2,tmp3);
                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(tmp3,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
-               debuga(_("sort command: %s\n"),csort);
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
                exit(EXIT_FAILURE);
        }
 
        if (!KeepTempLog && unlink(tmp2)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),tmp2,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp2,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -324,7 +324,7 @@ void useragent(void)
                fixendofline(buf);
                getword_start(&gwarea,buf);
                if (getword(tagent,sizeof(tagent),&gwarea,' ')<0) {
-                       debuga(_("Invalid useragent in file \"%s\"\n"),tmp3);
+                       debuga(__FILE__,__LINE__,_("Invalid useragent in file \"%s\"\n"),tmp3);
                        exit(EXIT_FAILURE);
                }
                nagent=atoi(tagent);
@@ -335,19 +335,19 @@ void useragent(void)
                fprintf(fp_ht,"</td><td class=\"data\">%d</td><td class=\"data\">%3.2lf</td></tr>\n",nagent,perc);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),tmp3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        fputs("</table></div>\n",fp_ht);
        write_html_trailer(fp_ht);
        if (fclose(fp_ht)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),hfile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),hfile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (!KeepTempLog && unlink(tmp3)) {
-               debuga(_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),tmp3,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
index 7a3e2cdc3a926259059260c3b120da5882103940..301ab1d8aa1f170b566df8a113128255475badc8 100644 (file)
@@ -79,7 +79,7 @@ struct userinfostruct *userinfo_create(const char *userid,const char *ip)
        if (!UserStrings) {
                UserStrings=StringBuffer_Create();
                if (!UserStrings) {
-                       debuga(_("Not enough memory to store the user's strings\n"));
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store the user's strings\n"));
                        exit(EXIT_FAILURE);
                }
        }
@@ -93,7 +93,7 @@ struct userinfostruct *userinfo_create(const char *userid,const char *ip)
        if (!group) {
                group=malloc(sizeof(*group));
                if (!group) {
-                       debuga(_("Not enough memory to store user \"%s\"\n"),userid);
+                       debuga(__FILE__,__LINE__,_("Not enough memory to store user \"%s\"\n"),userid);
                        exit(EXIT_FAILURE);
                }
                memset(group,0,sizeof(*group));
@@ -106,7 +106,7 @@ struct userinfostruct *userinfo_create(const char *userid,const char *ip)
 
        user->id=StringBuffer_Store(UserStrings,userid);
        if (!user->id) {
-               debuga(_("Not enough memory to store user ID \"%s\"\n"),userid);
+               debuga(__FILE__,__LINE__,_("Not enough memory to store user ID \"%s\"\n"),userid);
                exit(EXIT_FAILURE);
        }
        user->label=user->id; //assign a label to avoid a NULL pointer in case none is provided
@@ -162,7 +162,7 @@ struct userinfostruct *userinfo_create(const char *userid,const char *ip)
        user->filename=StringBuffer_Store(UserStrings,filename);
        if (!user->filename)
        {
-               debuga(_("Not enough memory to store the file name for user \"%s\"\n"),user->id);
+               debuga(__FILE__,__LINE__,_("Not enough memory to store the file name for user \"%s\"\n"),user->id);
                exit(EXIT_FAILURE);
        }
 
@@ -192,7 +192,7 @@ void userinfo_label(struct userinfostruct *uinfo,const char *label)
        if (!UserStrings) return;
        uinfo->label=StringBuffer_Store(UserStrings,label);
        if (!uinfo->label) {
-               debuga(_("Not enough memory to store label \"%s\" of user \"%s\"\n"),label,uinfo->id);
+               debuga(__FILE__,__LINE__,_("Not enough memory to store label \"%s\" of user \"%s\"\n"),label,uinfo->id);
                exit(EXIT_FAILURE);
        }
 }
@@ -315,40 +315,40 @@ void read_useralias(const char *Filename)
        longline line;
        char *buf;
 
-       if (debug) debuga(_("Reading user alias file \"%s\"\n"),Filename);
+       if (debug) debuga(__FILE__,__LINE__,_("Reading user alias file \"%s\"\n"),Filename);
 
        UserAliases=Alias_Create();
        if (!UserAliases) {
-               debuga(_("Cannot store user's aliases\n"));
+               debuga(__FILE__,__LINE__,_("Cannot store user's aliases\n"));
                exit(EXIT_FAILURE);
        }
 
        fi=fopen(Filename,"rt");
        if (!fi) {
-               debuga(_("Cannot read user name alias file \"%s\": %s\n"),Filename,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot read user name alias file \"%s\": %s\n"),Filename,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),Filename);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),Filename);
                exit(EXIT_FAILURE);
        }
 
        while ((buf=longline_read(fi,line)) != NULL) {
                if (Alias_Store(UserAliases,buf)<0) {
-                       debuga(_("While reading \"%s\"\n"),Filename);
+                       debuga(__FILE__,__LINE__,_("While reading \"%s\"\n"),Filename);
                        exit(EXIT_FAILURE);
                }
        }
 
        longline_destroy(&line);
        if (fclose(fi)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),Filename,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),Filename,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (debug) {
-               debuga(_("List of user names to alias:\n"));
+               debuga(__FILE__,__LINE__,_("List of user names to alias:\n"));
                Alias_PrintList(UserAliases);
        }
 }
index ebcbb65360ff641619f8e651540d8385c5651490..639920c5b2caac22374462aa62b9fcff62141f70 100644 (file)
--- a/usertab.c
+++ b/usertab.c
@@ -76,25 +76,25 @@ static void init_file_usertab(const char *UserTabFile)
        int z1, z2;
 
        if((fp_usr=fopen(UserTabFile,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),UserTabFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),UserTabFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if (fseek(fp_usr, 0, SEEK_END)==-1) {
-               debuga(_("Failed to move till the end of file \"%s\": %s\n"),UserTabFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Failed to move till the end of file \"%s\": %s\n"),UserTabFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
        nreg = ftell(fp_usr);
        if (nreg<0) {
-               debuga(_("Cannot get the size of file \"%s\"\n"),UserTabFile);
+               debuga(__FILE__,__LINE__,_("Cannot get the size of file \"%s\"\n"),UserTabFile);
                exit(EXIT_FAILURE);
        }
        nreg += 100;
        if (fseek(fp_usr, 0, SEEK_SET)==-1) {
-               debuga(_("Failed to rewind file \"%s\": %s\n"),UserTabFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Failed to rewind file \"%s\": %s\n"),UserTabFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
        if((userfile=(char *) malloc(nreg))==NULL){
-               debuga(_("ERROR: Cannot load. Memory fault\n"));
+               debuga(__FILE__,__LINE__,_("ERROR: Cannot load. Memory fault\n"));
                exit(EXIT_FAILURE);
        }
        userfile[0]='\t';
@@ -105,7 +105,7 @@ static void init_file_usertab(const char *UserTabFile)
                z1=0;
                while(buf[z1] && (unsigned char)buf[z1]>' ') {
                        if (z2+3>=nreg) { //need at least 3 additional bytes for the minimum string "\n\t\0"
-                               debuga(_("The list of users is too long in file \"%s\"\n"),UserTabFile);
+                               debuga(__FILE__,__LINE__,_("The list of users is too long in file \"%s\"\n"),UserTabFile);
                                exit(EXIT_FAILURE);
                        }
                        userfile[z2++]=buf[z1++];
@@ -114,7 +114,7 @@ static void init_file_usertab(const char *UserTabFile)
                userfile[z2++]='\n';
                while(buf[z1] && (unsigned char)buf[z1]>=' ') {
                        if (z2+2>=nreg) { //need at least 2 additional bytes for "\t\0"
-                               debuga(_("The list of users is too long in file \"%s\"\n"),UserTabFile);
+                               debuga(__FILE__,__LINE__,_("The list of users is too long in file \"%s\"\n"),UserTabFile);
                                exit(EXIT_FAILURE);
                        }
                        userfile[z2++]=buf[z1++];
@@ -124,7 +124,7 @@ static void init_file_usertab(const char *UserTabFile)
        }
        userfile[z2]='\0';
        if (fclose(fp_usr)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),UserTabFile,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),UserTabFile,strerror(errno));
                exit(EXIT_FAILURE);
        }
 }
@@ -164,31 +164,31 @@ static void init_ldap_usertab(void) {
        url.lud_scope = LDAP_SCOPE_DEFAULT;
        ldapuri = ldap_url_desc2str(&url);
        if (ldapuri==NULL) {
-               debuga(_("Cannot prepare ldap URI for server %s on port %d\n"),LDAPHost,LDAPPort);
+               debuga(__FILE__,__LINE__,_("Cannot prepare ldap URI for server %s on port %d\n"),LDAPHost,LDAPPort);
                exit(EXIT_FAILURE);
        }
 
        rc = ldap_initialize(&ldap_handle, ldapuri);
        if (rc != LDAP_SUCCESS) {
-               debuga(_("Unable to connect to LDAP server %s on port %d: %d (%s)\n"), LDAPHost, LDAPPort, rc, ldap_err2string(rc));
+               debuga(__FILE__,__LINE__,_("Unable to connect to LDAP server %s on port %d: %d (%s)\n"), LDAPHost, LDAPPort, rc, ldap_err2string(rc));
                exit(EXIT_FAILURE);
        }
        ldap_memfree(ldapuri);
 
        if (ldap_set_option(ldap_handle, LDAP_OPT_REFERRALS, LDAP_OPT_OFF) != LDAP_OPT_SUCCESS) {
-               debuga(_("Could not disable LDAP_OPT_REFERRALS\n"));
+               debuga(__FILE__,__LINE__,_("Could not disable LDAP_OPT_REFERRALS\n"));
                exit(EXIT_FAILURE);
        }
        int ldap_protocol_version = LDAPProtocolVersion;
        if (ldap_set_option(ldap_handle, LDAP_OPT_PROTOCOL_VERSION, &ldap_protocol_version) != LDAP_SUCCESS) {
-               debuga(_("Could not set LDAP protocol version %d\n"), ldap_protocol_version);
+               debuga(__FILE__,__LINE__,_("Could not set LDAP protocol version %d\n"), ldap_protocol_version);
                exit(EXIT_FAILURE);
        }
 
        /* Bind to the LDAP server. */
        rc = ldap_simple_bind_s( ldap_handle, LDAPBindDN, LDAPBindPW );
        if ( rc != LDAP_SUCCESS ) {
-               debuga(_("Cannot bind to LDAP server: %s\n"), ldap_err2string(rc));
+               debuga(__FILE__,__LINE__,_("Cannot bind to LDAP server: %s\n"), ldap_err2string(rc));
                exit(EXIT_FAILURE);
        }
 
@@ -197,7 +197,7 @@ static void init_ldap_usertab(void) {
        if (LDAPNativeCharset[0]!='\0') {
                ldapiconv = iconv_open( LDAPNativeCharset, "UTF-8" );
                if (ldapiconv==(iconv_t)-1) {
-                       debuga(_("iconv cannot convert from UTF-8 to %s: %s\n"),LDAPNativeCharset,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("iconv cannot convert from UTF-8 to %s: %s\n"),LDAPNativeCharset,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
@@ -225,7 +225,7 @@ const char * charset_convert( const char * str_in, const char * charset_to )
                ldapconvbuffersize=str_out_len;
                str_out = realloc(ldapconvbuffer,ldapconvbuffersize);
                if (!str_out) {
-                       debuga(_("Not enough memory to convert a LDAP returned string: %lu bytes required\n"),(unsigned long int)str_out_len);
+                       debuga(__FILE__,__LINE__,_("Not enough memory to convert a LDAP returned string: %lu bytes required\n"),(unsigned long int)str_out_len);
                        exit(EXIT_FAILURE);
                }
                ldapconvbuffer = str_out;
@@ -237,20 +237,20 @@ const char * charset_convert( const char * str_in, const char * charset_to )
        return_value = iconv(ldapiconv, (ICONV_CONST char **)&str_in, &str_in_len, &str_out, &str_out_len );
        if ( return_value == ( size_t ) -1 ) {
                /* TRANSLATORS: The message is followed by the reason for the failure. */
-               debuga(_("iconv failed on string \"%s\":\n"),str_in_orig);
+               debuga(__FILE__,__LINE__,_("iconv failed on string \"%s\":\n"),str_in_orig);
                switch ( errno ) {
                        /* See "man 3 iconv" for an explanation. */
                        case EILSEQ:
-                               debuga(_("Invalid multibyte sequence.\n"));
+                               debuga(__FILE__,__LINE__,_("Invalid multibyte sequence.\n"));
                                break;
                        case EINVAL:
-                               debuga(_("Incomplete multibyte sequence.\n"));
+                               debuga(__FILE__,__LINE__,_("Incomplete multibyte sequence.\n"));
                                break;
                        case E2BIG:
-                               debuga(_("No more room.\n"));
+                               debuga(__FILE__,__LINE__,_("No more room.\n"));
                                break;
                        default:
-                               debuga(_("Error: %s.\n"),strerror( errno ));
+                               debuga(__FILE__,__LINE__,_("Error: %s.\n"),strerror( errno ));
                }
                exit(EXIT_FAILURE);
        }
@@ -313,7 +313,7 @@ static void get_ldap_name(const char *userlogin,char *mappedname,int namelen)
        attrs[1]=NULL;
        rc= ldap_search_ext_s(ldap_handle, LDAPBaseSearch, LDAP_SCOPE_SUBTREE, filtersearch, attrs, 0, NULL, NULL, NULL, -1, &result);
        if (rc != LDAP_SUCCESS) {
-               debuga(_("LDAP search failed: %s\nlooking for \"%s\" at or below \"%s\"\n"), ldap_err2string(rc),filtersearch,LDAPBaseSearch);
+               debuga(__FILE__,__LINE__,_("LDAP search failed: %s\nlooking for \"%s\" at or below \"%s\"\n"), ldap_err2string(rc),filtersearch,LDAPBaseSearch);
                safe_strcpy(mappedname,userlogin,namelen);
                return;
        }
@@ -346,18 +346,18 @@ void init_usertab(const char *UserTabFile)
        if (strcmp(UserTabFile, "ldap") == 0) {
                if(debug) {
                        /* TRANSLATORS: The %s may be the string "ldap" or a file name.*/
-                       debuga(_("Loading User table from \"%s\"\n"),UserTabFile);
+                       debuga(__FILE__,__LINE__,_("Loading User table from \"%s\"\n"),UserTabFile);
                }
 #ifdef HAVE_LDAP_H
                which_usertab=UTT_Ldap;
                init_ldap_usertab();
 #else
-               debuga(_("LDAP module not compiled in sarg\n"));
+               debuga(__FILE__,__LINE__,_("LDAP module not compiled in sarg\n"));
                exit(EXIT_FAILURE);
 #endif //HAVE_LDAP_H
        } else if (UserTabFile[0] != '\0') {
                if(debug)
-                       debuga(_("Loading User table from \"%s\"\n"),UserTabFile);
+                       debuga(__FILE__,__LINE__,_("Loading User table from \"%s\"\n"),UserTabFile);
                which_usertab=UTT_File;
                init_file_usertab(UserTabFile);
        } else {
diff --git a/util.c b/util.c
index 5adc7e136aecf5032ae32c6947939590a6fb9b80..d350c342c325938b27f7e5d943516f06ddc45196 100644 (file)
--- a/util.c
+++ b/util.c
@@ -62,7 +62,7 @@ static void getword_backtrace(void)
        if (n<=0) return;
        calls=backtrace_symbols(buffer,n);
        if (calls) {
-               debuga(_("getword backtrace:\n"));
+               debuga(__FILE__,__LINE__,_("getword backtrace:\n"));
                for (i=0 ; i<n ; i++) {
                        fprintf(stderr,"SARG: %d:%s\n",i+1,calls[i]);
                }
@@ -81,7 +81,7 @@ void getword_start(struct getwordstruct *gwarea, const char *line)
 void getword_restart(struct getwordstruct *gwarea)
 {
        if (gwarea->modified) {
-               debuga(_("Cannot parse again the line as it was modified\n"));
+               debuga(__FILE__,__LINE__,_("Cannot parse again the line as it was modified\n"));
                exit(EXIT_FAILURE);
        }
        gwarea->current=gwarea->beginning;
@@ -97,10 +97,10 @@ int getword(char *word, int limit, struct getwordstruct *gwarea, char stop)
                         TRANSLATORS: The %s is the name of the function reporting the
                         error message.
                         */
-                       debuga(_("End of word not found in %s after %d bytes.\n"),__func__,x);
-                       debuga(_("Line=\"%s\"\n"),gwarea->beginning);
-                       debuga(_("Record=\"%s\"\n"),gwarea->current);
-                       debuga(_("searching for \'x%x\'\n"),stop);
+                       debuga(__FILE__,__LINE__,_("End of word not found in %s after %d bytes.\n"),__func__,x);
+                       debuga(__FILE__,__LINE__,_("Line=\"%s\"\n"),gwarea->beginning);
+                       debuga(__FILE__,__LINE__,_("Record=\"%s\"\n"),gwarea->current);
+                       debuga(__FILE__,__LINE__,_("searching for \'x%x\'\n"),stop);
                        word[(limit>0) ? limit-1 : 0]='\0';
 #if USE_GETWORD_BACKTRACE
                        getword_backtrace();
@@ -137,10 +137,10 @@ int getword_multisep(char *word, int limit, struct getwordstruct *gwarea, char s
 
        for(x=0;((gwarea->current[x]) && (gwarea->current[x] != stop ));x++) {
                if(x>=limit) {
-                       debuga(_("End of word not found in %s after %d bytes.\n"),__func__,x);
-                       debuga(_("Line=\"%s\"\n"),gwarea->beginning);
-                       debuga(_("Record=\"%s\"\n"),gwarea->current);
-                       debuga(_("searching for \'x%x\'\n"),stop);
+                       debuga(__FILE__,__LINE__,_("End of word not found in %s after %d bytes.\n"),__func__,x);
+                       debuga(__FILE__,__LINE__,_("Line=\"%s\"\n"),gwarea->beginning);
+                       debuga(__FILE__,__LINE__,_("Record=\"%s\"\n"),gwarea->current);
+                       debuga(__FILE__,__LINE__,_("searching for \'x%x\'\n"),stop);
                        if (limit>0) word[limit-1]='\0';
 #if USE_GETWORD_BACKTRACE
                        getword_backtrace();
@@ -163,10 +163,10 @@ int getword_skip(int limit, struct getwordstruct *gwarea, char stop)
 
        for(x=0;(gwarea->current[x] && (gwarea->current[x] != stop ));x++) {
                if(x>=limit) {
-                       debuga(_("End of word not found in %s after %d bytes.\n"),__func__,x);
-                       debuga(_("Line=\"%s\"\n"),gwarea->beginning);
-                       debuga(_("Record=\"%s\"\n"),gwarea->current);
-                       debuga(_("searching for \'x%x\'\n"),stop);
+                       debuga(__FILE__,__LINE__,_("End of word not found in %s after %d bytes.\n"),__func__,x);
+                       debuga(__FILE__,__LINE__,_("Line=\"%s\"\n"),gwarea->beginning);
+                       debuga(__FILE__,__LINE__,_("Record=\"%s\"\n"),gwarea->current);
+                       debuga(__FILE__,__LINE__,_("searching for \'x%x\'\n"),stop);
 #if USE_GETWORD_BACKTRACE
                        getword_backtrace();
 #endif
@@ -199,7 +199,7 @@ int getword_atoll(long long int *number, struct getwordstruct *gwarea, char stop
                         TRANSLATORS: The first %s is the function name (in the source code) where the
                         overflow is detected.
                        */
-                       debuga(_("Integer overflow detected in %s in line %s\n"),__func__,gwarea->beginning);
+                       debuga(__FILE__,__LINE__,_("Integer overflow detected in %s in line %s\n"),__func__,gwarea->beginning);
                        return(-1);
                }
                *number=(*number * 10) + digit;
@@ -208,10 +208,10 @@ int getword_atoll(long long int *number, struct getwordstruct *gwarea, char stop
                /*
                 TRANSLATORS: The %s is the function name, in the source code, where the problem occured.
                */
-               debuga(_("End of number not found in %s after %d bytes.\n"),__func__,x);
-               debuga(_("Line=\"%s\"\n"),gwarea->beginning);
-               debuga(_("Record=\"%s\"\n"),gwarea->current);
-               debuga(_("searching for \'x%x\'\n"),stop);
+               debuga(__FILE__,__LINE__,_("End of number not found in %s after %d bytes.\n"),__func__,x);
+               debuga(__FILE__,__LINE__,_("Line=\"%s\"\n"),gwarea->beginning);
+               debuga(__FILE__,__LINE__,_("Record=\"%s\"\n"),gwarea->current);
+               debuga(__FILE__,__LINE__,_("searching for \'x%x\'\n"),stop);
 #if USE_GETWORD_BACKTRACE
                getword_backtrace();
 #endif
@@ -240,16 +240,16 @@ int getword_atoi(int *number, struct getwordstruct *gwarea, char stop)
        for(x=0;isdigit(gwarea->current[x]);x++) {
                digit=gwarea->current[x]-'0';
                if (*number > (INT_MAX-digit)/10) {
-                       debuga(_("Integer overflow detected in %s in line %s\n"),__func__,gwarea->beginning);
+                       debuga(__FILE__,__LINE__,_("Integer overflow detected in %s in line %s\n"),__func__,gwarea->beginning);
                        return(-1);
                }
                *number=(*number * 10) + digit;
        }
        if(gwarea->current[x] && gwarea->current[x]!=stop) {
-               debuga(_("End of number not found in %s after %d bytes.\n"),__func__,x);
-               debuga(_("Line=\"%s\"\n"),gwarea->beginning);
-               debuga(_("Record=\"%s\"\n"),gwarea->current);
-               debuga(_("searching for \'x%x\'\n"),stop);
+               debuga(__FILE__,__LINE__,_("End of number not found in %s after %d bytes.\n"),__func__,x);
+               debuga(__FILE__,__LINE__,_("Line=\"%s\"\n"),gwarea->beginning);
+               debuga(__FILE__,__LINE__,_("Record=\"%s\"\n"),gwarea->current);
+               debuga(__FILE__,__LINE__,_("searching for \'x%x\'\n"),stop);
 #if USE_GETWORD_BACKTRACE
                getword_backtrace();
 #endif
@@ -278,16 +278,16 @@ int getword_atol(long int *number, struct getwordstruct *gwarea, char stop)
        for(x=0;isdigit(gwarea->current[x]);x++) {
                digit=gwarea->current[x]-'0';
                if (*number > (LONG_MAX-digit)/10) {
-                       debuga(_("Integer overflow detected in %s in line %s\n"),__func__,gwarea->beginning);
+                       debuga(__FILE__,__LINE__,_("Integer overflow detected in %s in line %s\n"),__func__,gwarea->beginning);
                        return(-1);
                }
                *number=(*number * 10) + digit;
        }
        if(gwarea->current[x] && gwarea->current[x]!=stop) {
-               debuga(_("End of number not found in %s after %d bytes.\n"),__func__,x);
-               debuga(_("Line=\"%s\"\n"),gwarea->beginning);
-               debuga(_("Record=\"%s\"\n"),gwarea->current);
-               debuga(_("searching for \'x%x\'\n"),stop);
+               debuga(__FILE__,__LINE__,_("End of number not found in %s after %d bytes.\n"),__func__,x);
+               debuga(__FILE__,__LINE__,_("Line=\"%s\"\n"),gwarea->beginning);
+               debuga(__FILE__,__LINE__,_("Record=\"%s\"\n"),gwarea->current);
+               debuga(__FILE__,__LINE__,_("searching for \'x%x\'\n"),stop);
 #if USE_GETWORD_BACKTRACE
                getword_backtrace();
 #endif
@@ -306,9 +306,9 @@ int getword_atolu(unsigned long int *number, struct getwordstruct *gwarea, char
        int digit;
 
        if (gwarea->current[0] == '-') {
-               debuga(_("getword_atolu got a negative number.\n"));
-               debuga(_("Line=\"%s\"\n"),gwarea->beginning);
-               debuga(_("Record=\"%s\"\n"),gwarea->current);
+               debuga(__FILE__,__LINE__,_("getword_atolu got a negative number.\n"));
+               debuga(__FILE__,__LINE__,_("Line=\"%s\"\n"),gwarea->beginning);
+               debuga(__FILE__,__LINE__,_("Record=\"%s\"\n"),gwarea->current);
                return(-1);
        }
        if (gwarea->current[0] == '+') {
@@ -318,16 +318,16 @@ int getword_atolu(unsigned long int *number, struct getwordstruct *gwarea, char
        for(x=0;isdigit(gwarea->current[x]);x++) {
                digit=gwarea->current[x]-'0';
                if (*number > (ULONG_MAX-digit)/10) {
-                       debuga(_("Integer overflow detected in %s in line %s\n"),__func__,gwarea->beginning);
+                       debuga(__FILE__,__LINE__,_("Integer overflow detected in %s in line %s\n"),__func__,gwarea->beginning);
                        return(-1);
                }
                *number=(*number * 10) + digit;
        }
        if(gwarea->current[x] && gwarea->current[x]!=stop) {
-               debuga(_("End of number not found in %s after %d bytes.\n"),__func__,x);
-               debuga(_("Line=\"%s\"\n"),gwarea->beginning);
-               debuga(_("Record=\"%s\"\n"),gwarea->current);
-               debuga(_("searching for \'x%x\'\n"),stop);
+               debuga(__FILE__,__LINE__,_("End of number not found in %s after %d bytes.\n"),__func__,x);
+               debuga(__FILE__,__LINE__,_("Line=\"%s\"\n"),gwarea->beginning);
+               debuga(__FILE__,__LINE__,_("Record=\"%s\"\n"),gwarea->current);
+               debuga(__FILE__,__LINE__,_("searching for \'x%x\'\n"),stop);
 #if USE_GETWORD_BACKTRACE
                getword_backtrace();
 #endif
@@ -353,7 +353,7 @@ int getword_ptr(char *orig_line,char **word, struct getwordstruct *gwarea, char
        int start;
 
        if (orig_line && orig_line!=gwarea->beginning) {
-               debuga(_("Invalid buffer passed to getword_ptr\n"));
+               debuga(__FILE__,__LINE__,_("Invalid buffer passed to getword_ptr\n"));
                return(-1);
        }
 
@@ -418,14 +418,14 @@ void my_mkdir(const char *name)
        int chars;
 
        if(!is_absolute(name)) {
-               debuga(_("Invalid path (%s). Please, use absolute paths only.\n"),name);
+               debuga(__FILE__,__LINE__,_("Invalid path (%s). Please, use absolute paths only.\n"),name);
                exit(EXIT_FAILURE);
        }
 
        chars=0;
        for (i=0 ; name[i] ; i++) {
                if (i>=sizeof(w0)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s\n",name);
                        exit(EXIT_FAILURE);
                }
@@ -433,7 +433,7 @@ void my_mkdir(const char *name)
                        w0[i] = '\0';
                        if (access(w0, R_OK) != 0) {
                                if (PortableMkDir(w0,0755)) {
-                                       debuga(_("Cannot create directory \"%s\": %s\n"),w0,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot create directory \"%s\": %s\n"),w0,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
                        }
@@ -444,7 +444,7 @@ void my_mkdir(const char *name)
 
        if (access(name, R_OK) != 0) {
                if (PortableMkDir(name,0755)) {
-                       debuga(_("Cannot create directory \"%s\": %s\n"),name,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot create directory \"%s\": %s\n"),name,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
@@ -460,7 +460,7 @@ void my_lltoa(unsigned long long int n, char *s, int ssize, int len)
 
        ssize--;
        if (len>ssize) {
-               debuga(_("The requested number of digits passed to my_lltoa (%d) is bigger than the output buffer size (%d)\n"),len,ssize);
+               debuga(__FILE__,__LINE__,_("The requested number of digits passed to my_lltoa (%d) is bigger than the output buffer size (%d)\n"),len,ssize);
                abort();
        }
 
@@ -559,11 +559,24 @@ Write a debug message to stderr. The message is prefixed by "SARG:" to identify
 \param msg The printf like message to format.
 \param ... The arguments to format in the message.
 */
-void debuga(const char *msg,...)
+void debuga(const char *File,int Line,const char *msg,...)
 {
        va_list ap;
 
-       fputs(_("SARG: "),stderr);
+       if (debugz>=LogLevel_Source) {
+               /* The path is removed because every source file is in the same directory.
+                * There is no point in reporting the full path from the build directory.
+                */
+               const char *ptr=strrchr(File,'/');
+               if (!ptr) ptr=File;
+               /* TRANSLATORS: This is the prefix to stderr messages when the debug level is
+                set to display the source file (%s) and the line number (%d). */
+               fprintf(stderr,_("SARG(%s:%d): "),ptr,Line);
+       } else {
+               /* TRANSLATORS: This is the prefix to stderr messages when the debug level
+                is low. */
+               fputs(_("SARG: "),stderr);
+       }
        va_start(ap,msg);
        vfprintf(stderr,msg,ap);
        va_end(ap);
@@ -591,11 +604,24 @@ Write a debug message to stderr. The message is prefixed by "SARG: (info)".
 \param msg The printf like message to format.
 \param ... The arguments to format in the message.
 */
-void debugaz(const char *msg,...)
+void debugaz(const char *File,int Line,const char *msg,...)
 {
        va_list ap;
 
-       fputs(_("SARG: (info) "),stderr);
+       if (debugz>=LogLevel_Source) {
+               /* The path is removed because every source file is in the same directory.
+                * There is no point in reporting the full path from the build directory.
+                */
+               const char *ptr=strrchr(File,'/');
+               if (!ptr) ptr=File;
+               /* TRANSLATORS: This is the prefix to information messages when the debug level is
+                set to display the source file (%s) and the line number (%d). */
+               fprintf(stderr,_("SARG(%s:%d): (info) "),ptr,Line);
+       } else {
+               /* TRANSLATORS: This is the prefix to information messages when the debug level
+                is low. */
+               fputs(_("SARG: (info) "),stderr);
+       }
        va_start(ap,msg);
        vfprintf(stderr,msg,ap);
        va_end(ap);
@@ -773,13 +799,13 @@ int obtdate(const char *dirname, const char *name, char *data)
        char wdir[MAXLEN];
 
        if (snprintf(wdir,sizeof(wdir),"%s%s/sarg-date",dirname,name)>=sizeof(wdir)) {
-               debuga(_("Buffer too small to store "));
+               debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                debuga_more("%s%s/sarg-date",dirname,name);
                exit(EXIT_FAILURE);
        }
        if ((fp_in = fopen(wdir, "rt")) == 0) {
                if (snprintf(wdir,sizeof(wdir),"%s%s/date",dirname,name)>=sizeof(wdir)) {
-                       debuga(_("Buffer too small to store "));
+                       debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                        debuga_more("%s%s/date",dirname,name);
                        exit(EXIT_FAILURE);
                }
@@ -790,11 +816,11 @@ int obtdate(const char *dirname, const char *name, char *data)
        }
 
        if (!fgets(data,80,fp_in)) {
-               debuga(_("Failed to read the date in file \"%s\"\n"),wdir);
+               debuga(__FILE__,__LINE__,_("Failed to read the date in file \"%s\"\n"),wdir);
                exit(EXIT_FAILURE);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),wdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        fixendofline(data);
@@ -841,13 +867,13 @@ int obtuser(const char *dirname, const char *name)
        int nuser;
 
        if (snprintf(wdir,sizeof(wdir),"%s%s/sarg-users",dirname,name)>=sizeof(wdir)) {
-               debuga(_("Buffer too small to store "));
+               debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                debuga_more("%s%s/sarg-users",dirname,name);
                exit(EXIT_FAILURE);
        }
        if((fp_in=fopen(wdir,"r"))==NULL) {
                if (snprintf(wdir,sizeof(wdir),"%s%s/users",dirname,name)>=sizeof(wdir)) {
-                       debuga(_("Buffer too small to store "));
+                       debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                        debuga_more("%s%s/users",dirname,name);
                        exit(EXIT_FAILURE);
                }
@@ -857,11 +883,11 @@ int obtuser(const char *dirname, const char *name)
        }
 
        if (!fgets(tuser,sizeof(tuser),fp_in)) {
-               debuga(_("Failed to read the number of users in file \"%s\"\n"),wdir);
+               debuga(__FILE__,__LINE__,_("Failed to read the number of users in file \"%s\"\n"),wdir);
                exit(EXIT_FAILURE);
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),wdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        nuser=atoi(tuser);
@@ -884,13 +910,13 @@ void obttotal(const char *dirname, const char *name, int nuser, long long int *t
        *media=0;
 
        if (snprintf(wdir,sizeof(wdir),"%s%s/sarg-general",dirname,name)>=sizeof(wdir)) {
-               debuga(_("Buffer too small to store "));
+               debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                debuga_more("%s%s/sarg-general",dirname,name);
                exit(EXIT_FAILURE);
        }
        if ((fp_in = fopen(wdir, "r")) == 0) {
                if (snprintf(wdir,sizeof(wdir),"%s%s/general",dirname,name)>=sizeof(wdir)) {
-                       debuga(_("Buffer too small to store "));
+                       debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                        debuga_more("%s%s/general",dirname,name);
                        exit(EXIT_FAILURE);
                }
@@ -900,7 +926,7 @@ void obttotal(const char *dirname, const char *name, int nuser, long long int *t
        }
 
        if ((line=longline_create())==NULL) {
-               debuga(_("Not enough memory to read file \"%s\"\n"),wdir);
+               debuga(__FILE__,__LINE__,_("Not enough memory to read file \"%s\"\n"),wdir);
                exit(EXIT_FAILURE);
        }
 
@@ -913,23 +939,23 @@ void obttotal(const char *dirname, const char *name, int nuser, long long int *t
                        continue;
                getword_start(&gwarea,buf);
                if (getword(user,sizeof(user),&gwarea,sep)<0) {
-                       debuga(_("Invalid user in file \"%s\"\n"),wdir);
+                       debuga(__FILE__,__LINE__,_("Invalid user in file \"%s\"\n"),wdir);
                        exit(EXIT_FAILURE);
                }
                if(strcmp(user,"TOTAL") != 0)
                        continue;
                if (getword_skip(MAXLEN,&gwarea,sep)<0) {
-                       debuga(_("Invalid total number of accesses in file \"%s\"\n"),wdir);
+                       debuga(__FILE__,__LINE__,_("Invalid total number of accesses in file \"%s\"\n"),wdir);
                        exit(EXIT_FAILURE);
                }
                if (getword_atoll(tbytes,&gwarea,sep)<0) {
-                       debuga(_("Invalid number of bytes in file \"%s\"\n"),wdir);
+                       debuga(__FILE__,__LINE__,_("Invalid number of bytes in file \"%s\"\n"),wdir);
                        exit(EXIT_FAILURE);
                }
                break;
        }
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),wdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),wdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
        longline_destroy(&line);
@@ -1097,36 +1123,36 @@ static void copy_images(void)
        struct stat info;
 
        if (snprintf(images,sizeof(images),"%simages",outdir)>=sizeof(images)) {
-               debuga(_("Cannot copy images to target directory %simages\n"),outdir);
+               debuga(__FILE__,__LINE__,_("Cannot copy images to target directory %simages\n"),outdir);
                exit(EXIT_FAILURE);
        }
        if (access(images,R_OK)!=0) {
                if (PortableMkDir(images,0755)) {
-                       debuga(_("Cannot create directory \"%s\": %s\n"),images,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot create directory \"%s\": %s\n"),images,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
 
        dirp = opendir(ImageDir);
        if(dirp==NULL) {
-               debuga(_("Cannot open directory \"%s\": %s\n"),ImageDir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open directory \"%s\": %s\n"),ImageDir,strerror(errno));
                return;
        }
        while ((direntp = readdir( dirp )) != NULL ){
                if(direntp->d_name[0]=='.')
                        continue;
                if (snprintf(srcfile,sizeof(srcfile),"%s/%s",ImageDir,direntp->d_name)>=sizeof(srcfile)) {
-                       debuga(_("Buffer too small to store "));
+                       debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                        debuga_more("%s/%s",ImageDir,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
                if (stat(srcfile,&info)) {
-                       debuga(_("Cannot stat \"%s\": %s\n"),srcfile,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot stat \"%s\": %s\n"),srcfile,strerror(errno));
                        continue;
                }
                if (S_ISREG(info.st_mode)) {
                        if (snprintf(dstfile,sizeof(dstfile),"%s/%s",images,direntp->d_name)>=sizeof(dstfile)) {
-                               debuga(_("Buffer too small to store "));
+                               debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                                debuga_more("%s/%s",images,direntp->d_name);
                                exit(EXIT_FAILURE);
                        }
@@ -1136,22 +1162,22 @@ static void copy_images(void)
                                if(img_ou!=NULL) {
                                        while ((nread = fread(buffer,1,sizeof(buffer),img_in))>0) {
                                                if (fwrite(buffer,1,nread,img_ou)!=nread) {
-                                                       debuga(_("Failed to copy image %s to %s\n"),srcfile,dstfile);
+                                                       debuga(__FILE__,__LINE__,_("Failed to copy image %s to %s\n"),srcfile,dstfile);
                                                        break;
                                                }
                                        }
                                        if (fclose(img_ou)==EOF) {
-                                               debuga(_("Write error in \"%s\": %s\n"),dstfile,strerror(errno));
+                                               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),dstfile,strerror(errno));
                                                exit(EXIT_FAILURE);
                                        }
                                } else
-                                       debuga(_("Cannot open file \"%s\": %s\n"), dstfile, strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"), dstfile, strerror(errno));
                                if (fclose(img_in)==EOF) {
-                                       debuga(_("Read error in \"%s\": %s\n"),srcfile,strerror(errno));
+                                       debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),srcfile,strerror(errno));
                                        exit(EXIT_FAILURE);
                                }
                        } else
-                               debuga(_("Cannot open file \"%s\": %s\n"), srcfile, strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"), srcfile, strerror(errno));
                }
        }
        (void) closedir(dirp);
@@ -1400,7 +1426,7 @@ int vrfydir(const struct periodstruct *per1, const char *addr, const char *site,
 
                        if(count > 0) {
                                if(debug)
-                                       debuga(_("File %s already exists, moved to %s\n"),outdirname,wdir);
+                                       debuga(__FILE__,__LINE__,_("File %s already exists, moved to %s\n"),outdirname,wdir);
                                rename(outdirname,wdir);
                        }
                } else {
@@ -1423,7 +1449,7 @@ int vrfydir(const struct periodstruct *per1, const char *addr, const char *site,
 
                        if(count > 0) {
                                if(debug)
-                                       debuga(_("File %s already exists, moved to %s\n"),dirname2,wdir);
+                                       debuga(__FILE__,__LINE__,_("File %s already exists, moved to %s\n"),dirname2,wdir);
                                rename(dirname2,wdir);
                                strcpy(dirname2,wdir);
                        }
@@ -1440,12 +1466,12 @@ int vrfydir(const struct periodstruct *per1, const char *addr, const char *site,
        strcpy(dirname2,wdir);
 
        if (snprintf(wdir,sizeof(wdir),"%s/sarg-date",outdirname)>=sizeof(wdir)) {
-               debuga(_("Buffer too small to store "));
+               debuga(__FILE__,__LINE__,_("Buffer too small to store "));
                debuga_more("%s/sarg-date",outdirname);
                exit(EXIT_FAILURE);
        }
        if ((fp_ou = fopen(wdir, "wt")) == 0) {
-               debuga(_("Cannot open file \"%s\": %s\n"),wdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),wdir,strerror(errno));
                perror("SARG:");
                exit(EXIT_FAILURE);
        }
@@ -1454,12 +1480,12 @@ int vrfydir(const struct periodstruct *per1, const char *addr, const char *site,
        loctm=localtime(&curtime);
        strftime(wdir,sizeof(wdir),"%Y-%m-%d %H:%M:%S",loctm);
        if (fprintf(fp_ou,"%s %d\n",wdir,loctm->tm_isdst)<0) {
-               debuga(_("Failed to write the date in %s\n"),wdir);
+               debuga(__FILE__,__LINE__,_("Failed to write the date in %s\n"),wdir);
                perror("SARG:");
                exit(EXIT_FAILURE);
        }
        if (fclose(fp_ou)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),wdir,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),wdir,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
@@ -1479,7 +1505,7 @@ int vrfydir(const struct periodstruct *per1, const char *addr, const char *site,
 void safe_strcpy(char *dest,const char *src,int length)
 {
        if (length<=0) {
-               debuga(_("Invalid buffer length passed to the function to safely copy a string\n"));
+               debuga(__FILE__,__LINE__,_("Invalid buffer length passed to the function to safely copy a string\n"));
                exit(EXIT_FAILURE);
        }
        strncpy(dest,src,length-1);
@@ -1558,16 +1584,16 @@ void date_from(char *date,int date_size, int *dfrom, int *duntil)
                int next=-1;
 
                if (sscanf(date,"%d/%d/%d%n",&d0,&m0,&y0,&next)!=3 || y0<100 || m0<1 || m0>12 || d0<1 || d0>31 || next<0) {
-                       debuga(_("The date passed as argument is not formated as dd/mm/yyyy or dd/mm/yyyy-dd/mm/yyyy\n"));
+                       debuga(__FILE__,__LINE__,_("The date passed as argument is not formated as dd/mm/yyyy or dd/mm/yyyy-dd/mm/yyyy\n"));
                        exit(EXIT_FAILURE);
                }
                if (date[next]=='-') {
                        if (sscanf(date+next+1,"%d/%d/%d",&d1,&m1,&y1)!=3 || y1<100 || m1<1 || m1>12 || d1<1 || d1>31) {
-                               debuga(_("The date range passed as argument is not formated as dd/mm/yyyy or dd/mm/yyyy-dd/mm/yyyy\n"));
+                               debuga(__FILE__,__LINE__,_("The date range passed as argument is not formated as dd/mm/yyyy or dd/mm/yyyy-dd/mm/yyyy\n"));
                                exit(EXIT_FAILURE);
                        }
                } else if (date[next]!='\0') {
-                       debuga(_("The date range passed as argument is not formated as dd/mm/yyyy or dd/mm/yyyy-dd/mm/yyyy\n"));
+                       debuga(__FILE__,__LINE__,_("The date range passed as argument is not formated as dd/mm/yyyy or dd/mm/yyyy-dd/mm/yyyy\n"));
                        exit(EXIT_FAILURE);
                } else {
                        d1=d0;
@@ -1580,18 +1606,18 @@ void date_from(char *date,int date_size, int *dfrom, int *duntil)
                struct tm *Date0,Date1;
 
                if (time(&Today)==(time_t)-1) {
-                       debuga(_("Failed to get the current time\n"));
+                       debuga(__FILE__,__LINE__,_("Failed to get the current time\n"));
                        exit(EXIT_FAILURE);
                }
                if (sscanf(date,"day-%d",&i)==1) {
                        if (i<0) {
-                               debuga(_("Invalid number of days in -d parameter\n"));
+                               debuga(__FILE__,__LINE__,_("Invalid number of days in -d parameter\n"));
                                exit(EXIT_FAILURE);
                        }
                        Today-=i*24*60*60;
                        Date0=localtime(&Today);
                        if (Date0==NULL) {
-                               debuga(_("Cannot convert local time: %s\n"),strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot convert local time: %s\n"),strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        y0=y1=Date0->tm_year+1900;
@@ -1610,19 +1636,19 @@ void date_from(char *date,int date_size, int *dfrom, int *duntil)
                        time_t WeekBegin;
 
                        if (i<0) {
-                               debuga(_("Invalid number of weeks in -d parameter\n"));
+                               debuga(__FILE__,__LINE__,_("Invalid number of weeks in -d parameter\n"));
                                exit(EXIT_FAILURE);
                        }
                        Date0=localtime(&Today);
                        if (Date0==NULL) {
-                               debuga(_("Cannot convert local time: %s\n"),strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot convert local time: %s\n"),strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        WeekBegin=Today-((Date0->tm_wday-FirstWeekDay+7)%7)*24*60*60;
                        WeekBegin-=i*7*24*60*60;
                        Date0=localtime(&WeekBegin);
                        if (Date0==NULL) {
-                               debuga(_("Cannot convert local time: %s\n"),strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot convert local time: %s\n"),strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        y0=Date0->tm_year+1900;
@@ -1631,7 +1657,7 @@ void date_from(char *date,int date_size, int *dfrom, int *duntil)
                        WeekBegin+=6*24*60*60;
                        Date0=localtime(&WeekBegin);
                        if (Date0==NULL) {
-                               debuga(_("Cannot convert local time: %s\n"),strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot convert local time: %s\n"),strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        y1=Date0->tm_year+1900;
@@ -1639,12 +1665,12 @@ void date_from(char *date,int date_size, int *dfrom, int *duntil)
                        d1=Date0->tm_mday;
                } else if (sscanf(date,"month-%d",&i)==1) {
                        if (i<0) {
-                               debuga(_("Invalid number of months in -d parameter\n"));
+                               debuga(__FILE__,__LINE__,_("Invalid number of months in -d parameter\n"));
                                exit(EXIT_FAILURE);
                        }
                        Date0=localtime(&Today);
                        if (Date0==NULL) {
-                               debuga(_("Cannot convert local time: %s\n"),strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot convert local time: %s\n"),strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                        if (Date0->tm_mon<i%12) {
@@ -1673,7 +1699,7 @@ void date_from(char *date,int date_size, int *dfrom, int *duntil)
                        m1=Date0->tm_mon+1;
                        d1=Date0->tm_mday;
                } else {
-                       debuga(_("Invalid date range passed on command line\n"));
+                       debuga(__FILE__,__LINE__,_("Invalid date range passed on command line\n"));
                        exit(EXIT_FAILURE);
                }
        }
@@ -1724,20 +1750,20 @@ void removetmp(const char *outdir)
                return;
 
        if(debug) {
-               debuga(_("Purging temporary file sarg-general\n"));
+               debuga(__FILE__,__LINE__,_("Purging temporary file sarg-general\n"));
        }
        if (snprintf(filename,sizeof(filename),"%s/sarg-general",outdir)>=sizeof(filename)) {
-               debuga(_("Path too long: "));
+               debuga(__FILE__,__LINE__,_("Path too long: "));
                debuga_more("%s/sarg-period\n",outdir);
                exit(EXIT_FAILURE);
        }
        if((fp_gen=fopen(filename,"w"))==NULL){
-               debuga(_("Cannot open file \"%s\": %s\n"),filename,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),filename,strerror(errno));
                exit(EXIT_FAILURE);
        }
        totalger(fp_gen,filename);
        if (fclose(fp_gen)==EOF) {
-               debuga(_("Write error in \"%s\": %s\n"),filename,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Write error in \"%s\": %s\n"),filename,strerror(errno));
                exit(EXIT_FAILURE);
        }
 }
@@ -1754,27 +1780,27 @@ void load_excludecodes(const char *ExcludeCodes)
                return;
 
        if((fp_in=fopen(ExcludeCodes,"r"))==NULL) {
-               debuga(_("Cannot open file \"%s\": %s\n"),ExcludeCodes,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),ExcludeCodes,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        if (fseek(fp_in, 0, SEEK_END)==-1) {
-               debuga(_("Failed to move till the end of file \"%s\": %s\n"),ExcludeCodes,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Failed to move till the end of file \"%s\": %s\n"),ExcludeCodes,strerror(errno));
                exit(EXIT_FAILURE);
        }
        MemSize = ftell(fp_in);
        if (MemSize<0) {
-               debuga(_("Cannot get the size of file \"%s\"\n"),ExcludeCodes);
+               debuga(__FILE__,__LINE__,_("Cannot get the size of file \"%s\"\n"),ExcludeCodes);
                exit(EXIT_FAILURE);
        }
        if (fseek(fp_in, 0, SEEK_SET)==-1) {
-               debuga(_("Failed to rewind file \"%s\": %s\n"),ExcludeCodes,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Failed to rewind file \"%s\": %s\n"),ExcludeCodes,strerror(errno));
                exit(EXIT_FAILURE);
        }
 
        MemSize+=1;
        if((excludecode=(char *) malloc(MemSize))==NULL) {
-               debuga(_("malloc error (%ld bytes required)\n"),MemSize);
+               debuga(__FILE__,__LINE__,_("malloc error (%ld bytes required)\n"),MemSize);
                exit(EXIT_FAILURE);
        }
        memset(excludecode,0,MemSize);
@@ -1785,7 +1811,7 @@ void load_excludecodes(const char *ExcludeCodes)
                for (i=strlen(data)-1 ; i>=0 && (unsigned char)data[i]<=' ' ; i--) data[i]='\0';
                if (i<0) continue;
                if (Stored+i+2>=MemSize) {
-                       debuga(_("Too many codes to exclude in file \"%s\"\n"),ExcludeCodes);
+                       debuga(__FILE__,__LINE__,_("Too many codes to exclude in file \"%s\"\n"),ExcludeCodes);
                        break;
                }
                strcat(excludecode,data);
@@ -1794,7 +1820,7 @@ void load_excludecodes(const char *ExcludeCodes)
        }
 
        if (fclose(fp_in)==EOF) {
-               debuga(_("Read error in \"%s\": %s\n"),ExcludeCodes,strerror(errno));
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),ExcludeCodes,strerror(errno));
                exit(EXIT_FAILURE);
        }
        return;
@@ -2183,7 +2209,7 @@ void unlinkdir(const char *dir,bool contentonly)
                    (direntp->d_name[1] == '.' && direntp->d_name[2] == '\0')))
                        continue;
                if (snprintf(dname,sizeof(dname),"%s/%s",dir,direntp->d_name)>=sizeof(dname)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/%s\n",dir,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
@@ -2193,25 +2219,25 @@ void unlinkdir(const char *dir,bool contentonly)
                err=stat(dname,&st);
 #endif
                if (err) {
-                       debuga(_("Cannot stat \"%s\": %s\n"),dname,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot stat \"%s\": %s\n"),dname,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                if (S_ISREG(st.st_mode)) {
                        if (unlink(dname)) {
-                               debuga(_("Cannot delete \"%s\": %s\n"),dname,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),dname,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                } else if (S_ISDIR(st.st_mode)) {
                        unlinkdir(dname,0);
                } else {
-                       debuga(_("Don't know how to delete \"%s\" (not a regular file nor a directory)\n"),dname);
+                       debuga(__FILE__,__LINE__,_("Don't know how to delete \"%s\" (not a regular file nor a directory)\n"),dname);
                }
        }
        closedir(dirp);
 
        if (!contentonly) {
                if (rmdir(dir)) {
-                       debuga(_("Cannot delete \"%s\": %s\n"),dir,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),dir,strerror(errno));
                        exit(EXIT_FAILURE);
                }
        }
@@ -2270,14 +2296,14 @@ void emptytmpdir(const char *dir)
                        if (dlen>=elen && strcasecmp(direntp->d_name+dlen-elen,TmpExt[i])==0) break;
                }
                if (i<0) {
-                       debuga(_("Unknown file \"%s\" found in temporary directory \"%s\". It is not one of our files. "
+                       debuga(__FILE__,__LINE__,_("Unknown file \"%s\" found in temporary directory \"%s\". It is not one of our files. "
                        "Please check the temporary directory you gave to sarg. Adjust the path to a safe "
                        "directory or manually delete the content of \"%s\"\n"),direntp->d_name,dir,dir);
                        exit(EXIT_FAILURE);
                }
 
                if (snprintf(dname,sizeof(dname),"%s/%s",dir,direntp->d_name)>=sizeof(dname)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/%s\n",dir,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
@@ -2288,13 +2314,13 @@ void emptytmpdir(const char *dir)
                err=stat(dname,&st);
 #endif
                if (err) {
-                       debuga(_("Cannot stat \"%s\": %s\n"),dname,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot stat \"%s\": %s\n"),dname,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                if (S_ISDIR(st.st_mode)) {
                        unlinkdir(dname,0);
                } else if (!S_ISREG(st.st_mode)) {
-                       debuga(_("Unknown path type for \"%s\". Check temporary directory\n"),dname);
+                       debuga(__FILE__,__LINE__,_("Unknown path type for \"%s\". Check temporary directory\n"),dname);
                        exit(EXIT_FAILURE);
                }
        }
@@ -2313,14 +2339,14 @@ void emptytmpdir(const char *dir)
                        if (dlen>=elen && strcasecmp(direntp->d_name+dlen-elen,TmpExt[i])==0) break;
                }
                if (i<0) {
-                       debuga(_("Unknown file \"%s\" found in temporary directory \"%s\". It is not one of our files. "
+                       debuga(__FILE__,__LINE__,_("Unknown file \"%s\" found in temporary directory \"%s\". It is not one of our files. "
                        "Please check the temporary directory you gave to sarg. Adjust the path to a safe "
                        "directory or manually delete the content of \"%s\"\n"),direntp->d_name,dir,dir);
                        exit(EXIT_FAILURE);
                }
 
                if (snprintf(dname,sizeof(dname),"%s/%s",dir,direntp->d_name)>=sizeof(dname)) {
-                       debuga(_("Path too long: "));
+                       debuga(__FILE__,__LINE__,_("Path too long: "));
                        debuga_more("%s/%s\n",dir,direntp->d_name);
                        exit(EXIT_FAILURE);
                }
@@ -2330,16 +2356,16 @@ void emptytmpdir(const char *dir)
                err=stat(dname,&st);
 #endif
                if (err) {
-                       debuga(_("Cannot stat \"%s\": %s\n"),dname,strerror(errno));
+                       debuga(__FILE__,__LINE__,_("Cannot stat \"%s\": %s\n"),dname,strerror(errno));
                        exit(EXIT_FAILURE);
                }
                if (S_ISREG(st.st_mode)) {
                        if (unlink(dname)) {
-                               debuga(_("Cannot delete \"%s\": %s\n"),dname,strerror(errno));
+                               debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),dname,strerror(errno));
                                exit(EXIT_FAILURE);
                        }
                } else {
-                       debuga(_("Don't know how to delete \"%s\" (not a regular file)\n"),dname);
+                       debuga(__FILE__,__LINE__,_("Don't know how to delete \"%s\" (not a regular file)\n"),dname);
                }
        }
        closedir(dirp);