[cvslog] (2004-07-25 11:17:46 UTC) Module eggdrop1.6: Change committed!

cvslog cvs at tsss.org
Sun Jul 25 05:17:46 CST 2004


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2004-07-25 11:17:45 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     Makefile.in aclocal.m4 config.h.in configure.ac doc/COMPILING-FAQ
     doc/UPDATES1.6 doc/html/compiling.html src/Makefile.in
     src/botmsg.c src/chanprog.c src/cmds.c src/eggdrop.h src/main.h
     src/modules.c src/modules.h src/patch.h src/tcl.c src/users.c
     src/mod/Makefile.in src/mod/eggmod.m4 src/mod/modvals.h
     src/mod/assoc.mod/Makefile src/mod/blowfish.mod/Makefile
     src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile.in
     src/mod/compress.mod/configure src/mod/compress.mod/configure.ac
     src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile
     src/mod/dns.mod/Makefile.in src/mod/dns.mod/configure
     src/mod/dns.mod/configure.ac src/mod/filesys.mod/Makefile
     src/mod/irc.mod/Makefile src/mod/notes.mod/Makefile
     src/mod/seen.mod/Makefile src/mod/server.mod/Makefile
     src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile
     src/mod/uptime.mod/Makefile src/mod/wire.mod/Makefile
     src/mod/woobie.mod/Makefile

Log message:

* We now support module loading under Darwin (Mac OS X) and NeXT Step.

* Detect Tcl in $HOME/lib and $HOME/tcl/lib first, as to make it easier to allow users to override the system's Tcl version.

* Cleaned up modules.c and the module configure stuff quite a bit.

* Check for -Wall as it's own test (backport 1.9).

* No more eggmod.sh.

* Small fix to a previous patch (removed an unused variable).

---------------------- diff included ----------------------
Index: eggdrop1.6/Makefile.in
diff -u eggdrop1.6/Makefile.in:1.38 eggdrop1.6/Makefile.in:1.39
--- eggdrop1.6/Makefile.in:1.38	Thu Jun 17 00:43:28 2004
+++ eggdrop1.6/Makefile.in	Sun Jul 25 06:17:33 2004
@@ -2,7 +2,7 @@
 #  This is the Makefile for EGGDROP (the IRC bot)
 #  You should never need to edit this.
 #
-# $Id: Makefile.in,v 1.38 2004/06/17 05:43:28 wcc Exp $
+# $Id: Makefile.in,v 1.39 2004/07/25 11:17:33 wcc Exp $
 
 SHELL = @SHELL@
 top_srcdir = @top_srcdir@
@@ -25,46 +25,53 @@
 #                    or 'make sdebug'
 CFLGS =
 
-# configure SHOULD set these...you may need to tweak them to get modules
-# to compile .. if you do...let the devel-team know the working settings
-# btw to turn STRIP off, do 'STRIP = touch' not 'STRIP ='
+# ./configure SHOULD set these; however you may need to tweak them to
+# get modules to compile. If you do, PLEASE let the development team know,
+# so we can incorporate needed changes into the next release. You can
+# contact us at eggdev at eggheads.org, as always.
 
-# defaults
+# Compiler
 CC = @CC@
-LD = @CC@
-STRIP = @STRIP@
-RANLIB = @RANLIB@
-
-# make eggmod
 MOD_CC = @MOD_CC@
-MOD_LD = @MOD_LD@
-MOD_STRIP = @MOD_STRIP@
-
-# make modules
 SHLIB_CC = @SHLIB_CC@
+
+# Linker
+LD = @CC@
+MOD_LD = @MOD_LD@
 SHLIB_LD = @SHLIB_LD@
+
+# Stripping
+# To turn STRIP off, use 'STRIP = touch' not 'STRIP ='.
+STRIP = @STRIP@
+MOD_STRIP = @MOD_STRIP@
 SHLIB_STRIP = @SHLIB_STRIP@
-MOD_EXT = @MOD_EXT@
 
-# programs make install uses
+# Programs make install uses
 LN_S = @LN_S@
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 
-# No need to edit anything below this line.
-
+# Misc
+RANLIB = @RANLIB@
+MOD_EXT = @MOD_EXT@
 XREQS = @TCL_REQS@
-XLIBS = @TCL_LIBS@ @LIBS@
 TCLLIB = @TCLLIB@
 TCLLIBFN = @TCLLIBFN@
 
+# Extra libraries
+# XLIBS will be linked with everything; MODULE_XLIBS will only be linked with
+# the actual module objects.
+XLIBS = @TCL_LIBS@ @LIBS@
+MODULE_XLIBS = @MODULE_XLIBS@
+
+# Shouldn't need to touch anything below here.
 DEBCFLAGS = -DDEBUG_ASSERT -DDEBUG_MEM
 
 modconf = $(top_srcdir)/misc/modconfig --top_srcdir=$(top_srcdir)
 
-egg_test_run =  EGG_LANGDIR=$(top_srcdir)/language ./$(EGGEXEC) -v
+egg_test_run = EGG_LANGDIR=$(top_srcdir)/language ./$(EGGEXEC) -v
 
 post_config  =  echo "" && \
 		echo "You can now compile the bot, using \"make\"." && \
@@ -85,7 +92,8 @@
 'XLIBS=$(XLIBS)' 'EGGEXEC=$(EGGEXEC)' 'EGGBUILD=(standard build)' 'MODOBJS='
 
 MAKE_MODULES = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(SHLIB_CC)' 'LD=$(SHLIB_LD)' \
-'STRIP=$(SHLIB_STRIP)' 'CFLGS=$(CFLGS)' 'XLIBS=$(XLIBS)' 'MOD_EXT=$(MOD_EXT)'
+'STRIP=$(SHLIB_STRIP)' 'CFLGS=$(CFLGS)' 'XLIBS=$(XLIBS)' 'MOD_EXT=$(MOD_EXT)' \
+'MODULE_XLIBS=$(MODULE_XLIBS)'
 
 MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
 'STRIP=$(STRIP)' 'RANLIB=$(RANLIB)' 'CFLGS=$(CFLGS) -DSTATIC' \
@@ -100,7 +108,7 @@
 
 MAKE_DEBMODULES = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(SHLIB_CC)' 'LD=$(SHLIB_LD)' \
 'XLIBS=$(XLIBS)' 'STRIP=touch' 'CFLGS=-g3 $(DEBCFLAGS) $(CFLGS)' \
-'MOD_EXT=$(MOD_EXT)'
+'MOD_EXT=$(MOD_EXT)' 'MODULE_XLIBS=$(MODULE_XLIBS)'
 
 MAKE_SDEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD) -g' \
 'STRIP=touch' 'RANLIB=$(RANLIB)' 'CFLGS=-g3 $(DEBCFLAGS) -DSTATIC $(CFLGS)' \
Index: eggdrop1.6/aclocal.m4
diff -u eggdrop1.6/aclocal.m4:1.91 eggdrop1.6/aclocal.m4:1.92
--- eggdrop1.6/aclocal.m4:1.91	Wed Jun 16 01:53:03 2004
+++ eggdrop1.6/aclocal.m4	Sun Jul 25 06:17:33 2004
@@ -16,18 +16,24 @@
 dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 dnl
-dnl $Id: aclocal.m4,v 1.91 2004/06/16 06:53:03 wcc Exp $
+dnl $Id: aclocal.m4,v 1.92 2004/07/25 11:17:33 wcc Exp $
 dnl
 
