From: Frédéric Marchal Date: Wed, 3 Mar 2010 19:49:27 +0000 (+0000) Subject: Automated replacement of the translated strings by a gettext macro X-Git-Tag: v2.3-pre2~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c36c73847907ac46064e91c79a8b094da40325cd;p=thirdparty%2Fsarg.git Automated replacement of the translated strings by a gettext macro --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ccc43ab..bcd378e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ SET(SRC util.c log.c report.c topuser.c email.c sort.c html.c totger.c index.c getconf.c usage.c decomp.c ip2name.c useragent.c exclude.c convlog.c totday.c repday.c datafile.c indexonly.c splitlog.c lastlog.c topsites.c siteuser.c css.c - smartfilter.c denied.c authfail.c language.c charset.c + smartfilter.c denied.c authfail.c charset.c squidguard_log.c squidguard_report.c auth.c download.c grepday.c dansguardian_log.c dansguardian_report.c realtime.c btree_cache.c usertab.c userinfo.c) diff --git a/auth.c b/auth.c index 61cf60a..1bcfeee 100644 --- a/auth.c +++ b/auth.c @@ -41,7 +41,7 @@ void htaccess(const struct userinfostruct *uinfo) exit(1); } if((fp_auth=fopen(htname,"w"))==NULL) { - fprintf(stderr, "SARG: (auth) %s: %s - %s\n",text[45],htname,strerror(errno)); + fprintf(stderr, "SARG: (auth) %s: %s - %s\n",_("Cannot open file"),htname,strerror(errno)); exit(1); } diff --git a/authfail.c b/authfail.c index edbdc2a..860505f 100644 --- a/authfail.c +++ b/authfail.c @@ -72,7 +72,7 @@ void authfail_report(void) sprintf(report,"%s/authfail.html",dirname); if ((fp_in = fopen(per, "r")) == 0) { - fprintf(stderr, "SARG: (authfail) %s: %s\n",text[45],per); + fprintf(stderr, "SARG: (authfail) %s: %s\n",_("Cannot open file"),per); exit(1); } if (!fgets(period,sizeof(period),fp_in)) { @@ -89,27 +89,27 @@ void authfail_report(void) exit(1); } if((fp_in=MY_FOPEN(authfail_in,"r"))==NULL) { - fprintf(stderr, "SARG: (authfail) %s: %s\n",text[45],authfail_in); + fprintf(stderr, "SARG: (authfail) %s: %s\n",_("Cannot open file"),authfail_in); debuga(_("sort command: %s"),csort); exit(1); } unlink(tmp4); if((fp_ou=MY_FOPEN(report,"w"))==NULL) { - fprintf(stderr, "SARG: (authfail) %s: %s\n",text[45],report); + fprintf(stderr, "SARG: (authfail) %s: %s\n",_("Cannot open file"),report); exit(1); } write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Authentication Failures")); - fprintf(fp_ou,"%s: %s\n",text[89],period); - fprintf(fp_ou,"%s\n",text[117]); + fprintf(fp_ou,"%s: %s\n",_("Period"),period); + fprintf(fp_ou,"%s\n",_("Authentication Failures")); close_html_header(fp_ou); fputs("
\n",fp_ou); fputs("\n",fp_ou); fputs("\n",fp_ou); fputs("\n",fp_ou); - fprintf(fp_ou,"\n",text[98],text[111],text[110],text[91]); + fprintf(fp_ou,"\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE")); if (longline_prepare(&line)<0) { debuga(_("Not enough memory to read file %s"),authfail_in); diff --git a/convlog.c b/convlog.c index dc24e68..b750ef8 100644 --- a/convlog.c +++ b/convlog.c @@ -44,7 +44,7 @@ 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) { - fprintf(stderr, "SARG: (convlog) %s: %s\n",text[8],arq); + fprintf(stderr, "SARG: (convlog) %s: %s\n",_("Cannot open log file"),arq); exit(1); } diff --git a/dansguardian_log.c b/dansguardian_log.c index cf85e7c..b9ffc28 100644 --- a/dansguardian_log.c +++ b/dansguardian_log.c @@ -86,12 +86,12 @@ void dansguardian_log(void) } if((fp_guard=fopen(DansGuardianConf,"r"))==NULL) { - fprintf(stderr, "SARG: (dansguardian) %s: %s\n",text[8],DansGuardianConf); + fprintf(stderr, "SARG: (dansguardian) %s: %s\n",_("Cannot open log file"),DansGuardianConf); exit(1); } if((fp_ou=MY_FOPEN(guard_in,"a"))==NULL) { - fprintf(stderr, "SARG: (dansguardian) %s: %s\n",text[8],guard_in); + fprintf(stderr, "SARG: (dansguardian) %s: %s\n",_("Cannot open log file"),guard_in); exit(1); } @@ -111,16 +111,16 @@ void dansguardian_log(void) if(debug) { char short_url[1024]; - getword_start(&gwarea,text[7]); + getword_start(&gwarea,_("Reading access log file")); if (getword_limit(short_url,sizeof(short_url),&gwarea,' ')<0 || getword_skip(MAXLEN,&gwarea,' ')<0) { - printf("SARG: Maybe you have a broken record or garbage in your %s entry.\n",text[7]); + printf("SARG: Maybe you have a broken record or garbage in your %s entry.\n",_("Reading access log file")); exit(1); } debuga("%s DansGuardian %s: %s",short_url,gwarea.current,loglocation); } if((fp_in=MY_FOPEN(loglocation,"r"))==NULL) { - fprintf(stderr, "SARG: (dansguardian) %s: %s\n",text[8],loglocation); + fprintf(stderr, "SARG: (dansguardian) %s: %s\n",_("Cannot open log file"),loglocation); exit(1); } @@ -165,7 +165,7 @@ void dansguardian_log(void) if(fp_ou) fclose(fp_ou); if(debug) - debuga("%s: %s",text[54],guard_ou); + debuga("%s: %s",_("Sorting file"),guard_ou); sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 \"%s\" -o \"%s\"",guard_in, guard_ou); cstatus=system(tmp6); diff --git a/dansguardian_report.c b/dansguardian_report.c index ea060f6..6eab779 100644 --- a/dansguardian_report.c +++ b/dansguardian_report.c @@ -61,7 +61,7 @@ void dansguardian_report(void) sprintf(report,"%s/dansguardian.html",dirname); if ((fp_in = fopen(per, "r")) == 0) { - fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",text[45],per); + fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",_("Cannot open file"),per); exit(1); } @@ -72,23 +72,23 @@ void dansguardian_report(void) fclose(fp_in); if((fp_in=MY_FOPEN(dansguardian_in,"r"))==NULL) { - fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",text[8],dansguardian_in); + fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",_("Cannot open log file"),dansguardian_in); exit(1); } if((fp_ou=MY_FOPEN(report,"w"))==NULL) { - fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",text[8],report); + fprintf(stderr, "SARG: (dansguardian_report) %s: %s\n",_("Cannot open log file"),report); exit(1); } write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("DansGuardian")); - fprintf(fp_ou,"\n",text[89],period); - fprintf(fp_ou,"\n",text[128]); + fprintf(fp_ou,"\n",_("Period"),period); + fprintf(fp_ou,"\n",_("DansGuardian")); close_html_header(fp_ou); fputs("
%s%s%s%s
%s%s%s%s
%s: %s
%s
%s: %s
%s
\n",fp_ou); fputs("\n",fp_ou); - fprintf(fp_ou,"\n",text[98],text[111],text[110],text[91],text[129]); + fprintf(fp_ou,"\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE"),_("CAUSE")); while(fgets(buf,sizeof(buf),fp_in)!=NULL) { getword_start(&gwarea,buf); diff --git a/datafile.c b/datafile.c index 968f6b4..317c183 100644 --- a/datafile.c +++ b/datafile.c @@ -97,7 +97,7 @@ void data_file(char *tmp) } if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){ - fprintf(stderr, "SARG: (datafile) %s: %s\n",text[45],tmp); + fprintf(stderr, "SARG: (datafile) %s: %s\n",_("Cannot open file"),tmp); exit(1); } @@ -134,7 +134,7 @@ void data_file(char *tmp) if(strcmp(oldurl,accurl) != 0 || new_user){ strcpy(oldmsg,"OK"); - if(strstr(oldacccode,"DENIED") != 0) strcpy(oldmsg,text[46]); + if(strstr(oldacccode,"DENIED") != 0) strcpy(oldmsg,_("DENIED")); gravatmp(uinfo,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache); strcpy(wdirname,dirname); saverecs(wdirname,uinfo,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache); @@ -178,7 +178,7 @@ void saverecs(char *dirname, const struct userinfostruct *uinfo, long long int n char val[20]; if((fp_ou=MY_FOPEN(DataFile,"a"))==NULL){ - fprintf(stderr, "SARG: (datafile) %s: %s\n",text[45],DataFile); + fprintf(stderr, "SARG: (datafile) %s: %s\n",_("Cannot open file"),DataFile); exit(1); } diff --git a/decomp.c b/decomp.c index e9a3517..c290103 100644 --- a/decomp.c +++ b/decomp.c @@ -34,13 +34,13 @@ void decomp(char *arq, char *zip, const char *tmp) int arqlen; if(access(arq, R_OK) != 0) { - debuga("%s: %s",text[64],arq); + debuga("%s: %s",_("File not found"),arq); exit(1); } arqlen=strlen(arq); if(arqlen>3 && strcmp(arq+arqlen-3,".gz") == 0) { - debuga("%s: %s > %s/sarg/sarg-file.in (zcat)",text[62],arq,tmp); + debuga("%s: %s > %s/sarg/sarg-file.in (zcat)",_("Decompressing log file"),arq,tmp); if (snprintf(cmd,sizeof(cmd),"zcat \"%s\" > \"%s/sarg/sarg-file.in\"",arq,tmp)>=sizeof(cmd)) { fprintf(stderr,"SARG: decompression command too long for log file %s\n",arq); exit(1); @@ -57,7 +57,7 @@ void decomp(char *arq, char *zip, const char *tmp) } if(arqlen>4 && strcmp(arq+arqlen-4,".bz2") == 0) { - debuga("%s: %s > %s/sarg/sarg-file.in (bzcat)",text[62],arq,tmp); + debuga("%s: %s > %s/sarg/sarg-file.in (bzcat)",_("Decompressing log file"),arq,tmp); if (snprintf(cmd,sizeof(cmd),"bzcat \"%s\" > \"%s/sarg/sarg-file.in\"",arq,tmp)>=sizeof(cmd)) { fprintf(stderr,"SARG: decompression command too long for log file %s\n",arq); exit(1); @@ -74,7 +74,7 @@ void decomp(char *arq, char *zip, const char *tmp) } if(arqlen>2 && strcmp(arq+arqlen-2,".Z") == 0) { - debuga("%s: %s (uncompress)",text[62],arq); + debuga("%s: %s (uncompress)",_("Decompressing log file"),arq); if (snprintf(cmd,sizeof(cmd),"zcat \"%s\" > \"%s/sarg/sarg-file.in\"",arq,tmp)>=sizeof(cmd)) { fprintf(stderr,"SARG: decompression command too long for log file %s\n",arq); exit(1); @@ -100,7 +100,7 @@ void recomp(const char *arq, const char *zip) int cstatus; if(access(arq, R_OK) != 0) { - debuga("%s: %s",text[64],arq); + debuga("%s: %s",_("File not found"),arq); exit(1); } @@ -108,7 +108,7 @@ void recomp(const char *arq, const char *zip) (strcmp(zip,"compress") != 0)) return; - debuga("%s: %s",text[63],arq); + debuga("%s: %s",_("Compressing log file"),arq); if (snprintf(cmd,sizeof(cmd),"%s \"%s\"",zip,arq)>=sizeof(cmd)) { fprintf(stderr,"SARG: compression command too long for log file %s\n",arq); diff --git a/denied.c b/denied.c index 0dd41eb..882325f 100644 --- a/denied.c +++ b/denied.c @@ -65,7 +65,7 @@ void gen_denied_report(void) sprintf(report,"%s/denied.html",dirname); if ((fp_in = fopen(per, "r")) == 0) { - fprintf(stderr, "SARG: (denied) %s: %s\n",text[45],per); + fprintf(stderr, "SARG: (denied) %s: %s\n",_("Cannot open file"),per); exit(1); } @@ -76,23 +76,23 @@ void gen_denied_report(void) fclose(fp_in); if((fp_in=MY_FOPEN(denied_in,"r"))==NULL) { - fprintf(stderr, "SARG: (denied) %s: %s\n",text[8],denied_in); + fprintf(stderr, "SARG: (denied) %s: %s\n",_("Cannot open log file"),denied_in); exit(1); } if((fp_ou=MY_FOPEN(report,"w"))==NULL) { - fprintf(stderr, "SARG: (denied) %s: %s\n",text[8],report); + fprintf(stderr, "SARG: (denied) %s: %s\n",_("Cannot open log file"),report); exit(1); } write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("DENIED")); - fprintf(fp_ou,"\n",text[89],period); - fprintf(fp_ou,"\n",text[46]); + fprintf(fp_ou,"\n",_("Period"),period); + fprintf(fp_ou,"\n",_("DENIED")); close_html_header(fp_ou); fputs("
%s%s%s%s%s
%s%s%s%s%s
%s: %s
%s
%s: %s
%s
\n",fp_ou); fputs("\n",fp_ou); - fprintf(fp_ou,"\n",text[98],text[111],text[110],text[91]); + fprintf(fp_ou,"\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE")); if (longline_prepare(&line)<0) { debuga(_("Not enough memory to read the denied accesses")); diff --git a/download.c b/download.c index fc22cf8..cd50b0e 100644 --- a/download.c +++ b/download.c @@ -70,7 +70,7 @@ void download_report(void) strcat(wdirname,"sarg-period"); if ((fp_in = fopen(wdirname, "r")) == 0) { - fprintf(stderr, "SARG: (download) %s: %s\n",text[45],wdirname); + fprintf(stderr, "SARG: (download) %s: %s\n",_("Cannot open file"),wdirname); exit(1); } @@ -81,23 +81,23 @@ void download_report(void) fclose(fp_in); if((fp_in=MY_FOPEN(report_in,"r"))==NULL) { - fprintf(stderr, "SARG: (download) %s: %s\n",text[8],report_in); + fprintf(stderr, "SARG: (download) %s: %s\n",_("Cannot open log file"),report_in); exit(1); } if((fp_ou=MY_FOPEN(report,"w"))==NULL) { - fprintf(stderr, "SARG: (download) %s: %s\n",text[8],report); + fprintf(stderr, "SARG: (download) %s: %s\n",_("Cannot open log file"),report); exit(1); } write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Downloads")); - fprintf(fp_ou,"\n",text[89],period); - fprintf(fp_ou,"\n",text[125]); + fprintf(fp_ou,"\n",_("Period"),period); + fprintf(fp_ou,"\n",_("Downloads")); close_html_header(fp_ou); fputs("
%s%s%s%s
%s%s%s%s
%s: %s
%s
%s: %s
%s
\n",fp_ou); fputs("\n",fp_ou); - fprintf(fp_ou,"\n",text[98],text[111],text[110],text[91]); + fprintf(fp_ou,"\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE")); if (longline_prepare(&line)<0) { debuga(_("Not enough memory to read the downloaded files")); diff --git a/email.c b/email.c index 7ec36a9..75a3c8f 100644 --- a/email.c +++ b/email.c @@ -60,17 +60,17 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, con strcat(tusr,"/sarg-users"); if((fp_in=fopen(wger,"r"))==NULL) { - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],wger); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),wger); exit(1); } if((fp_top1=fopen(top1,"w"))==NULL) { - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top1); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),top1); exit(1); } if((fp_top2=fopen(top2,"w"))==NULL) { - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top2); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),top2); exit(1); } @@ -134,7 +134,7 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, con unlink(top2); if((fp_top1=fopen(top1,"a"))==NULL) { - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top1); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),top1); exit(1); } #if defined(__FreeBSD__) @@ -154,7 +154,7 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, con strcat(arqper,"/sarg-period"); if ((fp_in = fopen(arqper, "r")) == 0){ - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],arqper); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),arqper); exit(1); } @@ -165,40 +165,40 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, con fclose(fp_in); if((fp_top1=fopen(top1,"r"))==NULL) { - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top1); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),top1); exit(1); } if((fp_top3=fopen(top3,"w"))==NULL) { - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top3); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),top3); exit(1); } - strcpy(strip1,text[88]); + strcpy(strip1,_("Squid User Access Report")); strip_latin(strip1); fprintf(fp_top3,"%s\n",strip1); - strcpy(strip1,text[97]); + strcpy(strip1,_("Decreasing Access (bytes)")); strip_latin(strip1); fprintf(fp_top3,"%s\n",strip1); - strcpy(strip1,text[89]); + strcpy(strip1,_("Period")); strip_latin(strip1); fprintf(fp_top3,"%s %s\n\n",strip1,period); - strcpy(strip1,text[100]); + strcpy(strip1,_("NUM")); strip_latin(strip1); - strcpy(strip2,text[98]); + strcpy(strip2,_("USERID")); strip_latin(strip2); - strcpy(strip3,text[92]); + strcpy(strip3,_("CONNECT")); strip_latin(strip3); - strcpy(strip4,text[93]); + strcpy(strip4,_("BYTES")); strip_latin(strip4); - strcpy(strip5,text[94]); + strcpy(strip5,_("ELAPSED TIME")); strip_latin(strip5); - strcpy(strip6,text[95]); + strcpy(strip6,_("MILISEC")); strip_latin(strip6); - strcpy(strip7,text[99]); + strcpy(strip7,_("TIME")); strip_latin(strip7); fprintf(fp_top3,"%-7s %-20s %-8s %-15s %%%-6s %-10s %-10s %%%-7s\n------- -------------------- -------- --------------- ------- ---------- ---------- -------\n",strip1,strip2,strip3,strip4,strip4,strip5,strip6,strip7); @@ -231,11 +231,11 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, con if(strcmp(user,"TOTAL") == 0){ fputs("------- -------------------- -------- --------------- ------- ---------- ---------- -------\n",fp_top3); #if defined(__FreeBSD__) - fprintf(fp_top3,"%-7s %20s %8qu %15s %8s %9s %10qu\n",text[107]," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap); + fprintf(fp_top3,"%-7s %20s %8qu %15s %8s %9s %10qu\n",_("TOTAL")," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap); #elif defined(__alpha) || __ALPHA - fprintf(fp_top3,"%-7s %20s %8ld %15s %8s %9s %10ld\n",text[107]," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap); + fprintf(fp_top3,"%-7s %20s %8ld %15s %8s %9s %10ld\n",_("TOTAL")," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap); #else - fprintf(fp_top3,"%-7s %20s %8lld %15s %8s %9s %10lld\n",text[107]," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap); + fprintf(fp_top3,"%-7s %20s %8lld %15s %8s %9s %10lld\n",_("TOTAL")," ",ttnacc,fixnum(ttnbytes,1)," ",buildtime(ttnelap),ttnelap); #endif } else { #if defined(__FreeBSD__) @@ -250,7 +250,7 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, con tnbytes=(totuser) ? ttnbytes / totuser : 0; - strcpy(strip1,text[96]); + strcpy(strip1,_("AVERAGE")); strip_latin(strip1); #if defined(__FreeBSD__) fprintf(fp_top3,"%-7s %20s %8qu %15s %8s %9s %10qu\n",strip1," ",ttnacc/totuser,fixnum(tnbytes,1)," ",buildtime(ttnelap/totuser),ttnelap/totuser); @@ -271,14 +271,14 @@ int geramail(const char *dirname, int debug, const char *outdir, int userip, con if(strcmp(email,"stdout") == 0) { if((fp_top3=fopen(top3,"r"))==NULL) { - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],top3); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),top3); exit(1); } while(fgets(buf,sizeof(buf),fp_top3)!=NULL) fputs(buf,stdout); } else { - sprintf(buf,"\"%s\" -s \"SARG %s, %s\" \"%s\" <\"%s\"",MailUtility,text[55],asctime(local),email,top3); + sprintf(buf,"\"%s\" -s \"SARG %s, %s\" \"%s\" <\"%s\"",MailUtility,_("Report"),asctime(local),email,top3); cstatus=system(buf); if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) { fprintf(stderr, "SARG: command return status %d\n",WEXITSTATUS(cstatus)); diff --git a/exclude.c b/exclude.c index 76a15f9..924554d 100644 --- a/exclude.c +++ b/exclude.c @@ -143,10 +143,10 @@ void gethexclude(const char *hexfile, int debug) exit(1); } if(debug) - debuga("%s: %s",text[67],hexfile); + debuga("%s: %s",_("Loading exclude file from"),hexfile); if ((fp_ex = fopen(hexfile, "r")) == NULL) { - fprintf(stderr, "SARG: (gethexclude) %s: %s - %s\n",text[45],hexfile,strerror(errno)); + fprintf(stderr, "SARG: (gethexclude) %s: %s - %s\n",_("Cannot open file"),hexfile,strerror(errno)); exit(1); } @@ -320,10 +320,10 @@ void getuexclude(const char *uexfile, int debug) long int nreg=0; if(debug) - debuga("%s: %s",text[67],uexfile); + debuga("%s: %s",_("Loading exclude file from"),uexfile); if ((fp_ex = fopen(uexfile, "r")) == NULL) { - fprintf(stderr, "SARG: (gethexclude) %s: %s - %s\n",text[45],uexfile,strerror(errno)); + fprintf(stderr, "SARG: (gethexclude) %s: %s - %s\n",_("Cannot open file"),uexfile,strerror(errno)); exit(1); } @@ -337,7 +337,7 @@ void getuexclude(const char *uexfile, int debug) fseek(fp_ex, 0, SEEK_SET); if((excludeuser=(char *) malloc(nreg))==NULL){ - fprintf(stderr, "SARG: %s (%ld):\n",text[59],nreg); + fprintf(stderr, "SARG: %s (%ld):\n",_("malloc error"),nreg); exit(1); } diff --git a/getconf.c b/getconf.c index 2a41a35..9da80f5 100644 --- a/getconf.c +++ b/getconf.c @@ -166,7 +166,7 @@ static int getparam_quoted(const char *param,char *buf,char *value,int value_siz while (*buf && (unsigned char)*buf<=' ') buf++; if (*buf != '\"') { - printf("SARG: %s %s.\n",text[139],param); + printf("SARG: %s %s.\n",_("Missing double quote after parameter"),param); exit(1); } buf++; @@ -450,8 +450,6 @@ static void parmtest(char *buf) if (getparam_bool("long_url",buf,&LongUrl)>0) return; - if (getparam_string("language",buf,language,sizeof(language))>0) return; - if (getparam_string("dansguardian_conf",buf,DansGuardianConf,sizeof(DansGuardianConf))>0) return; if (getparam_string("squidguard_conf",buf,SquidGuardConf,sizeof(SquidGuardConf))>0) return; @@ -601,7 +599,7 @@ static void parmtest(char *buf) return; } - printf("SARG: %s %s\n",text[140],buf); + printf("SARG: %s %s\n",_("Unknown option"),buf); } void getconf(void) @@ -629,6 +627,5 @@ void getconf(void) } fclose(fp_in); - language_load(language); return; } diff --git a/grepday.c b/grepday.c index bdb0623..290df4a 100644 --- a/grepday.c +++ b/grepday.c @@ -55,7 +55,7 @@ static char * I18NgdImageStringFT (gdImage * im, int *brect, int fg, char *fontl sslen = slen * 2; // We assume that UTF8 maximum 2 times large than local sstring = (char *)malloc(sslen); if (!sstring) { - fprintf(stderr, "SARG: %s (%zu):\n",text[59],sslen); + fprintf(stderr, "SARG: %s (%zu):\n",_("malloc error"),sslen); exit(1); } @@ -341,9 +341,9 @@ void greport_day(const struct userinfostruct *uinfo) SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,7,0.0,620,470,ftime); if(ShowSargInfo) SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,10,0.0,257,15,"SARG, "); SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,10,0.0,300,15,Title); - sprintf(warea,"%s: %s",text[89],period); + sprintf(warea,"%s: %s",_("Period"),period); SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,9,0.0,300,27,warea); - sprintf(warea,"%s: %s",text[90],uinfo->label); + sprintf(warea,"%s: %s",_("User"),uinfo->label); SARGgdImageStringFT(im,&brect[0],darkblue,GraphFont,9,0.0,300,38,warea); SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,418," 50K"); SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23,408,"250K"); @@ -382,10 +382,10 @@ void greport_day(const struct userinfostruct *uinfo) SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23, 78," 4G"); SARGgdImageStringFT(im,&brect[0],dimgray,GraphFont,7,0.0,23, 68," 5G"); if(strcmp(datetimeby,"bytes") == 0) - SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,3.14/2,20,248,text[93]); + SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,3.14/2,20,248,_("BYTES")); else - SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,3.14/2,20,248,text[94]); - SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,0.0,330,460,text[127]); + SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,3.14/2,20,248,_("ELAPSED TIME")); + SARGgdImageStringFT(im,&brect[0],black,GraphFont,10,0.0,330,460,_("DAYS")); if (snprintf(graph,sizeof(graph),"%s/%s/graph_day.png",dirname,uinfo->filename)>=sizeof(graph)) { debuga(_("user name too long for: %s/%s/graph_day.png"),dirname,uinfo->filename); @@ -418,12 +418,12 @@ void greport_day(const struct userinfostruct *uinfo) } if((fp_in=fopen(tmp5,"r"))==NULL) { - fprintf(stderr, "SARG: (grepday) %s: %s\n",text[8],tmp5); + fprintf(stderr, "SARG: (grepday) %s: %s\n",_("Cannot open log file"),tmp5); exit(1); } if((pngout=fopen(graph,"wb"))==NULL) { - fprintf(stderr, "SARG: (grepday) %s: %s\n",text[8],graph); + fprintf(stderr, "SARG: (grepday) %s: %s\n",_("Cannot open log file"),graph); exit(1); } diff --git a/html.c b/html.c index 60d84cb..43c2747 100644 --- a/html.c +++ b/html.c @@ -75,7 +75,7 @@ void htmlrel(void) strcpy(arqper,dirname); strcat(arqper,"/sarg-period"); if ((fp_in = fopen(arqper, "r")) == 0){ - fprintf(stderr, "SARG: (html1) %s: %s\n",text[45],arqper); + fprintf(stderr, "SARG: (html1) %s: %s\n",_("Cannot open file"),arqper); exit(1); } if (!fgets(period,sizeof(period),fp_in)) { @@ -87,7 +87,7 @@ void htmlrel(void) strcpy(arqper,dirname); strcat(arqper,"/sarg-general"); if ((fp_in = fopen(arqper, "r")) == 0){ - fprintf(stderr, "SARG: (html2) %s: %s\n",text[45],arqper); + fprintf(stderr, "SARG: (html2) %s: %s\n",_("Cannot open file"),arqper); exit(1); } if (longline_prepare(&line)<0) { @@ -111,7 +111,7 @@ void htmlrel(void) strcpy(arqper,dirname); strcat(arqper,"/sarg-users"); if ((fp_in = fopen(arqper, "r")) == 0){ - fprintf(stderr, "SARG: (html11) %s: %s\n",text[45],arqper); + fprintf(stderr, "SARG: (html11) %s: %s\n",_("Cannot open file"),arqper); exit(1); } if (!fgets(totuser,sizeof(totuser),fp_in)) { @@ -174,7 +174,7 @@ void htmlrel(void) denied_report[0]='\0'; if ((fp_in = fopen(arqin, "r")) == 0){ - fprintf(stderr, "SARG: (html3) %s: %s\n",text[45],arqin); + fprintf(stderr, "SARG: (html3) %s: %s\n",_("Cannot open file"),arqin); exit(1); } @@ -228,45 +228,45 @@ void htmlrel(void) rewind(fp_in); if ((fp_ou = fopen(arqou, "w")) == 0){ - fprintf(stderr, "SARG: (html5) %s: %s\n",text[45],arqou); + fprintf(stderr, "SARG: (html5) %s: %s\n",_("Cannot open file"),arqou); exit(1); } write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 4 : 2,_("User report")); - fprintf(fp_ou,"\n",text[89],period); - fprintf(fp_ou,"\n",text[90],uinfo->label); - fprintf(fp_ou,"\n",text[104],UserSortField,UserSortOrder); - fprintf(fp_ou,"\n",text[32],text[55]); + fprintf(fp_ou,"\n",_("Period"),period); + fprintf(fp_ou,"\n",_("User"),uinfo->label); + fprintf(fp_ou,"\n",_("Sort"),UserSortField,UserSortOrder); + fprintf(fp_ou,"\n",_("User"),_("Report")); //fputs("\n",fp_ou); close_html_header(fp_ou); fputs("
%s%s%s%s
%s%s%s%s
%s: %s
%s: %s
%s: %s, %s
%s %s
%s: %s
%s: %s
%s: %s, %s
%s %s
\n",fp_ou); if(denied_report[0]!='\0') { - fprintf(fp_ou,"\n",denied_report,text[116],text[55]); + fprintf(fp_ou,"\n",denied_report,_("SmartFilter"),_("Report")); } - fprintf(fp_ou,"",text[91]); + fprintf(fp_ou,"",_("ACCESSED SITE")); if((UserReportFields & USERREPORTFIELDS_CONNECT) != 0) - fprintf(fp_ou,"",text[92]); + fprintf(fp_ou,"",_("CONNECT")); if((UserReportFields & USERREPORTFIELDS_BYTES) != 0) - fprintf(fp_ou,"",text[93]); + fprintf(fp_ou,"",_("BYTES")); if((UserReportFields & USERREPORTFIELDS_SETYB) != 0) - fprintf(fp_ou,"",text[93]); + fprintf(fp_ou,"",_("BYTES")); if((UserReportFields & USERREPORTFIELDS_IN_CACHE_OUT) != 0) - fprintf(fp_ou,"",text[113],text[114],text[112]); + fprintf(fp_ou,"",_("IN"),_("CACHE"),_("OUT")); if((UserReportFields & USERREPORTFIELDS_USED_TIME) != 0) - fprintf(fp_ou,"",text[94]); + fprintf(fp_ou,"",_("ELAPSED TIME")); if((UserReportFields & USERREPORTFIELDS_MILISEC) != 0) - fprintf(fp_ou,"",text[95]); + fprintf(fp_ou,"",_("MILISEC")); if((UserReportFields & USERREPORTFIELDS_PTIME) != 0) - fprintf(fp_ou,"",text[99]); + fprintf(fp_ou,"",_("TIME")); fputs("\n",fp_ou); if(debug) { - debuga("%s: %s",text[61],uinfo->id); + debuga("%s: %s",_("Making report"),uinfo->id); } while((buf=longline_read(fp_in,&line))!=NULL) { @@ -309,12 +309,12 @@ void htmlrel(void) strcpy(tmp6,"../../images"); if((ReportType & REPORT_TYPE_SITE_USER_TIME_DATE) != 0) { - s=text[110]; + s=_("DATE/TIME"); for(z1=0 ; z1\"T\"",uinfo->filename,siteind,tmp6,ltext110,text[55]); + fprintf(fp_ou,"",uinfo->filename,siteind,tmp6,ltext110,_("Report")); } else { fprintf(fp_ou,""); } @@ -358,7 +358,7 @@ void htmlrel(void) } if(strncmp(tmsg,"OK",2) != 0) - fprintf(fp_ou,"",text[46]); + fprintf(fp_ou,"",_("DENIED")); fputs("\n",fp_ou); count++; @@ -371,12 +371,12 @@ void htmlrel(void) } if ((fp_ip = fopen(arqip, "r")) == 0){ - fprintf(stderr, "SARG: (html6) %s: %s\n",text[45],arqip); + fprintf(stderr, "SARG: (html6) %s: %s\n",_("Cannot open file"),arqip); exit(1); } if ((fp_ip2 = MY_FOPEN(tmp2, "a")) == 0){ - fprintf(stderr, "SARG: (html7) %s: %s\n",text[45],tmp2); + fprintf(stderr, "SARG: (html7) %s: %s\n",_("Cannot open file"),tmp2); exit(1); } @@ -402,7 +402,7 @@ void htmlrel(void) } if ((fp_ip = MY_FOPEN(tmp3, "r")) == 0) { - fprintf(stderr, "SARG: (html8) %s: %s\n",text[45],tmp3); + fprintf(stderr, "SARG: (html8) %s: %s\n",_("Cannot open file"),tmp3); exit(1); } @@ -475,7 +475,7 @@ void htmlrel(void) unlink(arqin); if((UserReportFields & USERREPORTFIELDS_TOTAL) != 0) { - fprintf(fp_ou,"",text[107]); + fprintf(fp_ou,"",_("TOTAL")); if((UserReportFields & USERREPORTFIELDS_CONNECT) != 0) fprintf(fp_ou,"",fixnum(tnacc,1)); if((UserReportFields & USERREPORTFIELDS_BYTES) != 0) @@ -505,7 +505,7 @@ void htmlrel(void) limit_flag=0; if(access(PerUserLimitFile, R_OK) == 0) { if((fp_usr = fopen(PerUserLimitFile, "r")) == 0) { - fprintf(stderr, "SARG: (html9) %s: %s\n",text[45],PerUserLimitFile); + fprintf(stderr, "SARG: (html9) %s: %s\n",_("Cannot open file"),PerUserLimitFile); exit(1); } while(fgets(tmp6,sizeof(tmp6),fp_usr)!=NULL) { @@ -520,14 +520,14 @@ void htmlrel(void) if(!limit_flag) { if((fp_usr = fopen(PerUserLimitFile, "a")) == 0) { - fprintf(stderr, "SARG: (html10) %s: %s\n",text[45],PerUserLimitFile); + fprintf(stderr, "SARG: (html10) %s: %s\n",_("Cannot open file"),PerUserLimitFile); exit(1); } fprintf(fp_usr,"%s\n",uinfo->label); fclose(fp_usr); if(debug) - debuga("%s %s %s (%d MB). %s %s",text[32],uinfo->label,text[74],PerUserLimit,text[75],PerUserLimitFile); + debuga("%s %s %s (%d MB). %s %s",_("User"),uinfo->label,_("limit exceeded"),PerUserLimit,_("Added to file"),PerUserLimitFile); } } } @@ -541,7 +541,7 @@ void htmlrel(void) totbytes2=totbytes/ntotuser; totelap2=totelap/ntotuser; - fprintf(fp_ou,"",text[96]); + fprintf(fp_ou,"",_("AVERAGE")); if((UserReportFields & USERREPORTFIELDS_CONNECT) != 0) fprintf(fp_ou,"",fixnum(ttnacc/ntotuser,1)); if((UserReportFields & USERREPORTFIELDS_BYTES) != 0) diff --git a/include/conf.h b/include/conf.h index 8cdd5a4..26091c8 100755 --- a/include/conf.h +++ b/include/conf.h @@ -248,7 +248,6 @@ char warea[MAXLEN]; char name[MAXLEN]; int LongUrl; int Ip2Name; -char language[255]; int NAccessLog; char AccessLog[MAXLOGS][MAXLEN]; int AccessLogFromCmdLine; @@ -330,7 +329,6 @@ char AuthType[255]; char Require[512]; char *str; char *str2; -char text[200][255]; char val1[MAXLEN]; char val2[MAXLEN]; char val3[MAXLEN]; diff --git a/include/defs.h b/include/defs.h index e7f95c3..a87a425 100755 --- a/include/defs.h +++ b/include/defs.h @@ -126,9 +126,6 @@ void index_only(const char *dirname,int debug); void ip2name(char *ip,int ip_len); void name2ip(char *name); -// language.c -void language_load(const char *language); - // lastlog.c void mklastlog(const char *outdir); diff --git a/index.c b/index.c index b57d86e..6244694 100644 --- a/index.c +++ b/index.c @@ -46,7 +46,7 @@ void make_index(void) return; } - if(debug) debuga("%s",text[53]); + if(debug) debuga("%s",_("Making index.html")); // convert any old report hierarchy dirp = opendir(outdir); @@ -129,13 +129,13 @@ static void make_date_index(void) order=(strcmp(IndexSortOrder,"A") == 0) ? 1 : -1; if((fp_ou=fopen(yearindex,"w"))==NULL) { - fprintf(stderr, "SARG: (index) %s: %s - %s\n",text[45],yearindex,strerror(errno)); + fprintf(stderr, "SARG: (index) %s: %s - %s\n",_("Cannot open file"),yearindex,strerror(errno)); exit(1); } write_html_header(fp_ou,0,"SARG reports"); close_html_header(fp_ou); fputs("
%s %s
%s %s
%s
%s%s%s%s%s%%%s%%%s%s-%s-%s%s-%s-%s%s%s%s%s%%%s%%%s
\"T\"%s%s
%s
%s%s
%s
%s%s
\n\n",fp_ou); - fprintf(fp_ou,"\n",text[130],text[132]); + fprintf(fp_ou,"\n",_("YEAR"),_("SIZE")); for (y=0 ; y0) year=yearsort[y]; @@ -172,14 +172,14 @@ static void make_date_index(void) (void)closedir(dirp2); sprintf(monthindex,"%s/index.html",yeardir); if((fp_ou2=fopen(monthindex,"w"))==NULL) { - fprintf(stderr, "SARG: (index) %s: %s - %s\n",text[45],monthindex,strerror(errno)); + fprintf(stderr, "SARG: (index) %s: %s - %s\n",_("Cannot open file"),monthindex,strerror(errno)); exit(1); } snprintf(title,sizeof(title),"SARG: report for %04d",year); write_html_header(fp_ou2,1,title); close_html_header(fp_ou2); fputs("
%s%s
%s%s
\n\n",fp_ou2); - fprintf(fp_ou2,"\n",text[130],text[131]); + fprintf(fp_ou2,"\n",_("YEAR"),_("MONTH")); for (m=0 ; m0) month=monthsort[m]; @@ -230,14 +230,14 @@ static void make_date_index(void) (void)closedir(dirp3); sprintf(dayindex,"%s/index.html",monthdir); if((fp_ou3=fopen(dayindex,"w"))==NULL) { - fprintf(stderr, "SARG: (index) %s: %s - %s\n",text[45],dayindex,strerror(errno)); + fprintf(stderr, "SARG: (index) %s: %s - %s\n",_("Cannot open file"),dayindex,strerror(errno)); exit(1); } snprintf(title,sizeof(title),"SARG: report for %04d/%02d",year,month); write_html_header(fp_ou3,2,title); close_html_header(fp_ou3); fputs("
%s/%s
%s/%s
\n\n",fp_ou3); - fprintf(fp_ou3,"\n",text[130],text[131],text[127]); + fprintf(fp_ou3,"\n",_("YEAR"),_("MONTH"),_("DAYS")); for (d=0 ; d0) day=daysort[d]; @@ -390,13 +390,13 @@ static void make_file_index(void) (void)closedir( dirp ); if((fp_ou=fopen(wdir,"w"))==NULL) { - fprintf(stderr, "SARG: (index) %s: %s\n",text[45],wdir); + fprintf(stderr, "SARG: (index) %s: %s\n",_("Cannot open file"),wdir); exit(1); } write_html_header(fp_ou,0,"SARG reports"); close_html_header(fp_ou); fputs("
%s/%s/%s
%s/%s/%s
\n\n",fp_ou); - fprintf(fp_ou,"\n",text[101],text[102],text[103],text[93],text[96]); + fprintf(fp_ou,"\n",_("FILE/PERIOD"),_("CREATION DATE"),_("USERS"),_("BYTES"),_("AVERAGE")); for (i=0 ; i0) item=sortlist[i]; diff --git a/lastlog.c b/lastlog.c index df3137b..f60f143 100644 --- a/lastlog.c +++ b/lastlog.c @@ -48,7 +48,7 @@ void mklastlog(const char *outdir) sprintf(temp,"%slastlog1",outdir); if((fp_ou=fopen(temp,"w"))==NULL) { - fprintf(stderr, "SARG: (lastlog) %s: %s\n",text[9],temp); + fprintf(stderr, "SARG: (lastlog) %s: %s\n",_("Cannot open temporary file"),temp); exit(1); } @@ -90,7 +90,7 @@ void mklastlog(const char *outdir) sprintf(temp,"%slastlog",outdir); if((fp_in=fopen(temp,"r"))==NULL) { - fprintf(stderr, "SARG: (lastlog) %s: %s\n",text[9],temp); + fprintf(stderr, "SARG: (lastlog) %s: %s\n",_("Cannot open temporary file"),temp); exit(1); } @@ -103,7 +103,7 @@ void mklastlog(const char *outdir) } if(debug) - debuga("%s: %s",text[81],gwarea.current); + debuga("%s: %s",_("Removing old report file"),gwarea.current); if (snprintf(temp,sizeof(temp),"%s%s",outdir,gwarea.current)>=sizeof(temp)) { fprintf(stderr,"SARG: Directory name too long: %s%s\n",outdir,gwarea.current); exit(1); diff --git a/log.c b/log.c index ce68b52..857e316 100644 --- a/log.c +++ b/log.c @@ -145,7 +145,7 @@ int main(int argc,char *argv[]) unsigned long recs2=0UL; int OutputNonZero = REPORT_EVERY_X_LINES ; int download_flag=0; - char *download_url; + char *download_url=NULL; struct getwordstruct gwarea; struct longlinestruct line; struct userinfostruct *uinfo; @@ -204,7 +204,6 @@ int main(int argc,char *argv[]) strcpy(TopsitesSortField,"CONNECT"); strcpy(TopsitesSortType,"D"); LongUrl=0; - strcpy(language,"English"); strcpy(FontFace,"Verdana,Tahoma,Arial"); strcpy(datetimeby,"elap"); strcpy(CharSet,"ISO-8859-1"); @@ -338,8 +337,7 @@ int main(int argc,char *argv[]) AccessLog[x][0]='\0'; AccessLogFromCmdLine=0; - language_load(language); - strcpy(Title,text[88]); + strcpy(Title,_("Squid User Access Report")); while((ch = getopt(argc, argv, "a:b:c:d:e:f:g:u:l:L:o:s:t:w:hijmnprvxyz")) != -1){ switch(ch) @@ -594,96 +592,95 @@ int main(int argc,char *argv[]) strcat(tmp6,"/authfail.log.unsort"); if(debug) { - fprintf(stderr, "SARG: %s:\nSARG:\n",text[22]); - fprintf(stderr, "SARG: %35s (-a) = %s\n",text[23],addr); - fprintf(stderr, "SARG: %35s (-b) = %s\n",text[71],uagent); - fprintf(stderr, "SARG: %35s (-c) = %s\n",text[69],hexclude); - fprintf(stderr, "SARG: %35s (-d) = %s\n",text[24],date); - fprintf(stderr, "SARG: %35s (-e) = %s\n",text[41],email); - fprintf(stderr, "SARG: %35s (-f) = %s\n",text[70],ConfigFile); + fprintf(stderr, "SARG: %s:\nSARG:\n",_("Parameters")); + fprintf(stderr, "SARG: %35s (-a) = %s\n",_("Hostname or IP address"),addr); + fprintf(stderr, "SARG: %35s (-b) = %s\n",_("Useragent log"),uagent); + fprintf(stderr, "SARG: %35s (-c) = %s\n",_("Exclude file"),hexclude); + fprintf(stderr, "SARG: %35s (-d) = %s\n",_("Date from-until"),date); + fprintf(stderr, "SARG: %35s (-e) = %s\n",_("Email address to send reports"),email); + fprintf(stderr, "SARG: %35s (-f) = %s\n",_("Config file"),ConfigFile); if(strcmp(df,"e") == 0) - fprintf(stderr, "SARG: %35s (-g) = %s (dd/mm/yyyy)\n",text[25],text[26]); + fprintf(stderr, "SARG: %35s (-g) = %s (dd/mm/yyyy)\n",_("Date format"),_("Europe")); if(strcmp(df,"u") == 0) - fprintf(stderr, "SARG: %35s (-g) = %s (mm/dd/yyyy)\n",text[25],text[27]); + fprintf(stderr, "SARG: %35s (-g) = %s (mm/dd/yyyy)\n",_("Date format"),_("USA")); if(strcmp(df,"w") == 0) - fprintf(stderr, "SARG: %35s (-g) = %s (yyyy/ww)\n",text[25],text[85]); + fprintf(stderr, "SARG: %35s (-g) = %s (yyyy/ww)\n",_("Date format"),_("Sites & Users")); if(iprel) - fprintf(stderr, "SARG: %35s (-i) = %s\n",text[28],text[1]); + fprintf(stderr, "SARG: %35s (-i) = %s\n",_("IP report"),_("Yes")); else - fprintf(stderr, "SARG: %35s (-i) = %s\n",text[28],text[2]); + fprintf(stderr, "SARG: %35s (-i) = %s\n",_("IP report"),_("No")); for (iarq=0 ; iarqfile = MY_FOPEN (tmp3, "a")) == NULL) { - fprintf (stderr, "%s: (log) %s: %s - %s\n", argv[0], text[9], tmp3, strerror(errno)); + fprintf (stderr, "%s: (log) %s: %s - %s\n", argv[0], _("Cannot open temporary file"), tmp3, strerror(errno)); exit (1); } } @@ -1450,7 +1448,7 @@ int main(int argc,char *argv[]) sprintf (tmp3, "%s/sarg/%s.unsort", tmp, user); if ((fp_Write_User = MY_FOPEN (tmp3, "a")) == NULL) { - fprintf (stderr, "%s: (log) %s: %s - %s\n", argv[0], text[9], tmp3, strerror(errno)); + fprintf (stderr, "%s: (log) %s: %s - %s\n", argv[0], _("Cannot open temporary file"), tmp3, strerror(errno)); exit (1); } strcpy( sz_Last_User , user ) ; @@ -1462,12 +1460,12 @@ int main(int argc,char *argv[]) totregsg++; - if(download_flag && strstr(code,"DENIED") == 0) { + if(download_flag && download_url && strstr(code,"DENIED") == 0) { ndownload = 1; if ( ! fp_Download_Unsort ) { if ((fp_Download_Unsort = MY_FOPEN ( sz_Download_Unsort, "a")) == NULL) { - fprintf (stderr, "%s: (log) %s: %s - %s\n", argv[0], text[9], tmp3, strerror(errno)); + fprintf (stderr, "%s: (log) %s: %s - %s\n", argv[0], _("Cannot open temporary file"), tmp3, strerror(errno)); exit (1); } } @@ -1537,25 +1535,25 @@ int main(int argc,char *argv[]) for (ilf=0 ; ilf0 && ilf_count[ILF_Squid]>0) - debuga("%s",text[12]); + debuga("%s",_("Log with mixed records format (squid and common log)")); if(ilf_count[ILF_Common]>0 && ilf_count[ILF_Squid]==0) - debuga("%s",text[13]); + debuga("%s",_("Common log format")); if(ilf_count[ILF_Common]==0 && ilf_count[ILF_Squid]>0) - debuga("%s",text[14]); + debuga("%s",_("Squid log format")); if(ilf_count[ILF_Sarg]>0) - debuga("%s",text[124]); + debuga("%s",_("Sarg log format")); if(totalcount==0) { if(!totregsg) { - fprintf(stderr, "SARG: %s\n",text[16]); - fprintf(stderr, "SARG: %s\n",text[21]); - } else fprintf(stderr, "SARG: %s\n",text[15]); + fprintf(stderr, "SARG: %s\n",_("No records found")); + fprintf(stderr, "SARG: %s\n",_("End")); + } else fprintf(stderr, "SARG: %s\n",_("Log with invalid format")); if(fp_denied) fclose(fp_denied); if(fp_authfail) @@ -1572,8 +1570,8 @@ int main(int argc,char *argv[]) } if(!totregsg){ - fprintf(stderr, "SARG: %s\n",text[16]); - fprintf(stderr, "SARG: %s\n",text[21]); + fprintf(stderr, "SARG: %s\n",_("No records found")); + fprintf(stderr, "SARG: %s\n",_("End")); // fclose(fp_ou); if(fp_denied) fclose(fp_denied); @@ -1597,7 +1595,7 @@ int main(int argc,char *argv[]) } if(debug) - debuga("%s: %s",text[17],period); + debuga("%s: %s",_("Period"),period); // fclose(fp_ou); if(fp_denied) @@ -1638,7 +1636,7 @@ int main(int argc,char *argv[]) } } if(debug) - debuga("%s %s",text[123],arq_log); + debuga("%s %s",_("Sarg parsed log saved as"),arq_log); } if((ReportType & REPORT_TYPE_DENIED) != 0) { @@ -1678,7 +1676,7 @@ int main(int argc,char *argv[]) close_usertab(); if(debug) - debuga("%s",text[21]); + debuga("%s",_("End")); exit(0); @@ -1694,10 +1692,10 @@ static void getusers(const char *pwdfile, int debug) long int nreg=0; if(debug) - debuga("%s: %s",text[60],pwdfile); + debuga("%s: %s",_("Loading password file from"),pwdfile); if ((fp_usr = fopen(pwdfile, "r")) == NULL) { - fprintf(stderr, "SARG: (getusers) %s: %s - %s\n",text[45],pwdfile,strerror(errno)); + fprintf(stderr, "SARG: (getusers) %s: %s - %s\n",_("Cannot open file"),pwdfile,strerror(errno)); exit(1); } @@ -1711,7 +1709,7 @@ static void getusers(const char *pwdfile, int debug) fseek(fp_usr, 0, SEEK_SET); if((userfile=(char *) malloc(nreg))==NULL){ - fprintf(stderr, "SARG: %s (%ld):\n",text[59],nreg); + fprintf(stderr, "SARG: %s (%ld):\n",_("malloc error"),nreg); exit(1); } diff --git a/realtime.c b/realtime.c index f3d0a5b..b07c99b 100755 --- a/realtime.c +++ b/realtime.c @@ -282,7 +282,7 @@ static void header(void) puts("\n"); printf("\n",FontFace,TitleFontSize,BgColor,BgImage); puts("
%s%s%s%s%s
%s%s%s%s%s
\n"); - printf("\n",text[134]); - printf("\n",text[136],realtime_refresh); - printf("\n",text[110],text[111],text[98],text[135],text[91]); + printf("\n",_("Realtime")); + printf("\n",_("Auto refresh"),realtime_refresh); + printf("\n",_("DATE/TIME"),_("IP/NAME"),_("USERID"),_("TYPE"),_("ACCESSED SITE")); } diff --git a/repday.c b/repday.c index 606978b..50dcf5a 100644 --- a/repday.c +++ b/repday.c @@ -62,12 +62,12 @@ void report_day(const struct userinfostruct *uinfo) return; if((fp_in=fopen(wdirname,"r"))==NULL) { - fprintf(stderr, "SARG: (repday) %s: %s\n",text[8],wdirname); + fprintf(stderr, "SARG: (repday) %s: %s\n",_("Cannot open log file"),wdirname); exit(1); } if((fp_ou=fopen(arqout,"w"))==NULL) { - fprintf(stderr, "SARG: (repday) %s: %s\n",text[8],arqout); + fprintf(stderr, "SARG: (repday) %s: %s\n",_("Cannot open log file"),arqout); exit(1); } @@ -75,9 +75,9 @@ void report_day(const struct userinfostruct *uinfo) close_html_header(fp_ou); fputs("
SARG %s
%s: %d s
%s%s%s%s%s
SARG %s
%s: %d s
%s%s%s%s%s
\n",fp_ou); - fprintf(fp_ou,"\n",text[89],period); + fprintf(fp_ou,"\n",_("Period"),period); - fprintf(fp_ou,"\n",text[90],uinfo->label); + fprintf(fp_ou,"\n",_("User"),uinfo->label); fputs("\n",fp_ou); fputs("
%s: %s
%s: %s
%s: %s
%s: %s
\n",fp_ou); @@ -87,14 +87,14 @@ void report_day(const struct userinfostruct *uinfo) fputs( "\n", fp_ou ); if(strcmp(datetimeby,"bytes") == 0) - strcpy( html, text[93] ); + strcpy( html, _("BYTES") ); else strcpy( html, "H:M:S" ); for( i = 0; i < hours.len; i++ ) fprintf( fp_ou, "%02dH
%s\n", hours.list[ i ], html ); fprintf( fp_ou, - "%s
%s\n", text[107], html ); + "%s
%s\n", _("TOTAL"), html ); while(fgets(buf,sizeof(buf),fp_in)!=NULL) { fixendofline(buf); @@ -159,7 +159,7 @@ void report_day(const struct userinfostruct *uinfo) for( i = 0; i < hours.len; i++ ) sprintf(c[ hours.list[ i ] ],"%s",fixtime(t[ hours.list[ i ] ])); - fprintf(fp_ou, "%s\n", text[107] ); + fprintf(fp_ou, "%s\n", _("TOTAL") ); for( i = 0; i < hours.len; i++ ) fprintf(fp_ou, "%s\n", c[ hours.list[ i ] ] ); fprintf(fp_ou, "%s\n", fixtime(ttt) ); diff --git a/report.c b/report.c index f05ae73..d55ce3a 100644 --- a/report.c +++ b/report.c @@ -96,7 +96,7 @@ void gerarel(void) sprintf(wdirname,"%s/sarg-general",dirname); if((fp_gen=MY_FOPEN(wdirname,"w"))==NULL){ - fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname); + fprintf(stderr, "SARG: (report) %s: %s\n",_("Cannot open file"),wdirname); exit(1); } @@ -118,7 +118,7 @@ void gerarel(void) exit(1); } if((fp_in=MY_FOPEN(tmp3,"r"))==NULL){ - fprintf(stderr, "SARG: (report) %s: %s\n",text[45],tmp); + fprintf(stderr, "SARG: (report) %s: %s\n",_("Cannot open file"),tmp); exit(1); } @@ -221,7 +221,7 @@ void gerarel(void) if(new_user){ strcpy(oldmsg,"OK"); if(strstr(oldacccode,"DENIED") != 0) - sprintf(oldmsg,"%s",text[46]); + sprintf(oldmsg,"%s",_("DENIED")); gravatmp(puinfo,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache); gravager(fp_gen,puinfo,nacc,oldurl,nbytes,oldaccip,oldacchora,oldaccdia,nelap,incache,oucache); nacc=0; @@ -233,7 +233,7 @@ void gerarel(void) } else { if(!same_url || new_user){ if(strstr(oldacccode,"DENIED") != 0) - strcpy(oldmsg,text[46]); + strcpy(oldmsg,_("DENIED")); else strcpy(oldmsg,"OK"); gravatmp(puinfo,oldurl,nacc,nbytes,oldmsg,nelap,indexonly,incache,oucache); @@ -259,7 +259,7 @@ void gerarel(void) my_mkdir(arqtt); snprintf(arqtt,sizeof(arqtt),"%s/%s/tt%s-%s.html",dirname,uinfo->filename,uinfo->filename,siteind); if ((fp_tt = fopen(arqtt, "w")) == 0) { - fprintf(stderr, "SARG: (report) %s: %s\n",text[45],arqtt); + fprintf(stderr, "SARG: (report) %s: %s\n",_("Cannot open file"),arqtt); exit(1); } ttopen=1; @@ -273,17 +273,17 @@ void gerarel(void) */ write_html_header(fp_tt,(IndexTree == INDEX_TREE_DATE) ? 4 : 2,_("Site access report")); - fprintf(fp_tt,"%s: %s\n",text[89],period); - fprintf(fp_tt,"%s: %s\n",text[90],uinfo->label); - fprintf(fp_tt,"%s: %s, %s\n",text[104],UserSortField,UserSortOrder); - fprintf(fp_tt,"%s\n",text[32]); + fprintf(fp_tt,"%s: %s\n",_("Period"),period); + fprintf(fp_tt,"%s: %s\n",_("User"),uinfo->label); + fprintf(fp_tt,"%s: %s, %s\n",_("Sort"),UserSortField,UserSortOrder); + fprintf(fp_tt,"%s\n",_("User")); close_html_header(fp_tt); fputs("
\n",fp_tt); fputs("",fp_tt); - strncpy(tmp4,text[110],4); + strncpy(tmp4,_("DATE/TIME"),4); tmp4[4]='\0'; - fprintf(fp_tt,"\n",text[91],tmp4,text[110]+5); + fprintf(fp_tt,"\n",_("ACCESSED SITE"),tmp4,_("DATE/TIME")+5); } fputs("\n",text[89],period); - fprintf(fp_ou,"\n",text[85]); + fprintf(fp_ou,"\n",_("Period"),period); + fprintf(fp_ou,"\n",_("Sites & Users")); close_html_header(fp_ou); fputs("
%s%s%s
%s%s%s
",fp_tt); @@ -345,7 +345,7 @@ void gerarel(void) if (oldurl) { if(strstr(oldacccode,"DENIED") != 0) - strcpy(oldmsg,text[46]); + strcpy(oldmsg,_("DENIED")); else strcpy(oldmsg,"OK"); strcpy(wdirname,dirname); @@ -394,13 +394,13 @@ void gerarel(void) make_index(); - if(SuccessfulMsg) fprintf(stderr, "SARG: %s %s\n",text[47],dirname); + if(SuccessfulMsg) fprintf(stderr, "SARG: %s %s\n",_("Successful report generated on"),dirname); } else { strcpy(wdirname,dirname); geramail(wdirname, debug, outdir, userip, email, TempDir); if((strcmp(email,"stdout") != 0) && SuccessfulMsg) - fprintf(stderr, "SARG: %s %s\n",text[48],email); + fprintf(stderr, "SARG: %s %s\n",_("Successful report generated and sent to"),email); } if(indexonly) { @@ -427,14 +427,14 @@ static void maketmp(const char *user, const char *dirname, int debug, int indexo if(indexonly) return; if((ReportType & REPORT_TYPE_USERS_SITES) == 0) return; - if(debug) debuga("%s: %s/%s",text[49],tmp,user); + if(debug) debuga("%s: %s/%s",_("Making file"),tmp,user); if (snprintf(wdirname,sizeof(wdirname),"%s/%s.utmp",tmp,user)>=sizeof(wdirname)) { debuga(_("Temporary file name too long: %s/%s.utmp"),tmp,user); exit(1); } if((fp_ou=fopen(wdirname,"w"))==NULL){ - fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname); + fprintf(stderr, "SARG: (report) %s: %s\n",_("Cannot open file"),wdirname); exit(1); } @@ -459,7 +459,7 @@ static void maketmp_hour(const char *user, const char *dirname, int indexonly) } if((fp_ou=fopen(wdirname,"w"))==NULL){ - fprintf(stderr, "SARG: (report-1) %s: %s - %s\n",text[45],wdirname,strerror(errno)); + fprintf(stderr, "SARG: (report-1) %s: %s - %s\n",_("Cannot open file"),wdirname,strerror(errno)); exit(1); } @@ -482,7 +482,7 @@ void gravatmp(const struct userinfostruct *uinfo, const char *oldurl, long long } if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){ - fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname); + fprintf(stderr, "SARG: (report) %s: %s\n",_("Cannot open file"),wdirname); exit(1); } @@ -514,7 +514,7 @@ static void gravatmpf(const struct userinfostruct *uinfo,const char *oldurl, lon } if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){ - fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname); + fprintf(stderr, "SARG: (report) %s: %s\n",_("Cannot open file"),wdirname); exit(1); } @@ -548,7 +548,7 @@ static void gravatmp_hora(const char *dirname, const struct userinfostruct *uinf } if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){ - fprintf(stderr, "SARG: (report-2) %s: %s - %s\n",text[45],wdirname,strerror(errno)); + fprintf(stderr, "SARG: (report-2) %s: %s - %s\n",_("Cannot open file"),wdirname,strerror(errno)); exit(1); } @@ -575,7 +575,7 @@ static void gravaporuser(const struct userinfostruct *uinfo, const char *dirname } if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){ - fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname); + fprintf(stderr, "SARG: (report) %s: %s\n",_("Cannot open file"),wdirname); exit(1); } @@ -826,7 +826,7 @@ static void grava_SmartFilter(const char *dirname, const char *user, const char sprintf(wdirname,"%s/smartfilter.unsort",dirname); if((fp_ou=MY_FOPEN(wdirname,"a"))==NULL){ - fprintf(stderr, "SARG: (report) %s: %s\n",text[45],wdirname); + fprintf(stderr, "SARG: (report) %s: %s\n",_("Cannot open file"),wdirname); exit(1); } diff --git a/siteuser.c b/siteuser.c index a8915c6..b4f95d0 100644 --- a/siteuser.c +++ b/siteuser.c @@ -64,7 +64,7 @@ void siteuser(void) sprintf(report,"%s/siteuser.html",dirname); if ((fp_in = fopen(per, "r")) == 0) { - fprintf(stderr, "SARG: (siteuser) %s: %s\n",text[45],per); + fprintf(stderr, "SARG: (siteuser) %s: %s\n",_("Cannot open file"),per); exit(1); } @@ -83,34 +83,34 @@ void siteuser(void) } if((fp_in=fopen(general2,"r"))==NULL) { - fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],general2); + fprintf(stderr, "SARG: (topsite) %s: %s\n",_("Cannot open log file"),general2); debuga(_("sort command: %s"),csort); exit(1); } if((fp_ou=fopen(report,"w"))==NULL) { - fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],report); + fprintf(stderr, "SARG: (topsite) %s: %s\n",_("Cannot open log file"),report); exit(1); } write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Sites & Users")); - fprintf(fp_ou,"
%s: %s
%s
%s: %s
%s
\n",fp_ou); fputs("\n",fp_ou); if(BytesInSitesUsersReport) - fprintf(fp_ou,"\n",text[100],text[91],text[93],text[103]); + fprintf(fp_ou,"\n",_("NUM"),_("ACCESSED SITE"),_("BYTES"),_("USERS")); else - fprintf(fp_ou,"\n",text[100],text[91],text[103]); + fprintf(fp_ou,"\n",_("NUM"),_("ACCESSED SITE"),_("USERS")); ourl=NULL; ourl_size=0; obytes=0; if((users=(char *) malloc(204800))==NULL){ - fprintf(stderr, "SARG: ERROR: %s",text[87]); + fprintf(stderr, "SARG: ERROR: %s",_("Cannot load. Memory fault")); exit(1); } strcpy(users," "); diff --git a/smartfilter.c b/smartfilter.c index bc1f259..1ecb57e 100644 --- a/smartfilter.c +++ b/smartfilter.c @@ -56,7 +56,7 @@ void smartfilter_report(void) ouser[0]='\0'; - sprintf(smartheader,"%s",text[116]); + sprintf(smartheader,"%s",_("SmartFilter")); strup(smartheader); sprintf(smart_in,"%s/smartfilter.unsort",dirname); @@ -66,7 +66,7 @@ void smartfilter_report(void) sprintf(report,"%s/smartfilter.html",dirname); if ((fp_in = fopen(per, "r")) == 0) { - fprintf(stderr, "SARG: (smartfilter) %s: %s\n",text[45],per); + fprintf(stderr, "SARG: (smartfilter) %s: %s\n",_("Cannot open file"),per); exit(1); } @@ -87,14 +87,14 @@ void smartfilter_report(void) exit(1); } if((fp_in=fopen(smart_ou,"r"))==NULL) { - fprintf(stderr, "SARG: (smartfilter) %s: %s\n",text[8],smart_ou); + fprintf(stderr, "SARG: (smartfilter) %s: %s\n",_("Cannot open log file"),smart_ou); debuga(_("sort command: %s"),csort); exit(1); } unlink(smart_in); if((fp_ou=fopen(report,"w"))==NULL) { - fprintf(stderr, "SARG: (smartfilter) %s: %s\n",text[8],report); + fprintf(stderr, "SARG: (smartfilter) %s: %s\n",_("Cannot open log file"),report); exit(1); } @@ -106,15 +106,15 @@ void smartfilter_report(void) write_logo_image(fp_ou); fprintf(fp_ou,"\n",TiColor,Title); - fprintf(fp_ou,"\n",HeaderBgColor,FontSize,text[89],period); - fprintf(fp_ou,"\n",HeaderBgColor,FontSize,text[116]); + fprintf(fp_ou,"\n",HeaderBgColor,FontSize,_("Period"),period); + fprintf(fp_ou,"\n",HeaderBgColor,FontSize,_("SmartFilter")); fputs("
%s%s%s%s
%s%s%s%s
%s%s%s
%s%s%s
%s
%s: %s
%s
%s: %s
%s
\n",fp_ou); fputs("
\n",fp_ou); fputs("\n",fp_ou); fputs("\n",fp_ou); fputs("\n",fp_ou); - fprintf(fp_ou,"\n",HeaderBgColor,FontSize,text[98],HeaderBgColor,FontSize,text[111],HeaderBgColor,FontSize,text[110],HeaderBgColor,FontSize,text[91],HeaderBgColor,FontSize,smartheader); + fprintf(fp_ou,"\n",HeaderBgColor,FontSize,_("USERID"),HeaderBgColor,FontSize,_("IP/NAME"),HeaderBgColor,FontSize,_("DATE/TIME"),HeaderBgColor,FontSize,_("ACCESSED SITE"),HeaderBgColor,FontSize,smartheader); while(fgets(buf,sizeof(buf),fp_in)!=NULL) { getword_start(&gwarea,buf); @@ -138,13 +138,13 @@ void smartfilter_report(void) fputs("
%s%s%s%s%s
%s%s%s%s%s
\n",fp_user); if(ShowSargInfo) { zdate(ftime, sizeof(ftime), DateFormat); - fprintf(fp_user,"

%s %s-%s %s %s
\n",text[108],URL,PGM,VERSION,text[109],ftime); + fprintf(fp_user,"

%s %s-%s %s %s
\n",_("Generated by"),URL,PGM,VERSION,_("on"),ftime); } fputs("\n\n",fp_user); fclose(fp_user); } if ((fp_user = fopen(smartuser, "a")) == 0) { - fprintf(stderr, "SARG: (smartfilter) %s: %s\n",text[45],smartuser); + fprintf(stderr, "SARG: (smartfilter) %s: %s\n",_("Cannot open file"),smartuser); exit(1); } fuser=1; @@ -172,14 +172,14 @@ void smartfilter_report(void) fputs("
\n",fp_user); if(LogoImage[0]!='\0') fprintf(fp_user,"\n",TiColor,Title); - fprintf(fp_user,"\n",HeaderBgColor,FontSize,text[89],period); - fprintf(fp_user,"\n",HeaderBgColor,FontSize,text[90],FontSize,uinfo->label); + fprintf(fp_user,"\n",HeaderBgColor,FontSize,_("Period"),period); + fprintf(fp_user,"\n",HeaderBgColor,FontSize,_("User"),FontSize,uinfo->label); fputs("
%s\n",LogoImage,Width,Height,LogoTextColor,LogoText); fprintf(fp_user,"
%s
%s: %s
%s: %s
%s: %s
%s: %s
\n",fp_user); fputs("
\n",fp_user); fputs("\n",fp_user); fputs("\n",fp_user); fputs("\n",fp_user); - fprintf(fp_user,"\n",HeaderBgColor,FontSize,text[98],HeaderBgColor,FontSize,text[111],HeaderBgColor,FontSize,text[110],HeaderBgColor,FontSize,text[91],HeaderBgColor,FontSize,smartheader); + fprintf(fp_user,"\n",HeaderBgColor,FontSize,_("USERID"),HeaderBgColor,FontSize,_("IP/NAME"),HeaderBgColor,FontSize,_("DATE/TIME"),HeaderBgColor,FontSize,_("ACCESSED SITE"),HeaderBgColor,FontSize,smartheader); } fprintf(fp_user,"\n",TxBgColor,FontSize,uinfo->label,TxBgColor,FontSize,ip,TxBgColor,FontSize,data,hora,TxBgColor,FontSize,url,TxBgColor,FontSize,smartcat); @@ -190,7 +190,7 @@ void smartfilter_report(void) if(ShowSargInfo) { zdate(ftime, sizeof(ftime), DateFormat); - fprintf(fp_ou,"

%s %s-%s %s %s
\n",text[108],URL,PGM,VERSION,text[109],ftime); + fprintf(fp_ou,"

%s %s-%s %s %s
\n",_("Generated by"),URL,PGM,VERSION,_("on"),ftime); } fputs("\n\n",fp_user); @@ -200,7 +200,7 @@ void smartfilter_report(void) fputs("
%s%s%s%s%s
%s%s%s%s%s
%s%s%s-%s%s%s
\n",fp_user); if(ShowSargInfo) { zdate(ftime, sizeof(ftime), DateFormat); - fprintf(fp_user,"

%s %s-%s %s %s
\n",text[108],URL,PGM,VERSION,text[109],ftime); + fprintf(fp_user,"

%s %s-%s %s %s
\n",_("Generated by"),URL,PGM,VERSION,_("on"),ftime); } fputs("\n\n",fp_user); fclose(fp_user); diff --git a/sort.c b/sort.c index f664349..0c5db0d 100644 --- a/sort.c +++ b/sort.c @@ -87,7 +87,7 @@ void tmpsort(void) strcat(arqin,direntp->d_name); if(debug) { - debuga("%s: %s",text[54],arqou); + debuga("%s: %s",_("Sorting file"),arqou); } strcat(arqou,".txt"); @@ -120,7 +120,7 @@ void sort_users_log(const char *tmp, int debug) const char unsortext[]=".unsort"; if(debug) { - debuga("%s",text[138]); + debuga("%s",_("pre-sorting files")); } sprintf(wtmp,"%s/sarg",tmp); diff --git a/splitlog.c b/splitlog.c index 377e7f6..7ee3383 100644 --- a/splitlog.c +++ b/splitlog.c @@ -44,7 +44,7 @@ void splitlog(const char *arq, char *df, int dfrom, int duntil, char *convert) arq="/var/log/squid/access.log"; if((fp_in=MY_FOPEN(arq,"r"))==NULL) { - fprintf(stderr, "SARG: (splitlog) %s: %s\n",text[8],arq); + fprintf(stderr, "SARG: (splitlog) %s: %s\n",_("Cannot open log file"),arq); exit(1); } diff --git a/squidguard_log.c b/squidguard_log.c index e3a044d..a98cd00 100644 --- a/squidguard_log.c +++ b/squidguard_log.c @@ -47,9 +47,9 @@ static void read_log(const char *wentp, FILE *fp_ou) struct getwordstruct gwarea1; if(debug) { - getword_start(&gwarea,text[7]); + getword_start(&gwarea,_("Reading access log file")); if (getword(url,sizeof(url),&gwarea,' ')<0 || getword_skip(MAXLEN,&gwarea,' ')<0) { - printf("SARG: Maybe you have a broken record or garbage in your %s string.\n",text[7]); + printf("SARG: Maybe you have a broken record or garbage in your %s string.\n",_("Reading access log file")); exit(1); } debuga("%s squidGuard %s: %s",url,gwarea.current,wentp); @@ -89,7 +89,7 @@ static void read_log(const char *wentp, FILE *fp_ou) } if ((fp_in=fopen(wentp,"r"))==NULL) { - fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],wentp); + fprintf(stderr, "SARG: (squidguard) %s: %s\n",_("Cannot open log file"),wentp); exit(1); } @@ -237,7 +237,7 @@ void squidguard_log(void) sprintf(guard_in,"%s/squidguard.unsort",tmp); sprintf(guard_ou,"%s/squidguard.log",tmp); if((fp_ou=fopen(guard_in,"a"))==NULL) { - fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],guard_in); + fprintf(stderr, "SARG: (squidguard) %s: %s\n",_("Cannot open log file"),guard_in); exit(1); } @@ -282,7 +282,7 @@ void squidguard_log(void) } if((fp_guard=fopen(SquidGuardConf,"r"))==NULL) { - fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],SquidGuardConf); + fprintf(stderr, "SARG: (squidguard) %s: %s\n",_("Cannot open log file"),SquidGuardConf); exit(1); } @@ -346,7 +346,7 @@ void squidguard_log(void) } if(debug) { - debuga("%s: %s",text[54],guard_ou); + debuga("%s: %s",_("Sorting file"),guard_ou); } sprintf(tmp6,"sort -k 1,1 -k 2,2 -k 4,4 \"%s\" -o \"%s\"",guard_in, guard_ou); diff --git a/squidguard_report.c b/squidguard_report.c index b63a489..1d18452 100644 --- a/squidguard_report.c +++ b/squidguard_report.c @@ -61,7 +61,7 @@ void squidguard_report(void) sprintf(report,"%s/squidguard.html",dirname); if ((fp_in = fopen(per, "r")) == 0) { - fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[45],per); + fprintf(stderr, "SARG: (squidguard) %s: %s\n",_("Cannot open file"),per); exit(1); } @@ -72,23 +72,23 @@ void squidguard_report(void) fclose(fp_in); if((fp_in=fopen(squidguard_in,"r"))==NULL) { - fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],squidguard_in); + fprintf(stderr, "SARG: (squidguard) %s: %s\n",_("Cannot open log file"),squidguard_in); exit(1); } if((fp_ou=fopen(report,"w"))==NULL) { - fprintf(stderr, "SARG: (squidguard) %s: %s\n",text[8],report); + fprintf(stderr, "SARG: (squidguard) %s: %s\n",_("Cannot open log file"),report); exit(1); } write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("SQUIDGUARD")); - fprintf(fp_ou,"%s: %s\n",text[89],period); - fprintf(fp_ou,"%s\n",text[120]); + fprintf(fp_ou,"%s: %s\n",_("Period"),period); + fprintf(fp_ou,"%s\n",_("SQUIDGUARD")); close_html_header(fp_ou); fputs("
\n",fp_ou); fputs("\n",fp_ou); - fprintf(fp_ou,"\n",text[98],text[111],text[110],text[91],text[121]); + fprintf(fp_ou,"\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE"),_("RULE")); while(fgets(buf,sizeof(buf),fp_in)!=NULL) { getword_start(&gwarea,buf); diff --git a/topsites.c b/topsites.c index 3149beb..107000b 100644 --- a/topsites.c +++ b/topsites.c @@ -75,7 +75,7 @@ void topsites(void) sprintf(report,"%s/topsites.html",dirname); if ((fp_in = fopen(per, "r")) == 0) { - fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],per); + fprintf(stderr, "SARG: (topuser) %s: %s\n",_("Cannot open file"),per); exit(1); } @@ -94,13 +94,13 @@ void topsites(void) } if((fp_in=fopen(general2,"r"))==NULL) { - fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],general2); + fprintf(stderr, "SARG: (topsite) %s: %s\n",_("Cannot open log file"),general2); fprintf(stderr, "SARG: sort command: %s\n",csort); exit(1); } if((fp_ou=fopen(general3,"w"))==NULL) { - fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],general3); + fprintf(stderr, "SARG: (topsite) %s: %s\n",_("Cannot open log file"),general3); exit(1); } @@ -183,7 +183,7 @@ void topsites(void) exit(1); } if((fp_in=fopen(sites,"r"))==NULL) { - fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],sites); + fprintf(stderr, "SARG: (topsite) %s: %s\n",_("Cannot open log file"),sites); fprintf(stderr, "SARG: sort command: %s\n",csort); exit(1); } @@ -192,18 +192,18 @@ void topsites(void) unlink(general3); if((fp_ou=fopen(report,"w"))==NULL) { - fprintf(stderr, "SARG: (topsite) %s: %s\n",text[8],report); + fprintf(stderr, "SARG: (topsite) %s: %s\n",_("Cannot open log file"),report); exit(1); } write_html_header(fp_ou,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Top sites")); - fprintf(fp_ou,"\n",text[89],period); - fprintf(fp_ou,"\n",text[83],TopSitesNum,text[84]); + fprintf(fp_ou,"\n",_("Period"),period); + fprintf(fp_ou,"\n",_("Top"),TopSitesNum,_("sites")); close_html_header(fp_ou); fputs("
%s%s%s%s%s
%s%s%s%s%s
%s: %s
%s %d %s
%s: %s
%s %d %s
\n",fp_ou); fputs("\n",fp_ou); - fprintf(fp_ou,"\n",text[100],text[91],text[92],text[93],text[99]); + fprintf(fp_ou,"\n",_("NUM"),_("ACCESSED SITE"),_("CONNECT"),_("BYTES"),_("TIME")); regs=0; ntopsites = 0; diff --git a/topuser.c b/topuser.c index f3d9648..a69af92 100644 --- a/topuser.c +++ b/topuser.c @@ -69,7 +69,7 @@ void topuser(void) strcpy(arqper,dirname); strcat(arqper,"/sarg-period"); if ((fp_in = fopen(arqper, "r")) == 0) { - fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],arqper); + fprintf(stderr, "SARG: (topuser) %s: %s\n",_("Cannot open file"),arqper); exit(1); } if (!fgets(period,sizeof(period),fp_in)) { @@ -91,12 +91,12 @@ void topuser(void) ntopuser = 0; if((fp_in=fopen(wger,"r"))==NULL) { - fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],wger); + fprintf(stderr, "SARG: (topuser) %s: %s\n",_("Cannot open file"),wger); exit(1); } if((fp_top2=fopen(top2,"w"))==NULL) { - fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],top2); + fprintf(stderr, "SARG: (topuser) %s: %s\n",_("Cannot open file"),top2); exit(1); } @@ -175,35 +175,35 @@ void topuser(void) } if((fp_top1=fopen(top1,"r"))==NULL) { - debuga("SARG: (topuser) %s: %s\n",text[45],top1); + debuga("SARG: (topuser) %s: %s\n",_("Cannot open file"),top1); exit(1); } unlink(top2); if((fp_top3=fopen(top3,"w"))==NULL) { - fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],top3); + fprintf(stderr, "SARG: (topuser) %s: %s\n",_("Cannot open file"),top3); exit(1); } snprintf(title,sizeof(title),_("SARG report for %s"),period); write_html_header(fp_top3,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,title); - fprintf(fp_top3,"\n",text[89],period); - fprintf(fp_top3,"\n",text[104],TopuserSortField,TopuserSortOrder); - fprintf(fp_top3,"\n",text[137]); + fprintf(fp_top3,"\n",_("Period"),period); + fprintf(fp_top3,"\n",_("Sort"),TopuserSortField,TopuserSortOrder); + fprintf(fp_top3,"\n",_("Topuser")); close_html_header(fp_top3); fputs("
%s%s%s%s%s
%s%s%s%s%s
%s: %s
%s: %s, %s
%s
%s: %s
%s: %s, %s
%s
\n",fp_top3); fputs("\n",fp_top3); - if((ReportType & REPORT_TYPE_TOPSITES) != 0 && !Privacy) fprintf(fp_top3,"\n",text[119]); - if((ReportType & REPORT_TYPE_SITES_USERS) != 0 && !Privacy) fprintf(fp_top3,"\n",text[85]); - if(dansguardian_count) fprintf(fp_top3,"\n",text[128]); - if(squidguard_count) fprintf(fp_top3,"\n",text[122]); - if ((ReportType & REPORT_TYPE_DOWNLOADS) != 0 && download_count && !Privacy && ndownload) fprintf(fp_top3,"\n",text[125]); - if ((ReportType & REPORT_TYPE_DENIED) != 0 && denied_count && !Privacy) fprintf(fp_top3,"\n",text[118]); - if ((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0 && authfail_count && !Privacy) fprintf(fp_top3,"\n",text[117]); - if(smartfilter) fprintf(fp_top3,"\n",text[116]); + if((ReportType & REPORT_TYPE_TOPSITES) != 0 && !Privacy) fprintf(fp_top3,"\n",_("Topsites")); + if((ReportType & REPORT_TYPE_SITES_USERS) != 0 && !Privacy) fprintf(fp_top3,"\n",_("Sites & Users")); + if(dansguardian_count) fprintf(fp_top3,"\n",_("DansGuardian")); + if(squidguard_count) fprintf(fp_top3,"\n",_("squidGuard")); + if ((ReportType & REPORT_TYPE_DOWNLOADS) != 0 && download_count && !Privacy && ndownload) fprintf(fp_top3,"\n",_("Downloads")); + if ((ReportType & REPORT_TYPE_DENIED) != 0 && denied_count && !Privacy) fprintf(fp_top3,"\n",_("Denied")); + if ((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0 && authfail_count && !Privacy) fprintf(fp_top3,"\n",_("Authentication Failures")); + if(smartfilter) fprintf(fp_top3,"\n",_("SmartFilter")); if(UserAgentLog[0] != '\0' && useragent_count) fprintf(fp_top3,"\n",_("Useragent")); fputs("\n
  
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
%s
\n",fp_top3); @@ -217,25 +217,25 @@ void topuser(void) fputs("",fp_top3); if((TopUserFields & TOPUSERFIELDS_NUM) != 0) - fprintf(fp_top3,"%s",text[100]); + fprintf(fp_top3,"%s",_("NUM")); if((TopUserFields & TOPUSERFIELDS_DATE_TIME) !=0 && (ReportType & REPORT_TYPE_DATE_TIME) != 0) fputs("",fp_top3); if((TopUserFields & TOPUSERFIELDS_USERID) != 0) - fprintf(fp_top3,"%s",text[98]); + fprintf(fp_top3,"%s",_("USERID")); if((TopUserFields & TOPUSERFIELDS_CONNECT) != 0) - fprintf(fp_top3,"%s",text[92]); + fprintf(fp_top3,"%s",_("CONNECT")); if((TopUserFields & TOPUSERFIELDS_BYTES) != 0) - fprintf(fp_top3,"%s",text[93]); + fprintf(fp_top3,"%s",_("BYTES")); if((TopUserFields & TOPUSERFIELDS_SETYB) != 0) - fprintf(fp_top3,"%%%s",text[93]); + fprintf(fp_top3,"%%%s",_("BYTES")); if((TopUserFields & TOPUSERFIELDS_IN_CACHE_OUT) != 0) - fprintf(fp_top3,"%s-%s-%s",text[113],text[114],text[112]); + fprintf(fp_top3,"%s-%s-%s",_("IN"),_("CACHE"),_("OUT")); if((TopUserFields & TOPUSERFIELDS_USED_TIME) != 0) - fprintf(fp_top3,"%s",text[94]); + fprintf(fp_top3,"%s",_("ELAPSED TIME")); if((TopUserFields & TOPUSERFIELDS_MILISEC) != 0) - fprintf(fp_top3,"%s",text[95]); + fprintf(fp_top3,"%s",_("MILISEC")); if((TopUserFields & TOPUSERFIELDS_PTIME) != 0) - fprintf(fp_top3,"%%%s",text[99]); + fprintf(fp_top3,"%%%s",_("TIME")); fputs("\n",fp_top3); @@ -292,19 +292,19 @@ void topuser(void) fprintf(fp_top3,"%d",posicao); if((TopUserFields & TOPUSERFIELDS_DATE_TIME) !=0 && (ReportType & REPORT_TYPE_DATE_TIME) != 0) { - s=text[110]; + s=_("DATE/TIME"); for(i=0 ; i",fp_top3); #ifdef HAVE_GD if(Graphs && GraphFont[0]!='\0') { - fprintf(fp_top3,"\"G\" ",uinfo->filename,ImageFile,text[126]); + fprintf(fp_top3,"\"G\" ",uinfo->filename,ImageFile,_("Graphic")); } #endif fprintf(fp_top3,"filename,uinfo->filename,ImageFile,ltext110); #ifdef HAVE_GD - fprintf(fp_top3," %s",text[55]); + fprintf(fp_top3," %s",_("Report")); #endif fputs("\" alt=\"T\">",fp_top3); } else { @@ -353,7 +353,7 @@ void topuser(void) fputs("",fp_top3); if((TopUserFields & TOPUSERFIELDS_DATE_TIME) !=0 && (ReportType & REPORT_TYPE_DATE_TIME) != 0) fputs("",fp_top3); - fprintf(fp_top3,"%s",text[107]); + fprintf(fp_top3,"%s",_("TOTAL")); if((TopUserFields & TOPUSERFIELDS_CONNECT) != 0) fprintf(fp_top3,"%s",fixnum(ttnacc,1)); @@ -381,7 +381,7 @@ void topuser(void) fputs("",fp_top3); if((TopUserFields & TOPUSERFIELDS_DATE_TIME) !=0 && (ReportType & REPORT_TYPE_DATE_TIME) != 0) fputs("",fp_top3); - fprintf(fp_top3,"%s",text[96]); + fprintf(fp_top3,"%s",_("AVERAGE")); if((TopUserFields & TOPUSERFIELDS_CONNECT) != 0) fprintf(fp_top3,"%s",fixnum(ttnacc/totuser,1)); @@ -405,7 +405,7 @@ void topuser(void) fclose(fp_top3); if((fp_ou=fopen(tusr,"w"))==NULL) { - fprintf(stderr, "SARG: (topuser) %s: %s\n",text[45],tusr); + fprintf(stderr, "SARG: (topuser) %s: %s\n",_("Cannot open file"),tusr); exit(1); } fprintf(fp_ou,"%d\n",totuser); diff --git a/totday.c b/totday.c index b00aa4c..40e03b5 100644 --- a/totday.c +++ b/totday.c @@ -63,7 +63,7 @@ void day_totalize(const char *tmp, const struct userinfostruct *uinfo, int index exit(1); } if((fp_in=fopen(sortout,"r"))==NULL) { - fprintf(stderr, "SARG: (totday) %s: %s\n",text[8],sortout); + fprintf(stderr, "SARG: (totday) %s: %s\n",_("Cannot open log file"),sortout); debuga(_("sort command: %s"),csort); exit(1); } @@ -71,7 +71,7 @@ void day_totalize(const char *tmp, const struct userinfostruct *uinfo, int index unlink(wdirname); if((fp_ou=fopen(arqout,"w"))==NULL) { - fprintf(stderr, "SARG: (totday) %s: %s\n",text[8],arqout); + fprintf(stderr, "SARG: (totday) %s: %s\n",_("Cannot open log file"),arqout); exit(1); } diff --git a/totger.c b/totger.c index 283825c..4cfb1c5 100644 --- a/totger.c +++ b/totger.c @@ -43,7 +43,7 @@ int totalger(const char *dirname, int debug, const char *outdir) strcat(wger,"/sarg-general"); if((fp_in=fopen(wger,"r"))==NULL) { - fprintf(stderr, "SARG: (totger) %s: %s\n",text[45],wger); + fprintf(stderr, "SARG: (totger) %s: %s\n",_("Cannot open file"),wger); exit(1); } @@ -66,7 +66,7 @@ int totalger(const char *dirname, int debug, const char *outdir) longline_free(&line); if((fp_ou=fopen(wger,"a"))==NULL) { - fprintf(stderr, "SARG: (totger) %s: %s\n",text[45],wger); + fprintf(stderr, "SARG: (totger) %s: %s\n",_("Cannot open file"),wger); exit(1); } diff --git a/usage.c b/usage.c index 48efbae..15a5a3c 100644 --- a/usage.c +++ b/usage.c @@ -29,28 +29,28 @@ void usage(const char *prog) { - fprintf(stderr, "%s: %s [%s...]\n", prog,text[39],text[40]); - fprintf(stderr, "%5s-a %s\n"," ",text[23]); - fprintf(stderr, "%5s-b %s\n"," ",text[71]); - fprintf(stderr, "%5s-c %s\n"," ",text[69]); - fprintf(stderr, "%5s-d %s dd/mm/yyyy-dd/mm/yyyy\n"," ",text[24]); - fprintf(stderr, "%5s-e %s (%s)\n"," ",text[41],text[42]); - fprintf(stderr, "%5s-f %s (%s/sarg.conf)\n"," ",text[70],SYSCONFDIR); - fprintf(stderr, "%5s-g %s [e=%s -> dd/mm/yy, u=%s -> mm/dd/yy]\n"," ",text[25],text[26],text[27]); + fprintf(stderr, "%s: %s [%s...]\n", prog,_("Usage"),_("options")); + fprintf(stderr, "%5s-a %s\n"," ",_("Hostname or IP address")); + fprintf(stderr, "%5s-b %s\n"," ",_("Useragent log")); + fprintf(stderr, "%5s-c %s\n"," ",_("Exclude file")); + fprintf(stderr, "%5s-d %s dd/mm/yyyy-dd/mm/yyyy\n"," ",_("Date from-until")); + fprintf(stderr, "%5s-e %s (%s)\n"," ",_("Email address to send reports"),_("stdout for console")); + fprintf(stderr, "%5s-f %s (%s/sarg.conf)\n"," ",_("Config file"),SYSCONFDIR); + fprintf(stderr, "%5s-g %s [e=%s -> dd/mm/yy, u=%s -> mm/dd/yy]\n"," ",_("Date format"),_("Europe"),_("USA")); fprintf(stderr, "%5s-h Help (this...)\n"," "); - fprintf(stderr, "%5s-i %s\n"," ",text[43]); - fprintf(stderr, "%5s-l %s\n"," ",text[37]); - fprintf(stderr, "%5s-n %s\n"," ",text[65]); - fprintf(stderr, "%5s-o %s\n"," ",text[38]); - fprintf(stderr, "%5s-p %s (%s)\n"," ",text[29],text[44]); - fprintf(stderr, "%5s-s %s [Eg. www.microsoft.com, www.netscape.com]\n"," ",text[30]); - fprintf(stderr, "%5s-t %s [HH, HH:MM]\n"," ",text[31]); - fprintf(stderr, "%5s-u %s\n"," ",text[32]); - fprintf(stderr, "%5s-w %s\n"," ",text[34]); - fprintf(stderr, "%5s-x %s\n"," ",text[35]); - fprintf(stderr, "%5s-z %s\n"," ",text[36]); - fprintf(stderr, "%5s-convert %s\n"," ",text[76]); - fprintf(stderr, "%5s-split %s\n"," ",text[77]); + fprintf(stderr, "%5s-i %s\n"," ",_("Reports by user and IP address")); + fprintf(stderr, "%5s-l %s\n"," ",_("Input log")); + fprintf(stderr, "%5s-n %s\n"," ",_("Resolve IP Address")); + fprintf(stderr, "%5s-o %s\n"," ",_("Output dir")); + fprintf(stderr, "%5s-p %s (%s)\n"," ",_("Use Ip Address instead of userid"),_("reports")); + fprintf(stderr, "%5s-s %s [Eg. www.microsoft.com, www.netscape.com]\n"," ",_("Accessed site")); + fprintf(stderr, "%5s-t %s [HH, HH:MM]\n"," ",_("Time")); + fprintf(stderr, "%5s-u %s\n"," ",_("User")); + fprintf(stderr, "%5s-w %s\n"," ",_("Temporary dir")); + fprintf(stderr, "%5s-x %s\n"," ",_("Debug messages")); + fprintf(stderr, "%5s-z %s\n"," ",_("Process messages")); + fprintf(stderr, "%5s-convert %s\n"," ",_("Convert the access.log file to a legible date")); + fprintf(stderr, "%5s-split %s\n"," ",_("Split the log file by date in -d parameter")); fprintf(stderr, "\n\t%s-%s\n",PGM,VERSION); fprintf(stderr, "\thttp://sarg.sourceforge.net\n"); fprintf(stderr, "\n\tPease donate to the sarg project:"); diff --git a/useragent.c b/useragent.c index 8d5212a..790d691 100644 --- a/useragent.c +++ b/useragent.c @@ -62,17 +62,17 @@ void useragent(void) sprintf(tmp2,"%s/squagent.log",TempDir); if((fp_in=fopen(UserAgentLog,"r"))==NULL) { - fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],UserAgentLog); + fprintf(stderr, "SARG: (useragent) %s: %s\n",_("Cannot open file"),UserAgentLog); exit(1); } if((fp_ou=fopen(tmp3,"w"))==NULL) { - fprintf(stderr, "SARG: (email) %s: %s\n",text[45],tmp3); + fprintf(stderr, "SARG: (email) %s: %s\n",_("Cannot open file"),tmp3); exit(1); } if(debug) { - debuga("%s: %s",text[66],UserAgentLog); + debuga("%s: %s",_("Reading useragent log"),UserAgentLog); } while(fgets(buf,sizeof(buf),fp_in)!=NULL) { @@ -123,14 +123,14 @@ void useragent(void) } if(debug) { - debuga(" %s: %ld",text[10],totregsl); + debuga(" %s: %ld",_("Records read"),totregsl); } fclose(fp_in); fclose(fp_ou); if(debug) { - debuga("%s: %s",text[54],tmp2); + debuga("%s: %s",_("Sorting file"),tmp2); } sprintf(csort,"sort -n -t \"\t\" -k 3,3 -k 2,2 -k 1,1 -o \"%s\" \"%s\"",tmp2,tmp3); @@ -141,7 +141,7 @@ void useragent(void) exit(1); } if((fp_in=fopen(tmp2,"r"))==NULL) { - fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp2); + fprintf(stderr, "SARG: (useragent) %s: %s\n",_("Cannot open file"),tmp2); fprintf(stderr, "SARG: sort command: %s\n",csort); exit(1); } @@ -150,16 +150,16 @@ void useragent(void) sprintf(hfile,"%s/useragent.html", dirname); if((fp_ht=fopen(hfile,"w"))==NULL) { - fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],hfile); + fprintf(stderr, "SARG: (useragent) %s: %s\n",_("Cannot open file"),hfile); exit(1); } if(debug) - debuga("%s",text[72]); + debuga("%s",_("Making Useragent report")); write_html_header(fp_ht,(IndexTree == INDEX_TREE_DATE) ? 3 : 1,_("Squid Useragent's Report")); - fprintf(fp_ht,"%s\n",text[105]); - fprintf(fp_ht,"%s: %s - %s\n",text[89],idate,fdate); + fprintf(fp_ht,"%s\n",_("Squid Useragent's Report")); + fprintf(fp_ht,"%s: %s - %s\n",_("Period"),idate,fdate); close_html_header(fp_ht); fputs("

