while (*buf && (unsigned char)*buf<=' ') buf++;
if (strlen(buf)>=value_size) {
- printf("SARG: Maybe you have a broken record or garbage in %s parameter.\n",param);
+ debuga(_("The string value of parameter \"%s\" is too long"),param);
exit(1);
}
strcpy(value,buf);
while (*buf && (unsigned char)*buf<=' ') buf++;
if (*buf != '\"') {
- printf("SARG: %s %s.\n",_("Missing double quote after parameter"),param);
+ debuga(_("Missing double quote after parameter \"%s\""),param);
exit(1);
}
buf++;
value[i]='\0';
if (*buf != '\"') {
- printf("SARG: Missing double quote after parameter %s or value is more than %d bytes long.\n",param,value_size);
+ debuga(_("Missing double quote after parameter \"%s\" or value is more than %d bytes long"),param,value_size);
exit(1);
}
fixnone(value);
for (i=0 ; i<word1_size && *buf && (unsigned char)*buf>' ' ; i++)
word1[i]=*buf++;
if (i>=word1_size) {
- printf("SARG: The first word of parameter %s is more than %d bytes long.\n",param,word1_size-1);
+ debuga(_("The first word of parameter \"%s\" is more than %d bytes long"),param,word1_size-1);
exit(1);
}
if (*buf!=' ') {
- printf("SARG: Missing second word for parameter %s.\n",param);
+ debuga(_("Missing second word for parameter \"%s\""),param);
exit(1);
}
word1[i]=0;
for (i=0 ; i<word2_size && *buf && (unsigned char)*buf>' ' ; i++)
word2[i]=*buf++;
if (i>=word2_size) {
- printf("SARG: The second word of parameter %s is more than %d bytes long.\n",param,word2_size-1);
+ debuga(_("The second word of parameter \"%s\" is more than %d bytes long"),param,word2_size-1);
exit(1);
}
word2[i]=0;
next=0;
if (sscanf(buf,"%d%n",value,&next) != 1 || (unsigned char)buf[next] > ' ') {
- printf("SARG: Maybe you have a broken record or garbage in %s parameter.\n",param);
+ debuga(_("The integer value of parameter \"%s\" is invalid"),param);
exit(1);
}
return(1);
}
for (i=0 ; i<noptions && strcasecmp(buf,options[i].name) ; i++);
if (i>=noptions) {
- fprintf(stderr,"SARG: Unknown value %s for parameter %s\n",buf,param);
+ debuga(_("SUnknown value \"%s\" for parameter \"%s\""),buf,param);
exit(1);
}
if ((*value & options[i].exclude)!=0) {
- fprintf(stderr,"SARG: Value %s conflicts with other selected values of parameter %s\n",buf,param);
+ debuga(_("Value \"%s\" conflicts with other selected values for parameter \"%s\""),buf,param);
exit(1);
}
*value|=options[i].value;
return;
if(debugz)
- printf("SARG: TAG: %s\n",buf);
+ printf(_("SARG: TAG: %s\n"),buf);
if (getparam_string("background_color",buf,BgColor,sizeof(BgColor))>0) return;
if (is_param("date_format",buf)) {
getword_start(&gwarea,buf);
if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
- printf("SARG: Maybe you have a broken record or garbage in date_format parameter.\n");
+ debuga(_("Maybe you have a broken record or garbage in \"date_format\" parameter"));
exit(1);
}
strncpy(DateFormat,gwarea.current,1);
if (is_param("hours",buf)) {
if( getnumlist( buf, &hours, 24, 24 ) ) {
- fprintf( stderr, "Error: Invalid syntax in hours tag!\n" );
+ debuga(_("Error: Invalid syntax in hours tag!"));
exit( 1 );
}
}
if (is_param("weekdays",buf)) {
if( getnumlist( buf, &weekdays, 7, 7 ) ) {
- fprintf( stderr, "Error: Invalid syntax in weekdays tag!\n" );
+ debuga(_("Error: Invalid syntax in weekdays tag!"));
exit( 1 );
}
}
if (is_param("access_log",buf)>0) {
if (AccessLogFromCmdLine==0) {
if (NAccessLog>=MAXLOGS) {
- fprintf(stderr,"SARG: Too many log files.\n");
+ debuga(_("Too many log files in configuration file"));
exit(1);
}
getparam_string("access_log",buf,AccessLog[NAccessLog],MAXLEN);
if(strstr(buf,"byte_cost") != 0) {
getword_start(&gwarea,buf);
if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
- printf("SARG: Maybe you have a broken record or garbage in byte_cost parameter.\n");
+ debuga(_("The \"byte_cost\" parameter of the configuration file is invalid"));
exit(1);
}
cost=atol(gwarea.current);
if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
- printf("SARG: Maybe you have a broken record or garbage in byte_cost parameter.\n");
+ debuga(_("The \"byte_cost\" parameter of the configuration file is invalid"));
exit(1);
}
nocost=my_atoll(gwarea.current);
return;
}
- printf("SARG: %s %s\n",_("Unknown option"),buf);
+ printf(_("SARG: Unknown option %s\n"),buf);
}
void getconf(void)
char buf[MAXLEN];
if(debug)
- debuga("Loading configuration from: %s",ConfigFile);
+ debuga(_("Loading configuration from: %s"),ConfigFile);
if ((fp_in = fopen(ConfigFile, "r")) == NULL) {
- fprintf(stderr, "SARG: (getconf) Cannot open file: %s\n",ConfigFile);
+ debuga(_("SARG: (getconf) Cannot open file: %s"),ConfigFile);
exit(1);
}
date[sizeof(date)-1]='\0';
getword_start(&gwarea,optarg);
if (getword(cdfrom,sizeof(cdfrom),&gwarea,'-')<0 || getword(cduntil,sizeof(cduntil),&gwarea,0)<0) {
- printf("SARG: Maybe you have a broken record or garbage in your date range.\n");
+ printf(_("SARG: The date range requested on the command line by option -d is invalid.\n"));
exit(1);
}
date_from(date, cdfrom, cduntil);
break;
case 'l':
if (NAccessLog>=MAXLOGS) {
- printf("SARG: Too many log files.\n");
+ printf(_("SARG: Too many log files passed on command line with option -l.\n"));
exit(1);
}
strcpy(AccessLog[NAccessLog],optarg);
} else {
getword_start(&gwarea,optarg);
if (getword(hm,sizeof(hm),&gwarea,'-')<0 || getword(hmf,sizeof(hmf),&gwarea,0)<0) {
- fprintf(stderr,"SARG: Maybe you have a broken record or garbage in your time range.\n");
+ debuga(_("The time range passed on the command line with option -t is invalid"));
exit(1);
}
}
if(sscanf(hm,"%d:%d",&h,&m)!=2) {
- fprintf(stderr,"SARG: time period must be MM or MM:SS. Exit.\n");
+ debuga(_("Time period must be MM or MM:SS. Exit"));
exit(1);
}
sprintf(hm,"%02d%02d",h,m);
if(sscanf(hmf,"%d:%d",&h,&m)!=2) {
- fprintf(stderr,"SARG: time period must be MM or MM:SS. Exit.\n");
+ debuga(_("Time period must be MM or MM:SS. Exit"));
exit(1);
}
sprintf(hmf,"%02d%02d",h,m);
debugz++;
break;
case ':':
- fprintf(stderr, "Option -%c require an argument\n",optopt);
+ debuga(_("Option -%c require an argument"),optopt);
errflg++;
break;
case '?':
strcat(tmp6,"/authfail.log.unsort");
if(debug) {
- 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);
+ fprintf(stderr, _("SARG: Parameters:\nSARG:\n"));
+ fprintf(stderr, _("SARG: Hostname or IP address (-a) = %s\n"),addr);
+ fprintf(stderr, _("SARG: Useragent log (-b) = %s\n"),uagent);
+ fprintf(stderr, _("SARG: Exclude file (-c) = %s\n"),hexclude);
+ fprintf(stderr, _("SARG: Date from-until (-d) = %s\n"),date);
+ fprintf(stderr, _("SARG: Email address to send reports (-e) = %s\n"),email);
+ fprintf(stderr, _("SARG: Config file (-f) = %s\n"),ConfigFile);
if(strcmp(df,"e") == 0)
- fprintf(stderr, "SARG: %35s (-g) = %s (dd/mm/yyyy)\n",_("Date format"),_("Europe"));
+ fprintf(stderr, _("SARG: Date format (-g) = Europe (dd/mm/yyyy)\n"));
if(strcmp(df,"u") == 0)
- fprintf(stderr, "SARG: %35s (-g) = %s (mm/dd/yyyy)\n",_("Date format"),_("USA"));
+ fprintf(stderr, _("SARG: Date format (-g) = USA (mm/dd/yyyy)\n"));
if(strcmp(df,"w") == 0)
- fprintf(stderr, "SARG: %35s (-g) = %s (yyyy/ww)\n",_("Date format"),_("Sites & Users"));
- if(iprel)
- fprintf(stderr, "SARG: %35s (-i) = %s\n",_("IP report"),_("Yes"));
- else
- fprintf(stderr, "SARG: %35s (-i) = %s\n",_("IP report"),_("No"));
+ fprintf(stderr, _("SARG: Date format (-g) = Sites & Users (yyyy/ww)\n"));
+ fprintf(stderr, _("SARG: IP report (-i) = %s\n"),(iprel) ? _("Yes") : _("No"));
for (iarq=0 ; iarq<NAccessLog ; iarq++)
- fprintf(stderr, "SARG: %35s (-l) = %s\n",_("Input log"),AccessLog[iarq]);
- if(Ip2Name)
- fprintf(stderr, "SARG: %35s (-n) = %s\n",_("Resolve IP Address"),_("Yes"));
- else
- fprintf(stderr, "SARG: %35s (-n) = %s\n",_("Resolve IP Address"),_("No"));
- fprintf(stderr, "SARG: %35s (-o) = %s\n",_("Output dir"),outdir);
- if(UserIp)
- fprintf(stderr, "SARG: %35s (-p) = %s\n",_("Use Ip Address instead of userid"),_("Yes"));
- else
- fprintf(stderr, "SARG: %35s (-p) = %s\n",_("Use Ip Address instead of userid"),_("No"));
- fprintf(stderr, "SARG: %35s (-s) = %s\n",_("Accessed site"),site);
- fprintf(stderr, "SARG: %35s (-t) = %s\n",_("Time"),hm);
- fprintf(stderr, "SARG: %35s (-u) = %s\n",_("User"),us);
- fprintf(stderr, "SARG: %35s (-w) = %s\n",_("Temporary dir"),tmp);
- if(debug)
- fprintf(stderr, "SARG: %35s (-x) = %s\n",_("Debug messages"),_("Yes"));
- else
- fprintf(stderr, "SARG: %35s (-x) = %s\n",_("Debug messages"),_("No"));
- if(debugz)
- fprintf(stderr, "SARG: %35s (-z) = %s\n",_("Process messages"),_("Yes"));
- else
- fprintf(stderr, "SARG: %35s (-z) = %s\n",_("Process messages"),_("No"));
- fprintf(stderr, "SARG:\n");
+ fprintf(stderr, _("SARG: Input log (-l) = %s\n"),AccessLog[iarq]);
+ fprintf(stderr, _("SARG: Resolve IP Address (-n) = %s\n"),(Ip2Name) ? _("Yes") : _("No"));
+ fprintf(stderr, _("SARG: Output dir (-o) = %s\n"),outdir);
+ fprintf(stderr, _("SARG: Use Ip Address instead of userid (-p) = %s\n"),(UserIp) ? _("Yes") : _("No"));
+ fprintf(stderr, _("SARG: Accessed site (-s) = %s\n"),site);
+ fprintf(stderr, _("SARG: Time (-t) = %s\n"),hm);
+ fprintf(stderr, _("SARG: User (-u) = %s\n"),us);
+ fprintf(stderr, _("SARG: Temporary dir (-w) = %s\n"),tmp);
+ fprintf(stderr, _("SARG: Debug messages (-x) = %s\n"),(debug) ? _("Yes") : _("No"));
+ fprintf(stderr, _("SARG: Process messages (-z) = %s\n"),(debugz) ? _("Yes") : _("No"));
+ fprintf(stderr, _("SARG:\n"));
}
if(debugm) {
- printf("%s:\nSARG:\n",_("Parameters"));
- printf("%35s (-a) = %s\n",_("Hostname or IP address"),addr);
- printf("%35s (-b) = %s\n",_("Useragent log"),uagent);
- printf("%35s (-c) = %s\n",_("Exclude file"),hexclude);
- printf("%35s (-d) = %s\n",_("Date from-until"),date);
- printf("%35s (-e) = %s\n",_("Email address to send reports"),email);
- printf("%35s (-f) = %s\n",_("Config file"),ConfigFile);
+ printf(_("Parameters:\n"));
+ printf(_(" Hostname or IP address (-a) = %s\n"),addr);
+ printf(_(" Useragent log (-b) = %s\n"),uagent);
+ printf(_(" Exclude file (-c) = %s\n"),hexclude);
+ printf(_(" Date from-until (-d) = %s\n"),date);
+ printf(_(" Email address to send reports (-e) = %s\n"),email);
+ printf(_(" Config file (-f) = %s\n"),ConfigFile);
if(strcmp(df,"e") == 0)
- printf("%35s (-g) = %s (dd/mm/yyyy)\n",_("Date format"),_("Europe"));
+ printf(_(" Date format (-g) = Europe (dd/mm/yyyy)\n"));
if(strcmp(df,"u") == 0)
- printf("%35s (-g) = %s (mm/dd/yyyy)\n",_("Date format"),_("USA"));
+ printf(_(" Date format (-g) = USA (mm/dd/yyyy)\n"));
if(strcmp(df,"w") == 0)
- printf("%35s (-g) = %s (yyyy/ww)\n",_("Date format"),_("Sites & Users"));
- if(iprel)
- printf("%35s (-i) = %s\n",_("IP report"),_("Yes"));
- else
- printf("%35s (-i) = %s\n",_("IP report"),_("No"));
+ printf(_(" Date format (-g) = Sites & Users (yyyy/ww)\n"));
+ printf(_(" IP report (-i) = %s\n"),(iprel) ? _("Yes") : _("No"));
for (iarq=0 ; iarq<NAccessLog ; iarq++)
- printf("%35s (-l) = %s\n",_("Input log"),AccessLog[iarq]);
- if(Ip2Name)
- printf("%35s (-n) = %s\n",_("Resolve IP Address"),_("Yes"));
- else
- printf("%35s (-n) = %s\n",_("Resolve IP Address"),_("No"));
- printf("%35s (-o) = %s\n",_("Output dir"),outdir);
- if(UserIp)
- printf("%35s (-p) = %s\n",_("Use Ip Address instead of userid"),_("Yes"));
- else
- printf("%35s (-p) = %s\n",_("Use Ip Address instead of userid"),_("No"));
- printf("%35s (-s) = %s\n",_("Accessed site"),site);
- printf("%35s (-t) = %s\n",_("Time"),hm);
- printf("%35s (-u) = %s\n",_("User"),us);
- printf("%35s (-w) = %s\n",_("Temporary dir"),tmp);
- if(debug)
- printf("%35s (-x) = %s\n",_("Debug messages"),_("Yes"));
- else
- printf("%35s (-x) = %s\n",_("Debug messages"),_("No"));
- if(debugz)
- printf("%35s (-z) = %s\n",_("Process messages"),_("Yes"));
- else
- printf("%35s (-z) = %s\n",_("Process messages"),_("No"));
- printf("sarg %s: %s\n",_("version"),VERSION);
+ printf(_(" Input log (-l) = %s\n"),AccessLog[iarq]);
+ printf(_(" Resolve IP Address (-n) = %s\n"),(Ip2Name) ? _("Yes") : _("No"));
+ printf(_(" Output dir (-o) = %s\n"),outdir);
+ printf(_("Use Ip Address instead of userid (-p) = %s\n"),(UserIp) ? _("Yes") : _("No"));
+ printf(_(" Accessed site (-s) = %s\n"),site);
+ printf(_(" Time (-t) = %s\n"),hm);
+ printf(_(" User (-u) = %s\n"),us);
+ printf(_(" Temporary dir (-w) = %s\n"),tmp);
+ printf(_(" Debug messages (-x) = %s\n"),(debug) ? _("Yes") : _("No"));
+ printf(_(" Process messages (-z) = %s\n"),(debugz) ? _("Yes") : _("No"));
+ printf(_("sarg version: %s\n"),VERSION);
}
if(debug)
- debuga("sarg %s: %s",_("version"),VERSION);
+ debuga(_("sarg version: %s"),VERSION);
maxopenfiles=MAX_OPEN_USER_FILES;
#ifdef HAVE_RLIM_T
if((ReportType & REPORT_TYPE_DENIED) != 0) {
if((fp_denied=MY_FOPEN(tmp4,"w"))==NULL) {
- fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],_("Cannot open file"),tmp4,strerror(errno));
+ debuga(_("SARG: (log) Cannot open file: %s - %s"),tmp4,strerror(errno));
exit(1);
}
}
if(DataFile[0]=='\0') {
if((ReportType & REPORT_TYPE_DENIED) != 0 || (ReportType & REPORT_TYPE_AUTH_FAILURES) != 0) {
if((fp_authfail=MY_FOPEN(tmp6,"w"))==NULL) {
- fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],_("Cannot open file"),tmp6,strerror(errno));
+ debuga(_("SARG: (log) Cannot open file: %s - %s"),tmp6,strerror(errno));
exit(1);
}
}
if(strcmp(arq,"-")==0) {
if(debug)
- debuga("%s: %s",_("Reading access log file"),"stdin");
+ debuga(_("Reading access log file: from stdin"));
fp_in=stdin;
from_stdin=1;
} else {
decomp(arq,zip,tmp);
if(debug)
- debuga("%s: %s",_("Reading access log file"),arq);
+ debuga(_("Reading access log file: %s"),arq);
if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
- fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],_("Cannot open log file"),arq,strerror(errno));
+ debuga(_("SARG: (log) Cannot open log file: %s - %s"),arq,strerror(errno));
exit(1);
}
from_stdin=0;
}
}
rewind(fp_in);
- printf("SARG: Records in file: %lu, reading: %3.2f%%\r",recs1,(float) 0);
+ printf(_("SARG: Records in file: %lu, reading: %3.2f%%\r"),recs1,(float) 0);
fflush( stdout ) ;
}
if(strncmp(linebuf,"#Software: Mic",14) == 0) {
fixendofline(linebuf);
if (debug)
- debuga("%s: %s",_("Log is from Microsoft ISA"),linebuf);
+ debuga(_("Log is from Microsoft ISA: %s"),linebuf);
ilf=ILF_Isa;
ilf_count[ilf]++;
continue;
}
sprintf(arq_log,"%s/sarg_temp.log",ParsedOutputLog);
if((fp_log=MY_FOPEN(arq_log,"w"))==NULL) {
- fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],_("Cannot open log file"),arq_log,strerror(errno));
+ debuga(_("SARG: (log) Cannot open log file: %s - %s"),arq_log,strerror(errno));
exit(1);
}
fputs("*** SARG Log ***\n",fp_log);