+
+dnl
+dnl Message functions.
+dnl
+
+
 dnl EGG_MSG_CONFIGURE_START()
 dnl
 AC_DEFUN([EGG_MSG_CONFIGURE_START],
 [
-  AC_MSG_RESULT()
+  AC_MSG_RESULT
   AC_MSG_RESULT([This is Eggdrop's GNU configure script.])
   AC_MSG_RESULT([It's going to run a bunch of tests to hopefully make your compile])
   AC_MSG_RESULT([work without much twiddling.])
-  AC_MSG_RESULT()
+  AC_MSG_RESULT
 ])
 
 
@@ -35,17 +41,65 @@
 dnl
 AC_DEFUN([EGG_MSG_CONFIGURE_END],
 [
-  AC_MSG_RESULT()
-  AC_MSG_RESULT([Configure is done.])
-  AC_MSG_RESULT()
   AC_MSG_RESULT([Type 'make config' to configure the modules, or type 'make iconfig'])
   AC_MSG_RESULT([to interactively choose which modules to compile.])
-  AC_MSG_RESULT()
+  AC_MSG_RESULT
+])
+
+
+dnl EGG_MSG_WEIRDOS
+dnl
+dnl Print some messages at the end of configure to give extra information to
+dnl users of 'weird' operating systems.
+dnl
+AC_DEFUN([EGG_MSG_WEIRDOS],
+[
+  AC_MSG_RESULT([Operating System: $egg_cv_var_system_type $egg_cv_var_system_release])
+  AC_MSG_RESULT
+  if test "$UNKNOWN_OS" = "yes"; then
+    AC_MSG_RESULT([Warning:])
+    AC_MSG_RESULT
+    AC_MSG_RESULT([  Unknown Operating System: $egg_cv_var_system_type $egg_cv_var_system_release])
+    AC_MSG_RESULT
+    AC_MSG_RESULT([  Module support has been disabled for this build.])
+    AC_MSG_RESULT
+    AC_MSG_RESULT([  Please let us know what type of system this is by e-mailing])
+    AC_MSG_RESULT([  bugs at eggheads.org. The output of uname -a, and some other basic])
+    AC_MSG_RESULT([  information about the OS should be included.])
+    AC_MSG_RESULT
+  else
+    if test "$WEIRD_OS" = "yes"; then
+      AC_MSG_RESULT([Warning:])
+      AC_MSG_RESULT
+      AC_MSG_RESULT([  The operating system you are using has not yet had a great])
+      AC_MSG_RESULT([  deal of testing with Eggdrop. For this reason, this compile])
+      AC_MSG_RESULT([  will default to "make static".])
+      AC_MSG_RESULT
+      AC_MSG_RESULT([  To enable module support, type "make eggdrop" instead of just])
+      AC_MSG_RESULT([  "make" after you run "make config" (or "make iconfig").])
+      AC_MSG_RESULT
+      AC_MSG_RESULT([  As we have not done a sufficiant ammount of testing on this])
+      AC_MSG_RESULT([  OS, your feedback is greatly appreciated. Please let us know])
+      AC_MSG_RESULT([  at bugs at eggheads.org if there are any problems compiling with])
+      AC_MSG_RESULT([  module support, or if you got it to work :)])
+      AC_MSG_RESULT
+    fi
+    AC_MSG_RESULT([If you experiance any problems compiling Eggdrop, please read the])
+    AC_MSG_RESULT([compile guide, found in doc/COMPILE-FAQ.])
+    AC_MSG_RESULT
+  fi
 ])
 
 
+dnl
+dnl Compiler checks.
+dnl
+
+
 dnl EGG_CHECK_CC()
 dnl
+dnl Check for a working C compiler.
+dnl
 AC_DEFUN([EGG_CHECK_CC],
 [
   if test "${cross_compiling-x}" = "x"; then
@@ -60,6 +114,24 @@
   fi
 ])
 
+
+dnl EGG_HEADER_STDC()
+dnl
+AC_DEFUN([EGG_HEADER_STDC],
+[
+  if test "$ac_cv_header_stdc" = "no"; then
+    cat << 'EOF' >&2
+configure: error:
+
+  Your system must support ANSI C Header files.
+  These are required for the language support. Sorry.
+
+EOF
+    exit 1
+  fi
+])
+
+
 dnl EGG_CHECK_CCPIPE()
 dnl
 dnl This function checks whether or not the compiler supports the `-pipe' flag,
@@ -93,8 +165,45 @@
 ])
 
 
+dnl EGG_CHECK_CCWALL()
+dnl
+dnl See if the compiler supports -Wall.
+dnl
+AC_DEFUN([EGG_CHECK_CCWALL],
+[
+  if test -n "$GCC"; then
+    AC_CACHE_CHECK([whether the compiler understands -Wall], egg_cv_var_ccwall, [
+      ac_old_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -Wall"
+       AC_COMPILE_IFELSE([[
+         int main ()
+         {
+           return(0);
+         }
+       ]], [
+         egg_cv_var_ccwall="yes"
+       ], [
+         egg_cv_var_ccwall="no"
+       ])
+      CFLAGS="$ac_old_CFLAGS"
+    ])
+
+    if test "$egg_cv_var_ccwall" = "yes"; then
+      CFLAGS="$CFLAGS -Wall"
+    fi
+  fi
+])
+
+
+dnl
+dnl Checks for types and functions.
+dnl
+
+
 dnl EGG_CHECK_SOCKLEN_T()
 dnl
+dnl Check for the socklen_t type.
+dnl
 AC_DEFUN([EGG_CHECK_SOCKLEN_T],
 [
   AC_CACHE_CHECK([for socklen_t], egg_cv_socklen_t, [
@@ -130,6 +239,29 @@
 ])
 
 
+dnl EGG_FUNC_VPRINTF()
+dnl
+AC_DEFUN([EGG_FUNC_VPRINTF],
+[
+  AC_FUNC_VPRINTF
+  if test "$ac_cv_func_vprintf" = "no"; then
+    cat << 'EOF' >&2
+configure: error:
+
+  Your system does not have the vprintf/vsprintf/sprintf libraries.
+  These are required to compile almost anything. Sorry.
+
+EOF
+    exit 1
+  fi
+])
+
+
+dnl
+dnl Checks for programs.
+dnl
+
+
 dnl EGG_PROG_HEAD_1()
 dnl
 dnl This function checks for the proper 'head -1' command variant to use.
@@ -241,42 +373,233 @@
   fi
 ])
 
+
+dnl
+dnl Checks for operating system and module support.
+dnl
+
+
+dnl EGG_OS_VERSION()
+dnl
+AC_DEFUN([EGG_OS_VERSION],
+[
+  AC_CACHE_CHECK([system type], egg_cv_var_system_type, [egg_cv_var_system_type=`$UNAME -s`])
+  AC_CACHE_CHECK([system release], egg_cv_var_system_release, [egg_cv_var_system_release=`$UNAME -r`])
+])
+
+
+dnl EGG_CYGWIN_BINMODE
+dnl
+dnl Check for binmode.o on Cygwin.
+dnl
+AC_DEFUN([EGG_CYGWIN_BINMODE],
+[
+  if test $EGG_CYGWIN = "yes"; then
+    AC_MSG_CHECKING([for /usr/lib/binmode.o])
+    if test -r /usr/lib/binmode.o; then
+      AC_MSG_RESULT([yes])
+      LIBS="$LIBS /usr/lib/binmode.o"
+    else
+      AC_MSG_RESULT([no])
+      AC_MSG_WARN([Make sure the directory Eggdrop is installed into is mounted in binary mode.])
+    fi
+  fi
+])
+
+
+dnl EGG_DARWIN_BUNDLE
+dnl
+dnl Locate bundle1.o on Darwin. Test systems seem to have it in /usr/lib,
+dnl however the official docs say /lib.
+dnl
+AC_DEFUN([EGG_DARWIN_BUNDLE],
+[
+  BUNDLE=""
+  for bundlepath in "/lib" "/usr/lib" "/usr/local/lib"; do
+    AC_MSG_CHECKING([for bundle1.o in ${bundlepath}])
+    if test -r "${bundlepath}/bundle1.o"; then
+      AC_MSG_RESULT([yes])
+      BUNDLE="${bundlepath}/bundle1.o"
+      break
+    else
+      AC_MSG_RESULT([no])
+    fi
+  done
+
+  if test "x${BUNDLE}" = "x"; then
+    cat << 'EOF' >&2
+configure: warning:
+
+  bundle1.o cannot be located. A module build might not compile correctly.
+
+EOF
+  fi
+])
+
+
+dnl EGG_CHECK_MODULE_SUPPORT()
+dnl
+dnl Checks for module support. This should be run after EGG_OS_VERSION.
+dnl
+AC_DEFUN([EGG_CHECK_MODULE_SUPPORT],
+[
+  MODULES_OK="yes"
+  MOD_EXT="so"
+  DEFAULT_MAKE="debug"
+  LOAD_METHOD="dl"
+  WEIRD_OS="yes"
+  UNKNOWN_OS="no"
+  MODULE_XLIBS=""
+
+  AC_MSG_CHECKING([module loading capabilities])
+  AC_MSG_RESULT
+  AC_CHECK_HEADERS([dl.h dlfcn.h loader.h rld.h mach-o/dyld.h mach-o/rld.h])
+  AC_CHECK_FUNCS([dlopen load NSLinkModule shl_load rld_load])
+
+  case "$egg_cv_var_system_type" in
+    BSD/OS)
+      if test "`echo $egg_cv_var_system_release | cut -d . -f 1`" = "2"; then
+        MODULES_OK="no"
+      fi
+    ;;
+    CYGWI*)
+      WEIRD_OS="no"
+      MOD_EXT="dll"
+    ;;
+    HP-UX)
+      LOAD_METHOD="shl"
+    ;;
+    dell)
+      # Fallthrough.
+    ;;
+    IRIX)
+      # Fallthrough.
+    ;;
+    Ultrix)
+      # No dlopen() or similar on Ultrix. We can't use modules.
+      MODULES_OK="no"
+    ;;
+    BeOS)
+      # We don't yet support BeOS's dynamic linking interface.
+      MODULES_OK="no"
+    ;;
+    Linux)
+      WEIRD_OS="no"
+    ;;
+    Lynx)
+      # Fallthrough.
+    ;;
+    QNX)
+      # Fallthrough.
+      # QNX (recent versions at least) support dlopen().
+    ;;
+    OSF1)
+      case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
+        1.*) LOAD_METHOD="loader" ;;
+      esac
+    ;;
+    SunOS)
+      if test "`echo $egg_cv_var_system_release | cut -d . -f 1`" = "5"; then
+        # We've had quite a bit of testing on Solaris.
+        WEIRD_OS="no"
+      else
+        # SunOS 4
+        AC_DEFINE(DLOPEN_1, 1, [Define if running on SunOS 4.0.])
+      fi
+    ;;
+    *BSD)
+      # FreeBSD/OpenBSD/NetBSD all support dlopen() and have had plenty of
+      # testing with Eggdrop.
+      WEIRD_OS="no"
+    ;;
+    Darwin)
+      # We should support Mac OS X (at least 10.1 and later) now.
+      # Use rld on < 10.1.
+      if test "$ac_cv_func_NSLinkModule" = "no"; then
+        LOAD_METHOD="rld"
+      fi
+      LOAD_METHOD="dyld"
+      EGG_DARWIN_BUNDLE
+      MODULE_XLIBS="${BUNDLE} ${MODULE_XLIBS}"
+    ;;
+    *)
+      if test -r /mach; then
+        # At this point, we're guessing this is NeXT Step. We support rld, so
+        # modules will probably work on NeXT now, but we have absolutly no way
+        # to test this. I've never even seen a NeXT box, let alone do I know of
+        # one I can test this on.
+        LOAD_METHOD="rld"
+      else
+        # QNX apparently supports dlopen()... Fallthrough.
+        if test -r /cmds; then
+          UNKNOWN_OS="yes"
+          MODULES_OK="no"
+        fi
+      fi
+    ;;
+  esac
+
+  if test "$MODULES_OK" = "yes"; then
+    AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
+    case $LOAD_METHOD in
+      dl)
+        AC_DEFINE(MOD_USE_DL, 1, [Define if modules should be loaded using the dl*() functions.])
+      ;;
+      shl)
+        AC_DEFINE(MOD_USE_SHL, 1, [Define if modules should be loaded using the shl_*() functions.])
+      ;;
+      dyld)
+        AC_DEFINE(MOD_USE_DYLD, 1, [Define if modules should be loaded using the NS*() functions.])
+      ;;
+      loader)
+        AC_DEFINE(MOD_USE_LOADER, 1, [Define if modules should be loaded using the ldr*() and *load() functions.])
+      ;;
+      rld)
+        AC_DEFINE(MOD_USE_RLD, 1, [Define if modules should be loaded using the rld_*() functions.])
+      ;;
+    esac
+  else
+    DEFAULT_MAKE="static"
+  fi
+
+  if test "$WEIRD_OS" = "yes"; then
+    # Default to "make static" for 'weird' operating systems. Will print a
+    # note at the end of configure explaining. This way, Eggdrop should compile
+    # "out of the box" on most every operating system we know of, and they can
+    # do a "make eggdrop" if they want to use(/try to use) module support. - Wcc
+    DEFAULT_MAKE="static"
+  fi
+
+  AC_SUBST(DEFAULT_MAKE)
+  AC_SUBST(MOD_EXT)
+  AC_SUBST(MODULE_XLIBS)
+  AC_DEFINE_UNQUOTED(EGG_MOD_EXT, "$MOD_EXT", [Defines the extension of Eggdrop modules.])
+])
+
+
 dnl EGG_CHECK_OS()
 dnl
-dnl FIXME/NOTICE:
-dnl   This function is obsolete. Any NEW code/checks should be written as
-dnl   individual tests that will be checked on ALL operating systems.
+dnl Various operating system tests.
 dnl
 AC_DEFUN([EGG_CHECK_OS],
 [
-  LINUX="no"
-  IRIX="no"
-  SUNOS="no"
-  HPUX="no"
-  EGG_CYGWIN="no"
   MOD_CC="$CC"
   MOD_LD="$CC"
   MOD_STRIP="$STRIP"
   SHLIB_CC="$CC"
   SHLIB_LD="$CC"
   SHLIB_STRIP="$STRIP"
-  NEED_DL=1
-  DEFAULT_MAKE="debug"
-  MOD_EXT="so"
-
-  AC_CACHE_CHECK([system type],
-                 egg_cv_var_system_type,
-                 [egg_cv_var_system_type=`$UNAME -s`])
-  AC_CACHE_CHECK([system release],
-                 egg_cv_var_system_release,
-                 [egg_cv_var_system_release=`$UNAME -r`])
+  LINUX="no"
+  IRIX="no"
+  SUNOS="no"
+  HPUX="no"
+  EGG_CYGWIN="no"
 
   case "$egg_cv_var_system_type" in
     BSD/OS)
       case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
         2)
-          NEED_DL=0
-          DEFAULT_MAKE="static"
+          # Fallthrough.
         ;;
         3)
           MOD_CC="shlicc"
@@ -286,46 +609,24 @@
           fi
           SHLIB_LD="shlicc -r"
           SHLIB_STRIP="touch"
-          AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
         ;;
         *)
-          CFLAGS="$CFLAGS -Wall"
-          MOD_LD="$CC"
           if test ! "$STRIP" = "touch"; then
             MOD_STRIP="$STRIP -d"
           fi
           SHLIB_CC="$CC -export-dynamic -fPIC"
           SHLIB_LD="$CC -shared -nostartfiles"
-          AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
         ;;
       esac
     ;;
     CYGWI*)
-      case "`echo $egg_cv_var_system_release | cut -c 1-3`" in
-        1.*)
-          NEED_DL=0
-          SHLIB_LD="$CC -shared"
-          AC_PROG_CC_WIN32
-          CC="$CC $WIN32FLAGS"
-          MOD_CC="$CC"
-          MOD_LD="$CC"
-          AC_MSG_CHECKING([for /usr/lib/binmode.o])
-          if test -r /usr/lib/binmode.o; then
-            AC_MSG_RESULT([yes])
-            LIBS="$LIBS /usr/lib/binmode.o"
-          else
-            AC_MSG_RESULT([no])
-            AC_MSG_WARN([Make sure the directory Eggdrop is installed into is mounted in binary mode.])
-          fi
-          MOD_EXT="dll"
-          AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
-        ;;
-        *)
-          NEED_DL=0
-          DEFAULT_MAKE="static"
-        ;;
-      esac
+      AC_PROG_CC_WIN32
+      SHLIB_LD="$CC -shared"
+      CC="$CC $WIN32FLAGS"
+      MOD_CC="$CC"
+      MOD_LD="$CC"
       EGG_CYGWIN="yes"
+      EGG_CYGWIN_BINMODE
       AC_DEFINE(CYGWIN_HACKS, 1, [Define if running under Cygwin.])
     ;;
     HP-UX)
@@ -334,96 +635,65 @@
         # HP-UX ANSI C Compiler.
         MOD_LD="$CC +z"
         SHLIB_CC="$CC +z"
-        AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
       else
         # GCC
         MOD_LD="$CC -fPIC -shared"
         SHLIB_CC="$CC -fPIC"
       fi
       SHLIB_LD="ld -b"
-      NEED_DL=0
-      AC_DEFINE(HPUX_HACKS, 1, [Define if running on HPUX that supports dynamic linking.])
-      if test "`echo $egg_cv_var_system_release | cut -d . -f 2`" = "10"; then
-        AC_DEFINE(HPUX10_HACKS, 1, [Define if running on HPUX 10.x.])
-      fi
     ;;
     dell)
-      AC_MSG_RESULT(Dell SVR4)
       SHLIB_STRIP="touch"
-      NEED_DL=0
       MOD_LD="$CC -lelf -lucb"
     ;;
     IRIX)
       SHLIB_LD="ld -n32 -shared -rdata_shared"
       IRIX="yes"
       SHLIB_STRIP="touch"
-      NEED_DL=0
-      DEFAULT_MAKE="static"
     ;;
     Ultrix)
-      NEED_DL=0
       SHLIB_STRIP="touch"
       DEFAULT_MAKE="static"
       SHELL="/bin/sh5"
     ;;
     SINIX*)
-      NEED_DL=0
       SHLIB_STRIP="touch"
-      DEFAULT_MAKE="static"
       SHLIB_CC="cc -G"
     ;;
     BeOS)
-      NEED_DL=0
-      DEFAULT_MAKE="static"
+      # Fallthrough.
     ;;
     Linux)
       LINUX="yes"
-      CFLAGS="$CFLAGS -Wall"
       MOD_LD="$CC"
       SHLIB_CC="$CC -fPIC"
       SHLIB_LD="$CC -shared -nostartfiles"
-      AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
     ;;
     Lynx)
-      NEED_DL=0
-      DEFAULT_MAKE="static"
+      # Fallthrough.
     ;;
     QNX)
-      NEED_DL=0
-      DEFAULT_MAKE="static"
       SHLIB_LD="ld -shared"
     ;;
     OSF1)
       case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
         V*)
-          # FIXME: we should check this in a separate test
           # Digital OSF uses an ancient version of gawk
           if test "$AWK" = "gawk"; then
             AWK="awk"
           fi
           SHLIB_LD="ld -shared -expect_unresolved \"'*'\""
           SHLIB_STRIP="touch"
-          AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
         ;;
         1.0|1.1|1.2)
           SHLIB_LD="ld -R -export $@:"
-          AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.])
-          AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
-          AC_DEFINE(OSF1_HACKS, 1, [Define if running on OSF/1 platform.])
         ;;
         1.*)
           SHLIB_CC="$CC -fpic"
           SHLIB_LD="ld -shared"
-          AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.])
-          AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
-          AC_DEFINE(OSF1_HACKS, 1, [Define if running on OSF/1 platform.])
-        ;;
-        *)
-          AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.])
-          NEED_DL=0
-          DEFAULT_MAKE="static"
         ;;
       esac
+      AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.])
       AC_DEFINE(STOP_UAC, 1, [Define if running on OSF/1 platform.])
     ;;
     SunOS)
@@ -441,59 +711,46 @@
         SUNOS="yes"
         SHLIB_LD="ld"
         SHLIB_CC="$CC -PIC"
-        AC_DEFINE(DLOPEN_1, 1, [Define if running on SunOS 4.0.])
       fi
-      AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
     ;;
     *BSD)
       # FreeBSD/OpenBSD/NetBSD
       SHLIB_CC="$CC -fPIC"
       SHLIB_LD="ld -Bshareable -x"
-      AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
     ;;
     Darwin)
       # Mac OS X
       SHLIB_CC="$CC -fPIC"
-      SHLIB_LD="ld -Bshareable -x"
-      AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
+      SHLIB_LD="ld -bundle -undefined error"
     ;;
     *)
-      AC_MSG_CHECKING([if system is Mach based])
       if test -r /mach; then
-        AC_MSG_RESULT([yes])
-        NEED_DL=0
-        DEFAULT_MAKE="static"
+        # At this point, we're guessing this is NeXT Step.
         AC_DEFINE(BORGCUBES, 1, [Define if running on NeXT Step.])
       else
-        AC_MSG_RESULT([no])
-        AC_MSG_CHECKING([if system is QNX])
         if test -r /cmds; then
-          AC_MSG_RESULT([yes])
+          # Probably QNX.
+          SHLIB_LD="ld -shared"
           SHLIB_STRIP="touch"
-          NEED_DL=0
-          DEFAULT_MAKE="static"
-        else
-          AC_MSG_RESULT([no])
-          AC_MSG_RESULT([unknown])
-          AC_MSG_RESULT([If you get modules to work, be sure to let the development team know how (eggdev at eggheads.org).])
-          NEED_DL=0
-          DEFAULT_MAKE="static"
         fi
       fi
     ;;
   esac
+
   AC_SUBST(MOD_LD)
   AC_SUBST(MOD_CC)
   AC_SUBST(MOD_STRIP)
   AC_SUBST(SHLIB_LD)
   AC_SUBST(SHLIB_CC)
   AC_SUBST(SHLIB_STRIP)
-  AC_SUBST(DEFAULT_MAKE)
-  AC_SUBST(MOD_EXT)
-  AC_DEFINE_UNQUOTED(EGG_MOD_EXT, "$MOD_EXT", [Defines the extension of Eggdrop modules.])
 ])
 
 
+dnl
+dnl Library tests.
+dnl
+
+
 dnl EGG_CHECK_LIBS()
 dnl
 AC_DEFUN([EGG_CHECK_LIBS],
@@ -507,6 +764,7 @@
     AC_CHECK_LIB(dns, gethostbyname)
     AC_CHECK_LIB(dl, dlopen)
     AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm")
+
     # This is needed for Tcl libraries compiled with thread support
     AC_CHECK_LIB(pthread, pthread_mutex_init, [
       ac_cv_lib_pthread_pthread_mutex_init="yes"
@@ -542,40 +800,6 @@
 ])
 
 
-dnl EGG_FUNC_VPRINTF()
-dnl
-AC_DEFUN([EGG_FUNC_VPRINTF],
-[
-  if test "$ac_cv_func_vprintf" = "no"; then
-    cat << 'EOF' >&2
-configure: error:
-
-  Your system does not have the vprintf/vsprintf/sprintf libraries.
-  These are required to compile almost anything. Sorry.
-
-EOF
-    exit 1
-  fi
-])
-
-
-dnl EGG_HEADER_STDC()
-dnl
-AC_DEFUN([EGG_HEADER_STDC],
-[
-  if test "$ac_cv_header_stdc" = "no"; then
-    cat << 'EOF' >&2
-configure: error:
-
-  Your system must support ANSI C Header files.
-  These are required for the language support. Sorry.
-
-EOF
-    exit 1
-  fi
-])
-
-
 dnl EGG_CHECK_LIBSAFE_SSCANF()
 dnl
 AC_DEFUN([EGG_CHECK_LIBSAFE_SSCANF],
@@ -609,6 +833,11 @@
 ])
 
 
+dnl
+dnl Misc checks.
+dnl
+
+
 dnl EGG_EXEEXT()
 dnl
 dnl Test for executable suffix and define Eggdrop's executable name accordingly.
@@ -617,22 +846,23 @@
   EGGEXEC="eggdrop"
   AC_EXEEXT
   if test ! "${EXEEXT-x}" = "x"; then
-    EGGEXEC="eggdrop$EXEEXT"
+    EGGEXEC="eggdrop${EXEEXT}"
   fi
   AC_SUBST(EGGEXEC)
 ])
 
 
+dnl
+dnl Tcl checks.
+dnl
+
+
 dnl EGG_TCL_ARG_WITH()
 dnl
 AC_DEFUN([EGG_TCL_ARG_WITH],
 [
-  AC_ARG_WITH(tcllib,
-              [  --with-tcllib=PATH      full path to Tcl library],
-              [tcllibname="$withval"])
-  AC_ARG_WITH(tclinc,
-              [  --with-tclinc=PATH      full path to Tcl header],
-              [tclincname="$withval"])
+  AC_ARG_WITH(tcllib, [  --with-tcllib=PATH      full path to Tcl library], [tcllibname="$withval"])
+  AC_ARG_WITH(tclinc, [  --with-tclinc=PATH      full path to Tcl header],  [tclincname="$withval"])
 
   WARN=0
   # Make sure either both or neither $tcllibname and $tclincname are set
@@ -651,6 +881,7 @@
       TCLINC=""
     fi
   fi
+
   if test "$WARN" = 1; then
     cat << 'EOF' >&2
 configure: warning:
@@ -685,12 +916,14 @@
       TCLINC=""
     fi
   fi
+
   if test "$WARN" = 1; then
     cat << EOF >&2
 configure: warning:
 
   Environment variable $WVAR1 was set, but I did not detect ${WVAR2}.
   Please set both TCLLIB and TCLINC correctly if you wish to use them.
+
   configure will now attempt to autodetect both the Tcl library and header.
 
 EOF
@@ -714,6 +947,7 @@
 configure: warning:
 
   The file '$tcllibname' given to option --with-tcllib is not valid.
+
   configure will now attempt to autodetect both the Tcl library and header.
 
 EOF
@@ -742,6 +976,7 @@
 configure: warning:
 
   The file '$tclincname' given to option --with-tclinc is not valid.
+
   configure will now attempt to autodetect both the Tcl library and header.
 
 EOF
@@ -761,34 +996,34 @@
 AC_DEFUN([EGG_TCL_FIND_LIBRARY],
 [
   # Look for Tcl library: if $TCLLIB is set, check there first
-  if test "${TCLLIBFN-x}" = "x"; then
-    if test ! "${TCLLIB-x}" = "x"; then
-      if test -d "$TCLLIB"; then
-        for tcllibfns in $tcllibnames; do
-          for tcllibext in $tcllibextensions; do
-            if test -r "${TCLLIB}/lib${tcllibfns}${tcllibext}"; then
-              TCLLIBFN="${tcllibfns}${tcllibext}"
-              TCLLIBEXT="$tcllibext"
-              TCLLIBFNS="$tcllibfns"
-              break 2
-            fi
-          done
+  if test "${TCLLIBFN-x}" = "x" && test ! "${TCLLIB-x}" = "x"; then
+    if test -d "$TCLLIB"; then
+      for tcllibfns in $tcllibnames; do
+        for tcllibext in $tcllibextensions; do
+          if test -r "${TCLLIB}/lib${tcllibfns}${tcllibext}"; then
+            TCLLIBFN="${tcllibfns}${tcllibext}"
+            TCLLIBEXT="$tcllibext"
+            TCLLIBFNS="$tcllibfns"
+            break 2
+          fi
         done
-      fi
-      if test "${TCLLIBFN-x}" = "x"; then
-        cat << 'EOF' >&2
+      done
+    fi
+
+    if test "${TCLLIBFN-x}" = "x"; then
+      cat << 'EOF' >&2
 configure: warning:
 
   Environment variable TCLLIB was set, but incorrectly.
   Please set both TCLLIB and TCLINC correctly if you wish to use them.
+
   configure will now attempt to autodetect both the Tcl library and header.
 
 EOF
-        TCLLIB=""
-        TCLLIBFN=""
-        TCLINC=""
-        TCLINCFN=""
-      fi
+      TCLLIB=""
+      TCLLIBFN=""
+      TCLINC=""
+      TCLINCFN=""
     fi
   fi
 ])
@@ -799,30 +1034,30 @@
 AC_DEFUN([EGG_TCL_FIND_HEADER],
 [
   # Look for Tcl header: if $TCLINC is set, check there first
-  if test "${TCLINCFN-x}" = "x"; then
-    if test ! "${TCLINC-x}" = "x"; then
-      if test -d "$TCLINC"; then
-        for tclheaderfn in $tclheadernames; do
-          if test -r "${TCLINC}/${tclheaderfn}"; then
-            TCLINCFN="$tclheaderfn"
-            break
-          fi
-        done
-      fi
-      if test "${TCLINCFN-x}" = "x"; then
-        cat << 'EOF' >&2
+  if test "${TCLINCFN-x}" = "x" && test ! "${TCLINC-x}" = "x"; then
+    if test -d "$TCLINC"; then
+      for tclheaderfn in $tclheadernames; do
+        if test -r "${TCLINC}/${tclheaderfn}"; then
+          TCLINCFN="$tclheaderfn"
+          break
+        fi
+      done
+    fi
+
+    if test "${TCLINCFN-x}" = "x"; then
+      cat << 'EOF' >&2
 configure: warning:
 
   Environment variable TCLINC was set, but incorrectly.
   Please set both TCLLIB and TCLINC correctly if you wish to use them.
+
   configure will now attempt to autodetect both the Tcl library and header.
 
 EOF
-        TCLLIB=""
-        TCLLIBFN=""
-        TCLINC=""
-        TCLINCFN=""
-      fi
+      TCLLIB=""
+      TCLLIBFN=""
+      TCLINC=""
+      TCLINCFN=""
     fi
   fi
 ])
@@ -858,6 +1093,7 @@
   if test "${TCLLIBFN-x}" = "x"; then
     AC_MSG_RESULT([not found])
   fi
+
   AC_SUBST(TCLLIB)
   AC_SUBST(TCLLIBFN)
 ])
@@ -904,6 +1140,7 @@
   if test "${TCLINCFN-x}" = "x"; then
     AC_MSG_RESULT({not found})
   fi
+
   AC_SUBST(TCLINC)
   AC_SUBST(TCLINCFN)
 ])
@@ -966,6 +1203,7 @@
     if test "$egg_tcl_changed" = "yes"; then
       EGG_CACHE_UNSET(egg_cv_var_tcl_version)
     fi
+
     AC_MSG_CHECKING([for Tcl version])
     AC_CACHE_VAL(egg_cv_var_tcl_version, [
       egg_cv_var_tcl_version=`grep TCL_VERSION $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`
@@ -1005,8 +1243,10 @@
   Eggdrop requires Tcl to compile. If you already have Tcl installed on
   this system, and I just wasn't looking in the right place for it, re-run
   ./configure using the --with-tcllib='/path/to/libtcl.so' and
-  --with-tclinc='/path/to/tcl.h' options. See doc/COMPILING's 'Tcl Detection
-  and Installation' section for more information.
+  --with-tclinc='/path/to/tcl.h' options.
+
+  See doc/COMPILING-FAQ's 'Tcl Detection and Installation' section for more
+  information.
 
 EOF
     exit 1
@@ -1027,8 +1267,10 @@
   Your Tcl version is much too old for Eggdrop to use. You should
   download and compile a more recent version. The most reliable
   current version is $tclrecommendver and can be downloaded from
-  ${tclrecommendsite}. See doc/COMPILING's 'Tcl
-  Detection and Installation' section for more information.
+  ${tclrecommendsite}.
+
+  See doc/COMPILING-FAQ's 'Tcl Detection and Installation' section
+  for more information.
 
 EOF
     exit 1
@@ -1070,10 +1312,7 @@
 dnl
 AC_DEFUN([EGG_TCL_ENABLE_THREADS],
 [
-  AC_ARG_ENABLE(tcl-threads,
-                [  --disable-tcl-threads   disable threaded Tcl support if detected ],
-                [enable_tcl_threads="$enableval"],
-                [enable_tcl_threads="yes"])
+  AC_ARG_ENABLE(tcl-threads, [  --disable-tcl-threads   disable threaded Tcl support if detected ], [enable_tcl_threads="$enableval"], [enable_tcl_threads="yes"])
 ])
 
 
@@ -1160,65 +1399,12 @@
       fi
     fi
   fi
+
   AC_SUBST(TCL_REQS)
   AC_SUBST(TCL_LIBS)
 ])
 
 
-dnl EGG_FUNC_DLOPEN()
-dnl
-AC_DEFUN([EGG_FUNC_DLOPEN],
-[
-  if test "$NEED_DL" = 1 && test "$ac_cv_func_dlopen" = "no"; then
-    if test "$LINUX" = "yes"; then
-      cat << 'EOF' >&2
-configure: warning:
-
-  libdl cannot be found. Since you are on a Linux system, this is a known
-  problem. A kludge is known for it,
-EOF
-
-      if test -r "/lib/libdl.so.1"; then
-        cat << 'EOF' >&2
-  and you seem to have it. We'll use that.
-
-EOF
-        AC_DEFINE(HAVE_DLOPEN, 1, [Define if we have/need dlopen() (for module support).])
-        LIBS="/lib/libdl.so.1 $LIBS"
-      else
-        cat << 'EOF' >&2
-  which you DON'T seem to have... doh! If you do have dlopen on your system,
-  and manage to figure out where it's located, add it to your XLIBS= lines
-  and #define HAVE_DLOPEN in config.h. We'll proceed on anyway, but you
-  probably won't be able to 'make eggdrop'. The default make will now be set
-  to static.
-
-  If you do manage to get modules working on this system, please let the
-  development team know how (eggdev at eggheads.org).
-
-EOF
-        DEFAULT_MAKE="static"
-      fi
-    else
-      cat << 'EOF' >&2
-configure: warning:
-
-  dlopen could not be found on this system. If you do have dlopen on your
-  system, and manage to figure out where it's located, add it to your XLIBS=
-  lines and #define HAVE_DLOPEN in config.h. We'll proceed on anyway, but you
-  probably won't be able to 'make eggdrop'. The default make will now be set
-  to static.
-
-  If you do manage to get modules working on this system, please let the
-  development team know how (eggdev at eggheads.org).
-
-EOF
-      DEFAULT_MAKE="static"
-    fi
-  fi
-])
-
-
 dnl EGG_SUBST_EGGVERSION()
 dnl
 AC_DEFUN([EGG_SUBST_EGGVERSION],
Index: eggdrop1.6/config.h.in
diff -u eggdrop1.6/config.h.in:1.42 eggdrop1.6/config.h.in:1.43
--- eggdrop1.6/config.h.in:1.42	Fri Jul  2 15:48:51 2004
+++ eggdrop1.6/config.h.in	Sun Jul 25 06:17:34 2004
@@ -34,9 +34,15 @@
    */
 #undef HAVE_DIRENT_H
 
-/* Define if we have/need dlopen() (for module support). */
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `dlopen' function. */
 #undef HAVE_DLOPEN
 
+/* Define to 1 if you have the <dl.h> header file. */
+#undef HAVE_DL_H
+
 /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
 #undef HAVE_DOPRNT
 
@@ -85,9 +91,21 @@
 /* Define to 1 if you have the <limits.h> header file. */
 #undef HAVE_LIMITS_H
 
+/* Define to 1 if you have the `load' function. */
+#undef HAVE_LOAD
+
+/* Define to 1 if you have the <loader.h> header file. */
+#undef HAVE_LOADER_H
+
 /* Define to 1 if you have the <locale.h> header file. */
 #undef HAVE_LOCALE_H
 
+/* Define to 1 if you have the <mach-o/dyld.h> header file. */
+#undef HAVE_MACH_O_DYLD_H
+
+/* Define to 1 if you have the <mach-o/rld.h> header file. */
+#undef HAVE_MACH_O_RLD_H
+
 /* Define to 1 if you have the `mbrlen' function. */
 #undef HAVE_MBRLEN
 
@@ -112,15 +130,27 @@
 /* Define to 1 if you have the <netinet/in.h> header file. */
 #undef HAVE_NETINET_IN_H
 
+/* Define to 1 if you have the `NSLinkModule' function. */
+#undef HAVE_NSLINKMODULE
+
 /* Define to 1 if you have the `random' function. */
 #undef HAVE_RANDOM
 
 /* Define to 1 if you have the `rename' function. */
 #undef HAVE_RENAME
 
+/* Define to 1 if you have the <rld.h> header file. */
+#undef HAVE_RLD_H
+
+/* Define to 1 if you have the `rld_load' function. */
+#undef HAVE_RLD_LOAD
+
 /* Define to 1 if you have the `setpgid' function. */
 #undef HAVE_SETPGID
 
+/* Define to 1 if you have the `shl_load' function. */
+#undef HAVE_SHL_LOAD
+
 /* Define to 1 if you have the `sigaction' function. */
 #undef HAVE_SIGACTION
 
@@ -230,20 +260,27 @@
 /* Define to 1 if you have the <wchar.h> header file. */
 #undef HAVE_WCHAR_H
 
-/* Define if running on HPUX 10.x. */
-#undef HPUX10_HACKS
-
-/* Define if running on HPUX that supports dynamic linking. */
-#undef HPUX_HACKS
-
 /* Define if you have a version of libsafe with a broken sscanf(). */
 #undef LIBSAFE_HACKS
 
 /* Define if modules will work on your system. */
 #undef MODULES_OK
 
-/* Define if running on OSF/1 platform. */
-#undef OSF1_HACKS
+/* Define if modules should be loaded using the dl*() functions. */
+#undef MOD_USE_DL
+
+/* Define if modules should be loaded using the NS*() functions. */
+#undef MOD_USE_DYLD
+
+/* Define if modules should be loaded using the ldr*() and *load() functions.
+   */
+#undef MOD_USE_LOADER
+
+/* Define if modules should be loaded using the rld_*() functions. */
+#undef MOD_USE_RLD
+
+/* Define if modules should be loaded using the shl_*() functions. */
+#undef MOD_USE_SHL
 
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
Index: eggdrop1.6/configure.ac
diff -u eggdrop1.6/configure.ac:1.12 eggdrop1.6/configure.ac:1.13
--- eggdrop1.6/configure.ac:1.12	Fri Jul  2 15:48:51 2004
+++ eggdrop1.6/configure.ac	Sun Jul 25 06:17:34 2004
@@ -1,11 +1,11 @@
 dnl configure.ac: this file is processed by autoconf to produce ./configure.
 dnl
-dnl $Id: configure.ac,v 1.12 2004/07/02 20:48:51 wcc Exp $
+dnl $Id: configure.ac,v 1.13 2004/07/25 11:17:34 wcc Exp $
 
 AC_PREREQ(2.59)
 AC_INIT([Eggdrop],[1.6.17],[bugs at eggheads.org])
 AC_COPYRIGHT([Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Eggheads Development Team])
-AC_REVISION($Revision: 1.12 $)
+AC_REVISION($Revision: 1.13 $)
 AC_CONFIG_SRCDIR(src/eggdrop.h)
 AC_CONFIG_AUX_DIR(misc)
 AC_CONFIG_HEADER(config.h)
@@ -25,18 +25,17 @@
 AC_PROG_CC
 EGG_CHECK_CC
 
-
-# Checks for odd operating systems
+# These 3 need to be done before any AC_COMPILE_IFELSE()'s.
 AC_AIX
 AC_ISC_POSIX
 AC_MINIX
 
-
-# Speedup compile
+# Check C compiler characteristics.
+EGG_CHECK_CCWALL
 EGG_CHECK_CCPIPE
 
 
-# Checks for programs
+# Checks for programs.
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 AC_PROG_RANLIB
@@ -48,22 +47,24 @@
 AC_CHECK_PROG(UNAME,uname,uname)
 
 
-# Test the os and set the module linking settings
-EGG_CHECK_OS
+# Checks for system libraries.
+EGG_CHECK_LIBS
 
 
-# Checks for system libraries
-EGG_CHECK_LIBS
+# Test the OS and set the module linking settings.
+EGG_OS_VERSION
+EGG_CHECK_MODULE_SUPPORT
+EGG_CHECK_OS
 
 
-# Checks for header files
+# Checks for header files.
 EGG_HEADER_STDC
 AC_HEADER_DIRENT
 AC_HEADER_TIME
 AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h locale.h netdb.h netinet/in.h std_args.h stdarg.h stddef.h sys/file.h sys/param.h sys/rusage.h sys/select.h sys/socket.h sys/time.h unistd.h wchar.h])
 
 
-# Checks for typedefs, structures, and compiler characteristics
+# Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_C_BIGENDIAN
 AC_C_INLINE
@@ -74,26 +75,25 @@
 EGG_CHECK_SOCKLEN_T
 
 
-# Check the sizes of various types
+# Check the sizes of various types.
 AC_CHECK_SIZEOF(long, 0)
 AC_CHECK_SIZEOF(int, 0)
 AC_CHECK_SIZEOF(short, 0)
 
 
-# Checks for functions and their arguments
-AC_CHECK_FUNCS(clock dlopen dprintf fsync getdtablesize getrusage inet_aton isascii mbrlen memcpy memset random rename setpgid sigaction sigemptyset snprintf srandom strcasecmp strncasecmp uname vsnprintf)
+# Checks for functions and their arguments.
+AC_CHECK_FUNCS([clock dprintf fsync getdtablesize getrusage inet_aton isascii mbrlen memcpy memset random rename setpgid sigaction sigemptyset snprintf srandom strcasecmp strncasecmp uname vsnprintf])
 AC_FUNC_SELECT_ARGTYPES
-AC_FUNC_VPRINTF
 EGG_FUNC_VPRINTF
 AC_FUNC_STRFTIME
 AC_FUNC_MMAP
 
 
-# Make sure we are using the correct result from a broken libsafe sscanf
+# Make sure we are using the correct result from a broken libsafe sscanf().
 EGG_CHECK_LIBSAFE_SSCANF
 
 
-# Check for executable extension
+# Check for executable extension.
 EGG_EXEEXT
 
 
@@ -103,33 +103,33 @@
 tclrecommendsite="ftp://tcl.activestate.com/pub/tcl/tcl8_4/"
 
 
-# Tcl library filename prefixes, suffixes, and search paths
+# Tcl library filename prefixes, suffixes, and search paths.
 tcllibnames="tcl8.4 tcl84 tcl8.3 tcl83 tcl8.2 tcl82 tcl8.1 tcl81 \
              tcl8.0 tcl80 tcl tcl7.6 tcl76 tcl7.5 tcl75 tcl7.4 tcl74 tcl7.3 \
              tcl73 tcl7.2 tcl72 tcl7.1 tcl71 tcl7.0 tcl70 tcl8.5 tcl85"
 tcllibextensions=".so .so.1 .so.1.0 .so.1.2 .a .sl .dll .dylib"
-tcllibpaths="/usr/local/lib /usr/lib /lib \
+tcllibpaths="$HOME/lib $HOME/tcl/lib /usr/local/lib /usr/lib /lib \
              /usr/local/lib/tcl8.4 /usr/local/lib/tcl8.3 \
              /usr/lib/tcl8.4 /usr/lib/tcl8.3 \
              /usr/local/lib/tcl8.5 /usr/lib/tcl8.5 \
              /usr/local/pkgs/tcl/lib /sys/lib \
-             /usr/i486-linuxaout/lib /beos/system/lib \
-             $HOME/lib $HOME/tcl/lib $HOME"
+             /usr/i486-linuxaout/lib /beos/system/lib $HOME"
 
 
 
-# Tcl header filenames and search paths
+# Tcl header filenames and search paths.
 tclheadernames="tcl.h"
-tclheaderpaths="/usr/local/include /usr/include \
+tclheaderpaths="$HOME/include $HOME/tcl/include /usr/local/include /usr/include \
                 /usr/local/include/tcl8.3 /usr/local/include/tcl8.4 \
                 /usr/include/tcl8.3 /usr/include/tcl8.4 \
                 /usr/local/include/tcl8.5 /usr/include/tcl8.5 \
                 /usr/local/pkgs/tcl/include /sys/include \
-                /beos/system/include /beos/devel/include \
-                $HOME/include $HOME/tcl/include $HOME"
+                /beos/system/include /beos/devel/include $HOME"
 
 
-# Misc Tcl checks
+# Misc Tcl checks. We save the cache (if used) here to speed things up if we
+# can't find Tcl.
+AC_CACHE_SAVE
 EGG_TCL_ARG_WITH
 EGG_TCL_ENV
 EGG_TCL_WITH_TCLLIB
@@ -149,11 +149,7 @@
 EGG_TCL_LUSH
 
 
-# dlopen() / module load function checks
-EGG_FUNC_DLOPEN
-
-
-# Substitute Makefile variables
+# Substitute Makefile variables.
 EGG_SUBST_EGGVERSION
 EGG_SUBST_DEST
 EGG_SUBST_MOD_UPDIR
@@ -168,4 +164,6 @@
 
 
 # Display configure end message
+AC_MSG_RESULT
+EGG_MSG_WEIRDOS
 EGG_MSG_CONFIGURE_END
Index: eggdrop1.6/doc/COMPILING-FAQ
diff -u eggdrop1.6/doc/COMPILING-FAQ:1.10 eggdrop1.6/doc/COMPILING-FAQ:1.11
--- eggdrop1.6/doc/COMPILING-FAQ:1.10	Sat Jul 24 22:56:58 2004
+++ eggdrop1.6/doc/COMPILING-FAQ	Sun Jul 25 06:17:34 2004
@@ -1,4 +1,4 @@
-$Id: COMPILING-FAQ,v 1.10 2004/07/25 03:56:58 wcc Exp $
+$Id: COMPILING-FAQ,v 1.11 2004/07/25 11:17:34 wcc Exp $
 
 Eggdrop Compiling Guide
 Last revised: July 09, 2004
@@ -151,10 +151,10 @@
         1. Depending on what shell your using:
 
             bash/ksh:
-              export LD_LIBRARY_PATH='<path to DIRECTORY containing Tcl library>'
+              export LD_LIBRARY_PATH=<path to DIRECTORY containing Tcl library>:${LD_LIBRARY_PATH}
 
             csh/tcsh/tclsh:
-              setenv LD_LIBRARY_PATH '<path to DIRECTORY containing Tcl library>'
+              setenv LD_LIBRARY_PATH <path to DIRECTORY containing Tcl library>:${LD_LIBRARY_PATH}
 
           2. Run the following command from your Eggdrop compilation directory
              (this is all one command):
@@ -310,10 +310,10 @@
           1. Depending on what shell your using:
 
             bash/ksh:
-              export LD_LIBRARY_PATH='<path to DIRECTORY containing Tcl library>'
+              export LD_LIBRARY_PATH=<path to DIRECTORY containing Tcl library>:${LD_LIBRARY_PATH}
 
             csh/tcsh/tclsh:
-              setenv LD_LIBRARY_PATH '<path to DIRECTORY containing Tcl library>'
+              setenv LD_LIBRARY_PATH <path to DIRECTORY containing Tcl library>:${LD_LIBRARY_PATH}
 
             Note that some OS's use a different environment variable to tell
             ld where to look for a library. See the notes for your specific OS
Index: eggdrop1.6/doc/UPDATES1.6
diff -u eggdrop1.6/doc/UPDATES1.6:1.583 eggdrop1.6/doc/UPDATES1.6:1.584
--- eggdrop1.6/doc/UPDATES1.6:1.583	Sat Jul 24 22:56:58 2004
+++ eggdrop1.6/doc/UPDATES1.6	Sun Jul 25 06:17:34 2004
@@ -1,4 +1,4 @@
-$Id: UPDATES1.6,v 1.583 2004/07/25 03:56:58 wcc Exp $
+$Id: UPDATES1.6,v 1.584 2004/07/25 11:17:34 wcc Exp $
 
 Eggdrop Changes (since v1.6.0)
     _____________________________________________________________________
@@ -11,6 +11,16 @@
     ftp://ftp.eggheads.org/pub/eggdrop/UPDATES/
 
   1.6.17:
+    - Cleaned up modules.c and the module configure stuff quite a bit.
+    * Patch by: Wcc
+
+    - Detect Tcl in $HOME/lib and $HOME/tcl/lib first, as to make it easier
+      to allow users to override the system's Tcl version.
+    * Found by: various - Patch by: Wcc
+
+    - We now support module loading under Darwin (Mac OS X) and NeXT Step.
+    * Found by: various - Patch by: Wcc
+
     - Don't try to call tcl_notes if the notes module isn't loaded.
     * Found by: Chris Northwood - Patch by: lordares
 
Index: eggdrop1.6/doc/html/compiling.html
diff -u eggdrop1.6/doc/html/compiling.html:1.29 eggdrop1.6/doc/html/compiling.html:1.30
--- eggdrop1.6/doc/html/compiling.html:1.29	Sat Jul 24 22:56:59 2004
+++ eggdrop1.6/doc/html/compiling.html	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- $Id: compiling.html,v 1.29 2004/07/25 03:56:59 wcc Exp $ -->
+<!-- $Id: compiling.html,v 1.30 2004/07/25 11:17:34 wcc Exp $ -->
 
 <html>
   <head>
@@ -219,14 +219,14 @@
           bash/ksh:
           <blockquote>
 <pre>
-export LD_LIBRARY_PATH=&#39;&lt;path to DIRECTORY containing Tcl library&gt;&#39;
+export LD_LIBRARY_PATH=&lt;path to DIRECTORY containing Tcl library&gt;:${LD_LIBRARY_PATH}
 </pre>
           </blockquote>
 
           csh/tcsh/tclsh:
           <blockquote>
 <pre>
-setenv LD_LIBRARY_PATH &#39;&lt;path to DIRECTORY containing Tcl library&gt;&#39;
+setenv LD_LIBRARY_PATH &lt;path to DIRECTORY containing Tcl library&gt;:${LD_LIBRARY_PATH}
 </pre>
           </blockquote></li>
 
@@ -455,14 +455,14 @@
           bash/ksh:
           <blockquote>
 <pre>
-export LD_LIBRARY_PATH=&#39;&lt;path to DIRECTORY containing Tcl library&gt;&#39;
+export LD_LIBRARY_PATH=&lt;path to DIRECTORY containing Tcl library&gt;:${LD_LIBRARY_PATH}
 </pre>
           </blockquote>
 
           csh/tcsh/tclsh:
           <blockquote>
 <pre>
-setenv LD_LIBRARY_PATH &#39;&lt;path to DIRECTORY containing Tcl library&gt;&#39;
+setenv LD_LIBRARY_PATH &lt;path to DIRECTORY containing Tcl library&gt;:${LD_LIBRARY_PATH}
 </pre>
           </blockquote>
 
Index: eggdrop1.6/src/Makefile.in
diff -u eggdrop1.6/src/Makefile.in:1.19 eggdrop1.6/src/Makefile.in:1.20
--- eggdrop1.6/src/Makefile.in:1.19	Tue Dec  9 16:21:46 2003
+++ eggdrop1.6/src/Makefile.in	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile for src/
-# $Id: Makefile.in,v 1.19 2003/12/09 22:21:46 wcc Exp $
+# $Id: Makefile.in,v 1.20 2004/07/25 11:17:34 wcc Exp $
 
 SHELL = @SHELL@
 top_srcdir = @top_srcdir@
@@ -26,6 +26,7 @@
 MAKE_GENERIC = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
 'STRIP=$(STRIP)' 'CFLGS=$(CFLGS)'
 
+
 doofus:
 	@echo ""
 	@echo "Let's try this from the right directory..."
@@ -33,7 +34,7 @@
 	@cd .. && $(MAKE)
 
 ../$(EGGEXEC): build_msg $(eggdrop_objs) $(XREQS) compile_md5 compatability
-	@echo "Linking eggdrop: $(EGGBUILD)."
+	@echo "Linking eggdrop $(EGGBUILD)."
 	@echo ""
 	@touch mod/mod.xlibs
 	$(LD) -o ../$(EGGEXEC) $(eggdrop_objs) $(MODOBJS) $(XLIBS) md5/md5c.o compat/*.o `cat mod/mod.xlibs`
Index: eggdrop1.6/src/botmsg.c
diff -u eggdrop1.6/src/botmsg.c:1.30 eggdrop1.6/src/botmsg.c:1.31
--- eggdrop1.6/src/botmsg.c:1.30	Mon Jul  5 02:35:16 2004
+++ eggdrop1.6/src/botmsg.c	Sun Jul 25 06:17:34 2004
@@ -5,7 +5,7 @@
  *
  * by Darrin Smith (beldin at light.iinet.net.au)
  *
- * $Id: botmsg.c,v 1.30 2004/07/05 07:35:16 wcc Exp $
+ * $Id: botmsg.c,v 1.31 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -853,7 +853,7 @@
   /* Is user ignoring notes from this source? */
   if (match_noterej(u, from)) {
     if (idx >= 0)
-      dprintf(idx, "%s %s\n", u->handle, "rejected your note.");
+      dprintf(idx, "%s rejected your note.\n", u->handle);
     return NOTE_REJECT;
   }
 
Index: eggdrop1.6/src/chanprog.c
diff -u eggdrop1.6/src/chanprog.c:1.56 eggdrop1.6/src/chanprog.c:1.57
--- eggdrop1.6/src/chanprog.c:1.56	Sun Jun 13 20:14:06 2004
+++ eggdrop1.6/src/chanprog.c	Sun Jul 25 06:17:34 2004
@@ -7,7 +7,7 @@
  *   telling the current programmed settings
  *   initializing a lot of stuff and loading the tcl scripts
  *
- * $Id: chanprog.c,v 1.56 2004/06/14 01:14:06 wcc Exp $
+ * $Id: chanprog.c,v 1.57 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -429,16 +429,17 @@
 void chanprog()
 {
   int i;
+  FILE *f;
+  char s[161], rands[8];
 
   admin[0]   = 0;
   helpdir[0] = 0;
   tempdir[0] = 0;
+  conmask    = 0;
 
   for (i = 0; i < max_logs; i++)
     logs[i].flags |= LF_EXPIRING;
 
-  conmask = 0;
-
   /* Turn off read-only variables (make them write-able) for rehash */
   protect_readonly = 0;
 
@@ -468,13 +469,16 @@
   /* We should be safe now */
   call_hook(HOOK_REHASH);
   protect_readonly = 1;
-  if (!botnetnick[0]) {
+
+  if (!botnetnick[0])
     strncpyz(botnetnick, origbotname, HANDLEN + 1);
-  }
+
   if (!botnetnick[0])
     fatal("I don't have a botnet nick!!\n", 0);
+
   if (!userfile[0])
     fatal(MISC_NOUSERFILE2, 0);
+
   if (!readuserfile(userfile, &userlist)) {
     if (!make_userfile) {
       char tmp[178];
@@ -490,31 +494,30 @@
     make_userfile = 0;
     printf("%s\n", MISC_USERFEXISTS);
   }
+
   if (helpdir[0])
     if (helpdir[strlen(helpdir) - 1] != '/')
       strcat(helpdir, "/");
+
   if (tempdir[0])
     if (tempdir[strlen(tempdir) - 1] != '/')
       strcat(tempdir, "/");
-  /* Test tempdir: it's vital */
-  {
-    FILE *f;
-    char s[161], rands[8];
-
-    /* Possible file race condition solved by using a random string
-     * and the process id in the filename.
-     * FIXME: This race is only partitially fixed. We could still be
-     *        overwriting an existing file / following a malicious
-     *        link.
-     */
-    make_rand_str(rands, 7);    /* create random string */
-    sprintf(s, "%s.test-%u-%s", tempdir, getpid(), rands);
-    f = fopen(s, "w");
-    if (f == NULL)
-      fatal(MISC_CANTWRITETEMP, 0);
-    fclose(f);
-    unlink(s);
-  }
+
+  /* Test tempdir: it's vital. */
+
+  /* Possible file race condition solved by using a random string
+   * and the process id in the filename.
+   * FIXME: This race is only partitially fixed. We could still be
+   *        overwriting an existing file / following a malicious
+   *        link.
+   */
+  make_rand_str(rands, 7); /* create random string */
+  sprintf(s, "%s.test-%u-%s", tempdir, getpid(), rands);
+  f = fopen(s, "w");
+  if (f == NULL)
+    fatal(MISC_CANTWRITETEMP, 0);
+  fclose(f);
+  unlink(s);
   reaffirm_owners();
   check_tcl_event("userfile-loaded");
 }
Index: eggdrop1.6/src/cmds.c
diff -u eggdrop1.6/src/cmds.c:1.108 eggdrop1.6/src/cmds.c:1.109
--- eggdrop1.6/src/cmds.c:1.108	Mon Jul  5 00:14:12 2004
+++ eggdrop1.6/src/cmds.c	Sun Jul 25 06:17:34 2004
@@ -3,7 +3,7 @@
  *   commands from a user via dcc
  *   (split in 2, this portion contains no-irc commands)
  *
- * $Id: cmds.c,v 1.108 2004/07/05 05:14:12 wcc Exp $
+ * $Id: cmds.c,v 1.109 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -2199,7 +2199,6 @@
 {
   int code;
   char *result;
-
 #ifdef USE_TCL_ENCODING
   Tcl_DString dstr;
 #endif
@@ -2220,7 +2219,7 @@
   /* use old pre-Tcl 8.1 way. */
   result = interp->result;
 #endif
-  
+
   if (code == TCL_OK)
     dumplots(idx, "Tcl: ", result);
   else
@@ -2236,9 +2235,7 @@
 static void cmd_set(struct userrec *u, int idx, char *msg)
 {
   int code;
-  char s[512];
-  char *result;
-
+  char s[512], *result;
 #ifdef USE_TCL_ENCODING
   Tcl_DString dstr;
 #endif
Index: eggdrop1.6/src/eggdrop.h
diff -u eggdrop1.6/src/eggdrop.h:1.60 eggdrop1.6/src/eggdrop.h:1.61
--- eggdrop1.6/src/eggdrop.h:1.60	Sun Jun 13 20:14:06 2004
+++ eggdrop1.6/src/eggdrop.h	Sun Jul 25 06:17:34 2004
@@ -4,7 +4,7 @@
  *
  *   IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
  *
- * $Id: eggdrop.h,v 1.60 2004/06/14 01:14:06 wcc Exp $
+ * $Id: eggdrop.h,v 1.61 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -91,10 +91,12 @@
 #define NOTENAMELEN  ((HANDLEN * 2) + 1)
 
 
-
 /* We have to generate compiler errors in a weird way since not all compilers
- * support the #error preprocessor directive.
- */
+ * support the #error preprocessor directive. */
+#ifndef STDC_HEADERS
+#  include "Error: Your system must have standard ANSI C headers."
+#endif
+
 #ifndef HAVE_VPRINTF
 #  include "Error: You need vsprintf to compile eggdrop."
 #endif
@@ -103,16 +105,59 @@
 #  include <unistd.h>
 #endif
 
+/* This allows us to make things a lot less messy in modules.c. */
 #ifndef STATIC
-#  if (!defined(MODULES_OK) || !defined(HAVE_DLOPEN)) && !defined(HPUX_HACKS)
+#  if !defined(MODULES_OK) || (!defined(MOD_USE_DL) && !defined(MOD_USE_SHL) && !defined(MOD_USE_DYLD) && !defined(MOD_USE_RLD) && !defined(MOD_USE_LOADER))
 #    include "Error: You can't compile with module support on this system (try make static)."
+#  else
+#    ifdef MOD_USE_DL
+#      ifndef HAVE_DLOPEN
+#        include "Error: We have detected that dlopen() should be used to load modules on this OS; but it was not found. Please use 'make static'."
+#      endif
+#      undef MOD_USE_SHL
+#      undef MOD_USE_DYLD
+#      undef MOD_USE_RLD
+#      undef MOD_USE_LOADER
+#    endif
+#    ifdef MOD_USE_SHL
+#      ifndef HAVE_SHL_LOAD
+#        include "Error: We have detected that shl_load() should be used to load modules on this OS; but it was not found. Please use 'make static'."
+#      endif
+#      undef MOD_USE_DL
+#      undef MOD_USE_DYLD
+#      undef MOD_USE_RLD
+#      undef MOD_USE_LOADER
+#    endif
+#    ifdef MOD_USE_DYLD
+#      ifndef HAVE_NSLINKMODULE
+#        include "Error: We have detected that NSLinkModule() should be used to load modules on this OS; but it was not found. Please use 'make static'."
+#      endif
+#      undef MOD_USE_DL
+#      undef MOD_USE_SHL
+#      undef MOD_USE_RLD
+#      undef MOD_USE_LOADER
+#    endif
+#    ifdef MOD_USE_RLD
+#      ifndef HAVE_RLD_LOAD
+#        include "Error: We have detected that rld_load() should be used to load modules on this OS; but it was not found. Please use 'make static'."
+#      endif
+#      undef MOD_USE_DL
+#      undef MOD_USE_SHL
+#      undef MOD_USE_DYLD
+#      undef MOD_USE_LOADER
+#    endif
+#    ifdef MOD_USE_LOADER
+#      ifndef HAVE_LOAD
+#        include "Error: We have detected that load() should be used to load modules on this OS; but it was not found. Please use 'make static'."
+#      endif
+#      undef MOD_USE_DL
+#      undef MOD_USE_SHL
+#      undef MOD_USE_DYLD
+#      undef MOD_USE_RLD
+#    endif
 #  endif
 #endif
 
-#ifndef STDC_HEADERS
-#  include "Error: Your system must have standard ANSI C headers."
-#endif
-
 #if (NICKMAX < 9) || (NICKMAX > 32)
 #  include "Error: Invalid NICKMAX value."
 #endif
@@ -239,6 +284,7 @@
 #define egg_isascii(x)  isascii((int)  (unsigned char) (x))
 #define egg_isspace(x)  isspace((int)  (unsigned char) (x))
 #define egg_islower(x)  islower((int)  (unsigned char) (x))
+
 /***********************************************************************/
 
 /* It's used in so many places, let's put it here */
@@ -387,8 +433,7 @@
                                  * lookup for                              */
 };
 
-/* Flags for dns_type
- */
+/* Flags for dns_type. */
 #define RES_HOSTBYIP  1         /* hostname to IP address               */
 #define RES_IPBYHOST  2         /* IP address to hostname               */
 
@@ -397,8 +442,7 @@
   struct chat_info *chat;       /* holds current chat data              */
 };
 
-/* Flags about dcc types
- */
+/* Flags for dcc types. */
 #define DCT_CHAT      0x00000001        /* this dcc type receives botnet
                                          * chatter                          */
 #define DCT_MASTER    0x00000002        /* received master chatter          */
@@ -417,8 +461,7 @@
                                          * getting = !this                  */
 #define DCT_LISTEN    0x00001000        /* a listening port of some sort    */
 
-/* For dcc chat & files:
- */
+/* For dcc chat & files. */
 #define STAT_ECHO    0x00001    /* echo commands back?                  */
 #define STAT_DENY    0x00002    /* bad username (ignore password & deny
                                  * access)                              */
@@ -429,8 +472,7 @@
 #define STAT_USRONLY 0x00040    /* telnet on users-only connect         */
 #define STAT_PAGE    0x00080    /* page output to the user              */
 
-/* For stripping out mIRC codes
- */
+/* For stripping out mIRC codes. */
 #define STRIP_COLOR  0x00001    /* remove mIRC color codes              */
 #define STRIP_BOLD   0x00002    /* remove bold codes                    */
 #define STRIP_REV    0x00004    /* remove reverse video codes           */
@@ -439,7 +481,7 @@
 #define STRIP_BELLS  0x00020    /* remote ctrl-g's                      */
 #define STRIP_ALL    0x00040    /* remove every damn thing!             */
 
-/* for dcc bot links: */
+/* For dcc bot links. */
 #define STAT_PINGED  0x00001    /* waiting for ping to return            */
 #define STAT_SHARE   0x00002    /* sharing user data with the bot        */
 #define STAT_CALLED  0x00004    /* this bot called me                    */
@@ -468,9 +510,9 @@
 #define FLOOD_GLOBAL_MAX 3
 
 /* For local console: */
-#define STDIN      0
-#define STDOUT     1
-#define STDERR     2
+#define STDIN  0
+#define STDOUT 1
+#define STDERR 2
 
 /* Structure for internal logs */
 typedef struct {
@@ -592,11 +634,8 @@
 };
 
 /* Telnet codes.  See "TELNET Protocol Specification" (RFC 854) and
- * "TELNET Echo Option" (RFC 875) for details.
- */
-
+ * "TELNET Echo Option" (RFC 875) for details. */
 #define TLN_AYT         246     /* Are You There        */
-
 #define TLN_WILL        251     /* Will                 */
 #define TLN_WILL_C      "\373"
 #define TLN_WONT        252     /* Won't                */
Index: eggdrop1.6/src/main.h
diff -u eggdrop1.6/src/main.h:1.28 eggdrop1.6/src/main.h:1.29
--- eggdrop1.6/src/main.h:1.28	Sun Jun 13 20:14:06 2004
+++ eggdrop1.6/src/main.h	Sun Jul 25 06:17:34 2004
@@ -2,7 +2,7 @@
  * main.h
  *   include file to include most other include files
  *
- * $Id: main.h,v 1.28 2004/06/14 01:14:06 wcc Exp $
+ * $Id: main.h,v 1.29 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -30,9 +30,9 @@
 #  include "config.h"
 #endif
 
-#include "lush.h" /* We seem to need this everywhere... */
+#include "lush.h"
 
-#if (((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION >= 5)) || (TCL_MAJOR_VERSION > 7))
+#if ((TCL_MAJOR_VERSION > 7) || ((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION >= 5)))
 #  define USE_TCL_EVENTS
 #  define USE_TCL_FINDEXEC
 #  define USE_TCL_PACKAGE
Index: eggdrop1.6/src/mod/Makefile.in
diff -u eggdrop1.6/src/mod/Makefile.in:1.19 eggdrop1.6/src/mod/Makefile.in:1.20
--- eggdrop1.6/src/mod/Makefile.in:1.19	Thu Jun 17 00:43:29 2004
+++ eggdrop1.6/src/mod/Makefile.in	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/
-# $Id: Makefile.in,v 1.19 2004/06/17 05:43:29 wcc Exp $
+# $Id: Makefile.in,v 1.20 2004/07/25 11:17:34 wcc Exp $
 
 SHELL = @SHELL@
 top_srcdir = @top_srcdir@
@@ -36,7 +36,8 @@
 
 MAKE_MOD = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
 'STRIP=$(STRIP)' 'CFLAGS=$(MOD_CFLAGS)' 'CPPFLAGS=$(MOD_CPPFLAGS)' \
-'XLIBS=$(XLIBS)' 'MOD_EXT=$(MOD_EXT)' 'SHELL=$(SHELL)'
+'XLIBS=$(XLIBS)' 'MOD_EXT=$(MOD_EXT)' 'SHELL=$(SHELL)' \
+'MODULE_XLIBS=$(MODULE_XLIBS)'
 
 
 doofus:
Index: eggdrop1.6/src/mod/assoc.mod/Makefile
diff -u eggdrop1.6/src/mod/assoc.mod/Makefile:1.14 eggdrop1.6/src/mod/assoc.mod/Makefile:1.15
--- eggdrop1.6/src/mod/assoc.mod/Makefile:1.14	Sat Nov  1 17:26:57 2003
+++ eggdrop1.6/src/mod/assoc.mod/Makefile	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/assoc.mod/
-# $Id: Makefile,v 1.14 2003/11/01 23:26:57 wcc Exp $
+# $Id: Makefile,v 1.15 2004/07/25 11:17:34 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv assoc.o ../
 
 ../../../assoc.$(MOD_EXT): ../assoc.o
-	$(LD) -o ../../../assoc.$(MOD_EXT) ../assoc.o $(XLIBS)
+	$(LD) -o ../../../assoc.$(MOD_EXT) ../assoc.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../assoc.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/blowfish.mod/Makefile
diff -u eggdrop1.6/src/mod/blowfish.mod/Makefile:1.13 eggdrop1.6/src/mod/blowfish.mod/Makefile:1.14
--- eggdrop1.6/src/mod/blowfish.mod/Makefile:1.13	Sat Nov  1 17:26:57 2003
+++ eggdrop1.6/src/mod/blowfish.mod/Makefile	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/blowfish.mod/
-# $Id: Makefile,v 1.13 2003/11/01 23:26:57 wcc Exp $
+# $Id: Makefile,v 1.14 2004/07/25 11:17:34 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv blowfish.o ../
 
 ../../../blowfish.$(MOD_EXT): ../blowfish.o
-	$(LD) -o ../../../blowfish.$(MOD_EXT) ../blowfish.o $(XLIBS)
+	$(LD) -o ../../../blowfish.$(MOD_EXT) ../blowfish.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../blowfish.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/channels.mod/Makefile
diff -u eggdrop1.6/src/mod/channels.mod/Makefile:1.14 eggdrop1.6/src/mod/channels.mod/Makefile:1.15
--- eggdrop1.6/src/mod/channels.mod/Makefile:1.14	Sat Nov  1 17:26:57 2003
+++ eggdrop1.6/src/mod/channels.mod/Makefile	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/channels.mod/
-# $Id: Makefile,v 1.14 2003/11/01 23:26:57 wcc Exp $
+# $Id: Makefile,v 1.15 2004/07/25 11:17:34 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv channels.o ../
 
 ../../../channels.$(MOD_EXT): ../channels.o
-	$(LD) -o ../../../channels.$(MOD_EXT) ../channels.o $(XLIBS)
+	$(LD) -o ../../../channels.$(MOD_EXT) ../channels.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../channels.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/compress.mod/Makefile.in
diff -u eggdrop1.6/src/mod/compress.mod/Makefile.in:1.10 eggdrop1.6/src/mod/compress.mod/Makefile.in:1.11
--- eggdrop1.6/src/mod/compress.mod/Makefile.in:1.10	Tue Jun 15 02:20:55 2004
+++ eggdrop1.6/src/mod/compress.mod/Makefile.in	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile.in for src/mod/compress.mod/
-# $Id: Makefile.in,v 1.10 2004/06/15 07:20:55 wcc Exp $
+# $Id: Makefile.in,v 1.11 2004/07/25 11:17:34 wcc Exp $
 
 ZLIB = @ZLIB@
 srcdir = .
@@ -22,7 +22,7 @@
 	mv compress.o ../
 
 ../../../compress.$(MOD_EXT): ../compress.o
-	$(LD) -o ../../../compress.$(MOD_EXT) ../compress.o $(ZLIB) $(XLIBS)
+	$(LD) -o ../../../compress.$(MOD_EXT) ../compress.o $(ZLIB) $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../compress.$(MOD_EXT)
 
 depend:
Index: eggdrop1.6/src/mod/compress.mod/configure
diff -u eggdrop1.6/src/mod/compress.mod/configure:1.9 eggdrop1.6/src/mod/compress.mod/configure:1.10
--- eggdrop1.6/src/mod/compress.mod/configure:1.9	Tue Jun 15 02:28:14 2004
+++ eggdrop1.6/src/mod/compress.mod/configure	Sun Jul 25 06:17:34 2004
@@ -1305,28 +1305,6 @@
 
 
 
-  # This tells the code in eggmod.sh to search for the file `compress.c'.
-  # That way we can make sure we're started from the correct directory.
-  ac_egg_uniquefile=compress.c
-
-  # Scan for out source directory
-  ac_egg_srcdir=.
-  for i in $*; do
-    case "${i}" in
-      --srcdir=*)
-        ac_egg_srcdir=`echo ${i} | sed -e 's/^--srcdir=//'`
-      ;;
-    esac
-  done
-
-  if test -r ${ac_egg_srcdir}/../eggmod.sh; then
-    ${ac_egg_srcdir}/../eggmod.sh
-  else
-    echo "$0: error: failed to locate eggmod.sh in ${ac_egg_srcdir}/.." >&2
-    exit 1
-  fi
-
-
 
 ac_aux_dir=
 for ac_dir in ../../../misc $srcdir/../../../misc; do