\n",fp_ht); @@ -167,7 +167,7 @@ void useragent(void) fputs("
\n",fp_ht); fputs("",fp_ht); - fprintf(fp_ht,"\n",text[98],text[106]); + fprintf(fp_ht,"\n",_("USERID"),_("AGENT")); while(fgets(buf,sizeof(buf),fp_in)!=NULL) { getword_start(&gwarea,buf); @@ -213,7 +213,7 @@ void useragent(void) exit(1); } if((fp_in=fopen(tmp3,"r"))==NULL) { - fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp3); + fprintf(stderr, "SARG: (useragent) %s: %s\n",_("Cannot open file"),tmp3); fprintf(stderr, "SARG: sort command: %s\n",csort); exit(1); } @@ -221,7 +221,7 @@ void useragent(void) unlink(tmp2); if((fp_ou=fopen(tmp2,"w"))==NULL) { - fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp2); + fprintf(stderr, "SARG: (useragent) %s: %s\n",_("Cannot open file"),tmp2); exit(1); } @@ -267,7 +267,7 @@ void useragent(void) exit(1); } if((fp_in=fopen(tmp3,"r"))==NULL) { - fprintf(stderr, "SARG: (useragent) %s: %s\n",text[45],tmp3); + fprintf(stderr, "SARG: (useragent) %s: %s\n",_("Cannot open file"),tmp3); fprintf(stderr, "SARG: sort command: %s\n",csort); exit(1); } @@ -277,7 +277,7 @@ void useragent(void) fputs("

