#include "include/conf.h"
-void authfail_report()
+void authfail_report(void)
{
FILE *fp_in = NULL, *fp_ou = NULL;
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
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
#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");
--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
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*)
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
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 ()
{
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
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 ()
{
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 ()
{
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 ()
{
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 ()
{
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 ()
{
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
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>
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;
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*)
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
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
#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;
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
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);
}
#include "include/conf.h"
-int dansguardian_log()
+void dansguardian_log(void)
{
FILE *fp_in = NULL, *fp_ou = NULL, *fp_guard = NULL;
char ip[30];
char wdata[127];
int idata=0;
- int x, y;
int cstatus;
bzero(day, 3);
}
#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
}
#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
exit(1);
}
unlink(guard_in);
- return;
}
#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];
char date[15];
char date2[15];
char hour[15];
- char ftime[128];
char *str;
int z=0;
int count=0;
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
}
#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
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
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);
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);
}
#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;
}
-void recomp(char *arq, char *zip)
+void recomp(const char *arq, const char *zip)
{
char cmd[1024];
int cstatus;
#include "include/conf.h"
-void gen_denied_report()
+void gen_denied_report(void)
{
FILE *fp_in = NULL, *fp_ou = NULL;
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
}
#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
#include "include/conf.h"
-void download_report()
+void download_report(void)
{
FILE *fp_in = NULL, *fp_ou = NULL;
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
}
#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
#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;
#include "include/conf.h"
-int vhexclude(char *excludefile, char *url)
+int vhexclude(const char *excludefile, const char *url)
{
char whost[1024];
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';
}
-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);
}
}
}
-void getconf()
+void getconf(void)
{
FILE *fp_in;
#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);
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);
return;
}
-void greport_day(char *user, int *iprel, int *ipuser)
+void greport_day(const char *user)
{
FILE *fp_in, *pngout;
int x, y;
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;
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;
#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;
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);
} 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) {
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++) {
}
#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
}
#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
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];
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);
#include "include/conf.h"
-void make_index()
+void make_index(void)
{
FILE *fp_ou, *fp_ou2, *fp_ou3, *fp_tmp, *fp_tmp2, *fp_tmp3;
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);
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 {
#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)
unlink(remove);
}
- (void)rewinddir( dirp );
(void)closedir( dirp );
return;
{
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;
}
#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);
strcpy(text[record],warea);
if(langcode)
- printf("%d %s\n",record,warea);
+ printf("%d %s\n",record,warea);
record++;
}
#include "include/conf.h"
-void mklastlog()
+void mklastlog(const char *outdir)
{
FILE *fp_in, *fp_ou;
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 ;
}
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);
}
}
}
#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
}
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
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
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
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);
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);
}
sort_users_log(tmp, debug);
- report_gen:
if(strlen(DataFile) > 0)
data_file(tmp);
else
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];
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";
}
-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");
extern numlist hours;
-void report_day(char *user, int *iprel, int *ipuser)
+void report_day(const char *user)
{
FILE *fp_in, *fp_ou;
#include "include/conf.h"
#include "include/defs.h"
-void gerarel()
+void gerarel(void)
{
FILE *fp_in;
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> %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> %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, "../../../..");
#include "include/conf.h"
-void siteuser()
+void siteuser(void)
{
FILE *fp_in, *fp_ou;
#include "include/conf.h"
-void smartfilter_report()
+void smartfilter_report(void)
{
FILE *fp_in = NULL, *fp_ou = NULL, *fp_user = NULL;
#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";
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);
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);
}
- (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]);
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)
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;
#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;
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
}
-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;
#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];
char data[15];
char data2[15];
char hora[15];
- char ftime[128];
char *str;
int z=0;
int count=0;
#include "include/conf.h"
-void topsites()
+void topsites(void)
{
FILE *fp_in, *fp_ou;
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> ",wwwDocumentRoot,BlockIt,url);
#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;
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) {
#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;
#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;
#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]);
#include "include/conf.h"
-void useragent()
+void useragent(void)
{
FILE *fp_in = NULL, *fp_ou = NULL, *fp_ht = NULL;
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
#endif
-void my_mkdir(char *name)
+void my_mkdir(const char *name)
{
char w0[255];
char w1[255];
}
-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];
}
-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;
}
-void fixper(char *tbuf, char *period, char *duntil)
+void fixper(char *tbuf, char *period, const char *duntil)
{
char warea[50];
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)
}
-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);
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];
return(abbrev);
}
- bzero(buf, MAXLEN*2);
+ bzero(buf, MAXLEN_FIXNUM*2);
pbuf = buf;
pret = ret;
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;
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;
}
}
-void obtdate(char *dirname, char *name, char *data)
+void obtdate(const char *dirname, const char *name, char *data)
{
FILE *fp_in;
}
-void obtuser(char *dirname, char *name, char *tuser)
+void obtuser(const char *dirname, const char *name, char *tuser)
{
FILE *fp_in;
}
-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;
//void gperiod(char *dirname, const char *period)
-void gperiod()
+void gperiod(void)
{
FILE *fp_ou;
}
-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;
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);
strncat(wdir,d2,strlen(d2));
}
} else
- sprintf(wdir,"%s",dir);
+ strcpy(wdir,dir);
if(strlen(us) > 0) {
strcat(wdir,"-");
}
-void zdate(char *ftime, char *DateFormat)
+void zdate(char *ftime, const char *DateFormat)
{
time_t t;
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;
}
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;
}
}
-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;
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,";");
}
-int vercode(char *code)
+int vercode(const char *code)
{
char warea[1024];
char cod[80];
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';
}
#ifdef LEGACY_TESTVALIDUSERCHAR
-int testvaliduserchar(char *user)
+int testvaliduserchar(const char *user)
{
int x=0;
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 ;
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> <font class=\"logo\">Squid Analysis Report Generator</font></th></tr>\n<tr><th class=\"title\"> </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);
}
-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);
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");
}
-char url_module(char *url, char *w2)
+void url_module(char *url, char *w2)
{
int x, y;
char w[255];
w2[y]=w[x];
y++;
}
-
- return;
}
fputs("</body>\n</html>\n",fp_ou);
}
-void version()
+void version(void)
{
printf("SARG Version: %s\n",VERSION);
exit(0);