Index: eggdrop1.6/src/mod/compress.mod/configure.ac
diff -u eggdrop1.6/src/mod/compress.mod/configure.ac:1.1 eggdrop1.6/src/mod/compress.mod/configure.ac:1.2
--- eggdrop1.6/src/mod/compress.mod/configure.ac:1.1	Tue Jun 15 02:25:51 2004
+++ eggdrop1.6/src/mod/compress.mod/configure.ac	Sun Jul 25 06:17:34 2004
@@ -1,19 +1,18 @@
 dnl configure.ac: this file is processed by autoconf to produce ./configure.
 dnl
-dnl $Id: configure.ac,v 1.1 2004/06/15 07:25:51 wcc Exp $
+dnl $Id: configure.ac,v 1.2 2004/07/25 11:17:34 wcc Exp $
 
 AC_PREREQ(2.59)
 
 sinclude(../eggmod.m4)
 
 AC_INIT([Eggdrop Compress Module],[1.6.17],[bugs at eggheads.org])
-EGG_INIT(compress.c)
 
 AC_CONFIG_SRCDIR(compress.c)
 AC_CONFIG_AUX_DIR(../../../misc)
 
 AC_COPYRIGHT([Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Eggheads Development Team])
-AC_REVISION($Revision: 1.1 $)
+AC_REVISION($Revision: 1.2 $)
 
 # Check for gzopen() in -lz.
 AC_CHECK_LIB(z, gzopen, [ZLIB="-lz"], [])
