From: Frederic Marchal Date: Sun, 26 Apr 2015 14:40:09 +0000 (+0200) Subject: Put double quotes around remaining file names in messages X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2eb432c7665671e34573fbaa016fda5a929ba850;p=thirdparty%2Fsarg.git Put double quotes around remaining file names in messages Be consistent with the naming of files in messages. It makes life easier for the translators. --- diff --git a/dansguardian_log.c b/dansguardian_log.c index ddec52a..3b4b1d2 100644 --- a/dansguardian_log.c +++ b/dansguardian_log.c @@ -88,7 +88,7 @@ void dansguardian_log(void) } if(debug) - debuga(_("Reading DansGuardian log file: %s\n"),loglocation); + debuga(_("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)); @@ -154,7 +154,7 @@ void dansguardian_log(void) } if(debug) - debuga(_("Sorting file: %s\n"),guard_ou); + debuga(_("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); diff --git a/datafile.c b/datafile.c index 293e245..2bb02a0 100644 --- a/datafile.c +++ b/datafile.c @@ -82,7 +82,7 @@ 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(_("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)) { diff --git a/download.c b/download.c index 41afaed..f37bb7e 100644 --- a/download.c +++ b/download.c @@ -137,7 +137,7 @@ 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 the file: %s\n"),download_unsort); + debuga(_("Path too long to sort file \"%s\"\n"),download_unsort); exit(EXIT_FAILURE); } cstatus=system(csort); diff --git a/email.c b/email.c index 5a52aa9..d4bd1dc 100644 --- a/email.c +++ b/email.c @@ -126,7 +126,7 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema #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(_("Total statistics mismatch when reading \"%s\" to produce the email report\n"),wger); exit(EXIT_FAILURE); } #endif diff --git a/exclude.c b/exclude.c index 98e39d2..35f1722 100644 --- a/exclude.c +++ b/exclude.c @@ -197,7 +197,7 @@ void gethexclude(const char *hexfile, int debug) exit(EXIT_FAILURE); } if(debug) - debuga(_("Loading exclude host file from: %s\n"),hexfile); + debuga(_("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)); @@ -314,7 +314,7 @@ void getuexclude(const char *uexfile, int debug) long int nreg=0; if(debug) - debuga(_("Loading exclude file from: %s\n"),uexfile); + debuga(_("Loading exclude file from \"%s\"\n"),uexfile); if ((fp_ex = fopen(uexfile, "r")) == NULL) { debuga(_("Cannot open file \"%s\": %s\n"),uexfile,strerror(errno)); @@ -327,7 +327,7 @@ void getuexclude(const char *uexfile, int debug) } nreg = ftell(fp_ex); if (nreg<0) { - debuga(_("Cannot get the size of file %s\n"),uexfile); + debuga(_("Cannot get the size of file \"%s\"\n"),uexfile); exit(EXIT_FAILURE); } nreg += 11; diff --git a/getconf.c b/getconf.c index 58716a3..2b0a160 100644 --- a/getconf.c +++ b/getconf.c @@ -963,7 +963,7 @@ void getconf(void) char buf[MAXLEN]; if(debug) - debuga(_("Loading configuration from %s\n"),ConfigFile); + debuga(_("Loading configuration from \"%s\"\n"),ConfigFile); if ((fp_in = fopen(ConfigFile, "r")) == NULL) { debuga(_("Cannot open file \"%s\": %s\n"),ConfigFile,strerror(errno)); diff --git a/html.c b/html.c index 087d807..0c25b6a 100644 --- a/html.c +++ b/html.c @@ -612,7 +612,7 @@ void htmlrel(void) user_limit[maskid]|=mask; if(debug) - debuga(_("User %s limit exceeded (%d MB). Added to file %s\n"),uinfo->label, + debuga(_("Limit exceeded for user %s (%d MB). Added to file \"%s\"\n"),uinfo->label, PerUserLimits[i].Limit,PerUserLimits[i].File); } } diff --git a/index.c b/index.c index 8fcbb31..e08826e 100644 --- a/index.c +++ b/index.c @@ -584,7 +584,7 @@ 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: %s/%s"),outdir,INDEX_HTML_FILE); + debuga(_("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) { @@ -799,7 +799,7 @@ static void make_file_index(void) fputs("\n",fp_ou); write_html_trailer(fp_ou); if (fclose(fp_ou)==EOF) - debuga(_("Write error in file \"%s\": %s\n"),wdir,strerror(errno)); + debuga(_("Write error in \"%s\": %s\n"),wdir,strerror(errno)); if (sortlist) { for (i=0 ; id_name)>=sizeof(remove)) { - debuga(_("Name of the file to remove is too long: %s/%s\n"),dirname,direntp->d_name); + debuga(_("Name of the file to remove is too long. File name is \"%s/%s\"\n"),dirname,direntp->d_name); continue; } if (unlink(remove) == -1) { diff --git a/lastlog.c b/lastlog.c index 5c6f9d3..55aeaa0 100644 --- a/lastlog.c +++ b/lastlog.c @@ -100,7 +100,7 @@ static struct DirEntry *BuildDirDateList(struct DirEntry *List,char *Path,int Pa { name_len=strlen(direntp->d_name); if (RootPos+name_len+1>=PathSize) { - debuga(_("Directory entry too long to purge the old reports: %s%s\n"),Path,direntp->d_name); + debuga(_("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); @@ -153,7 +153,7 @@ static struct DirEntry *BuildDirList(const char *Path) name_pos=strlen(Path); if (name_pos>=sizeof(warea)) { - debuga(_("The directory containing the old reports to purge is too long: %s\n"),Path); + debuga(_("The directory name \"%s\" containing the old reports to purge is too long\n"),Path); exit(EXIT_FAILURE); } strcpy(warea,Path); @@ -165,7 +165,7 @@ static struct DirEntry *BuildDirList(const char *Path) { name_len=strlen(direntp->d_name); if (name_pos+name_len+1>=sizeof(warea)) { - debuga(_("Directory entry too long to purge the old reports: %s%s\n"),Path,direntp->d_name); + debuga(_("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); @@ -232,10 +232,10 @@ static void DeleteEmptyDirs(char *Path,int PathSize,int BasePos) break; } if (debug) - debuga(_("Deleting empty directory %s\n"),Path); + debuga(_("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(_("Buffer too small to delete index file \"%s/%s\""),Path,INDEX_HTML_FILE); exit(EXIT_FAILURE); } strcat(Path,"/"INDEX_HTML_FILE); @@ -287,7 +287,7 @@ void mklastlog(const char *outdir) name_pos=strlen(outdir); if (name_pos>=sizeof(warea)) { DeleteDirList(List); - debuga(_("The directory containing the old reports to purge is too long: %s\n"),outdir); + debuga(_("The directory name \"%s\" containing the old reports to purge is too long\n"),outdir); exit(EXIT_FAILURE); } strcpy(warea,outdir); diff --git a/log.c b/log.c index 7eb46da..2c982cd 100644 --- a/log.c +++ b/log.c @@ -757,7 +757,7 @@ static void getusers(const char *pwdfile, int debug) long int nreg=0; if(debug) - debuga(_("Loading password file from %s\n"),pwdfile); + debuga(_("Loading password file \"%s\"\n"),pwdfile); if ((fp_usr = fopen(pwdfile, "r")) == NULL) { debuga(_("Cannot open file \"%s\": %s\n"),pwdfile,strerror(errno)); @@ -770,7 +770,7 @@ static void getusers(const char *pwdfile, int debug) } nreg = ftell(fp_usr); if (nreg<0) { - debuga(_("Cannot get the size of file %s\n"),pwdfile); + debuga(_("Cannot get the size of file \"%s\"\n"),pwdfile); exit(EXIT_FAILURE); } nreg = nreg+5000; @@ -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(_("You have an invalid user in your %s file\n"),pwdfile); + debuga(_("Invalid user in file \"%s\"\n"),pwdfile); exit(EXIT_FAILURE); } str[1]='\0'; diff --git a/redirector.c b/redirector.c index 534961e..b5b931e 100644 --- a/redirector.c +++ b/redirector.c @@ -81,7 +81,7 @@ static void parse_log(FILE *fp_ou,char *buf) } 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(_("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(_("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(_("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(_("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(_("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(_("User ID too long in redirector log 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(_("Reading redirector log file \"%s\"\n"),wentp); } /* With squidGuard, you can log groups in only one log file. @@ -396,7 +396,7 @@ 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(_("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)) { diff --git a/smartfilter.c b/smartfilter.c index 359f936..df45e2c 100644 --- a/smartfilter.c +++ b/smartfilter.c @@ -74,7 +74,7 @@ void smartfilter_report(void) } 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(_("Cannot build the sort command to sort file \"%s\"\n"),smart_in); exit(EXIT_FAILURE); } cstatus=system(csort); diff --git a/sort.c b/sort.c index 7b6426d..c4048ac 100644 --- a/sort.c +++ b/sort.c @@ -74,7 +74,7 @@ void tmpsort(const struct userinfostruct *uinfo) } if(debug) { - debuga(_("Sorting file: %s\n"),arqin); + debuga(_("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)) { @@ -117,7 +117,8 @@ void sort_users_log(const char *tmp, int debug,struct userinfostruct *uinfo) int clen; if(debug) { - debuga(_("Sorting log %s/%s.user_unsort\n"),tmp,uinfo->filename); + snprintf(csort,sizeof(csort),"%s/%s.user_unsort",tmp,uinfo->filename); + debuga(_("Sorting file \"%s\"\n"),csort); } user=uinfo->filename; diff --git a/topsites.c b/topsites.c index 7573dfe..cab57e6 100644 --- a/topsites.c +++ b/topsites.c @@ -184,7 +184,7 @@ void topsites(void) #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(_("Total statistics mismatch when reading \"%s\" to produce the top sites\n"),general2); exit(EXIT_FAILURE); } #endif diff --git a/topuser.c b/topuser.c index 68858c4..5bf5976 100644 --- a/topuser.c +++ b/topuser.c @@ -167,7 +167,7 @@ void topuser(void) #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(_("Total statistics mismatch when reading \"%s\" to produce the top users\n"),wger); exit(EXIT_FAILURE); } #endif diff --git a/useragent.c b/useragent.c index 9ec1cfc..33dad90 100644 --- a/useragent.c +++ b/useragent.c @@ -72,7 +72,7 @@ void useragent(void) } if(debug) { - debuga(_("Reading useragent log: %s\n"),UserAgentLog); + debuga(_("Reading useragent log \"%s\"\n"),UserAgentLog); } while(fgets(buf,sizeof(buf),fp_in)!=NULL) { @@ -132,7 +132,7 @@ void useragent(void) } if(debug) { - debuga(_("Sorting file: %s\n"),tmp2); + debuga(_("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)) { diff --git a/usertab.c b/usertab.c index 03934e3..4e0a580 100644 --- a/usertab.c +++ b/usertab.c @@ -85,7 +85,7 @@ static void init_file_usertab(const char *UserTabFile) } nreg = ftell(fp_usr); if (nreg<0) { - debuga(_("Cannot get the size of file %s\n"),UserTabFile); + debuga(_("Cannot get the size of file \"%s\"\n"),UserTabFile); exit(EXIT_FAILURE); } nreg += 100; @@ -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 the users is too long in your %s file.\n"),UserTabFile); + debuga(_("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 the users is too long in your %s file.\n"),UserTabFile); + debuga(_("The list of users is too long in file \"%s\"\n"),UserTabFile); exit(EXIT_FAILURE); } userfile[z2++]=buf[z1++]; @@ -236,7 +236,8 @@ const char * charset_convert( const char * str_in, const char * charset_to ) str_in_orig = str_in; return_value = iconv(ldapiconv, (ICONV_CONST char **)&str_in, &str_in_len, &str_out, &str_out_len ); if ( return_value == ( size_t ) -1 ) { - debuga(_("iconv failed in string \"%s\":\n"),str_in_orig); + /* TRANSLATORS: The message is followed by the reason for the failure. */ + debuga(_("iconv failed on string \"%s\":\n"),str_in_orig); switch ( errno ) { /* See "man 3 iconv" for an explanation. */ case EILSEQ: @@ -344,8 +345,10 @@ static void get_ldap_name(const char *userlogin,char *mappedname,int namelen) void init_usertab(const char *UserTabFile) { if (strcmp(UserTabFile, "ldap") == 0) { - if(debug) - debuga(_("Loading User table: %s\n"),UserTabFile); + if(debug) { + /* TRANSLATORS: The %s may be the string "ldap" or a file name.*/ + debuga(_("Loading User table from \"%s\"\n"),UserTabFile); + } #ifdef HAVE_LDAP_H which_usertab=UTT_Ldap; init_ldap_usertab(); @@ -355,7 +358,7 @@ void init_usertab(const char *UserTabFile) #endif //HAVE_LDAP_H } else if (UserTabFile[0] != '\0') { if(debug) - debuga(_("Loading User table: %s\n"),UserTabFile); + debuga(_("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 86a2cd8..5adc7e1 100644 --- a/util.c +++ b/util.c @@ -790,7 +790,7 @@ int obtdate(const char *dirname, const char *name, char *data) } if (!fgets(data,80,fp_in)) { - debuga(_("Failed to read the date in %s\n"),wdir); + debuga(_("Failed to read the date in file \"%s\"\n"),wdir); exit(EXIT_FAILURE); } if (fclose(fp_in)==EOF) { @@ -857,7 +857,7 @@ int obtuser(const char *dirname, const char *name) } if (!fgets(tuser,sizeof(tuser),fp_in)) { - debuga(_("Failed to read the number of users in %s\n"),wdir); + debuga(_("Failed to read the number of users in file \"%s\"\n"),wdir); exit(EXIT_FAILURE); } if (fclose(fp_in)==EOF) { @@ -1445,7 +1445,7 @@ int vrfydir(const struct periodstruct *per1, const char *addr, const char *site, exit(EXIT_FAILURE); } if ((fp_ou = fopen(wdir, "wt")) == 0) { - debuga(_("cannot open %s for writing: %s\n"),wdir,strerror(errno)); + debuga(_("Cannot open file \"%s\": %s\n"),wdir,strerror(errno)); perror("SARG:"); exit(EXIT_FAILURE); } @@ -1764,7 +1764,7 @@ void load_excludecodes(const char *ExcludeCodes) } MemSize = ftell(fp_in); if (MemSize<0) { - debuga(_("Cannot get the size of file %s\n"),ExcludeCodes); + debuga(_("Cannot get the size of file \"%s\"\n"),ExcludeCodes); exit(EXIT_FAILURE); } if (fseek(fp_in, 0, SEEK_SET)==-1) { @@ -2204,7 +2204,7 @@ void unlinkdir(const char *dir,bool contentonly) } else if (S_ISDIR(st.st_mode)) { unlinkdir(dname,0); } else { - debuga(_("Unknown path type %s\n"),dname); + debuga(_("Don't know how to delete \"%s\" (not a regular file nor a directory)\n"),dname); } } closedir(dirp); @@ -2339,7 +2339,7 @@ void emptytmpdir(const char *dir) exit(EXIT_FAILURE); } } else { - debuga(_("Unknown path type %s\n"),dname); + debuga(_("Don't know how to delete \"%s\" (not a regular file)\n"),dname); } } closedir(dirp);