]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Remove all the warnings (inspired from patch #1771501).
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 6 Jul 2009 14:21:54 +0000 (14:21 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 6 Jul 2009 14:21:54 +0000 (14:21 +0000)
40 files changed:
authfail.c
charset.c
configure
configure.in
convlog.c
css.c
dansguardian_log.c
dansguardian_report.c
datafile.c
decomp.c
denied.c
download.c
email.c
exclude.c
getconf.c
grepday.c
html.c
include/conf.h
index.c
indexonly.c
ip2name.c
language.c
lastlog.c
log.c
realtime.c
repday.c
report.c
siteuser.c
smartfilter.c
sort.c
splitlog.c
squidguard_log.c
squidguard_report.c
topsites.c
topuser.c
totday.c
totger.c
usage.c
useragent.c
util.c

index 843d60265b87cfeb49651b0e5dd18bf8b738352e..69ebbfbdba9430785d3e9aebe67ccd954783d4e3 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void authfail_report()
+void authfail_report(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL;
@@ -78,7 +78,7 @@ void authfail_report()
       exit(1);
    }
 #if defined(HAVE_FOPEN64)
-   if((fp_in=(long)fopen64(authfail_in,"r"))==NULL) {
+   if((fp_in=fopen64(authfail_in,"r"))==NULL) {
 #else
    if((fp_in=fopen(authfail_in,"r"))==NULL) {
 #endif
@@ -89,7 +89,7 @@ void authfail_report()
    unlink(tmp4);
 
 #if defined(HAVE_FOPEN64)
-   if((fp_ou=(long)fopen64(report,"w"))==NULL) {
+   if((fp_ou=fopen64(report,"w"))==NULL) {
 #else
    if((fp_ou=fopen(report,"w"))==NULL) {
 #endif
index d5d94ee3554754f969f9ff2cfdec05fd46d1b6d6..1bf02510852b54198243c0be5146e84c8e74e952 100644 (file)
--- a/charset.c
+++ b/charset.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void ccharset()
+void ccharset(char *CharSet)
 {
    if(strcmp(CharSet,"Latin2") == 0) strcpy(CharSet,"ISO-8859-2");
    else if(strcmp(CharSet,"Latin3") == 0) strcpy(CharSet,"ISO-8859-3");
index 2830c433ed07d578d553931970981eef113fe88a..86358cf3466d05367468b42e6bb42f736117159f 100755 (executable)
--- a/configure
+++ b/configure
@@ -1259,6 +1259,7 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-rpath         do not hardcode runtime library paths
+  --disable-largefile     omit support for large files
   --enable-bindir=bindir
                         Select bindir
   --enable-mandir=mandir
@@ -2760,10 +2761,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 esac
 
 if test "${CC}" = "cc" ; then
-   CFLAGS="${CFLAGS} -w -g -O2 -Aa"
+   CFLAGS="${CFLAGS} -Wall -g -O2 -Aa -Werror=implicit"
 else
-   CFLAGS="${CFLAGS} -w"
+   CFLAGS="${CFLAGS} -Wall -Werror=implicit-function-declaration"
 fi
+CPPFLAGS="${CFLAGS}"
 
 case "$host" in
    *-solaris*)
@@ -5048,6 +5050,472 @@ _ACEOF
 fi
 
 
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+        # IRIX 6.2 and later do not support large files by default,
+        # so use the C compiler's -n32 option if that helps.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_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
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+        CC="$CC -n32"
+        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
+  ac_cv_sys_largefile_CC=' -n32'; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+        break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_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
+  ac_cv_sys_file_offset_bits=no; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_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
+  ac_cv_sys_file_offset_bits=64; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -f conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_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
+  ac_cv_sys_large_files=no; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_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
+  ac_cv_sys_large_files=1; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -f conftest*
+  fi
+fi
+
+
+# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
+# needs to be defined for it
+{ echo "$as_me:$LINENO: checking for fopen64" >&5
+echo $ECHO_N "checking for fopen64... $ECHO_C" >&6; }
+if test "${bu_cv_have_fopen64+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen64 ("/tmp/foo","r");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+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_link") 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_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  bu_cv_have_fopen64=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       saved_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen64 ("/tmp/foo","r");
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+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_link") 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_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       bu_cv_have_fopen64=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+ CPPFLAGS=$saved_CPPFLAGS
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+
+{ echo "$as_me:$LINENO: result: $bu_cv_have_fopen64" >&5
+echo "${ECHO_T}$bu_cv_have_fopen64" >&6; }
+if test "$bu_cv_have_fopen64" != no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_FOPEN64 1
+_ACEOF
+
+  if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _LARGEFILE64_SOURCE 1
+_ACEOF
+
+  fi
+fi
+
+
 { echo "$as_me:$LINENO: checking for off_t" >&5
 echo $ECHO_N "checking for off_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_off_t+set}" = set; then
@@ -5059,8 +5527,435 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-typedef off_t ac__type_new_;
+$ac_includes_default
+typedef off_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+  return 0;
+if (sizeof (ac__type_new_))
+  return 0;
+  ;
+  return 0;
+}
+_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
+  ac_cv_type_off_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_type_off_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6; }
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ echo "$as_me:$LINENO: checking size of off_t" >&5
+echo $ECHO_N "checking size of off_t... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_off_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_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
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_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
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_lo=`expr $ac_mid + 1`
+                       if test $ac_lo -le $ac_mid; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_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
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_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
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_hi=`expr '(' $ac_mid ')' - 1`
+                       if test $ac_mid -le $ac_hi; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_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
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_off_t=$ac_lo;;
+'') if test "$ac_cv_type_off_t" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (off_t)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_off_t=0
+   fi ;;
+esac
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+   typedef off_t ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+       return 1;
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+       return 1;
+      fprintf (f, "%lu\n", i);
+    }
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+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_link") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (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_try") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_off_t=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_off_t" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (off_t)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+   else
+     ac_cv_sizeof_off_t=0
+   fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
+_ACEOF
+
+
+if test $ac_cv_sizeof_off_t = "4"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define OFFSET_STRING "%d"
+_ACEOF
+
+elif test $ac_cv_sizeof_off_t = "8"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define OFFSET_STRING "%lli"
+_ACEOF
+
+else
+    { { echo "$as_me:$LINENO: error: can not detect the size of your system\'s off_t type" >&5
+echo "$as_me: error: can not detect the size of your system\'s off_t type" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+{ echo "$as_me:$LINENO: checking for rlim_t" >&5
+echo $ECHO_N "checking for rlim_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_rlim_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+
+typedef rlim_t ac__type_new_;
 int
 main ()
 {
@@ -5089,26 +5984,26 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_off_t=yes
+  ac_cv_type_rlim_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_off_t=no
+       ac_cv_type_rlim_t=no
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-echo "${ECHO_T}$ac_cv_type_off_t" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_type_rlim_t" >&5
+echo "${ECHO_T}$ac_cv_type_rlim_t" >&6; }
 
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of off_t" >&5
-echo $ECHO_N "checking size of off_t... $ECHO_C" >&6; }
-if test "${ac_cv_sizeof_off_t+set}" = set; then
+{ echo "$as_me:$LINENO: checking size of rlim_t" >&5
+echo $ECHO_N "checking size of rlim_t... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_rlim_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test "$cross_compiling" = yes; then
@@ -5119,8 +6014,12 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-   typedef off_t ac__type_sizeof_;
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+
+   typedef rlim_t ac__type_sizeof_;
 int
 main ()
 {
@@ -5156,8 +6055,12 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-   typedef off_t ac__type_sizeof_;
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+
+   typedef rlim_t ac__type_sizeof_;
 int
 main ()
 {
@@ -5210,8 +6113,12 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-   typedef off_t ac__type_sizeof_;
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+
+   typedef rlim_t ac__type_sizeof_;
 int
 main ()
 {
@@ -5247,8 +6154,12 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-   typedef off_t ac__type_sizeof_;
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+
+   typedef rlim_t ac__type_sizeof_;
 int
 main ()
 {
@@ -5311,8 +6222,12 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-   typedef off_t ac__type_sizeof_;
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+
+   typedef rlim_t ac__type_sizeof_;
 int
 main ()
 {
@@ -5351,15 +6266,15 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 case $ac_lo in
-?*) ac_cv_sizeof_off_t=$ac_lo;;
-'') if test "$ac_cv_type_off_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
+?*) ac_cv_sizeof_rlim_t=$ac_lo;;
+'') if test "$ac_cv_type_rlim_t" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (rlim_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (off_t)
+echo "$as_me: error: cannot compute sizeof (rlim_t)
 See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }
    else
-     ac_cv_sizeof_off_t=0
+     ac_cv_sizeof_rlim_t=0
    fi ;;
 esac
 else
@@ -5369,8 +6284,12 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-   typedef off_t ac__type_sizeof_;
+#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+
+   typedef rlim_t ac__type_sizeof_;
 static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
 static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
 #include <stdio.h>
@@ -5422,170 +6341,55 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_sizeof_off_t=`cat conftest.val`
+  ac_cv_sizeof_rlim_t=`cat conftest.val`
 else
   echo "$as_me: program exited with status $ac_status" >&5
 echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-if test "$ac_cv_type_off_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
+if test "$ac_cv_type_rlim_t" = yes; then
+     { { echo "$as_me:$LINENO: error: cannot compute sizeof (rlim_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (off_t)
+echo "$as_me: error: cannot compute sizeof (rlim_t)
 See \`config.log' for more details." >&2;}
    { (exit 77); exit 77; }; }
    else
-     ac_cv_sizeof_off_t=0
+     ac_cv_sizeof_rlim_t=0
    fi
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
-echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_rlim_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_rlim_t" >&6; }
 
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
+#define SIZEOF_RLIM_T $ac_cv_sizeof_rlim_t
 _ACEOF
 
 
-if test $ac_cv_sizeof_off_t = "4"; then
+if test $ac_cv_sizeof_rlim_t = "4"; then
 
 cat >>confdefs.h <<\_ACEOF
-#define OFFSET_STRING "%d"
+#define RLIM_STRING "%d"
 _ACEOF
 
-elif test $ac_cv_sizeof_off_t = "8"; then
+elif test $ac_cv_sizeof_rlim_t = "8"; then
 
 cat >>confdefs.h <<\_ACEOF
-#define OFFSET_STRING "%lli"
+#define RLIM_STRING "%lli"
 _ACEOF
 
 else
-    { { echo "$as_me:$LINENO: error: can not detect the size of your system\'s off_t type" >&5
-echo "$as_me: error: can not detect the size of your system\'s off_t type" >&2;}
+    { { echo "$as_me:$LINENO: error: can not detect the size of your system\'s rlim_t type" >&5
+echo "$as_me: error: can not detect the size of your system\'s rlim_t type" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
-# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
-# needs to be defined for it
-{ echo "$as_me:$LINENO: checking for fopen64" >&5
-echo $ECHO_N "checking for fopen64... $ECHO_C" >&6; }
-if test "${bu_cv_have_fopen64+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen64 ("/tmp/foo","r");
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-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_link") 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_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  bu_cv_have_fopen64=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       saved_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen64 ("/tmp/foo","r");
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-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_link") 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_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       bu_cv_have_fopen64=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
- CPPFLAGS=$saved_CPPFLAGS
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-
-{ echo "$as_me:$LINENO: result: $bu_cv_have_fopen64" >&5
-echo "${ECHO_T}$bu_cv_have_fopen64" >&6; }
-if test "$bu_cv_have_fopen64" != no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FOPEN64 1
-_ACEOF
-
-  if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _LARGEFILE64_SOURCE 1
-_ACEOF
-
-  fi
-fi
-
-
 # Check whether --enable-bindir was given.
 if test "${enable_bindir+set}" = set; then
   enableval=$enable_bindir;
index 1d74b81412911ce1cb4b0a2b3c480155345b2586..74e658fdcfc5d748c956ade984ec67322e3196af 100644 (file)
@@ -20,10 +20,11 @@ dnl  *   ) AC_PROG_CXX ;;
 esac
 
 if test "${CC}" = "cc" ; then
-   CFLAGS="${CFLAGS} -w -g -O2 -Aa"
+   CFLAGS="${CFLAGS} -Wall -g -O2 -Aa -Werror=implicit"
 else
-   CFLAGS="${CFLAGS} -w"
+   CFLAGS="${CFLAGS} -Wall -Werror=implicit-function-declaration"
 fi
+CPPFLAGS="${CFLAGS}"
 
 case "$host" in
    *-solaris*)
@@ -56,15 +57,7 @@ dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_STRUCT_TM
 
-dnl check for the off_t size
-AC_CHECK_SIZEOF(off_t)
-if test $ac_cv_sizeof_off_t = "4"; then
-    AC_DEFINE(OFFSET_STRING, "%d", [Offset string])
-elif test $ac_cv_sizeof_off_t = "8"; then
-    AC_DEFINE(OFFSET_STRING, "%lli", [Offset string])
-else
-    AC_MSG_ERROR([can not detect the size of your system\'s off_t type])
-fi
+AC_SYS_LARGEFILE
 
 # Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
 # needs to be defined for it
@@ -87,6 +80,29 @@ if test "$bu_cv_have_fopen64" != no; then
 fi
 
 
+dnl check for the off_t size
+AC_CHECK_SIZEOF(off_t)
+if test $ac_cv_sizeof_off_t = "4"; then
+    AC_DEFINE(OFFSET_STRING, "%d", [Offset string])
+elif test $ac_cv_sizeof_off_t = "8"; then
+    AC_DEFINE(OFFSET_STRING, "%lli", [Offset string])
+else
+    AC_MSG_ERROR([can not detect the size of your system\'s off_t type])
+fi
+
+dnl check for the rlim_t size
+AC_CHECK_SIZEOF(rlim_t,1,[#if HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+])
+if test $ac_cv_sizeof_rlim_t = "4"; then
+    AC_DEFINE(RLIM_STRING, "%d", [Rlim string])
+elif test $ac_cv_sizeof_rlim_t = "8"; then
+    AC_DEFINE(RLIM_STRING, "%lli", [Rlim string])
+else
+    AC_MSG_ERROR([can not detect the size of your system\'s rlim_t type])
+fi
+
 dnl Select bindir
 AC_ARG_ENABLE(bindir,
 [  --enable-bindir=bindir
index 2c09b9e04e9150a38e49f6b7645d8f26797ad558..ef109435c02f948a06b12cfe8bafc9013c13c773 100644 (file)
--- a/convlog.c
+++ b/convlog.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void convlog(char *arq, char *df, int dfrom, int duntil)
+void convlog(const char *arq, char *df, int dfrom, int duntil)
 {
 
    FILE *fp_in;
@@ -39,10 +39,10 @@ void convlog(char *arq, char *df, int dfrom, int duntil)
    struct tm *t;
 
    if(arq[0] == '\0')
-      strcpy(arq,"/usr/local/squid/logs/access.log");
+      arq="/usr/local/squid/logs/access.log";
 
 #if defined(HAVE_FOPEN64)
-   if((fp_in=(long)fopen64(arq,"r"))==NULL) {
+   if((fp_in=fopen64(arq,"r"))==NULL) {
 #else
    if((fp_in=fopen(arq,"r"))==NULL) {
 #endif
diff --git a/css.c b/css.c
index bf4e0af570077d787eeafb4f1bde89e1e148dfb5..565048c59c084a367a1ab647c92eb9807ba4cb23 100644 (file)
--- a/css.c
+++ b/css.c
@@ -59,7 +59,7 @@ void css(FILE *fp_css)
    fprintf(fp_css,".data2 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
    fprintf(fp_css,".data3 {font-family:%s;color:%s;font-size:%s;text-align:center;background-color:%s;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}\n", FontFace, TxColor, FontSize, TxBgColor);
    fprintf(fp_css,".data3 a:link,a:visited {font-family:%s;color:#0000FF;font-size:%s;text-align:center;background-color:%s;text-decoration:none;}\n", FontFace, FontSize, TxBgColor);
-   fprintf(fp_css,".text {font-family:%s;color:%s;font-size:%s;text-align:right;}\n", FontFace, TxColor, FontSize, TxBgColor);
+   fprintf(fp_css,".text {font-family:%s;color:%s;font-size:%s;background-color:%s;text-align:right;}\n", FontFace, TxColor, FontSize, TxBgColor);
    fprintf(fp_css,".link {font-family:%s;font-size:%s;color:#0000FF;}\n", FontFace, FontSize);
    fprintf(fp_css,".link a:link,a:visited {font-family:%s;font-size:%s;color:#0000FF;text-decoration:none;}\n</style>\n", FontFace, FontSize);
 }
index af73f950367a9e2c721671ee1757b8c8ac260d54..3588d437c265f85665e1ceba16bb24a2325f6fdc 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-int dansguardian_log()
+void dansguardian_log(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL, *fp_guard = NULL;
@@ -38,7 +38,6 @@ int dansguardian_log()
    char ip[30];
    char wdata[127];
    int  idata=0;
-   int  x, y;
    int cstatus;
 
    bzero(day, 3);
@@ -88,7 +87,7 @@ int dansguardian_log()
    }
 
 #if defined(HAVE_FOPEN64)
-   if((fp_ou=(long)fopen64(guard_in,"a"))==NULL) {
+   if((fp_ou=fopen64(guard_in,"a"))==NULL) {
 #else
    if((fp_ou=fopen(guard_in,"a"))==NULL) {
 #endif
@@ -121,7 +120,7 @@ int dansguardian_log()
    }
    
 #if defined(HAVE_FOPEN64)
-   if((fp_in=(long)fopen64(loglocation,"r"))==NULL) {
+   if((fp_in=fopen64(loglocation,"r"))==NULL) {
 #else
    if((fp_in=fopen(loglocation,"r"))==NULL) {
 #endif
@@ -175,5 +174,4 @@ int dansguardian_log()
       exit(1);
    }
    unlink(guard_in);
-   return;
 }
index b87c662cb224808e184a49abdef4ab749b7bd0d7..1ae3f3fec5ae18af43b4ce4ef985664c32fe4723 100644 (file)
 
 #include "include/conf.h"
 
-void dansguardian_report()
+void dansguardian_report(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL;
       
    char url[MAXLEN];
-   char html[MAXLEN];
    char html2[MAXLEN];
    char dansguardian_in[MAXLEN];
-   char dansguardian_ou[MAXLEN];
    char per[MAXLEN];
    char report[MAXLEN];
    char period[100];
@@ -46,7 +44,6 @@ void dansguardian_report()
    char date[15];
    char date2[15];
    char hour[15];
-   char ftime[128];
    char *str;
    int  z=0;
    int  count=0;
@@ -71,7 +68,7 @@ void dansguardian_report()
    fclose(fp_in);
 
 #if defined(HAVE_FOPEN64)
-   if((fp_in=(long)fopen64(dansguardian_in,"r"))==NULL) {
+   if((fp_in=fopen64(dansguardian_in,"r"))==NULL) {
 #else
    if((fp_in=fopen(dansguardian_in,"r"))==NULL) {
 #endif
@@ -80,7 +77,7 @@ void dansguardian_report()
    }
 
 #if defined(HAVE_FOPEN64)
-   if((fp_ou=(long)fopen64(report,"w"))==NULL) {
+   if((fp_ou=fopen64(report,"w"))==NULL) {
 #else
    if((fp_ou=fopen(report,"w"))==NULL) {
 #endif
index c94ec408145db923a60d6e538eb8fd465adfa145..850230f87096049f470082f1cb82180471626f12 100644 (file)
@@ -66,7 +66,7 @@ void data_file(char *tmp)
       sprintf(tmp3,"%s/%s",tmp,direntp->d_name);
 
 #if defined(HAVE_FOPEN64)
-      if((fp_in=(long)fopen64(tmp3,"r"))==NULL){
+      if((fp_in=fopen64(tmp3,"r"))==NULL){
 #else
       if((fp_in=fopen(tmp3,"r"))==NULL){
 #endif
@@ -74,7 +74,6 @@ void data_file(char *tmp)
          exit(1);
       }
       strcpy(wdname,direntp->d_name);
-      strip_prefix:
       if (getword(wname2,sizeof(wname2),wdname,'.')<0) {
          printf("SARG: Maybe you have a broken record or garbage in your %s directory.\n",tmp);
          exit(1);
@@ -161,16 +160,15 @@ void data_file(char *tmp)
 
 void saverecs(char *dirname, char *user, long long int nacc, char *url, long long int nbytes, char *ip, char *hora, char *dia, long long int nelap, long long int incache, long long int oucache)
 {
-
    FILE *fp_ou;
    char reg[MAXLEN];
 
 #if defined(HAVE_FOPEN64)
-   if((fp_ou=(long)fopen64(DataFile,"a"))==NULL){
+   if((fp_ou=fopen64(DataFile,"a"))==NULL){
 #else
    if((fp_ou=fopen(DataFile,"a"))==NULL){
 #endif
-       fprintf(stderr, "SARG: (datafile) %s: %s\n",text[45],DataFile);
+      fprintf(stderr, "SARG: (datafile) %s: %s\n",text[45],DataFile);
       exit(1);
    }
 
index 3a3be2e48d5e98b102fa18b5adc4722b004dc47b..2f9fb719e91cdd022c3336095512f58561b58ac7 100644 (file)
--- a/decomp.c
+++ b/decomp.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void decomp(char *arq, char *zip, char *tmp)
+void decomp(char *arq, char *zip, const char *tmp)
 {
    char cmd[1024];
    int cstatus;
@@ -85,7 +85,7 @@ void decomp(char *arq, char *zip, char *tmp)
 }
 
 
-void recomp(char *arq, char *zip) 
+void recomp(const char *arq, const char *zip) 
 {
    char cmd[1024];
    int cstatus;
index 21f20dd3d1e073d58bb9684ee8c3c82fe1f9d1f9..66bc392822e527552459a60f37ceeaa88544c01d 100644 (file)
--- a/denied.c
+++ b/denied.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void gen_denied_report()
+void gen_denied_report(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL;
@@ -67,7 +67,7 @@ void gen_denied_report()
    fclose(fp_in);
 
 #if defined(HAVE_FOPEN64)
-   if((fp_in=(long)fopen64(denied_in,"r"))==NULL) {
+   if((fp_in=fopen64(denied_in,"r"))==NULL) {
 #else
    if((fp_in=fopen(denied_in,"r"))==NULL) {
 #endif
@@ -76,7 +76,7 @@ void gen_denied_report()
    }
 
 #if defined(HAVE_FOPEN64)
-   if((fp_ou=(long)fopen64(report,"w"))==NULL) {
+   if((fp_ou=fopen64(report,"w"))==NULL) {
 #else
    if((fp_ou=fopen(report,"w"))==NULL) {
 #endif
index bb3c56ae2d5cc08690437429750d991a5a550dc8..ee47d79314f25335ff05b9305cc1c47d94913ac2 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void download_report()
+void download_report(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL;
@@ -68,7 +68,7 @@ void download_report()
    fclose(fp_in);
 
 #if defined(HAVE_FOPEN64)
-   if((fp_in=(long)fopen64(report_in,"r"))==NULL) {
+   if((fp_in=fopen64(report_in,"r"))==NULL) {
 #else
    if((fp_in=fopen(report_in,"r"))==NULL) {
 #endif
@@ -77,7 +77,7 @@ void download_report()
    }
 
 #if defined(HAVE_FOPEN64)
-   if((fp_ou=(long)fopen64(report,"w"))==NULL) {
+   if((fp_ou=fopen64(report,"w"))==NULL) {
 #else
    if((fp_ou=fopen(report,"w"))==NULL) {
 #endif
diff --git a/email.c b/email.c
index 8974ad3c25b1cbb2893b4466764bd375d7757cf6..fafabe1a6598ac83c7be285b54349758c4abe0f6 100644 (file)
--- a/email.c
+++ b/email.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-int geramail(const char *dirname, int debug, const char *outdir, int userip, char *email, char *TempDir)
+int geramail(const char *dirname, int debug, const char *outdir, int userip, const char *email, const char *TempDir)
 {
 
    FILE *fp_in, *fp_top1, *fp_top2, *fp_top3;
index f4a1840fad7817e7450111645d49d47e4988dbb6..1d0ad4f0f02935b4fb8c9c29f1faff58fa277306 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-int vhexclude(char *excludefile, char *url)
+int vhexclude(const char *excludefile, const char *url)
 {
 
    char whost[1024];
@@ -34,12 +34,12 @@ int vhexclude(char *excludefile, char *url)
    int len = strlen(excludefile);
 
    if((str=(char *) malloc(len+1))==NULL) {
-         fprintf(stderr, "SARG: %s (%ld):\n",text[59], len);
+         fprintf(stderr, "SARG: %s (%d):\n",text[59], len);
          exit(1);
    }
    len = strlen(url);
    if((wurl=(char *) malloc(len+1))==NULL) {
-         fprintf(stderr, "SARG: %s (%ld):\n",text[59], len);
+         fprintf(stderr, "SARG: %s (%d):\n",text[59], len);
          exit(1);
    }
    whost[0]='\0';
@@ -90,16 +90,17 @@ int vhexclude(char *excludefile, char *url)
 }
 
 
-int vuexclude(char *excludeuser, char *user)
+int vuexclude(const char *excludeuser, const char *user)
 {
+   const char *wuser;
+   int len;
 
-   char wuser[MAXLEN];
-
-   strcpy(wuser,user);
-   strcat(wuser," ");
-
-   if(strstr(excludeuser,wuser) != 0 )
-      return(0);
-
+   len=strlen(user);
+   wuser=excludeuser;
+   while ((wuser=strstr(wuser,user))!=NULL) {
+      if (wuser[len]==' ') return(0);
+      wuser+=len;
+   }
+         
    return(1);
 }
index 86f242e0a530e44338a9295122f65dbc51925c8c..a81b1e7973041f5b83981d6bedb9e726e55dc2a4 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -1089,7 +1089,7 @@ void parmtest(char *buf)
       }
 }
 
-void getconf()
+void getconf(void)
 {
 
    FILE *fp_in;
index 2b2153b51de264eb4b345192552de7d44c9962c7..a4b6f6d0c096805c5cba76810cbd2c02adcfc180 100644 (file)
--- a/grepday.c
+++ b/grepday.c
@@ -71,76 +71,76 @@ char * I18NgdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
 #define SARGgdImageStringFT gdImageStringFT
 #endif
 
-void *bar(long long int *n)
+void bar(long long int n)
 {     
 #ifdef HAVE_GD
    gdPoint points[4];
    int brect[8];
    int val=0, x;
-   long long int lim, num;
+   long long int num;
    char v[15];
 
-   static char limits[400][12]={"0","500","1000","2000","3000","4000",
-       "5000","6000","7000","8000","9000","10000",
-       "20000","30000","40000","50000","70000","90000",
-       "110000","130000","150000","170000","190000","210000",
-       "230000","250000","280000","310000","340000","370000",
-       "400000","430000","450000","460000","490000","500000",
-       "550000","600000","650000","700000","750000","800000",
-       "850000","900000","950000","1000000","1100000","1200000",
-       "1300000","1400000","1500000","1600000","1700000","1800000",
-       "1900000","2000000","2100000","2200000","2300000","2400000",
-       "2500000","2600000","2700000","2800000","2900000","3000000",
-       "3100000","3200000","3300000","3400000","3500000","3600000",
-       "3700000","3800000","3900000","4000000","4100000","4200000",
-       "4300000","4400000","4500000","4600000","4700000","4800000",
-       "4900000","5000000","5100000","5200000","5300000","5400000",
-       "5500000","5600000","5700000","5800000","5900000","6000000",
-       "6100000","6200000","6300000","6400000","6500000","6600000",
-       "6700000","6800000","6900000","7000000","7100000","7200000",
-       "7300000","7400000","7500000","7600000","7700000","7800000",
-       "7900000","8000000","8100000","8200000","8300000","8400000",
-       "8500000","8600000","8700000","8800000","8900000","9000000",
-       "9100000","9200000","9300000","9400000","9500000","9600000",
-       "9700000","9800000","9900000","10000000","10500000","11000000",
-       "11500000","12000000","12500000","13000000","13500000","14000000",
-       "14500000","15000000","15500000","16000000","16500000","17000000",
-       "17500000","18000000","18500000","19000000","19500000","20000000",
-       "21000000","22000000","23000000","24000000","25000000","26000000",
-       "27000000","28000000","29000000","30000000","31000000","32000000",
-       "33000000","34000000","35000000","36000000","37000000","38000000",
-       "39000000","40000000","41000000","42000000","43000000","44000000",
-       "45000000","46000000","47000000","48000000","49000000","50000000",
-       "51000000","52000000","53000000","54000000","55000000","56000000",
-       "57000000","58000000","59000000","60000000","61000000","62000000",
-       "63000000","64000000","65000000","66000000","67000000","68000000",
-       "69000000","70000000","71000000","72000000","73000000","74000000",
-       "75000000","76000000","77000000","78000000","79000000","80000000",
-       "81000000","82000000","83000000","84000000","85000000","86000000",
-       "87000000","88000000","89000000","90000000","91000000","92000000",
-       "93000000","94000000","95000000","96000000","97000000","98000000",
-       "99000000","100000000","110000000","120000000","130000000","140000000",
-       "150000000","160000000","170000000","180000000","190000000","200000000",
-       "210000000","220000000","230000000","240000000","250000000","260000000",
-       "270000000","280000000","290000000","300000000","310000000","320000000",
-       "330000000","340000000","350000000","360000000","370000000","380000000",
-       "390000000","400000000","410000000","420000000","430000000","440000000",
-       "450000000","460000000","470000000","480000000","490000000","500000000",
-       "510000000","520000000","530000000","540000000","550000000","560000000",
-       "570000000","580000000","590000000","600000000","610000000","620000000",
-       "630000000","640000000","650000000","660000000","670000000","680000000",
-       "690000000","700000000","710000000","720000000","730000000","740000000",
-       "750000000","760000000","770000000","780000000","790000000","800000000",
-       "810000000","820000000","830000000","840000000","850000000","860000000",
-       "870000000","880000000","890000000","900000000","910000000","920000000",
-       "930000000","940000000","950000000","960000000","970000000","980000000",
-       "990000000","1000000000","1100000000","1200000000","1300000000","1400000000",
-       "1500000000","1600000000","1700000000","1800000000","1900000000","2000000000",
-       "2100000000","2200000000","2300000000","2400000000","2500000000","2600000000",
-       "2700000000","2800000000","2900000000","3000000000","3100000000","3200000000",
-       "3300000000","3400000000","3500000000","3600000000","3700000000","3800000000",
-       "3900000000","4000000000","4100000000","4200000000","4300000000","4400000000",
-       "4500000000","4600000000","4700000000","4800000000","4900000000","5000000000"};
+   static const long long int limits[400]={0,500,1000,2000,3000,4000,
+       5000,6000,7000,8000,9000,10000,
+       20000,30000,40000,50000,70000,90000,
+       110000,130000,150000,170000,190000,210000,
+       230000,250000,280000,310000,340000,370000,
+       400000,430000,450000,460000,490000,500000,
+       550000,600000,650000,700000,750000,800000,
+       850000,900000,950000,1000000,1100000,1200000,
+       1300000,1400000,1500000,1600000,1700000,1800000,
+       1900000,2000000,2100000,2200000,2300000,2400000,
+       2500000,2600000,2700000,2800000,2900000,3000000,
+       3100000,3200000,3300000,3400000,3500000,3600000,
+       3700000,3800000,3900000,4000000,4100000,4200000,
+       4300000,4400000,4500000,4600000,4700000,4800000,
+       4900000,5000000,5100000,5200000,5300000,5400000,
+       5500000,5600000,5700000,5800000,5900000,6000000,
+       6100000,6200000,6300000,6400000,6500000,6600000,
+       6700000,6800000,6900000,7000000,7100000,7200000,
+       7300000,7400000,7500000,7600000,7700000,7800000,
+       7900000,8000000,8100000,8200000,8300000,8400000,
+       8500000,8600000,8700000,8800000,8900000,9000000,
+       9100000,9200000,9300000,9400000,9500000,9600000,
+       9700000,9800000,9900000,10000000,10500000,11000000,
+       11500000,12000000,12500000,13000000,13500000,14000000,
+       14500000,15000000,15500000,16000000,16500000,17000000,
+       17500000,18000000,18500000,19000000,19500000,20000000,
+       21000000,22000000,23000000,24000000,25000000,26000000,
+       27000000,28000000,29000000,30000000,31000000,32000000,
+       33000000,34000000,35000000,36000000,37000000,38000000,
+       39000000,40000000,41000000,42000000,43000000,44000000,
+       45000000,46000000,47000000,48000000,49000000,50000000,
+       51000000,52000000,53000000,54000000,55000000,56000000,
+       57000000,58000000,59000000,60000000,61000000,62000000,
+       63000000,64000000,65000000,66000000,67000000,68000000,
+       69000000,70000000,71000000,72000000,73000000,74000000,
+       75000000,76000000,77000000,78000000,79000000,80000000,
+       81000000,82000000,83000000,84000000,85000000,86000000,
+       87000000,88000000,89000000,90000000,91000000,92000000,
+       93000000,94000000,95000000,96000000,97000000,98000000,
+       99000000,100000000,110000000,120000000,130000000,140000000,
+       150000000,160000000,170000000,180000000,190000000,200000000,
+       210000000,220000000,230000000,240000000,250000000,260000000,
+       270000000,280000000,290000000,300000000,310000000,320000000,
+       330000000,340000000,350000000,360000000,370000000,380000000,
+       390000000,400000000,410000000,420000000,430000000,440000000,
+       450000000,460000000,470000000,480000000,490000000,500000000,
+       510000000,520000000,530000000,540000000,550000000,560000000,
+       570000000,580000000,590000000,600000000,610000000,620000000,
+       630000000,640000000,650000000,660000000,670000000,680000000,
+       690000000,700000000,710000000,720000000,730000000,740000000,
+       750000000,760000000,770000000,780000000,790000000,800000000,
+       810000000,820000000,830000000,840000000,850000000,860000000,
+       870000000,880000000,890000000,900000000,910000000,920000000,
+       930000000,940000000,950000000,960000000,970000000,980000000,
+    990000000LL,1000000000LL,1100000000LL,1200000000LL,1300000000LL,1400000000LL,
+    1500000000LL,1600000000LL,1700000000LL,1800000000LL,1900000000LL,2000000000LL,
+    2100000000LL,2200000000LL,2300000000LL,2400000000LL,2500000000LL,2600000000LL,
+    2700000000LL,2800000000LL,2900000000LL,3000000000LL,3100000000LL,3200000000LL,
+    3300000000LL,3400000000LL,3500000000LL,3600000000LL,3700000000LL,3800000000LL,
+    3900000000LL,4000000000LL,4100000000LL,4200000000LL,4300000000LL,4400000000LL,
+    4500000000LL,4600000000LL,4700000000LL,4800000000LL,4900000000LL,5000000000LL};
 
    if(access(font1, R_OK) != 0) {
      fprintf(stderr, "SARG: (grepday) Fontname: %s not found.\n",font1);
@@ -185,14 +185,13 @@ void *bar(long long int *n)
    goldenrod2 = gdImageColorAllocate(im, 207, 181, 59);
 
    num = n;
+   val = 55;
    for(x=0; x<=366; x++) {
-      lim = my_atoll(limits[x]);
-      if(lim >= num) {
+      if(limits[x] >= num) {
          val = 425 - x;
          break;
       }
    }
-   if(x>366) val = 55;
 
    gdImageFilledRectangle(im, x1, val, x1+11, 425, color3);
 
@@ -228,7 +227,7 @@ void *bar(long long int *n)
    return;
 }
 
-void greport_day(char *user, int *iprel, int *ipuser)
+void greport_day(const char *user)
 {
    FILE *fp_in, *pngout;
    int x, y;
@@ -242,7 +241,7 @@ void greport_day(char *user, int *iprel, int *ipuser)
    char oday[20];
    char day[20];
    char bytes[20];
-   long long int tot;
+   long long int tot=0;
    time_t t;
    struct tm *local;
    int cstatus;
@@ -372,9 +371,18 @@ void greport_day(char *user, int *iprel, int *ipuser)
    SARGgdImageStringFT(im,&brect[0],black,font1,10,3.14/2,20,248,text[93]);
    SARGgdImageStringFT(im,&brect[0],black,font1,10,0.0,330,460,text[127]);
  
-   sprintf(graph,"%s/%s/graph_day.png",dirname,user);
-   sprintf(wdirname,"%s/%s.day",tmp,user);
-   sprintf(tmp5,"%s/%s.graph",tmp,user);
+   if (snprintf(graph,sizeof(graph),"%s/%s/graph_day.png",dirname,user)>=sizeof(graph)) {
+      fprintf(stderr, "SARG: user name too long for: %s/%s/graph_day.png\n",dirname,user);
+      exit(1);
+   }
+   if (snprintf(wdirname,sizeof(wdirname),"%s/%s.day",tmp,user)>=sizeof(wdirname)) {
+      fprintf(stderr, "SARG: user name too long for: %s/%s.day\n",tmp,user);
+      exit(1);
+   }
+   if (snprintf(tmp5,sizeof(tmp5),"%s/%s.graph",tmp,user)>=sizeof(tmp5)) {
+      fprintf(stderr, "SARG: user name too long for: %s/%s.graph\n",tmp,user);
+      exit(1);
+   }
 
    if(access(wdirname, R_OK) != 0)
       return;
diff --git a/html.c b/html.c
index 70b8c2d6ab9e979a3fb3bc469749ede741ecdc1d..2e684fa138a631500c013a0b6b1aec226a889f2a 100644 (file)
--- a/html.c
+++ b/html.c
 
 #include "include/conf.h"
 
-void htmlrel()
+void htmlrel(void)
 {
    DIR *dirp;
-   FILE *fp_in, *fp_ou, *fp_ip, *fp_ip2, *fp_usr, *fp_tt;
+   FILE *fp_in, *fp_ou, *fp_ip, *fp_ip2, *fp_usr;
 
    struct dirent *direntp;
    long long int nnbytes=0, unbytes=0, tnbytes=0, totbytes=0, totbytes2=0;
    long long int totelap=0, totelap2=0, nnelap=0, unelap=0, tnelap=0;
    long long int incache=0, oucache=0, tnincache=0, tnoucache=0, twork=0, twork2=0;
    char arqin[MAXLEN], arqou[MAXLEN], arqper[MAXLEN], arqip[MAXLEN];
-   char nacc[20], nbytes[20], url[1024], purl[1024], tmsg[50], tmsg2[50], nelap[20], csort[MAXLEN];
+   char nacc[20], nbytes[20], url[1024], tmsg[50], nelap[20], csort[MAXLEN];
    char period[MAXLEN], usuario[MAXLEN], wusuario[MAXLEN], u2[MAXLEN], duser[MAXLEN];
    char userbytes[20], userelap[20], userurl[1024], userhora[9], userdia[9];
    char user_ip[MAXLEN], olduserip[MAXLEN], tmp2[MAXLEN], tmp3[MAXLEN], incac[20], oucac[20];
    char denied_report[255], name2[MAXLEN];
-   char ttd1[3], ttd2[3], ttd3[5], ttt1[3], ttt2[3], ttt3[3];
+   //char ttd1[3], ttd2[3], ttd3[5], ttt1[3], ttt2[3], ttt3[3];
    char *str;
-   char ftime[128], warea[MAXLEN];
+   char warea[MAXLEN];
    char wtemp[MAXLEN], totuser[8];
    long long int tnacc=0, ttnacc=0, unacc=0;
    float perc=0, perc2=0, ouperc=0, inperc=0;
    char *s;
-   int  x, count;
+   int count;
    int cstatus;
 
    if(strstr(ReportType,"users_sites") == 0) return;
@@ -126,8 +126,8 @@ void htmlrel()
       sprintf(warea,"%s/%s",dirname,wusuario);
       mkdir(warea,0755);
 
-      report_day(wusuario, iprel, userip);
-      greport_day(wusuario, iprel, userip);
+      report_day(wusuario);
+      greport_day(wusuario);
 
       strcpy(usuario,wusuario);
       strcpy(arqin,tmp);
@@ -356,9 +356,9 @@ void htmlrel()
          } else ouperc=0;
    
          twork=my_atoll(nacc);
-         sprintf(wwork1,"%s",fixnum(twork,1));
-         sprintf(wwork2,"%s",fixnum(nnbytes,1));
-         sprintf(wwork3,"%s",fixnum2(nnelap,1));
+         strcpy(wwork1,fixnum(twork,1));
+         strcpy(wwork2,fixnum(nnbytes,1));
+         strcpy(wwork3,fixnum2(nnelap,1));
 
          if(strcmp(LongUrl,"yes") != 0) {
             if (getword(warea,sizeof(warea),url,'/')<0) {
@@ -390,11 +390,9 @@ void htmlrel()
                 sprintf(httplink,"<a href=http://%s title=\"%s\">%s</a>",urly,urly,url);
 
          if(strstr(ReportType,"site_user_time_date") != 0) {
-            sprintf(ltext110,"%s",text[110]);
-            if(ltext110){
-               for(s=ltext110; *s; ++s)
-                  *s=tolower(*s);
-            }
+            strcpy(ltext110,text[110]);
+            for(s=ltext110; *s; ++s)
+               *s=tolower(*s);
             strcpy(siteind,urly);
             str=siteind;
             for(z1=0; str[z1]; z1++) {
@@ -469,7 +467,7 @@ void htmlrel()
             }
 
 #if defined(HAVE_FOPEN64)
-            if ((fp_ip2 = (long)fopen64(tmp2, "a")) == 0){
+            if ((fp_ip2 = fopen64(tmp2, "a")) == 0){
 #else
             if ((fp_ip2 = fopen(tmp2, "a")) == 0){
 #endif
@@ -494,7 +492,7 @@ void htmlrel()
             }
    
 #if defined(HAVE_FOPEN64)
-            if ((fp_ip = (long)fopen64(tmp3, "r")) == 0) {
+            if ((fp_ip = fopen64(tmp3, "r")) == 0) {
 #else
             if ((fp_ip = fopen(tmp3, "r")) == 0) {
 #endif
index faae954a928ae01be2c248feef286f7e7f8a2e99..fa7784383e4597f6f8549521bbb761e56fb9ff64 100755 (executable)
@@ -122,9 +122,6 @@ char href3[MAXLEN];
 char df[20];
 char day[3], month[4], year[5];
 char nmonth[30];
-char y1[5], y2[5];
-char d1[3], d2[3];
-char m1[4], m2[4];
 char ltext110[50];
 char cdfrom[30];
 char cduntil[30];
@@ -346,11 +343,160 @@ typedef struct
 DIR *dirp;
 struct dirent *direntp;
 
-int getnumlist( char *, numlist *, const int, const int );
+// auth.c
+void htaccess(const char *name);
+
+// authfail.c
+void authfail_report(void);
+
+// charset.c
+void ccharset(char *CharSet);
+
+// convlog.c
+void convlog(const char *arq, char *df, int dfrom, int duntil);
+
+// css.c
+void css(FILE *fp_css);
+
+// dansguardian_log.c
+void dansguardian_log(void);
+
+// dansguardian_report.c
+void dansguardian_report(void);
+
+// datafile.c
+void data_file(char *tmp);
+
+// decomp.c
+void decomp(char *arq, char *zip, const char *tmp);
+void recomp(const char *arq, const char *zip) ;
+
+// denied.c
+void gen_denied_report(void);
+
+// download.c
+void download_report(void);
+
+// email.c
+int geramail(const char *dirname, int debug, const char *outdir, int userip, const char *email, const char *TempDir);
+
+// exclude.c
+int vhexclude(const char *excludefile, const char *url);
+int vuexclude(const char *excludeuser, const char *user);
+
+// getconf.c
+void getconf(void);
+
+// grepday.c
+void greport_day(const char *user);
+
+// html.c
+void htmlrel(void);
+
+// indexonly.c
+void index_only(const char *dirname,int debug);
+
+// ip2name.c
+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);
+
+// index.c
+void make_index(void);
+
+// realtime.c
+void realtime(void);
+
+// repday.c
+void report_day(const char *user);
+
+// report.c
+void gravatmp(char *oldaccuser, char *dirname, char *oldurl, long long int nacc, long long int nbytes, char *oldmsg, long long int nelap, int indexonly, long long int incache, long long int oucache);
+void gerarel(void);
+
+// siteuser.c
+void siteuser(void);
+
+// smartfilter.c
+void smartfilter_report(void);
+
+// sort.c
+void sort_users_log(const char *tmp, int debug);
+void tmpsort(void);
+
+// splitlog.c
+void splitlog(const char *arq, char *df, int dfrom, int duntil, char *convert);
+
+// squidguard_log.c
+void squidguard_log(void);
+
+// squidguard_report.c
+void squidguard_report(void);
+
+// topsites.c
+void topsites(void);
+
+// topuser.c
+void topuser(void);
+
+// totday.c
+void day_totalize(const char *tmp, const char *user, int indexonly);
+
+// totger.c
+int totalger(const char *dirname, int debug, const char *outdir);
+
+// usage.c
+void usage(const char *prog);
+
+// useragent.c
+void useragent(void);
+
+// util.c
 int getword(char *word, int limit, char *line, int stop);
 int getword_multisep(char *word, int limit, char *line, int stop);
 int getword3(char *word, int limit, char *line, int stop);
 void name_month(char *month,int month_len);
-void ip2name(char *ip,int ip_len);
-
-      
\ No newline at end of file
+void conv_month_name(char *month);
+void buildymd(const char *dia, const char *mes, const char *ano, char *wdata);
+void date_from(char *date, char *dfrom, char *duntil);
+int getnumlist( char *, numlist *, const int, const int );
+void fixip(char *ip);
+char *fixnum(long long int value, int n);
+char *fixnum2(long long int value, int n);
+void fixnone(char *str);
+void fixper(char *tbuf, char *period, const char *duntil);
+char *fixtime(long int elap);
+void show_info(FILE *fp_ou);
+void show_sarg(FILE *fp_ou, const char *ind);
+void write_html_header(FILE *fp_ou, const char * ind);
+void write_html_trailer(FILE *fp_ou);
+char *subs(char *str, char *from, char *to);
+void conv_month(char *month);
+void debuga(const char *msg);
+void debugaz(const char *head, const char *msg);
+void my_lltoa(unsigned long long int n, char s[], int len);
+char *get_size(const char *path, const char *file);
+void url_module(char *url, char *w2);
+void strip_latin(char *line);
+char *buildtime(long long int elap);
+void obtdate(const char *dirname, const char *name, char *data);
+void obtuser(const char *dirname, const char *name, char *tuser);
+void obttotal(const char *dirname, const char *name, char *tbytes, char *tuser, char *media);
+void version(void);
+int vercode(const char *code);
+void load_excludecodes(void);
+void my_mkdir(const char *name);
+int testvaliduserchar(const char *user);
+char *strlow(char *string);
+char *strup(char *string);
+void builddia(char *dia, const char *mes, const char *ano, const char *df, char *wdata);
+void vrfydir(const char *dir, const char *per1, const char *addr, const char *site, const char *us, const char *form);
+void gperiod(void);
+void removetmp(const char *outdir);
+void zdate(char *ftime, const char *DateFormat);
+void baddata(void);
diff --git a/index.c b/index.c
index d9fd7b83c3f98de6bfa6acff23a82534ce9edb4e..60b84563a0d1ca36f7c31b35c90d9ca35197c261 100644 (file)
--- a/index.c
+++ b/index.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void make_index()
+void make_index(void)
 {
 
    FILE *fp_ou, *fp_ou2, *fp_ou3, *fp_tmp, *fp_tmp2, *fp_tmp3;
@@ -49,8 +49,11 @@ void make_index()
    char day[4], mon[4], year[6], hour[10];
    char h[3], m[3], s[3];
    int cstatus;
+   char y1[5], y2[5];
+   char d1[3], d2[3];
+   char m1[4], m2[4];
 
-   if(LastLog[0] != '\0') mklastlog(outdir,debug);
+   if(LastLog[0] != '\0') mklastlog(outdir);
 
    sprintf(wdir,"%sindex.html",outdir);
    sprintf(wdir_tmp,"%sindex.unsort",outdir);
@@ -181,7 +184,7 @@ void make_index()
    while ((direntp = readdir( dirp )) != NULL) {
       char *p;
       if(strcmp(IndexTree,"date") == 0) {
-         if(strlen(direntp->d_name) > 4 || !isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1])) continue;
+         if(strlen(direntp->d_name) > 4 || (!isdigit(direntp->d_name[0]) && !isdigit(direntp->d_name[1]))) continue;
          fprintf(fp_tmp,"%s %s\n",direntp->d_name,get_size(outdir,direntp->d_name));
          continue;
       } else {
index 507392d31cefff33bad7fb6089a83675e202ac0f..b409665ac5a0cede8d0bf872bed26afdb5041286 100644 (file)
 #include "include/conf.h"
 
 
-void index_only()
+void index_only(const char *dirname,int debug)
 {
-
    DIR *dirp;
    struct dirent *direntp;
    char remove[MAXLEN];
   
-
    dirp = opendir(dirname);
    while ( (direntp = readdir( dirp )) != NULL ){
       if(strcmp(direntp->d_name,".") == 0 || strcmp(direntp->d_name,"..") == 0 || strcmp(direntp->d_name, "index.html") == 0)
@@ -43,7 +41,6 @@ void index_only()
       unlink(remove);
    }
 
-   (void)rewinddir( dirp );
    (void)closedir( dirp );
 
    return;
index 1907130ec2de1fea2db8ec3199e23af1b6be6291..462b04592c0c99871bb7b4808e217bfcc6fd3ec0 100644 (file)
--- a/ip2name.c
+++ b/ip2name.c
@@ -53,34 +53,27 @@ void name2ip(char *name)
 { 
    struct in_addr ia;
    struct hostent *hp;
-   char   work[MAXLEN];
-   char   n1[4];
-   char   n2[4];
-   char   n3[4];
-   char   n4[4];
+   char *port;
+   char n1[4];
+   char n2[4];
+   char n3[4];
+   char n4[4];
 
-   if(strstr(name,":") > 0) {
-      if (getword(work,sizeof(work),name,':')<0) {
-         printf("SARG: Maybe you have a broken record or garbage in your %s name.\n",name);
-         exit(1);
-      }
-      strcpy(name,work);
-   }
+   port=strchr(name,':');
+   if (port) *port=0;
 
    if((hp=gethostbyname(name))==NULL)
       return;
-   else {
-      memcpy(&ia.s_addr,hp->h_addr_list[0],sizeof(ia.s_addr));
-      ia.s_addr=ntohl(ia.s_addr);
-      sprintf(name,"%s",inet_ntoa(ia));
-      if (getword(n4,sizeof(n4),name,'.')<0 || getword(n3,sizeof(n3),name,'.')<0 ||
-          getword(n2,sizeof(n2),name,'.')<0 || getword(n1,sizeof(n1),name,0)<0) {
-         printf("SARG: Maybe you have a broken record or garbage in your %s ip address.\n",name);
-         exit(1);
-      }
-      sprintf(name,"%s.%s.%s.%s",n1,n2,n3,n4);
-
+      
+   memcpy(&ia.s_addr,hp->h_addr_list[0],sizeof(ia.s_addr));
+   ia.s_addr=ntohl(ia.s_addr);
+   strcpy(name,inet_ntoa(ia));
+   if (getword(n4,sizeof(n4),name,'.')<0 || getword(n3,sizeof(n3),name,'.')<0 ||
+         getword(n2,sizeof(n2),name,'.')<0 || getword(n1,sizeof(n1),name,0)<0) {
+      printf("SARG: Maybe you have a broken record or garbage in your %s ip address.\n",name);
+      exit(1);
    }
+   sprintf(name,"%s.%s.%s.%s",n1,n2,n3,n4);
 
    return;
 } 
index fbae8cc8617aa4534a31358cd3a9d88313a62076..8e58a83feb98636cf357f06a49cf3cd8f325f850 100644 (file)
 
 #include "include/conf.h"
 
-void language_load(char *language)
+void language_load(const char *language)
 {
    char lfile[FILENAME_MAX];
    FILE *fp_text;
    int record=0;
 
-   sprintf(lfile,"%s/languages/%s",SYSCONFDIR,language);
+   if (snprintf(lfile,sizeof(lfile),"%s/languages/%s",SYSCONFDIR,language)>=sizeof(lfile)) {
+      fprintf(stderr, "SARG: (language) language name is too long: %s/languages/%s\n",SYSCONFDIR,language);
+      exit(1);
+   }
 
    if((fp_text=fopen(lfile,"r"))==NULL) {
      fprintf(stderr, "SARG: (language) Cannot open language file: %s\n",lfile);
@@ -46,7 +49,7 @@ void language_load(char *language)
       strcpy(text[record],warea);
 
       if(langcode)
-      printf("%d %s\n",record,warea);
+         printf("%d %s\n",record,warea);
 
       record++;
    }
index 19a0c8125272ee2e6ac2e1fdf9926be08ba3cfee..abbaca4de234c1b29546c1711724b3cd4a7529e7 100644 (file)
--- a/lastlog.c
+++ b/lastlog.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void mklastlog()
+void mklastlog(const char *outdir)
 {
 
    FILE *fp_in, *fp_ou;
diff --git a/log.c b/log.c
index beb8bbfc3fcc9544e52e2894a7f838d283d7a838..7c0b0c0ad2d5d84a47e341298d8fc9f8dde9cbf0 100644 (file)
--- a/log.c
+++ b/log.c
@@ -54,7 +54,7 @@ int main(argc,argv)
    char *argv[];
 {
 
-   FILE *fp_in = NULL, *fp_ou = NULL, *fp_denied, *fp_usr, *fp_authfail, *fp_log;
+   FILE *fp_in = NULL, *fp_ou = NULL, *fp_denied=NULL, *fp_usr, *fp_authfail=NULL, *fp_log=NULL;
 
    char sz_Download_Unsort[ 20000 ] ;
    FILE * fp_Download_Unsort = NULL ;
@@ -679,7 +679,7 @@ int main(argc,argv)
       }
 
       if(debug) {
-         sprintf(msg,"Maximum file descriptor: cur=%ld max=%ld, changed to cur=%ld max=%ld",l1,l2,rl.rlim_cur,rl.rlim_max);
+         sprintf(msg,"Maximum file descriptor: cur=%ld max=%ld, changed to cur="RLIM_STRING" max="RLIM_STRING,l1,l2,rl.rlim_cur,rl.rlim_max);
          debuga(msg);
       }
    }
@@ -739,7 +739,7 @@ int main(argc,argv)
    }
 
 #if defined(HAVE_FOPEN64)
-   if((fp_in=(long)fopen64(arq,"r"))==NULL) {
+   if((fp_in=fopen64(arq,"r"))==NULL) {
 #else
    if((fp_in=fopen(arq,"r"))==NULL) {
 #endif
@@ -766,7 +766,7 @@ int main(argc,argv)
       }
       sprintf(arq_log,"%s/sarg_temp.log",ParsedOutputLog);
 #if defined(HAVE_FOPEN64)
-      if((fp_log=(long)fopen64(arq_log,"w"))==NULL) {
+      if((fp_log=fopen64(arq_log,"w"))==NULL) {
 #else
       if((fp_log=fopen(arq_log,"w"))==NULL) {
 #endif
@@ -778,7 +778,7 @@ int main(argc,argv)
 
    if(strstr(ReportType,"denied") != 0) {
 #if defined(HAVE_FOPEN64)
-      if((fp_denied=(long)fopen64(tmp4,"w"))==NULL) {
+      if((fp_denied=fopen64(tmp4,"w"))==NULL) {
 #else
       if((fp_denied=fopen(tmp4,"w"))==NULL) {
 #endif
@@ -790,7 +790,7 @@ int main(argc,argv)
    if(DataFile[0]=='\0') {
       if(strstr(ReportType,"denied") != 0 || strstr(ReportType,"auth_failures") != 0) {
 #if defined(HAVE_FOPEN64)
-         if((fp_authfail=(long)fopen64(tmp6,"w"))==NULL) {
+         if((fp_authfail=fopen64(tmp6,"w"))==NULL) {
 #else
          if((fp_authfail=fopen(tmp6,"w"))==NULL) {
 #endif
@@ -1412,7 +1412,7 @@ int main(argc,argv)
 
               if(download_flag && strstr(code,"DENIED") == 0) {
                  ndownload = 1;
-                 sprintf(bufz, "%s %s %s %s %s %s\n",dia,hora,user,ip,download_url);
+                 sprintf(bufz, "%s %s %s %s %s\n",dia,hora,user,ip,download_url);
 
 #ifdef LEGACY_WRITE_DOWNLOAD
                  sprintf(tmp3,"%s/sarg/download.unsort",tmp);
@@ -1520,10 +1520,8 @@ int main(argc,argv)
             fclose(fp_denied);
          if(fp_authfail)
             fclose(fp_authfail);
-         if(tmp4)
-            unlink(tmp4);
-         if(tmp6)
-            unlink(tmp6);
+         unlink(tmp4);
+         unlink(tmp6);
          unlink(tmp3);
          exit(0);
       }
@@ -1608,7 +1606,6 @@ int main(argc,argv)
  
    sort_users_log(tmp, debug);
 
-   report_gen:
    if(strlen(DataFile) > 0)
       data_file(tmp);
    else
index 6b71f5f5b6a1f9c37a3245be6737c16ceaf1e365..deb9eaffd47265b4035879015bb4a7a2eb203e4d 100755 (executable)
@@ -27,8 +27,8 @@
 
 int getdata(char *, FILE *);
 void datashow(char *);
-void getlog();
-void header();
+static void getlog(void);
+static void header(void);
 
 char dat[128];
 char tim[128];
@@ -36,15 +36,14 @@ char typ[128];
 char ouser[MAXLEN]="";
 char ourl[MAXLEN]="";
 
-void
-realtime(int argc, char *argv[])
+void realtime(void)
 {
 
    getlog();
 
 }
 
-void getlog()
+static void getlog(void)
 {
    FILE *tmp, *fp, *fp_usr;
    char template1[255]="/var/tmp/sargtpl1.XXXXXX";
@@ -269,7 +268,7 @@ void datashow(char *tmp)
    
 }
 
-void header()
+static void header(void)
 {
    puts("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"");
    puts(" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
index aa0bafc4cb380aad94354fce0f1a1a40b8119012..db4ec0c900e60e1e2597efacd83edfd1b4cceb5a 100644 (file)
--- a/repday.c
+++ b/repday.c
@@ -27,7 +27,7 @@
 
 extern numlist hours;
 
-void report_day(char *user, int *iprel, int *ipuser)
+void report_day(const char *user)
 {
 
    FILE *fp_in, *fp_ou;
index 10d790df9f66fa3b77cb5102e376a5275fe8db60..58a6a949a9d706a94842b105f7afc774f699d69d 100644 (file)
--- a/report.c
+++ b/report.c
@@ -26,7 +26,7 @@
 #include "include/conf.h"
 #include "include/defs.h"
 
-void gerarel()
+void gerarel(void)
 {
 
    FILE *fp_in;
@@ -191,45 +191,43 @@ void gerarel()
       if(strstr(ReportType,"site_user_time_date") != 0) {
          if(!ttopen) {
             ind2++;
-           strcpy(siteind,accurl);
-           str=siteind;
-           for(z1=0; str[z1]; z1++) {
-              if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\' || str[z1]=='*' ||
-              str[z1]=='\'' || str[z1]=='\"' || str[z1]=='$')
-                 str[z1]='_';
-        }
-           sprintf(arqtt,"%s/%s",dirname,accuser);
-           if(access(arqtt, R_OK) != 0)
+            strcpy(siteind,accurl);
+            str=siteind;
+            for(z1=0; str[z1]; z1++) {
+               if(str[z1]=='?' || str[z1]=='-' || str[z1]=='.' || str[z1]==':' || str[z1]=='/' || str[z1]=='\\' || str[z1]=='*' ||
+                  str[z1]=='\'' || str[z1]=='\"' || str[z1]=='$')
+                  str[z1]='_';
+            }
+            sprintf(arqtt,"%s/%s",dirname,accuser);
+            if(access(arqtt, R_OK) != 0)
                my_mkdir(arqtt);
-           sprintf(arqtt,"%s/%s/tt%s-%s.html",dirname,accuser,accuser,siteind);
+            sprintf(arqtt,"%s/%s/tt%s-%s.html",dirname,accuser,accuser,siteind);
             if(strlen(arqtt) > 255) {
                strncpy(val7,arqtt,255);
                bzero(arqtt,MAXLEN);
                strcpy(arqtt,val7);
-            }            
+            }
             if ((fp_tt = fopen(arqtt, "w")) == 0) {
                fprintf(stderr, "SARG: (report) %s: %s\n",text[45],arqtt);
                exit(1);
             }
-           ttopen=1;
+            ttopen=1;
 
-           if(strcmp(Privacy,"yes") == 0)
+            if(strcmp(Privacy,"yes") == 0)
                sprintf(httplink,"<font size=%s color=%s><href=http://%s>%s",   \
-                         FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
-            else
+                           FontSize,PrivacyStringColor,PrivacyString,PrivacyString);
+            else
                sprintf(httplink,"<font size=%s><a href=http://%s>%s</A>",FontSize,accurl,accurl);
 
             sprintf(ltext110,"%s",text[110]);
-            if(ltext110){
-               for(s=ltext110; *s; ++s)
-                  *s=tolower(*s);
-            }
+            for(s=ltext110; *s; ++s)
+               *s=tolower(*s);
 
-           fprintf(fp_tt, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
+               fprintf(fp_tt, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n",CharSet);
             css(fp_tt);
             fputs("</head>\n",fp_tt);
             fprintf(fp_tt,"<body bgcolor=%s text=%s background='%s'>\n",BgColor,TxColor,BgImage);
-           if(strlen(LogoImage) > 0) fprintf(fp_tt, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
+               if(strlen(LogoImage) > 0) fprintf(fp_tt, "<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"logo\"><img src='%s' border=0 align=absmiddle width=%s height=%s>&nbsp;%s</th></tr>\n<tr><td height=\"5\"></td></tr>\n</table>\n",LogoImage,Width,Height,LogoText);
 
             if(strcmp(IndexTree,"date") == 0)
                show_sarg(fp_tt, "../../../..");
index 261644a5f16f5cdefb9a146959114255a8997aa2..7adb880b161d6c84fb3d77adba8891297dab521f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void siteuser()
+void siteuser(void)
 {
 
    FILE *fp_in, *fp_ou;
index c214db4e1b2f4501168a2ec3ff7fdebb595c1f4e..8e7306302a63e36579eedfca62dbd8f4367e6dd9 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void smartfilter_report()
+void smartfilter_report(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL, *fp_user = NULL;
diff --git a/sort.c b/sort.c
index ec2a8381f454ea4924550eefcb4d143544286da9..ce90275582fc805faca06086ad6a95af4fdf79c9 100644 (file)
--- a/sort.c
+++ b/sort.c
 
 #include "include/conf.h"
 
-void tmpsort()
+void tmpsort(void)
 {
 
    DIR *dirp;
    struct dirent *direntp;
    int cstatus;
+   const char tmpext[]=".utmp";
+   int dlen;
 
    char csort[MAXLEN];
-   char arqou[MAXLEN], arqin[MAXLEN], wnome[MAXLEN], wnome2[MAXLEN];
+   char arqou[MAXLEN], arqin[MAXLEN], wnome[MAXLEN];
    char field1[10]="2,2";
    char field2[10]="1,1";
    char field3[10]="3,3";
@@ -42,29 +44,40 @@ void tmpsort()
    if(indexonly) return;
    if(strstr(ReportType,"users_sites") == 0) return;
 
-   wnome[0]='\0';
-   wnome2[0]='\0';
+   strup(UserSortField);
+   if(strcmp(UserSortField,"CONNECT") == 0) {
+      strcpy(field1,"1,1");
+      strcpy(field2,"2,2");
+      strcpy(field3,"3,3");
+   } else if(strcmp(UserSortField,"SITE") == 0) {
+      strcpy(field1,"3,3");
+      strcpy(field2,"2,2");
+      strcpy(field3,"1,1");
+   } else if(strcmp(UserSortField,"TIME") == 0) {
+      strcpy(field1,"5,5");
+      strcpy(field2,"2,2");
+      strcpy(field3,"1,1");
+   }
+
+   strlow(UserSortOrder);
+   if(strcmp(UserSortOrder,"normal") == 0)
+      order[0]='\0';
 
    dirp = opendir(tmp);
    while ((direntp = readdir( dirp )) != NULL ){
-      if(strstr(direntp->d_name,".utmp") == 0)
+      dlen=strlen(direntp->d_name)-(sizeof(tmpext)-1);
+      if (dlen<0) continue;
+      if(strcmp(direntp->d_name+dlen,tmpext) != 0)
          continue;
 
-      strcpy(wentp,direntp->d_name);
-      wnome[0]='\0'; 
-      striptmp:
-      if (getword(wnome2,sizeof(wnome2),wentp,'.')<0) {
-         printf("SARG: Maybe you have a broken record or garbage in your %s directory.\n",tmp);
-         exit(1);
-      }
-      strcat(wnome,wnome2);
-
-      if(strcmp(wentp,"utmp") !=0) {
-         strcat(wnome,".");
-         goto striptmp;
+      if (dlen>0) {
+         if (dlen>=sizeof(wnome)) continue;
+         strncpy(wnome,direntp->d_name,dlen);
+         wnome[dlen]=0;
+      } else {
+         wnome[0]='\0';
       }
-
+      
       strcpy(arqou,tmp);
       strcat(arqou,"/");
       strcpy(arqin,arqou);
@@ -76,30 +89,6 @@ void tmpsort()
          debuga(msg);
       }
 
-      strup(UserSortField);
-      strlow(UserSortOrder);
-
-      if(strcmp(UserSortField,"CONNECT") == 0) {
-         strcpy(field1,"1,1");
-         strcpy(field2,"2,2");
-         strcpy(field3,"3,3");
-      }
-
-      if(strcmp(UserSortField,"SITE") == 0) {
-         strcpy(field1,"3,3");
-         strcpy(field2,"2,2");
-         strcpy(field3,"1,1");
-      }
-
-      if(strcmp(UserSortField,"TIME") == 0) {
-         strcpy(field1,"5,5");
-         strcpy(field2,"2,2");
-         strcpy(field3,"1,1");
-      }
-
-      if(strcmp(UserSortOrder,"normal") == 0)
-         order[0]='\0';
-        
       strcat(arqou,".txt");
       sprintf(csort,"sort -n -T %s %s -k %s -k %s -k %s -o '%s' '%s'",TempDir,order,field1,field2,field3,arqou,arqin);
       cstatus=system(csort);
@@ -112,21 +101,21 @@ void tmpsort()
 
    }
 
-   (void)rewinddir( dirp );
    (void)closedir( dirp );
    return;
 }
 
-void sort_users_log(char *tmp, int debug)
+void sort_users_log(const char *tmp, int debug)
 {
-
    DIR *dirp;
    struct dirent *direntp;
    char csort[MAXLEN];
    char wtmp[MAXLEN];
-   char wname2[MAXLEN];
+   char user[MAXLEN];
    char wdname[MAXLEN];
    int cstatus;
+   const char unsortext[]=".unsort";
+   int dlen;
 
    if(debug) {
       sprintf(msg,"%s",text[138]);
@@ -137,24 +126,19 @@ void sort_users_log(char *tmp, int debug)
 
    dirp = opendir(wtmp);
    while ( (direntp = readdir( dirp )) != NULL ){
-      if(strstr(direntp->d_name,".unsort") == 0)
+      dlen=strlen(direntp->d_name)-(sizeof(unsortext)-1);
+      if (dlen<0) continue;
+      if(strcmp(direntp->d_name+dlen,unsortext) != 0)
          continue;
-      if(strcmp(direntp->d_name,"denied.log") == 0 || strcmp(direntp->d_name,"authfail.log.unsort") == 0)
+      if(strcmp(direntp->d_name,"authfail.log.unsort") == 0)
          continue;
 
-      strcpy(wdname,direntp->d_name);
-
-      bzero(user, MAXLEN);
-      strip_unsort:
-      if (getword(wname2,sizeof(wname2),wdname,'.')<0) {
-         printf("SARG: Maybe you have a broken record or garbage in your %s directory.\n",wtmp);
-         exit(1);
-      }
-      strcat(user,wname2);
-
-      if(strcmp(wdname,"unsort") !=0) {
-         strcat(user,".");
-         goto strip_unsort;
+      if (dlen>0) {
+         if (dlen>=sizeof(user)) continue;
+         strncpy(user,direntp->d_name,dlen);
+         user[dlen]=0;
+      } else {
+         bzero(user, MAXLEN);
       }
 
       if(strcmp(direntp->d_name,"download.unsort") == 0)
@@ -169,12 +153,14 @@ void sort_users_log(char *tmp, int debug)
          fprintf(stderr, "SARG: sort command: %s\n",csort);
          exit(1);
       }
-      sprintf(wdname,"%s/%s.unsort",wtmp,user);
+      if (snprintf(wdname,sizeof(wdname),"%s/%s.unsort",wtmp,user)>=sizeof(wdname)) {
+         fprintf(stderr, "SARG: user name too long for: %s/%s.unsort\n",wtmp,user);
+         exit(1);
+      }
       unlink(wdname);
       bzero(user, MAXLEN);
 
    }
-   (void)rewinddir( dirp );
    (void)closedir( dirp );
 
    return;
index a8d0e74a4a512eaa601b00ef77b73146c5940e42..aa535b7b4a38d3fbfaadbb2a81c0795e5bd56f5d 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void splitlog(char *arq, char *df, int dfrom, int duntil, char *convert)
+void splitlog(const char *arq, char *df, int dfrom, int duntil, char *convert)
 {
 
    FILE *fp_in;
@@ -39,10 +39,10 @@ void splitlog(char *arq, char *df, int dfrom, int duntil, char *convert)
    struct tm *t;
 
    if(arq[0] == '\0')
-      strcpy(arq,"/usr/local/squid/logs/access.log");
+      arq="/usr/local/squid/logs/access.log";
 
 #if defined(HAVE_FOPEN64)
-   if((fp_in=(long)fopen64(arq,"r"))==NULL) {
+   if((fp_in=fopen64(arq,"r"))==NULL) {
 #else
    if((fp_in=fopen(arq,"r"))==NULL) {
 #endif
index e1276e44f6b94a1d534ca3770f147b8277fc3fec..bdbd9e31bebd7a66cb3c24db329226d8422f9638 100644 (file)
@@ -161,16 +161,14 @@ void read_log(char *wentp, FILE *fp_ou)
 }
 
 
-int squidguard_log()
+void squidguard_log(void)
 {
-
    FILE *fp_ou = NULL, *fp_guard = NULL;
    char guard_in[MAXLEN];
    char guard_ou[MAXLEN];
    char logdir[MAXLEN];
    char year[10], day[10], mon[10];
    char user[MAXLEN];
-   char ip[30];
    int  x, y;
    int cstatus;
 
index ada1d4504f894e4c0fc66616791487e735d842ea..f383f38b2eea66168ffa9514f23572893f0b8983 100644 (file)
 
 #include "include/conf.h"
 
-void squidguard_report()
+void squidguard_report(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL;
       
    char url[MAXLEN];
-   char html[MAXLEN];
    char html2[MAXLEN];
    char squidguard_in[MAXLEN];
-   char squidguard_ou[MAXLEN];
    char per[MAXLEN];
    char report[MAXLEN];
    char period[100];
@@ -46,7 +44,6 @@ void squidguard_report()
    char data[15];
    char data2[15];
    char hora[15];
-   char ftime[128];
    char *str;
    int  z=0;
    int  count=0;
index cf7958585b52ee036b9d7e1a0eac72ba8dde9337..3f1b26b9f8c1841790d9f3e19c00e8ed6e96235c 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void topsites()
+void topsites(void)
 {
 
    FILE *fp_in, *fp_ou;
@@ -265,7 +265,7 @@ void topsites()
 
       sprintf(wwork1,"%s",fixnum(twork1,1));
       sprintf(wwork2,"%s",fixnum(twork2,1));
-      sprintf(wwork3,"%s",fixtime(twork3,1));
+      sprintf(wwork3,"%s",fixtime(twork3));
 
       if(strlen(BlockIt) > 0)
          sprintf(BlockImage,"<a href=\"%s%s?url=%s\"><img src=\"../images/sarg-squidguard-block.png\" border=\"0\"></a>&nbsp;",wwwDocumentRoot,BlockIt,url);
index d172ef99d18df50eaca87397f774ad2cb0a4d50a..006bae468cac0bcb12e2e9e7e07efd68eb79ad73 100644 (file)
--- a/topuser.c
+++ b/topuser.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-int topuser()
+void topuser(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL, *fp_top1 = NULL, *fp_top2 = NULL, *fp_top3 = NULL;
@@ -416,15 +416,13 @@ int topuser()
     
       if(strstr(ReportType,"date_time") != 0) {
          sprintf(ltext110,"%s",text[110]);
-         if(ltext110){
-            for(s=ltext110; *s; ++s)
-               *s=tolower(*s);
-         }
+         for(s=ltext110; *s; ++s)
+            *s=tolower(*s);
       } else {
          bzero(href2, MAXLEN);
          bzero(ltext110, 50);
          sprintf(val1,"%s/d%s.html",dirname,user);
-        unlink(val1);
+            unlink(val1);
       }
 
 //      if(UserTabFile[0] != '\0' && strstr(user2,".") != 0) {
index fb1b07968d4680997c58656ac428a701121c915c..efd08c744693f00825ae148d3a88236c9dc3107d 100644 (file)
--- a/totday.c
+++ b/totday.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void day_totalize(const char *tmp, char *user, int indexonly)
+void day_totalize(const char *tmp, const char *user, int indexonly)
 {
 
    FILE *fp_in, *fp_ou;
index e6543ef696fee2d795ba898fbe456f2e999355e1..01d7bfd71f3b34d76184866e6020171d73e916ca 100644 (file)
--- a/totger.c
+++ b/totger.c
 #include "include/conf.h"
 
 int totalger(const char *dirname, int debug, const char *outdir)
-
 {
-
-
    FILE *fp_in, *fp_ou;
    long long int tnacc=0;
    long long int tnbytes=0;
diff --git a/usage.c b/usage.c
index 3a7620d26ff56734202f5c571d625b791e0702a6..4ccc40d740339152a7d1d9976e8eccf4e3e5b67d 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void usage(char *prog)
+void usage(const char *prog)
 {
   fprintf(stderr, "%s: %s [%s...]\n", prog,text[39],text[40]);
   fprintf(stderr, "%5s-a %s\n"," ",text[23]);
index 15ed405ef2e902ade9c37767fb2cf814d56fda39..b467df4a8963d2a4c674ab6e6166a3ca97826bca 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "include/conf.h"
 
-void useragent()
+void useragent(void)
 {
 
    FILE *fp_in = NULL, *fp_ou = NULL, *fp_ht = NULL;
diff --git a/util.c b/util.c
index bd5200c3db49ff86d198385c3170cdbec7c0a8b9..56c9feb3eb4d64a6ed590408007bae313c80068b 100644 (file)
--- a/util.c
+++ b/util.c
@@ -197,7 +197,7 @@ long long int my_atoll (const char *nptr)
 long long int my_atoll (const char *nptr)
 {
   long long int returnval=0;
-  char * t = nptr ;
+  const char * t = nptr ;
   int max_digits = MAXLLL ;
 
   // Soak up all the white space
@@ -221,7 +221,7 @@ long long int my_atoll (const char *nptr)
 #endif
 
 
-void my_mkdir(char *name)
+void my_mkdir(const char *name)
 {
    char w0[255];
    char w1[255];
@@ -297,7 +297,7 @@ void my_lltoa(unsigned long long int n, char s[], int len)
 }
 
 
-void builddia(char *dia, char *mes, char *ano, char *df, char *wdata)
+void builddia(char *dia, const char *mes, const char *ano, const char *df, char *wdata)
 {
    char ndia[11];
    char nmes[3];
@@ -328,7 +328,7 @@ void builddia(char *dia, char *mes, char *ano, char *df, char *wdata)
 }
 
 
-void buildymd(char *dia, char *mes, char *ano, char *wdata)
+void buildymd(const char *dia, const char *mes, const char *ano, char *wdata)
 {
    char nmes[3];
    int  x;
@@ -388,7 +388,7 @@ void name_month(char *month,int month_len)
 }
 
 
-void fixper(char *tbuf, char *period, char *duntil)
+void fixper(char *tbuf, char *period, const char *duntil)
 {
 
    char warea[50];
@@ -405,8 +405,10 @@ void fixper(char *tbuf, char *period, char *duntil)
    ano[4]='\0';
 
    for(x=0; x<12; x++) {
-      if(strcmp(mtab2[x],mes) == 0)
+      if(strcmp(mtab2[x],mes) == 0) {
          strcpy(mes,mtab1[x]);
+         break;
+      }
    }
 
    if(strcmp(df,"e") == 0)
@@ -418,14 +420,14 @@ void fixper(char *tbuf, char *period, char *duntil)
 }
 
 
-void debuga(char *msg)
+void debuga(const char *msg)
 {
   fprintf(stderr, "SARG: %s\n",msg);
 
 }
 
 
-void debugaz(char *head, char *msg)
+void debugaz(const char *head, const char *msg)
 {
   fprintf(stderr, "SARG: (util) %s=%s\n",head, msg);
 
@@ -464,12 +466,12 @@ void fixip(char *ip)
 
 
 char *fixnum(long long int value, int n)
-#define MAXLEN 1024
 {
-   char num[MAXLEN];
-   char buf[MAXLEN * 2];
+#define MAXLEN_FIXNUM 1024
+   char num[MAXLEN_FIXNUM];
+   char buf[MAXLEN_FIXNUM * 2];
    char *pbuf;
-   static char ret[MAXLEN * 2];
+   static char ret[MAXLEN_FIXNUM * 2];
    char *pret;
    register int i, j, k;
    static char abbrev[30];
@@ -525,7 +527,7 @@ char *fixnum(long long int value, int n)
       return(abbrev);
    }
 
-   bzero(buf, MAXLEN*2);
+   bzero(buf, MAXLEN_FIXNUM*2);
 
    pbuf = buf;
    pret = ret;
@@ -557,18 +559,17 @@ char *fixnum(long long int value, int n)
 
 
 char *fixnum2(long long int value, int n)
-#define MAXLEN 1024
 {
-   char num[MAXLEN];
-   char buf[MAXLEN * 2];
+#define MAXLEN_FIXNUM2 1024
+   char num[MAXLEN_FIXNUM2];
+   char buf[MAXLEN_FIXNUM2 * 2];
    char *pbuf;
-   static char ret[MAXLEN * 2];
+   static char ret[MAXLEN_FIXNUM2 * 2];
    char *pret;
    register int i, j, k;
-   static char abbrev[30];
       
    my_lltoa(value, num, 0);
-   bzero(buf, MAXLEN*2);
+   bzero(buf, MAXLEN_FIXNUM2*2);
 
    pbuf = buf;
    pret = ret;
@@ -593,9 +594,9 @@ char *fixnum2(long long int value, int n)
    for ( i = strlen(pbuf) - 1, j = 0 ; i > -1; i--, j++)
       pret[j] = pbuf[i];
 
-      pret[j] = '\0';
+   pret[j] = '\0';
 
-      return pret;
+   return pret;
 }
 
 
@@ -643,7 +644,7 @@ char *buildtime(long long int elap)
 }
 
 
-void obtdate(char *dirname, char *name, char *data)
+void obtdate(const char *dirname, const char *name, char *data)
 {
 
    FILE *fp_in;
@@ -667,7 +668,7 @@ void obtdate(char *dirname, char *name, char *data)
 }
 
 
-void obtuser(char *dirname, char *name, char *tuser)
+void obtuser(const char *dirname, const char *name, char *tuser)
 {
 
    FILE *fp_in;
@@ -691,7 +692,7 @@ void obtuser(char *dirname, char *name, char *tuser)
 }
 
 
-void obttotal(char *dirname, char *name, char *tbytes, char *tuser, char *media)
+void obttotal(const char *dirname, const char *name, char *tbytes, char *tuser, char *media)
 {
 
    FILE *fp_in;
@@ -744,7 +745,7 @@ void obttotal(char *dirname, char *name, char *tbytes, char *tuser, char *media)
 
 
 //void gperiod(char *dirname, const char *period)
-void gperiod()
+void gperiod(void)
 {
  
    FILE *fp_ou;
@@ -770,7 +771,7 @@ void gperiod()
  
 }
 
-void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form)
+void vrfydir(const char *dir, const char *per1, const char *addr, const char *site, const char *us, const char *form)
 {
    FILE *img_in, *img_ou;
    int  num=1, count=0;
@@ -782,6 +783,9 @@ void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form
    DIR *dirp;
    struct dirent *direntp;
    int cstatus;
+   char y1[5], y2[5];
+   char d1[3], d2[3];
+   char m1[4], m2[4];
 
    if(strcmp(IndexTree,"date") == 0) {
       bzero(y1,5);
@@ -832,7 +836,7 @@ void vrfydir(char *dir, char *per1, char *addr, char *site, char *us, char *form
          strncat(wdir,d2,strlen(d2));
       }
    } else
-      sprintf(wdir,"%s",dir);
+      strcpy(wdir,dir);
 
    if(strlen(us) > 0) {
       strcat(wdir,"-");
@@ -979,7 +983,7 @@ void strip_latin(char *line)
 
 }
 
-void zdate(char *ftime, char *DateFormat)
+void zdate(char *ftime, const char *DateFormat)
 {
 
    time_t t;
@@ -1066,15 +1070,15 @@ void date_from(char *date, char *dfrom, char *duntil)
 
 char *strlow(char *string)
 {
-      char *s;
+   char *s;
 
-      if (string)
-      {
-            for (s = string; *s; ++s)
-                  *s = tolower(*s);
-      }
+   if (string)
+   {
+      for (s = string; *s; ++s)
+         *s = tolower(*s);
+   }
 
-      return string;
+   return string;
 }
 
 
@@ -1082,15 +1086,15 @@ char *strlow(char *string)
 
 char *strup(char *string)
 {
-      char *s;
+   char *s;
 
-      if (string)
-      {
-            for (s = string; *s; ++s)
-                  *s = toupper(*s);
-      }
+   if (string)
+   {
+      for (s = string; *s; ++s)
+         *s = toupper(*s);
+   }
 
-      return string;
+   return string;
 }
 
 
@@ -1123,43 +1127,45 @@ char *subs(char *str, char *from, char *to)
 }
 
 
-void removetmp(char *outdir)
+void removetmp(const char *outdir)
 {
 
    FILE *fp_in;
    char warea[256];
 
-   if(strcmp(RemoveTempFiles,"yes") != 0) {
+   if(strcmp(RemoveTempFiles,"yes") != 0)
       return;
-   } else {
-      if(debug) {
-         sprintf(msg,"%s: sarg-general, sarg-period",text[82]);
-         debuga(msg);
-      }
-      sprintf(warea,"%s/sarg-general",outdir);
-      if((fp_in=fopen(warea,"r"))==NULL){
-         fprintf(stderr, "===SARG: (removetmp) %s: %s\n",text[45],warea);
-         exit(1);
-      }
-      while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-         if(strncmp(buf,"TOTAL",5) == 0)
-            break;
-      }
-      fclose(fp_in);
-      if((fp_in=fopen(warea,"w"))==NULL){
-         fprintf(stderr, "SARG: (removetmp) %s: %s\n",text[45],warea);
-         exit(1);
-      }
-      fputs(buf,fp_in);
-      fclose(fp_in);
-      sprintf(warea,"%s/sarg-period",outdir);
-      unlink(warea);
+      
+   if(debug) {
+      sprintf(msg,"%s: sarg-general, sarg-period",text[82]);
+      debuga(msg);
+   }
+   sprintf(warea,"%s/sarg-general",outdir);
+   if((fp_in=fopen(warea,"r"))==NULL){
+      fprintf(stderr, "===SARG: (removetmp) %s: %s\n",text[45],warea);
+      exit(1);
+   }
+   while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+      if(strncmp(buf,"TOTAL",5) == 0)
+         break;
+   }
+   fclose(fp_in);
+   if((fp_in=fopen(warea,"w"))==NULL){
+      fprintf(stderr, "SARG: (removetmp) %s: %s\n",text[45],warea);
+      exit(1);
    }
+   fputs(buf,fp_in);
+   fclose(fp_in);
+   if (snprintf(warea,sizeof(warea),"%s/sarg-period",outdir)>=sizeof(warea)) {
+      fprintf(stderr, "SARG: (removetmp) directory too long to remove: %s/sarg-period\n",outdir);
+      exit(1);
+   }
+   unlink(warea);
   
    return;
 }
 
-void load_excludecodes()
+void load_excludecodes(void)
 {
 
    FILE *fp_in;
@@ -1170,7 +1176,7 @@ void load_excludecodes()
      exit(1);
    }
 
-   while(fgets(data,80,fp_in)!=NULL) {
+   while(fgets(data,sizeof(data),fp_in)!=NULL) {
       data[strlen(data)-1]='\0';
       strcat(excludecode,data);
       strcat(excludecode,";");
@@ -1182,7 +1188,7 @@ void load_excludecodes()
 
 }
 
-int vercode(char *code)
+int vercode(const char *code)
 {
    char warea[1024];
    char cod[80];
@@ -1202,8 +1208,10 @@ int vercode(char *code)
 
 void fixnone(char *str)
 {
-   if(strstr(str,"\n") != 0)
-      str[strlen(str)-1]='\0';
+   char *eol;
+
+   eol=strchr(str,'\n');
+   if (eol) *eol=0;
    if(strcmp(str,"none") == 0)
       str[0]='\0';
 
@@ -1211,7 +1219,7 @@ void fixnone(char *str)
 }
 
 #ifdef LEGACY_TESTVALIDUSERCHAR
-int testvaliduserchar(char *user)
+int testvaliduserchar(const char *user)
 {
 
    int x=0;
@@ -1226,11 +1234,11 @@ int testvaliduserchar(char *user)
    return 0;
 }
 #else
-int testvaliduserchar(char *user)
+int testvaliduserchar(const char *user)
 {
 
    char * p_UserInvalidChar = UserInvalidChar ;
-   char * p_user ;
+   const char * p_user ;
 
    while( *p_UserInvalidChar ) {
       p_user = user ;
@@ -1307,21 +1315,25 @@ void show_info(FILE *fp_ou)
   fprintf(fp_ou,"<center><table><tr><td><br><br></td><td class=\"info\">%s <a href='%s'><font class=\"info\">%s-%s</font></a> %s %s</td></tr></table></center>\n",text[108],URL,PGM,VERSION,text[109],ftime);
 }
 
-void show_sarg(FILE *fp_ou, char *ind)
+void show_sarg(FILE *fp_ou, const char *ind)
 {
    if(strcmp(ShowSargLogo,"yes") == 0) fprintf(fp_ou,"<center><table cellpadding=0 cellspacing=0>\n<tr><th class=\"logo\"><a href=\"http://sarg.sourceforge.net\"><img src=\"%s/images/sarg.png\" border=\"0\" align=\"absmiddle\" title=\"SARG, Squid Analysis Report Generator. Logo by Osamu Matsuzaki\"></a>&nbsp;<font class=\"logo\">Squid Analysis Report Generator</font></th></tr>\n<tr><th class=\"title\">&nbsp</th></tr>\n<table>\n",ind);
 }
 
-int get_size(char *path, char *file)
+char *get_size(const char *path, const char *file)
 {
    FILE *fp;
    char response[255];
+   char cmd[255];
 
-   sprintf(cmd,"du -skh %s%s",path,file);
+   if (snprintf(cmd,sizeof(cmd),"du -skh %s%s",path,file)>=sizeof(cmd)) {
+      printf("SARG: Cannot get disk space because the path %s%s is too long.\n",path,file);
+      exit(1);
+   }
    fp = popen(cmd, "r");
-   fgets(response, 255, fp);
+   fgets(response, sizeof(response), fp);
    if (getword_multisep(val5,sizeof(val5),response,'\t')<0) {
-      printf("SARG: Maybe you have a broken record or garbage in your %s command.\n",cmd);
+      printf("SARG: Maybe the command %s failed.\n",cmd);
       exit(1);
    }
    pclose(fp);
@@ -1330,7 +1342,7 @@ int get_size(char *path, char *file)
 }
 
 
-void write_html_header(FILE *fp_ou, char * ind)
+void write_html_header(FILE *fp_ou, const char * ind)
 {
    fprintf(fp_ou, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n<head>\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\">\n</head>\n",CharSet);
    css(fp_ou);
@@ -1340,7 +1352,7 @@ void write_html_header(FILE *fp_ou, char * ind)
    fprintf(fp_ou,"<center><table cellpadding=\"0\" cellspacing=\"0\">\n<tr><th class=\"title\">%s</th></tr>\n</table></center>\n<center><table cellpadding=\"1\" cellspacing=\"2\">\n<tr><td></td><td></td></tr>\n",Title);
 }
 
-void baddata()
+void baddata(void)
 {
    printf("SARG: ------------------------------------------------------------------------------\n");
    printf("SARG: MALICIUS CODE DETECTED.\n");
@@ -1358,7 +1370,7 @@ void baddata()
 }
 
 
-char url_module(char *url, char *w2)
+void url_module(char *url, char *w2)
 {
    int x, y;
    char w[255];
@@ -1377,8 +1389,6 @@ char url_module(char *url, char *w2)
       w2[y]=w[x];
       y++;
    }
-
-   return;
 }
 
 
@@ -1390,7 +1400,7 @@ void write_html_trailer(FILE *fp_ou)
    fputs("</body>\n</html>\n",fp_ou);
 }
 
-void version()
+void version(void)
 {
    printf("SARG Version: %s\n",VERSION);
    exit(0);