Index: eggdrop1.6/src/mod/console.mod/Makefile
diff -u eggdrop1.6/src/mod/console.mod/Makefile:1.16 eggdrop1.6/src/mod/console.mod/Makefile:1.17
--- eggdrop1.6/src/mod/console.mod/Makefile:1.16	Sat Nov  1 17:26:57 2003
+++ eggdrop1.6/src/mod/console.mod/Makefile	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/console.mod/
-# $Id: Makefile,v 1.16 2003/11/01 23:26:57 wcc Exp $
+# $Id: Makefile,v 1.17 2004/07/25 11:17:34 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv console.o ../
 
 ../../../console.$(MOD_EXT): ../console.o
-	$(LD) -o ../../../console.$(MOD_EXT) ../console.o $(XLIBS)
+	$(LD) -o ../../../console.$(MOD_EXT) ../console.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../console.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/ctcp.mod/Makefile
diff -u eggdrop1.6/src/mod/ctcp.mod/Makefile:1.13 eggdrop1.6/src/mod/ctcp.mod/Makefile:1.14
--- eggdrop1.6/src/mod/ctcp.mod/Makefile:1.13	Sat Nov  1 17:26:57 2003
+++ eggdrop1.6/src/mod/ctcp.mod/Makefile	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/ctcp.mod/
-# $Id: Makefile,v 1.13 2003/11/01 23:26:57 wcc Exp $
+# $Id: Makefile,v 1.14 2004/07/25 11:17:34 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv ctcp.o ../
 
 ../../../ctcp.$(MOD_EXT): ../ctcp.o
