diff --git a/.gitattributes b/.gitattributes index 0297662f..a7dcd518 100644 --- a/.gitattributes +++ b/.gitattributes @@ -273,7 +273,6 @@ src/modules/statserv/database.c -text src/modules/statserv/global.h -text src/modules/statserv/html/index.tpl -text src/modules/statserv/htmlstats.c -text -src/modules/statserv/m_stats.h -text src/modules/statserv/md5.c -text src/modules/statserv/md5.h -text src/modules/statserv/sqlstats.h -text diff --git a/ChangeLog b/ChangeLog index e2724cb2..fab9805a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,26 @@ Anything we add/remove/fix/change is in here (even our rants) Fish (F), Mark (M) =============================================================================== * NeoStats * Version 3.0.genesis + - StatServ: Optimise database save to further reduce code required and get + back a little CPU. + - StatServ: Adjust exclusions so that counts are accurate. The exclusions + produced cases where the current channel count was greater than the network + record! (M) + - IRCd version suffix now handled by configure rather than code. (M) + - Introduce new debug.log system to store all current messages and debug info + to avoid corrupting main system logs when in debug mode and allow users to + submit this file for support rather than multiple ones from modules plus + core. (M) + - StatServ: reorganised code so stats code is encapsulated from module + specifics and introduced new burst request system during init. (M) + - Begin implementing "burst" request interface for modules to get current + user/channel/server etc lists. (M) + - Homogenize init error messages. (M) + - Update core support functions to use new run level system to determine + current module removing the need for modules to pass their module pointer + when adding bots/timers/socks etc. (M) + - Replace old segv_module system with new run level system. (M) + - Keeper subdirs are now subdirs of main data dir. (M) - ConnectServ: reverse colour define so default is disabled. (M) - Core modules now use core config loading system (M) - All socket code now in socks.c for easier upgrade (M) diff --git a/configure b/configure index 30019f1d..a009570a 100755 --- a/configure +++ b/configure @@ -1,9 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57. +# Generated by GNU Autoconf 2.59. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -20,9 +19,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -41,7 +41,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -218,16 +218,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -668,7 +669,7 @@ done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -708,10 +709,10 @@ if test -z "$srcdir"; then # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -803,9 +804,9 @@ _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -908,12 +909,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -924,7 +958,7 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else @@ -938,8 +972,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -951,7 +984,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1028,19 +1061,19 @@ do 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. + ac_must_keep_next=false # Got value, back to normal. else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. @@ -1074,12 +1107,12 @@ _ASBOX case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1108,7 +1141,7 @@ _ASBOX for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1127,7 +1160,7 @@ _ASBOX echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1207,7 +1240,7 @@ fi # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" @@ -1224,13 +1257,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1744,7 +1777,6 @@ ac_compiler=`set X $ac_compile; echo $2` (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1764,8 +1796,8 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -1785,23 +1817,23 @@ do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; + ;; conftest.$ac_ext ) - # This is the source file. - ;; + # This is the source file. + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # We found the default executable, but exeext='' is most + # certainly right. + break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; * ) - break;; + break;; esac done else @@ -1875,8 +1907,8 @@ for ac_file in conftest.exe conftest conftest.*; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done @@ -1901,7 +1933,6 @@ if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1952,7 +1983,6 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1972,11 +2002,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1989,7 +2029,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -2005,7 +2045,6 @@ if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2022,11 +2061,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2039,7 +2088,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -2066,7 +2115,6 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2094,6 +2142,16 @@ static char *f (char * (*g) (char **, int), char **p, ...) va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2120,11 +2178,21 @@ do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2137,7 +2205,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -2165,19 +2233,28 @@ cat >conftest.$ac_ext <<_ACEOF _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2185,14 +2262,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -2203,11 +2279,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2220,9 +2306,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2239,11 +2324,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2255,7 +2350,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2269,7 +2364,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2287,6 +2382,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 @@ -2303,6 +2399,7 @@ do case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2310,20 +2407,20 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi done done ;; @@ -2405,7 +2502,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lfl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2429,11 +2525,21 @@ yywrap (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2446,7 +2552,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fl_yywrap=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 @@ -2462,7 +2569,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ll $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2486,11 +2592,21 @@ yywrap (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2503,7 +2619,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_l_yywrap=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 @@ -2565,11 +2682,21 @@ cat >conftest.$ac_ext <<_ACEOF _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2581,7 +2708,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" @@ -2746,13 +2874,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -2782,7 +2910,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2806,11 +2933,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2823,7 +2960,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -2845,21 +2983,28 @@ if test "${ac_cv_func_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define socket to an innocuous variant, in case declares socket. + For example, HP-UX 11i declares gettimeofday. */ +#define socket innocuous_socket + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char socket (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef socket + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -2890,11 +3035,21 @@ return f != socket; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2907,7 +3062,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_socket=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_socket" >&5 echo "${ECHO_T}$ac_cv_func_socket" >&6 @@ -2924,7 +3080,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2948,11 +3103,21 @@ socket (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2965,7 +3130,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_socket=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 @@ -2996,21 +3162,28 @@ if test "${ac_cv_func_inet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define inet_ntoa to an innocuous variant, in case declares inet_ntoa. + For example, HP-UX 11i declares gettimeofday. */ +#define inet_ntoa innocuous_inet_ntoa + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char inet_ntoa (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef inet_ntoa + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3041,11 +3214,21 @@ return f != inet_ntoa; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3058,7 +3241,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_inet_ntoa=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_inet_ntoa" >&5 echo "${ECHO_T}$ac_cv_func_inet_ntoa" >&6 @@ -3075,7 +3259,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3099,11 +3282,21 @@ inet_ntoa (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3116,7 +3309,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_inet_ntoa=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_inet_ntoa" >&5 @@ -3147,21 +3341,28 @@ if test "${ac_cv_func_backtrace+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define backtrace to an innocuous variant, in case declares backtrace. + For example, HP-UX 11i declares gettimeofday. */ +#define backtrace innocuous_backtrace + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char backtrace (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef backtrace + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3192,11 +3393,21 @@ return f != backtrace; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3209,7 +3420,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_backtrace=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_backtrace" >&5 echo "${ECHO_T}$ac_cv_func_backtrace" >&6 @@ -3251,13 +3463,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -3307,7 +3519,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3318,7 +3529,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -3330,6 +3541,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3350,7 +3562,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3368,6 +3579,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3414,7 +3626,6 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3425,7 +3636,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -3437,6 +3648,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3457,7 +3669,6 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3475,6 +3686,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3535,7 +3747,6 @@ if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3556,11 +3767,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3573,12 +3794,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3600,7 +3820,6 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3625,7 +3844,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3637,9 +3855,9 @@ cat >>conftest.$ac_ext <<_ACEOF # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -3650,7 +3868,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -3675,7 +3893,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -3695,7 +3913,6 @@ if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3722,11 +3939,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3739,7 +3966,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 @@ -3762,7 +3989,7 @@ fi for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h + inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -3771,7 +3998,6 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3783,11 +4009,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3800,7 +4036,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3833,7 +4069,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3844,11 +4079,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3861,7 +4106,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -3869,7 +4114,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3887,6 +4131,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3906,33 +4151,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -3943,7 +4187,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3986,13 +4230,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -4019,7 +4263,6 @@ if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4082,11 +4325,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4099,7 +4352,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 @@ -4117,7 +4370,6 @@ if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4137,11 +4389,21 @@ if (sizeof (size_t)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4154,7 +4416,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 @@ -4174,7 +4436,6 @@ if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4195,11 +4456,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4212,7 +4483,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 @@ -4230,7 +4501,6 @@ if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4249,11 +4519,21 @@ struct tm *tp; tp->tm_sec; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4266,7 +4546,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 @@ -4306,13 +4586,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -4346,7 +4626,6 @@ else ac_cv_func_fnmatch_works=cross else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4391,7 +4670,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_fnmatch_works=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_fnmatch_works" >&5 @@ -4412,7 +4691,6 @@ if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4439,11 +4717,21 @@ int i; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4456,7 +4744,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=int fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 @@ -4476,21 +4764,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -4521,11 +4816,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4538,7 +4843,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -4557,7 +4863,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4581,11 +4886,21 @@ strftime (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4598,7 +4913,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_strftime=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5 @@ -4626,21 +4942,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -4671,11 +4994,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4688,7 +5021,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -4711,21 +5045,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -4756,11 +5097,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4773,7 +5124,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -4795,21 +5147,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -4840,11 +5199,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4857,7 +5226,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -4881,21 +5251,28 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -4926,11 +5303,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4943,7 +5330,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -4964,21 +5352,28 @@ if test "${ac_cv_func_inet_aton+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define inet_aton to an innocuous variant, in case declares inet_aton. + For example, HP-UX 11i declares gettimeofday. */ +#define inet_aton innocuous_inet_aton + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char inet_aton (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef inet_aton + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -5009,11 +5404,21 @@ return f != inet_aton; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5026,7 +5431,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_inet_aton=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_inet_aton" >&5 echo "${ECHO_T}$ac_cv_func_inet_aton" >&6 @@ -5042,7 +5448,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5066,11 +5471,21 @@ inet_aton (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5083,7 +5498,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_resolv_inet_aton=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_inet_aton" >&5 @@ -5115,7 +5531,6 @@ echo $ECHO_N "checking inlines... $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5132,11 +5547,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5149,7 +5574,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 dpkg_cv_c_inline=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi @@ -5177,7 +5602,6 @@ echo $ECHO_N "checking __attribute__((,,))... $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5194,11 +5618,21 @@ extern int testfunction(int x) __attribute__((,,)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5211,7 +5645,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 adns_cv_c_attribute_supported=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi @@ -5231,7 +5665,6 @@ echo $ECHO_N "checking __attribute__((noreturn))... $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5248,11 +5681,21 @@ extern int testfunction(int x) __attribute__((noreturn)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5265,7 +5708,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 adns_cv_c_attribute_noreturn=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi @@ -5291,7 +5734,6 @@ echo $ECHO_N "checking __attribute__((const))... $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5308,11 +5750,21 @@ extern int testfunction(int x) __attribute__((const)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5325,7 +5777,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 adns_cv_c_attribute_const=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi @@ -5351,7 +5803,6 @@ echo $ECHO_N "checking __attribute__((format...))... $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5368,11 +5819,21 @@ extern int testfunction(char *y, ...) __attribute__((format(printf,1,2))) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5385,7 +5846,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 adns_cv_attribute_format=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi @@ -5427,7 +5888,6 @@ else echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5438,11 +5898,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5455,7 +5925,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -5463,7 +5933,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5481,6 +5950,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -5500,33 +5970,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -5537,7 +6006,7 @@ echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -5560,7 +6029,6 @@ if test "${adns_cv_decl_inaddrloopback+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5583,11 +6051,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5600,7 +6078,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 adns_cv_decl_inaddrloopback=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "$adns_cv_decl_inaddrloopback" = yes; then @@ -5622,7 +6100,6 @@ else echo "$as_me:$LINENO: checking rpc/types.h usability" >&5 echo $ECHO_N "checking rpc/types.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5633,11 +6110,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5650,7 +6137,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -5658,7 +6145,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking rpc/types.h presence" >&5 echo $ECHO_N "checking rpc/types.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5676,6 +6162,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -5695,33 +6182,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: rpc/types.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: rpc/types.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: rpc/types.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: rpc/types.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: rpc/types.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: rpc/types.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: rpc/types.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: rpc/types.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: rpc/types.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: rpc/types.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: rpc/types.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: rpc/types.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: rpc/types.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: rpc/types.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: rpc/types.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: rpc/types.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: rpc/types.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: rpc/types.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: rpc/types.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: rpc/types.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -5770,7 +6256,6 @@ _ac_test: .long 0 EOF cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5787,11 +6272,21 @@ if (ac_test) return 1 _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5804,7 +6299,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_extern_prefix="no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$saved_libs fi echo "$as_me:$LINENO: result: $ac_cv_c_extern_prefix" >&5 @@ -5830,7 +6326,6 @@ else echo "$as_me:$LINENO: checking db.h usability" >&5 echo $ECHO_N "checking db.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5841,11 +6336,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5858,7 +6363,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -5866,7 +6371,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 echo "$as_me:$LINENO: checking db.h presence" >&5 echo $ECHO_N "checking db.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5884,6 +6388,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -5903,33 +6408,32 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: db.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: db.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: db.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: db.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: db.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: db.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: db.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: db.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: db.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: db.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: db.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: db.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: db.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: db.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: db.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: db.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: db.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -5960,7 +6464,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldb $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5984,11 +6487,21 @@ db_create (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6001,7 +6514,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_db_db_create=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_db_db_create" >&5 @@ -6084,13 +6598,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -6124,6 +6638,10 @@ if test "${enable_unreal31+set}" = set; then cat >>confdefs.h <<\_ACEOF #define UNREAL 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Unreal 3.1" _ACEOF PROTOCOL="unreal" @@ -6154,6 +6672,10 @@ _ACEOF cat >>confdefs.h <<\_ACEOF #define UNREAL32 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Unreal 3.2" _ACEOF PROTOCOL="unreal" @@ -6180,6 +6702,10 @@ if test "${enable_ultimate2+set}" = set; then cat >>confdefs.h <<\_ACEOF #define ULTIMATE 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Ultimate 2.x.x" _ACEOF PROTOCOL="ultimate" @@ -6211,6 +6737,10 @@ _ACEOF cat >>confdefs.h <<\_ACEOF #define ULTIMATE3 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Ultimate 3.x.x" _ACEOF PROTOCOL="ultimate" @@ -6238,6 +6768,10 @@ if test "${enable_hybrid7+set}" = set; then cat >>confdefs.h <<\_ACEOF #define HYBRID7 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Hybrid 7" _ACEOF PROTOCOL="hybrid7" @@ -6276,6 +6810,10 @@ if test "${enable_neoircd+set}" = set; then cat >>confdefs.h <<\_ACEOF #define NEOIRCD 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "NeoIRCd" _ACEOF PROTOCOL="neoircd" @@ -6303,6 +6841,10 @@ if test "${enable_quantum+set}" = set; then cat >>confdefs.h <<\_ACEOF #define QUANTUM 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Quantum" _ACEOF PROTOCOL="quantum" @@ -6329,6 +6871,10 @@ if test "${enable_mystic+set}" = set; then cat >>confdefs.h <<\_ACEOF #define MYSTIC 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Mystic" _ACEOF PROTOCOL="mystic" @@ -6355,6 +6901,10 @@ if test "${enable_bahamut+set}" = set; then cat >>confdefs.h <<\_ACEOF #define BAHAMUT 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Bahamut" _ACEOF PROTOCOL="bahamut" @@ -6381,6 +6931,10 @@ if test "${enable_ircu+set}" = set; then cat >>confdefs.h <<\_ACEOF #define IRCU 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "IRCu" _ACEOF PROTOCOL="ircu" @@ -6407,6 +6961,10 @@ if test "${enable_liquid+set}" = set; then cat >>confdefs.h <<\_ACEOF #define LIQUID 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Liquid" _ACEOF PROTOCOL="liquid" @@ -6434,6 +6992,10 @@ if test "${enable_viagra+set}" = set; then cat >>confdefs.h <<\_ACEOF #define VIAGRA 1 +_ACEOF + + cat >>confdefs.h <<_ACEOF +#define NS_PROTOCOL "Viagra" _ACEOF PROTOCOL="viagra" @@ -6453,7 +7015,6 @@ fi; echo "$as_me:$LINENO: checking A compatible IRCD is specified" >&5 echo $ECHO_N "checking A compatible IRCD is specified... $ECHO_C" >&6 -echo $PROTOCOL if test "$PROTOCOL" = no; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 @@ -6733,13 +7294,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -6769,13 +7330,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -6786,7 +7347,7 @@ ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' @@ -6830,9 +7391,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -6851,7 +7413,7 @@ for as_var in \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -7030,16 +7592,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -7066,7 +7629,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7110,9 +7673,9 @@ Usage: $0 [OPTIONS] [FILE]... -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -7126,11 +7689,10 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.57, +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir @@ -7406,9 +7968,9 @@ _ACEOF (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -7426,21 +7988,21 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -7456,10 +8018,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -7497,12 +8059,45 @@ case $srcdir in ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac case $INSTALL in @@ -7524,7 +8119,7 @@ echo "$as_me: creating $ac_file" >&6;} configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -7533,24 +8128,24 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } _ACEOF @@ -7592,12 +8187,12 @@ cat >>$CONFIG_STATUS <<\_ACEOF # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' @@ -7606,11 +8201,11 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac @@ -7624,28 +8219,29 @@ echo "$as_me: creating $ac_file" >&6;} case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF @@ -7668,9 +8264,9 @@ s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times @@ -7684,13 +8280,13 @@ rm -f confdef2sed.sed # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -7699,7 +8295,7 @@ do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -7726,7 +8322,7 @@ do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -7760,10 +8356,10 @@ echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -7779,10 +8375,10 @@ echo X"$ac_file" | as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -7864,13 +8460,13 @@ _ACEOF # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | diff --git a/configure.in b/configure.in index a205ef12..7122c670 100644 --- a/configure.in +++ b/configure.in @@ -185,6 +185,7 @@ AC_ARG_ENABLE(unreal31, [ --enable-unreal31 - enable Unreal 3.1.x IRCD Support], [ case "$enableval" in yes) AC_DEFINE(UNREAL, 1, 'Enable Unreal 3.1.x Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Unreal 3.1") PROTOCOL="unreal" AC_MSG_RESULT(yes) ;; @@ -199,6 +200,7 @@ AC_ARG_ENABLE(unreal32, [ --enable-unreal32 - enable Unreal 3.2.x IRCD Support], yes) AC_DEFINE(UNREAL, 1, 'Enable Unreal 3.1.x Support') AC_DEFINE(UNREAL32, 1, 'Enable Unreal 3.2.x Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Unreal 3.2") PROTOCOL="unreal" AC_MSG_RESULT(yes) ;; @@ -214,6 +216,7 @@ AC_ARG_ENABLE(ultimate2, [ --enable-ultimate2 - enable Ultimate 2.x.x IRCD Suppo [ case "$enableval" in yes) AC_DEFINE(ULTIMATE, 1, 'Enable Ultimate Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Ultimate 2.x.x") PROTOCOL="ultimate" AC_MSG_RESULT(yes) ;; @@ -229,6 +232,7 @@ AC_ARG_ENABLE(ultimate3, [ --enable-ultimate3 - enable Ultimate 3.x.x IRCD Suppo yes) AC_DEFINE(ULTIMATE, 1, 'Enable Ultimate 2.x.x Support') AC_DEFINE(ULTIMATE3, 1, "Enable Ultimate 3.x.x Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Ultimate 3.x.x") PROTOCOL="ultimate" AC_MSG_RESULT(yes) ;; @@ -244,6 +248,7 @@ AC_ARG_ENABLE(hybrid7, [ --enable-hybrid7 - enable Hybrid7 IRCD Support], [ case "$enableval" in yes) AC_DEFINE(HYBRID7, 1, 'Enable hybrid7 IRCD support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Hybrid 7") PROTOCOL="hybrid7" AC_MSG_CHECKING(Auto-Enabling ServiceRoots Authentication Module) do_serviceroots=yes @@ -265,6 +270,7 @@ AC_ARG_ENABLE(neoircd, [ --enable-neoircd - enable NeoIRCd IRCD Support], [ case "$enableval" in yes) AC_DEFINE(NEOIRCD, 1, 'Enable NeoIRCd IRCD support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "NeoIRCd") PROTOCOL="neoircd" AC_MSG_RESULT(yes) ;; @@ -281,6 +287,7 @@ AC_ARG_ENABLE(quantum, [ --enable-quantum - enable Quantum IRCD Support], [ case "$enableval" in yes) AC_DEFINE(QUANTUM, 1, 'Enable Quantum Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Quantum") PROTOCOL="quantum" AC_MSG_RESULT(yes) ;; @@ -296,6 +303,7 @@ AC_ARG_ENABLE(mystic, [ --enable-mystic - enable Mystic IRCD Support], [ case "$enableval" in yes) AC_DEFINE(MYSTIC, 1, 'Enable Mystic Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Mystic") PROTOCOL="mystic" AC_MSG_RESULT(yes) ;; @@ -311,6 +319,7 @@ AC_ARG_ENABLE(bahamut, [ --enable-bahamut - enable Bahamut IRCD Support], [ case "$enableval" in yes) AC_DEFINE(BAHAMUT, 1, 'Enable Bahamut Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Bahamut") PROTOCOL="bahamut" AC_MSG_RESULT(yes) ;; @@ -327,6 +336,7 @@ AC_ARG_ENABLE(ircu, [ --enable-ircu - enable IRCu IRCD Support], yes) dnl AC_MSG_ERROR('Sorry IRCu support isnt complete yet') AC_DEFINE(IRCU, 1, 'Enable IRCu Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "IRCu") PROTOCOL="ircu" AC_MSG_RESULT(yes) ;; @@ -342,6 +352,7 @@ AC_ARG_ENABLE(liquid, [ --enable-liquid - enable Liquid IRCD Support], [ case "$enableval" in yes) AC_DEFINE(LIQUID, 1, 'Enable Liquid IRCd Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Liquid") PROTOCOL="liquid" AC_MSG_RESULT(yes) ;; @@ -358,6 +369,7 @@ AC_ARG_ENABLE(viagra, [ --enable-viagra - enable Viagra IRCD Support], [ case "$enableval" in yes) AC_DEFINE(VIAGRA, 1, 'Enable Viagra IRCd Support') + AC_DEFINE_UNQUOTED(NS_PROTOCOL, "Viagra") PROTOCOL="viagra" AC_MSG_RESULT(yes) ;; diff --git a/src/bans.c b/src/bans.c index 25fb20ee..9b417d04 100755 --- a/src/bans.c +++ b/src/bans.c @@ -36,13 +36,9 @@ new_ban (const char *mask) hnode_t *bansnode; SET_SEGV_LOCATION(); - ban = calloc (sizeof (Ban), 1); - bzero(ban, sizeof(Ban)); + ban = scalloc (sizeof (Ban)); strlcpy (ban->mask, mask, MAXHOST); bansnode = hnode_create (ban); - if (!bansnode) { - nlog (LOG_WARNING, "bans hash is broken\n"); - } if (hash_isfull (banshash)) { nlog (LOG_WARNING, "bans hash is full!\n"); } else { @@ -259,7 +255,7 @@ InitBans (void) { banshash = hash_create (-1, 0, 0); if (!banshash) { - nlog (LOG_CRITICAL, "Create bans hash failed\n"); + nlog (LOG_CRITICAL, "Unable to create bans hash"); return NS_FAILURE; } #ifdef SQLSRV diff --git a/src/bots.c b/src/bots.c index 2e49dd2d..4a79fd96 100755 --- a/src/bots.c +++ b/src/bots.c @@ -144,6 +144,34 @@ del_chan_bot (char *bot, char *chan) } } +/** @brief dump list of module bots and channels + * + * @param u + * + * @return none + */ +int +list_bot_chans (CmdParams* cmdparams) +{ + hscan_t hs; + hnode_t *hn; + lnode_t *ln; + ChanBot *mod_chan_bot; + + prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "BotChanDump:"); + hash_scan_begin (&hs, bch); + while ((hn = hash_scan_next (&hs)) != NULL) { + mod_chan_bot = hnode_get (hn); + prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "%s:--------------------------------", mod_chan_bot->chan); + ln = list_first (mod_chan_bot->bots); + while (ln) { + prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "Bot Name: %s", (char *)lnode_get (ln)); + ln = list_next (mod_chan_bot->bots, ln); + } + } + return 0; +} + int process_origin(CmdParams * cmdparams, char* origin) { cmdparams->source.user = finduser (origin); @@ -295,34 +323,6 @@ void bot_chan_private (char *origin, char **av, int ac) free (cmdparams); } -/** @brief dump list of module bots and channels - * - * @param u - * - * @return none - */ -int -list_bot_chans (CmdParams* cmdparams) -{ - hscan_t hs; - hnode_t *hn; - lnode_t *ln; - ChanBot *mod_chan_bot; - - prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "BotChanDump:"); - hash_scan_begin (&hs, bch); - while ((hn = hash_scan_next (&hs)) != NULL) { - mod_chan_bot = hnode_get (hn); - prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "%s:--------------------------------", mod_chan_bot->chan); - ln = list_first (mod_chan_bot->bots); - while (ln) { - prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "Bot Name: %s", (char *)lnode_get (ln)); - ln = list_next (mod_chan_bot->bots, ln); - } - } - return 0; -} - /** @brief create a new bot * * @param bot_name string containing bot name @@ -516,14 +516,16 @@ int del_bots (Module *mod_ptr) * * @return NS_SUCCESS if suceeds, NS_FAILURE if not */ -Bot * init_bot (Module* modptr, BotInfo* botinfo, const char* modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list) +Bot * init_bot (BotInfo* botinfo, const char* modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list) { Bot * botptr; User *u; long Umode; char* nick; + Module* modptr; SET_SEGV_LOCATION(); + modptr = GET_CUR_MODULE(); nick = botinfo->nick; u = finduser (nick); if (u) { @@ -559,10 +561,7 @@ Bot * init_bot (Module* modptr, BotInfo* botinfo, const char* modes, unsigned in sumode_cmd (nick, nick, UMODE_DEAF); } #endif - /* restore segv_inmodule from SIGNON */ - if(modptr) { - SET_SEGV_INMODULE(modptr->info->name); - } + SET_RUN_LEVEL(modptr); botptr->flags = flags; if (bot_cmd_list) { add_bot_cmd_list (botptr, bot_cmd_list); diff --git a/src/channels.c b/src/channels.c index c6c8fd8e..4f67dccd 100644 --- a/src/channels.c +++ b/src/channels.c @@ -44,9 +44,9 @@ typedef struct Chanmem { void *moddata[NUM_MODULES]; } Chanmem; -hash_t *ch; +static hash_t *ch; -extern char quitreason[BUFSIZE]; +static char quitreason[BUFSIZE]; static void ChanPartHandler (list_t * list, lnode_t * node, void *v) @@ -54,8 +54,13 @@ ChanPartHandler (list_t * list, lnode_t * node, void *v) part_chan ((User *)v, lnode_get (node), quitreason[0] != 0 ? quitreason : NULL); } -void PartAllChannels (User* u) +void PartAllChannels (User* u, const char* reason) { + bzero(quitreason, BUFSIZE); + if(reason) { + strlcpy(quitreason, reason, BUFSIZE); + strip_mirc_codes(quitreason); + } list_process (u->chans, u, ChanPartHandler); } @@ -675,7 +680,7 @@ join_chan (const char* nick, const char *chan) if (!ircstrcasecmp ("0", chan)) { /* join 0 is actually part all chans */ nlog (LOG_DEBUG2, "join_chan: parting %s from all channels", u->nick); - PartAllChannels (u); + PartAllChannels (u, NULL); return; } c = findchan (chan); @@ -1096,8 +1101,10 @@ int InitChannels () { ch = hash_create (C_TABLE_SIZE, 0, 0); - if(!ch) + if(!ch) { + nlog (LOG_CRITICAL, "Unable to create channel hash"); return NS_FAILURE; + } #ifdef SQLSRV /* add the server hash to the sql library */ neo_chans.address = ch; @@ -1105,3 +1112,22 @@ InitChannels () #endif return NS_SUCCESS; } + +void FiniChannels (void) +{ + hash_destroy(ch); +} + +void GetChannelList(ChannelListHandler handler) +{ + hnode_t *node; + hscan_t scan; + Channel *c; + + SET_SEGV_LOCATION(); + hash_scan_begin(&scan, ch); + while ((node = hash_scan_next(&scan)) != NULL) { + c = hnode_get(node); + handler(c); + } +} diff --git a/src/channels.h b/src/channels.h index 149c5e14..16dba667 100644 --- a/src/channels.h +++ b/src/channels.h @@ -26,7 +26,7 @@ void ChanDump (const char *chan); void part_chan (User * u, const char *chan, const char* reason); -void PartAllChannels (User* u); +void PartAllChannels (User* u, const char* reason); void join_chan (const char* nick, const char *chan); void ChanNickChange (Channel * c, const char *newnick, const char *oldnick); int ChanMode (char *origin, char **av, int ac); @@ -35,5 +35,6 @@ void ChanUserMode (const char* chan, const char* nick, int add, long mode); void kick_chan (const char *kickby, const char *chan, const char *kicked, const char *kickreason); void SetChanTS (Channel * c, const time_t tstime); int InitChannels (void); +void FiniChannels (void); #endif /* _CHANS_H_ */ diff --git a/src/commands.c b/src/commands.c index 2830a536..c2124128 100755 --- a/src/commands.c +++ b/src/commands.c @@ -476,10 +476,9 @@ run_bot_cmd (CmdParams * cmdparams) nlog (LOG_NORMAL, "%s used %s", cmdparams->source.user->nick, cmdparams->param); /* call handler */ if (setjmp (sigvbuf) == 0) { - if(cmdparams->dest.bot->moduleptr) - SET_SEGV_INMODULE(cmdparams->dest.bot->moduleptr->info->name); + SET_RUN_LEVEL(cmdparams->dest.bot->moduleptr); cmdret = cmd_ptr->handler(cmdparams); - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); } switch(cmdret) { case NS_ERR_SYNTAX_ERROR: diff --git a/src/conf.c b/src/conf.c index 4853b147..7bb576d7 100644 --- a/src/conf.c +++ b/src/conf.c @@ -101,13 +101,6 @@ ConfLoad () return NS_FAILURE; } printf ("Sucessfully loaded config file, booting NeoStats\n"); - /* if all bots should join the chan */ - if (GetConf ((void *) &me.allbots, CFGINT, "AllBotsJoinChan") <= 0) { - me.allbots = 0; - } - if (GetConf ((void *) &me.pingtime, CFGINT, "PingServerTime") <= 0) { - me.pingtime = 120; - } return NS_SUCCESS; } diff --git a/src/config.h.in b/src/config.h.in index c7920a59..fc4558f2 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -121,13 +121,15 @@ /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME +/* IRCd protocol */ +#undef NS_PROTOCOL + /* 'Enable Ultimate Support' */ #undef ULTIMATE /* 'Enable Ultimate Support' */ #undef ULTIMATE3 - /* 'Enable Unreal Support' */ #undef UNREAL diff --git a/src/db.c b/src/db.c index 45bcd38e..569f84d3 100755 --- a/src/db.c +++ b/src/db.c @@ -41,15 +41,8 @@ int DBOpenDatabase(void) { int index; nlog(LOG_DEBUG1, "DBOpenDatabase"); - - index = get_mod_num (segv_inmodule); - - if (index == NS_FAILURE) { - return -1; - } - - ircsnprintf(db_list[index].dbname, MAXPATH, "data/%s.db", segv_inmodule); - + index = GET_CUR_MODNUM(); + ircsnprintf(db_list[index].dbname, MAXPATH, "data/%s.db", GET_CUR_MODNAME()); if ((dbret = db_create(&db_list[index].dbp, NULL, 0)) != 0) { nlog(LOG_DEBUG1, "db_create: %s", db_strerror(dbret)); return -1; @@ -66,7 +59,7 @@ void DBCloseDatabase(void) int index; nlog(LOG_DEBUG1, "DBCloseDatabase"); - index = get_mod_num (segv_inmodule); + index = GET_CUR_MODNUM(); db_list[index].dbp->close(db_list[index].dbp, 0); } @@ -75,7 +68,7 @@ void* DBGetData(char* key) int index; nlog(LOG_DEBUG1, "DBGetData %s", key); - index = get_mod_num (segv_inmodule); + index = GET_CUR_MODNUM(); memset(&dbkey, 0, sizeof(dbkey)); memset(&dbdata, 0, sizeof(dbdata)); dbkey.data = key; @@ -94,7 +87,7 @@ void DBSetData(char* key, void* data, int size) int index; nlog(LOG_DEBUG1, "DBSetData %s %s", key, data); - index = get_mod_num (segv_inmodule); + index = GET_CUR_MODNUM(); memset(&dbkey, 0, sizeof(dbkey)); memset(&dbdata, 0, sizeof(dbdata)); dbkey.data = key; diff --git a/src/dns.c b/src/dns.c index 8b27c815..3c01ef5d 100644 --- a/src/dns.c +++ b/src/dns.c @@ -2,8 +2,6 @@ ** Copyright (c) 1999-2004 Adam Rutter, Justin Hammond ** http://www.neostats.net/ ** -** -** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or @@ -36,21 +34,20 @@ #include "dns.h" #include "services.h" -adns_state ads; +#define DNS_DATA_SIZE 255 -/** @brief DNS lookup Struct - * structure containing all pending DNS lookups and the callback functions - */ -struct dnslookup_struct { +typedef struct DnsLookup { adns_query q; /**< the ADNS query */ adns_answer *a; /**< the ADNS result if we have completed */ adns_rrtype type; /**< the type we are looking for, only populated if we add to a queue */ - char data[255]; /**< the User data based to the callback */ + char data[DNS_DATA_SIZE]; /**< the User data based to the callback */ char lookupdata[255]; /**< the look up data, only populated if we add to a queue */ void (*callback) (char *data, adns_answer * a); /**< a function pointer to call when we have a result */ - char mod_name[MAX_MOD_NAME]; -}; + Module* modptr; +} DnsLookup; + +adns_state ads; struct DNSStats { int totalq; @@ -60,22 +57,16 @@ struct DNSStats { int failure; } DNSStats; - -/** @brief DNS structures - */ -typedef struct dnslookup_struct DnsLookup; - /** @brief List of DNS queryies * Contains DnsLookup entries */ -list_t *dnslist; +static list_t *dnslist; /** @brief list of DNS queries that are queued up * */ list_t *dnsqueue; - void dns_check_queue(); /** @brief starts a DNS lookup @@ -90,9 +81,7 @@ void dns_check_queue(); * * @return returns 1 on success, 0 on failure (to add the lookup, not a successful lookup */ - -int -dns_lookup (char *str, adns_rrtype type, void (*callback) (char *data, adns_answer * a), char *data) +int dns_lookup (char *str, adns_rrtype type, void (*callback) (char *data, adns_answer * a), char *data) { lnode_t *dnsnode; DnsLookup *dnsdata; @@ -109,14 +98,8 @@ dns_lookup (char *str, adns_rrtype type, void (*callback) (char *data, adns_answ return 0; } /* set the module name */ - /* This is a bad bad hack... */ - if (segv_inmodule[0]) { - /* why MAXHOST? because thats the size of mod_name!?!? */ - strlcpy(dnsdata->mod_name, segv_inmodule, MAX_MOD_NAME); - } else { - strlcpy(dnsdata->mod_name, "NeoStats", MAX_MOD_NAME); - } - strlcpy (dnsdata->data, data, 254); + dnsdata->modptr = GET_CUR_MODULE(); + strlcpy (dnsdata->data, data, DNS_DATA_SIZE); dnsdata->callback = callback; dnsdata->type = type; @@ -155,23 +138,22 @@ dns_lookup (char *str, adns_rrtype type, void (*callback) (char *data, adns_answ return 1; } - /** @brief sets up DNS subsystem * * configures ADNS for use with NeoStats. * * @return returns 1 on success, 0 on failure */ - -int -InitDns () +int InitDns (void) { int adnsstart; SET_SEGV_LOCATION(); dnslist = list_create (DNS_QUEUE_SIZE); - if (!dnslist) + if (!dnslist) { + nlog (LOG_CRITICAL, "Unable to create DNS list"); return NS_FAILURE; + } /* dnsqueue is unlimited. */ dnsqueue = list_create(-1); if (!dnsqueue) @@ -182,7 +164,6 @@ InitDns () adnsstart = adns_init (&ads, adns_if_debug | adns_if_noautosys, 0); #endif if (adnsstart) { - printf ("ADNS init failed: %s\n", strerror (adnsstart)); nlog (LOG_CRITICAL, "ADNS init failed: %s", strerror (adnsstart)); return NS_FAILURE; } @@ -193,14 +174,12 @@ InitDns () /* @brief Clean up ADNS data when we shutdown * */ -void -FiniDns (void) +void FiniDns (void) { lnode_t *dnsnode; DnsLookup *dnsdata; SET_SEGV_LOCATION(); - dnsnode = list_first (dnslist); while (dnsnode) { dnsdata = lnode_get(dnsnode); @@ -222,17 +201,16 @@ FiniDns (void) * @param module name * @return Nothing */ -void -canx_dns(const char *modname) { +void canx_dns(Module* modptr) +{ lnode_t *dnsnode, *lnode2; DnsLookup *dnsdata; SET_SEGV_LOCATION(); - dnsnode = list_first (dnslist); while (dnsnode) { dnsdata = lnode_get(dnsnode); - if (!ircstrcasecmp(dnsdata->mod_name, modname)) { + if (dnsdata->modptr == modptr) { adns_cancel(dnsdata->q); free (dnsdata->a); free (dnsdata); @@ -245,7 +223,7 @@ canx_dns(const char *modname) { dnsnode = list_first(dnsqueue); while (dnsnode) { dnsdata = lnode_get(dnsnode); - if (!ircstrcasecmp(dnsdata->mod_name, modname)) { + if (dnsdata->modptr == modptr) { free(dnsdata); lnode2 = list_next(dnsqueue, dnsnode); list_delete(dnsqueue, dnsnode); @@ -257,8 +235,6 @@ canx_dns(const char *modname) { dns_check_queue(); } - - /** @brief Checks for Completed DNS queries * * Goes through the dnslist of pending queries and calls the callback function for each lookup @@ -267,9 +243,7 @@ canx_dns(const char *modname) { * * @return Nothing */ - -void -do_dns () +void do_dns (void) { lnode_t *dnsnode, *dnsnode1; int status; @@ -297,12 +271,11 @@ do_dns () if (status) { nlog (LOG_CRITICAL, "DNS: Baaaad error on adns_check: %s. Please report to NeoStats Group", strerror (status)); chanalert (ns_botptr->nick, "Bad Error on DNS lookup. Please check logfile"); + SET_RUN_LEVEL(dnsdata->modptr); DNSStats.failure++; - /* set this so nlog works good */ - SET_SEGV_INMODULE(dnsdata->mod_name); /* call the callback function with answer set to NULL */ dnsdata->callback (dnsdata->data, NULL); - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); /* delete from list */ dnsnode1 = list_delete (dnslist, dnsnode); dnsnode = list_next (dnslist, dnsnode1); @@ -311,12 +284,12 @@ do_dns () lnode_destroy (dnsnode1); break; } - nlog (LOG_DEBUG1, "DNS: Calling callback function with data %s for module %s", dnsdata->data, dnsdata->mod_name); + nlog (LOG_DEBUG1, "DNS: Calling callback function with data %s for module %s", dnsdata->data, dnsdata->modptr->info->name); DNSStats.success++; - SET_SEGV_INMODULE(dnsdata->mod_name); + SET_RUN_LEVEL(dnsdata->modptr); /* call the callback function */ dnsdata->callback (dnsdata->data, dnsdata->a); - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); /* delete from list */ dnsnode1 = list_delete (dnslist, dnsnode); dnsnode = list_next (dnslist, dnsnode1); @@ -375,7 +348,6 @@ void dns_check_queue() { } } - void do_dns_stats_Z(User *u) { numeric (RPL_MEMSTATS, u->nick, "Active DNS queries: %d", (int) list_count(dnslist)); numeric (RPL_MEMSTATS, u->nick, "Queued DNS Queries: %d", (int) list_count(dnsqueue)); diff --git a/src/dns.h b/src/dns.h index b54cd3af..eaf8f33e 100644 --- a/src/dns.h +++ b/src/dns.h @@ -27,6 +27,6 @@ int InitDns (void); void do_dns (void); void FiniDns (); -void canx_dns(const char *modname); +void canx_dns(Module* modptr); void do_dns_stats_Z(User *); #endif /* _DNS_H_ */ diff --git a/src/dotconf.h b/src/dotconf.h index 2003a770..0c085004 100644 --- a/src/dotconf.h +++ b/src/dotconf.h @@ -58,8 +58,10 @@ typedef struct _cfgoption { /* general configuration items */ struct config { + /* log level */ + unsigned int loglevel; /* debug level */ - unsigned int debug; + unsigned int debuglevel; /* enable recv.log */ unsigned int recvlog:1; /* dont load modules on startup */ diff --git a/src/exclude.c b/src/exclude.c index 4f979941..1b4a85aa 100644 --- a/src/exclude.c +++ b/src/exclude.c @@ -60,8 +60,7 @@ int InitExcludes(void) exclude_list = list_create(-1); if (GetTableData("Exclusions", &row) > 0) { for (i = 0; row[i] != NULL; i++) { - e = malloc(sizeof(excludes)); - bzero(e, sizeof(excludes)); + e = scalloc(sizeof(excludes)); if (GetData((void *)&tmp, CFGSTR, "Exclusions", row[i], "Pattern") > 0) { strlcpy(e->pattern, tmp, MAXHOST); } else { diff --git a/src/ircd.c b/src/ircd.c index ac08a11c..a11640ad 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -207,9 +207,6 @@ SmodeStringToMask(const char* SmodeString, long Smode) int join_bot_to_chan (const char *who, const char *chan, unsigned long chflag) { - char savemod[SEGV_INMODULE_BUFSIZE]; - - strlcpy(savemod, segv_inmodule, SEGV_INMODULE_BUFSIZE); #ifdef GOTSJOIN ssjoin_cmd(who, chan, chflag); #else @@ -222,7 +219,6 @@ join_bot_to_chan (const char *who, const char *chan, unsigned long chflag) #endif #endif - SET_SEGV_INMODULE(savemod); return NS_SUCCESS; } @@ -627,7 +623,7 @@ void do_version (const char* nick, const char *remoteserver) { SET_SEGV_LOCATION(); - numeric (RPL_VERSION, nick, "%s :%s -> %s %s", me.versionfull, me.name, ns_module_info.build_date, ns_module_info.build_time); + numeric (RPL_VERSION, nick, "%s :%s -> %s %s", me.version, me.name, ns_module_info.build_date, ns_module_info.build_time); ModulesVersion (nick, remoteserver); } @@ -649,7 +645,7 @@ do_motd (const char* nick, const char *remoteserver) numeric (ERR_NOMOTD, nick, ":- MOTD file Missing"); } else { numeric (RPL_MOTDSTART, nick, ":- %s Message of the Day -", me.name); - numeric (RPL_MOTD, nick, ":- %s. Copyright (c) 1999 - 2004 The NeoStats Group", me.versionfull); + numeric (RPL_MOTD, nick, ":- %s. Copyright (c) 1999 - 2004 The NeoStats Group", me.version); numeric (RPL_MOTD, nick, ":-"); while (fgets (buf, sizeof (buf), fp)) { @@ -679,7 +675,7 @@ do_admin (const char* nick, const char *remoteserver) numeric (ERR_NOADMININFO, nick, "%s :No administrative info available", me.name); } else { numeric (RPL_ADMINME, nick, ":%s :Administrative info", me.name); - numeric (RPL_ADMINME, nick, ":%s. Copyright (c) 1999 - 2004 The NeoStats Group", me.versionfull); + numeric (RPL_ADMINME, nick, ":%s. Copyright (c) 1999 - 2004 The NeoStats Group", me.version); while (fgets (buf, sizeof (buf), fp)) { buf[strnlen (buf, BUFSIZE) - 1] = 0; numeric (RPL_ADMINLOC1, nick, ":- %s", buf); @@ -699,7 +695,7 @@ void do_credits (const char* nick, const char *remoteserver) { SET_SEGV_LOCATION(); - numeric (RPL_VERSION, nick, ":- NeoStats %s Credits ", me.versionfull); + numeric (RPL_VERSION, nick, ":- NeoStats %s Credits ", me.version); numeric (RPL_VERSION, nick, ":- Now Maintained by Shmad (shmad@neostats.net) and ^Enigma^ (enigma@neostats.net)"); numeric (RPL_VERSION, nick, ":- For Support, you can find ^Enigma^ or Shmad at"); numeric (RPL_VERSION, nick, ":- irc.irc-chat.net #NeoStats"); @@ -920,8 +916,8 @@ numeric (const int numeric, const char *target, const char *data, ...) void unsupported_cmd(const char* cmd) { - chanalert (ns_botptr->nick, "Warning, %s tried to %s which is not supported", ((segv_inmodule[0] != 0)? segv_inmodule : ""), cmd); - nlog (LOG_NOTICE, "Warning, %s tried to %s, which is not supported", ((segv_inmodule[0] != 0)? segv_inmodule : ""), cmd); + chanalert (ns_botptr->nick, "Warning, %s tried to %s which is not supported", GET_CUR_MODNAME(), cmd); + nlog (LOG_NOTICE, "Warning, %s tried to %s, which is not supported", GET_CUR_MODNAME(), cmd); } int diff --git a/src/ircd.h b/src/ircd.h index 9f12c29e..32d54684 100644 --- a/src/ircd.h +++ b/src/ircd.h @@ -66,7 +66,6 @@ extern UserModes user_umodes[]; extern UserModes user_smodes[]; #endif -extern const char ircd_version[]; extern ircd_server ircd_srv; extern ircd_cmd cmd_list[]; extern ChanModes chan_modes[]; diff --git a/src/keeper.c b/src/keeper.c index d133d2b4..c44d055a 100644 --- a/src/keeper.c +++ b/src/keeper.c @@ -35,12 +35,7 @@ GetConf (void **data, int type, const char *item) char keypath[255]; int i = 0; - /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "g/%s:/%s", segv_inmodule, item); - } else { - ircsnprintf (keypath, 255, "g/core:/%s", item); - } + ircsnprintf (keypath, 255, "g/%s:/%s", GET_CUR_MODNAME(), item); switch (type) { case CFGSTR: @@ -76,12 +71,7 @@ GetDir (char *item, char ***data) char keypath[255]; char **data1; - /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "g/%s:/%s", segv_inmodule, item); - } else { - ircsnprintf (keypath, 255, "g/core:/%s", item); - } + ircsnprintf (keypath, 255, "g/%s:/%s", GET_CUR_MODNAME(), item); i = kp_get_dir (keypath, &data1, NULL); if (i == 0) { *data = data1; @@ -103,12 +93,7 @@ SetConf (void *data, int type, char *item) char keypath[255]; int i = 0; - /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "g/%s:/%s", segv_inmodule, item); - } else { - ircsnprintf (keypath, 255, "g/core:/%s", item); - } + ircsnprintf (keypath, 255, "g/%s:/%s", GET_CUR_MODNAME(), item); switch (type) { case CFGSTR: @@ -148,11 +133,7 @@ DelConf (char *item) int i = 0; /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "g/%s:/%s", segv_inmodule, item); - } else { - ircsnprintf (keypath, 255, "g/core:/%s", item); - } + ircsnprintf (keypath, 255, "g/%s:/%s", GET_CUR_MODNAME(), item); i = kp_recursive_do(keypath, (kp_func) kp_remove, 0, NULL); /* check for errors */ if (i != 0) { @@ -172,11 +153,7 @@ GetData (void **data, int type, const char *table, const char *row, const char * int i = 0; /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "l/%s:/%s/%s/%s", segv_inmodule, table, row, field); - } else { - ircsnprintf (keypath, 255, "l/core:/%s/%s/%s", table, row, field); - } + ircsnprintf (keypath, 255, "l/%s:/%s/%s/%s", GET_CUR_MODNAME(), table, row, field); switch (type) { case CFGSTR: i = kp_get_string (keypath, (char **) *&data); @@ -212,11 +189,7 @@ GetTableData (char *table, char ***data) char **data1; /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "l/%s:/%s", segv_inmodule, table); - } else { - ircsnprintf (keypath, 255, "l/core:/%s", table); - } + ircsnprintf (keypath, 255, "l/%s:/%s", GET_CUR_MODNAME(), table); i = kp_get_dir (keypath, &data1, NULL); if (i == 0) { *data = data1; @@ -238,12 +211,7 @@ SetData (void *data, int type, char *table, char *row, char *field) char keypath[255]; int i = 0; - /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "l/%s:/%s/%s/%s", segv_inmodule, table, row, field); - } else { - ircsnprintf (keypath, 255, "l/core:/%s/%s/%s", table, row, field); - } + ircsnprintf (keypath, 255, "l/%s:/%s/%s/%s", GET_CUR_MODNAME(), table, row, field); switch (type) { case CFGSTR: i = kp_set_string (keypath, (char *) data); @@ -282,11 +250,7 @@ DelRow (char *table, char *row) int i = 0; /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "l/%s:/%s/%s", segv_inmodule, table, row); - } else { - ircsnprintf (keypath, 255, "l/core:/%s/%s", table, row); - } + ircsnprintf (keypath, 255, "l/%s:/%s/%s", GET_CUR_MODNAME(), table, row); i = kp_recursive_do(keypath, (kp_func) kp_remove, 0, NULL); /* check for errors */ if (i != 0) { @@ -305,11 +269,7 @@ DelTable (char *table) int i = 0; /* determine if its a module setting */ - if (segv_inmodule[0] != 0) { - ircsnprintf (keypath, 255, "l/%s:/%s", segv_inmodule, table); - } else { - ircsnprintf (keypath, 255, "l/core:/%s", table); - } + ircsnprintf (keypath, 255, "l/%s:/%s", GET_CUR_MODNAME(), table); i = kp_recursive_do(keypath, (kp_func) kp_remove, 0, NULL); /* check for errors */ if (i != 0) { diff --git a/src/keeper/kp_util.c b/src/keeper/kp_util.c index a71720b4..61cb60d9 100644 --- a/src/keeper/kp_util.c +++ b/src/keeper/kp_util.c @@ -70,8 +70,8 @@ static char *kp_tmpname = NULL; /* String array containing the base path of the different sections */ static char *kp_basedirs[KPDB_NUMDBS]; -#define GLOBALDIR "kpconf" /* Default global database path */ -#define LOCALDIR "kpdata" /* Local database path */ +#define GLOBALDIR "data/kpconf" /* Default global database path */ +#define LOCALDIR "data/kpdata" /* Local database path */ #define USERSUBDIR "kplang" /* Default user database dir */ #define LOCKFILE ":lock:" /* Lock file name */ diff --git a/src/log.c b/src/log.c index 16c25e2f..c5bc4ce1 100644 --- a/src/log.c +++ b/src/log.c @@ -48,6 +48,19 @@ const char *loglevels[10] = { "INSANE" }; +const char *dloglevels[10] = { + "DEBUG1", + "DEBUG2", + "DEBUG3", + "DEBUG4", + "DEBUG5", + "DEBUG6", + "DEBUG7", + "DEBUG8", + "DEBUG9", + "DEBUG10", +}; + static char log_buf[BUFSIZE]; static char log_fmttime[TIMEBUFSIZE]; @@ -140,6 +153,42 @@ void make_log_filename(char* modname, char *logname) ircsnprintf (logname, MAXPATH, "logs/%s%s.log", modname, log_fmttime); } +static void +debuglog (const char* time, const char* level, const char *line) +{ + FILE *logfile; + + if ((logfile = fopen ("logs/debug.log", "a")) == NULL) + return; + if (logfile) { + fprintf (logfile, "%s %s %s\n", time, level, line); + fclose (logfile); + } +} + +/** @Configurable logging function + */ +void +dlog (DEBUG_LEVEL level, char *fmt, ...) +{ + va_list ap; + + if (level <= config.debuglevel) { + /* we update me.now here, because some functions might be busy and not call the loop a lot */ + me.now = time(NULL); + ircsnprintf (me.strnow, STR_TIME_T_SIZE, "%ld", me.now); + strftime (log_fmttime, TIMEBUFSIZE, "%d/%m/%Y[%H:%M:%S]", localtime (&me.now)); + va_start (ap, fmt); + ircvsnprintf (log_buf, BUFSIZE, fmt, ap); + va_end (ap); +#ifndef DEBUG + if (config.foreground) +#endif + printf ("%s %s - %s\n", dloglevels[level - 1], GET_CUR_MODNAME(), log_buf); + debuglog (log_fmttime, dloglevels[level - 1], log_buf); + } +} + /** @Configurable logging function */ void @@ -149,12 +198,8 @@ nlog (LOG_LEVEL level, char *fmt, ...) hnode_t *hn; struct logs_ *logentry; - if (level <= config.debug) { - if (segv_inmodule[0]!= 0) { - hn = hash_lookup (logs, segv_inmodule); - } else { - hn = hash_lookup (logs, CoreLogFileName); - } + if (level <= config.loglevel) { + hn = hash_lookup (logs, GET_CUR_MODNAME()); if (hn) { /* we found our log entry */ logentry = hnode_get (hn); @@ -162,7 +207,7 @@ nlog (LOG_LEVEL level, char *fmt, ...) logentry->logfile = fopen (logentry->logname, "a"); } else { logentry = malloc (sizeof (struct logs_)); - strlcpy (logentry->name, segv_inmodule[0] == 0 ? CoreLogFileName : segv_inmodule , MAX_MOD_NAME); + strlcpy (logentry->name, GET_CUR_MODNAME() , MAX_MOD_NAME); make_log_filename(logentry->name, logentry->logname); logentry->logfile = fopen (logentry->logname, "a"); logentry->flush = 0; @@ -176,20 +221,24 @@ nlog (LOG_LEVEL level, char *fmt, ...) do_exit (NS_EXIT_NORMAL, NULL); } #endif - /* we update me.now here, becase some functions might be busy and not call the loop a lot */ + /* we update me.now here, because some functions might be busy and not call the loop a lot */ me.now = time(NULL); ircsnprintf (me.strnow, STR_TIME_T_SIZE, "%ld", me.now); strftime (log_fmttime, TIMEBUFSIZE, "%d/%m/%Y[%H:%M:%S]", localtime (&me.now)); va_start (ap, fmt); ircvsnprintf (log_buf, BUFSIZE, fmt, ap); va_end (ap); - - fprintf (logentry->logfile, "(%s) %s %s - %s\n", log_fmttime, loglevels[level - 1], segv_inmodule[0] == 0 ? "CORE" : segv_inmodule, log_buf); - logentry->flush = 1; + if(level <= LOG_INFO) { + fprintf (logentry->logfile, "(%s) %s %s - %s\n", log_fmttime, loglevels[level - 1], GET_CUR_MODNAME(), log_buf); + logentry->flush = 1; + } #ifndef DEBUG if (config.foreground) #endif - printf ("%s %s - %s\n", loglevels[level - 1], segv_inmodule[0] == 0 ? "CORE" : segv_inmodule, log_buf); + printf ("%s %s - %s\n", loglevels[level - 1], GET_CUR_MODNAME(), log_buf); + } + if (config.debuglevel) { + debuglog (log_fmttime, loglevels[level - 1], log_buf); } } diff --git a/src/main.c b/src/main.c index e00f75f8..5bbde36e 100644 --- a/src/main.c +++ b/src/main.c @@ -46,7 +46,6 @@ #endif char segv_location[SEGV_LOCATION_BUFSIZE]; -char segv_inmodule[SEGV_INMODULE_BUFSIZE]; /*! Date when we were compiled */ const char version_date[] = __DATE__; @@ -126,6 +125,7 @@ static int InitCore(void) if (InitCurl () != NS_SUCCESS) return NS_FAILURE; InitIrcd (); + nlog (LOG_DEBUG1, "Core init successful"); return NS_SUCCESS; } @@ -145,8 +145,6 @@ main (int argc, char *argv[]) /* initialise version */ strlcpy(me.version, NEOSTATS_VERSION, VERSIONSIZE); - strlcpy(me.versionfull, NEOSTATS_VERSION, VERSIONSIZE); - strlcat(me.versionfull, ircd_version, VERSIONSIZE); /* get our commandline options */ if(get_options (argc, argv)!=NS_SUCCESS) return EXIT_FAILURE; @@ -159,15 +157,16 @@ main (int argc, char *argv[]) return EXIT_FAILURE; } #endif + /* Init run level to NeoStats core */ + RunModule[0]=&ns_module; /* before we do anything, make sure logging is setup */ if(InitLogs () != NS_SUCCESS) return EXIT_FAILURE; /* our crash trace variables */ SET_SEGV_LOCATION(); - CLEAR_SEGV_INMODULE(); /* keep quiet if we are told to :) */ if (!config.quiet) { - printf ("NeoStats %s Loading...\n", me.versionfull); + printf ("NeoStats %s Loading...\n", me.version); printf ("-----------------------------------------------\n"); printf ("Copyright: NeoStats Group. 2000-2004\n"); printf ("Justin Hammond (fish@neostats.net)\n"); @@ -199,7 +198,7 @@ main (int argc, char *argv[]) fclose (fp); if (!config.quiet) { printf ("\n"); - printf ("NeoStats %s Successfully Launched into Background\n", me.versionfull); + printf ("NeoStats %s Successfully Launched into Background\n", me.version); printf ("PID: %i - Wrote to %s\n", forked, PID_FILENAME); } return EXIT_SUCCESS; /* parent exits */ @@ -215,7 +214,7 @@ main (int argc, char *argv[]) } } #endif - nlog (LOG_NOTICE, "NeoStats started (Version %s).", me.versionfull); + nlog (LOG_NOTICE, "NeoStats \"%s\" started.", NEOSTATS_VERSION); /* Load modules after we fork. This fixes the load->fork-exit->call _fini problems when we fork */ @@ -238,31 +237,34 @@ static int get_options (int argc, char **argv) { int c; - int dbg; + int level; /* set some defaults first */ #ifdef DEBUG - config.debug = 10; + config.loglevel = LOG_INFO; + config.debuglevel = DEBUG10; config.foreground = 1; #else - config.debug = 5; + config.loglevel = LOG_NORMAL; + config.debuglevel = 0; config.foreground = 0; #endif - while ((c = getopt (argc, argv, "hvrd:nqf")) != -1) { + while ((c = getopt (argc, argv, "hvrd:l:nqf")) != -1) { switch (c) { case 'h': printf ("NeoStats: Usage: \"neostats [options]\"\n"); printf (" -h (Show this screen)\n"); printf (" -v (Show version number)\n"); printf (" -r (Enable recv.log)\n"); - printf (" -d 1-10 (Enable debugging output 1= lowest, 10 = highest)\n"); + printf (" -d 1-10 (Debug log output level 1= lowest, 10 = highest)\n"); + printf (" -l 1-10 (Log output level 1= lowest, 6 = highest)\n"); printf (" -n (Do not load any modules on startup)\n"); printf (" -q (Quiet start - for cron scripts)\n"); printf (" -f (Do not fork into background\n"); return NS_FAILURE; case 'v': - printf ("NeoStats Version %s\n", me.versionfull); + printf ("NeoStats Version %s\n", me.version); printf ("Compiled: %s at %s\n", ns_module_info.build_date, ns_module_info.build_time); printf ("Flag after version number indicates what IRCd NeoStats is compiled for:\n"); printf ("(U31)- Unreal 3.1.x IRCd\n"); @@ -279,22 +281,31 @@ get_options (int argc, char **argv) printf ("\nNeoStats: http://www.neostats.net\n"); return NS_FAILURE; case 'r': - printf ("recv.log enabled. Watch your DiskSpace\n"); + printf ("recv.log enabled. Watch your disk space\n"); config.recvlog = 1; break; + case 'd': + printf ("debug.log enabled. Watch your disk space\n"); + level = atoi (optarg); + if ((level > DEBUGMAX - 1) || (level < 1)) { + printf ("Invalid debug level %d\n", level); + return NS_FAILURE; + } + config.debuglevel = level; + break; case 'n': config.modnoload = 1; break; case 'q': config.quiet = 1; break; - case 'd': - dbg = atoi (optarg); - if ((dbg > 10) || (dbg < 1)) { - printf ("Invalid Debug Level %d\n", dbg); + case 'l': + level = atoi (optarg); + if ((level > LOG_LEVELMAX - 1) || (level < 1)) { + printf ("Invalid level %d\n", level); return NS_FAILURE; } - config.debug = dbg; + config.loglevel = level; break; case 'f': config.foreground = 1; @@ -348,6 +359,7 @@ do_exit (NS_EXIT_TYPE exitcode, char* quitmsg) sleep(1); /* now free up the users and servers memory */ FiniUsers(); + FiniChannels(); FiniServers(); FiniBans(); FiniDns(); diff --git a/src/modules.c b/src/modules.c index 4aba24ac..8481cbbd 100644 --- a/src/modules.c +++ b/src/modules.c @@ -34,6 +34,8 @@ * */ static Module *ModList[NUM_MODULES]; +Module* RunModule[10]; +int RunLevel = 0; int del_all_bot_cmds(Bot* bot_ptr); @@ -78,7 +80,7 @@ void *display_module_builddate (void *tbl, char *col, char *sql, void *row) void *display_core_info (void *tbl, char *col, char *sql, void *row) { - ircsnprintf(sqlbuf, BUFSIZE, "%s", me.versionfull); + ircsnprintf(sqlbuf, BUFSIZE, "%s", me.version); return sqlbuf; } @@ -167,8 +169,10 @@ InitModules () { SET_SEGV_LOCATION(); mh = hash_create (NUM_MODULES, 0, 0); - if(!mh) + if(!mh) { + nlog (LOG_CRITICAL, "Unable to create module hash"); return NS_FAILURE; + } #ifdef SQLSRV /* add the module hash to the sql library */ @@ -211,9 +215,9 @@ SendModuleEvent (Event event, CmdParams* cmdparams, Bot* bot) nlog (LOG_DEBUG1, "Running module %s with event %d", module_ptr->info->name, event); SET_SEGV_LOCATION(); if (setjmp (sigvbuf) == 0) { - SET_SEGV_INMODULE(module_ptr->info->name); + SET_RUN_LEVEL(module_ptr); ev_list->function (cmdparams); - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); } else { nlog (LOG_CRITICAL, "setjmp() Failed, Can't call Module %s\n", module_ptr->info->name); } @@ -254,9 +258,9 @@ SendAllModuleEvent (Event event, CmdParams* cmdparams) nlog (LOG_DEBUG1, "Running module %s with event %d", module_ptr->info->name, event); SET_SEGV_LOCATION(); if (setjmp (sigvbuf) == 0) { - SET_SEGV_INMODULE(module_ptr->info->name); + SET_RUN_LEVEL(module_ptr); ev_list->function (cmdparams); - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); } else { nlog (LOG_CRITICAL, "setjmp() Failed, Can't call Module %s\n", module_ptr->info->name); } @@ -415,14 +419,14 @@ load_module (char *modfilename, User * u) } else { int err; SET_SEGV_LOCATION(); - SET_SEGV_INMODULE(mod_ptr->info->name); + SET_RUN_LEVEL(mod_ptr); err = (*ModInit) (mod_ptr); if (err < 1) { nlog (LOG_NORMAL, "Unable to load module: %s. See %s.log for further information.", mod_ptr->info->name, mod_ptr->info->name); unload_module(mod_ptr->info->name, NULL); return NULL; } - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); SET_SEGV_LOCATION(); } @@ -432,9 +436,9 @@ load_module (char *modfilename, User * u) if (event_ptr->event == EVENT_ONLINE) { AddStringToList (&av, me.s->name, &ac); SET_SEGV_LOCATION(); - SET_SEGV_INMODULE(mod_ptr->info->name); + SET_RUN_LEVEL(mod_ptr); event_ptr->function (NULL); - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); SET_SEGV_LOCATION(); free (av); break; @@ -449,72 +453,6 @@ load_module (char *modfilename, User * u) return mod_ptr; } -/** @brief - * - * @param - * - * @return - */ -int -get_dl_handle (const char *mod_name) -{ - Module *mod_ptr; - hnode_t *mn; - - mn = hash_lookup (mh, mod_name); - if (mn) { - mod_ptr = hnode_get (mn); - return (int) mod_ptr->dl_handle; - } - return 0; -} - -/** @brief - * - * @param - * - * @return - */ -int -get_mod_num (const char *mod_name) -{ - int i; - - for (i = 0; i < NUM_MODULES; i++) { - if (ModList[i] != NULL) { - if (!ircstrcasecmp (ModList[i]->info->name, mod_name)) { - return i; - } - } - } - /* if we get here, it wasn't found */ - nlog (LOG_DEBUG1, "get_mod_num: can't find %s in module number list", mod_name); - return NS_FAILURE; -} - -/** @brief - * - * @param - * - * @return - */ -Module * -get_mod_ptr (const char *mod_name) -{ - int i; - - for (i = 0; i < NUM_MODULES; i++) { - if (ModList[i] != NULL) { - if (!ircstrcasecmp (ModList[i]->info->name, mod_name)) { - return ModList[i]; - } - } - } - /* if we get here, it wasn't found */ - nlog (LOG_DEBUG1, "get_mod_ptr: can't find %s in module number list", mod_name); - return NULL; -} - /** @brief * * @param @@ -534,7 +472,7 @@ list_modules (CmdParams* cmdparams) mod_ptr = hnode_get (mn); prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "Module: %s (%s)", mod_ptr->info->name, mod_ptr->info->version); prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "Module Description: %s", mod_ptr->info->description); - prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "Module Number: %d", get_mod_num (mod_ptr->info->name)); + prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "Module Number: %d", mod_ptr->modnum); } prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "End of Module List"); return 0; @@ -564,11 +502,11 @@ unload_module (const char *modname, User * u) } return NS_FAILURE; } - i = get_mod_num (modname); mod_ptr = hnode_get (modnode); + i = mod_ptr->modnum; chanalert (ns_botptr->nick, "Unloading module %s", modname); /* canx any DNS queries used by this module */ - canx_dns (modname); + canx_dns (mod_ptr); /* Delete any timers used by this module */ del_timers (mod_ptr); /* Delete any sockets used by this module */ @@ -582,9 +520,9 @@ unload_module (const char *modname, User * u) /* call ModFini (replacement for library __fini() call */ ModFini = ns_dlsym ((int *) mod_ptr->dl_handle, "ModFini"); if (ModFini) { - SET_SEGV_INMODULE(modname); + SET_RUN_LEVEL(mod_ptr); (*ModFini) (); - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); } /* Delete any bots used by this module. Done after ModFini, so the bot * can still send messages during ModFini @@ -592,11 +530,11 @@ unload_module (const char *modname, User * u) del_bots (mod_ptr); hnode_destroy (modnode); /* Close module */ - SET_SEGV_INMODULE(modname); + SET_RUN_LEVEL(mod_ptr); #ifndef VALGRIND ns_dlclose (mod_ptr->dl_handle); #endif - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); /* free the module number */ if (i >= 0) { nlog (LOG_DEBUG1, "Free %d from Module Numbers", i); @@ -635,11 +573,11 @@ void unload_modules(void) * @return */ int -ModuleConfig(Module* moduleptr, bot_setting* set_ptr) +ModuleConfig(bot_setting* set_ptr) { char *temp = NULL; - SET_SEGV_INMODULE(moduleptr->info->name); + SET_SEGV_LOCATION(); while(set_ptr->option) { switch(set_ptr->type) { @@ -681,6 +619,5 @@ ModuleConfig(Module* moduleptr, bot_setting* set_ptr) } set_ptr++; } - CLEAR_SEGV_INMODULE(); return NS_SUCCESS; } diff --git a/src/modules.h b/src/modules.h index 1feef867..232fcec1 100644 --- a/src/modules.h +++ b/src/modules.h @@ -28,16 +28,12 @@ extern jmp_buf sigvbuf; int InitModules (void); int FiniModules (void); -void SendAllModuleEvent (Event event, CmdParams* cmdparams); -void SendModuleEvent (Event event, CmdParams* cmdparams, Bot* bot); Module *load_module (char *path, User * u); int unload_module (const char *module_name, User * u); -int list_modules (CmdParams* cmdparams); -int get_dl_handle (const char *mod_name); -int get_mod_num (const char *mod_name); -Module *get_mod_ptr (const char *mod_name); void unload_modules(void); - +int list_modules (CmdParams* cmdparams); void ModulesVersion (const char* nick, const char *remoteserver); +void SendAllModuleEvent (Event event, CmdParams* cmdparams); +void SendModuleEvent (Event event, CmdParams* cmdparams, Bot* bot); #endif /* _MODULES_H_ */ diff --git a/src/modules/connectserv/cs.c b/src/modules/connectserv/cs.c index 6b2ecdaa..1a3a33f4 100644 --- a/src/modules/connectserv/cs.c +++ b/src/modules/connectserv/cs.c @@ -110,7 +110,7 @@ static Module* cs_module; ModuleInfo module_info = { "ConnectServ", - "Connection monitoring service", + "Connection monitoring service", ns_copyright, cs_about, NEOSTATS_VERSION, @@ -132,7 +132,7 @@ static bot_setting cs_settings[]= {"ALTNICK", &cs_botinfo.altnick,SET_TYPE_NICK, 0, MAXNICK, NS_ULEVEL_ADMIN, "AltNick", NULL, ns_help_set_altnick, NULL, (void*)"ConnectServ" }, {"USER", &cs_botinfo.user, SET_TYPE_USER, 0, MAXUSER, NS_ULEVEL_ADMIN, "User", NULL, ns_help_set_user, NULL, (void*)"CS" }, {"HOST", &cs_botinfo.host, SET_TYPE_HOST, 0, MAXHOST, NS_ULEVEL_ADMIN, "Host", NULL, ns_help_set_host, NULL, (void*)"" }, - {"REALNAME", &cs_botinfo.realname,SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname, NULL, (void*)"" }, + {"REALNAME", &cs_botinfo.realname,SET_TYPE_REALNAME, 0, MAXREALNAME, NS_ULEVEL_ADMIN, "RealName",NULL, ns_help_set_realname, NULL, (void*)"Connection monitoring service" }, {"SIGNWATCH", &cs_cfg.sign_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "SignWatch", NULL, cs_help_set_signwatch, NULL, (void*)1 }, {"KILLWATCH", &cs_cfg.kill_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "KillWatch", NULL, cs_help_set_killwatch, NULL, (void*)1 }, {"MODEWATCH", &cs_cfg.mode_watch, SET_TYPE_BOOLEAN, 0, 0, NS_ULEVEL_ADMIN, "ModeWatch", NULL, cs_help_set_modewatch, NULL, (void*)1 }, @@ -160,7 +160,7 @@ ModuleEvent module_events[] = { int ModInit(Module* mod_ptr) { cs_module = mod_ptr; - ModuleConfig(cs_module, cs_settings); + ModuleConfig(cs_settings); return 1; } @@ -171,8 +171,8 @@ void ModFini() static int cs_event_online(CmdParams* cmdparams) { - cs_bot = init_bot (cs_module, &cs_botinfo, services_bot_modes, BOT_FLAG_RESTRICT_OPERS|BOT_FLAG_DEAF, - cs_commands, cs_settings); + cs_bot = init_bot (&cs_botinfo, services_bot_modes, + BOT_FLAG_RESTRICT_OPERS|BOT_FLAG_DEAF, cs_commands, cs_settings); cs_online = 1; return 1; }; diff --git a/src/modules/hostserv/hostserv.c b/src/modules/hostserv/hostserv.c index 234e5d3d..4c665031 100644 --- a/src/modules/hostserv/hostserv.c +++ b/src/modules/hostserv/hostserv.c @@ -242,9 +242,9 @@ static int hs_event_signon(CmdParams* cmdparams) static int hs_event_online(CmdParams* cmdparams) { - hs_bot = init_bot(hs_module, &hs_botinfo, services_bot_modes, BOT_FLAG_DEAF, + hs_bot = init_bot(&hs_botinfo, services_bot_modes, BOT_FLAG_DEAF, hs_commands, hs_settings); - add_timer (hs_module, CleanupHosts, "CleanupHosts", 7200); + add_timer (CleanupHosts, "CleanupHosts", 7200); LoadHosts(); return 1; }; @@ -268,7 +268,7 @@ int ModInit(Module* mod_ptr) nlog(LOG_CRITICAL, "Error, can't create vhosts hash"); return -1; } - ModuleConfig(hs_module, hs_settings); + ModuleConfig(hs_settings); LoadConfig(); return 1; } diff --git a/src/modules/loveserv/loveserv.c b/src/modules/loveserv/loveserv.c index 3a417d40..babbe021 100644 --- a/src/modules/loveserv/loveserv.c +++ b/src/modules/loveserv/loveserv.c @@ -31,14 +31,13 @@ static int ls_kiss(CmdParams* cmdparams); static int ls_tonsil(CmdParams* cmdparams); static int ls_hug(CmdParams* cmdparams); static int ls_admirer(CmdParams* cmdparams); -static int ls_choco(CmdParams* cmdparams); +static int ls_chocolate(CmdParams* cmdparams); static int ls_candy(CmdParams* cmdparams); static int ls_lovenote(CmdParams* cmdparams); static int ls_apology(CmdParams* cmdparams); static int ls_thankyou(CmdParams* cmdparams); static Bot *ls_bot; -static Module* ls_module; ModuleInfo module_info = { "LoveServ", @@ -69,7 +68,7 @@ static bot_cmd ls_commands[]= {"TONSIL", ls_tonsil, 1, 0, ls_help_tonsil, ls_help_tonsil_oneline }, {"HUG", ls_hug, 1, 0, ls_help_hug, ls_help_hug_oneline }, {"ADMIRER", ls_admirer, 1, 0, ls_help_admirer, ls_help_admirer_oneline }, - {"CHOCOLATE", ls_choco, 1, 0, ls_help_chocolate, ls_help_chocolate_oneline }, + {"CHOCOLATE", ls_chocolate, 1, 0, ls_help_chocolate, ls_help_chocolate_oneline }, {"CANDY", ls_candy, 1, 0, ls_help_candy, ls_help_candy_oneline }, {"LOVENOTE", ls_lovenote, 2, 0, ls_help_lovenote, ls_help_lovenote_oneline }, {"APOLOGY", ls_apology, 2, 0, ls_help_apology, ls_help_apology_oneline }, @@ -88,7 +87,8 @@ static bot_setting ls_settings[]= static int ls_event_online(CmdParams* cmdparams) { - ls_bot = init_bot(ls_module, &ls_botinfo, services_bot_modes, BOT_FLAG_DEAF, ls_commands, ls_settings); + ls_bot = init_bot(&ls_botinfo, services_bot_modes, + BOT_FLAG_DEAF, ls_commands, ls_settings); return 1; }; @@ -99,7 +99,7 @@ ModuleEvent module_events[] = { int ModInit(Module* mod_ptr) { - ModuleConfig(ls_module, ls_settings); + ModuleConfig(ls_settings); return 1; } @@ -116,8 +116,8 @@ static int ls_rose(CmdParams* cmdparams) if(!is_target_valid(ls_bot->nick, cmdparams->source.user, target_nick)) { return 0; } - prefmsg(cmdparams->source.user->nick, ls_bot->nick, "Your rose has been sent to %s!", - target_nick); + prefmsg(cmdparams->source.user->nick, ls_bot->nick, + "Rose has been sent to %s", target_nick); prefmsg(target_nick, ls_bot->nick, "%s has sent you this beautiful rose! 3--<--<--<{4@", cmdparams->source.user->nick); @@ -133,7 +133,8 @@ static int ls_kiss(CmdParams* cmdparams) if(!is_target_valid(ls_bot->nick, cmdparams->source.user, target_nick)) { return 0; } - prefmsg(cmdparams->source.user->nick, ls_bot->nick, "You have virtually kissed %s!", target_nick); + prefmsg(cmdparams->source.user->nick, ls_bot->nick, + "You have virtually kissed %s", target_nick); prefmsg(target_nick, ls_bot->nick, "%s has virtually kissed you!", cmdparams->source.user->nick); return 1; } @@ -148,7 +149,7 @@ static int ls_tonsil(CmdParams* cmdparams) return 0; } prefmsg(cmdparams->source.user->nick, ls_bot->nick, - "You have virtually tonsilly kissed %s!", target_nick); + "You have virtually tonsil kissed %s", target_nick); prefmsg(target_nick, ls_bot->nick, "%s would like to send a SLoW..LoNG..DeeP..PeNeTRaTiNG..ToNSiL-TiCKLiNG.. HaiR STRaiGHTeNiNG..Toe-CuRLiNG..NeRVe-JaNGLiNG..LiFe-aLTeRiNG.. FaNTaSY-CauSiNG..i JuST SaW GoD!..GoSH, DiD MY CLoTHeS FaLL oFF?.. YeS, i'M GLaD i CaMe oN iRC..KiSS oN Da LiPS!!!", cmdparams->source.user->nick); @@ -164,7 +165,8 @@ static int ls_hug(CmdParams* cmdparams) if(!is_target_valid(ls_bot->nick, cmdparams->source.user, target_nick)) { return 0; } - prefmsg(cmdparams->source.user->nick, ls_bot->nick, "%s has received your hug! :)", target_nick); + prefmsg(cmdparams->source.user->nick, ls_bot->nick, + "You have hugged %s", target_nick); prefmsg(target_nick, ls_bot->nick, "%s has sent you a *BIG WARM HUG*!", cmdparams->source.user->nick); return 1; } @@ -178,12 +180,13 @@ static int ls_admirer(CmdParams* cmdparams) if(!is_target_valid(ls_bot->nick, cmdparams->source.user, target_nick)) { return 0; } - prefmsg(cmdparams->source.user->nick, ls_bot->nick, "Secret admirer sent to %s :)", target_nick); + prefmsg(cmdparams->source.user->nick, ls_bot->nick, + "Secret admirer sent to %s", target_nick); prefmsg(target_nick, ls_bot->nick, "You have a secret admirer! ;)"); return 1; } -static int ls_choco(CmdParams* cmdparams) +static int ls_chocolate(CmdParams* cmdparams) { char *target_nick; @@ -193,7 +196,7 @@ static int ls_choco(CmdParams* cmdparams) return 0; } prefmsg(cmdparams->source.user->nick, ls_bot->nick, - "A box of cholocates has been sent to %s :)", target_nick); + "Cholocates sent to %s", target_nick); prefmsg(target_nick, ls_bot->nick, "%s would like you to have this YUMMY box of chocolates!", cmdparams->source.user->nick); @@ -210,7 +213,7 @@ static int ls_candy(CmdParams* cmdparams) return 0; } prefmsg(cmdparams->source.user->nick, ls_bot->nick, - "A bag of yummy heart shaped candies has been sent to %s :)", target_nick); + "Candy sent to %s", target_nick); prefmsg(target_nick, ls_bot->nick, "%s would like you to have this big YUMMY bag of heart shaped candies!", cmdparams->source.user->nick); @@ -229,9 +232,10 @@ static int ls_lovenote(CmdParams* cmdparams) } message = joinbuf(cmdparams->av, cmdparams->ac, 1); prefmsg(cmdparams->source.user->nick, ls_bot->nick, - "Your lovenote to %s has been sent! :)", target_nick); + "Love note sent to %s", target_nick); prefmsg(target_nick, ls_bot->nick, - "%s has sent you a LoveNote which reads: \2%s\2", cmdparams->source.user->nick, message); + "%s has sent you a love note which reads: \2%s\2", + cmdparams->source.user->nick, message); free(message); return 1; } @@ -247,8 +251,8 @@ static int ls_apology(CmdParams* cmdparams) return 0; } message = joinbuf(cmdparams->av, cmdparams->ac, 1); - prefmsg(cmdparams->source.user->nick, ls_bot->nick, "Your apology has been sent to %s", - target_nick); + prefmsg(cmdparams->source.user->nick, ls_bot->nick, + "Apology sent to %s", target_nick); prefmsg(target_nick, ls_bot->nick, "%s is sorry, and would like to apologise for \2%s\2", cmdparams->source.user->nick, message); @@ -267,8 +271,8 @@ static int ls_thankyou(CmdParams* cmdparams) return 0; } message = joinbuf(cmdparams->av, cmdparams->ac, 1); - prefmsg(cmdparams->source.user->nick, ls_bot->nick, "Your Thank You has been sent to %s", - target_nick); + prefmsg(cmdparams->source.user->nick, ls_bot->nick, + "Thank you sent to %s", target_nick); prefmsg(target_nick, ls_bot->nick, "%s wishes to thank you for \2%s\2", cmdparams->source.user->nick, message); free(message); diff --git a/src/modules/moraleserv/ms.c b/src/modules/moraleserv/ms.c index 6e53897c..5dc7a064 100644 --- a/src/modules/moraleserv/ms.c +++ b/src/modules/moraleserv/ms.c @@ -35,7 +35,6 @@ static BotInfo ms_botinfo = "", "Network morale service", }; -static Module* ms_module; static int ms_hail(CmdParams* cmdparams); static int ms_ode(CmdParams* cmdparams); @@ -61,14 +60,14 @@ ModuleInfo module_info = { static bot_cmd ms_commands[]= { - {"HAIL", ms_hail, 2, 0, ms_help_hail, ms_help_hail_oneline }, - {"ODE", ms_ode, 2, 0, ms_help_ode, ms_help_ode_oneline }, {"LAPDANCE", ms_lapdance, 1, 0, ms_help_lapdance, ms_help_lapdance_oneline }, - {"POEM", ms_poem, 2, 0, ms_help_poem, ms_help_poem_oneline }, {"REDNECK", ms_redneck, 1, 0, ms_help_redneck, ms_help_redneck_oneline }, {"CHEERUP", ms_cheerup, 1, 0, ms_help_cheerup, ms_help_cheerup_oneline }, {"BEHAPPY", ms_behappy, 1, 0, ms_help_behappy, ms_help_behappy_oneline }, {"WONDERFUL", ms_wonderful, 1, 0, ms_help_wonderful, ms_help_wonderful_oneline }, + {"HAIL", ms_hail, 2, 0, ms_help_hail, ms_help_hail_oneline }, + {"ODE", ms_ode, 2, 0, ms_help_ode, ms_help_ode_oneline }, + {"POEM", ms_poem, 2, 0, ms_help_poem, ms_help_poem_oneline }, {NULL, NULL, 0, 0, NULL, NULL} }; @@ -83,7 +82,8 @@ static bot_setting ms_settings[]= static int ms_event_online(CmdParams* cmdparams) { - ms_bot = init_bot (ms_module, &ms_botinfo, services_bot_modes, BOT_FLAG_DEAF, ms_commands, ms_settings); + ms_bot = init_bot (&ms_botinfo, services_bot_modes, + BOT_FLAG_DEAF, ms_commands, ms_settings); return 1; }; @@ -94,7 +94,7 @@ ModuleEvent module_events[] = { int ModInit(Module* mod_ptr) { - ModuleConfig(ms_module, ms_settings); + ModuleConfig(ms_settings); return 1; } @@ -133,6 +133,8 @@ static int ms_lapdance(CmdParams* cmdparams) if(!is_target_valid(ms_bot->nick, cmdparams->source.user, target_nick)) { return 0; } + prefmsg(cmdparams->source.user->nick, ms_bot->nick, + "Lap dance sent to %s!", target_nick); prefmsg(target_nick, ms_bot->nick, "*%s Seductively walks up to %s and gives %s a sly look*", ms_bot->nick, target_nick, target_nick); @@ -157,7 +159,7 @@ static int ms_ode(CmdParams* cmdparams) return 0; } prefmsg(cmdparams->source.user->nick, ms_bot->nick, - "Your ODE to %s has been sent to %s!", about_nick, target_nick); + "Ode to %s sent to %s!", about_nick, target_nick); prefmsg(target_nick, ms_bot->nick, "Courtesy of your friend %s:", cmdparams->source.user->nick); prefmsg(target_nick, ms_bot->nick, "*recites*"); prefmsg(target_nick, ms_bot->nick, "How I wish to be a %s,", about_nick); @@ -181,7 +183,7 @@ static int ms_poem(CmdParams* cmdparams) return 0; } prefmsg(cmdparams->source.user->nick, ms_bot->nick, - "Your POEM about %s has been sent to %s!", about_nick, target_nick); + "Poem about %s sent to %s!", about_nick, target_nick); prefmsg(target_nick, ms_bot->nick, "Courtesy of your friend %s:", cmdparams->source.user->nick); prefmsg(target_nick, ms_bot->nick, "*recites*"); prefmsg(target_nick, ms_bot->nick, "I wish I was a %s,", about_nick); @@ -203,7 +205,7 @@ static int ms_redneck(CmdParams* cmdparams) return 0; } prefmsg(cmdparams->source.user->nick, ms_bot->nick, - "Your redneck message has been sent to %s!", target_nick); + "Redneck message sent to %s!", target_nick); prefmsg(target_nick, ms_bot->nick, "Courtesy of your friend %s:", cmdparams->source.user->nick); prefmsg(target_nick, ms_bot->nick, "*recites*"); prefmsg(target_nick, ms_bot->nick, @@ -237,6 +239,8 @@ static int ms_behappy(CmdParams* cmdparams) if(!is_target_valid(ms_bot->nick, cmdparams->source.user, target_nick)) { return 0; } + prefmsg(cmdparams->source.user->nick, ms_bot->nick, + "Behappy sent to %s!", target_nick); prefmsg(target_nick, ms_bot->nick, "%s thinks that you're a little sad.....", cmdparams->source.user->nick); prefmsg(target_nick, ms_bot->nick, "*starts singing*"); @@ -291,7 +295,10 @@ static int ms_wonderful(CmdParams* cmdparams) if(!is_target_valid(ms_bot->nick, cmdparams->source.user, target_nick)) { return 0; } - prefmsg(target_nick, ms_bot->nick, "Courtesy of your friend %s:", cmdparams->source.user->nick); + prefmsg(cmdparams->source.user->nick, ms_bot->nick, + "wonderful sent to %s!", target_nick); + prefmsg(target_nick, ms_bot->nick, "Courtesy of your friend %s:", + cmdparams->source.user->nick); prefmsg(target_nick, ms_bot->nick, "*starts singing*"); prefmsg(target_nick, ms_bot->nick, "So excuse me forgetting but these things I do"); diff --git a/src/modules/statserv/database.c b/src/modules/statserv/database.c index 050007ce..4baec799 100644 --- a/src/modules/statserv/database.c +++ b/src/modules/statserv/database.c @@ -4,8 +4,6 @@ ** ** Portions Copyright (c) 2000-2001 ^Enigma^ ** -** Portions Copyright (c) 1999 Johnathan George net@lite.net -** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or @@ -27,39 +25,19 @@ #include "statserv.h" -/* define this if you want the old database format.... but beware, its slow */ -#undef OLDDATABASE - - -int SaveStats() +void SaveServerStats(void) { SStats *s; - CStats *c; hnode_t *sn; - lnode_t *cn; hscan_t ss; - int count, limit; - SET_SEGV_LOCATION(); - if (StatServ.newdb == 1) { - chanalert(ss_bot->nick, "Enabling Record yelling!"); - StatServ.newdb = 0; - } - - if (StatServ.shutdown == 1) { - chanalert(ss_bot->nick, "Saving StatServ Database. this *could* take a while"); - } - /* first thing we do is clear the old database */ + /* clear the old database */ DelTable("ServerStats"); - //DelTable("ChanStats"); - DelTable("NetStats"); - - /* ok, run through the server stats, and save them */ + /* run through stats and save them */ hash_scan_begin(&ss, Shead); while ((sn = hash_scan_next(&ss))) { s = hnode_get(sn); - nlog(LOG_DEBUG1, - "Writing statistics to database for %s", s->name); + nlog(LOG_DEBUG1, "Writing statistics to database for %s", s->name); SetData((void *)s->numsplits, CFGINT, "ServerStats", s->name, "Splits"); SetData((void *)s->maxusers, CFGINT, "ServerStats", s->name, "MaxUsers"); SetData((void *)s->t_maxusers, CFGINT, "ServerStats", s->name, "MaxUsersTime"); @@ -70,19 +48,32 @@ int SaveStats() SetData((void *)s->totusers, CFGINT, "ServerStats", s->name, "TotalUsers"); SetData((void *)s->maxopers, CFGINT, "ServerStats", s->name, "MaxOpers"); SetData((void *)s->t_maxopers, CFGINT, "ServerStats", s->name, "MaxOpersTime"); - if (StatServ.shutdown == 1) { - free(s); - hash_scan_delete(Shead, sn); - hnode_destroy(sn); - } - - } - if (StatServ.shutdown == 1) { - hash_destroy(Shead); } +} + +void SaveNetworkStats(void) +{ + /* clear the old database */ + DelTable("NetStats"); + /* run through stats and save them */ + SetData((void *)stats_network.maxopers, CFGINT, "NetStats", "Global", "MaxOpers"); + SetData((void *)stats_network.maxusers, CFGINT, "NetStats", "Global", "MaxUsers"); + SetData((void *)stats_network.maxservers, CFGINT, "NetStats", "Global", "MaxServers"); + SetData((void *)stats_network.t_maxopers, CFGINT, "NetStats", "Global", "MaxOpersTime"); + SetData((void *)stats_network.t_maxusers, CFGINT, "NetStats", "Global", "MaxUsersTime"); + SetData((void *)stats_network.t_maxservers, CFGINT, "NetStats", "Global", "MaxServersTime"); + SetData((void *)stats_network.totusers, CFGINT, "NetStats", "Global", "TotalUsers"); + SetData((void *)stats_network.maxchans, CFGINT, "NetStats", "Global", "MaxChans"); + SetData((void *)stats_network.t_chans, CFGINT, "NetStats", "Global", "MaxChansTime"); +} + +void SaveChanStats(void) +{ + CStats *c; + lnode_t *cn; + int limit; + int count = 0; - /* ok, Now Channel Stats */ - count = 0; /* we want to only do 25% each progressive save */ limit = (list_count(Chead)/4); cn = list_first(Chead); @@ -100,54 +91,25 @@ int SaveStats() } count++; } -/* we need to squeze as much performance out of this as we can */ -#if 0 - nlog(LOG_DEBUG1, - "Writting Statistics to database for %s (%d)", c->name, count); -#endif save_chan(c); - /* if we are shuting down, clean up */ - if (StatServ.shutdown == 1) { - free(c); - } cn = list_next(Chead, cn); } - if (StatServ.shutdown == 1) { - list_destroy_nodes(Chead); - } +} - /* and finally, the network data */ - - SetData((void *)stats_network.maxopers, CFGINT, "NetStats", "Global", "MaxOpers"); - SetData((void *)stats_network.maxusers, CFGINT, "NetStats", "Global", "MaxUsers"); - SetData((void *)stats_network.maxservers, CFGINT, "NetStats", "Global", "MaxServers"); - SetData((void *)stats_network.t_maxopers, CFGINT, "NetStats", "Global", "MaxOpersTime"); - SetData((void *)stats_network.t_maxusers, CFGINT, "NetStats", "Global", "MaxUsersTime"); - SetData((void *)stats_network.t_maxservers, CFGINT, "NetStats", "Global", "MaxServersTime"); - SetData((void *)stats_network.totusers, CFGINT, "NetStats", "Global", "TotalUsers"); - SetData((void *)stats_network.maxchans, CFGINT, "NetStats", "Global", "MaxChans"); - SetData((void *)stats_network.t_chans, CFGINT, "NetStats", "Global", "MaxChansTime"); - if (StatServ.shutdown == 1) { - chanalert(ss_bot->nick, "Done"); - } +int SaveStats(void) +{ + SET_SEGV_LOCATION(); + SaveServerStats(); + SaveChanStats(); + SaveNetworkStats(); return 1; } -void LoadStats() { - SStats *s; - char **row; - - hnode_t *sn; - int count; - - SET_SEGV_LOCATION(); - Chead = list_create(SS_CHAN_SIZE); - Shead = hash_create(S_TABLE_SIZE, 0, 0); - +int LoadNetworkStats(void) +{ if (GetData ((void *) &stats_network.maxopers, CFGINT, "NetStats", "Global", "MaxOpers") <= 0) { - return; + return 0; } - /* the rest don't need such valid checking */ GetData((void *)&stats_network.maxusers, CFGINT, "NetStats", "Global", "MaxUsers"); GetData((void *)&stats_network.maxservers, CFGINT, "NetStats", "Global", "MaxServers"); GetData((void *)&stats_network.t_maxopers, CFGINT, "NetStats", "Global", "MaxOpersTime"); @@ -156,13 +118,18 @@ void LoadStats() { GetData((void *)&stats_network.totusers, CFGINT, "NetStats", "Global", "TotalUsers"); GetData((void *)&stats_network.maxchans, CFGINT, "NetStats", "Global", "MaxChans"); GetData((void *)&stats_network.t_chans, CFGINT, "NetStats", "Global", "MaxChansTime"); + return 1; +} - - /* ok, now load the server stats */ +void LoadServerStats(void) +{ + SStats *s; + char **row; + hnode_t *sn; + int count; if (GetTableData("ServerStats", &row) > 0) { for (count = 0; row[count] != NULL; count++) { - s = malloc(sizeof(SStats)); - bzero(s, sizeof(SStats)); + s = scalloc(sizeof(SStats)); strlcpy(s->name, row[count], MAXHOST); GetData((void *)&s->numsplits, CFGINT, "ServerStats", s->name, "Splits"); GetData((void *)&s->maxusers, CFGINT, "ServerStats", s->name, "MaxUsers"); @@ -178,63 +145,24 @@ void LoadStats() { s->opers = 0; s->daily_totusers = 0; s->lowest_ping = s->highest_ping = s->daily_totusers = 0; - - nlog(LOG_DEBUG1, - "LoadStats(): Loaded statistics for %s", s->name); + nlog(LOG_DEBUG1, "Loaded statistics for %s", s->name); sn = hnode_create(s); if (hash_isfull(Shead)) { - nlog(LOG_CRITICAL, - "Eeek, StatServ Server Hash is Full!"); + nlog(LOG_CRITICAL, "StatServ server hash full"); } else { hash_insert(Shead, sn, s->name); } } } free(row); -/* we now load channel data dynamically. */ - /* ok, and now the channel stats. */ -#if 0 - if (GetTableData("ChanStats", &row) > 0) { - for (count = 0; row[count] != NULL; count++) { - load_chan(row[count]); - } - } - c = malloc(sizeof(CStats)); - strlcpy(c->name, row[count], CHANLEN); - GetData((void *)&c->topics, CFGINT, "ChanStats", c->name, "Topics"); - GetData((void *)&c->totmem, CFGINT, "ChanStats", c->name, "TotalMems"); - GetData((void *)&c->kicks, CFGINT, "ChanStats", c->name, "Kicks"); - GetData((void *)&c->lastseen, CFGINT, "ChanStats", c->name, "LastSeen"); - GetData((void *)&c->maxmems, CFGINT, "ChanStats", c->name, "MaxMems"); - GetData((void *)&c->t_maxmems, CFGINT, "ChanStats", c->name, "MaxMemsTime"); - GetData((void *)&c->maxkicks, CFGINT, "ChanStats", c->name, "MaxKicks"); - GetData((void *)&c->t_maxkicks, CFGINT, "ChanStats", c->name, "MaxKicksTime"); - GetData((void *)&c->maxjoins, CFGINT, "ChanStats", c->name, "MaxJoins"); - GetData((void *)&c->t_maxjoins, CFGINT, "ChanStats", c->name, "MaxJoinsTime"); - c->topicstoday = 0; - c->joinstoday = 0; - c->members = 0; - cn = lnode_create(c); - if (list_isfull(Chead)) { - nlog(LOG_CRITICAL, - "Eeek, StatServ Channel Hash is Full!"); - } else { - nlog(LOG_DEBUG2, - "Loading %s Channel Data", c->name); - if ((me.now - c->lastseen) < 604800) { - list_append(Chead, cn); - } else { - nlog(LOG_DEBUG1, - "Deleting Old Channel %s", c->name); - lnode_destroy(cn); - free(c); - } - } - } - } - free(row); -#endif - StatServ.newdb = 0; +} + +void LoadStats(void) +{ + SET_SEGV_LOCATION(); + if(LoadNetworkStats() == 0) + return; + LoadServerStats(); } /* @brief load the info for a specific channel from the database @@ -245,13 +173,12 @@ void LoadStats() { * @returns a CStats struct that contains info for the channel. If its a new Channel, contains the name and thats it. */ -CStats *load_chan(char *name) { +CStats *load_chan(char *name) +{ lnode_t *cn; char *data; - CStats *c; - SET_SEGV_LOCATION(); c = malloc(sizeof(CStats)); #ifdef USE_BERKELEY @@ -260,22 +187,9 @@ CStats *load_chan(char *name) { #else strlcpy(c->name, name, CHANLEN); if (GetData((void *)&data, CFGSTR, "ChanStats", c->name, "ChanData") > 0) { - /* its the new database format... Good */ sscanf(data, "%ld %ld %ld %ld %ld %ld %ld %ld %ld", &c->topics, &c->totmem, &c->kicks, &c->maxmems, &c->t_maxmems, &c->maxkicks, &c->t_maxkicks, &c->maxjoins, &c->t_maxjoins); GetData((void *)&c->lastseen, CFGINT, "ChanStats", c->name, "LastSeen"); free(data); - } else if (GetData((void *)&c->topics, CFGINT, "ChanStats", c->name, "Topics") > 0) { - GetData((void *)&c->totmem, CFGINT, "ChanStats", c->name, "TotalMems"); - GetData((void *)&c->kicks, CFGINT, "ChanStats", c->name, "Kicks"); - GetData((void *)&c->lastseen, CFGINT, "ChanStats", c->name, "LastSeen"); - GetData((void *)&c->maxmems, CFGINT, "ChanStats", c->name, "MaxMems"); - GetData((void *)&c->t_maxmems, CFGINT, "ChanStats", c->name, "MaxMemsTime"); - GetData((void *)&c->maxkicks, CFGINT, "ChanStats", c->name, "MaxKicks"); - GetData((void *)&c->t_maxkicks, CFGINT, "ChanStats", c->name, "MaxKicksTime"); - GetData((void *)&c->maxjoins, CFGINT, "ChanStats", c->name, "MaxJoins"); - GetData((void *)&c->t_maxjoins, CFGINT, "ChanStats", c->name, "MaxJoinsTime"); - /* delete so when we save, we only save relevent information */ - DelRow("ChanStats", c->name); #endif } else { strlcpy(c->name, name, CHANLEN); @@ -298,12 +212,11 @@ CStats *load_chan(char *name) { c->lastsave = me.now; cn = lnode_create(c); if (list_isfull(Chead)) { - nlog(LOG_CRITICAL, "Eeek, StatServ Channel Hash is Full!"); + nlog(LOG_CRITICAL, "StatServ channel hash full"); } else { - nlog(LOG_DEBUG2, "Loading %s Channel Data", c->name); + nlog(LOG_DEBUG2, "Loading channel %s", c->name); if ((me.now - c->lastseen) > 604800) { - nlog(LOG_DEBUG1, - "Resetting Old Channel %s", c->name); + nlog(LOG_DEBUG1, "Reset old channel %s", c->name); c->totmem = 0; c->topics = 0; c->kicks = 0; @@ -334,8 +247,8 @@ CStats *load_chan(char *name) { * @returns nothing */ -void save_chan(CStats *c) { -#ifndef OLDDATABASE +void save_chan(CStats *c) +{ char data[BUFSIZE]; #ifdef USE_BERKELEY @@ -352,20 +265,6 @@ void save_chan(CStats *c) { /* we keep this seperate so we can easily delete old channels */ SetData((void *)c->lastseen, CFGINT, "ChanStats", c->name, "LastSeen"); #endif - -#else - SET_SEGV_LOCATION(); - SetData((void *)c->topics, CFGINT, "ChanStats", c->name, "Topics"); - SetData((void *)c->totmem, CFGINT, "ChanStats", c->name, "TotalMems"); - SetData((void *)c->kicks, CFGINT, "ChanStats", c->name, "Kicks"); - SetData((void *)c->lastseen, CFGINT, "ChanStats", c->name, "LastSeen"); - SetData((void *)c->maxmems, CFGINT, "ChanStats", c->name, "MaxMems"); - SetData((void *)c->t_maxmems, CFGINT, "ChanStats", c->name, "MaxMemsTime"); - SetData((void *)c->maxkicks, CFGINT, "ChanStats", c->name, "MaxKicks"); - SetData((void *)c->t_maxkicks, CFGINT, "ChanStats", c->name, "MaxKicksTime"); - SetData((void *)c->maxjoins, CFGINT, "ChanStats", c->name, "MaxJoins"); - SetData((void *)c->t_maxjoins, CFGINT, "ChanStats", c->name, "MaxJoinsTime"); -#endif c->lastsave = me.now; } @@ -377,7 +276,7 @@ void save_chan(CStats *c) { * @returns nothing */ -int DelOldChan() +int DelOldChan(void) { char **row; int count = 0; @@ -385,7 +284,7 @@ int DelOldChan() time_t start; start = time(NULL); - nlog(LOG_DEBUG1, "Starting To Clean Channel Database"); + nlog(LOG_DEBUG1, "Deleting old channels"); if (GetTableData("ChanStats", &row) > 0) { for (count = 0; row[count] != NULL; count++) { if (GetData((void *)&lastseen, CFGINT, "ChanStats", row[count], "LastSeen") > 0) { @@ -398,14 +297,12 @@ int DelOldChan() } } else { /* database corruption? */ - nlog(LOG_WARNING, "Hrm, Database Corruption for Channel %s?. Deleting Record", row[count]); + nlog(LOG_WARNING, "Channel %s corrpted: deleting record", row[count]); DelRow("ChanStats", row[count]); } } } free(row); - nlog(LOG_INFO, "Took %d seconds to clean %d channel stats", (int)(time(NULL) - start), count); + nlog(LOG_INFO, "DelOldChan: %d seconds %d channels", (int)(time(NULL) - start), count); return 1; } - - diff --git a/src/modules/statserv/htmlstats.c b/src/modules/statserv/htmlstats.c index 6e0b4a56..d5279f6b 100644 --- a/src/modules/statserv/htmlstats.c +++ b/src/modules/statserv/htmlstats.c @@ -61,7 +61,7 @@ int ss_html() if (StatServ.html) { if (StatServ.htmlpath[0] == 0) { nlog(LOG_WARNING, - "Can't do HTML Writout as html path is not defined"); + "Unable to write HTML: html path is not defined"); return 1; } } else { @@ -172,7 +172,7 @@ int ss_html() if (buf1) { startstr = strlen(buf) - strlen(buf1); fwrite(buf, startstr, 1, opf); - fputs(me.versionfull, opf); + fputs(me.version, opf); buf = buf1 + strlen("!VERSION!"); } buf1 = strstr(buf, "!TITLE!"); @@ -575,6 +575,7 @@ void get_chantops() void get_map(char *uplink, int level) { +#if 0 hscan_t hs; hnode_t *sn; Server *s; @@ -584,7 +585,7 @@ void get_map(char *uplink, int level) hash_scan_begin(&hs, sh); while ((sn = hash_scan_next(&hs))) { s = hnode_get(sn); - ss = findstats(s->name); + ss = findserverstats(s->name); if ((level == 0) && (strlen(s->uplink) <= 0)) { /* its the root server */ @@ -612,4 +613,5 @@ void get_map(char *uplink, int level) get_map(s->name, level + 1); } } +#endif } diff --git a/src/modules/statserv/m_stats.h b/src/modules/statserv/m_stats.h deleted file mode 100644 index 073e13df..00000000 --- a/src/modules/statserv/m_stats.h +++ /dev/null @@ -1,43 +0,0 @@ -/* NeoStats - IRC Statistical Services -** Copyright (c) 1999-2004 Adam Rutter, Justin Hammond -** http://www.neostats.net/ -** -** Portions Copyright (c) 2000-2001 ^Enigma^ -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -** USA -** -** NeoStats CVS Identification -** $Id$ -*/ - -#ifndef M_STATS_H -#define M_STATS_H - -#define DecreaseOpers(x) x->opers--; stats_network.opers--; -#define DecreaseUsers(x) x->users--; stats_network.users--; -#define DecreaseServers() stats_network.servers--; - -#define IncreaseOpers(x) x->opers++; stats_network.opers++; -#define IncreaseUsers(x) x->users++; stats_network.users++; x->totusers++; stats_network.totusers++; daily.tot_users++; -#define IncreaseServers() stats_network.servers++; - -#define IncreaseKicks(x) x->kicks++; x->maxkickstoday++; x->members--; -#define IncreaseTops(x) x->topics++; x->topicstoday++; -#define Increasemems(x) x->members++; x->totmem++; x->lastseen = time(NULL); x->joinstoday++; -#define Decreasemems(x) x->members--; x->lastseen = time(NULL); -#define IncreaseChans() stats_network.chans++; -#define DecreaseChans() stats_network.chans--; -#endif diff --git a/src/modules/statserv/sqlstats.h b/src/modules/statserv/sqlstats.h index aaa6d18e..ea7ba345 100644 --- a/src/modules/statserv/sqlstats.h +++ b/src/modules/statserv/sqlstats.h @@ -445,7 +445,7 @@ COLDEF statserv_versionscols[] = { "statserv_versions", "name", RTA_STR, - MAX_CLIENT_VERSION_NAME, + BUFSIZE, offsetof(struct irc_client_version, name), RTA_READONLY, NULL, diff --git a/src/modules/statserv/stats.c b/src/modules/statserv/stats.c index 826a319e..da9f7c53 100755 --- a/src/modules/statserv/stats.c +++ b/src/modules/statserv/stats.c @@ -25,53 +25,27 @@ #include "statserv.h" +#define IncreaseOpers(x) x->opers++; stats_network.opers++; +#define DecreaseOpers(x) x->opers--; stats_network.opers--; + +#define IncreaseUsers(x) x->users++; stats_network.users++; x->totusers++; stats_network.totusers++; daily.tot_users++; +#define DecreaseUsers(x) x->users--; stats_network.users--; + +#define Increasemems(x) x->members++; x->totmem++; x->lastseen = time(NULL); x->joinstoday++; +#define Decreasemems(x) x->members--; x->lastseen = time(NULL); + static char announce_buf[BUFSIZE]; -static int ss_event_ctcpversion(CmdParams* cmdparams); -int ss_event_online(CmdParams* cmdparams); -static int ss_event_pong(CmdParams* cmdparams); -static int ss_event_away(CmdParams* cmdparams); -static int ss_event_server(CmdParams* cmdparams); -static int ss_event_squit(CmdParams* cmdparams); -static int ss_event_nickip(CmdParams* cmdparams); -static int ss_event_signon(CmdParams* cmdparams); -static int ss_event_quit(CmdParams* cmdparams); -static int ss_event_mode(CmdParams* cmdparams); -static int ss_event_kill(CmdParams* cmdparams); -static int ss_event_newchan(CmdParams* cmdparams); -static int ss_event_delchan(CmdParams* cmdparams); -static int ss_event_join(CmdParams* cmdparams); -static int ss_event_part(CmdParams* cmdparams); -static int ss_event_topic(CmdParams* cmdparams); -static int ss_event_kick(CmdParams* cmdparams); - -ModuleEvent module_events[] = { - {EVENT_ONLINE, ss_event_online}, - {EVENT_PONG, ss_event_pong}, - {EVENT_SERVER, ss_event_server}, - {EVENT_SQUIT, ss_event_squit}, - {EVENT_SIGNON, ss_event_signon}, - {EVENT_GOTNICKIP, ss_event_nickip}, - {EVENT_UMODE, ss_event_mode}, - {EVENT_QUIT, ss_event_quit}, - {EVENT_AWAY, ss_event_away}, - {EVENT_KILL, ss_event_kill}, - {EVENT_NEWCHAN, ss_event_newchan}, - {EVENT_DELCHAN, ss_event_delchan}, - {EVENT_JOIN, ss_event_join}, - {EVENT_PART, ss_event_part}, - {EVENT_KICK, ss_event_kick}, - {EVENT_TOPIC, ss_event_topic}, - {EVENT_CTCPVERSION, ss_event_ctcpversion}, - {EVENT_NULL, NULL} -}; +hash_t *Shead; +list_t *Chead; +list_t *Vhead; static int check_interval() { static int lasttime; static int count; - if (StatServ.newdb || !StatServ.onchan || !me.synced) { + if (!StatServ.onchan || !me.synced) { return -1; } if ((me.now - lasttime) < StatServ.msginterval ) { @@ -129,7 +103,7 @@ announce_lag(const char *msg, ...) announce(StatServ.lagalert, announce_buf); } -static CVersions *findversions(char *name) +static CVersions *findctcpversion(char *name) { CVersions *cv; lnode_t *cn; @@ -137,7 +111,7 @@ static CVersions *findversions(char *name) if (cn) { cv = lnode_get(cn); } else { - nlog(LOG_DEBUG2, "findversions(%s) -> NOT FOUND", name); + nlog(LOG_DEBUG2, "findctcpversion(%s) -> NOT FOUND", name); return NULL; } return cv; @@ -183,85 +157,94 @@ int load_client_versions(void) return 1; } -int ss_event_ctcpversion(CmdParams* cmdparams) +void list_client_versions(User* u, int num) { + CVersions *cv; + lnode_t *cn; + int i; + + if (list_count(Vhead) == 0) { + prefmsg(u->nick, ss_bot->nick, "No Stats Available."); + return; + } + if (!list_is_sorted(Vhead, topversions)) { + list_sort(Vhead, topversions); + } + cn = list_first(Vhead); + cv = lnode_get(cn); + prefmsg(u->nick, ss_bot->nick, "Top%d Client Versions:", num); + prefmsg(u->nick, ss_bot->nick, "======================"); + for (i = 0; i <= num; i++) { + prefmsg(u->nick, ss_bot->nick, "%d) %d -> %s", i, cv->count, cv->name); + cn = list_next(Vhead, cn); + if (cn) { + cv = lnode_get(cn); + } else { + break; + } + } + prefmsg(u->nick, ss_bot->nick, "End of List."); +} + +void StatsAddChan(Channel* c) +{ + stats_network.chans++; + if (stats_network.chans > stats_network.maxchans) { + stats_network.maxchans = stats_network.chans; + stats_network.t_chans = me.now; + announce_record("\2NEW CHANNEL RECORD\2 %ld channels on the network", + stats_network.maxchans); + } + if (stats_network.chans > daily.chans) { + daily.chans = stats_network.chans; + daily.t_chans = me.now; + } +} + +void StatsAddCTCPVersion(char* version) +{ + static char nocols[BUFSIZE]; lnode_t *node; CVersions *clientv; - char *nocols = cmdparams->av[1]; + strlcpy(nocols, version, BUFSIZE); strip_mirc_codes(nocols); - - clientv = findversions(nocols); + clientv = findctcpversion(nocols); if (clientv) { nlog(LOG_DEBUG2, "Found version: %s", nocols); clientv->count++; - return 1; + return; } clientv = malloc(sizeof(CVersions)); - strlcpy(clientv->name, nocols, MAX_CLIENT_VERSION_NAME); + strlcpy(clientv->name, nocols, BUFSIZE); clientv->count = 1; node = lnode_create(clientv); list_append(Vhead, node); nlog(LOG_DEBUG2, "Added version: %s", clientv->name); - return 1; } -int ss_event_newchan(CmdParams* cmdparams) -{ - long count; - - IncreaseChans(); - /* only check exclusions after increasing channel count */ - if (StatServ.exclusions && IsExcluded(cmdparams->channel)) { - return 1; - } - count = hash_count(ch); - if (count > stats_network.maxchans) { - stats_network.maxchans = count; - stats_network.t_chans = me.now; - announce_record("\2NEW CHANNEL RECORD\2 Wow, there is now %ld Channels on the Network", - stats_network.maxchans); - } - if (count > daily.chans) { - daily.chans = count; - daily.t_chans = me.now; - } - return 1; -} - -int ss_event_delchan(CmdParams* cmdparams) +void StatsDelChan(Channel* c) { CStats *cs; lnode_t *ln; - DecreaseChans(); - /* only check exclusions after increasing channel count */ - if (StatServ.exclusions && IsExcluded(cmdparams->channel)) { - return 1; - } - ln = list_find(Chead, cmdparams->channel->name, comparef); - if (ln) { - cs = lnode_get(ln); + stats_network.chans --; + cs = findchanstats(c->name); + if (cs) { save_chan(cs); list_delete(Chead, ln); lnode_destroy(ln); free(cs); } else { - nlog(LOG_WARNING, "Couldn't find channel %s when deleting from stats", cmdparams->av[0]); + nlog(LOG_WARNING, "Couldn't find channel %s when deleting from stats", c->name); } - return 1; } -int ss_event_join(CmdParams* cmdparams) +void StatsJoinChan(User* u, Channel* c) { CStats *cs; - /* only check exclusions after increasing channel count */ - if (StatServ.exclusions && (IsExcluded(cmdparams->channel)|| IsExcluded(cmdparams->source.user))) { - return 1; - } - - cs = findchanstats(cmdparams->channel->name); + cs = findchanstats(c->name); if (cs) { Increasemems(cs); if (cs->maxmemtoday < cs->members) { @@ -277,62 +260,50 @@ int ss_event_join(CmdParams* cmdparams) cs->t_maxjoins = me.now; } } else { - cs = load_chan(cmdparams->channel->name); + cs = load_chan(c->name); Increasemems(cs); cs->maxmemtoday++; cs->t_maxmemtoday = me.now; cs->maxmems++; cs->t_maxmems = me.now; } - return 1; } -int ss_event_part(CmdParams* cmdparams) +void StatsPartChan(User* u, Channel* c) { CStats *cs; - /* only check exclusions after increasing channel count */ - if (StatServ.exclusions && (IsExcluded(cmdparams->channel) || IsExcluded(cmdparams->source.user))) { - return 1; - } - cs = findchanstats(cmdparams->channel->name); + + cs = findchanstats(c->name); if (cs) { Decreasemems(cs); } - return 1; } -int ss_event_topic(CmdParams* cmdparams) +void StatsChanTopic(Channel* c) { CStats *cs; - /* only check exclusions after increasing channel count */ - if (StatServ.exclusions && IsExcluded(cmdparams->channel)) { - return 1; - } - cs = findchanstats(cmdparams->channel->name); + cs = findchanstats(c->name); if (cs) { - IncreaseTops(cs); + cs->topics++; + cs->topicstoday++; } - return 1; } -int ss_event_kick(CmdParams* cmdparams) +void StatsChanKick(Channel* c) { CStats *cs; - /* only check exclusions after increasing channel count */ - if (StatServ.exclusions && IsExcluded(cmdparams->channel)) { - return 1; - } - cs = findchanstats(cmdparams->channel->name); + cs = findchanstats(c->name); if (cs) { - IncreaseKicks(cs); + cs->kicks++; + cs->maxkickstoday++; + cs->members--; if (cs->maxkicks < cs->maxkickstoday) { cs->maxkicks = cs->maxkickstoday; cs->t_maxkicks = me.now; } } - return 1; } CStats *findchanstats(char *name) @@ -343,264 +314,19 @@ CStats *findchanstats(char *name) cn = list_find(Chead, name, comparef); if (cn) { cs = lnode_get(cn); - } else { - nlog(LOG_DEBUG2, "findchanstats(%s) -> NOT FOUND", - name); - return NULL; + return cs; } - return cs; + nlog(LOG_DEBUG2, "findchanstats: %s not found", name); + return NULL; } -int ss_event_server(CmdParams* cmdparams) -{ - SET_SEGV_LOCATION(); - AddStats(cmdparams->source.server); - IncreaseServers(); - if (stats_network.maxservers < stats_network.servers) { - stats_network.maxservers = stats_network.servers; - stats_network.t_maxservers = me.now; - if (!(StatServ.exclusions && IsExcluded(cmdparams->source.server))) { - announce_record("\2NEW SERVER RECORD\2 Wow, there are now %ld Servers on the Network", - stats_network.servers); - } - } - if (stats_network.servers > daily.servers) { - daily.servers = stats_network.servers; - daily.t_servers = me.now; - } - return 1; -} - -int ss_event_squit(CmdParams* cmdparams) -{ - SStats *ss; - - SET_SEGV_LOCATION(); - DecreaseServers(); - ss = findstats(cmdparams->source.server->name); - if (cmdparams->source.server->name != me.uplink) - ss->numsplits = ss->numsplits + 1; - return 1; -} - -int ss_event_kill(CmdParams* cmdparams) -{ - SStats *s; - SStats *ss; - char *rbuf, *cmd, *who; - - SET_SEGV_LOCATION(); - if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { - return 0; - } - s = findstats(cmdparams->source.user->server->name); - if (is_oper(cmdparams->source.user)) { - nlog(LOG_DEBUG2, "Decreasing OperCount on %s due to kill", cmdparams->source.user->server->name); - DecreaseOpers(s); - } - if (cmdparams->source.user->is_away == 1) { - stats_network.away = stats_network.away - 1; - } - DecreaseUsers(s); - DelTLD(cmdparams->source.user); - rbuf = sstrdup(recbuf); - cmd = rbuf; - who = strtok(cmd, " "); - cmd = strtok(NULL, " "); - cmd = strtok(NULL, " "); - cmd = strtok(NULL, ""); - cmd++; - who++; - if (finduser(who)) { - /* it was a User that killed the target */ - ss = findstats(cmdparams->source.user->server->name); - ss->operkills = ss->operkills + 1; - } else if (findserver(who)) { - ss = findstats(who); - ss->serverkills = ss->serverkills + 1; - } - free(rbuf); - return 1; -} - -int ss_event_mode(CmdParams* cmdparams) -{ - int add = 1; - char *modes; - SStats *s; - - SET_SEGV_LOCATION(); - if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { - return -1; - } - s = findstats(cmdparams->source.user->server->name); - if (!s) { - nlog(LOG_WARNING, - "Unable to find stats for %s", cmdparams->source.user->server->name); - return -1; - } - modes = cmdparams->av[1]; - while (*modes) { - switch (*modes) { - case '+': - add = 1; - break; - case '-': - add = 0; - break; - case 'O': - case 'o': - if (add) { - nlog(LOG_DEBUG1, "Increasing OperCount for %s (%d)", cmdparams->source.user->server->name, s->opers); - IncreaseOpers(s); - if (stats_network.maxopers < - stats_network.opers) { - stats_network.maxopers = stats_network.opers; - stats_network.t_maxopers = me.now; - announce_record("\2Oper Record\2 The Network has reached a New Record for Opers at %ld", - stats_network.opers); - } - if (s->maxopers < s->opers) { - s->maxopers = s->opers; - s->t_maxopers = me.now; - announce_record("\2Server Oper Record\2 Wow, the Server %s now has a New record with %d Opers", - s->name,s->opers); - } - if (s->opers > daily.opers) { - daily.opers = s->opers; - daily.t_opers = me.now; - } - } else { - if (is_oper(cmdparams->source.user)) { - nlog(LOG_DEBUG1, "Decreasing OperCount for %s", cmdparams->source.user->server->name); - DecreaseOpers(s); - } - } - break; - default: - break; - } - modes++; - } - return 1; -} - -int ss_event_quit(CmdParams* cmdparams) -{ - SStats *s; - - if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { - return 0; - } - s = findstats(cmdparams->source.user->server->name); - - if (!cmdparams->source.user->modes) - return -1; - if (is_oper(cmdparams->source.user)) { - nlog(LOG_DEBUG2, "Decreasing OperCount on %s due to signoff", cmdparams->source.user->server->name); - DecreaseOpers(s); - } - if (cmdparams->source.user->is_away == 1) { - stats_network.away = stats_network.away - 1; - } - DecreaseUsers(s); - DelTLD(cmdparams->source.user); - return 1; -} - -int ss_event_away(CmdParams* cmdparams) -{ - SET_SEGV_LOCATION(); - if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { - return 0; - } - if (cmdparams->source.user->is_away == 1) { - stats_network.away = stats_network.away + 1; - } else { - stats_network.away = stats_network.away - 1; - } - return 1; -} - -int ss_event_nickip(CmdParams* cmdparams) -{ - AddTLD(cmdparams->source.user); - return 1; -} - -int ss_event_signon(CmdParams* cmdparams) -{ - SStats *s; - - SET_SEGV_LOCATION(); - /* ignore them if they are excluded */ - if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { - return 0; - } - s = findstats(cmdparams->source.user->server->name); - IncreaseUsers(s); - nlog(LOG_DEBUG2, "added %s to stats, now at %d", cmdparams->source.user->nick, s->users); - if (s->maxusers < s->users) { - /* New User Record */ - s->maxusers = s->users; - s->t_maxusers = me.now; - announce_record("\2NEW USER RECORD!\2 Wow, %s is cranking at the moment with %d users!", - s->name, s->users); - } - if (stats_network.maxusers < stats_network.users) { - stats_network.maxusers = stats_network.users; - stats_network.t_maxusers = me.now; - announce_record("\2NEW NETWORK RECORD!\2 Wow, a New Global User record has been reached with %ld users!", - stats_network.users); - } - if (stats_network.users > daily.users) { - daily.users = stats_network.users; - daily.t_users = me.now; - } - return 1; -} - -int ss_event_pong(CmdParams* cmdparams) -{ - SStats *ss; - - SET_SEGV_LOCATION(); - /* we don't want negative pings! */ - if (cmdparams->source.server->ping < 0) - return -1; - ss = findstats(cmdparams->source.server->name); - if (!ss) - return -1; - /* this is a tidy up from old versions of StatServ that used to have negative pings! */ - if (ss->lowest_ping < 0) { - ss->lowest_ping = 0; - } - if (ss->highest_ping < 0) { - ss->highest_ping = 0; - } - if (cmdparams->source.server->ping > ss->highest_ping) { - ss->highest_ping = cmdparams->source.server->ping; - ss->t_highest_ping = me.now; - } - if (cmdparams->source.server->ping < ss->lowest_ping) { - ss->lowest_ping = cmdparams->source.server->ping; - ss->t_lowest_ping = me.now; - } - /* ok, updated the statistics, now lets see if this server is "lagged out" */ - if (cmdparams->source.server->ping > StatServ.lagtime) { - announce_lag("\2%s\2 is lagged out with a ping of %d", - cmdparams->source.server->name, cmdparams->source.server->ping); - } - return 1; -} - -SStats *new_stats(const char *name) +SStats *newserverstats(const char *name) { hnode_t *sn; SStats *s; SET_SEGV_LOCATION(); - nlog(LOG_DEBUG2, "new_stats(%s)", name); + nlog(LOG_DEBUG2, "newserverstats(%s)", name); s = scalloc(sizeof(SStats)); if (!s) { FATAL_ERROR("Out of memory.") @@ -622,34 +348,235 @@ SStats *new_stats(const char *name) return s; } -void AddStats(Server * s) -{ - SStats *st; - - SET_SEGV_LOCATION(); - nlog(LOG_DEBUG2, "AddStats(%s)", s->name); - st = findstats(s->name); - if (!st) { - st = new_stats(s->name); - } else { - st->lastseen = me.now; - } -} - -SStats *findstats(char *name) +SStats *findserverstats(char *name) { hnode_t *sn; SET_SEGV_LOCATION(); sn = hash_lookup(Shead, name); if (sn) { - nlog(LOG_DEBUG2, "findstats(%s) - found", name); + nlog(LOG_DEBUG2, "findserverstats(%s) - found", name); return hnode_get(sn); } - nlog(LOG_DEBUG2, "findstats(%s) - not found", name); + nlog(LOG_DEBUG2, "findserverstats(%s) - not found", name); return NULL; } +void StatsAddServer(Server* s) +{ + SStats *st; + + SET_SEGV_LOCATION(); + nlog(LOG_DEBUG2, "StatsAddServer(%s)", s->name); + st = findserverstats(s->name); + if (!st) { + st = newserverstats(s->name); + } else { + st->lastseen = me.now; + } + stats_network.servers ++; + if (stats_network.maxservers < stats_network.servers) { + stats_network.maxservers = stats_network.servers; + stats_network.t_maxservers = me.now; + if (!(StatServ.exclusions && IsExcluded(s))) { + announce_record("\2NEW SERVER RECORD\2 Wow, there are now %ld Servers on the Network", + stats_network.servers); + } + } + if (stats_network.servers > daily.servers) { + daily.servers = stats_network.servers; + daily.t_servers = me.now; + } +} + +void StatsDelServer(Server* s) +{ + SStats *ss; + + SET_SEGV_LOCATION(); + stats_network.servers--; + ss = findserverstats(s->name); + if (s->name != me.uplink) + ss->numsplits ++; +} + +void StatsServerPong(Server* s) +{ + SStats *ss; + + SET_SEGV_LOCATION(); + /* we don't want negative pings! */ + if (s->ping < 0) + return; + ss = findserverstats(s->name); + if (!ss) + return; + /* this is a tidy up from old versions of StatServ that used to have negative pings! */ + if (ss->lowest_ping < 0) { + ss->lowest_ping = 0; + } + if (ss->highest_ping < 0) { + ss->highest_ping = 0; + } + if (s->ping > ss->highest_ping) { + ss->highest_ping = s->ping; + ss->t_highest_ping = me.now; + } + if (s->ping < ss->lowest_ping) { + ss->lowest_ping = s->ping; + ss->t_lowest_ping = me.now; + } + /* ok, updated the statistics, now lets see if this server is "lagged out" */ + if (s->ping > StatServ.lagtime) { + announce_lag("\2%s\2 is lagged out with a ping of %d", + s->name, s->ping); + } +} + +void StatsKillUser(User* u) +{ + SStats *s; + SStats *ss; + char *rbuf, *cmd, *who; + + SET_SEGV_LOCATION(); + s = findserverstats(u->server->name); + if (is_oper(u)) { + nlog(LOG_DEBUG2, "Decreasing OperCount on %s due to kill", u->server->name); + DecreaseOpers(s); + } + if (u->is_away == 1) { + stats_network.away --; + } + DecreaseUsers(s); + DelTLD(u); + rbuf = sstrdup(recbuf); + cmd = rbuf; + who = strtok(cmd, " "); + cmd = strtok(NULL, " "); + cmd = strtok(NULL, " "); + cmd = strtok(NULL, ""); + cmd++; + who++; + if (finduser(who)) { + /* it was a User that killed the target */ + ss = findserverstats(u->server->name); + ss->operkills ++; + } else if (findserver(who)) { + ss = findserverstats(who); + ss->serverkills ++; + } + free(rbuf); +} + +void StatsUserMode(User* u, char *modes) +{ + int add = 1; + SStats *s; + + SET_SEGV_LOCATION(); + s = findserverstats(u->server->name); + if (!s) { + nlog(LOG_WARNING, "Unable to find stats for %s", u->server->name); + return; + } + while (*modes) { + switch (*modes) { + case '+': + add = 1; + break; + case '-': + add = 0; + break; + case 'O': + case 'o': + if (add) { + nlog(LOG_DEBUG1, "Increasing OperCount for %s (%d)", u->server->name, s->opers); + IncreaseOpers(s); + if (stats_network.maxopers < + stats_network.opers) { + stats_network.maxopers = stats_network.opers; + stats_network.t_maxopers = me.now; + announce_record("\2Oper Record\2 The Network has reached a New Record for Opers at %ld", + stats_network.opers); + } + if (s->maxopers < s->opers) { + s->maxopers = s->opers; + s->t_maxopers = me.now; + announce_record("\2Server Oper Record\2 Wow, the Server %s now has a New record with %d Opers", + s->name,s->opers); + } + if (s->opers > daily.opers) { + daily.opers = s->opers; + daily.t_opers = me.now; + } + } else { + if (is_oper(u)) { + nlog(LOG_DEBUG1, "Decreasing OperCount for %s", u->server->name); + DecreaseOpers(s); + } + } + break; + default: + break; + } + modes++; + } +} + +void StatsUserAway(User* u) +{ + SET_SEGV_LOCATION(); + if (u->is_away == 1) { + stats_network.away ++; + } else { + stats_network.away --; + } +} + +void StatsAddUser(User* u) +{ + SStats *s; + + SET_SEGV_LOCATION(); + s = findserverstats(u->server->name); + IncreaseUsers(s); + nlog(LOG_DEBUG2, "added %s to stats, now at %d", u->nick, s->users); + if (s->maxusers < s->users) { + /* New User Record */ + s->maxusers = s->users; + s->t_maxusers = me.now; + announce_record("\2NEW USER RECORD!\2 Wow, %s is cranking at the moment with %d users!", + s->name, s->users); + } + if (stats_network.maxusers < stats_network.users) { + stats_network.maxusers = stats_network.users; + stats_network.t_maxusers = me.now; + announce_record("\2NEW NETWORK RECORD!\2 Wow, a New Global User record has been reached with %ld users!", + stats_network.users); + } + if (stats_network.users > daily.users) { + daily.users = stats_network.users; + daily.t_users = me.now; + } +} + +void StatsDelUser(User* u) +{ + SStats *s; + + s = findserverstats(u->server->name); + if (is_oper(u)) { + nlog(LOG_DEBUG2, "Decreasing OperCount on %s due to signoff", u->server->name); + DecreaseOpers(s); + } + if (u->is_away == 1) { + stats_network.away = stats_network.away - 1; + } + DecreaseUsers(s); + DelTLD(u); +} + int StatsMidnight(void) { struct tm *ltm = localtime(&me.now); @@ -683,3 +610,40 @@ int StatsMidnight(void) } return 1; } + +void InitStats(void) +{ + Chead = list_create(-1); + Shead = hash_create(-1, 0, 0); + Vhead = list_create(-1); + GetServerList(StatsAddServer); + GetUserList(StatsAddUser); + /* TODO get user modes */ + GetChannelList(StatsAddChan); + /* TODO get member counts */ +} + +void FiniStats(void) +{ + CStats *c; + lnode_t *cn; + SStats *s; + hnode_t *sn; + hscan_t ss; + + hash_destroy(Shead); + hash_scan_begin(&ss, Shead); + while ((sn = hash_scan_next(&ss))) { + s = hnode_get(sn); + free(s); + hash_scan_delete(Shead, sn); + hnode_destroy(sn); + } + cn = list_first(Chead); + while (cn) { + c = lnode_get(cn); + free(c); + cn = list_next(Chead, cn); + } + list_destroy_nodes(Chead); +} diff --git a/src/modules/statserv/statserv.c b/src/modules/statserv/statserv.c index 72968f12..8f03aa7c 100644 --- a/src/modules/statserv/statserv.c +++ b/src/modules/statserv/statserv.c @@ -44,11 +44,52 @@ static int ss_netstats(CmdParams* cmdparams); static int ss_clientversions(CmdParams* cmdparams); static int ss_forcehtml(CmdParams* cmdparams); +static int ss_event_ctcpversion(CmdParams* cmdparams); +static int ss_event_online(CmdParams* cmdparams); +static int ss_event_pong(CmdParams* cmdparams); +static int ss_event_away(CmdParams* cmdparams); +static int ss_event_server(CmdParams* cmdparams); +static int ss_event_squit(CmdParams* cmdparams); +static int ss_event_nickip(CmdParams* cmdparams); +static int ss_event_signon(CmdParams* cmdparams); +static int ss_event_quit(CmdParams* cmdparams); +static int ss_event_mode(CmdParams* cmdparams); +static int ss_event_kill(CmdParams* cmdparams); +static int ss_event_newchan(CmdParams* cmdparams); +static int ss_event_delchan(CmdParams* cmdparams); +static int ss_event_join(CmdParams* cmdparams); +static int ss_event_part(CmdParams* cmdparams); +static int ss_event_topic(CmdParams* cmdparams); +static int ss_event_kick(CmdParams* cmdparams); + +static User* listu; +static int listindex = 0; Bot *ss_bot; static Module* ss_module; +ModuleEvent module_events[] = { + {EVENT_ONLINE, ss_event_online}, + {EVENT_PONG, ss_event_pong}, + {EVENT_SERVER, ss_event_server}, + {EVENT_SQUIT, ss_event_squit}, + {EVENT_SIGNON, ss_event_signon}, + {EVENT_GOTNICKIP, ss_event_nickip}, + {EVENT_UMODE, ss_event_mode}, + {EVENT_QUIT, ss_event_quit}, + {EVENT_AWAY, ss_event_away}, + {EVENT_KILL, ss_event_kill}, + {EVENT_NEWCHAN, ss_event_newchan}, + {EVENT_DELCHAN, ss_event_delchan}, + {EVENT_JOIN, ss_event_join}, + {EVENT_PART, ss_event_part}, + {EVENT_KICK, ss_event_kick}, + {EVENT_TOPIC, ss_event_topic}, + {EVENT_CTCPVERSION, ss_event_ctcpversion}, + {EVENT_NULL, NULL} +}; + ModuleInfo module_info = { - "statserv", + "StatServ", "Network statistical service", ns_copyright, ss_about, @@ -105,104 +146,44 @@ static bot_setting ss_settings[]= {NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL }, }; -int ss_event_online(CmdParams* cmdparams) +static int ss_event_online(CmdParams* cmdparams) { SET_SEGV_LOCATION(); - ss_bot = init_bot (ss_module, &ss_botinfo, services_bot_modes, BOT_FLAG_RESTRICT_OPERS|BOT_FLAG_DEAF, ss_commands, ss_settings); + ss_bot = init_bot (&ss_botinfo, services_bot_modes, + BOT_FLAG_RESTRICT_OPERS|BOT_FLAG_DEAF, ss_commands, ss_settings); StatServ.onchan = 1; /* now that we are online, setup the timer to save the Stats database every so often */ - add_timer (ss_module, SaveStats, "SaveStats", DBSAVETIME); - add_timer (ss_module, ss_html, "ss_html", 3600); + add_timer (SaveStats, "SaveStats", DBSAVETIME); + add_timer (ss_html, "ss_html", 3600); /* also add a timer to check if its midnight (to reset the daily stats */ - add_timer (ss_module, StatsMidnight, "StatsMidnight", 60); - add_timer (ss_module, DelOldChan, "DelOldChan", 3600); + add_timer (StatsMidnight, "StatsMidnight", 60); + add_timer (DelOldChan, "DelOldChan", 3600); return 1; } int ModInit(Module* mod_ptr) { - Server *ss; - User *u; - hnode_t *node; - hscan_t scan; #ifdef SQLSRV lnode_t *lnode; #endif - int count, i; - Channel *c; - char **av; - int ac = 0; - char *chan; - lnode_t *chanmem; SET_SEGV_LOCATION(); - ss_module = mod_ptr; StatServ.onchan = 0; StatServ.shutdown = 0; /* we want nickip messages */ - me.want_nickip = 1; - - ModuleConfig(ss_module, ss_settings); + me.want_nickip = 1; + ModuleConfig(ss_settings); if (StatServ.html && StatServ.htmlpath[0] == 0) { - nlog(LOG_NOTICE, - "StatServ HTML stats disabled as HTML_PATH is not set"); + nlog(LOG_NOTICE, "HTML stats disabled as HTML_PATH is not set"); StatServ.html = 0; } - init_tld(); + InitTLD(); LoadStats(); - Vhead = list_create(-1); - hash_scan_begin(&scan, sh); - while ((node = hash_scan_next(&scan)) != NULL) { - ss = hnode_get(node); - ac = 0; - AddStringToList(&av, ss->name, &ac); - ss_event_server(av, ac); - free(av); - ac = 0; - nlog(LOG_DEBUG2, "Added Server %s to StatServ List", ss->name); - } - hash_scan_begin(&scan, uh); - while ((node = hash_scan_next(&scan)) != NULL) { - u = hnode_get(node); - ac = 0; - AddStringToList(&av, u->nick, &ac); - ss_event_signon(av, ac); - AddStringToList(&av, u->modes, &ac); - ss_event_mode(av, ac); - free(av); - ac = 0; - nlog(LOG_DEBUG2, "Add user %s to StatServ List", u->nick); - } - hash_scan_begin(&scan, ch); - while ((node = hash_scan_next(&scan)) != NULL) { - c = hnode_get(node); - count = list_count(c->chanmembers); - chanmem = list_first(c->chanmembers); - chan = lnode_get(chanmem); - ac = 0; - AddStringToList(&av, c->name, &ac); - ss_event_newchan(av, ac); - free(av); - ac = 0; - for (i = 1; i <= count; i++) { - nlog(LOG_DEBUG2, "Chanjoin %s", c->name); - ac = 0; - AddStringToList(&av, c->name, &ac); - AddStringToList(&av, chan, &ac); - ss_event_join(av, ac); - free(av); - ac = 0; - if (i < count) { - chanmem = list_next(c->chanmembers, chanmem); - chan = lnode_get(chanmem); - } - } - } + InitStats(); #ifdef SQLSRV /* ok, now export the server and chan data into the sql emulation layers */ - /* for the network and daily stats, we use a fake list, so we can easily import into rta */ fakedaily = list_create(-1); @@ -238,8 +219,11 @@ int ModInit(Module* mod_ptr) void ModFini() { StatServ.shutdown = 1; + chanalert(ss_bot->nick, "Saving StatServ Database. this *could* take a while"); SaveStats(); - fini_tld(); + chanalert(ss_bot->nick, "Done"); + FiniStats(); + FiniTLD(); save_client_versions(); #if SQLSRV list_destroy_nodes(fakedaily); @@ -250,6 +234,130 @@ void ModFini() #endif } +static int ss_event_server(CmdParams* cmdparams) +{ + SET_SEGV_LOCATION(); + StatsAddServer(cmdparams->source.server); + return 1; +} + +static int ss_event_squit(CmdParams* cmdparams) +{ + StatsDelServer(cmdparams->source.server); + return 1; +} + +static int ss_event_newchan(CmdParams* cmdparams) +{ + StatsAddChan(cmdparams->channel); + return 1; +} + +static int ss_event_delchan(CmdParams* cmdparams) +{ + StatsDelChan(cmdparams->channel); + return 1; +} + +static int ss_event_join(CmdParams* cmdparams) +{ + if (StatServ.exclusions && (IsExcluded(cmdparams->channel) || IsExcluded(cmdparams->source.user))) { + return 0; + } + StatsJoinChan(cmdparams->source.user, cmdparams->channel); + return 1; +} + +static int ss_event_part(CmdParams* cmdparams) +{ + if (StatServ.exclusions && (IsExcluded(cmdparams->channel) || IsExcluded(cmdparams->source.user))) { + return 0; + } + StatsPartChan(cmdparams->source.user, cmdparams->channel); + return 1; +} + +static int ss_event_topic(CmdParams* cmdparams) +{ + if (StatServ.exclusions && IsExcluded(cmdparams->channel)) { + return 1; + } + StatsChanTopic(cmdparams->channel); + return 1; +} + +static int ss_event_kick(CmdParams* cmdparams) +{ + if (StatServ.exclusions && IsExcluded(cmdparams->channel)) { + return 1; + } + StatsChanKick(cmdparams->channel); + return 1; +} + +int ss_event_ctcpversion(CmdParams* cmdparams) +{ + StatsAddCTCPVersion(cmdparams->av[1]); + return 1; +} + +static int ss_event_kill(CmdParams* cmdparams) +{ + if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { + return 0; + } + StatsKillUser(cmdparams->source.user); + return 1; +} + +static int ss_event_mode(CmdParams* cmdparams) +{ + if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { + return 0; + } + StatsUserMode(cmdparams->source.user, cmdparams->av[1]); + return 1; +} + +static int ss_event_quit(CmdParams* cmdparams) +{ + if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { + return 0; + } + StatsDelUser(cmdparams->source.user); + return 1; +} + +static int ss_event_away(CmdParams* cmdparams) +{ + if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { + return 0; + } + StatsUserAway(cmdparams->source.user); + return 1; +} + +static int ss_event_nickip(CmdParams* cmdparams) +{ + AddTLD(cmdparams->source.user); + return 1; +} + +static int ss_event_signon(CmdParams* cmdparams) +{ + if (StatServ.exclusions && IsExcluded(cmdparams->source.user)) { + return 0; + } + StatsAddUser(cmdparams->source.user); + return 1; +} + +static int ss_event_pong(CmdParams* cmdparams) +{ + StatsServerPong(cmdparams->source.server); + return 1; +} + int topchan(const void *key1, const void *key2) { const CStats *chan1 = key1; @@ -287,37 +395,13 @@ int topversions(const void *key1, const void *key2) static int ss_clientversions(CmdParams* cmdparams) { - CVersions *cv; - lnode_t *cn; - int i; int num; - chanalert(ss_bot->nick, "%s Wanted to see the Client Version List", cmdparams->source.user->nick); num = cmdparams->ac > 2 ? atoi(cmdparams->av[2]) : 10; if (num < 10) { num = 10; } - if (list_count(Vhead) == 0) { - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "No Stats Available."); - return 0; - } - if (!list_is_sorted(Vhead, topversions)) { - list_sort(Vhead, topversions); - } - cn = list_first(Vhead); - cv = lnode_get(cn); - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Top%d Client Versions:", num); - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "======================"); - for (i = 0; i <= num; i++) { - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "%d) %d -> %s", i, cv->count, cv->name); - cn = list_next(Vhead, cn); - if (cn) { - cv = lnode_get(cn); - } else { - break; - } - } - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "End of List."); + list_client_versions(cmdparams->source.user, num); return 1; } @@ -327,7 +411,6 @@ static int ss_chans(CmdParams* cmdparams) lnode_t *cn; int i; - chanalert(ss_bot->nick, "%s Wanted to see Channel Statistics", cmdparams->source.user->nick); if (!cmdparams->av[2]) { /* they want the top10 Channels online atm */ if (!list_is_sorted(Chead, topchan)) { @@ -493,17 +576,13 @@ static int ss_chans(CmdParams* cmdparams) static int ss_tld_map(CmdParams* cmdparams) { SET_SEGV_LOCATION(); - chanalert(ss_bot->nick, "%s Wanted to see a Country Breakdown", cmdparams->source.user->nick); - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Top Level Domain Statistics:"); DisplayTLDmap(cmdparams->source.user); - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "End of List"); return 1; } static int ss_netstats(CmdParams* cmdparams) { SET_SEGV_LOCATION(); - chanalert(ss_bot->nick, "%s Wanted to see the NetStats ", cmdparams->source.user->nick); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Network Statistics:-----"); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Current Users: %ld", stats_network.users); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Maximum Users: %ld [%s]", @@ -527,7 +606,6 @@ static int ss_netstats(CmdParams* cmdparams) static int ss_daily(CmdParams* cmdparams) { SET_SEGV_LOCATION(); - chanalert(ss_bot->nick, "%s Wanted to see the Daily NetStats ", cmdparams->source.user->nick); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Daily Network Statistics:"); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Maximum Servers: %-2d %s", daily.servers, sftime(daily.t_servers)); @@ -546,6 +624,7 @@ static int ss_daily(CmdParams* cmdparams) static void makemap(char *uplink, User * u, int level) { +#if 0 hscan_t hs; hnode_t *sn; Server *s; @@ -556,7 +635,7 @@ static void makemap(char *uplink, User * u, int level) hash_scan_begin(&hs, sh); while ((sn = hash_scan_next(&hs))) { s = hnode_get(sn); - ss = findstats(s->name); + ss = findserverstats(s->name); if ((level == 0) && (s->uplink[0] == 0)) { /* its the root server */ if (StatServ.exclusions && IsExcluded(s)) { @@ -583,12 +662,12 @@ static void makemap(char *uplink, User * u, int level) makemap(s->name, u, level + 1); } } +#endif } static int ss_map(CmdParams* cmdparams) { SET_SEGV_LOCATION(); - chanalert(ss_bot->nick, "%s Wanted to see the Current Network MAP", cmdparams->source.user->nick); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "%-40s %-10s %-10s %-10s", "\2[NAME]\2", "\2[USERS/MAX]\2", "\2[OPERS/MAX]\2", "\2[LAG/MAX]\2"); makemap("", cmdparams->source.user, 0); @@ -605,9 +684,7 @@ static int ss_server(CmdParams* cmdparams) char *server; SET_SEGV_LOCATION(); - server = cmdparams->av[2]; - chanalert(ss_bot->nick, "%s requested server information on %s", - cmdparams->source.user->nick, cmdparams->av[2]); + server = cmdparams->av[2]; if (!server) { prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Server listing:"); hash_scan_begin(&hs, Shead); @@ -625,7 +702,7 @@ static int ss_server(CmdParams* cmdparams) } /* ok, found the Server, lets do some Statistics work now ! */ - ss = findstats(server); + ss = findserverstats(server); s = findserver(server); if (!ss) { nlog(LOG_CRITICAL, "Unable to find server statistics for %s", server); @@ -662,7 +739,7 @@ static int ss_server(CmdParams* cmdparams) } if (ss->numsplits >= 1) { prefmsg(cmdparams->source.user->nick, ss_bot->nick, - "%s has split from the network %d time%s", + "%s has split from the network %d time %s", ss->name, ss->numsplits, (ss->numsplits == 1) ? "" : "s"); } else { prefmsg(cmdparams->source.user->nick, ss_bot->nick,"%s has never split from the network.", @@ -672,90 +749,74 @@ static int ss_server(CmdParams* cmdparams) return 1; } +static int operlistaway = 0; +static char* operlistserver; + +static void operlist(User* u) +{ + if (!is_oper(u)) + return; + if (operlistaway && u->is_away) + return; + if (!operlistserver) { + listindex++; + prefmsg(listu->nick, ss_bot->nick, "[%2d] %-15s %-15s %-10d", listindex, + u->nick, u->server->name, UserLevel(u)); + } else { + if (ircstrcasecmp(operlistserver, u->server->name)) + return; + listindex++; + prefmsg(listu->nick, ss_bot->nick, "[%2d] %-15s %-15s %-10d", listindex, + u->nick, u->server->name, UserLevel(u)); + } +} + static int ss_operlist(CmdParams* cmdparams) { - register int j = 0; - int away = 0; - register User *testuser; - int ulevel = 0; - hscan_t scan; - hnode_t *node; char *flags; - char *server; SET_SEGV_LOCATION(); - + operlistaway = 0; + listindex = 0; if (cmdparams->ac == 2) { prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Online IRCops:"); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "ID %-15s %-15s %-10s", "Nick", "Server", "Level"); - chanalert(ss_bot->nick, "%s requested operlist", cmdparams->source.user->nick); } - flags = cmdparams->av[2]; - server = cmdparams->av[3]; + operlistserver = cmdparams->av[3]; if (flags && !ircstrcasecmp(flags, "NOAWAY")) { - away = 1; + operlistaway = 1; flags = NULL; prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Online IRCops (not away):"); - chanalert(ss_bot->nick, "%s requested operlist (not away)", cmdparams->source.user->nick); } - if (!away && flags && strchr(flags, '.')) { - server = flags; - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Online IRCops on server %s", server); - chanalert(ss_bot->nick, "%s requested operlist on server %s", - cmdparams->source.user->nick, server); - } - hash_scan_begin(&scan, uh); - while ((node = hash_scan_next(&scan)) != NULL) { - testuser = hnode_get(node); - if (!is_oper(testuser)) - continue; - ulevel = UserLevel(testuser); - if (ulevel < NS_ULEVEL_OPER) - continue; - if (away && testuser->is_away) - continue; - if (!ircstrcasecmp(testuser->server->name, me.services_name)) - continue; - if (!server) { - j++; - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "[%2d] %-15s %-15s %-10d", j, - testuser->nick, testuser->server->name, ulevel); - continue; - } else { - if (ircstrcasecmp(server, testuser->server->name)) - continue; - j++; - prefmsg(cmdparams->source.user->nick, ss_bot->nick, "[%2d] %-15s %-15s %-10d", j, - testuser->nick, testuser->server->name, ulevel); - continue; - } + if (!operlistaway && flags && strchr(flags, '.')) { + operlistserver = flags; + prefmsg(cmdparams->source.user->nick, ss_bot->nick, "Online IRCops on server %s", operlistserver); } + listu = cmdparams->source.user; + GetUserList(operlist); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "End of Listing."); return 1; } #ifdef GOTBOTMODE +static void botlist(User* u) +{ + if is_bot(u) { + listindex++; + prefmsg(listu->nick, ss_bot->nick,"[%2d] %-15s %s", listindex, + u->nick, u->server->name); + } +} + static int ss_botlist(CmdParams* cmdparams) { - register int j = 0; - register User *testuser; - hscan_t scan; - hnode_t *node; - SET_SEGV_LOCATION(); - chanalert(ss_bot->nick, "%s Wanted to see the Bot List", cmdparams->source.user->nick); + listindex = 0; prefmsg(cmdparams->source.user->nick, ss_bot->nick, "On-Line Bots:"); - hash_scan_begin(&scan, uh); - while ((node = hash_scan_next(&scan)) != NULL) { - testuser = hnode_get(node); - if is_bot(testuser) { - j++; - prefmsg(cmdparams->source.user->nick, ss_bot->nick,"[%2d] %-15s %s", j, - testuser->nick, testuser->server->name); - } - } + listu = cmdparams->source.user; + GetUserList(botlist); prefmsg(cmdparams->source.user->nick, ss_bot->nick, "End of Listing."); return 1; } @@ -787,7 +848,7 @@ static int ss_stats(CmdParams* cmdparams) ss_bot->nick); return 0; } - st = findstats(cmdparams->av[3]); + st = findserverstats(cmdparams->av[3]); if (!st) { prefmsg(cmdparams->source.user->nick, ss_bot->nick, "%s is not in the database", cmdparams->av[3]); return 0; @@ -821,11 +882,11 @@ static int ss_stats(CmdParams* cmdparams) " ", ss_bot->nick); return 0; } - st = findstats(cmdparams->av[4]); + st = findserverstats(cmdparams->av[4]); if (st) free(st); - st = findstats(cmdparams->av[3]); + st = findserverstats(cmdparams->av[3]); if (!st) { prefmsg(cmdparams->source.user->nick, ss_bot->nick, "%s is not in the database", cmdparams->av[3]); @@ -853,8 +914,6 @@ static int ss_forcehtml(CmdParams* cmdparams) { nlog(LOG_NOTICE, "%s!%s@%s forced an update of the HTML file.", cmdparams->source.user->nick, cmdparams->source.user->username, cmdparams->source.user->hostname); - chanalert(ss_bot->nick, "%s forced an update of the HTML file.", - cmdparams->source.user->nick); ss_html(); return 1; } diff --git a/src/modules/statserv/statserv.h b/src/modules/statserv/statserv.h index 1f2ad5fa..242ae010 100644 --- a/src/modules/statserv/statserv.h +++ b/src/modules/statserv/statserv.h @@ -27,10 +27,6 @@ #define STATSERV_H #include "neostats.h" -#include "m_stats.h" - -/* this is the max number of statserv channels our database can hold... */ -#define SS_CHAN_SIZE -1 /* this is the how often to save a portion of the DB. Don't alter this unless you need to */ /* DO NOT set PROGCHANTIME less than ((DBSAVETIME + (DBSAVETIME/2)) * 4) otherwise you will not have the enitre database progressively saved! */ @@ -41,17 +37,11 @@ #define PROGCHANTIME 3600 extern Bot *ss_bot; -extern ModuleInfo module_info; -typedef struct tld_ TLD; -typedef struct region_ Region; -typedef struct server_stats SStats; -typedef struct chan_stats CStats; -typedef struct irc_client_version CVersions; -hash_t *Shead; -list_t *Chead; -list_t *Thead; -list_t *Vhead; +extern hash_t *Shead; +extern list_t *Chead; +extern list_t *Thead; +extern list_t *Vhead; struct stats_network_ { long opers; @@ -78,7 +68,6 @@ struct StatServ { int html; char htmlpath[MAXPATH]; int onchan; - int newdb; int msginterval; int msglimit; int shutdown; @@ -87,8 +76,7 @@ struct StatServ { } StatServ; -struct server_stats { - SStats *next, *prev; +typedef struct SStats { char name[MAXHOST]; unsigned int users; int opers; @@ -107,16 +95,14 @@ struct server_stats { unsigned int serverkills; long totusers; long daily_totusers; -}; +}SStats; -#define MAX_CLIENT_VERSION_NAME 512 - -struct irc_client_version { - char name[MAX_CLIENT_VERSION_NAME]; +typedef struct CVersions { + char name[BUFSIZE]; int count; -}; +}CVersions; -struct chan_stats { +typedef struct CStats { char name[CHANLEN]; long members; long topics; @@ -135,7 +121,7 @@ struct chan_stats { long maxjoins; time_t t_maxjoins; time_t lastsave; -}; +}CStats; struct daily_ { int servers; @@ -149,41 +135,56 @@ struct daily_ { time_t t_chans; } daily; -struct tld_ { +typedef struct TLD { char tld[5]; char country[32]; int users; int daily_users; /* for region/isp edition of GeoIP */ list_t *rl; -}; +}TLD; -struct region_ { +typedef struct Region { char *region; int users; int daily_users; -}; +}Region; int StatsMidnight(void); /* statserv.c */ -void statserv(char *); int topchan(const void *key1, const void *key2); int topjoin(const void *key1, const void *key2); int topkick(const void *key1, const void *key2); int toptopics(const void *key1, const void *key2); int topversions(const void *key1, const void *key2); /* stats.c */ +void list_client_versions(User* u, int num); int load_client_versions(void); int save_client_versions(void); -void AddStats(Server *); -SStats *findstats(char *); -int SaveStats(); -void LoadStats(); -CStats *findchanstats(char *); -#if 0 -CStats *AddChanStats(char *); -#endif -int DelOldChan(); +void StatsAddServer(Server* s); +void StatsDelServer(Server* s); +void StatsServerPong(Server* s); +SStats *findserverstats(char *name); +void StatsAddCTCPVersion(char* version); +void StatsAddUser(User* u); +void StatsDelUser(User* u); +void StatsKillUser(User* u); +void StatsUserMode(User* u, char *modes); +void StatsUserAway(User* u); +void InitStats(void); +void FiniStats(void); + +int SaveStats(void); +void LoadStats(void); + +CStats *findchanstats(char *name); +void StatsAddChan(Channel* c); +void StatsDelChan(Channel* c); +void StatsJoinChan(User* u, Channel* c); +void StatsPartChan(User* u, Channel* c); +void StatsChanTopic(Channel* c); +void StatsChanKick(Channel* c); +int DelOldChan(void); /* database.c */ void save_chan(CStats *c); @@ -236,8 +237,8 @@ int sortusers(const void *v, const void *v2); void ResetTLD(); void DisplayTLDmap(User *u); void AddTLD(User *); -void init_tld(); -void fini_tld(); +void InitTLD(void); +void FiniTLD(void); /* htmlstats.c */ int ss_html(void); diff --git a/src/modules/statserv/tld.c b/src/modules/statserv/tld.c index fdd03a59..ec9ad96c 100644 --- a/src/modules/statserv/tld.c +++ b/src/modules/statserv/tld.c @@ -32,11 +32,13 @@ #include "GeoIP.h" #include "GeoIPCity.h" +list_t *Thead; GeoIP *gi; void _setup_dbfilename(); -void ResetTLD() { +void ResetTLD() +{ lnode_t *tn, *tn2; TLD *t; @@ -70,10 +72,12 @@ int sortusers(const void *v, const void *v2) { return (t2->users - t->users); } -void DisplayTLDmap(User *u) { +void DisplayTLDmap(User *u) +{ TLD *t; lnode_t *tn; + prefmsg(u->nick, ss_bot->nick, "Top Level Domain Statistics:"); list_sort(Thead, sortusers); tn = list_first(Thead); while (tn) { @@ -81,11 +85,11 @@ void DisplayTLDmap(User *u) { prefmsg(u->nick, ss_bot->nick, "%3s \2%3d\2 (%2.0f%%) -> %s ---> Daily Total: %d", t->tld, t->users, - (float) t->users / - (float) stats_network.users * 100, + ((float) t->users / (float) stats_network.users) * 100, t->country, t->daily_users); tn = list_next(Thead, tn); } + prefmsg(u->nick, ss_bot->nick, "End of List"); } void DelTLD(User * u) @@ -94,8 +98,8 @@ void DelTLD(User * u) const char *ipaddr; lnode_t *tn; TLD *t = NULL; - SET_SEGV_LOCATION(); + SET_SEGV_LOCATION(); if (!gi) { return; } @@ -124,11 +128,9 @@ void AddTLD(User * u) if (!gi) { return; - } - + } ipaddr = inet_ntoa(u->ipaddr); country_code = GeoIP_country_code_by_addr(gi, ipaddr); - if (country_code) { tn = list_find(Thead, country_code, findcc); } else { @@ -151,16 +153,16 @@ void AddTLD(User * u) return; } -void init_tld() +void InitTLD(void) { TLD *t; lnode_t *tn; SET_SEGV_LOCATION(); + Thead = list_create(-1); gi = NULL; /* setup the GeoIP db filenames */ - _setup_dbfilename(); - + _setup_dbfilename(); StatServ.GeoDBtypes = -1; /* now open the various DB's */ if (GeoIP_db_avail(GEOIP_COUNTRY_EDITION)) { @@ -173,17 +175,15 @@ void init_tld() } else { nlog(LOG_WARNING, "GeoIP Database is not available. TLD stats will not be available"); } - Thead = list_create(-1); - t = malloc(sizeof(TLD)); - bzero(t, sizeof(TLD)); + t = scalloc(sizeof(TLD)); ircsnprintf(t->tld, 5, "???"); strlcpy(t->country, "Unknown", 8); tn = lnode_create(t); list_append(Thead, tn); - } -void fini_tld() { +void FiniTLD(void) +{ TLD *t; lnode_t *tn; diff --git a/src/modules/template/template.c b/src/modules/template/template.c index a0732c73..226d97c7 100755 --- a/src/modules/template/template.c +++ b/src/modules/template/template.c @@ -2,8 +2,6 @@ ** Copyright (c) 1999-2004 Adam Rutter, Justin Hammond, Mark Hetherington ** http://www.neostats.net/ ** -** Portions Copyright (c) 2000-2001 ^Enigma^ -** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or @@ -27,36 +25,41 @@ * You can copy this file as a template for writing your own modules */ -#include "neostats.h" /* Neostats API */ +/* neostats.h is the only required include for your module to access the + * NeoStats module API. You should not need to include any other NeoStats + * files in order to develop your module. + */ +#include "neostats.h" /* NeoStats API */ /** When we create a a bot, we must store the handle returned to us for use * when calling API bot functions */ static Bot *template_bot; -/** When a module loads, it is passed a handle that must be used when calling - * API functions. +/** When a module loads, it is passed a handle that includes information + * we might need later so you should store this. */ static Module* template_module; /** Define information about our bot */ -BotInfo template_bot_info = { +BotInfo template_bot_info = +{ /* REQUIRED: * nick */ - "TemplateBot", + "changeme", /* OPTIONAL: * altnick, use "" if not needed */ - "", + "altnick", /* REQUIRED: * user */ - "user", + "changeme", /* REQUIRED: * host */ "", /* REQUIRED: * realname */ - "Real Name", + "Example NeoStats module", }; /** @@ -129,7 +132,7 @@ ModuleInfo module_info = { static int tm_event_online(CmdParams* cmdparams) { /* Introduce a bot onto the network saving the bot handle */ - template_bot = init_bot ( template_module, &template_bot_info, "-x", 0, NULL, NULL); + template_bot = init_bot ( &template_bot_info, "-x", 0, NULL, NULL); return 1; }; @@ -149,7 +152,7 @@ ModuleEvent module_events[] = { */ int ModInit(Module* mod_ptr) { - /* Save our module handle so we can use API functions */ + /* Save our module handle */ template_module = mod_ptr; return 1; } diff --git a/src/neostats.h b/src/neostats.h index bac628d4..f7c1764d 100755 --- a/src/neostats.h +++ b/src/neostats.h @@ -53,17 +53,10 @@ /*#define USE_BERKELEY*/ #endif -/* Temp disable for upcoming release until all external modules - * have been released with warnings fixed - */ -#if 0 -#define __attribute__(x) /* NOTHING */ -#else /* If we're not using GNU C, elide __attribute__ */ #ifndef __GNUC__ #define __attribute__(x) /* NOTHING */ #endif -#endif /* * NeoStats core API version. @@ -106,9 +99,9 @@ #endif #ifdef NEOSTATS_REVISION -#define NEOSTATS_VERSION NEOSTATS_PACKAGE_VERSION " (" NEOSTATS_REVISION ")" +#define NEOSTATS_VERSION NEOSTATS_PACKAGE_VERSION " (" NEOSTATS_REVISION ")" NS_PROTOCOL #else -#define NEOSTATS_VERSION NEOSTATS_PACKAGE_VERSION +#define NEOSTATS_VERSION NEOSTATS_PACKAGE_VERSION NS_PROTOCOL #endif #define CORE_MODULE_VERSION NEOSTATS_VERSION @@ -296,28 +289,9 @@ typedef enum NS_TRANSFER { #define CLEAR_SEGV_LOCATION() segv_location[0]='\0'; #endif -#define SEGV_INMODULE_BUFSIZE MAX_MOD_NAME -#define SET_SEGV_INMODULE(module_name) strlcpy(segv_inmodule,(module_name),SEGV_INMODULE_BUFSIZE); -#define CLEAR_SEGV_INMODULE() segv_inmodule[0]='\0'; - -/* macros to provide a couple missing string functions for code legibility - * and to ensure we perform these operations in a standard and optimal manner - */ -/* set a string to NULL */ -#define strsetnull(str) (str)[0] = 0 -/* test a string for NULL */ -#define strisnull(str) ((str) && (str)[0] == 0) - -#define ARRAY_COUNT (a) ((sizeof ((a)) / sizeof ((a)[0])) - extern char recbuf[BUFSIZE]; extern const char services_bot_modes[]; extern char segv_location[SEGV_LOCATION_BUFSIZE]; -extern char segv_inmodule[SEGV_INMODULE_BUFSIZE]; - -extern hash_t *sh; -extern hash_t *uh; -extern hash_t *ch; /* this is the dns structure */ extern adns_state ads; @@ -388,7 +362,6 @@ struct me { int sqlport; #endif char version[VERSIONSIZE]; - char versionfull[VERSIONSIZE]; } me; /** @brief Bans structure @@ -696,6 +669,21 @@ typedef struct Module { unsigned int modnum; }Module; +extern Module* RunModule[10]; +extern int RunLevel; + +/* Simple stack to manage run level replacing original segv_module stuff + * which will hopefully make it easier to determine where we are running + * and avoid the need for modules to ever manage this and the core to + * have to set/reset when a module calls a core function which triggers + * other modules to run (e.g. init_bot) + */ +#define SET_RUN_LEVEL(moduleptr) {if(RunLevel<10 && RunModule[RunLevel] != moduleptr){RunLevel++;RunModule[RunLevel] = moduleptr;}} +#define RESET_RUN_LEVEL() {if(RunLevel>0){RunLevel--;}} +#define GET_CUR_MODULE() RunModule[RunLevel] +#define GET_CUR_MODNUM() RunModule[RunLevel]->modnum +#define GET_CUR_MODNAME() RunModule[RunLevel]->info->name + /** @brief Module socket list structure * */ @@ -781,25 +769,25 @@ typedef struct _Bot { unsigned int set_ulevel; }_Bot; -int ModuleConfig(Module* moduleptr, bot_setting* bot_settings); +int ModuleConfig(bot_setting* bot_settings); -int add_timer (Module* moduleptr, timer_function func, char* name, int interval); +int add_timer (timer_function func, char* name, int interval); int del_timer (char *timer_name); int set_timer_interval (char *timer_name, int interval); Timer *findtimer(char *timer_name); -int add_socket (Module* moduleptr, socket_function readfunc, socket_function writefunc, socket_function errfunc, char *sock_name, int socknum); -int add_sockpoll (Module* moduleptr, before_poll_function beforepoll, after_poll_function afterpoll, char *sock_name, void *data); +int add_socket (socket_function readfunc, socket_function writefunc, socket_function errfunc, char *sock_name, int socknum); +int add_sockpoll (before_poll_function beforepoll, after_poll_function afterpoll, char *sock_name, void *data); int del_socket (char *name); Sock *findsock (char *sock_name); -Bot * init_bot (Module* modptr, BotInfo* botinfo, const char* modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list); +Bot * init_bot (BotInfo* botinfo, const char* modes, unsigned int flags, bot_cmd *bot_cmd_list, bot_setting *bot_setting_list); int del_bot (Bot *botptr, char * reason); Bot *findbot (char * bot_name); int bot_nick_change (char * oldnick, char *newnick); /* sock.c */ -int sock_connect (Module* moduleptr, int socktype, unsigned long ipaddr, int port, char *module, socket_function func_read, socket_function func_write, socket_function func_error); +int sock_connect (int socktype, unsigned long ipaddr, int port, char *module, socket_function func_read, socket_function func_write, socket_function func_error); int sock_disconnect (char *name); /* conf.c */ @@ -958,12 +946,13 @@ typedef enum LOG_LEVEL { LOG_DEBUG2, /* more debug notices that are usefull */ LOG_DEBUG3, /* even more stuff, that would be useless to most normal people */ LOG_DEBUG4, /* are you insane? */ + LOG_LEVELMAX, /* are you insane? */ } LOG_LEVEL; /* define debug levels */ typedef enum DEBUG_LEVEL { - DEBUG1, + DEBUG1=1, DEBUG2, DEBUG3, DEBUG4, @@ -972,6 +961,8 @@ typedef enum DEBUG_LEVEL { DEBUG7, DEBUG8, DEBUG9, + DEBUG10, + DEBUGMAX, } DEBUG_LEVEL; /* this is for the neostats assert replacement. */ @@ -1007,6 +998,13 @@ void nlog (LOG_LEVEL level, char *fmt, ...) __attribute__((format(printf,2,3))); int CloakHost (Bot *bot_ptr); +typedef void (*ChannelListHandler) (Channel * c); +void GetChannelList(ChannelListHandler handler); +typedef void (*UserListHandler) (User * u); +void GetUserList(UserListHandler handler); +typedef void (*ServerListHandler) (Server * s); +void GetServerList(ServerListHandler handler); + /* * Module Interface */ diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c index 00981d09..10e0e3d8 100644 --- a/src/protocol/bahamut.c +++ b/src/protocol/bahamut.c @@ -52,7 +52,6 @@ static void m_svinfo (char *origin, char **argv, int argc, int srv); static void m_burst (char *origin, char **argv, int argc, int srv); static void m_sjoin (char *origin, char **argv, int argc, int srv); -const char ircd_version[] = "(B)"; const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { diff --git a/src/protocol/hybrid7.c b/src/protocol/hybrid7.c index d919930c..57304720 100644 --- a/src/protocol/hybrid7.c +++ b/src/protocol/hybrid7.c @@ -49,7 +49,6 @@ static void m_burst (char *origin, char **argv, int argc, int srv); static void m_sjoin (char *origin, char **argv, int argc, int srv); static void m_protoctl (char *origin, char **argv, int argc, int srv); -const char ircd_version[] = "(H)"; const char services_bot_modes[]= "+o"; /* this is the command list and associated functions to run */ diff --git a/src/protocol/ircu.c b/src/protocol/ircu.c index 1937b915..2606816e 100644 --- a/src/protocol/ircu.c +++ b/src/protocol/ircu.c @@ -60,7 +60,6 @@ static void m_end_of_burst (char *origin, char **argv, int argc, int srv); void send_end_of_burst_ack(void); void send_end_of_burst(void); -const char ircd_version[] = "(IRCu)"; const char services_bot_modes[]= "+iok"; /* this is the command list and associated functions to run */ diff --git a/src/protocol/liquid.c b/src/protocol/liquid.c index 6e234c1a..ad99139d 100644 --- a/src/protocol/liquid.c +++ b/src/protocol/liquid.c @@ -53,7 +53,6 @@ static void m_svinfo (char *origin, char **argv, int argc, int srv); static void m_burst (char *origin, char **argv, int argc, int srv); static void m_sjoin (char *origin, char **argv, int argc, int srv); -const char ircd_version[] = "(L)"; const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { diff --git a/src/protocol/mystic.c b/src/protocol/mystic.c index 531b8fe0..84930c09 100644 --- a/src/protocol/mystic.c +++ b/src/protocol/mystic.c @@ -53,7 +53,6 @@ static void m_svsnick (char *origin, char **argv, int argc, int srv); static void m_protoctl (char *origin, char **argv, int argc, int srv); static void m_vctrl (char *origin, char **argv, int argc, int srv); -const char ircd_version[] = "(M)"; const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { diff --git a/src/protocol/neoircd.c b/src/protocol/neoircd.c index f1f0ac0f..1b5397fe 100644 --- a/src/protocol/neoircd.c +++ b/src/protocol/neoircd.c @@ -49,7 +49,6 @@ static void m_burst (char *origin, char **argv, int argc, int srv); static void m_sjoin (char *origin, char **argv, int argc, int srv); static void m_tburst (char *origin, char **argv, int argc, int srv); -const char ircd_version[] = "(N)"; const char services_bot_modes[]= "+oS"; /* this is the command list and associated functions to run */ diff --git a/src/protocol/quantum.c b/src/protocol/quantum.c index 61864ec3..233aea2c 100644 --- a/src/protocol/quantum.c +++ b/src/protocol/quantum.c @@ -57,7 +57,6 @@ static void m_vctrl (char *origin, char **argv, int argc, int srv); static void m_client (char *origin, char **argv, int argc, int srv); static void m_smode (char *origin, char **argv, int argc, int srv); -const char ircd_version[] = "(Q)"; const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { diff --git a/src/protocol/ultimate.c b/src/protocol/ultimate.c index 7492eed3..3e9904b7 100644 --- a/src/protocol/ultimate.c +++ b/src/protocol/ultimate.c @@ -62,10 +62,8 @@ static void m_snetinfo (char *origin, char **argv, int argc, int srv); static void m_vctrl (char *origin, char **argv, int argc, int srv); #ifdef ULTIMATE3 -const char ircd_version[] = "(UL3)"; const char services_bot_modes[]= "+oS"; #else -const char ircd_version[] = "(UL)"; const char services_bot_modes[]= "+oS"; #endif diff --git a/src/protocol/unreal.c b/src/protocol/unreal.c index b5999b77..c2157805 100644 --- a/src/protocol/unreal.c +++ b/src/protocol/unreal.c @@ -63,11 +63,6 @@ static void m_tkl (char *origin, char **argv, int argc, int srv); #define NICKV2 -#ifdef UNREAL32 -const char ircd_version[] = "(U32)"; -#else -const char ircd_version[] = "(U31)"; -#endif const char services_bot_modes[]= "+oSq"; ircd_cmd cmd_list[] = { diff --git a/src/protocol/viagra.c b/src/protocol/viagra.c index 2925f0b3..70c2cd82 100755 --- a/src/protocol/viagra.c +++ b/src/protocol/viagra.c @@ -52,7 +52,6 @@ static void m_svinfo (char *origin, char **argv, int argc, int srv); static void m_burst (char *origin, char **argv, int argc, int srv); static void m_sjoin (char *origin, char **argv, int argc, int srv); -const char ircd_version[] = "(V)"; const char services_bot_modes[]= "+oS"; ircd_cmd cmd_list[] = { diff --git a/src/servers.c b/src/servers.c index bc49ed09..7b15d973 100644 --- a/src/servers.c +++ b/src/servers.c @@ -4,8 +4,6 @@ ** ** Portions Copyright (c) 2000-2001 ^Enigma^ ** -** Portions Copyright (c) 1999 Johnathan George net@lite.net -** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or @@ -34,7 +32,7 @@ #include "sqlsrv/rta.h" #endif -hash_t *sh; +static hash_t *sh; static Server * new_server (const char *name) @@ -47,12 +45,12 @@ new_server (const char *name) strlcpy (s->name, name, MAXHOST); sn = hnode_create (s); if (!sn) { - nlog (LOG_WARNING, "Server hash broken\n"); + nlog (LOG_WARNING, "Server hash broken"); free (s); return NULL; } if (hash_isfull (sh)) { - nlog (LOG_WARNING, "Server hash full\n"); + nlog (LOG_WARNING, "Server hash full"); free (s); return NULL; } else { @@ -295,7 +293,7 @@ InitServers (void) { sh = hash_create (S_TABLE_SIZE, 0, 0); if (!sh) { - nlog (LOG_CRITICAL, "Create Server Hash Failed\n"); + nlog (LOG_CRITICAL, "Unable to create server hash"); return NS_FAILURE; } AddServer (me.name, NULL, 0, NULL, me.infoline); @@ -346,3 +344,17 @@ FiniServers (void) } hash_destroy(sh); } + +void GetServerList(ServerListHandler handler) +{ + hnode_t *node; + hscan_t scan; + Server *ss; + + SET_SEGV_LOCATION(); + hash_scan_begin(&scan, sh); + while ((node = hash_scan_next(&scan)) != NULL) { + ss = hnode_get(node); + handler(ss); + } +} diff --git a/src/services.c b/src/services.c index e6da1361..fefaf81d 100644 --- a/src/services.c +++ b/src/services.c @@ -4,8 +4,6 @@ ** ** Portions Copyright (c) 2000-2001 ^Enigma^ ** -** Portions Copyright (c) 1999 Johnathan George net@lite.net -** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or @@ -75,7 +73,7 @@ ModuleInfo ns_module_info = { 0, }; -static Module ns_module = { +Module ns_module = { &ns_module_info }; @@ -125,10 +123,17 @@ init_services_bot (void) unsigned int flags; SET_SEGV_LOCATION(); + /* if all bots should join the chan */ + if (GetConf ((void *) &me.allbots, CFGINT, "AllBotsJoinChan") <= 0) { + me.allbots = 0; + } + if (GetConf ((void *) &me.pingtime, CFGINT, "PingServerTime") <= 0) { + me.pingtime = 120; + } ircsnprintf (ns_botinfo.realname, MAXREALNAME, "/msg %s \2HELP\2", ns_botinfo.nick); flags = me.onlyopers ? BOT_FLAG_ONLY_OPERS : 0; flags |= BOT_FLAG_DEAF; - ns_botptr = init_bot (&ns_module, &ns_botinfo, services_bot_modes, flags, ns_commands, NULL); + ns_botptr = init_bot (&ns_botinfo, services_bot_modes, flags, ns_commands, NULL); me.onchan = 1; SendAllModuleEvent (EVENT_ONLINE, NULL); return NS_SUCCESS; @@ -138,9 +143,7 @@ init_services_bot (void) * * maintain global exclusion list, which modules can take advantage off * - * @param u user - * @param av list of arguments - * @param ac number of arguments + * @param cmdparams structure with command information * @returns none */ @@ -149,20 +152,18 @@ ns_exclude (CmdParams* cmdparams) { if (!ircstrcasecmp(cmdparams->av[0], "ADD")) { if (cmdparams->ac < 3) { - prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Syntax error. /msg %s help exclude", ns_botptr->nick); - return NS_FAILURE; + return NS_ERR_NEED_MORE_PARAMS; } ns_do_exclude_add(cmdparams->source.user, cmdparams->av[0], cmdparams->av[1]); } else if (!ircstrcasecmp(cmdparams->av[0], "DEL")) { if (cmdparams->ac < 2) { - prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Syntax error. /msg %s help exclude", ns_botptr->nick); - return NS_FAILURE; + return NS_ERR_NEED_MORE_PARAMS; } ns_do_exclude_del(cmdparams->source.user, cmdparams->av[1]); } else if (!ircstrcasecmp(cmdparams->av[0], "LIST")) { ns_do_exclude_list(cmdparams->source.user, ns_botptr->nick); } else { - prefmsg(cmdparams->source.user->nick, ns_botptr->nick, "Syntax error. /msg %s help exclude", ns_botptr->nick); + return NS_ERR_SYNTAX_ERROR; } return NS_SUCCESS; } @@ -170,9 +171,7 @@ ns_exclude (CmdParams* cmdparams) * * Shutdown NeoStats * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -192,9 +191,7 @@ ns_shutdown (CmdParams* cmdparams) * * Reload NeoStats * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -214,9 +211,7 @@ ns_reload (CmdParams* cmdparams) * * Jupiter a server * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -237,9 +232,7 @@ ns_jupe (CmdParams* cmdparams) * * Set debug mode on/off * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -255,9 +248,7 @@ ns_set_debug (CmdParams* cmdparams) globops (me.name, "\2DEBUG MODE\2 disabled by %s", cmdparams->source.user->nick); prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "Debug mode disabled"); } else { - prefmsg(cmdparams->source.user->nick, ns_botptr->nick, - "Syntax Error: /msg %s HELP DEBUG for more info", ns_botptr->nick); - return NS_FAILURE; + return NS_ERR_SYNTAX_ERROR; } return NS_SUCCESS; } @@ -266,9 +257,7 @@ ns_set_debug (CmdParams* cmdparams) * * Dump user list * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -279,13 +268,7 @@ ns_userdump (CmdParams* cmdparams) prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "\2Error:\2 debug mode disabled"); return NS_FAILURE; } - if(cmdparams->ac < 1) { - chanalert (ns_botptr->nick, "\2DEBUG\2 %s requested a user dump", cmdparams->source.user->nick); - UserDump (NULL); - } else { - chanalert (ns_botptr->nick, "\2DEBUG\2 %s requested a user dump for %s", cmdparams->source.user->nick, cmdparams->av[0]); - UserDump (cmdparams->av[0]); - } + UserDump ((cmdparams->ac < 1)? NULL : cmdparams->av[0]); return NS_SUCCESS; } @@ -293,9 +276,7 @@ ns_userdump (CmdParams* cmdparams) * * Dump server list * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -306,13 +287,7 @@ ns_serverdump (CmdParams* cmdparams) prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "\2Error:\2 debug mode disabled"); return NS_FAILURE; } - if(cmdparams->ac < 1) { - chanalert (ns_botptr->nick, "\2DEBUG\2 %s requested a server dump", cmdparams->source.user->nick); - ServerDump (NULL); - } else { - chanalert (ns_botptr->nick, "\2DEBUG\2 %s requested a server dump for %s", cmdparams->source.user->nick, cmdparams->av[0]); - ServerDump (cmdparams->av[0]); - } + ServerDump ((cmdparams->ac < 1)? NULL : cmdparams->av[0]); return NS_SUCCESS; } @@ -320,9 +295,7 @@ ns_serverdump (CmdParams* cmdparams) * * Dump channel list * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -333,13 +306,7 @@ ns_chandump (CmdParams* cmdparams) prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "\2Error:\2 debug mode disabled"); return NS_FAILURE; } - if(cmdparams->ac < 1) { - chanalert (ns_botptr->nick, "\2DEBUG\2 %s requested a channel dump", cmdparams->source.user->nick); - ChanDump (NULL); - } else { - chanalert (ns_botptr->nick, "\2DEBUG\2 %s requested a channel dump for %s", cmdparams->source.user->nick, cmdparams->av[0]); - ChanDump (cmdparams->av[0]); - } + ChanDump ((cmdparams->ac < 1)? NULL : cmdparams->av[0]); return NS_SUCCESS; } @@ -347,9 +314,7 @@ ns_chandump (CmdParams* cmdparams) * * Display NeoStats status * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -384,9 +349,7 @@ ns_status (CmdParams* cmdparams) * * Display user level * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -398,9 +361,11 @@ ns_level (CmdParams* cmdparams) } else { User * otheruser; otheruser = finduser(cmdparams->av[0]); - if(otheruser) { - prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "User level for %s is %d", otheruser->nick, UserLevel (otheruser)); + if(!otheruser) { + prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "User %s not found", cmdparams->av[0]); + return NS_FAILURE; } + prefmsg (cmdparams->source.user->nick, ns_botptr->nick, "User level for %s is %d", otheruser->nick, UserLevel (otheruser)); } return NS_SUCCESS; } @@ -409,9 +374,7 @@ ns_level (CmdParams* cmdparams) * * Load module * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -430,9 +393,7 @@ ns_load (CmdParams* cmdparams) * * Unload module * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ static int @@ -449,9 +410,7 @@ ns_unload (CmdParams* cmdparams) * * issue a RAW command * - * @param user - * @param list of arguments - * @param number of arguments + * @param cmdparams structure with command information * @returns none */ #ifdef USE_RAW diff --git a/src/services.h b/src/services.h index 46e050cc..5856ac08 100644 --- a/src/services.h +++ b/src/services.h @@ -25,6 +25,7 @@ #define _SERVICES_H_ extern ModuleInfo ns_module_info; +extern Module ns_module; extern BotInfo ns_botinfo; extern Bot* ns_botptr; diff --git a/src/signals.c b/src/signals.c index 9f0381ed..c1b4e393 100644 --- a/src/signals.c +++ b/src/signals.c @@ -116,12 +116,12 @@ void do_backtrace(void) #endif } -void report_segfault(char* modulename) +void report_segfault(const char* modulename) { segfault = fopen ("segfault.log", "a"); if(modulename) { - globops (me.name, "Segmentation fault in %s. Refer to segfault.log for details.", segv_inmodule); - nlog (LOG_CRITICAL, "Segmentation fault in %s. Refer to segfault.log for details.", segv_inmodule); + globops (me.name, "Segmentation fault in %s. Refer to segfault.log for details.", GET_CUR_MODNAME()); + nlog (LOG_CRITICAL, "Segmentation fault in %s. Refer to segfault.log for details.", GET_CUR_MODNAME()); } else { globops (me.name, "Segmentation fault. Server terminating. Refer to segfault.log."); nlog (LOG_CRITICAL, "Segmentation fault. Server terminating. Refer to segfault.log."); @@ -129,9 +129,9 @@ void report_segfault(char* modulename) fprintf (segfault, "------------------------SEGFAULT REPORT-------------------------\n"); fprintf (segfault, "Please view the README for how to submit a bug report\n"); fprintf (segfault, "and include this segfault report in your submission.\n"); - fprintf (segfault, "Version: %s\n", me.versionfull); + fprintf (segfault, "Version: %s\n", me.version); if (modulename) { - fprintf (segfault, "Module: %s\n", segv_inmodule); + fprintf (segfault, "Module: %s\n", GET_CUR_MODNAME()); } fprintf (segfault, "Location: %s\n", segv_location); fprintf (segfault, "recbuf: %s\n", recbuf); @@ -149,10 +149,10 @@ serv_segv () /** segv happened inside a module, so unload and try to restore the stack * to location before we jumped into the module and continue */ - if (strcasecmp (segv_inmodule, "neostats") != 0) { - report_segfault (segv_inmodule); - strlcpy (name, segv_inmodule, MAX_MOD_NAME); - CLEAR_SEGV_INMODULE(); + if (RunLevel > 0) { + report_segfault (GET_CUR_MODNAME()); + strlcpy (name, GET_CUR_MODNAME(), MAX_MOD_NAME); + RunLevel = 0; unload_module (name, NULL); chanalert (ns_botptr->nick, "Restoring Stack to before Crash"); /* flush the logs out */ diff --git a/src/sock.c b/src/sock.c index f0eff26b..78e6ff08 100644 --- a/src/sock.c +++ b/src/sock.c @@ -212,9 +212,9 @@ read_loop () ++me.cursocks; } else { /* its a poll interface, setup for select instead */ - SET_SEGV_INMODULE(sock->moduleptr->info->name); + SET_RUN_LEVEL(sock->moduleptr); j = sock->beforepoll (sock->data, ufds); - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); /* if we don't have any socks, just continue */ if (j == -1) continue; @@ -329,7 +329,7 @@ restartsql: while ((sn = hash_scan_next (&ss)) != NULL) { pollflag = 0; sock = hnode_get (sn); - SET_SEGV_INMODULE(sock->moduleptr->info->name); + SET_RUN_LEVEL(sock->moduleptr); if (sock->socktype == SOCK_STANDARD) { if (FD_ISSET (sock->sock_no, &readfds)) { nlog (LOG_DEBUG3, "Running module %s readsock function for %s", sock->moduleptr->info->name, sock->name); @@ -367,8 +367,8 @@ restartsql: sock->afterpoll(sock->data, ufds, pollsize); } } - } - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); + } continue; } } else if (SelectResult == 0) { @@ -466,12 +466,14 @@ recvlog (char *line) * NS_FAILURE if unsuccessful */ int -sock_connect (Module* moduleptr, int socktype, unsigned long ipaddr, int port, char *name, socket_function func_read, socket_function func_write, socket_function func_error) +sock_connect (int socktype, unsigned long ipaddr, int port, char *name, socket_function func_read, socket_function func_write, socket_function func_error) { struct sockaddr_in sa; int s; int i; + Module* moduleptr; + moduleptr = GET_CUR_MODULE(); /* socktype = SOCK_STREAM */ if ((s = socket (AF_INET, socktype, 0)) < 0) return NS_FAILURE; @@ -506,7 +508,7 @@ sock_connect (Module* moduleptr, int socktype, unsigned long ipaddr, int port, c } } - add_socket (moduleptr, func_read, func_write, func_error, name, s); + add_socket (func_read, func_write, func_error, name, s); return s; } @@ -844,8 +846,10 @@ int InitSocks (void) { me.maxsocks = getmaxsock (); sockh = hash_create (me.maxsocks, 0, 0); - if(!sockh) + if(!sockh) { + nlog (LOG_CRITICAL, "Unable to create socks hash"); return NS_FAILURE; + } return NS_SUCCESS; } @@ -917,11 +921,13 @@ findsock (char *sock_name) * @return pointer to socket if found, NULL if not found */ int -add_socket (Module* moduleptr, socket_function readfunc, socket_function writefunc, socket_function errfunc, char *sock_name, int socknum) +add_socket (socket_function readfunc, socket_function writefunc, socket_function errfunc, char *sock_name, int socknum) { Sock *sock; + Module* moduleptr; SET_SEGV_LOCATION(); + moduleptr = GET_CUR_MODULE(); if (!readfunc) { nlog (LOG_WARNING, "add_socket: read socket function doesn't exist = %s (%s)", sock_name, moduleptr->info->name); return NS_FAILURE; @@ -958,11 +964,13 @@ add_socket (Module* moduleptr, socket_function readfunc, socket_function writefu * @return pointer to socket if found, NULL if not found */ int -add_sockpoll (Module* moduleptr, before_poll_function beforepoll, after_poll_function afterpoll, char *sock_name, void *data) +add_sockpoll (before_poll_function beforepoll, after_poll_function afterpoll, char *sock_name, void *data) { Sock *sock; + Module* moduleptr; SET_SEGV_LOCATION(); + moduleptr = GET_CUR_MODULE(); if (!beforepoll) { nlog (LOG_WARNING, "add_sockpoll: read socket function doesn't exist = %s (%s)", sock_name, moduleptr->info->name); return NS_FAILURE; diff --git a/src/sqlsrv/api.c b/src/sqlsrv/api.c index 642f025f..9850fc5e 100644 --- a/src/sqlsrv/api.c +++ b/src/sqlsrv/api.c @@ -344,8 +344,7 @@ dbcommand(char *buf, int *nin, char *out, int *nout, int connid) } else { - conn = malloc(sizeof(EpgConn)); - bzero(conn, sizeof(EpgConn)); + conn = scalloc(sizeof(EpgConn)); snprintf(conn->cmd, 1000, "Authenticating"); snprintf((char *) conn->username, 32, "%s", &buf[72]); conn->id = connid; diff --git a/src/timer.c b/src/timer.c index 511486ce..e3b96f3a 100644 --- a/src/timer.c +++ b/src/timer.c @@ -42,8 +42,10 @@ void run_mod_timers (void); int InitTimers (void) { th = hash_create (T_TABLE_SIZE, 0, 0); - if(!th) + if(!th) { + nlog (LOG_CRITICAL, "Unable to create timer hash"); return NS_FAILURE; + } return NS_SUCCESS; } @@ -161,11 +163,13 @@ findtimer (char *name) * @return NS_SUCCESS if added, NS_FAILURE if not */ int -add_timer (Module* moduleptr, timer_function func_name, char *name, int interval) +add_timer (timer_function func_name, char *name, int interval) { Timer *timer; + Module* moduleptr; SET_SEGV_LOCATION(); + moduleptr = GET_CUR_MODULE(); if (func_name == NULL) { nlog (LOG_WARNING, "%s: Timer %s Function doesn't exist", moduleptr->info->name, name); return NS_FAILURE; @@ -311,7 +315,7 @@ run_mod_timers (void) timer = hnode_get (tn); if (me.now - timer->lastrun > timer->interval) { if (setjmp (sigvbuf) == 0) { - SET_SEGV_INMODULE(timer->moduleptr->info->name); + SET_RUN_LEVEL(timer->moduleptr); nlog(LOG_DEBUG3, "run_mod_timers: Running timer %s for module %s", timer->name, timer->moduleptr->info->name); if (timer->function () < 0) { nlog(LOG_DEBUG2, "run_mod_timers: Deleting Timer %s for Module %s as requested", timer->name, timer->moduleptr->info->name); @@ -321,7 +325,7 @@ run_mod_timers (void) } else { timer->lastrun = (int) me.now; } - CLEAR_SEGV_INMODULE(); + RESET_RUN_LEVEL(); } else { nlog (LOG_CRITICAL, "run_mod_timers: setjmp() failed, can't call module %s\n", timer->moduleptr->info->name); } diff --git a/src/transfer.c b/src/transfer.c index d0de0001..d7cbb665 100644 --- a/src/transfer.c +++ b/src/transfer.c @@ -29,17 +29,6 @@ #include "transfer.h" #include "curl.h" -void testcallback(void *data, int status, char *body, int bodysize) { -if (status == NS_FAILURE) { - printf("gotcallback for %s\n", (char *)data); - printf("Error: %s\n", body); -} else { - printf("got good callback for %s\n", (char *)data); - printf("Body:(%d - %d)\n%s\n", bodysize, strlen(body),body); -} -} - - int InitCurl(void) { /* global curl init */ @@ -67,7 +56,8 @@ int InitCurl(void) return NS_SUCCESS; } -static size_t neocurl_callback( void *transferptr, size_t size, size_t nmemb, void *stream) { +static size_t neocurl_callback( void *transferptr, size_t size, size_t nmemb, void *stream) +{ size_t writesize; int rembuffer; char *newbuf; @@ -106,10 +96,10 @@ static size_t neocurl_callback( void *transferptr, size_t size, size_t nmemb, vo } -int new_transfer(char *url, char *params, NS_TRANSFER savetofileormemory, char *filename, void *data, transfer_callback *callback) { +int new_transfer(char *url, char *params, NS_TRANSFER savetofileormemory, char *filename, void *data, transfer_callback *callback) +{ int ret; neo_transfer *newtrans; - /* sanity check the input first */ if (url[0] == 0) { @@ -121,8 +111,7 @@ int new_transfer(char *url, char *params, NS_TRANSFER savetofileormemory, char * return NS_FAILURE; } - newtrans = malloc(sizeof(neo_transfer)); - bzero(newtrans, sizeof(neo_transfer)); + newtrans = scalloc(sizeof(neo_transfer)); switch (savetofileormemory) { case NS_FILE: /* if we don't have a filename, bail out */ @@ -197,7 +186,7 @@ int new_transfer(char *url, char *params, NS_TRANSFER savetofileormemory, char * } /* setup the user agent */ - ircsnprintf(newtrans->useragent, MAXURL, "NeoStats %s (%s)", me.versionfull, segv_inmodule); + ircsnprintf(newtrans->useragent, MAXURL, "NeoStats %s (%s)", me.version, GET_CUR_MODNAME()); if ((ret = curl_easy_setopt(newtrans->curleasyhandle, CURLOPT_USERAGENT, newtrans->useragent)) != 0) { nlog(LOG_WARNING, "Curl Set useragent failed. Returned %d for url %s", ret, url); nlog(LOG_WARNING, "Error Was: %s", newtrans->curlerror); @@ -269,8 +258,8 @@ int new_transfer(char *url, char *params, NS_TRANSFER savetofileormemory, char * return NS_SUCCESS; } - -void transfer_status() { +void transfer_status(void) +{ CURLMsg *msg; int msg_left; neo_transfer *neotrans; @@ -294,7 +283,6 @@ void transfer_status() { /* check if it failed etc */ if (msg->data.result != 0) { /* it failed for whatever reason */ - /* XXX TODO... Callback with a failure */ nlog(LOG_NOTICE, "Transfer %s Failed. Error was: %s", neotrans->url, neotrans->curlerror); neotrans->callback(neotrans->data, NS_FAILURE, neotrans->curlerror, strlen(neotrans->curlerror)); } else { @@ -302,7 +290,6 @@ void transfer_status() { /* success, so we must callback with success */ neotrans->callback(neotrans->data, NS_SUCCESS, neotrans->savefileormem == NS_MEMORY ? neotrans->savemem : NULL, neotrans->savememsize); } - CLEAR_SEGV_INMODULE(); /* regardless, clean up the transfer */ curl_multi_remove_handle(curlmultihandle, neotrans->curleasyhandle); curl_easy_cleanup(neotrans->curleasyhandle); diff --git a/src/users.c b/src/users.c index 531fba8b..5d051303 100644 --- a/src/users.c +++ b/src/users.c @@ -4,8 +4,6 @@ ** ** Portions Copyright (c) 2000-2001 ^Enigma^ ** -** Portions Copyright (c) 1999 Johnathan George net@lite.net -** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or @@ -41,9 +39,7 @@ #include #include -hash_t *uh; - -char quitreason[BUFSIZE]; +static hash_t *uh; static User * new_user (const char *nick) @@ -194,17 +190,12 @@ KillUser (const char *nick, const char *reason) nlog (LOG_WARNING, "KillUser: %s failed!", nick); return; } - bzero(quitreason, BUFSIZE); - if(reason) { - strlcpy(quitreason, reason, BUFSIZE); - strip_mirc_codes(quitreason); - } - PartAllChannels (u); + PartAllChannels (u, reason); /* run the event to delete a user */ cmdparams = (CmdParams*) scalloc (sizeof(CmdParams)); cmdparams->source.user = u; if(reason) { - cmdparams->param = (char*)quitreason; + cmdparams->param = (char*)reason; } SendAllModuleEvent (EVENT_KILL, cmdparams); /* if its one of our bots inform the module */ @@ -229,17 +220,12 @@ QuitUser (const char *nick, const char *reason) nlog (LOG_WARNING, "QuitUser: %s failed!", nick); return; } - bzero(quitreason, BUFSIZE); - if(reason) { - strlcpy(quitreason, reason, BUFSIZE); - strip_mirc_codes(quitreason); - } - PartAllChannels (u); + PartAllChannels (u, reason); /* run the event to delete a user */ cmdparams = (CmdParams*) scalloc (sizeof(CmdParams)); cmdparams->source.user = u; if(reason) { - cmdparams->param = (char*)quitreason; + cmdparams->param = (char*)reason; } SendAllModuleEvent (EVENT_QUIT, cmdparams); deluser(u); @@ -578,8 +564,10 @@ int InitUsers () { uh = hash_create (U_TABLE_SIZE, 0, 0); - if(!uh) + if(!uh) { + nlog (LOG_CRITICAL, "Unable to create user hash"); return NS_FAILURE; + } #ifdef SQLSRV /* add the server hash to the sql library */ @@ -768,7 +756,7 @@ void FiniUsers (void) hash_scan_begin(&hs, uh); while ((un = hash_scan_next(&hs)) != NULL) { u = hnode_get (un); - PartAllChannels (u); + PartAllChannels (u, NULL); /* something is wrong if its our bots */ if ( IsMe(u) ) { nlog (LOG_NOTICE, "FiniUsers called with a neostats bot online: %s", u->nick); @@ -779,5 +767,18 @@ void FiniUsers (void) free (u); } hash_destroy(uh); - hash_destroy(ch); +} + +void GetUserList(UserListHandler handler) +{ + User *u; + hscan_t scan; + hnode_t *node; + + SET_SEGV_LOCATION(); + hash_scan_begin(&scan, uh); + while ((node = hash_scan_next(&scan)) != NULL) { + u = hnode_get(node); + handler(u); + } }