if test "${enable_extraprotection+set}" = set; then
enableval=$enable_extraprotection;
if test "$enableval"; then
- CFLAGS="${CFLAGS} -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=2 -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter"
+ CFLAGS="${CFLAGS} -fstack-protector -D_FORTIFY_SOURCE=2 -Werror"
+
+ { echo "$as_me:$LINENO: checking for format security flag in gcc" >&5
+echo $ECHO_N "checking for format security flag in gcc... $ECHO_C" >&6; }
+ saved_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} -Werror=format-security"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ have_format_security="yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ have_format_security="no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { echo "$as_me:$LINENO: result: have_format_security" >&5
+echo "${ECHO_T}have_format_security" >&6; }
+ if test "$have_format_security" == "no" ; then
+ CFLAGS="${saved_CFLAGS}"
+ fi
fi
fi
char agent_old[MAXLEN]="$#%0a3bc6";
char hfile[MAXLEN];
char idate[MAXLEN], fdate[MAXLEN];
- int agentot=0, agentot2=0, agentdif=0, cont=0;
+ int agentot=0, agentot2=0, agentdif=0, cont=0, nagent;
unsigned long totregsl=0;
int cstatus;
char ftime[128];
if(strlen(user) == 0)
strcpy(user,ip);
- fprintf(fp_ou,"%s\t%s\t%s\t%s\n",ip,data,agent,user);
+ fprintf(fp_ou,"%s\t%s\t%s\n",ip,agent,user);
user[0]='\0';
}
fclose(fp_in);
fclose(fp_ou);
- if (fp_ht) {
- fclose(fp_ht);
- }
-
if(debug) {
debuga("%s: %s",text[54],tmp2);
}
- sprintf(csort,"sort -n -t \"\t\" -k 4,4 -k 3,3 -k 2,2 -k 1,1 -o \"%s\" \"%s\"",tmp2,tmp3);
+ sprintf(csort,"sort -n -t \"\t\" -k 3,3 -k 2,2 -k 1,1 -o \"%s\" \"%s\"",tmp2,tmp3);
cstatus=system(csort);
if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
fprintf(stderr, "SARG: sort command return status %d\n",WEXITSTATUS(cstatus));
} else strcpy(ip,namebefore);
}
- if (getword(data,sizeof(data),buf,'\t')<0 || getword(agent,sizeof(agent),buf,'\t')<0 ||
+ if (getword(agent,sizeof(agent),buf,'\t')<0 ||
getword(user,sizeof(user),buf,'\t')<0) {
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",tmp2);
exit(1);
fclose(fp_in);
fclose(fp_ou);
- sprintf(csort,"sort -n -t \"\t\" -k 3,3 -o \"%s\" \"%s\"",tmp3,tmp2);
+ sprintf(csort,"sort -t \"\t\" -k 2,2 -o \"%s\" \"%s\"",tmp3,tmp2);
cstatus=system(csort);
if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
fprintf(stderr, "SARG: sort command return status %d\n",WEXITSTATUS(cstatus));
}
agent_old[0]='\0';
+ cont=0;
while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
- if (getword(ip,sizeof(ip),buf,'\t')<0 || getword(data,sizeof(data),buf,'\t')<0 ||
+ if (getword(ip,sizeof(ip),buf,'\t')<0 ||
getword(agent,sizeof(agent),buf,'\t')<0) {
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",tmp);
exit(1);
strcpy(agent_old,agent);
}
- agentot++;
-
if(strcmp(agent,agent_old) != 0) {
agentdif++;
fprintf(fp_ou,"%06d %s\n",agentot,agent_old);
strcpy(agent_old,agent);
agentot2+=agentot;
- agentot=1;
+ agentot=0;
}
+ agentot++;
}
agentdif++;
fprintf(fp_ou,"%06d %s\n",agentot,agent);
fputs("<div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\">\n",fp_ht);
fprintf(fp_ht,"<tr><th align=\"left\" bgcolor=\"%s\"><font color=\"%s\">%s</font></th><th bgcolor=\"%s\" align=\"left\"><font color=\"%s\">%s</font></th><th align=\"center\" bgcolor=\"%s\"><font color=\"%s\">%%</font></th></tr>\n",HeaderBgColor,HeaderColor,text[106],HeaderBgColor,HeaderColor,text[107],HeaderBgColor,HeaderColor);
+ perc=0.;
while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
fixendofline(buf);
if (getword(tagent,sizeof(tagent),buf,' ')<0) {
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",tmp);
exit(1);
}
- perc=atoi(tagent) * 100;
- perc=perc / agentot2;
+ nagent=atoi(tagent);
+ if(agentot2>0) {
+ perc=nagent * 100;
+ perc=perc / agentot2;
+ }
- fprintf(fp_ht,"<tr><td align=\"left\" bgcolor=\"%s\">%s</td><td align=\"right\" bgcolor=\"%s\">%d</td><td align=\"right\" bgcolor=\"%s\">%3.2f</td></tr>\n",TxBgColor,buf,TxBgColor,atoi(tagent),TxBgColor,perc);
+ fprintf(fp_ht,"<tr><td align=\"left\" bgcolor=\"%s\">%s</td><td align=\"right\" bgcolor=\"%s\">%d</td><td align=\"right\" bgcolor=\"%s\">%3.2f</td></tr>\n",TxBgColor,buf,TxBgColor,nagent,TxBgColor,perc);
}
fputs("</table></html>\n",fp_ht);