\n",fp_ht); fputs("
  
%s%s
%s%s
\n",fp_ht); - fprintf(fp_ht,"\n",text[106],text[107]); + fprintf(fp_ht,"\n",_("AGENT"),_("TOTAL")); perc=0.; while(fgets(buf,sizeof(buf),fp_in)!=NULL) { diff --git a/usertab.c b/usertab.c index 3981718..21be860 100644 --- a/usertab.c +++ b/usertab.c @@ -62,7 +62,7 @@ static void init_file_usertab(const char *UserTabFile) int z1; if((fp_usr=fopen(UserTabFile,"r"))==NULL) { - fprintf(stderr, "SARG: (log) %s: %s - %s\n",text[45],UserTabFile,strerror(errno)); + fprintf(stderr, "SARG: (log) %s: %s - %s\n",_("Cannot open file"),UserTabFile,strerror(errno)); exit(1); } fseek(fp_usr, 0, SEEK_END); @@ -74,7 +74,7 @@ static void init_file_usertab(const char *UserTabFile) nreg += 100; fseek(fp_usr, 0, SEEK_SET); if((userfile=(char *) malloc(nreg))==NULL){ - fprintf(stderr, "SARG ERROR: %s",text[87]); + fprintf(stderr, "SARG ERROR: %s",_("Cannot load. Memory fault")); exit(1); } userfile[0]='\t'; @@ -209,7 +209,7 @@ void init_usertab(const char *UserTabFile) { if (strcmp(UserTabFile, "ldap") == 0) { if(debug) - debuga("%s: %s",text[86],UserTabFile); + debuga("%s: %s",_("Loading User table"),UserTabFile); #ifdef HAVE_LDAP_H which_usertab=UTT_Ldap; init_ldap_usertab(); @@ -219,7 +219,7 @@ void init_usertab(const char *UserTabFile) #endif //HAVE_LDAP_H } else if (UserTabFile[0] != '\0') { if(debug) - debuga("%s: %s",text[86],UserTabFile); + debuga("%s: %s",_("Loading User table"),UserTabFile); which_usertab=UTT_File; init_file_usertab(UserTabFile); } else { diff --git a/util.c b/util.c index 0f73f43..c1a2d4e 100644 --- a/util.c +++ b/util.c @@ -428,7 +428,7 @@ void name_month(char *month,int month_len) char w[20]; struct getwordstruct gwarea; - strcpy(m,text[133]); + strcpy(m,_("January,February,March,April,May,June,July,August,September,October,November,December")); getword_start(&gwarea,m); for(x=0; x 0) { if(debug) - fprintf(stderr, "SARG: %s: %s %s %s\n",text[51],dirname,text[52],wdir); + fprintf(stderr, "SARG: %s: %s %s %s\n",_("File"),dirname,_("already exists, moved to"),wdir); rename(dirname,wdir); } } else { @@ -1013,7 +1013,7 @@ void vrfydir(const char *per1, const char *addr, const char *site, const char *u if(count > 0) { if(debug) - fprintf(stderr, "SARG: %s: %s %s %s\n",text[51],dirname2,text[52],wdir); + fprintf(stderr, "SARG: %s: %s %s %s\n",_("File"),dirname2,_("already exists, moved to"),wdir); rename(dirname2,wdir); strcpy(dirname2,wdir); } @@ -1192,14 +1192,14 @@ void removetmp(const char *outdir) return; if(debug) { - debuga("%s: sarg-general, sarg-period",text[82]); + debuga("%s: sarg-general, sarg-period",_("Removing temporary files")); } if (snprintf(warea,sizeof(warea),"%s/sarg-general",outdir)>=sizeof(warea)) { debuga(_("(removetmp) directory too long to remove: %s/sarg-period"),outdir); exit(1); } if((fp_in=fopen(warea,"r"))==NULL){ - fprintf(stderr, "===SARG: (removetmp) %s: %s\n",text[45],warea); + fprintf(stderr, "===SARG: (removetmp) %s: %s\n",_("Cannot open file"),warea); exit(1); } while(fgets(buf,sizeof(buf),fp_in)!=NULL) { @@ -1208,7 +1208,7 @@ void removetmp(const char *outdir) } fclose(fp_in); if((fp_in=fopen(warea,"w"))==NULL){ - fprintf(stderr, "SARG: (removetmp) %s: %s\n",text[45],warea); + fprintf(stderr, "SARG: (removetmp) %s: %s\n",_("Cannot open file"),warea); exit(1); } fputs(buf,fp_in); @@ -1233,7 +1233,7 @@ void load_excludecodes(const char *ExcludeCodes) return; if((excludecode=(char *) malloc(1024))==NULL) { - fprintf(stderr, "SARG: %s (1024):\n",text[59]); + fprintf(stderr, "SARG: %s (1024):\n",_("malloc error")); exit(1); } bzero(excludecode,1024); @@ -1420,7 +1420,7 @@ void show_info(FILE *fp_ou) if(!ShowSargInfo) return; zdate(ftime, sizeof(ftime), DateFormat); - fprintf(fp_ou,"
%s %s-%s %s %s
\n",text[108],URL,PGM,VERSION,text[109],ftime); + fprintf(fp_ou,"
%s %s-%s %s %s
\n",_("Generated by"),URL,PGM,VERSION,_("on"),ftime); } void show_sarg(FILE *fp_ou, int depth)
%s%s%%
%s%s%%