-	$(LD) -o ../../../ctcp.$(MOD_EXT) ../ctcp.o
+	$(LD) -o ../../../ctcp.$(MOD_EXT) ../ctcp.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../ctcp.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/dns.mod/Makefile.in
diff -u eggdrop1.6/src/mod/dns.mod/Makefile.in:1.10 eggdrop1.6/src/mod/dns.mod/Makefile.in:1.11
--- eggdrop1.6/src/mod/dns.mod/Makefile.in:1.10	Sat Nov  1 17:26:57 2003
+++ eggdrop1.6/src/mod/dns.mod/Makefile.in	Sun Jul 25 06:17:34 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/dns.mod/
-# $Id: Makefile.in,v 1.10 2003/11/01 23:26:57 wcc Exp $
+# $Id: Makefile.in,v 1.11 2004/07/25 11:17:34 wcc Exp $
 
 RESLIB = @RESLIB@
 RESINCLUDE = @RESINCLUDE@
@@ -23,7 +23,7 @@
 	mv dns.o ../
 
 ../../../dns.$(MOD_EXT): ../dns.o
-	$(LD) -o ../../../dns.$(MOD_EXT) ../dns.o $(RESLIB)
+	$(LD) -o ../../../dns.$(MOD_EXT) ../dns.o $(RESLIB) $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../dns.$(MOD_EXT)
 
 depend:
Index: eggdrop1.6/src/mod/dns.mod/configure
diff -u eggdrop1.6/src/mod/dns.mod/configure:1.15 eggdrop1.6/src/mod/dns.mod/configure:1.16
--- eggdrop1.6/src/mod/dns.mod/configure:1.15	Tue Jun 15 02:28:14 2004
+++ eggdrop1.6/src/mod/dns.mod/configure	Sun Jul 25 06:17:35 2004
@@ -1267,28 +1267,6 @@
 
 
 
-  # This tells the code in eggmod.sh to search for the file `coredns.c'.
-  # That way we can make sure we're started from the correct directory.
-  ac_egg_uniquefile=coredns.c
-
-  # Scan for out source directory
-  ac_egg_srcdir=.
-  for i in $*; do
-    case "${i}" in
-      --srcdir=*)
-        ac_egg_srcdir=`echo ${i} | sed -e 's/^--srcdir=//'`
-      ;;
-    esac
-  done
-
-  if test -r ${ac_egg_srcdir}/../eggmod.sh; then
-    ${ac_egg_srcdir}/../eggmod.sh
-  else
-    echo "$0: error: failed to locate eggmod.sh in ${ac_egg_srcdir}/.." >&2
-    exit 1
-  fi
-
-
 
 ac_aux_dir=
 for ac_dir in ../../../misc $srcdir/../../../misc; do
Index: eggdrop1.6/src/mod/dns.mod/configure.ac
diff -u eggdrop1.6/src/mod/dns.mod/configure.ac:1.1 eggdrop1.6/src/mod/dns.mod/configure.ac:1.2
--- eggdrop1.6/src/mod/dns.mod/configure.ac:1.1	Tue Jun 15 02:25:51 2004
+++ eggdrop1.6/src/mod/dns.mod/configure.ac	Sun Jul 25 06:17:35 2004
@@ -1,19 +1,18 @@
 dnl configure.ac: this file is processed by autoconf to produce ./configure.
 dnl
-dnl $Id: configure.ac,v 1.1 2004/06/15 07:25:51 wcc Exp $
+dnl $Id: configure.ac,v 1.2 2004/07/25 11:17:35 wcc Exp $
 
 AC_PREREQ(2.59)
 
 sinclude(../eggmod.m4)
 
 AC_INIT([Eggdrop DNS Module],[1.6.17],[bugs at eggheads.org])
-EGG_INIT(coredns.c)
 
 AC_CONFIG_SRCDIR(coredns.c)
 AC_CONFIG_AUX_DIR(../../../misc)
 
 AC_COPYRIGHT([Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Eggheads Development Team])
-AC_REVISION($Revision: 1.1 $)
+AC_REVISION($Revision: 1.2 $)
 
 dns_reslib_avail="true"
 
Index: eggdrop1.6/src/mod/eggmod.m4
diff -u eggdrop1.6/src/mod/eggmod.m4:1.7 eggdrop1.6/src/mod/eggmod.m4:1.8
--- eggdrop1.6/src/mod/eggmod.m4:1.7	Tue Jun 15 02:20:55 2004
+++ eggdrop1.6/src/mod/eggmod.m4	Sun Jul 25 06:17:34 2004
@@ -1,6 +1,6 @@
 dnl eggmod.m4
 dnl
-dnl $Id: eggmod.m4,v 1.7 2004/06/15 07:20:55 wcc Exp $
+dnl $Id: eggmod.m4,v 1.8 2004/07/25 11:17:34 wcc Exp $
 
 dnl EGG_REMOVE_MOD(MODULE-NAME)
 dnl
@@ -9,28 +9,3 @@
 [
   ${srcdir}/../../../misc/modconfig -q --top_srcdir=${srcdir}/../../.. --bindir=../../.. del $1
 ])
-
-dnl EGG_INIT(UNIQUE-SOURCE-FILE)
-define(EGG_INIT,
-[
-  # This tells the code in eggmod.sh to search for the file `$1'.
-  # That way we can make sure we're started from the correct directory.
-  ac_egg_uniquefile=$1
-
-  # Scan for out source directory
-  ac_egg_srcdir=.
-  for i in [$]*; do
-    case "[$]{i}" in
-      --srcdir=*)
-        ac_egg_srcdir=`echo [$]{i} | sed -e 's/^--srcdir=//'`
-      ;;
-    esac
-  done
-
-  if test -r [$]{ac_egg_srcdir}/../eggmod.sh; then
-    [$]{ac_egg_srcdir}/../eggmod.sh
-  else
-    echo "[$]0: error: failed to locate eggmod.sh in [$]{ac_egg_srcdir}/.." >&2
-    exit 1
-  fi
-])
Index: eggdrop1.6/src/mod/filesys.mod/Makefile
diff -u eggdrop1.6/src/mod/filesys.mod/Makefile:1.17 eggdrop1.6/src/mod/filesys.mod/Makefile:1.18
--- eggdrop1.6/src/mod/filesys.mod/Makefile:1.17	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/filesys.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/filesys.mod/
-# $Id: Makefile,v 1.17 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.18 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv filesys.o ../
 
 ../../../filesys.$(MOD_EXT): ../filesys.o
-	$(LD) -o ../../../filesys.$(MOD_EXT) ../filesys.o $(XLIBS)
+	$(LD) -o ../../../filesys.$(MOD_EXT) ../filesys.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../filesys.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/irc.mod/Makefile
diff -u eggdrop1.6/src/mod/irc.mod/Makefile:1.13 eggdrop1.6/src/mod/irc.mod/Makefile:1.14
--- eggdrop1.6/src/mod/irc.mod/Makefile:1.13	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/irc.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/irc.mod/
-# $Id: Makefile,v 1.13 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.14 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv irc.o ../
 
 ../../../irc.$(MOD_EXT): ../irc.o
-	$(LD) -o ../../../irc.$(MOD_EXT) ../irc.o $(XLIBS)
+	$(LD) -o ../../../irc.$(MOD_EXT) ../irc.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../irc.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/modvals.h
diff -u eggdrop1.6/src/mod/modvals.h:1.26 eggdrop1.6/src/mod/modvals.h:1.27
--- eggdrop1.6/src/mod/modvals.h:1.26	Thu Jan  8 23:56:37 2004
+++ eggdrop1.6/src/mod/modvals.h	Sun Jul 25 06:17:34 2004
@@ -1,7 +1,7 @@
 /*
  * modvals.h
  *
- * $Id: modvals.h,v 1.26 2004/01/09 05:56:37 wcc Exp $
+ * $Id: modvals.h,v 1.27 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -54,8 +54,7 @@
 #define HOOK_ENCRYPT_STRING     114
 #define HOOK_DECRYPT_STRING     115
 
-/* These are FIXED once they are in a release they STAY
- */
+/* These are FIXED once they are in a release they STAY */
 #define MODCALL_START             0
 #define MODCALL_CLOSE             1
 #define MODCALL_EXPMEM            2
@@ -85,21 +84,36 @@
 /* Console */
 #define CONSOLE_DOSTORE           4
 
-#ifdef HPUX_HACKS
+#ifdef MOD_USE_SHL
 #  include <dl.h>
 #endif
 
+#ifdef MOD_USE_DYLD
+#  include <mach-o/dyld.h>
+#endif
+
+#ifdef MOD_USE_LOADER
+#  include <loader.h>
+#endif
+
 typedef struct _module_entry {
   struct _module_entry *next;
   char *name;                   /* Name of the module (without .so)     */
   int major;                    /* Major version number MUST match      */
   int minor;                    /* Minor version number MUST be >=      */
 #ifndef STATIC
-#  ifdef HPUX_HACKS
+#  ifdef MOD_USE_SHL
   shl_t hand;
-#  else /* !HPUX_HACKS */
-  void *hand;                   /* Module handle                        */
-#  endif /* !HPUX_HACKS */
+#  endif
+#  ifdef MOD_USE_DYLD
+  NSModule hand;
+#  endif
+#  ifdef MOD_USE_LOADER
+  ldr_module_t hand;
+#  endif
+#  ifdef MOD_USE_DL
+  void *hand;
+#  endif
 #endif /* STATIC */
   Function *funcs;
 #ifdef DEBUG_MEM
Index: eggdrop1.6/src/mod/notes.mod/Makefile
diff -u eggdrop1.6/src/mod/notes.mod/Makefile:1.14 eggdrop1.6/src/mod/notes.mod/Makefile:1.15
--- eggdrop1.6/src/mod/notes.mod/Makefile:1.14	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/notes.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/notes.mod
-# $Id: Makefile,v 1.14 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.15 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv notes.o ../
 
 ../../../notes.$(MOD_EXT): ../notes.o
-	$(LD) -o ../../../notes.$(MOD_EXT) ../notes.o $(XLIBS)
+	$(LD) -o ../../../notes.$(MOD_EXT) ../notes.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../notes.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/seen.mod/Makefile
diff -u eggdrop1.6/src/mod/seen.mod/Makefile:1.13 eggdrop1.6/src/mod/seen.mod/Makefile:1.14
--- eggdrop1.6/src/mod/seen.mod/Makefile:1.13	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/seen.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/seen.mod/
-# $Id: Makefile,v 1.13 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.14 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv seen.o ../
 
 ../../../seen.$(MOD_EXT): ../seen.o
-	$(LD) -o ../../../seen.$(MOD_EXT) ../seen.o
+	$(LD) -o ../../../seen.$(MOD_EXT) ../seen.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../seen.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/server.mod/Makefile
diff -u eggdrop1.6/src/mod/server.mod/Makefile:1.14 eggdrop1.6/src/mod/server.mod/Makefile:1.15
--- eggdrop1.6/src/mod/server.mod/Makefile:1.14	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/server.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/server.mod/
-# $Id: Makefile,v 1.14 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.15 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv server.o ../
 
 ../../../server.$(MOD_EXT): ../server.o
-	$(LD) -o ../../../server.$(MOD_EXT) ../server.o $(XLIBS)
+	$(LD) -o ../../../server.$(MOD_EXT) ../server.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../server.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/share.mod/Makefile
diff -u eggdrop1.6/src/mod/share.mod/Makefile:1.14 eggdrop1.6/src/mod/share.mod/Makefile:1.15
--- eggdrop1.6/src/mod/share.mod/Makefile:1.14	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/share.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/share.mod/
-# $Id: Makefile,v 1.14 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.15 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv share.o ../
 
 ../../../share.$(MOD_EXT): ../share.o
-	$(LD) -o ../../../share.$(MOD_EXT) ../share.o
+	$(LD) -o ../../../share.$(MOD_EXT) ../share.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../share.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/transfer.mod/Makefile
diff -u eggdrop1.6/src/mod/transfer.mod/Makefile:1.14 eggdrop1.6/src/mod/transfer.mod/Makefile:1.15
--- eggdrop1.6/src/mod/transfer.mod/Makefile:1.14	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/transfer.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/transfer.mod/
-# $Id: Makefile,v 1.14 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.15 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv transfer.o ../
 
 ../../../transfer.$(MOD_EXT): ../transfer.o
-	$(LD) -o ../../../transfer.$(MOD_EXT) ../transfer.o $(XLIBS)
+	$(LD) -o ../../../transfer.$(MOD_EXT) ../transfer.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../transfer.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/uptime.mod/Makefile
diff -u eggdrop1.6/src/mod/uptime.mod/Makefile:1.4 eggdrop1.6/src/mod/uptime.mod/Makefile:1.5
--- eggdrop1.6/src/mod/uptime.mod/Makefile:1.4	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/uptime.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/uptime.mod/
-# $Id: Makefile,v 1.4 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.5 2004/07/25 11:17:35 wcc Exp $
 srcdir = .
 
 
@@ -19,7 +19,7 @@
 	mv uptime.o ../
 
 ../../../uptime.$(MOD_EXT): ../uptime.o
-	$(LD) -o ../../../uptime.$(MOD_EXT) ../uptime.o
+	$(LD) -o ../../../uptime.$(MOD_EXT) ../uptime.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../uptime.$(MOD_EXT)
 
 depend:
@@ -27,6 +27,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/wire.mod/Makefile
diff -u eggdrop1.6/src/mod/wire.mod/Makefile:1.15 eggdrop1.6/src/mod/wire.mod/Makefile:1.16
--- eggdrop1.6/src/mod/wire.mod/Makefile:1.15	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/wire.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/wire.mod/
-# $Id: Makefile,v 1.15 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.16 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv wire.o ../
 
 ../../../wire.$(MOD_EXT): ../wire.o
-	$(LD) -o ../../../wire.$(MOD_EXT) ../wire.o
+	$(LD) -o ../../../wire.$(MOD_EXT) ../wire.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../wire.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/mod/woobie.mod/Makefile
diff -u eggdrop1.6/src/mod/woobie.mod/Makefile:1.11 eggdrop1.6/src/mod/woobie.mod/Makefile:1.12
--- eggdrop1.6/src/mod/woobie.mod/Makefile:1.11	Sat Nov  1 17:26:58 2003
+++ eggdrop1.6/src/mod/woobie.mod/Makefile	Sun Jul 25 06:17:35 2004
@@ -1,5 +1,5 @@
 # Makefile for src/mod/woobie.mod/
-# $Id: Makefile,v 1.11 2003/11/01 23:26:58 wcc Exp $
+# $Id: Makefile,v 1.12 2004/07/25 11:17:35 wcc Exp $
 
 srcdir = .
 
@@ -20,7 +20,7 @@
 	mv woobie.o ../
 
 ../../../woobie.$(MOD_EXT): ../woobie.o
-	$(LD) -o ../../../woobie.$(MOD_EXT) ../woobie.o
+	$(LD) -o ../../../woobie.$(MOD_EXT) ../woobie.o $(XLIBS) $(MODULE_XLIBS)
 	$(STRIP) ../../../woobie.$(MOD_EXT)
 
 depend:
@@ -28,6 +28,7 @@
 
 clean:
 	@rm -f .depend *.o *.$(MOD_EXT) *~
+
 distclean: clean
 
 #safety hash
Index: eggdrop1.6/src/modules.c
diff -u eggdrop1.6/src/modules.c:1.94 eggdrop1.6/src/modules.c:1.95
--- eggdrop1.6/src/modules.c:1.94	Tue Apr  6 01:56:38 2004
+++ eggdrop1.6/src/modules.c	Sun Jul 25 06:17:34 2004
@@ -4,7 +4,7 @@
  *
  * by Darrin Smith (beldin at light.iinet.net.au)
  *
- * $Id: modules.c,v 1.94 2004/04/06 06:56:38 wcc Exp $
+ * $Id: modules.c,v 1.95 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -33,36 +33,53 @@
 #include "users.h"
 
 #ifndef STATIC
-#  ifdef HPUX_HACKS
+#  ifdef MOD_USE_SHL
 #    include <dl.h>
-#  else
-#    ifdef OSF1_HACKS
-#      include <loader.h>
+#  endif
+#  ifdef MOD_USE_DYLD
+#    include <mach-o/dyld.h>
+#    define DYLDFLAGS NSLINKMODULE_OPTION_BINDNOW|NSLINKMODULE_OPTION_PRIVATE|NSLINKMODULE_OPTION_RETURN_ON_ERROR
+#  endif
+#  ifdef MOD_USE_RLD
+#    ifdef HAVE_MACH_O_RLD_H
+#      include <mach-o/rld.h>
 #    else
-#      ifdef DLOPEN_1
+#      ifdef HAVE_RLD_H
+#        indluce <rld.h>
+#      endif
+#    endif
+#  endif
+#  ifdef MOD_USE_LOADER
+#    include <loader.h>
+#  endif
+
+#  ifdef MOD_USE_DL
+#    ifdef DLOPEN_1
 char *dlerror();
 void *dlopen(const char *, int);
 int dlclose(void *);
 void *dlsym(void *, char *);
-#        define DLFLAGS 1
+#      define DLFLAGS 1
+#    else /* DLOPEN_1 */
+#      include <dlfcn.h>
+
+#      ifndef RTLD_GLOBAL
+#        define RTLD_GLOBAL 0
+#      endif
+#      ifndef RTLD_NOW
+#        define RTLD_NOW 1
+#      endif
+#      ifdef RTLD_LAZY
+#        define DLFLAGS RTLD_LAZY|RTLD_GLOBAL
 #      else
-#        include <dlfcn.h>
-#        ifndef RTLD_GLOBAL
-#          define RTLD_GLOBAL 0
-#        endif
-#        ifndef RTLD_NOW
-#          define RTLD_NOW 1
-#        endif
-#        ifdef RTLD_LAZY
-#          define DLFLAGS RTLD_LAZY|RTLD_GLOBAL
-#        else
-#          define DLFLAGS RTLD_NOW|RTLD_GLOBAL
-#        endif
-#      endif /* DLOPEN_1 */
-#    endif /* OSF1_HACKS */
-#  endif /* HPUX_HACKS */
+#        define DLFLAGS RTLD_NOW|RTLD_GLOBAL
+#      endif
+#    endif /* DLOPEN_1 */
+#  endif /* MOD_USE_DL */
 #endif /* !STATIC */
 
+
+
 extern struct dcc_t *dcc;
 extern struct userrec *userlist, *lastuser;
 extern struct chanset_t *chanset;
@@ -80,7 +97,6 @@
 extern party_t *party;
 extern time_t now, online_since;
 extern tand_t *tandbot;
-
 extern Tcl_Interp *interp;
 extern sock_list *socklist;
 
@@ -89,14 +105,11 @@
 int xtra_unpack();
 static int module_rename(char *name, char *newname);
 
-
 #ifndef STATIC
-
-/* Directory to look for modules */
 char moddir[121] = "modules/";
+#endif
 
-#else
-
+#ifdef STATIC
 struct static_list {
   struct static_list *next;
   char *name;
@@ -113,14 +126,14 @@
   p->next = static_modules;
   static_modules = p;
 }
-
-#endif
+#endif /* STATIC */
 
 
 /* The null functions */
 void null_func()
 {
 }
+
 char *charp_func()
 {
   return NULL;
@@ -137,13 +150,8 @@
 }
 
 
-/*
- *     Various hooks & things
- */
-
-/* The REAL hooks, when these are called, a return of 0 indicates unhandled
- * 1 is handled
- */
+/* The REAL hooks. When these are called, a return of 0 indicates unhandled;
+ * 1 indicates handled. */
 struct hook_entry *hook_list[REAL_HOOKS];
 
 static void null_share(int idx, char *x)
@@ -154,8 +162,9 @@
     if (!(dcc[idx].status & STAT_GETTING)) {
       dcc[idx].status &= ~STAT_SHARE;
     }
-  } else if ((x[0] != 'v') && (x[0] != 'e'))
+  } else if ((x[0] != 'v') && (x[0] != 'e')) {
     dprintf(idx, "s un Not sharing userfile.\n");
+  }
 }
 
 void (*encrypt_pass) (char *, char *) = 0;
@@ -181,7 +190,6 @@
  * BUT it makes the whole thing *much* more portable than letting each
  * OS screw up the symbols their own special way :/
  */
-
 Function global_table[] = {
   /* 0 - 3 */
   (Function) mod_malloc,
@@ -573,7 +581,7 @@
   module_list->name = nmalloc(8);
   strcpy(module_list->name, "eggdrop");
   module_list->major = (egg_numver) / 10000;
-  module_list->minor = ((egg_numver) / 100) % 100;
+  module_list->minor = (egg_numver / 100) % 100;
 #ifndef STATIC
   module_list->hand = NULL;
 #endif
@@ -585,18 +593,14 @@
 
 int expmem_modules(int y)
 {
-  int c = 0;
-  int i;
+  int c = 0, i;
   module_entry *p;
   dependancy *d;
   struct hook_entry *q;
-
+  Function *f;
 #ifdef STATIC
   struct static_list *s;
-#endif
-  Function *f;
 
-#ifdef STATIC
   for (s = static_modules; s; s = s->next)
     c += sizeof(struct static_list) + strlen(s->name) + 1;
 #endif
@@ -622,13 +626,15 @@
 {
   module_entry *p;
 
-  for (p = module_list; p && p->name; p = p->next)
+  for (p = module_list; p && p->name; p = p->next) {
     if (!egg_strcasecmp(name, p->name)) {
       p->major = major;
       p->minor = minor;
       p->funcs = funcs;
       return 1;
     }
+  }
+
   return 0;
 }
 
@@ -637,92 +643,131 @@
   module_entry *p;
   char *e;
   Function f;
+#ifdef STATIC
+  struct static_list *sl;
+#endif
 
 #ifndef STATIC
   char workbuf[1024];
-
-#  ifdef HPUX_HACKS
+#  ifdef MOD_USE_SHL
   shl_t hand;
-#  else
-#    ifdef OSF1_HACKS
+#  endif
+#  ifdef MOD_USE_DYLD
+  NSObjectFileImage file;
+  NSObjectFileImageReturnCode ret;
+  NSModule hand;
+  NSSymbol sym;
+#  endif
+#  ifdef MOD_USE_RLD
+  long ret;
+#  endif
+#  ifdef MOD_USE_LOADER
   ldr_module_t hand;
-#    else
+#  endif
+#  ifdef MOD_USE_DL
   void *hand;
-#    endif
 #  endif
-#else
-  struct static_list *sl;
-#endif
+#endif /* !STATIC */
 
   if (module_find(name, 0, 0) != NULL)
     return MOD_ALREADYLOAD;
+
 #ifndef STATIC
   if (moddir[0] != '/') {
     if (getcwd(workbuf, 1024) == NULL)
       return MOD_BADCWD;
     sprintf(&(workbuf[strlen(workbuf)]), "/%s%s." EGG_MOD_EXT, moddir, name);
-  } else
+  } else {
     sprintf(workbuf, "%s%s." EGG_MOD_EXT, moddir, name);
-#  ifdef HPUX_HACKS
+  }
+
+#  ifdef MOD_USE_SHL
   hand = shl_load(workbuf, BIND_IMMEDIATE, 0L);
   if (!hand)
     return "Can't load module.";
-#  else
-#    ifdef OSF1_HACKS
-#      ifdef USE_TCL_PACKAGE
-  hand = (Tcl_PackageInitProc *) load(workbuf, LDR_NOFLAGS);
+  sprintf(workbuf, "%s_start", name);
+  if (shl_findsym(&hand, workbuf, (short) TYPE_PROCEDURE, (void *) &f))
+    f = NULL;
+  if (f == NULL) {
+    /* Some OS's require a _ to be prepended to the symbol name (Darwin, etc). */
+    sprintf(workbuf, "_%s_start", name);
+    if (shl_findsym(&hand, workbuf, (short) TYPE_PROCEDURE, (void *) &f))
+      f = NULL;
+  }
+  if (f == NULL) {
+    shl_unload(hand);
+    return MOD_NOSTARTDEF;
+  }
+#  endif /* MOD_USE_SHL */
+
+#  ifdef MOD_USE_DYLD
+  ret = NSCreateObjectFileImageFromFile(workbuf, &file);
+  if (ret != NSObjectFileImageSuccess)
+    return "Can't load module.";
+  hand = NSLinkModule(file, workbuf, DYLDFLAGS);
+  sprintf(workbuf, "_%s_start", name);
+  sym = NSLookupSymbolInModule(hand, workbuf);
+  if (sym)
+    f = (Function) NSAddressOfSymbol(sym);
+  else
+    f = NULL;
+  if (f == NULL) {
+    NSUnLinkModule(hand, NSUNLINKMODULE_OPTION_NONE);
+    return MOD_NOSTARTDEF;
+  }
+#  endif /* MOD_USE_DYLD */
+
+#  ifdef MOD_USE_RLD
+  ret = rld_load(NULL, (struct mach_header **) 0, workbuf, (const char *) 0);
+  if (!ret)
+    return "Can't load module.";
+  sprintf(workbuf, "_%s_start", name);
+  ret = rld_lookup(NULL, workbuf, &f)
+  if (!ret || f == NULL)
+    return MOD_NOSTARTDEF;
+  /* There isn't a reliable way to unload at this point... just keep it loaded. */
+#  endif /* MOD_USE_DYLD */
+
+#  ifdef MOD_USE_LOADER
+  hand = load(workbuf, LDR_NOFLAGS);
   if (hand == LDR_NULL_MODULE)
     return "Can't load module.";
-#      endif /* USE_TCL_PACKAGE */
-#    else
+  sprintf(workbuf, "%s_start", name);
+  f = (Function) ldr_lookup_package(hand, workbuf);
+  if (f == NULL) {
+    sprintf(workbuf, "_%s_start", name);
+    f = (Function) ldr_lookup_package(hand, workbuf);
+  }
+  if (f == NULL) {
+    unload(hand);
+    return MOD_NOSTARTDEF;
+  }
+#  endif /* MOD_USE_LOADER */
+
+#  ifdef MOD_USE_DL
   hand = dlopen(workbuf, DLFLAGS);
   if (!hand)
     return dlerror();
-#    endif
-#  endif
-
   sprintf(workbuf, "%s_start", name);
-#  ifdef HPUX_HACKS
-  if (shl_findsym(&hand, workbuf, (short) TYPE_PROCEDURE, (void *) &f))
-    f = NULL;
-#  else
-#    ifdef OSF1_HACKS
-  f = (Function) ldr_lookup_package(hand, workbuf);
-#    else
   f = (Function) dlsym(hand, workbuf);
-#    endif
-#  endif
-  if (f == NULL) {              /* some OS's need the _ */
+  if (f == NULL) {
     sprintf(workbuf, "_%s_start", name);
-#  ifdef HPUX_HACKS
-    if (shl_findsym(&hand, workbuf, (short) TYPE_PROCEDURE, (void *) &f))
-      f = NULL;
-#  else
-#    ifdef OSF1_HACKS
-    f = (Function) ldr_lookup_package(hand, workbuf);
-#    else
     f = (Function) dlsym(hand, workbuf);
-#    endif
-#  endif
-    if (f == NULL) {
-#  ifdef HPUX_HACKS
-      shl_unload(hand);
-#  else
-#    ifdef OSF1_HACKS
-#    else
-      dlclose(hand);
-#    endif
-#  endif
-      return MOD_NOSTARTDEF;
-    }
   }
-#  else
-  for (sl = static_modules; sl && egg_strcasecmp(sl->name, name);
-       sl = sl->next);
+  if (f == NULL) {
+    dlclose(hand);
+    return MOD_NOSTARTDEF;
+  }
+#  endif /* MOD_USE_DL */
+#endif /* !STATIC */
+
+#ifdef STATIC
+  for (sl = static_modules; sl && egg_strcasecmp(sl->name, name); sl = sl->next);
   if (!sl)
     return "Unknown module.";
   f = (Function) sl->func;
-#endif
+#endif /* STATIC */
+
   p = nmalloc(sizeof(module_entry));
   if (p == NULL)
     return "Malloc error";
@@ -744,10 +789,12 @@
     return e;
   }
   check_tcl_load(name);
+
   if (exist_lang_section(name))
     putlog(LOG_MISC, "*", MOD_LOADED_WITH_LANG, name);
   else
     putlog(LOG_MISC, "*", MOD_LOADED, name);
+
   return NULL;
 }
 
@@ -758,7 +805,7 @@
   Function *f;
 
   while (p) {
-    if ((p->name != NULL) && (!strcmp(name, p->name))) {
+    if ((p->name != NULL) && !strcmp(name, p->name)) {
       dependancy *d;
 
       for (d = dependancy_list; d; d = d->next)
@@ -774,15 +821,19 @@
         if (e != NULL)
           return e;
 #ifndef STATIC
-#  ifdef HPUX_HACKS
+#  ifdef MOD_USE_SHL
         shl_unload(p->hand);
-#  else
-#    ifdef OSF1_HACKS
-#    else
+#  endif
+#  ifdef MOD_USE_DYLD
+        NSUnLinkModule(p->hand, NSUNLINKMODULE_OPTION_NONE);
+#  endif
+#  ifdef MOD_USE_LOADER
+        unload(p->hand);
+#  endif
+#  ifdef MOD_USE_DL
         dlclose(p->hand);
-#    endif
 #  endif
-#endif /* STATIC */
+#endif /* !STATIC */
       }
       nfree(p->name);
       if (o == NULL)
@@ -796,6 +847,7 @@
     o = p;
     p = p->next;
   }
+
   return MOD_NOSUCH;
 }
 
@@ -803,10 +855,11 @@
 {
   module_entry *p;
 
-  for (p = module_list; p && p->name; p = p->next)
+  for (p = module_list; p && p->name; p = p->next) {
     if ((major == p->major || !major) && minor <= p->minor &&
         !egg_strcasecmp(name, p->name))
       return p;
+  }
   return NULL;
 }
 
@@ -818,13 +871,14 @@
     if (!egg_strcasecmp(newname, p->name))
       return 0;
 
-  for (p = module_list; p && p->name; p = p->next)
+  for (p = module_list; p && p->name; p = p->next) {
     if (!egg_strcasecmp(name, p->name)) {
       nfree(p->name);
       p->name = nmalloc(strlen(newname) + 1);
       strcpy(p->name, newname);
       return 1;
     }
+  }
   return 0;
 }
 
Index: eggdrop1.6/src/modules.h
diff -u eggdrop1.6/src/modules.h:1.14 eggdrop1.6/src/modules.h:1.15
--- eggdrop1.6/src/modules.h:1.14	Thu Jan  8 23:56:37 2004
+++ eggdrop1.6/src/modules.h	Sun Jul 25 06:17:34 2004
@@ -4,7 +4,7 @@
  *
  * by Darrin Smith (beldin at light.iinet.net.au)
  *
- * $Id: modules.h,v 1.14 2004/01/09 05:56:37 wcc Exp $
+ * $Id: modules.h,v 1.15 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -34,24 +34,21 @@
 
 #ifndef MAKING_NUMMODS
 
-/* Modules specific functions and functions called by eggdrop
- */
-
+/* Modules specific functions and functions called by Eggdrop */
 void do_module_report(int, int, char *);
-
-int module_register(char *name, Function* funcs, int major, int minor);
-const char *module_load(char *module_name);
-char *module_unload(char *module_name, char *nick);
-module_entry *module_find(char *name, int, int);
-Function *module_depend(char *, char *, int major, int minor);
+int module_register(char *, Function *, int, int);
+const char *module_load(char *);
+char *module_unload(char *, char *);
+module_entry *module_find(char *, int, int);
+Function *module_depend(char *, char *, int, int);
 int module_undepend(char *);
-void *mod_malloc(int size, const char *modname, const char *filename, int line);
-void *mod_realloc(void *ptr, int size, const char *modname,
-                  const char *filename, int line);
-void mod_free(void *ptr, const char *modname, const char *filename, int line);
-void add_hook(int hook_num, Function func);
-void del_hook(int hook_num, Function func);
-void *get_next_hook(int hook_num, void *func);
+void *mod_malloc(int, const char *, const char *, int);
+void *mod_realloc(void *, int, const char *, const char *, int);
+void mod_free(void *, const char *, const char *, int);
+void add_hook(int, Function);
+void del_hook(int, Function);
+void *get_next_hook(int, void *);
+
 extern struct hook_entry {
   struct hook_entry *next;
   int (*func) ();
@@ -65,6 +62,7 @@
                 p->func();                                      \
         }                                                       \
 } while (0)
+
 int call_hook_cccc(int, char *, char *, char *, char *);
 
 #endif
Index: eggdrop1.6/src/patch.h
diff -u eggdrop1.6/src/patch.h:1.1118 eggdrop1.6/src/patch.h:1.1119
--- eggdrop1.6/src/patch.h:1.1118	Sat Jul 24 22:56:59 2004
+++ eggdrop1.6/src/patch.h	Sun Jul 25 06:17:34 2004
@@ -10,7 +10,7 @@
  * statement, leave the rest of the file alone, this allows better
  * overlapping patches.
  *
- * $Id: patch.h,v 1.1118 2004/07/25 03:56:59 wcc Exp $
+ * $Id: patch.h,v 1.1119 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -41,12 +41,12 @@
  *
  *
  */
-patch("1090727935");            /* current unixtime */
+patch("1090728854");            /* current unixtime */
 /*
  *
  *
  */
-patch("holy-crap-another-doc-commit");
+patch("modulebuild");
 /*
  *
  *
Index: eggdrop1.6/src/tcl.c
diff -u eggdrop1.6/src/tcl.c:1.80 eggdrop1.6/src/tcl.c:1.81
--- eggdrop1.6/src/tcl.c:1.80	Mon Jul  5 00:14:12 2004
+++ eggdrop1.6/src/tcl.c	Sun Jul 25 06:17:34 2004
@@ -4,7 +4,7 @@
  *   Tcl initialization
  *   getting and setting Tcl/eggdrop variables
  *
- * $Id: tcl.c,v 1.80 2004/07/05 05:14:12 wcc Exp $
+ * $Id: tcl.c,v 1.81 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -730,7 +730,6 @@
 {
   int code;
   char *result;
-
 #ifdef USE_TCL_ENCODING
   Tcl_DString dstr;
 #endif
@@ -745,7 +744,7 @@
   /* properly convert string to system encoding. */
   Tcl_DStringInit(&dstr);
   Tcl_UtfToExternalDString(NULL, result, -1, &dstr);
-  result = Tcl_DStringValue(&dstr);  
+  result = Tcl_DStringValue(&dstr);
 #endif
 
   if (code != TCL_OK) {
Index: eggdrop1.6/src/users.c
diff -u eggdrop1.6/src/users.c:1.45 eggdrop1.6/src/users.c:1.46
--- eggdrop1.6/src/users.c:1.45	Sun Jul 18 12:54:38 2004
+++ eggdrop1.6/src/users.c	Sun Jul 25 06:17:34 2004
@@ -10,7 +10,7 @@
  *
  * dprintf'ized, 9nov1995
  *
- * $Id: users.c,v 1.45 2004/07/18 17:54:38 wcc Exp $
+ * $Id: users.c,v 1.46 2004/07/25 11:17:34 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -479,13 +479,12 @@
   struct user_entry *ue;
   struct laston_info *li;
   struct flag_record fr = { FR_GLOBAL, 0, 0, 0, 0, 0 };
-  module_entry *me;
 
   fr.global = u->flags;
 
   fr.udef_global = u->flags_udef;
   build_flags(s, &fr, NULL);
-  if ((me = module_find("notes", 0, 0))) {
+  if (module_find("notes", 0, 0)) {
     Tcl_SetVar(interp, "user", u->handle, 0);
     if (Tcl_VarEval(interp, "notes ", "$user", NULL) == TCL_OK)
       n = atoi(interp->result);
@@ -592,39 +591,46 @@
       chname = dcc[idx].u.chat->con_chan;
     flags = 1;
   }
+
   for (u = userlist; u; u = u->next) {
     if (flags) {
       get_user_flagrec(u, &user, chname);
       if (flagrec_eq(&pls, &user)) {
         if (nomns || !flagrec_eq(&mns, &user)) {
           cnt++;
-          if ((cnt <= limit) && (cnt >= start))
+          if ((cnt <= limit) && (cnt >= start)) {
             tell_user(idx, u, master);
-          if (cnt == limit + 1)
+          }
+          if (cnt == limit + 1) {
             dprintf(idx, MISC_TRUNCATED, limit);
+          }
         }
       }
     } else if (wild_match(mtch, u->handle)) {
       cnt++;
-      if ((cnt <= limit) && (cnt >= start))
+      if ((cnt <= limit) && (cnt >= start)) {
         tell_user(idx, u, master);
-      if (cnt == limit + 1)
+      }
+      if (cnt == limit + 1) {
         dprintf(idx, MISC_TRUNCATED, limit);
+      }
     } else {
       fnd = 0;
       for (q = get_user(&USERENTRY_HOSTS, u); q; q = q->next) {
-        if ((wild_match(mtch, q->extra)) && (!fnd)) {
+        if (wild_match(mtch, q->extra) && !fnd) {
           cnt++;
           fnd = 1;
           if ((cnt <= limit) && (cnt >= start)) {
             tell_user(idx, u, master);
           }
-          if (cnt == limit + 1)
+          if (cnt == limit + 1) {
             dprintf(idx, MISC_TRUNCATED, limit);
+          }
         }
       }
     }
   }
+
   dprintf(idx, MISC_FOUNDMATCH, cnt, cnt == 1 ? "" : MISC_MATCH_PLURAL);
 }
 
----------------------- End of diff -----------------------



More information about the Changes mailing list