Browse Source

Import upstream version 0.10.0

Alexander Barton 17 years ago
parent
commit
0713fe23ff
90 changed files with 7381 additions and 4443 deletions
  1. 36 4
      ChangeLog
  2. 64 6
      INSTALL
  3. 2 2
      Makefile.am
  4. 159 99
      Makefile.in
  5. 17 2
      NEWS
  6. 2 2
      README
  7. 550 673
      aclocal.m4
  8. 41 10
      config.guess
  9. 38 9
      config.sub
  10. 957 483
      configure
  11. 98 28
      configure.in
  12. 56 28
      contrib/Debian/Makefile.in
  13. 25 0
      contrib/Debian/changelog
  14. 3 1
      contrib/Debian/control
  15. 1 1
      contrib/Debian/ngircd.init
  16. 56 27
      contrib/MacOSX/Makefile.in
  17. 103 68
      contrib/Makefile.in
  18. 11 5
      contrib/README
  19. 1 1
      contrib/ngircd.spec
  20. 73 23
      depcomp
  21. 10 9
      doc/CVS.txt
  22. 10 1
      doc/FAQ.txt
  23. 8 6
      doc/Makefile.am
  24. 242 58
      doc/Makefile.in
  25. 19 8
      doc/Platforms.txt
  26. 2 2
      doc/Protocol.txt
  27. 4 4
      doc/README-AUX.txt
  28. 40 0
      doc/Zeroconf.txt
  29. 21 19
      doc/sample-ngircd.conf
  30. 25 0
      doc/src/Makefile.am
  31. 318 0
      doc/src/Makefile.in
  32. 253 224
      install-sh
  33. 71 44
      man/Makefile.in
  34. 4 4
      man/ngircd.8
  35. 10 9
      man/ngircd.conf.5
  36. 78 57
      missing
  37. 0 111
      mkinstalldirs
  38. 1 6
      src/Makefile.am
  39. 108 76
      src/Makefile.in
  40. 16 4
      src/config.h.in
  41. 13 13
      src/ngircd/Makefile.am
  42. 152 149
      src/ngircd/Makefile.in
  43. 359 0
      src/ngircd/array.c
  44. 101 0
      src/ngircd/array.h
  45. 96 51
      src/ngircd/channel.c
  46. 13 3
      src/ngircd/channel.h
  47. 59 55
      src/ngircd/client.c
  48. 2 3
      src/ngircd/client.h
  49. 360 328
      src/ngircd/conf.c
  50. 12 12
      src/ngircd/conf.h
  51. 18 10
      src/ngircd/conn-func.c
  52. 4 4
      src/ngircd/conn-func.h
  53. 77 39
      src/ngircd/conn-zip.c
  54. 2 2
      src/ngircd/conn-zip.h
  55. 758 833
      src/ngircd/conn.c
  56. 11 17
      src/ngircd/conn.h
  57. 78 56
      src/ngircd/defines.h
  58. 3 3
      src/ngircd/hash.c
  59. 605 0
      src/ngircd/io.c
  60. 51 0
      src/ngircd/io.h
  61. 68 30
      src/ngircd/irc-channel.c
  62. 35 21
      src/ngircd/irc-info.c
  63. 107 49
      src/ngircd/irc-login.c
  64. 26 21
      src/ngircd/irc-mode.c
  65. 69 27
      src/ngircd/irc-oper.c
  66. 15 13
      src/ngircd/irc-server.c
  67. 6 5
      src/ngircd/irc-write.c
  68. 2 2
      src/ngircd/irc-write.h
  69. 11 10
      src/ngircd/irc.c
  70. 8 8
      src/ngircd/lists.c
  71. 60 7
      src/ngircd/log.c
  72. 2 1
      src/ngircd/log.h
  73. 5 5
      src/ngircd/match.c
  74. 2 1
      src/ngircd/messages.h
  75. 52 51
      src/ngircd/ngircd.c
  76. 20 17
      src/ngircd/parse.c
  77. 17 15
      src/ngircd/rendezvous.c
  78. 4 4
      src/ngircd/rendezvous.h
  79. 206 158
      src/ngircd/resolve.c
  80. 13 28
      src/ngircd/resolve.h
  81. 113 111
      src/portab/Makefile.in
  82. 1 4
      src/portab/portab.h
  83. 3 3
      src/portab/portabtest.c
  84. 71 46
      src/testsuite/Makefile.in
  85. 3 1
      src/testsuite/stress-A.e
  86. 19 11
      src/testsuite/stress-B.e
  87. 11 1
      src/testsuite/stress-server.sh
  88. 4 1
      src/testsuite/wait-tests.sh
  89. 92 83
      src/tool/Makefile.in
  90. 29 17
      src/tool/tool.c

+ 36 - 4
ChangeLog

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2005 Alexander Barton,
+                        (c)2001-2006 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -10,9 +10,41 @@
                                -- ChangeLog --
 
 
+ngIRCd 0.10.0 (2006-10-01)
+
+  - Fixed file handle leak when daemon is not able to send MOTD to a client.
+
+  ngIRCd 0.10.0-pre2 (2006-09-09)
+  - Fixed build problems with GCC option -fstack-protector.
+  - Minor documentation updates.
+
+  ngIRCd 0.10.0-pre1 (2006-08-02)
+  - Validate "ServerName" (see RFC 2812, section 2.3.1).
+  - Enhanced DIE to accept a single parameter ("comment text") which is sent
+    to all locally connected clients before the server goes down.
+  - The ngIRCd handles time shifts backwards more gracefully now (the
+    timeout handling doesn't disconnect clients by mistake any more).
+  - Internal: Restructured connection handling (the connection ID is equal
+    to the file descriptor of the connection).
+  - Internal: Simplified resolver code.
+  - JOIN now supports more than one channel key at a time.
+  - Implemented numeric "333": Time and user name who set a channel topic.
+  - Enhanced the handler for PING and PONG commands: fix forwarding and enable
+    back-passing of a client supplied additional argument of PING.
+  - Changed handling of timeouts for unregistered connections: don't reset
+    the counter if data is received and disconnect clients earlier.
+  - Removed unnecessary #define of "LOCAL", now use plain C "static" instead.
+  - Channel topics are no longer limited to 127 characters: now the only limit
+    is the maximum length of an IRC command, i. e. 512 bytes (in practice, this
+    limits the topic to about 490 characters due to protocol overhead).
+  - Reverse DNS lookup code now checks the result by doing an additional
+    lookup to prevent spoofing.
+  - Added new IO layer which (optionally) supports epoll() and kqueue() in
+    addition to the select() interface.
+
 ngIRCd 0.9.2 (2005-10-15)
 
-  - Fixed a bug that could cause the damon to crash when outgoing server
+  - Fixed a bug that could cause the daemon to crash when outgoing server
     connections can't be established.
   - Fixed a bug that caused the daemon to leak file descriptors when no
     resolver subprocesses could be created.
@@ -32,7 +64,7 @@ ngIRCd 0.9.0 (2005-07-24)
   ngIRCd 0.9.0-pre1 (2005-07-09)
   - Fixed maximum length of user names, now allow up to 9 characters.
   - Cut off oversized IRC messages that should be sent to the network instead
-    of shuttding down the (wrong) connection.
+    of shutting down the (wrong) connection.
   - Don't generate error messages for unknown commands received before the
     client is registered with the server (like the original ircd).
   - Never run with root privileges but always switch the user ID.
@@ -629,4 +661,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: ChangeLog,v 1.276.2.12 2005/10/15 12:44:08 alex Exp $
+$Id: ChangeLog,v 1.302.2.4 2006/10/01 16:21:55 alex Exp $

+ 64 - 6
INSTALL

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                      (c)2001-2004 by Alexander Barton,
+                      (c)2001-2006 by Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -14,6 +14,12 @@
 I. Upgrade Information
 ~~~~~~~~~~~~~~~~~~~~~~
 
+Differences to version 0.9.x
+
+- The option of the configure script to enable support for Zeroconf/Bonjour/
+  Rendezvous/WhateverItIsNamedToday has been renamed:
+    --with-rendezvous  ->  --with-zeroconf
+
 Differences to version 0.8.x
 
 - The maximum length of passwords has been raised to 20 characters (instead
@@ -121,7 +127,59 @@ This files will be installed by default:
 - /usr/local/share/doc/ngircd/: documentation
 
 
-II. Useful make-targets
+III. Additional features
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following optional features can be compiled into the daemon by passing
+options to the "configure" script. Most options can handle a <path> argument
+which will be used to search for the required libraries and header files in
+the given paths ("<path>/lib/...", "<path>/include/...") in addition to the
+standard locations.
+
+* Syslog Logging (autodetected by default): 
+  --with-syslog[=<path>] / --without-syslog
+
+  Enable (disable) support for logging to "syslog", which should be
+  available on most modern UNIX-like operating systems by default.
+
+* ZLib Compression (autodetected by default):
+  --with-zlib[=<path>] / --without-zlib
+
+  Enable (disable) support for compressed server-server links.
+  The Z compression library ("libz") is required for this option.
+  
+* IO Backend (autodetected by default):
+  --with-epoll[=<path>] / --without-epoll
+  --with-kqueue[=<path>] / --without-kqueue  
+
+  ngIRCd can use three different IO "backends": the "old school" select()
+  API which should be supported by most UNIX-like operating systems, or the
+  more efficient and flexible epoll() (Linux 2.6) or kqueue() (BSD) APIs.
+  By default the IO backend is autodetected, but you can use "--without-xxx"
+  to disable a more enhanced API and force the daemon to use select().
+
+* IDENT-Support:
+  --with-ident[=<path>]
+
+  Include support for IDENT ("AUTH") lookups. The "ident" library is
+  required for this option.
+
+* ZeroConf Support:
+  --with-zeroconf[=<path>] 
+
+  Compile ngIRCd with support for ZeroConf multicast DNS service registration.
+  Either the Apple ZeroConf implementation (e. g. Mac OS X) or the Howl
+  library is required. Which one is available is autodetected.
+
+* TCP-Wrappers:
+  --with-tcp-wrappers[=<path>] 
+
+  Include support for Wietse Venemas "TCP Wrappers" to limit client access
+  to the daemon, for example by using "/etc/hosts.{allow|deny}".
+  The "libwrap" is required for this option.
+
+
+IV. Useful make-targets
 ~~~~~~~~~~~~~~~~~~~~~~~
 
 The Makefile produced by the configure-script contains always these useful
@@ -137,8 +195,8 @@ targets:
    next step: -> ./autogen.sh
 
 
-III. Sample configuration file ngircd.conf
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+V. Sample configuration file ngircd.conf
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 In the sample configuration file, there are comments beginning with "#" OR
 ";" -- this is only for the better understanding of the file.
@@ -158,7 +216,7 @@ The meaning of the variables in the configuration file is explained in the
 and in the "ngircd.conf" manual page.
 
 
-IV. Command line options
+VI. Command line options
 ~~~~~~~~~~~~~~~~~~~~~~~~
 
 These parameters could be passed to the ngIRCd:
@@ -183,4 +241,4 @@ number. In both cases the server exits after the output.
 
 
 -- 
-$Id: INSTALL,v 1.21 2005/02/10 08:20:09 alex Exp $
+$Id: INSTALL,v 1.23.2.1 2006/08/02 08:19:38 alex Exp $

+ 2 - 2
Makefile.am

@@ -8,7 +8,7 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.16 2005/04/09 12:27:40 alex Exp $
+# $Id: Makefile.am,v 1.17 2005/07/22 21:01:52 alex Exp $
 #
 
 AUTOMAKE_OPTIONS = gnu
@@ -28,7 +28,7 @@ lint:
 	make -C src/ngircd lint
 
 srcdoc:
-	make -C src srcdoc
+	make -C doc srcdoc
 
 xcode:
 	@xcodebuild -project contrib/MacOSX/ngIRCd.xcode -list >/dev/null 2>&1 \

+ 159 - 99
Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -24,9 +24,8 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.16 2005/04/09 12:27:40 alex Exp $
+# $Id: Makefile.am,v 1.17 2005/07/22 21:01:52 alex Exp $
 #
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -34,7 +33,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = .
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -48,7 +46,45 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
+	ChangeLog INSTALL NEWS config.guess config.sub depcomp \
+	install-sh missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -102,6 +138,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -122,6 +160,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -133,45 +172,43 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 AUTOMAKE_OPTIONS = gnu
-
 SUBDIRS = doc src man contrib
-subdir = .
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-
-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
-	ps-recursive install-info-recursive uninstall-info-recursive \
-	all-recursive install-data-recursive install-exec-recursive \
-	installdirs-recursive install-recursive uninstall-recursive \
-	check-recursive installcheck-recursive
-DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure AUTHORS \
-	COPYING ChangeLog INSTALL Makefile.am NEWS aclocal.m4 \
-	config.guess config.sub configure.in depcomp install-sh missing \
-	mkinstalldirs
-DIST_SUBDIRS = $(SUBDIRS)
 all: all-recursive
 
 .SUFFIXES:
-
-am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+am--refresh:
+	@:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+	      cd $(srcdir) && $(AUTOMAKE) --gnu  \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
-
-$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
 	$(SHELL) ./config.status --recheck
-$(srcdir)/configure:  $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
-	cd $(srcdir) && $(AUTOCONF)
 
-$(ACLOCAL_M4):  configure.in 
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 uninstall-info-am:
 
@@ -182,7 +219,13 @@ uninstall-info-am:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -194,7 +237,7 @@ $(RECURSIVE_TARGETS):
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -202,7 +245,13 @@ $(RECURSIVE_TARGETS):
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -223,7 +272,7 @@ maintainer-clean-recursive:
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -234,14 +283,6 @@ ctags-recursive:
 	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
-tags: TAGS
-
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -250,19 +291,22 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	mkid -fID $$unique
+tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
 	here=`pwd`; \
-	if (etags --etags-include --version) >/dev/null 2>&1; then \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
+	  empty_fix=.; \
 	else \
 	  include_option=--include; \
+	  empty_fix=; \
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -f $$subdir/TAGS && \
+	    test ! -f $$subdir/TAGS || \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
@@ -272,10 +316,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
-
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -298,19 +343,6 @@ GTAGS:
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = .
-distdir = $(PACKAGE)-$(VERSION)
-
-am__remove_distdir = \
-  { test ! -d $(distdir) \
-    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
-         && rm -fr $(distdir); }; }
-
-GZIP_ENV = --best
-distuninstallcheck_listfiles = find . -type f -print
-distcleancheck_listfiles = find . -type f -print
 
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
@@ -326,7 +358,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -341,15 +373,17 @@ distdir: $(DISTFILES)
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d $(distdir)/$$subdir \
-	    || mkdir $(distdir)/$$subdir \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
 	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
 	    (cd $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$(top_distdir)" \
-	        distdir=../$(distdir)/$$subdir \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -360,19 +394,46 @@ distdir: $(DISTFILES)
 	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
 	|| chmod -R a+r $(distdir)
 dist-gzip: distdir
-	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
 	$(am__remove_distdir)
 
 dist dist-all: distdir
-	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
 	$(am__remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
 # it guarantees that the distribution is self-contained by making another
 # tarfile.
 distcheck: dist
-	$(am__remove_distdir)
-	GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
 	chmod -R a-w $(distdir); chmod a+w $(distdir)
 	mkdir $(distdir)/_build
 	mkdir $(distdir)/_inst
@@ -392,19 +453,20 @@ distcheck: dist
 	        distuninstallcheck \
 	  && chmod -R a-w "$$dc_install_base" \
 	  && ({ \
-	       (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
 	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
 	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
 	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
 	  && rm -rf "$$dc_destdir" \
-	  && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
-	  && rm -f $(distdir).tar.gz \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
 	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
 	$(am__remove_distdir)
-	@echo "$(distdir).tar.gz is ready for distribution" | \
-	  sed 'h;s/./=/g;p;x;p;x'
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
 distuninstallcheck:
 	@cd $(distuninstallcheck_dir) \
 	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
@@ -428,7 +490,6 @@ check: check-recursive
 all-am: Makefile
 installdirs: installdirs-recursive
 installdirs-am:
-
 install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
@@ -448,7 +509,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -466,6 +527,8 @@ dvi: dvi-recursive
 
 dvi-am:
 
+html: html-recursive
+
 info: info-recursive
 
 info-am:
@@ -503,22 +566,19 @@ uninstall-am: uninstall-info-am
 
 uninstall-info: uninstall-info-recursive
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
-	clean-generic clean-local clean-recursive ctags ctags-recursive \
-	dist dist-all dist-gzip distcheck distclean distclean-generic \
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+	check-am clean clean-generic clean-local clean-recursive ctags \
+	ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+	dist-tarZ dist-zip distcheck distclean distclean-generic \
 	distclean-recursive distclean-tags distcleancheck distdir \
-	distuninstallcheck dvi dvi-am dvi-recursive info info-am \
-	info-recursive install install-am install-data install-data-am \
-	install-data-recursive install-exec install-exec-am \
-	install-exec-recursive install-info install-info-am \
-	install-info-recursive install-man install-recursive \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
 	install-strip installcheck installcheck-am installdirs \
-	installdirs-am installdirs-recursive maintainer-clean \
-	maintainer-clean-generic maintainer-clean-local \
-	maintainer-clean-recursive mostlyclean mostlyclean-generic \
-	mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
-	ps-recursive tags tags-recursive uninstall uninstall-am \
-	uninstall-info-am uninstall-info-recursive uninstall-recursive
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	maintainer-clean-local maintainer-clean-recursive mostlyclean \
+	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am uninstall-info-am
 
 
 clean-local:
@@ -534,7 +594,7 @@ lint:
 	make -C src/ngircd lint
 
 srcdoc:
-	make -C src srcdoc
+	make -C doc srcdoc
 
 xcode:
 	@xcodebuild -project contrib/MacOSX/ngIRCd.xcode -list >/dev/null 2>&1 \

+ 17 - 2
NEWS

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2005 Alexander Barton,
+                        (c)2001-2006 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -10,6 +10,21 @@
                                   -- NEWS --
 
 
+ngIRCd 0.10.0 (2006-10-01)
+
+  ngIRCd 0.10.0-pre1 (2006-08-02)
+  - Enhanced DIE to accept a single parameter ("comment text") which is sent
+    to all locally connected clients before the server goes down.
+  - JOIN now supports more than one channel key at a time.
+  - Implemented numeric "333": Time and user name who set a channel topic.
+  - Channel topics are no longer limited to 127 characters: now the only limit
+    is the maximum length of an IRC command, i. e. 512 bytes (in practice, this
+    limits the topic to about 490 characters due to protocol overhead).
+  - Reverse DNS lookup code now checks the result by doing an additional
+    lookup to prevent spoofing.
+  - Added new IO layer which (optionally) supports epoll() and kqueue() in
+    addition to the select() interface.
+
 ngIRCd 0.9.0 (2005-07-24)
 
   - Never run with root privileges but always switch the user ID.
@@ -208,4 +223,4 @@ ngIRCd 0.0.1, 31.12.2001
 
 
 -- 
-$Id: NEWS,v 1.74.2.1 2005/07/24 21:39:45 alex Exp $
+$Id: NEWS,v 1.75.2.3 2006/10/01 16:21:55 alex Exp $

+ 2 - 2
README

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2005 Alexander Barton,
+                        (c)2001-2006 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -84,4 +84,4 @@ mail to <alex@barton.de>.
 
 
 -- 
-$Id: README,v 1.20.2.1 2005/07/09 14:41:39 alex Exp $
+$Id: README,v 1.21.2.1 2006/08/02 08:19:38 alex Exp $

File diff suppressed because it is too large
+ 550 - 673
aclocal.m4


+ 41 - 10
config.guess

@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-timestamp='2005-08-03'
+timestamp='2006-02-23'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -106,7 +106,7 @@ set_cc_for_build='
 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
 : ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
  { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
@@ -206,6 +206,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:ekkoBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
 	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
     macppc:MirBSD:*:*)
 	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
@@ -764,7 +767,12 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
@@ -772,6 +780,9 @@ EOF
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    i*:MSYS_NT-*:*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
     i*:windows32*:*)
     	# uname -m includes "-pc" on this system.
     	echo ${UNAME_MACHINE}-mingw32
@@ -779,8 +790,11 @@ EOF
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    x86:Interix*:[34]*)
-	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+    x86:Interix*:[345]*)
+	echo i586-pc-interix${UNAME_RELEASE}
+	exit ;;
+    EM64T:Interix*:[345]*)
+	echo x86_64-unknown-interix${UNAME_RELEASE}
 	exit ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
@@ -851,7 +865,11 @@ EOF
 	#endif
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     mips64:Linux:*:*)
@@ -870,7 +888,11 @@ EOF
 	#endif
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
@@ -919,6 +941,9 @@ EOF
     sparc:Linux:*:* | sparc64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
     x86_64:Linux:*:*)
 	echo x86_64-unknown-linux-gnu
 	exit ;;
@@ -964,7 +989,7 @@ EOF
 	LIBC=gnulibc1
 	# endif
 	#else
-	#ifdef __INTEL_COMPILER
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun)
 	LIBC=gnu
 	#else
 	LIBC=gnuaout
@@ -974,7 +999,11 @@ EOF
 	LIBC=dietlibc
 	#endif
 EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
 	test x"${LIBC}" != x && {
 		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
 		exit
@@ -1185,7 +1214,6 @@ EOF
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
-	    *86) UNAME_PROCESSOR=i686 ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1264,6 +1292,9 @@ EOF
     i*86:skyos:*:*)
 	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
 	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2

+ 38 - 9
config.sub

@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-timestamp='2005-07-08'
+timestamp='2006-02-23'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -119,8 +119,9 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
-  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -171,6 +172,10 @@ case $os in
 	-hiux*)
 		os=-hiuxwe2
 		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-sco5)
 		os=-sco3.2v5
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -187,6 +192,10 @@ case $os in
 		# Don't forget version if it is 3.2v4 or newer.
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
 	-sco*)
 		os=-sco3.2v2
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -239,7 +248,7 @@ case $basic_machine in
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
-	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+	| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -257,8 +266,9 @@ case $basic_machine in
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
-	| ms1 \
+	| mt \
 	| msp430 \
+	| nios | nios2 \
 	| ns16k | ns32k \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
@@ -286,6 +296,9 @@ case $basic_machine in
 		;;
 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
 		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
 
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
@@ -336,8 +349,9 @@ case $basic_machine in
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipstx39-* | mipstx39el-* \
 	| mmix-* \
-	| ms1-* \
+	| mt-* \
 	| msp430-* \
+	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
@@ -696,6 +710,9 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-msdos
 		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
@@ -803,6 +820,12 @@ case $basic_machine in
 	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
@@ -859,6 +882,10 @@ case $basic_machine in
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
 	rom68k)
 		basic_machine=m68k-rom68k
 		os=-coff
@@ -1174,21 +1201,23 @@ case $os in
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* \
 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku*)
+	      | -skyos* | -haiku* | -rdos*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)

File diff suppressed because it is too large
+ 957 - 483
configure


+ 98 - 28
configure.in

@@ -1,6 +1,6 @@
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2005 Alexander Barton <alex@barton.de>
+# Copyright (c)2001-2006 Alexander Barton <alex@barton.de>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -8,13 +8,13 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: configure.in,v 1.111.2.6 2005/10/15 12:44:08 alex Exp $
+# $Id: configure.in,v 1.118.2.6 2006/10/01 16:21:56 alex Exp $
 #
 
 # -- Initialisation --
 
 AC_PREREQ(2.50)
-AC_INIT(ngircd, 0.9.2)
+AC_INIT(ngircd, 0.10.0)
 AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
 AC_CANONICAL_TARGET
 AM_INIT_AUTOMAKE(1.6)
@@ -30,7 +30,7 @@ AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
 AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
 AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
-AH_TEMPLATE([RENDEZVOUS], [Define if Rendezvous support should be included])
+AH_TEMPLATE([ZEROCONF], [Define if support for Zeroconf should be included])
 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
 
 AH_TEMPLATE([TARGET_OS], [Target operating system name])
@@ -56,9 +56,27 @@ AC_C_CONST
 
 # -- Hard coded system and compiler dependencies/features/options ... --
 
+AC_DEFUN([GCC_STACK_PROTECT_CC],[
+  ssp_cc=yes
+  # we use -fstack-protector-all for the test to enfoce the use of the guard variable 
+  AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
+  ssp_old_cflags="$CFLAGS"
+  CFLAGS="$CFLAGS -fstack-protector-all"
+  AC_TRY_LINK(,,, ssp_cc=no)
+  echo $ssp_cc
+  CFLAGS="$ssp_old_cflags"
+  if test "X$ssp_cc" = "Xyes"; then
+      CFLAGS="$CFLAGS -fstack-protector"
+      AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
+  fi
+])
+
+
 if test "$GCC" = "yes"; then
 	# We are using the GNU C compiler. Good!
 	CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
+
+	GCC_STACK_PROTECT_CC
 fi
 
 case "$target_os" in
@@ -105,6 +123,7 @@ AC_TRY_COMPILE([
 AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
 
+
 # -- Libraries --
 
 AC_CHECK_LIB(UTIL,memmove)
@@ -178,6 +197,45 @@ if test "$x_zlib_on" = "yes"; then
 	AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
 fi
 
+
+x_io_backend=select
+AC_ARG_WITH(epoll,
+	[  --without-epoll         disable epoll support (autodetected by default)],
+	[	if test "$withval" != "no"; then
+			if test "$withval" != "yes"; then
+				CFLAGS="-I$withval/include $CFLAGS"
+				CPPFLAGS="-I$withval/include $CPPFLAGS"
+				LDFLAGS="-L$withval/lib $LDFLAGS"
+			fi
+			AC_CHECK_FUNCS(epoll_create, x_io_backend=epoll,
+				AC_MSG_ERROR([Can't enable epoll support!])
+			)
+		fi
+	],
+	[
+		AC_CHECK_FUNCS(epoll_create, x_io_backend=epoll)
+	]
+)
+
+AC_ARG_WITH(kqueue,
+	[  --without-kqueue        disable kqueue support (autodetected by default)],
+	[	if test "$withval" != "no"; then
+			if test "$withval" != "yes"; then
+				CFLAGS="-I$withval/include $CFLAGS"
+				CPPFLAGS="-I$withval/include $CPPFLAGS"
+				LDFLAGS="-L$withval/lib $LDFLAGS"
+			fi
+			AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue,
+				AC_MSG_ERROR([Can't enable kqueue support!])
+			)
+		fi
+	],
+	[
+		AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue)
+	]
+)
+
+
 x_tcpwrap_on=no
 AC_ARG_WITH(tcp-wrappers,
 	[  --with-tcp-wrappers     enable TCP wrappers support],
@@ -207,34 +265,35 @@ int deny_severity = 0;
 	]
 )
 
-x_rendezvous_on=no
-AC_ARG_WITH(rendezvous,
-	[  --with-rendezvous       enable support for "Rendezvous"],
+x_zeroconf_on=no
+AC_ARG_WITH(zeroconf,
+	[  --with-zeroconf         enable support for "Zeroconf"],
 	[	if test "$withval" != "no"; then
 			if test "$withval" != "yes"; then
 				CFLAGS="-I$withval/include $CFLAGS"
 				CPPFLAGS="-I$withval/include $CPPFLAGS"
 				LDFLAGS="-L$withval/lib $LDFLAGS"
 			fi
-			AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_rendezvous_on=osx,
+			AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_zeroconf_on=osx,
 			[
 				AC_CHECK_LIB(pthread, pthread_mutexattr_init)
 				AC_CHECK_LIB(howl, sw_discovery_init)
 				AC_CHECK_FUNCS(sw_discovery_init, \
-				 x_rendezvous_on=howl, \
-				 AC_MSG_ERROR([Can't enable Rendezvous!]))
+				 x_zeroconf_on=howl, \
+				 AC_MSG_ERROR([Can't enable Zeroconf!]))
 			])
 		fi
 	]
 )
-if test "$x_rendezvous_on" = "osx"; then
+if test "$x_zeroconf_on" = "osx"; then
 	AC_CHECK_HEADERS([DNSServiceDiscovery/DNSServiceDiscovery.h \
 	 mach/port.h],,AC_MSG_ERROR([required C header missing!]))
-	AC_DEFINE(RENDEZVOUS, 1)
+	AC_DEFINE(ZEROCONF, 1)
 fi
-if test "$x_rendezvous_on" = "howl"; then
+if test "$x_zeroconf_on" = "howl"; then
 	for dir in /usr/local/include /usr/local/include/howl* \
-	 /usr/include /usr/include/howl*; do
+	 /usr/include /usr/include/howl* \
+	 /usr/local/include/avahi* /usr/include/avahi*; do
 	 	test -d "$dir" || continue
 		AC_MSG_CHECKING([for Howl headers in $dir])
 		if test -f "$dir/rendezvous/rendezvous.h"; then
@@ -251,7 +310,7 @@ if test "$x_rendezvous_on" = "howl"; then
 	done
 	AC_CHECK_HEADERS([rendezvous/rendezvous.h],, \
 	 AC_MSG_ERROR([required C header missing!]))
-	AC_DEFINE(RENDEZVOUS, 1)
+	AC_DEFINE(ZEROCONF, 1)
 fi
 
 x_identauth_on=no
@@ -326,6 +385,7 @@ test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
 AC_OUTPUT([ \
 	Makefile \
 	doc/Makefile \
+	doc/src/Makefile \
 	src/Makefile \
 	src/portab/Makefile \
 	src/tool/Makefile \
@@ -374,8 +434,8 @@ echo
 
 echo $ECHO_N "     Syslog support: $ECHO_C"
 test "$x_syslog_on" = "yes" \
-	&& echo $ECHO_N "yes $ECHO_C" \
-	|| echo $ECHO_N "no  $ECHO_C"
+	&& echo $ECHO_N "yes   $ECHO_C" \
+	|| echo $ECHO_N "no    $ECHO_C"
 echo $ECHO_N "  Enable debug code: $ECHO_C"
 test "$x_debug_on" = "yes" \
 	&& echo "yes" \
@@ -383,8 +443,8 @@ test "$x_debug_on" = "yes" \
 
 echo $ECHO_N "   zlib compression: $ECHO_C"
 test "$x_zlib_on" = "yes" \
-	&& echo $ECHO_N "yes $ECHO_C" \
-	|| echo $ECHO_N "no  $ECHO_C"
+	&& echo $ECHO_N "yes   $ECHO_C" \
+	|| echo $ECHO_N "no    $ECHO_C"
 echo $ECHO_N "        IRC sniffer: $ECHO_C"
 test "$x_sniffer_on" = "yes" \
 	&& echo "yes" \
@@ -392,17 +452,25 @@ test "$x_sniffer_on" = "yes" \
 
 echo $ECHO_N "   Use TCP Wrappers: $ECHO_C"
 test "$x_tcpwrap_on" = "yes" \
-	&& echo $ECHO_N "yes $ECHO_C" \
-	|| echo $ECHO_N "no  $ECHO_C"
+	&& echo $ECHO_N "yes   $ECHO_C" \
+	|| echo $ECHO_N "no    $ECHO_C"
 echo $ECHO_N "    Strict RFC mode: $ECHO_C"
 test "$x_strict_rfc_on" = "yes" \
 	&& echo "yes" \
 	|| echo "no"
 
-echo $ECHO_N " Rendezvous support: $ECHO_C"
-test "$x_rendezvous_on" = "osx" -o "$x_rendezvous_on" = "howl" \
-	&& echo $ECHO_N "yes $ECHO_C" \
-	|| echo $ECHO_N "no  $ECHO_C"
+echo $ECHO_N "   Zeroconf support: $ECHO_C"
+case "$x_zeroconf_on" in
+	osx)
+		echo $ECHO_N "Apple $ECHO_C"
+		;;
+	howl)
+		echo $ECHO_N "Howl  $ECHO_C"
+		;;
+	*)
+		echo $ECHO_N "no    $ECHO_C"
+		;;
+esac
 echo $ECHO_N "      IRC+ protocol: $ECHO_C"
 test "$x_ircplus_on" = "yes" \
 	&& echo "yes" \
@@ -410,9 +478,11 @@ test "$x_ircplus_on" = "yes" \
 
 echo $ECHO_N "      IDENT support: $ECHO_C"
 test "$x_identauth_on" = "yes" \
-	&& echo $ECHO_N "yes $ECHO_C" \
-	|| echo $ECHO_N "no  $ECHO_C"
+	&& echo $ECHO_N "yes   $ECHO_C" \
+	|| echo $ECHO_N "no    $ECHO_C"
+echo $ECHO_N "        I/O backend: $ECHO_C"
+	echo "\"$x_io_backend()\""
 
-echo; echo
+echo
 
 # -eof-

+ 56 - 28
contrib/Debian/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -26,7 +26,6 @@
 #
 # $Id: Makefile.am,v 1.4 2004/05/11 00:32:31 alex Exp $
 #
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -34,7 +33,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ../..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -48,7 +46,21 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/Debian
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -102,6 +114,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -122,6 +136,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -133,25 +148,41 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 EXTRA_DIST = rules changelog compat control copyright \
 	ngircd.init ngircd.postinst
 
-subdir = contrib/Debian
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  contrib/Debian/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  contrib/Debian/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 uninstall-info-am:
 tags: TAGS
 TAGS:
@@ -159,10 +190,6 @@ TAGS:
 ctags: CTAGS
 CTAGS:
 
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -176,7 +203,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -194,7 +221,6 @@ distdir: $(DISTFILES)
 check-am: all-am
 check: check-am
 all-am: Makefile
-
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -215,7 +241,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -232,6 +258,8 @@ dvi: dvi-am
 
 dvi-am:
 
+html: html-am
+
 info: info-am
 
 info-am:
@@ -266,11 +294,11 @@ ps-am:
 uninstall-am: uninstall-info-am
 
 .PHONY: all all-am check check-am clean clean-generic clean-local \
-	distclean distclean-generic distdir dvi dvi-am info info-am \
-	install install-am install-data install-data-am install-exec \
-	install-exec-am install-info install-info-am install-man \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic \
+	distclean distclean-generic distdir dvi dvi-am html html-am \
+	info info-am install install-am install-data install-data-am \
+	install-exec install-exec-am install-info install-info-am \
+	install-man install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
 	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
 	pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
 

+ 25 - 0
contrib/Debian/changelog

@@ -1,3 +1,28 @@
+ngircd (0.10.0-0ab1) unstable; urgency=low
+
+  * New "upstream" release: 0.10.0
+
+ -- Alexander Barton <alex@barton.de>  Sun,  1 Oct 2006 18:14:21 +0200
+
+ngircd (0.10.0-0ab0-pre2-1) unstable; urgency=low
+
+  * Bumped standards version to 3.7.2.1.
+  * Added "Provides: ircd" to Debian control file.
+
+ -- Alexander Barton <alex@barton.de>  Sun,  1 Oct 2006 16:25:33 +0200
+
+ngircd (0.10.0-0ab0-pre2) unstable; urgency=low
+
+  * Second "upstream" prerelease of upcoming 0.10.0 release.
+
+ -- Alexander Barton <alex@barton.de>  Sat,  9 Sep 2006 20:57:52 +0200
+
+ngircd (0.10.0-0ab0-pre1) unstable; urgency=low
+
+  * Prerelease of upcoming new "upstream release".
+
+ -- Alexander Barton <alex@barton.de>  Wed,  2 Aug 2006 12:01:07 +0200
+
 ngircd (0.9.2-0ab1) unstable; urgency=low
 
   * New "upstream release" fixing a few bugs in 0.9.1.

+ 3 - 1
contrib/Debian/control

@@ -3,11 +3,12 @@ Section: net
 Priority: optional
 Maintainer: Alexander Barton <alex@barton.de>
 Build-Depends: debhelper (>> 4.0.0), libz-dev, libwrap-dev, libident-dev
-Standards-Version: 3.5.8
+Standards-Version: 3.7.2.1
 
 Package: ngircd
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: ircd
 Description: A lightweight daemon for the Internet Relay Chat (IRC)
  ngIRCd is a free open source daemon for the Internet Relay Chat (IRC)
  network. It is written from scratch and is not based upon the original
@@ -28,6 +29,7 @@ Description: A lightweight daemon for the Internet Relay Chat (IRC)
 Package: ngircd-full
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: ircd
 Conflicts: ngircd
 Description: A lightweight daemon for the Internet Relay Chat (IRC)
  ngIRCd is a free open source daemon for the Internet Relay Chat (IRC)

+ 1 - 1
contrib/Debian/ngircd.init

@@ -2,7 +2,7 @@
 #
 # ngIRCd start and stop script for Debian-based systems
 #
-# $Id: ngircd.init,v 1.5.2.1 2005/07/26 19:30:54 alex Exp $
+# $Id: ngircd.init,v 1.6 2005/07/26 19:37:18 alex Exp $
 #
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

+ 56 - 27
contrib/MacOSX/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -26,7 +26,6 @@
 #
 # $Id: Makefile.am,v 1.2 2004/05/11 00:34:26 alex Exp $
 #
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -34,7 +33,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ../..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -48,7 +46,21 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+subdir = contrib/MacOSX
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -102,6 +114,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -122,6 +136,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -133,21 +148,38 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-subdir = contrib/MacOSX
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  contrib/MacOSX/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  contrib/MacOSX/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 uninstall-info-am:
 tags: TAGS
 TAGS:
@@ -155,10 +187,6 @@ TAGS:
 ctags: CTAGS
 CTAGS:
 
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -172,7 +200,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -190,7 +218,6 @@ distdir: $(DISTFILES)
 check-am: all-am
 check: check-am
 all-am: Makefile
-
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -211,7 +238,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -228,6 +255,8 @@ dvi: dvi-am
 
 dvi-am:
 
+html: html-am
+
 info: info-am
 
 info-am:
@@ -262,11 +291,11 @@ ps-am:
 uninstall-am: uninstall-info-am
 
 .PHONY: all all-am check check-am clean clean-generic clean-local \
-	distclean distclean-generic distdir dvi dvi-am info info-am \
-	install install-am install-data install-data-am install-exec \
-	install-exec-am install-info install-info-am install-man \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic \
+	distclean distclean-generic distdir dvi dvi-am html html-am \
+	info info-am install install-am install-data install-data-am \
+	install-exec install-exec-am install-info install-info-am \
+	install-man install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
 	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
 	pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
 

+ 103 - 68
contrib/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -27,7 +27,6 @@
 #
 # $Id: Makefile.am,v 1.4 2004/04/28 12:18:02 alex Exp $
 #
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -35,7 +34,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -49,7 +47,30 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+subdir = contrib
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -103,6 +124,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -123,6 +146,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -134,32 +158,40 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 SUBDIRS = Debian MacOSX
-
 EXTRA_DIST = README ngircd.spec systrace.policy
-subdir = contrib
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-
-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
-	ps-recursive install-info-recursive uninstall-info-recursive \
-	all-recursive install-data-recursive install-exec-recursive \
-	installdirs-recursive install-recursive uninstall-recursive \
-	check-recursive installcheck-recursive
-DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am
-DIST_SUBDIRS = $(SUBDIRS)
 all: all-recursive
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  contrib/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  contrib/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 uninstall-info-am:
 
 # This directory's subdirectories are mostly independent; you can cd
@@ -169,7 +201,13 @@ uninstall-info-am:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -181,7 +219,7 @@ $(RECURSIVE_TARGETS):
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -189,7 +227,13 @@ $(RECURSIVE_TARGETS):
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -210,7 +254,7 @@ maintainer-clean-recursive:
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -221,14 +265,6 @@ ctags-recursive:
 	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
-tags: TAGS
-
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -237,19 +273,22 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	mkid -fID $$unique
+tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
 	here=`pwd`; \
-	if (etags --etags-include --version) >/dev/null 2>&1; then \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
+	  empty_fix=.; \
 	else \
 	  include_option=--include; \
+	  empty_fix=; \
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -f $$subdir/TAGS && \
+	    test ! -f $$subdir/TAGS || \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
@@ -259,10 +298,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
-
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -285,10 +325,6 @@ GTAGS:
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -302,7 +338,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -317,15 +353,17 @@ distdir: $(DISTFILES)
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d $(distdir)/$$subdir \
-	    || mkdir $(distdir)/$$subdir \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
 	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
 	    (cd $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$(top_distdir)" \
-	        distdir=../$(distdir)/$$subdir \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -335,7 +373,6 @@ check: check-recursive
 all-am: Makefile
 installdirs: installdirs-recursive
 installdirs-am:
-
 install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
@@ -355,7 +392,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -372,6 +409,8 @@ dvi: dvi-recursive
 
 dvi-am:
 
+html: html-recursive
+
 info: info-recursive
 
 info-am:
@@ -407,21 +446,17 @@ uninstall-am: uninstall-info-am
 
 uninstall-info: uninstall-info-recursive
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
-	clean-generic clean-recursive ctags ctags-recursive distclean \
-	distclean-generic distclean-recursive distclean-tags distdir \
-	dvi dvi-am dvi-recursive info info-am info-recursive install \
-	install-am install-data install-data-am install-data-recursive \
-	install-exec install-exec-am install-exec-recursive \
-	install-info install-info-am install-info-recursive install-man \
-	install-recursive install-strip installcheck installcheck-am \
-	installdirs installdirs-am installdirs-recursive \
-	maintainer-clean maintainer-clean-generic \
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+	clean clean-generic clean-recursive ctags ctags-recursive \
+	distclean distclean-generic distclean-recursive distclean-tags \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
 	maintainer-clean-local maintainer-clean-recursive mostlyclean \
-	mostlyclean-generic mostlyclean-recursive pdf pdf-am \
-	pdf-recursive ps ps-am ps-recursive tags tags-recursive \
-	uninstall uninstall-am uninstall-info-am \
-	uninstall-info-recursive uninstall-recursive
+	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am uninstall-info-am
 
 
 maintainer-clean-local:

+ 11 - 5
contrib/README

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                      (c)2001-2004 by Alexander Barton,
+                        (c)2001-2005 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -10,11 +10,17 @@
                             -- Contributions --
 
 
+Debian/
+ - Various files for building Debian GNU/Linux packages (".deb's").
+
 MacOSX/
- - Project file for XCode "project builder" of Mac OS X.
+ - Project files for XCode, the "project builder" of Apple Mac OS X.
 
-Debian/
- - Various files for building Debian packages.
+ngindent
+ - Script to indent the code of ngIRCd in the "standard way".
+
+ngircd.sh
+ - Start script for FreeBSD.
 
 ngircd.spec
  - RPM "spec" file.
@@ -24,4 +30,4 @@ systrace.policy
 
 
 --
-$Id: README,v 1.1 2004/04/28 12:18:50 alex Exp $
+$Id: README,v 1.3 2006/07/23 11:34:32 alex Exp $

+ 1 - 1
contrib/ngircd.spec

@@ -1,5 +1,5 @@
 %define name    ngircd
-%define version 0.9.2
+%define version 0.10.0
 %define release 1
 %define prefix  %{_prefix}
 

+ 73 - 23
depcomp

@@ -1,7 +1,9 @@
 #! /bin/sh
-
 # depcomp - compile a program generating dependencies as side-effects
-# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
+
+scriptversion=2005-02-09.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -25,22 +27,45 @@
 
 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
 
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   exit 1
 fi
-# `libtool' can also be set to `yes' or `no'.
-
-if test -z "$depfile"; then
-   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
-   dir=`echo "$object" | sed 's,/.*$,/,'`
-   if test "$dir" = "$object"; then
-      dir=
-   fi
-   # FIXME: should be _deps on DOS.
-   depfile="$dir.deps/$base"
-fi
 
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 
 rm -f "$tmpdepfile"
@@ -262,27 +287,43 @@ tru64)
    base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
 
    if test "$libtool" = yes; then
-      tmpdepfile1="$dir.libs/$base.lo.d"
-      tmpdepfile2="$dir.libs/$base.d"
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
       "$@" -Wc,-MD
    else
-      tmpdepfile1="$dir$base.o.d"
-      tmpdepfile2="$dir$base.d"
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
       "$@" -MD
    fi
 
    stat=$?
    if test $stat -eq 0; then :
    else
-      rm -f "$tmpdepfile1" "$tmpdepfile2"
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
       exit $stat
    fi
 
-   if test -f "$tmpdepfile1"; then
-      tmpdepfile="$tmpdepfile1"
-   else
-      tmpdepfile="$tmpdepfile2"
-   fi
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
    if test -f "$tmpdepfile"; then
       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
       # That's a tab and a space in the [].
@@ -477,3 +518,12 @@ none)
 esac
 
 exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

+ 10 - 9
doc/CVS.txt

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                      (c)2001-2003 by Alexander Barton,
+                        (c)2001-2006 Alexander Barton,
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -21,18 +21,19 @@ To access the source tree anonymously in read-only mode, follow these steps:
 
 Login to the CVS server:
 
- $ cvs -d:pserver:anonymous@arthur.ath.cx:/usr/local/CVS/ngircd login
+ $ cvs -d:pserver:anonymous@ngircd.barton.de:/srv/cvs/ngircd login
 
 Use "anonymous" as user name and no password (just hit Return). Now you can
 check out the sources:
 
- $ cvs -d:pserver:anonymous@arthur.ath.cx:/usr/local/CVS/ngircd checkout ngircd
+ $ cvs -d:pserver:anonymous@ngircd.barton.de:/srv/cvs/ngircd checkout ngircd
 
 Thereby a new folder "ngircd" will be created containing all the individual
-source files.
+source files. (Substitute the last "ngircd" with "website" to check out all
+the files of the homepage of ngIRCd.)
 
-This is the "working folder", all CVS commands will be executed from within
-this folder in the future.
+The newly created folder ("ngircd" or "website") is the "working folder", all
+CVS commands will be executed from within this folder in the future.
 
 Please note: When checking out a fresh copy of ngIRCd from CVS, the
 configure script doesn't exist; you have to run the autogen.sh shell script
@@ -46,11 +47,11 @@ Updating the CVS tree:
 You can update a single file or the complete source tree.
 
 
-III. Write Access
-~~~~~~~~~~~~~~~~~
+II. Write Access
+~~~~~~~~~~~~~~~~
 If you want to contribute a couple of patches and write access to the CVS
 repository would be handy, please contact Alex Barton, <alex@barton.de>.
 
 
 -- 
-$Id: CVS.txt,v 1.7 2003/03/26 22:34:33 alex Exp $
+$Id: CVS.txt,v 1.8.2.1 2006/08/02 09:04:20 alex Exp $

+ 10 - 1
doc/FAQ.txt

@@ -62,6 +62,15 @@ A: On Linux/glibc with chroot enabled you need to put some libraries inside
    is to either disable chroot support or to link against dietlibc instead
    of glibc. (tnx to Sebastian Siewior)
 
+Q: I am running Linux and ngircd dies on startup with the follwing errors:
+   IO subsystem: epoll (hint size 100, initial maxfd 100, masterfd -1).
+   Cannot initialize IO routines: Function not implemented
+   Server isn't listening on a single port!
+   ngircd exiting due to fatal errors!
+A: epoll is only supported on 2.6 Linux kernels. Either use a 2.6 kernel, or
+   re-run configure with the --without-epoll parameter. After configure
+   completed, you should see select() being listed as IO backend:
+   '(I/O backend: "select()"').
 
 IV. Bugs!?
 ~~~~~~~~~~
@@ -76,4 +85,4 @@ A: Please file a bug report at <http://ngircd.barton.de/bugzilla/index.cgi>!
 
 
 -- 
-$Id: FAQ.txt,v 1.7.4.1 2005/07/09 14:41:39 alex Exp $
+$Id: FAQ.txt,v 1.11 2005/12/09 21:14:56 fw Exp $

+ 8 - 6
doc/Makefile.am

@@ -9,18 +9,17 @@
 # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
 # der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
 #
-# $Id: Makefile.am,v 1.18 2005/04/27 07:52:29 alex Exp $
+# $Id: Makefile.am,v 1.21 2005/11/29 20:59:57 alex Exp $
 #
 
-EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt Platforms.txt \
-	README-AUX.txt README-BeOS.txt RFC.txt sample-ngircd.conf
+SUBDIRS = src
+
+EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt Platforms.txt README-AUX.txt \
+	README-BeOS.txt RFC.txt Zeroconf.txt  sample-ngircd.conf
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in
 
-distclean-local:
-	rm -rf src
-
 docdir = $(datadir)/doc/$(PACKAGE)
 
 documents = $(EXTRA_DIST) ../AUTHORS ../COPYING ../ChangeLog ../INSTALL \
@@ -39,4 +38,7 @@ install-data-hook:
 uninstall-hook:
 	rm -rf $(DESTDIR)$(docdir)
 
+srcdoc:
+	make -C src srcdoc
+
 # -eof-

+ 242 - 58
doc/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -25,9 +25,8 @@
 # Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
 # der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
 #
-# $Id: Makefile.am,v 1.18 2005/04/27 07:52:29 alex Exp $
+# $Id: Makefile.am,v 1.21 2005/11/29 20:59:57 alex Exp $
 #
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -35,7 +34,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -49,7 +47,30 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+subdir = doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -103,6 +124,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -123,6 +146,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -134,42 +158,179 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
-EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt Platforms.txt \
-	README-AUX.txt README-BeOS.txt RFC.txt sample-ngircd.conf
-
+SUBDIRS = src
+EXTRA_DIST = CVS.txt FAQ.txt Protocol.txt Platforms.txt README-AUX.txt \
+	README-BeOS.txt RFC.txt Zeroconf.txt  sample-ngircd.conf
 
 docdir = $(datadir)/doc/$(PACKAGE)
-
 documents = $(EXTRA_DIST) ../AUTHORS ../COPYING ../ChangeLog ../INSTALL \
 	../NEWS ../README
 
-subdir = doc
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
-all: all-am
+all: all-recursive
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  doc/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  doc/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 uninstall-info-am:
-tags: TAGS
-TAGS:
 
-ctags: CTAGS
-CTAGS:
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
 
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
 
-top_distdir = ..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -183,7 +344,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -198,20 +359,35 @@ distdir: $(DISTFILES)
 	    || exit 1; \
 	  fi; \
 	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
 check-am: all-am
-check: check-am
+check: check-recursive
 all-am: Makefile
-
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
 
 install-am: all-am
 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
-installcheck: installcheck-am
+installcheck: installcheck-recursive
 install-strip:
 	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
 	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -222,24 +398,26 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
 
 clean-am: clean-generic mostlyclean-am
 
-distclean: distclean-am
+distclean: distclean-recursive
 	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-local
+distclean-am: clean-am distclean-generic distclean-tags
 
-dvi: dvi-am
+dvi: dvi-recursive
 
 dvi-am:
 
-info: info-am
+html: html-recursive
+
+info: info-recursive
 
 info-am:
 
@@ -249,26 +427,26 @@ install-data-am:
 
 install-exec-am:
 
-install-info: install-info-am
+install-info: install-info-recursive
 
 install-man:
 
 installcheck-am:
 
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic \
 	maintainer-clean-local
 
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
 
 mostlyclean-am: mostlyclean-generic
 
-pdf: pdf-am
+pdf: pdf-recursive
 
 pdf-am:
 
-ps: ps-am
+ps: ps-recursive
 
 ps-am:
 
@@ -276,22 +454,25 @@ uninstall-am: uninstall-info-am
 	@$(NORMAL_INSTALL)
 	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
 
-.PHONY: all all-am check check-am clean clean-generic distclean \
-	distclean-generic distclean-local distdir dvi dvi-am info \
-	info-am install install-am install-data install-data-am \
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+	clean clean-generic clean-recursive ctags ctags-recursive \
+	distclean distclean-generic distclean-recursive distclean-tags \
+	distdir dvi dvi-am html html-am info info-am install \
+	install-am install-data install-data-am install-data-hook \
 	install-exec install-exec-am install-info install-info-am \
 	install-man install-strip installcheck installcheck-am \
-	installdirs maintainer-clean maintainer-clean-generic \
-	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
-	pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic maintainer-clean-local \
+	maintainer-clean-recursive mostlyclean mostlyclean-generic \
+	mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+	uninstall uninstall-am uninstall-hook uninstall-info-am
 
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in
 
-distclean-local:
-	rm -rf src
-
 install-data-hook:
 	$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
 	if [ ! -f $(DESTDIR)$(sysconfdir)/ngircd.conf ]; then \
@@ -305,6 +486,9 @@ install-data-hook:
 uninstall-hook:
 	rm -rf $(DESTDIR)$(docdir)
 
+srcdoc:
+	make -C src srcdoc
+
 # -eof-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 19 - 8
doc/Platforms.txt

@@ -1,7 +1,7 @@
 
                      ngIRCd - Next Generation IRC Server
 
-                        (c)2001-2005 Alexander Barton
+                        (c)2001-2006 Alexander Barton
                     alex@barton.de, http://www.barton.de/
 
                ngIRCd is free software and published under the
@@ -26,21 +26,29 @@ list can be updated. Thanks for your help!
                                                                     | | | |
 Platform                    Compiler     ngIRCd     Date     Tester C M T R See
 --------------------------- ------------ ---------- -------- ------ - - - - ---
+alpha/unknown/netbsd3.0     gcc 3.3.3    CVSHEAD    06-05-07 fw     Y Y Y Y (3)
 hppa/unknown/openbsd3.5     gcc 2.95.3   CVSHEAD    04-05-25 alex   Y Y Y Y
 hppa1.1/unknown/linux-gnu   gcc 3.3.3    0.8.0      04-05-30 alex   Y Y Y Y
 hppa2.0/unknown/linux-gnu   gcc 3.3.5    0.9.x-CVS  05-06-27 alex   Y Y Y Y
 i386/pc/solaris2.9          gcc 3.2.2    CVSHEAD    04-02-24 alex   Y Y Y Y
+i386/pc/solaris2.11         gcc 3.4.3    CVSHEAD    06-08-04 alex   Y Y Y Y
 i386/unknown/freebsd5.2.1   gcc 3.3.3    0.8.0      04-05-30 alex   Y Y Y Y
+i386/unknown/freebsd6.0     gcc 3.4.4    0.10.0-p1  06-08-04 alex   Y Y Y Y (3)
+i386/unknown/freebsd6.1     gcc 3.4.4    CVSHEAD    06-05-07 fw     Y Y Y Y (3)
 i386/unknown/gnu0.3         gcc 3.3.3    0.8.0      04-05-30 alex   Y Y n Y
 i386/unknown/netbsdelf1.6.1 gcc 2.95.3   CVSHEAD    04-02-24 alex   Y Y Y Y
-i686/pc/cygwin              gcc 3.3.1    0.9.x-CVS  05-07-08 alex   Y Y n Y
+i386/unknown/netbsdelf3.0.1 gcc 3.3.3    0.10.0-p1  06-08-30 alex   Y Y Y Y (3)
+i386/unknown/openbsd3.9     gcc 3.3.5    0.10.0-p1  06-08-30 alex   Y Y Y Y (3)
+i686/pc/cygwin              gcc 3.3.1    0.8.0      04-05-30 alex   Y Y n Y
 i686/pc/linux-gnu           gcc 2.95.4   0.8.0      04-05-30 alex   Y Y Y Y (1)
-i686/pc/linux-gnu           gcc 3.3.5    0.9.x-CVS  05-07-09 alex   Y Y Y Y (1)
+i686/pc/linux-gnu           gcc 3.3.3    0.8.0      04-05-30 alex   Y Y Y Y (1)
+i386/pc/linux-gnu           gcc 4.1.2    0.10.0-p1  06-08-30 alex   Y Y Y Y (1)
 m68k/apple/aux3.1.1         Orig. A/UX   0.7.x-CVS  03-04-22 alex   Y Y Y Y (2)
 m68k/hp/hp-ux9.10           Orig. HPUX   0.7.x-CVS  03-04-30 goetz  Y Y Y Y
 m88k/dg/dgux5.4R3.10        gcc 2.5.8    CVSHEAD    04-03-15 alex   Y Y ? ?
 powerpc/apple/darwin6.5     gcc 3.1      0.7.x-CVS  03-04-23 alex   Y Y Y Y
 powerpc/apple/darwin7.4.0   gcc 3.3      0.8.0      04-05-30 alex   Y Y Y Y
+powerpc/apple/darwin7.9.0   gcc 3.3      CVSHEAD    06-05-07 fw     Y Y Y Y (3)
 powerpc/apple/darwin8.1.0   gcc 4.0      0.9.x-CVS  05-06-27 alex   Y Y Y Y
 powerpc/unknown/linux-gnu   gcc 3.3.3    0.8.0      04-05-30 alex   Y Y Y Y
 sparc/sun/solaris2.6        gcc 2.95.3   0.7.x-CVS  03-04-22 alex   Y Y Y Y
@@ -50,16 +58,19 @@ sparc/unkn./netbsdelf1.6.1  gcc 2.95.3   0.8.0      04-05-30 alex   Y Y Y Y
 
 Notes
 ~~~~~
+
 (1) i686/pc/linux-gnu:
     ngIRCd has been tested with various Linux distributions, such as SuSE,
     RedHat, Debian, and Gentoo using Kernels 2.2.x, 2.4.x and 2.6.x with
-    various versions of the GNU C compiler (2.95.3, 3.0, 3.2, and 3.3). The
-    eldest glibc used was glibc-2.0.7. ngIRCd compiled and run on all these
-    systems without problems.
+    various versions of the GNU C compiler (starting with 2.95.x and up to
+    version 4.1.x). The eldest glibc used was glibc-2.0.7. ngIRCd compiled
+    and run on all these systems without problems.
+    Actual Linux kernels (2.6.x) and glic's support the epoll() IO interface.
 
 (2) This compiler is an pre-ANSI C compiler, therefore the source code is
     automatically converted using the included ansi2knr tool while building.
-			
+
+(3) Using the kqueue() IO interface.
 
 -- 
-$Id: Platforms.txt,v 1.13.2.2 2005/07/09 11:16:38 alex Exp $
+$Id: Platforms.txt,v 1.14.2.1 2006/09/09 18:10:56 alex Exp $

+ 2 - 2
doc/Protocol.txt

@@ -93,7 +93,7 @@ defined in RFC 2813, section 4.1.1.
 II.2 Exchange channel-modes, topics, and persistent channels
 
      Command: CHANINFO
-  Parameters: <channel> +<modes> <key> <maxusers> [<topic>]
+  Parameters: <channel> +<modes> <key> <limit> [<topic>]
      Used by: servers only
 
 CHANINFO is used by servers to inform each other about a channel: its
@@ -115,4 +115,4 @@ channel mode). In this case <limit> should be "0".
 
 
 -- 
-$Id: Protocol.txt,v 1.12 2004/04/25 15:44:10 alex Exp $
+$Id: Protocol.txt,v 1.13 2005/08/27 19:00:06 alex Exp $

+ 4 - 4
doc/README-AUX.txt

@@ -22,7 +22,7 @@ The following software packages are needed:
  - GNU sed
    Source:
    http://www.rezepte-im-web.de/appleux/sed-3.02.tar.gz
-   ftp://arthur.barton.de/pub/UNIX/AUX/Tools/sed-3.02.tar.gz
+   ftp://arthur.barton.de/pub/unix/aux/tools/sed-3.02.tar.gz
 
    A/UX comes with /bin/sed which isn't supporting all functions needed
    by GNU automake/autoconf.
@@ -34,7 +34,7 @@ The following software packages are needed:
  - libUTIL.a
    Source:
    ftp://ftp.mayn.de/pub/really_old_stuff/apple/apple_unix/Sys_stuff/libUTIL-2.1.tar.gz>
-   ftp://arthur.barton.de/pub/UNIX/AUX/Libraries/libUTIL-2.1.tar.gz
+   ftp://arthur.barton.de/pub/unix/aux/libraries/libUTIL-2.1.tar.gz
 
    This library contains functions that are common on other UNIX
    systems but not on A/UX e.g. memmove(), strerror() und strdup().
@@ -50,7 +50,7 @@ A few hints in case of errors:
    (so 'configure' uses its own shell script) or use a fully functionable one.
    There's at least one binary "out there" causing problems. The one
    of the GNU fileutils works fine:
-   ftp://arthur.barton.de/pub/UNIX/AUX/Software/Tools/fileutils-4.0.tar.gz
+   ftp://arthur.barton.de/pub/unix/aux/tools/fileutils-4.0.tar.gz
 
  - The precompiled binary of the old 'bash' shouldn't be installed within
    /bin (better do this in /usr/local/bin) because 'configure' would
@@ -64,4 +64,4 @@ A few hints in case of errors:
    even if you don't use ngIRCd.
 
 -- 
-$Id: README-AUX.txt,v 1.9 2005/06/24 20:59:13 alex Exp $
+$Id: README-AUX.txt,v 1.10 2006/07/23 12:19:57 alex Exp $

+ 40 - 0
doc/Zeroconf.txt

@@ -0,0 +1,40 @@
+
+                     ngIRCd - Next Generation IRC Server
+
+                        (c)2001-2006 Alexander Barton
+                    alex@barton.de, http://www.barton.de/
+
+               ngIRCd is free software and published under the
+                   terms of the GNU General Public License.
+
+			      -- Zeroconf.txt --
+
+
+ngIRCd supports one aspect of Zeroconf Networking[1]: Multicast DNS (mDNS[2])
+with DNS Service Discovery (DNS-SD[3]).
+
+To use this features you can use one of two APIs:
+
+  a) Apple "Bonjour" API as used by Mac OS X,
+  b) the Howl[4] Zeroconf library or the Howl compatibility layer
+     of the newer Avahi[5] library.
+
+When calling the configure script using the "--with-zeroconf" switch the
+avalable API will be autodetected and the required additional libraries will
+be linked to the ngircd binary as required.
+
+ngIRCd then registers a DNS-SD service for each port it is listening on using
+the service type "_ircu._tcp.".
+
+
+Links:
+
+ [1] http://www.zeroconf.org/
+ [2] http://www.multicastdns.org/
+ [3] http://www.dns-sd.org/
+ [4] http://www.porchdogsoft.com/products/howl/
+ [5] http://avahi.org/
+
+
+-- 
+$Id: Zeroconf.txt,v 1.1.2.1 2006/08/02 09:04:20 alex Exp $

+ 21 - 19
doc/sample-ngircd.conf

@@ -1,4 +1,4 @@
-# $Id: sample-ngircd.conf,v 1.33 2005/03/15 16:58:01 alex Exp $
+# $Id: sample-ngircd.conf,v 1.37 2006/04/09 12:27:23 alex Exp $
 
 #
 # This is a sample configuration file for the ngIRCd, which must be adepted
@@ -7,25 +7,25 @@
 # Comments are started with "#" or ";".
 #
 # Use "ngircd --configtest" (see manual page ngircd(8)) to validate that the
-# server interpreted the configuration file as expected!
+# server interprets the configuration file as expected!
 #
 
 [Global]
 	# The [Global] section of this file is used to define the main
 	# configuration of the server, like the server name and the ports
 	# on which the server should be listening.
-	
+
 	# Server name in the IRC network, must contain at least one dot
 	# (".") and be unique in the IRC network. Required!
 	Name = irc.the.net
-	
+
 	# Info text of the server. This will be shown by WHOIS and
 	# LINKS requests for example.
 	Info = Server Info Text
 
 	# Global password for all users needed to connect to the server
 	;Password = abc
-	
+
 	# Information about the server and the administrator, used by the
 	# ADMIN command. Not required by server but by RFC!
 	;AdminInfo1 = Description
@@ -39,7 +39,7 @@
 	# IP address on which the server should listen. (Default: empty,
 	# so the server listens on all IP addresses of the system)
 	;Listen = 1.2.3.4
-	
+
 	# Text file with the "message of the day" (MOTD). This message will
 	# be shown to all users connecting to the server:
 	;MotdFile = /usr/local/etc/ngircd.motd
@@ -92,11 +92,11 @@
 	# Mask IRC Operator mode requests as if they were coming from the
 	# server? (This is a compatibility hack for ircd-irc2 servers)
 	;OperServerMode = no
-	
+
 	# Maximum number of simultaneous connection the server is allowed
 	# to accept (<=0: unlimited):
 	;MaxConnections = -1
-	
+
 	# Maximum number of simultaneous connections from a single IP address
 	# the server will accept (<=0: unlimited):
 	;MaxConnectionsIP = 5
@@ -107,7 +107,7 @@
 [Operator]
 	# [Operator] sections are used to define IRC Operators. There may be
 	# more than one [Operator] block, one for each local operator.
-	
+
 	# ID of the operator (may be different of the nick name)
 	;Name = TheOper
 
@@ -125,7 +125,7 @@
 	# configure a port for the connection, then this ngircd tries to
 	# connect to to the other server on the given port; if not it waits
 	# for the other server to connect.
-	# There may be more than one server block.
+	# There may be more than one server block, one for each server.
 	#
 	# Server Groups:
 	# The ngIRCd allows "server groups": You can assign an "ID" to every
@@ -133,16 +133,18 @@
 	# group won't answer, the ngIRCd tries to connect to the next server
 	# in the given group. But the ngircd never tries to connect to two
 	# servers with the same group ID.
-	
-	# IRC name of the server
+
+	# IRC name of the remote server, must match the "Name" variable in
+	# the [Global] section of the other server (when using ngIRCd).
 	;Name = irc2.the.net
-   
-	# Internet host name of the peer
+  
+	# Internet host name or IP address of the peer (only required when
+	# this server should establish the connection).
 	;Host = connect-to-host.the.net
 
 	# Port of the server to which the ngIRCd should connect. If you
 	# assign no port the ngIRCd waits for incoming connections.
-	;Port = 6666
+	;Port = 6667
 
 	# Own password for the connection. This password has to be configured
 	# as "PeerPassword" on the other server.
@@ -151,7 +153,7 @@
 	# Foreign password for this connection. This password has to be
 	# configured as "MyPassword" on the other server.
 	;PeerPassword = PeerSecret
-	
+
 	# Group of this server (optional)
 	;Group = 123
 
@@ -164,14 +166,14 @@
 	# persist when there are no more members left.
 	# Persistent channels are marked with the mode 'P', which can be set
 	# and unset by IRC operators like other modes on the fly.
-	# There may be more than one [Channel] block.
-	
+	# There may be more than one [Channel] block, one for each channel.
+
 	# Name of the channel
 	;Name = #TheName
 
 	# Topic for this channel
 	;Topic = a great topic
-	
+
 	# Initial channel modes
 	;Modes = tn
 

+ 25 - 0
doc/src/Makefile.am

@@ -0,0 +1,25 @@
+#
+# ngIRCd -- The Next Generation IRC Daemon
+# Copyright (c)2001-2006 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# Please read the file COPYING, README and AUTHORS for more information.
+#
+# $Id: Makefile.am,v 1.2 2006/04/08 16:35:03 alex Exp $
+#
+
+maintainer-clean-local:
+	rm -f Makefile Makefile.in
+
+distclean-local:
+	rm -f html
+
+srcdoc:
+	@doxygen --version >/dev/null 2>&1 \
+	  || ( echo; echo "Error: \"doxygen\" not found!"; echo; exit 1 )
+	doxygen
+
+# -eof-

+ 318 - 0
doc/src/Makefile.in

@@ -0,0 +1,318 @@
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#
+# ngIRCd -- The Next Generation IRC Daemon
+# Copyright (c)2001-2006 Alexander Barton (alex@barton.de)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# Please read the file COPYING, README and AUTHORS for more information.
+#
+# $Id: Makefile.am,v 1.2 2006/04/08 16:35:03 alex Exp $
+#
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = doc/src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  doc/src/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  doc/src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic \
+	maintainer-clean-local
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+	distclean-generic distclean-local distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic maintainer-clean-local mostlyclean \
+	mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+
+maintainer-clean-local:
+	rm -f Makefile Makefile.in
+
+distclean-local:
+	rm -f html
+
+srcdoc:
+	@doxygen --version >/dev/null 2>&1 \
+	  || ( echo; echo "Error: \"doxygen\" not found!"; echo; exit 1 )
+	doxygen
+
+# -eof-
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

+ 253 - 224
install-sh

@@ -1,7 +1,8 @@
 #!/bin/sh
-#
 # install - install a program, script, or datafile
-#
+
+scriptversion=2005-02-02.21
+
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
 # following copyright and license.
@@ -41,13 +42,11 @@
 # from scratch.  It can only install one file at a time, a restriction
 # shared with many OS's install programs.
 
-
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
 
-
 # put in absolute paths if you don't have them in your path; or use env. vars.
 
 mvprog="${MVPROG-mv}"
@@ -59,236 +58,266 @@ stripprog="${STRIPPROG-strip}"
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
 chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
+chowncmd=
+chgrpcmd=
+stripcmd=
 rmcmd="$rmprog -f"
 mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-	-c) instcmd=$cpprog
-	    shift
-	    continue;;
-
-	-d) dir_arg=true
-	    shift
-	    continue;;
-
-	-m) chmodcmd="$chmodprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-o) chowncmd="$chownprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-g) chgrpcmd="$chgrpprog $2"
-	    shift
-	    shift
-	    continue;;
-
-	-s) stripcmd=$stripprog
-	    shift
-	    continue;;
-
-	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
-	    shift
-	    continue;;
-
-	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-	    shift
-	    continue;;
-
-	*)  if [ x"$src" = x ]
-	    then
-		src=$1
-	    else
-		# this colon is to work around a 386BSD /bin/sh bug
-		:
-		dst=$1
-	    fi
-	    shift
-	    continue;;
-    esac
-done
-
-if [ x"$src" = x ]
-then
-	echo "$0: no input file specified" >&2
-	exit 1
-else
-	:
-fi
-
-if [ x"$dir_arg" != x ]; then
-	dst=$src
-	src=""
-
-	if [ -d "$dst" ]; then
-		instcmd=:
-		chmodcmd=""
-	else
-		instcmd=$mkdirprog
-	fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
-	if [ -f "$src" ] || [ -d "$src" ]
-	then
-		:
-	else
-		echo "$0: $src does not exist" >&2
-		exit 1
-	fi
-
-	if [ x"$dst" = x ]
-	then
-		echo "$0: no destination specified" >&2
-		exit 1
-	else
-		:
-	fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
-	if [ -d "$dst" ]
-	then
-		dst=$dst/`basename "$src"`
-	else
-		:
-	fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-#  this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-	'
-IFS="${IFS-$defaultIFS}"
-
-oIFS=$IFS
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS=$oIFS
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
-	pathcomp=$pathcomp$1
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
 	shift
+	shift
+	continue;;
 
-	if [ ! -d "$pathcomp" ] ;
-        then
-		$mkdirprog "$pathcomp"
-	else
-		:
-	fi
-
-	pathcomp=$pathcomp/
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
+  esac
 done
-fi
-
-if [ x"$dir_arg" != x ]
-then
-	$doit $instcmd "$dst" &&
 
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
-	if [ x"$transformarg" = x ]
-	then
-		dstfile=`basename "$dst"`
-	else
-		dstfile=`basename "$dst" $transformbasename |
-			sed $transformarg`$transformbasename
-	fi
-
-# don't allow the sed command to completely eliminate the filename
-
-	if [ x"$dstfile" = x ]
-	then
-		dstfile=`basename "$dst"`
-	else
-		:
-	fi
-
-# Make a couple of temp file names in the proper directory.
-
-	dsttmp=$dstdir/_inst.$$_
-	rmtmp=$dstdir/_rm.$$_
-
-# Trap to clean up temp files at exit.
-
-	trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
-	trap '(exit $?); exit' 1 2 13 15
-
-# Move or copy the file name to the temp name
-
-	$doit $instcmd "$src" "$dsttmp" &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing.  If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
-
-# Now remove or move aside any old file at destination location.  We try this
-# two ways since rm can't unlink itself on some systems and the destination
-# file might be busy for other reasons.  In this case, the final cleanup
-# might fail but the new file should still install successfully.
-
-{
-	if [ -f "$dstdir/$dstfile" ]
-	then
-		$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
-		$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
-		{
-		  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-		  (exit 1); exit
-		}
-	else
-		:
-	fi
-} &&
-
-# Now rename the file to the real destination.
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
 
-	$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
 
-fi &&
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	       || {
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	 }
+    }
+  fi || { (exit 1); exit 1; }
+done
 
 # The final little trick to "correctly" pass the exit status to the exit trap.
-
 {
-	(exit 0); exit
+  (exit 0); exit 0
 }
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

+ 71 - 44
man/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -27,7 +27,6 @@
 #
 # $Id: Makefile.am,v 1.5 2002/04/04 13:02:41 alex Exp $
 #
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -35,7 +34,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -49,7 +47,26 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+subdir = man
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+man5dir = $(mandir)/man5
+am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
+man8dir = $(mandir)/man8
+NROFF = nroff
+MANS = $(man_MANS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -103,6 +120,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -123,6 +142,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -134,34 +154,44 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 man_MANS = ngircd.conf.5 ngircd.8
-
 EXTRA_DIST = $(man_MANS)
-subdir = man
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-
-NROFF = nroff
-MANS = $(man_MANS)
-DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  man/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  man/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 uninstall-info-am:
-
-man5dir = $(mandir)/man5
 install-man5: $(man5_MANS) $(man_MANS)
 	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(man5dir)
+	test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
 	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	for i in $$l2; do \
@@ -180,8 +210,8 @@ install-man5: $(man5_MANS) $(man_MANS)
 	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
 	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
 	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \
-	  $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
 	done
 uninstall-man5:
 	@$(NORMAL_UNINSTALL)
@@ -201,14 +231,12 @@ uninstall-man5:
 	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
 	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
 	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-	  echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \
-	  rm -f $(DESTDIR)$(man5dir)/$$inst; \
+	  echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
 	done
-
-man8dir = $(mandir)/man8
 install-man8: $(man8_MANS) $(man_MANS)
 	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(man8dir)
+	test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)"
 	@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
 	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
 	for i in $$l2; do \
@@ -227,8 +255,8 @@ install-man8: $(man8_MANS) $(man_MANS)
 	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
 	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
 	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
-	  $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
+	  echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+	  $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \
 	done
 uninstall-man8:
 	@$(NORMAL_UNINSTALL)
@@ -248,8 +276,8 @@ uninstall-man8:
 	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
 	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
 	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-	  echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
-	  rm -f $(DESTDIR)$(man8dir)/$$inst; \
+	  echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \
+	  rm -f "$(DESTDIR)$(man8dir)/$$inst"; \
 	done
 tags: TAGS
 TAGS:
@@ -257,10 +285,6 @@ TAGS:
 ctags: CTAGS
 CTAGS:
 
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -274,7 +298,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -292,9 +316,10 @@ distdir: $(DISTFILES)
 check-am: all-am
 check: check-am
 all-am: Makefile $(MANS)
-
 installdirs:
-	$(mkinstalldirs) $(DESTDIR)$(man5dir) $(DESTDIR)$(man8dir)
+	for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
@@ -314,7 +339,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -331,6 +356,8 @@ dvi: dvi-am
 
 dvi-am:
 
+html: html-am
+
 info: info-am
 
 info-am:
@@ -367,8 +394,8 @@ uninstall-am: uninstall-info-am uninstall-man
 uninstall-man: uninstall-man5 uninstall-man8
 
 .PHONY: all all-am check check-am clean clean-generic distclean \
-	distclean-generic distdir dvi dvi-am info info-am install \
-	install-am install-data install-data-am install-exec \
+	distclean-generic distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
 	install-exec-am install-info install-info-am install-man \
 	install-man5 install-man8 install-strip installcheck \
 	installcheck-am installdirs maintainer-clean \

+ 4 - 4
man/ngircd.8

@@ -1,7 +1,7 @@
 .\"
-.\" $Id: ngircd.8,v 1.10 2005/06/04 13:39:20 alex Exp $
+.\" $Id: ngircd.8,v 1.11 2005/08/12 13:20:54 alex Exp $
 .\"
-.TH ngircd 8 "Juni 2005" ngircd "ngIRCd Manual"
+.TH ngircd 8 "August 2005" ngircd "ngIRCd Manual"
 .SH NAME
 ngIRCd \- the next generation IRC daemon
 .SH SYNOPSIS
@@ -70,8 +70,8 @@ alex@barton.de
 .UE
 .br
 Homepage:
-.UR http://arthur.ath.cx/~alex/ngircd/
-http://arthur.ath.cx/~alex/ngircd/
+.UR http://ngircd.barton.de/
+http://ngircd.barton.de/
 .UE
 .SH "SEE ALSO"
 .BR ngircd.conf (5),

+ 10 - 9
man/ngircd.conf.5

@@ -1,16 +1,17 @@
 .\"
-.\" $Id: ngircd.conf.5,v 1.18 2005/06/04 13:39:20 alex Exp $
+.\" $Id: ngircd.conf.5,v 1.20 2005/09/02 14:39:00 fw Exp $
 .\"
-.TH ngircd.conf 5 "Juni 2005" ngircd "ngIRCd Manual"
+.TH ngircd.conf 5 "August 2005" ngircd "ngIRCd Manual"
 .SH NAME
 ngircd.conf \- configuration file of ngIRCd
 .SH SYNOPSIS
 .B /usr/local/etc/ngircd.conf
 .SH DESCRIPTION
 .BR ngircd.conf
-is the configuration file for
+is the configuration file of the
 .BR ngircd (8)
-which you should adept to your local preferences and needs.
+Internet Relay Chat (IRC) daemon which you should adept to your local
+preferences and needs.
 .SH "FILE FORMAT"
 The file consists of sections and parameters. A section begins with the name
 of the section in square brackets and continues until the next section
@@ -24,8 +25,8 @@ Sections contain parameters of the form
 .I value
 .RE
 .PP
-Any line beginning with a semicolon (';') or a hash ('#') character is
-treated as a comment and ignored.
+Empty lines and any line beginning with a semicolon (';') or a hash ('#')
+character is treated as a comment and will be ignored.
 .PP
 The file format is line-based - that means, each newline-terminated line
 represents either a comment, a section name or a parameter.
@@ -200,7 +201,7 @@ the ngIRCd waits for incoming connections.
 .TP
 \fBMyPassword\fR
 Own password for this connection. This password has to be configured as
-"PeerPassword" on the other server.
+"PeerPassword" on the other server. Must not have ':' as first character.
 .TP
 \fBPeerPassword\fR
 Foreign password for this connection. This password has to be configured as
@@ -241,8 +242,8 @@ alex@barton.de
 .UE
 .br
 Homepage:
-.UR http://arthur.ath.cx/~alex/ngircd/
-http://arthur.ath.cx/~alex/ngircd/
+.UR http://ngircd.barton.de/
+http://ngircd.barton.de/
 .UE
 .SH "SEE ALSO"
 .BR ngircd (8)

+ 78 - 57
missing

@@ -1,6 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+
+scriptversion=2005-02-08.22
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -38,18 +42,24 @@ else
   configure_ac=configure.in
 fi
 
+msg="missing on your system"
+
 case "$1" in
 --run)
   # Try to run requested program, and just exit if it succeeds.
   run=
   shift
   "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
   ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
 
   -h|--h|--he|--hel|--help)
     echo "\
@@ -74,11 +84,15 @@ Supported PROGRAM values:
   lex          create \`lex.yy.c', if possible, from existing .c
   makeinfo     touch the output file
   tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
     ;;
 
   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing 0.4 - GNU automake"
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
     ;;
 
   -*)
@@ -87,14 +101,44 @@ Supported PROGRAM values:
     exit 1
     ;;
 
-  aclocal*)
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
        # We have it, but it failed.
        exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
     fi
+    ;;
+esac
 
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
     echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
+WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
          to install the \`Automake' and \`Perl' packages.  Grab them from
          any GNU archive site."
@@ -102,13 +146,8 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   autoconf)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
+WARNING: \`$1' is $msg.  You should only need it if
          you modified \`${configure_ac}'.  You might want to install the
          \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
          archive site."
@@ -116,13 +155,8 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   autoheader)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
+WARNING: \`$1' is $msg.  You should only need it if
          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
          to install the \`Autoconf' and \`GNU m4' packages.  Grab them
          from any GNU archive site."
@@ -140,13 +174,8 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   automake*)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
+WARNING: \`$1' is $msg.  You should only need it if
          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
          You might want to install the \`Automake' and \`Perl' packages.
          Grab them from any GNU archive site."
@@ -156,14 +185,9 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   autom4te)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
-         system.  You might have modified some files without having the
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
          proper tools for further handling them.
          You can get \`$1' as part of \`Autoconf' from any GNU
          archive site."
@@ -185,7 +209,7 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
 
   bison|yacc)
     echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
+WARNING: \`$1' $msg.  You should only need it if
          you modified a \`.y' file.  You may need the \`Bison' package
          in order for those modifications to take effect.  You can get
          \`Bison' from any GNU archive site."
@@ -215,7 +239,7 @@ WARNING: \`$1' is missing on your system.  You should only need it if
 
   lex|flex)
     echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
+WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.l' file.  You may need the \`Flex' package
          in order for those modifications to take effect.  You can get
          \`Flex' from any GNU archive site."
@@ -237,13 +261,8 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   help2man)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
+WARNING: \`$1' is $msg.  You should only need it if
 	 you modified a dependency of a manual page.  You may need the
 	 \`Help2man' package in order for those modifications to take
 	 effect.  You can get \`Help2man' from any GNU archive site."
@@ -262,32 +281,27 @@ WARNING: \`$1' is missing on your system.  You should only need it if
     ;;
 
   makeinfo)
-    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
-       # We have makeinfo, but it failed.
-       exit 1
-    fi
-
     echo 1>&2 "\
-WARNING: \`$1' is missing on your system.  You should only need it if
+WARNING: \`$1' is $msg.  You should only need it if
          you modified a \`.texi' or \`.texinfo' file, or any other file
          indirectly affecting the aspect of the manual.  The spurious
          call might also be the consequence of using a buggy \`make' (AIX,
          DU, IRIX).  You might want to install the \`Texinfo' package or
          the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
     file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
     if test -z "$file"; then
-      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
     fi
     touch $file
     ;;
 
   tar)
     shift
-    if test -n "$run"; then
-      echo 1>&2 "ERROR: \`tar' requires --run"
-      exit 1
-    fi
 
     # We have already tried tar in the generic part.
     # Look for gnutar/gtar before invocation to avoid ugly error
@@ -323,8 +337,8 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments.
 
   *)
     echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
-         system.  You might have modified some files without having the
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
          proper tools for further handling them.  Check the \`README' file,
          it often tells you about the needed prerequisites for installing
          this package.  You may also peek at any GNU archive site, in case
@@ -334,3 +348,10 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your
 esac
 
 exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

+ 0 - 111
mkinstalldirs

@@ -1,111 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain
-
-errstatus=0
-dirmode=""
-
-usage="\
-Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
-
-# process command line arguments
-while test $# -gt 0 ; do
-  case $1 in
-    -h | --help | --h*)         # -h for help
-      echo "$usage" 1>&2
-      exit 0
-      ;;
-    -m)                         # -m PERM arg
-      shift
-      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
-      dirmode=$1
-      shift
-      ;;
-    --)                         # stop option processing
-      shift
-      break
-      ;;
-    -*)                         # unknown option
-      echo "$usage" 1>&2
-      exit 1
-      ;;
-    *)                          # first non-opt arg
-      break
-      ;;
-  esac
-done
-
-for file
-do
-  if test -d "$file"; then
-    shift
-  else
-    break
-  fi
-done
-
-case $# in
-  0) exit 0 ;;
-esac
-
-case $dirmode in
-  '')
-    if mkdir -p -- . 2>/dev/null; then
-      echo "mkdir -p -- $*"
-      exec mkdir -p -- "$@"
-    fi
-    ;;
-  *)
-    if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
-      echo "mkdir -m $dirmode -p -- $*"
-      exec mkdir -m "$dirmode" -p -- "$@"
-    fi
-    ;;
-esac
-
-for file
-do
-  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
-  shift
-
-  pathcomp=
-  for d
-  do
-    pathcomp="$pathcomp$d"
-    case $pathcomp in
-      -*) pathcomp=./$pathcomp ;;
-    esac
-
-    if test ! -d "$pathcomp"; then
-      echo "mkdir $pathcomp"
-
-      mkdir "$pathcomp" || lasterr=$?
-
-      if test ! -d "$pathcomp"; then
-  	errstatus=$lasterr
-      else
-  	if test ! -z "$dirmode"; then
-	  echo "chmod $dirmode $pathcomp"
-    	  lasterr=""
-  	  chmod "$dirmode" "$pathcomp" || lasterr=$?
-
-  	  if test ! -z "$lasterr"; then
-  	    errstatus=$lasterr
-  	  fi
-  	fi
-      fi
-    fi
-
-    pathcomp="$pathcomp/"
-  done
-done
-
-exit $errstatus
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# End:
-# mkinstalldirs ends here

+ 1 - 6
src/Makefile.am

@@ -8,7 +8,7 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.6 2005/04/09 12:22:41 alex Exp $
+# $Id: Makefile.am,v 1.7 2005/07/22 21:01:03 alex Exp $
 #
 
 SUBDIRS = portab tool ngircd testsuite
@@ -16,9 +16,4 @@ SUBDIRS = portab tool ngircd testsuite
 maintainer-clean-local:
 	rm -f Makefile Makefile.in config.h config.h.in stamp-h.in
 
-srcdoc:
-	@doxygen --version >/dev/null 2>&1 \
-	 || ( echo; echo "Error: \"doxygen\" not found!"; echo; exit 1 )
-	doxygen
-
 # -eof-

+ 108 - 76
src/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -24,9 +24,8 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.6 2005/04/09 12:22:41 alex Exp $
+# $Id: Makefile.am,v 1.7 2005/07/22 21:01:03 alex Exp $
 #
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -34,7 +33,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -48,7 +46,31 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/config.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-exec-recursive install-info-recursive \
+	install-recursive installcheck-recursive installdirs-recursive \
+	pdf-recursive ps-recursive uninstall-info-recursive \
+	uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -102,6 +124,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -122,6 +146,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -133,31 +158,40 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 SUBDIRS = portab tool ngircd testsuite
-subdir = src
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-
-RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
-	ps-recursive install-info-recursive uninstall-info-recursive \
-	all-recursive install-data-recursive install-exec-recursive \
-	installdirs-recursive install-recursive uninstall-recursive \
-	check-recursive installcheck-recursive
-DIST_COMMON = $(srcdir)/Makefile.in Makefile.am config.h.in
-DIST_SUBDIRS = $(SUBDIRS)
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  src/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
 config.h: stamp-h1
 	@if test ! -f $@; then \
@@ -168,10 +202,10 @@ config.h: stamp-h1
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
 	cd $(top_builddir) && $(SHELL) ./config.status src/config.h
-
-$(srcdir)/config.h.in:  $(top_srcdir)/configure.in $(ACLOCAL_M4) 
+$(srcdir)/config.h.in:  $(am__configure_deps) 
 	cd $(top_srcdir) && $(AUTOHEADER)
-	touch $(srcdir)/config.h.in
+	rm -f stamp-h1
+	touch $@
 
 distclean-hdr:
 	-rm -f config.h stamp-h1
@@ -184,7 +218,13 @@ uninstall-info-am:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -196,7 +236,7 @@ $(RECURSIVE_TARGETS):
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -204,7 +244,13 @@ $(RECURSIVE_TARGETS):
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -225,7 +271,7 @@ maintainer-clean-recursive:
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -236,14 +282,6 @@ ctags-recursive:
 	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
 	done
 
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
-tags: TAGS
-
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -252,19 +290,22 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	mkid -fID $$unique
+tags: TAGS
 
 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
 	here=`pwd`; \
-	if (etags --etags-include --version) >/dev/null 2>&1; then \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
 	  include_option=--etags-include; \
+	  empty_fix=.; \
 	else \
 	  include_option=--include; \
+	  empty_fix=; \
 	fi; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -f $$subdir/TAGS && \
+	    test ! -f $$subdir/TAGS || \
 	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
@@ -274,10 +315,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
-
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -300,10 +342,6 @@ GTAGS:
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -317,7 +355,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -332,15 +370,17 @@ distdir: $(DISTFILES)
 	    || exit 1; \
 	  fi; \
 	done
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
 	  if test "$$subdir" = .; then :; else \
-	    test -d $(distdir)/$$subdir \
-	    || mkdir $(distdir)/$$subdir \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
 	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
 	    (cd $$subdir && \
 	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$(top_distdir)" \
-	        distdir=../$(distdir)/$$subdir \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
 	        distdir) \
 	      || exit 1; \
 	  fi; \
@@ -350,7 +390,6 @@ check: check-recursive
 all-am: Makefile config.h
 installdirs: installdirs-recursive
 installdirs-am:
-
 install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
@@ -370,7 +409,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -387,6 +426,8 @@ dvi: dvi-recursive
 
 dvi-am:
 
+html: html-recursive
+
 info: info-recursive
 
 info-am:
@@ -422,31 +463,22 @@ uninstall-am: uninstall-info-am
 
 uninstall-info: uninstall-info-recursive
 
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
-	clean-generic clean-recursive ctags ctags-recursive distclean \
-	distclean-generic distclean-hdr distclean-recursive \
-	distclean-tags distdir dvi dvi-am dvi-recursive info info-am \
-	info-recursive install install-am install-data install-data-am \
-	install-data-recursive install-exec install-exec-am \
-	install-exec-recursive install-info install-info-am \
-	install-info-recursive install-man install-recursive \
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+	clean clean-generic clean-recursive ctags ctags-recursive \
+	distclean distclean-generic distclean-hdr distclean-recursive \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
 	install-strip installcheck installcheck-am installdirs \
-	installdirs-am installdirs-recursive maintainer-clean \
-	maintainer-clean-generic maintainer-clean-local \
-	maintainer-clean-recursive mostlyclean mostlyclean-generic \
-	mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
-	ps-recursive tags tags-recursive uninstall uninstall-am \
-	uninstall-info-am uninstall-info-recursive uninstall-recursive
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	maintainer-clean-local maintainer-clean-recursive mostlyclean \
+	mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am uninstall-info-am
 
 
 maintainer-clean-local:
 	rm -f Makefile Makefile.in config.h config.h.in stamp-h.in
 
-srcdoc:
-	@doxygen --version >/dev/null 2>&1 \
-	 || ( echo; echo "Error: \"doxygen\" not found!"; echo; exit 1 )
-	doxygen
-
 # -eof-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

+ 16 - 4
src/config.h.in

@@ -3,6 +3,9 @@
 /* Define if debug-mode should be enabled */
 #undef DEBUG
 
+/* Define if SSP C support is enabled. */
+#undef ENABLE_SSP_CC
+
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #undef HAVE_ARPA_INET_H
 
@@ -22,6 +25,9 @@
 /* Define to 1 if you have the `DNSServiceRegistrationCreate' function. */
 #undef HAVE_DNSSERVICEREGISTRATIONCREATE
 
+/* Define to 1 if you have the `epoll_create' function. */
+#undef HAVE_EPOLL_CREATE
+
 /* Define to 1 if you have the <errno.h> header file. */
 #undef HAVE_ERRNO_H
 
@@ -58,6 +64,9 @@
 /* Define to 1 if you have the `isdigit' function. */
 #undef HAVE_ISDIGIT
 
+/* Define to 1 if you have the `kqueue' function. */
+#undef HAVE_KQUEUE
+
 /* Define to 1 if you have the `be' library (-lbe). */
 #undef HAVE_LIBBE
 
@@ -253,12 +262,9 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* Define if compiler has function prototypes */
+/* Define to 1 if the C compiler supports function prototypes. */
 #undef PROTOTYPES
 
-/* Define if Rendezvous support should be included */
-#undef RENDEZVOUS
-
 /* Define as the return type of signal handlers (`int' or `void'). */
 #undef RETSIGTYPE
 
@@ -292,9 +298,15 @@
 /* Version number of package */
 #undef VERSION
 
+/* Define if support for Zeroconf should be included */
+#undef ZEROCONF
+
 /* Define if zlib compression should be enabled */
 #undef ZLIB
 
+/* Define like PROTOTYPES; this can be used by system headers. */
+#undef __PROTOTYPES
+
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const
 

+ 13 - 13
src/ngircd/Makefile.am

@@ -8,7 +8,7 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.46 2005/05/23 00:11:15 alex Exp $
+# $Id: Makefile.am,v 1.49 2006/03/11 01:48:50 alex Exp $
 #
 
 AUTOMAKE_OPTIONS = ../portab/ansi2knr
@@ -20,20 +20,20 @@ LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN \
 
 sbin_PROGRAMS = ngircd
 
-ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c conn-zip.c conn-func.c \
-	hash.c irc.c irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c \
-	irc-oper.c irc-server.c irc-write.c lists.c log.c match.c parse.c \
-	rendezvous.c resolve.c
+ngircd_SOURCES = ngircd.c array.c channel.c client.c conf.c conn.c conn-func.c \
+	conn-zip.c hash.c io.c irc.c irc-channel.c irc-info.c irc-login.c \
+	irc-mode.c irc-op.c irc-oper.c irc-server.c irc-write.c lists.c log.c \
+	match.c parse.c rendezvous.c resolve.c
 
 ngircd_LDFLAGS = -L../portab -L../tool
 
 ngircd_LDADD = -lngportab -lngtool
 
-noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h conn-zip.h conn-func.h \
-	hash.h irc.h irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h \
-	irc-oper.h irc-server.h irc-write.h lists.h log.h match.h parse.h \
-	rendezvous.h resolve.h \
-	messages.h defines.h
+noinst_HEADERS = ngircd.h array.h channel.h client.h conf.h conn.h conn-func.h \
+	conn-zip.h hash.h io.h irc.h irc-channel.h irc-info.h irc-login.h \
+	irc-mode.h irc-op.h irc-oper.h irc-server.h irc-write.h lists.h log.h \
+	match.h parse.h rendezvous.h resolve.h \
+	defines.h messages.h
 
 clean-local:
 	rm -f check-version check-help lint.out cvs-version.*
@@ -43,12 +43,12 @@ maintainer-clean-local:
 
 check-version: Makefile
 	echo "#!/bin/sh" > check-version
-	echo "./ngircd --version | grep ngircd > /dev/null 2>&1" >> check-version
+	echo "./ngircd --version | grep ngircd >/dev/null 2>&1" >>check-version
 	chmod 755 check-version
 
 check-help: Makefile
 	echo "#!/bin/sh" > check-help
-	echo "./ngircd --help | grep help > /dev/null 2>&1" >> check-help
+	echo "./ngircd --help | grep help >/dev/null 2>&1" >>check-help
 	chmod 755 check-help
 
 lint:
@@ -63,7 +63,7 @@ lint:
 	 if [ $$? -ne 0 ]; then \
 	  waswarning=1; \
 	  echo; grep -v "^Command Line: " lint.out; echo; \
-	  w=$$( grep "code warning" lint.out | awk "{ print \$$4 }" ); \
+	  w=$$( grep "code warning" lint.out | $(AWK) "{ print \$$4 }" ); \
 	  [ "$$w" -gt 0 ] && warnings=`expr $$warnings + $$w`; \
 	  files=`expr $$files + 1`; \
 	 else \

+ 152 - 149
src/ngircd/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -24,9 +24,12 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: Makefile.am,v 1.46 2005/05/23 00:11:15 alex Exp $
+# $Id: Makefile.am,v 1.49 2006/03/11 01:48:50 alex Exp $
 #
 
+
+SOURCES = $(ngircd_SOURCES)
+
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -34,7 +37,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ../..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -48,7 +50,49 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+ANSI2KNR = ../portab/ansi2knr
+sbin_PROGRAMS = ngircd$(EXEEXT)
+subdir = src/ngircd
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(sbindir)"
+sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(sbin_PROGRAMS)
+am_ngircd_OBJECTS = ngircd$U.$(OBJEXT) array$U.$(OBJEXT) \
+	channel$U.$(OBJEXT) client$U.$(OBJEXT) conf$U.$(OBJEXT) \
+	conn$U.$(OBJEXT) conn-func$U.$(OBJEXT) conn-zip$U.$(OBJEXT) \
+	hash$U.$(OBJEXT) io$U.$(OBJEXT) irc$U.$(OBJEXT) \
+	irc-channel$U.$(OBJEXT) irc-info$U.$(OBJEXT) \
+	irc-login$U.$(OBJEXT) irc-mode$U.$(OBJEXT) irc-op$U.$(OBJEXT) \
+	irc-oper$U.$(OBJEXT) irc-server$U.$(OBJEXT) \
+	irc-write$U.$(OBJEXT) lists$U.$(OBJEXT) log$U.$(OBJEXT) \
+	match$U.$(OBJEXT) parse$U.$(OBJEXT) rendezvous$U.$(OBJEXT) \
+	resolve$U.$(OBJEXT)
+ngircd_OBJECTS = $(am_ngircd_OBJECTS)
+ngircd_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(ngircd_SOURCES)
+DIST_SOURCES = $(ngircd_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -102,6 +146,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -122,6 +168,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -133,103 +180,68 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 AUTOMAKE_OPTIONS = ../portab/ansi2knr
-
 INCLUDES = -I$(srcdir)/../portab -I$(srcdir)/../tool
-
 LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN \
  -varuse -retvalother -emptyret -unrecog
 
-
-sbin_PROGRAMS = ngircd
-
-ngircd_SOURCES = ngircd.c channel.c client.c conf.c conn.c conn-zip.c conn-func.c \
-	hash.c irc.c irc-channel.c irc-info.c irc-login.c irc-mode.c irc-op.c \
-	irc-oper.c irc-server.c irc-write.c lists.c log.c match.c parse.c \
-	rendezvous.c resolve.c
-
+ngircd_SOURCES = ngircd.c array.c channel.c client.c conf.c conn.c conn-func.c \
+	conn-zip.c hash.c io.c irc.c irc-channel.c irc-info.c irc-login.c \
+	irc-mode.c irc-op.c irc-oper.c irc-server.c irc-write.c lists.c log.c \
+	match.c parse.c rendezvous.c resolve.c
 
 ngircd_LDFLAGS = -L../portab -L../tool
-
 ngircd_LDADD = -lngportab -lngtool
-
-noinst_HEADERS = ngircd.h channel.h client.h conf.h conn.h conn-zip.h conn-func.h \
-	hash.h irc.h irc-channel.h irc-info.h irc-login.h irc-mode.h irc-op.h \
-	irc-oper.h irc-server.h irc-write.h lists.h log.h match.h parse.h \
-	rendezvous.h resolve.h \
-	messages.h defines.h
-
+noinst_HEADERS = ngircd.h array.h channel.h client.h conf.h conn.h conn-func.h \
+	conn-zip.h hash.h io.h irc.h irc-channel.h irc-info.h irc-login.h \
+	irc-mode.h irc-op.h irc-oper.h irc-server.h irc-write.h lists.h log.h \
+	match.h parse.h rendezvous.h resolve.h \
+	defines.h messages.h
 
 TESTS = check-version check-help
-subdir = src/ngircd
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-sbin_PROGRAMS = ngircd$(EXEEXT)
-PROGRAMS = $(sbin_PROGRAMS)
-
-am_ngircd_OBJECTS = ngircd$U.$(OBJEXT) channel$U.$(OBJEXT) \
-	client$U.$(OBJEXT) conf$U.$(OBJEXT) conn$U.$(OBJEXT) \
-	conn-zip$U.$(OBJEXT) conn-func$U.$(OBJEXT) hash$U.$(OBJEXT) \
-	irc$U.$(OBJEXT) irc-channel$U.$(OBJEXT) irc-info$U.$(OBJEXT) \
-	irc-login$U.$(OBJEXT) irc-mode$U.$(OBJEXT) irc-op$U.$(OBJEXT) \
-	irc-oper$U.$(OBJEXT) irc-server$U.$(OBJEXT) \
-	irc-write$U.$(OBJEXT) lists$U.$(OBJEXT) log$U.$(OBJEXT) \
-	match$U.$(OBJEXT) parse$U.$(OBJEXT) rendezvous$U.$(OBJEXT) \
-	resolve$U.$(OBJEXT)
-ngircd_OBJECTS = $(am_ngircd_OBJECTS)
-ngircd_DEPENDENCIES =
-
-DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)/src
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/channel$U.Po ./$(DEPDIR)/client$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/conf$U.Po ./$(DEPDIR)/conn$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/conn-func$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/conn-zip$U.Po ./$(DEPDIR)/hash$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/irc$U.Po ./$(DEPDIR)/irc-channel$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/irc-info$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/irc-login$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/irc-mode$U.Po ./$(DEPDIR)/irc-op$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/irc-oper$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/irc-server$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/irc-write$U.Po ./$(DEPDIR)/lists$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/log$U.Po ./$(DEPDIR)/match$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/ngircd$U.Po ./$(DEPDIR)/parse$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/rendezvous$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/resolve$U.Po
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-DIST_SOURCES = $(ngircd_SOURCES)
-HEADERS = $(noinst_HEADERS)
-
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am
-SOURCES = $(ngircd_SOURCES)
-
 all: all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .o .obj
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/ngircd/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  src/ngircd/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
-sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 install-sbinPROGRAMS: $(sbin_PROGRAMS)
 	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(sbindir)
+	test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)"
 	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
 	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
 	  if test -f $$p \
 	  ; then \
 	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-	   echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \
-	   $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+	   $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
 	  else :; fi; \
 	done
 
@@ -237,8 +249,8 @@ uninstall-sbinPROGRAMS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
 	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-	  echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \
-	  rm -f $(DESTDIR)$(sbindir)/$$f; \
+	  echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(sbindir)/$$f"; \
 	done
 
 clean-sbinPROGRAMS:
@@ -248,18 +260,17 @@ ngircd$(EXEEXT): $(ngircd_OBJECTS) $(ngircd_DEPENDENCIES)
 	$(LINK) $(ngircd_LDFLAGS) $(ngircd_OBJECTS) $(ngircd_LDADD) $(LIBS)
 
 mostlyclean-compile:
-	-rm -f *.$(OBJEXT) core *.core
+	-rm -f *.$(OBJEXT)
 
 distclean-compile:
 	-rm -f *.tab.c
-
-ANSI2KNR = ../portab/ansi2knr
 ../portab/ansi2knr:
 	cd ../portab && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
 
 mostlyclean-kr:
 	-test "$U" = "" || rm -f *_.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/channel$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf$U.Po@am__quote@
@@ -267,6 +278,7 @@ mostlyclean-kr:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn-func$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conn-zip$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash$U.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-channel$U.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/irc-info$U.Po@am__quote@
@@ -285,26 +297,20 @@ mostlyclean-kr:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolve$U.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@	fi
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@	fi
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
+array_.c: array.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/array.c; then echo $(srcdir)/array.c; else echo array.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 channel_.c: channel.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/channel.c; then echo $(srcdir)/channel.c; else echo channel.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 client_.c: client.c $(ANSI2KNR)
@@ -319,6 +325,8 @@ conn-zip_.c: conn-zip.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/conn-zip.c; then echo $(srcdir)/conn-zip.c; else echo conn-zip.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 hash_.c: hash.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hash.c; then echo $(srcdir)/hash.c; else echo hash.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+io_.c: io.c $(ANSI2KNR)
+	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/io.c; then echo $(srcdir)/io.c; else echo io.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 irc_.c: irc.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/irc.c; then echo $(srcdir)/irc.c; else echo irc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 irc-channel_.c: irc-channel.c $(ANSI2KNR)
@@ -351,23 +359,16 @@ rendezvous_.c: rendezvous.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rendezvous.c; then echo $(srcdir)/rendezvous.c; else echo rendezvous.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 resolve_.c: resolve.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/resolve.c; then echo $(srcdir)/resolve.c; else echo resolve.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
-channel_.$(OBJEXT) client_.$(OBJEXT) conf_.$(OBJEXT) conn_.$(OBJEXT) \
-conn-func_.$(OBJEXT) conn-zip_.$(OBJEXT) hash_.$(OBJEXT) irc_.$(OBJEXT) \
-irc-channel_.$(OBJEXT) irc-info_.$(OBJEXT) irc-login_.$(OBJEXT) \
-irc-mode_.$(OBJEXT) irc-op_.$(OBJEXT) irc-oper_.$(OBJEXT) \
-irc-server_.$(OBJEXT) irc-write_.$(OBJEXT) lists_.$(OBJEXT) \
-log_.$(OBJEXT) match_.$(OBJEXT) ngircd_.$(OBJEXT) parse_.$(OBJEXT) \
-rendezvous_.$(OBJEXT) resolve_.$(OBJEXT) : $(ANSI2KNR)
+array_.$(OBJEXT) channel_.$(OBJEXT) client_.$(OBJEXT) conf_.$(OBJEXT) \
+conn_.$(OBJEXT) conn-func_.$(OBJEXT) conn-zip_.$(OBJEXT) \
+hash_.$(OBJEXT) io_.$(OBJEXT) irc_.$(OBJEXT) irc-channel_.$(OBJEXT) \
+irc-info_.$(OBJEXT) irc-login_.$(OBJEXT) irc-mode_.$(OBJEXT) \
+irc-op_.$(OBJEXT) irc-oper_.$(OBJEXT) irc-server_.$(OBJEXT) \
+irc-write_.$(OBJEXT) lists_.$(OBJEXT) log_.$(OBJEXT) match_.$(OBJEXT) \
+ngircd_.$(OBJEXT) parse_.$(OBJEXT) rendezvous_.$(OBJEXT) \
+resolve_.$(OBJEXT) : $(ANSI2KNR)
 uninstall-info-am:
 
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
-tags: TAGS
-
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -376,6 +377,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	mkid -fID $$unique
+tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -387,10 +389,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
-
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -427,24 +430,24 @@ check-TESTS: $(TESTS)
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
 	      *" $$tst "*) \
-	        xpass=`expr $$xpass + 1`; \
-	        failed=`expr $$failed + 1`; \
-	        echo "XPASS: $$tst"; \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		echo "XPASS: $$tst"; \
 	      ;; \
 	      *) \
-	        echo "PASS: $$tst"; \
+		echo "PASS: $$tst"; \
 	      ;; \
 	      esac; \
 	    elif test $$? -ne 77; then \
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
 	      *" $$tst "*) \
-	        xfail=`expr $$xfail + 1`; \
-	        echo "XFAIL: $$tst"; \
+		xfail=`expr $$xfail + 1`; \
+		echo "XFAIL: $$tst"; \
 	      ;; \
 	      *) \
-	        failed=`expr $$failed + 1`; \
-	        echo "FAIL: $$tst"; \
+		failed=`expr $$failed + 1`; \
+		echo "FAIL: $$tst"; \
 	      ;; \
 	      esac; \
 	    else \
@@ -469,27 +472,23 @@ check-TESTS: $(TESTS)
 	  skipped=""; \
 	  if test "$$skip" -ne 0; then \
 	    skipped="($$skip tests were not run)"; \
-	    test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
 	      dashes="$$skipped"; \
 	  fi; \
 	  report=""; \
 	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
 	    report="Please report to $(PACKAGE_BUGREPORT)"; \
-	    test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
 	      dashes="$$report"; \
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
 	  echo "$$dashes"; \
 	  echo "$$banner"; \
-	  test -n "$$skipped" && echo "$$skipped"; \
-	  test -n "$$report" && echo "$$report"; \
+	  test -z "$$skipped" || echo "$$skipped"; \
+	  test -z "$$report" || echo "$$report"; \
 	  echo "$$dashes"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -503,7 +502,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -522,9 +521,10 @@ check-am: all-am
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
 all-am: Makefile $(PROGRAMS) $(HEADERS)
-
 installdirs:
-	$(mkinstalldirs) $(DESTDIR)$(sbindir)
+	for dir in "$(DESTDIR)$(sbindir)"; do \
+	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+	done
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
@@ -544,7 +544,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -563,6 +563,8 @@ dvi: dvi-am
 
 dvi-am:
 
+html: html-am
+
 info: info-am
 
 info-am:
@@ -600,13 +602,14 @@ uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
 	clean-generic clean-local clean-sbinPROGRAMS ctags distclean \
 	distclean-compile distclean-generic distclean-tags distdir dvi \
-	dvi-am info info-am install install-am install-data \
-	install-data-am install-exec install-exec-am install-info \
-	install-info-am install-man install-sbinPROGRAMS install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic maintainer-clean-local mostlyclean \
-	mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf \
-	pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-sbinPROGRAMS \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic \
+	maintainer-clean-local mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-kr pdf pdf-am ps ps-am tags \
+	uninstall uninstall-am uninstall-info-am \
 	uninstall-sbinPROGRAMS
 
 
@@ -618,12 +621,12 @@ maintainer-clean-local:
 
 check-version: Makefile
 	echo "#!/bin/sh" > check-version
-	echo "./ngircd --version | grep ngircd > /dev/null 2>&1" >> check-version
+	echo "./ngircd --version | grep ngircd >/dev/null 2>&1" >>check-version
 	chmod 755 check-version
 
 check-help: Makefile
 	echo "#!/bin/sh" > check-help
-	echo "./ngircd --help | grep help > /dev/null 2>&1" >> check-help
+	echo "./ngircd --help | grep help >/dev/null 2>&1" >>check-help
 	chmod 755 check-help
 
 lint:
@@ -638,7 +641,7 @@ lint:
 	 if [ $$? -ne 0 ]; then \
 	  waswarning=1; \
 	  echo; grep -v "^Command Line: " lint.out; echo; \
-	  w=$$( grep "code warning" lint.out | awk "{ print \$$4 }" ); \
+	  w=$$( grep "code warning" lint.out | $(AWK) "{ print \$$4 }" ); \
 	  [ "$$w" -gt 0 ] && warnings=`expr $$warnings + $$w`; \
 	  files=`expr $$files + 1`; \
 	 else \

+ 359 - 0
src/ngircd/array.c

@@ -0,0 +1,359 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * Please read the file COPYING, README and AUTHORS for more information.
+ *
+ * functions to dynamically allocate arrays.
+ * Copyright (c) 2005 Florian Westphal (westphal@foo.fh-furtwangen.de)
+ *
+ */
+
+#include "array.h"
+
+static char UNUSED id[] = "$Id: array.c,v 1.11 2006/07/01 22:11:48 fw Exp $";
+
+#include <assert.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "log.h"
+
+/* Enable more Debug messages in alloc / append / memmove code. */
+/* #define DEBUG_ARRAY */
+
+
+
+#define array_UNUSABLE(x)	( !(x)->mem || (0 == (x)->allocated) )
+
+#define ALIGN_32U(x)            (((x)+31U  ) & ~(31U))
+#define ALIGN_1024U(x)          (((x)+1023U) & ~(1023U))
+#define ALIGN_4096U(x)          (((x)+4095U) & ~(4095U))
+
+
+static bool
+safemult_sizet(size_t a, size_t b, size_t *res)
+{
+	size_t tmp = a * b;
+
+	if (b && (tmp / b != a))
+		return false;
+
+	*res = tmp;
+	return true;
+}
+
+
+void
+array_init(array *a)
+{
+	assert(a != NULL);
+	a->mem = NULL;
+	a->allocated = 0;
+	a->used = 0;
+}
+
+
+/* if realloc() fails, array_alloc return NULL. otherwise return pointer to elem pos in array */
+void *
+array_alloc(array * a, size_t size, size_t pos)
+{
+	size_t alloc, pos_plus1 = pos + 1;
+	size_t aligned = 0;
+	char *tmp;
+
+	assert(size > 0);
+
+	if (pos_plus1 < pos)
+		return NULL;
+
+	if (!safemult_sizet(size, pos_plus1, &alloc))
+		return NULL;
+
+	if (a->allocated < alloc) {
+		if (alloc < 128) {
+			aligned = ALIGN_32U(alloc);
+		} else {
+			if (alloc < 4096) {
+				aligned = ALIGN_1024U(alloc);
+			} else {
+				aligned = ALIGN_4096U(alloc);
+			}
+		}
+#ifdef DEBUG_ARRAY
+		Log(LOG_DEBUG, "array_alloc(): rounded %u to %u bytes.", alloc, aligned);
+#endif
+
+		assert(aligned >= alloc);
+
+		if (aligned < alloc)	/* rounding overflow */
+			return NULL;
+
+		alloc = aligned;
+#ifdef DEBUG_ARRAY
+		Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.",
+		    a->allocated, aligned);
+#endif
+
+		tmp = realloc(a->mem, alloc);
+		if (!tmp)
+			return NULL;
+
+		a->mem = tmp;
+		a->allocated = alloc;
+
+		assert(a->allocated > a->used);
+
+		memset(a->mem + a->used, 0, a->allocated - a->used);
+
+		a->used = alloc;
+	}
+	return a->mem + (pos * size);
+}
+
+
+/*return number of initialized ELEMS in a. */
+size_t
+array_length(const array * const a, size_t membersize)
+{
+	assert(a != NULL);
+	assert(membersize > 0);
+
+	if (array_UNUSABLE(a))
+		return 0;
+
+	return membersize ? a->used / membersize : 0;
+}
+
+
+/* copy array src to array dest */
+bool
+array_copy(array * dest, const array * const src)
+{
+	if (array_UNUSABLE(src))
+		return false;
+
+	return array_copyb(dest, src->mem, src->used);
+}
+
+
+/* return false on failure (realloc failure, invalid src/dest array) */
+bool
+array_copyb(array * dest, const char *src, size_t len)
+{
+	assert(dest != NULL);
+	assert(src != NULL );
+
+	if (!src || !dest)
+		return false;
+
+	array_trunc(dest);
+	return array_catb(dest, src, len);
+}
+
+
+/* copy string to dest */
+bool
+array_copys(array * dest, const char *src)
+{
+	return array_copyb(dest, src, strlen(src));
+}
+
+
+/* append len bytes from src to the array dest.
+return false if we could not append all bytes (realloc failure, invalid src/dest array) */
+bool
+array_catb(array * dest, const char *src, size_t len)
+{
+	size_t tmp;
+	size_t used;
+	char *ptr;
+
+	assert(dest != NULL);
+	assert(src != NULL);
+
+	if (!len)
+		return true;
+
+	if (!src || !dest)
+		return false;
+
+	used = dest->used;
+	tmp = used + len;
+
+	if (tmp < used || tmp < len)	/* integer overflow */
+		return false;
+
+	if (!array_alloc(dest, 1, tmp))
+		return false;
+
+	ptr = dest->mem;
+
+	assert(ptr != NULL);
+
+#ifdef DEBUG_ARRAY
+	Log(LOG_DEBUG,
+	    "array_catb(): appending %u bytes to array (now %u bytes in array).",
+	    len, tmp);
+#endif
+	memcpy(ptr + used, src, len);
+	dest->used = tmp;
+	return true;
+}
+
+
+/* append string to dest */
+bool
+array_cats(array * dest, const char *src)
+{
+	return array_catb(dest, src, strlen(src));
+}
+
+
+/* append trailing NUL byte to array */
+bool
+array_cat0(array * a)
+{
+	return array_catb(a, "", 1);
+}
+
+
+/* append trailing NUL byte to array, but do not count it. */
+bool
+array_cat0_temporary(array * a)
+{
+	char *endpos = array_alloc(a, 1, array_bytes(a));
+	if (!endpos)
+		return false;
+
+	*endpos = '\0';
+	return true;
+}
+
+/* add contents of array src to array dest. */
+bool
+array_cat(array * dest, const array * const src)
+{
+	if (array_UNUSABLE(src))
+		return false;
+
+	return array_catb(dest, src->mem, src->used);
+}
+
+
+/* return pointer to the element at pos.
+   return NULL if the array is unallocated, or if pos is larger than
+   the number of elements stored int the array. */
+void *
+array_get(array * a, size_t membersize, size_t pos)
+{
+	size_t totalsize;
+
+	assert(membersize > 0);
+	assert(a != NULL);
+
+	if (array_UNUSABLE(a))
+		return NULL;
+
+	if (!safemult_sizet(pos, membersize, &totalsize))
+		return NULL;
+
+	if (a->allocated < totalsize)
+		return NULL;
+
+	return a->mem + pos * membersize;
+}
+
+
+void
+array_free(array * a)
+{
+	assert(a != NULL);
+#ifdef DEBUG
+	Log(LOG_DEBUG,
+	    "array_free(): %u bytes free'd (%u bytes still used at time of free()).",
+	    a->allocated, a->used);
+#endif
+	free(a->mem);
+	a->mem = NULL;
+	a->allocated = 0;
+	a->used = 0;
+}
+
+
+void
+array_free_wipe(array * a)
+{
+	if (!array_UNUSABLE(a))
+		memset(a->mem, 0, a->allocated);
+
+	array_free(a);
+}
+
+
+void *
+array_start(const array * const a)
+{
+	assert(a != NULL);
+	return a->mem;
+}
+
+
+void
+array_trunc(array * a)
+{
+	assert(a != NULL);
+	a->used = 0;
+}
+
+
+void
+array_truncate(array * a, size_t membersize, size_t len)
+{
+	size_t newlen;
+	assert(a != NULL);
+	if (!safemult_sizet(membersize, len, &newlen))
+		return;
+
+	if (newlen <= a->allocated)
+		a->used = newlen;
+}
+
+
+/* move elements starting at pos to beginning of array */
+void
+array_moveleft(array * a, size_t membersize, size_t pos)
+{
+	size_t bytepos;
+
+	assert(a != NULL);
+	assert(membersize > 0);
+
+	if (!pos)
+		return;
+
+	if (!safemult_sizet(membersize, pos, &bytepos)) {
+		a->used = 0;
+		return;
+	}
+
+	if (!bytepos)
+		return;	/* nothing to do */
+
+#ifdef DEBUG_ARRAY
+	Log(LOG_DEBUG,
+	    "array_moveleft(): %u bytes used in array, starting at position %u.",
+	    a->used, bytepos);
+#endif
+	if (a->used <= bytepos) {
+		a->used = 0;
+		return;
+	}
+
+	a->used -= bytepos;
+	memmove(a->mem, a->mem + bytepos, a->used);
+}
+
+/* -eof- */

+ 101 - 0
src/ngircd/array.h

@@ -0,0 +1,101 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * Please read the file COPYING, README and AUTHORS for more information.
+ *
+ * libarray - dynamically allocate arrays.
+ * Copyright (c) 2005 Florian Westphal (westphal@foo.fh-furtwangen.de)
+ *
+ * $Id: array.h,v 1.4 2005/08/30 13:36:32 fw Exp $
+ */
+
+#ifndef array_h_included
+#define array_h_included
+
+#include "portab.h"
+
+typedef struct {
+	char * mem;
+	size_t allocated;
+	size_t used;
+} array;
+
+/* allocated: mem != NULL, used >= 0 && used <= allocated, allocated > 0
+   unallocated: mem == NULL, allocated == 0, used == 0 */
+
+#define array_unallocated(x)	(array_bytes(x)==0)
+#define INIT_ARRAY		{ NULL, 0, 0 }
+
+/* set all variables in a to 0 */
+extern void array_init PARAMS((array *a));
+
+/* allocates space for at least nmemb+1 elements of size bytes each.
+   return pointer to elem at pos, or NULL if realloc() fails */
+extern void * array_alloc PARAMS((array *a, size_t size, size_t pos));
+
+/* returns the number of initialized BYTES in a. */
+#define array_bytes(array)	( (array)->used )
+
+/* returns the number of initialized ELEMS in a. */
+extern size_t array_length PARAMS((const array* const a, size_t elemsize));
+
+/* _copy functions: copy src to dest.
+   return true if OK, else false (e. g. realloc failure, invalid src/dest
+   array, ...). In that case dest is left unchanged. */
+
+/* copy array src to dest */
+extern bool array_copy PARAMS((array* dest, const array* const src));
+
+/* copy len bytes from src to array dest. */
+extern bool array_copyb PARAMS((array* dest, const char* src, size_t len));
+
+/* copy string to dest */
+extern bool array_copys PARAMS((array* dest, const char* src));
+
+/* _cat functions: append src to dest.
+   return true if OK, else false (e. g. realloc failure, invalid src/dest
+   array, ...). In that case dest is left unchanged. */
+
+/* append len bytes from src to array dest. */
+extern bool array_catb PARAMS((array* dest, const char* src, size_t len));
+
+/* append string to dest */
+extern bool array_cats PARAMS((array* dest, const char* src));
+
+/* append NUL byte to dest */
+extern bool array_cat0 PARAMS((array* dest));
+
+/* append NUL byte to dest, but do not count null byte */
+extern bool array_cat0_temporary PARAMS((array* dest));
+
+/* append contents of array src to array dest. */
+extern bool array_cat PARAMS((array* dest, const array* const src));
+
+/* return pointer to element at pos.
+   return NULL if the array is unallocated or if pos is larger than the number
+   of elements stored int the array. */
+extern void* array_get PARAMS((array* a, size_t membersize, size_t pos));
+
+/* free the contents of this array. */
+extern void array_free PARAMS((array* a));
+
+/* overwrite array with zeroes before free */
+extern void array_free_wipe PARAMS((array* a));
+
+/* return pointer to first element in this array */
+extern void* array_start PARAMS((const array* const a));
+
+/* reset this array (the memory is not free'd */
+extern void array_trunc PARAMS((array* a));
+
+/* set number of used elements in this array to len */
+extern void array_truncate PARAMS((array* a, size_t membersize, size_t len));
+
+/* move elements starting at pos to beginning of array */
+extern void array_moveleft PARAMS((array* a, size_t membersize, size_t pos));
+
+#endif
+
+/* -eof- */

+ 96 - 51
src/ngircd/channel.c

@@ -17,12 +17,13 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: channel.c,v 1.50 2005/06/18 08:57:37 fw Exp $";
+static char UNUSED id[] = "$Id: channel.c,v 1.56 2006/07/24 22:54:09 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 #include <strings.h>
 
 #include "defines.h"
@@ -49,16 +50,16 @@ static char UNUSED id[] = "$Id: channel.c,v 1.50 2005/06/18 08:57:37 fw Exp $";
 #define REMOVE_KICK 2
 
 
-LOCAL CHANNEL *My_Channels;
-LOCAL CL2CHAN *My_Cl2Chan;
+static CHANNEL *My_Channels;
+static CL2CHAN *My_Cl2Chan;
 
 
-LOCAL CL2CHAN *Get_Cl2Chan PARAMS(( CHANNEL *Chan, CLIENT *Client ));
-LOCAL CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client ));
-LOCAL bool Remove_Client PARAMS(( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, char *Reason, bool InformServer ));
-LOCAL CL2CHAN *Get_First_Cl2Chan PARAMS(( CLIENT *Client, CHANNEL *Chan ));
-LOCAL CL2CHAN *Get_Next_Cl2Chan PARAMS(( CL2CHAN *Start, CLIENT *Client, CHANNEL *Chan ));
-LOCAL bool Delete_Channel PARAMS(( CHANNEL *Chan ));
+static CL2CHAN *Get_Cl2Chan PARAMS(( CHANNEL *Chan, CLIENT *Client ));
+static CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client ));
+static bool Remove_Client PARAMS(( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, char *Reason, bool InformServer ));
+static CL2CHAN *Get_First_Cl2Chan PARAMS(( CLIENT *Client, CHANNEL *Chan ));
+static CL2CHAN *Get_Next_Cl2Chan PARAMS(( CL2CHAN *Start, CLIENT *Client, CHANNEL *Chan ));
+static bool Delete_Channel PARAMS(( CHANNEL *Chan ));
 
 
 GLOBAL void
@@ -76,7 +77,7 @@ Channel_InitPredefined( void )
 
 	CHANNEL *chan;
 	char *c;
-	int i;
+	unsigned int i;
 	
 	for( i = 0; i < Conf_Channel_Count; i++ )
 	{
@@ -87,6 +88,7 @@ Channel_InitPredefined( void )
 		if( ! Channel_IsValidName( Conf_Channel[i].name ))
 		{
 			Log( LOG_ERR, "Can't create pre-defined channel: invalid name: \"%s\"!", Conf_Channel[i].name );
+			array_free(&Conf_Channel[i].topic);
 			continue;
 		}
 
@@ -95,20 +97,29 @@ Channel_InitPredefined( void )
 		if( chan )
 		{
 			Log( LOG_INFO, "Can't create pre-defined channel \"%s\": name already in use.", Conf_Channel[i].name );
+			array_free(&Conf_Channel[i].topic);
 			continue;
 		}
-		
-		/* Channel anlegen */
-		chan = Channel_Create( Conf_Channel[i].name );
-		if( chan )
-		{
-			Channel_ModeAdd( chan, 'P' );
-			Channel_SetTopic( chan, Conf_Channel[i].topic );
+
+		/* Create channel */
+		chan = Channel_Create(Conf_Channel[i].name);
+		if (chan) {
+			Channel_ModeAdd(chan, 'P');
+
+			if (array_start(&Conf_Channel[i].topic) != NULL)
+				Channel_SetTopic(chan, NULL,
+					 array_start(&Conf_Channel[i].topic));
+			array_free(&Conf_Channel[i].topic);
+
 			c = Conf_Channel[i].modes;
-			while( *c ) Channel_ModeAdd( chan, *c++ );
-			Log( LOG_INFO, "Created pre-defined channel \"%s\".", Conf_Channel[i].name );
+			while (*c)
+				Channel_ModeAdd(chan, *c++);
+		
+			Log(LOG_INFO, "Created pre-defined channel \"%s\".",
+							Conf_Channel[i].name );
 		}
-		else Log( LOG_ERR, "Can't create pre-defined channel \"%s\"!", Conf_Channel[i].name );
+		else Log(LOG_ERR, "Can't create pre-defined channel \"%s\"!",
+							Conf_Channel[i].name );
 	}
 } /* Channel_InitPredefined */
 
@@ -124,6 +135,7 @@ Channel_Exit( void )
 	while( c )
 	{
 		c_next = c->next;
+		array_free(&c->topic);
 		free( c );
 		c = c_next;
 	}
@@ -147,17 +159,13 @@ Channel_Join( CLIENT *Client, char *Name )
 	assert( Client != NULL );
 	assert( Name != NULL );
 
-	/* Valider Channel-Name? */
-	if( ! Channel_IsValidName( Name ))
-	{
+	if( ! Channel_IsValidName( Name )) {
 		IRC_WriteStrClient( Client, ERR_NOSUCHCHANNEL_MSG, Client_ID( Client ), Name );
 		return false;
 	}
 
-	/* Channel suchen */
 	chan = Channel_Search( Name );
-	if( chan )
-	{
+	if( chan ) {
 		/* Ist der Client bereits Mitglied? */
 		if( Get_Cl2Chan( chan, Client )) return false;
 	}
@@ -183,7 +191,6 @@ Channel_Part( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason )
 	assert( Name != NULL );
 	assert( Reason != NULL );
 
-	/* Channel suchen */
 	chan = Channel_Search( Name );
 	if(( ! chan ) || ( ! Get_Cl2Chan( chan, Client )))
 	{
@@ -215,21 +222,20 @@ Channel_Kick( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason )
 		return;
 	}
 
-	/* Ist der User Mitglied in dem Channel? */
 	if( ! Channel_IsMemberOf( chan, Origin ))
 	{
 		IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Name );
 		return;
 	}
 
-	/* Ist der User Channel-Operator? */
+	/* Is User Channel-Operator? */
 	if( ! strchr( Channel_UserModes( chan, Origin ), 'o' ))
 	{
 		IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Name);
 		return;
 	}
 
-	/* Ist der Ziel-User Mitglied im Channel? */
+	/* Ist the kickED User member of channel? */
 	if( ! Channel_IsMemberOf( chan, Client ))
 	{
 		IRC_WriteStrClient( Origin, ERR_USERNOTINCHANNEL_MSG, Client_ID( Origin ), Client_ID( Client ), Name );
@@ -509,13 +515,11 @@ Channel_ModeDel( CHANNEL *Chan, char Mode )
 	 * if the mode was removed return true.
 	 * if the channel did not have the mode, return false.
 	*/
-	char x[2], *p;
+	char *p;
 
 	assert( Chan != NULL );
 
-	x[0] = Mode; x[1] = '\0';
-
-	p = strchr( Chan->modes, x[0] );
+	p = strchr( Chan->modes, Mode );
 	if( ! p ) return false;
 
 	/* Channel has mode -> delete */
@@ -565,7 +569,7 @@ Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, char Mode )
 	 */
 
 	CL2CHAN *cl2chan;
-	char x[2], *p;
+	char *p;
 
 	assert( Chan != NULL );
 	assert( Client != NULL );
@@ -573,9 +577,7 @@ Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, char Mode )
 	cl2chan = Get_Cl2Chan( Chan, Client );
 	assert( cl2chan != NULL );
 
-	x[0] = Mode; x[1] = '\0';
-
-	p = strchr( cl2chan->modes, x[0] );
+	p = strchr( cl2chan->modes, Mode );
 	if( ! p ) return false;
 
 	/* Client has Mode -> delete */
@@ -621,18 +623,61 @@ Channel_IsMemberOf( CHANNEL *Chan, CLIENT *Client )
 GLOBAL char *
 Channel_Topic( CHANNEL *Chan )
 {
+	char *ret;
 	assert( Chan != NULL );
-	return Chan->topic;
+	ret = array_start(&Chan->topic);
+	return ret ? ret : "";
 } /* Channel_Topic */
 
+	
+#ifndef STRICT_RFC
+
+GLOBAL unsigned int
+Channel_TopicTime(CHANNEL *Chan)
+{
+	assert(Chan != NULL);
+	return (unsigned int) Chan->topic_time;
+} /* Channel_TopicTime */
+
+
+GLOBAL char *
+Channel_TopicWho(CHANNEL *Chan)
+{
+	assert(Chan != NULL);
+	return Chan->topic_who;
+} /* Channel_TopicWho */
+
+#endif
+
 
 GLOBAL void
-Channel_SetTopic( CHANNEL *Chan, char *Topic )
+Channel_SetTopic(CHANNEL *Chan, CLIENT *Client, char *Topic)
 {
+	size_t len;
 	assert( Chan != NULL );
 	assert( Topic != NULL );
-	
-	strlcpy( Chan->topic, Topic, sizeof( Chan->topic ));
+
+	len = strlen(Topic);
+	if (len < array_bytes(&Chan->topic))
+		array_free(&Chan->topic);
+
+	if (!array_copyb(&Chan->topic, Topic, len))
+		Log(LOG_WARNING, "could not set new Topic \"%s\" on %s: %s",
+					Topic, Chan->name, strerror(errno));
+
+	array_cat0(&Chan->topic);
+
+#ifndef STRICT_RFC
+	Chan->topic_time = time(NULL);
+	if (Client != NULL && Client_Type(Client) != CLIENT_SERVER)
+		strlcpy(Chan->topic_who, Client_ID(Client),
+			sizeof Chan->topic_who);
+	else
+		strlcpy(Chan->topic_who, DEFAULT_TOPIC_ID,
+			sizeof Chan->topic_who);
+#else
+	(void) Client;
+#endif
 } /* Channel_SetTopic */
 
 
@@ -689,7 +734,7 @@ Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, char *Text )
 	/* Is the client banned? */
 	if( Lists_CheckBanned( From, Chan ))
 	{
-		/* Client is banned, bus is he channel operator or has voice? */
+		/* Client is banned, but is he channel operator or has voice? */
 		if(( ! has_voice ) && ( ! is_op )) ok = false;
 	}
 
@@ -720,14 +765,14 @@ Channel_Create( char *Name )
 	c->hash = Hash( c->name );
 	c->next = My_Channels;
 	My_Channels = c;
-	
+#ifdef DEBUG	
 	Log( LOG_DEBUG, "Created new channel structure for \"%s\".", Name );
-	
+#endif
 	return c;
 } /* Channel_Create */
 
 
-LOCAL CL2CHAN *
+static CL2CHAN *
 Get_Cl2Chan( CHANNEL *Chan, CLIENT *Client )
 {
 	CL2CHAN *cl2chan;
@@ -745,7 +790,7 @@ Get_Cl2Chan( CHANNEL *Chan, CLIENT *Client )
 } /* Get_Cl2Chan */
 
 
-LOCAL CL2CHAN *
+static CL2CHAN *
 Add_Client( CHANNEL *Chan, CLIENT *Client )
 {
 	CL2CHAN *cl2chan;
@@ -774,7 +819,7 @@ Add_Client( CHANNEL *Chan, CLIENT *Client )
 } /* Add_Client */
 
 
-LOCAL bool
+static bool
 Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, char *Reason, bool InformServer )
 {
 	CL2CHAN *cl2chan, *last_cl2chan;
@@ -837,14 +882,14 @@ Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, char *Re
 } /* Remove_Client */
 
 
-LOCAL CL2CHAN *
+static CL2CHAN *
 Get_First_Cl2Chan( CLIENT *Client, CHANNEL *Chan )
 {
 	return Get_Next_Cl2Chan( My_Cl2Chan, Client, Chan );
 } /* Get_First_Cl2Chan */
 
 
-LOCAL CL2CHAN *
+static CL2CHAN *
 Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel )
 {
 	CL2CHAN *cl2chan;
@@ -862,7 +907,7 @@ Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel )
 } /* Get_Next_Cl2Chan */
 
 
-LOCAL bool
+static bool
 Delete_Channel( CHANNEL *Chan )
 {
 	/* Channel-Struktur loeschen */

+ 13 - 3
src/ngircd/channel.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: channel.h,v 1.27 2005/03/19 18:43:48 fw Exp $
+ * $Id: channel.h,v 1.29 2005/09/02 12:50:25 alex Exp $
  *
  * Channel management (header)
  */
@@ -21,6 +21,7 @@
 #if defined(__channel_c__) | defined(S_SPLINT_S)
 
 #include "defines.h"
+#include "array.h"
 
 typedef struct _CHANNEL
 {
@@ -28,7 +29,11 @@ typedef struct _CHANNEL
 	char name[CHANNEL_NAME_LEN];	/* Name of the channel */
 	UINT32 hash;			/* Hash of the (lowecase!) name */
 	char modes[CHANNEL_MODE_LEN];	/* Channel modes */
-	char topic[CHANNEL_TOPIC_LEN];	/* Topic of the channel */
+	array topic;			/* Topic of the channel */
+#ifndef STRICT_RFC
+	time_t topic_time;		/* Time when topic was set */
+	char topic_who[CLIENT_NICK_LEN];/* Nickname of user that set topic */
+#endif
 	char key[CLIENT_PASS_LEN];	/* Channel key ("password", mode "k" ) */
 	long maxusers;			/* Maximum number of members (mode "l") */
 } CHANNEL;
@@ -71,7 +76,7 @@ GLOBAL char *Channel_Topic PARAMS(( CHANNEL *Chan ));
 GLOBAL char *Channel_Key PARAMS(( CHANNEL *Chan ));
 GLOBAL long Channel_MaxUsers PARAMS(( CHANNEL *Chan ));
 
-GLOBAL void Channel_SetTopic PARAMS(( CHANNEL *Chan, char *Topic ));
+GLOBAL void Channel_SetTopic PARAMS(( CHANNEL *Chan, CLIENT *Client, char *Topic ));
 GLOBAL void Channel_SetModes PARAMS(( CHANNEL *Chan, char *Modes ));
 GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, char *Key ));
 GLOBAL void Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, long Count ));
@@ -104,6 +109,11 @@ GLOBAL bool Channel_Write PARAMS(( CHANNEL *Chan, CLIENT *From, CLIENT *Client,
 
 GLOBAL CHANNEL *Channel_Create PARAMS(( char *Name ));
 
+#ifndef STRICT_RFC
+GLOBAL unsigned int Channel_TopicTime PARAMS(( CHANNEL *Chan ));
+GLOBAL char *Channel_TopicWho PARAMS(( CHANNEL *Chan ));
+#endif
+
 
 #endif
 

+ 59 - 55
src/ngircd/client.c

@@ -17,7 +17,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: client.c,v 1.84 2005/06/12 16:39:42 alex Exp $";
+static char UNUSED id[] = "$Id: client.c,v 1.91 2006/04/23 10:37:27 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -50,19 +50,23 @@ static char UNUSED id[] = "$Id: client.c,v 1.84 2005/06/12 16:39:42 alex Exp $";
 #define GETID_LEN (CLIENT_NICK_LEN-1) + 1 + (CLIENT_USER_LEN-1) + 1 + (CLIENT_HOST_LEN-1) + 1
 
 
-LOCAL CLIENT *This_Server, *My_Clients;
-LOCAL char GetID_Buffer[GETID_LEN];
+static CLIENT *This_Server, *My_Clients;
+static char GetID_Buffer[GETID_LEN];
 
-LOCAL WHOWAS My_Whowas[MAX_WHOWAS];
-LOCAL int Last_Whowas = -1;
+static WHOWAS My_Whowas[MAX_WHOWAS];
+static int Last_Whowas = -1;
 
 
-LOCAL long Count PARAMS(( CLIENT_TYPE Type ));
-LOCAL long MyCount PARAMS(( CLIENT_TYPE Type ));
+static long Count PARAMS(( CLIENT_TYPE Type ));
+static long MyCount PARAMS(( CLIENT_TYPE Type ));
 
-LOCAL CLIENT *New_Client_Struct PARAMS(( void ));
-LOCAL void Generate_MyToken PARAMS(( CLIENT *Client ));
-LOCAL void Adjust_Counters PARAMS(( CLIENT *Client ));
+static CLIENT *New_Client_Struct PARAMS(( void ));
+static void Generate_MyToken PARAMS(( CLIENT *Client ));
+static void Adjust_Counters PARAMS(( CLIENT *Client ));
+
+static CLIENT *Init_New_Client PARAMS((CONN_ID Idx, CLIENT *Introducer,
+ CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname,
+ char *Info, int Hops, int Token, char *Modes, bool Idented));
 
 #ifndef Client_DestroyNow
 GLOBAL void Client_DestroyNow PARAMS((CLIENT *Client ));
@@ -135,32 +139,53 @@ Client_ThisServer( void )
 } /* Client_ThisServer */
 
 
+/**
+ * Initialize new local client; wrapper function for Init_New_Client().
+ * @return New CLIENT structure.
+ */
 GLOBAL CLIENT *
-Client_NewLocal( CONN_ID Idx, char *Hostname, int Type, bool Idented )
+Client_NewLocal(CONN_ID Idx, char *Hostname, int Type, bool Idented)
 {
-	/* Neuen lokalen Client erzeugen: Wrapper-Funktion fuer Client_New(). */
-	return Client_New( Idx, This_Server, NULL, Type, NULL, NULL, Hostname, NULL, 0, 0, NULL, Idented );
+	return Init_New_Client(Idx, This_Server, NULL, Type, NULL, NULL,
+		Hostname, NULL, 0, 0, NULL, Idented);
 } /* Client_NewLocal */
 
 
+/**
+ * Initialize new remote server; wrapper function for Init_New_Client().
+ * @return New CLIENT structure.
+ */
 GLOBAL CLIENT *
-Client_NewRemoteServer( CLIENT *Introducer, char *Hostname, CLIENT *TopServer, int Hops, int Token, char *Info, bool Idented )
+Client_NewRemoteServer(CLIENT *Introducer, char *Hostname, CLIENT *TopServer,
+ int Hops, int Token, char *Info, bool Idented)
 {
-	/* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
-	return Client_New( NONE, Introducer, TopServer, CLIENT_SERVER, Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented );
+	return Init_New_Client(NONE, Introducer, TopServer, CLIENT_SERVER,
+		Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented);
 } /* Client_NewRemoteServer */
 
 
+/**
+ * Initialize new remote client; wrapper function for Init_New_Client().
+ * @return New CLIENT structure.
+ */
 GLOBAL CLIENT *
-Client_NewRemoteUser( CLIENT *Introducer, char *Nick, int Hops, char *User, char *Hostname, int Token, char *Modes, char *Info, bool Idented )
+Client_NewRemoteUser(CLIENT *Introducer, char *Nick, int Hops, char *User,
+ char *Hostname, int Token, char *Modes, char *Info, bool Idented)
 {
-	/* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */
-	return Client_New( NONE, Introducer, NULL, CLIENT_USER, Nick, User, Hostname, Info, Hops, Token, Modes, Idented );
+	return Init_New_Client(NONE, Introducer, NULL, CLIENT_USER, Nick,
+		User, Hostname, Info, Hops, Token, Modes, Idented);
 } /* Client_NewRemoteUser */
 
 
-GLOBAL CLIENT *
-Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname, char *Info, int Hops, int Token, char *Modes, bool Idented )
+/**
+ * Initialize new client and set up the given parameters like client type,
+ * user name, host name, introducing server etc. ...
+ * @return New CLIENT structure.
+ */
+static CLIENT *
+Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer,
+ int Type, char *ID, char *User, char *Hostname, char *Info, int Hops,
+ int Token, char *Modes, bool Idented)
 {
 	CLIENT *client;
 
@@ -197,7 +222,7 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, int Type, char *
 	Adjust_Counters( client );
 
 	return client;
-} /* Client_New */
+} /* Init_New_Client */
 
 
 GLOBAL void
@@ -296,11 +321,9 @@ Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )
 				{
 					if( c->id[0] ) Log( LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
 					else Log( LOG_NOTICE, "Client unregistered (connection %d): %s", c->conn_id, txt );
-				}
-				else
-				{
-					if( c->id[0] ) Log( LOG_WARNING, "Unregistered unknown client \"%s\": %s", c->id, txt );
-					else Log( LOG_WARNING, "Unregistered unknown client: %s", c->id, txt );
+				} else {
+					Log(LOG_WARNING, "Unregistered unknown client \"%s\": %s",
+								c->id[0] ? c->id : "(No Nick)", txt );
 				}
 			}
 
@@ -541,27 +564,6 @@ Client_ModeDel( CLIENT *Client, char Mode )
 
 
 GLOBAL CLIENT *
-Client_GetFromConn( CONN_ID Idx )
-{
-	/* return Client-Structure that belongs to the local Connection Idx gehoert.
-	 * If none is found, return NULL.
-	 */
-
-	CLIENT *c;
-
-	assert( Idx >= 0 );
-	
-	c = My_Clients;
-	while( c )
-	{
-		if( c->conn_id == Idx ) return c;
-		c = (CLIENT *)c->next;
-	}
-	return NULL;
-} /* Client_GetFromConn */
-
-
-GLOBAL CLIENT *
 Client_Search( char *Nick )
 {
 	/* return Client-Structure that has the corresponding Nick.
@@ -1035,7 +1037,7 @@ Client_StartTime(CLIENT *Client)
 } /* Client_Uptime */
 
 
-LOCAL long
+static long
 Count( CLIENT_TYPE Type )
 {
 	CLIENT *c;
@@ -1052,7 +1054,7 @@ Count( CLIENT_TYPE Type )
 } /* Count */
 
 
-LOCAL long
+static long
 MyCount( CLIENT_TYPE Type )
 {
 	CLIENT *c;
@@ -1069,7 +1071,7 @@ MyCount( CLIENT_TYPE Type )
 } /* MyCount */
 
 
-LOCAL CLIENT *
+static CLIENT *
 New_Client_Struct( void )
 {
 	/* Neue CLIENT-Struktur pre-initialisieren */
@@ -1096,7 +1098,7 @@ New_Client_Struct( void )
 } /* New_Client */
 
 
-LOCAL void
+static void
 Generate_MyToken( CLIENT *Client )
 {
 	CLIENT *c;
@@ -1120,7 +1122,7 @@ Generate_MyToken( CLIENT *Client )
 } /* Generate_MyToken */
 
 
-LOCAL void
+static void
 Adjust_Counters( CLIENT *Client )
 {
 	long count;
@@ -1150,11 +1152,13 @@ GLOBAL void
 Client_RegisterWhowas( CLIENT *Client )
 {
 	int slot;
+	time_t now;
 	
 	assert( Client != NULL );
 
+	now = time(NULL);
 	/* Don't register clients that were connected less than 30 seconds. */
-	if( time(NULL) - Client->starttime < 30 )
+	if( now - Client->starttime < 30 )
 		return;
 
 	slot = Last_Whowas + 1;
@@ -1164,7 +1168,7 @@ Client_RegisterWhowas( CLIENT *Client )
 	Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
 #endif
 	
-	My_Whowas[slot].time = time( NULL );
+	My_Whowas[slot].time = now;
 	strlcpy( My_Whowas[slot].id, Client_ID( Client ),
 		 sizeof( My_Whowas[slot].id ));
 	strlcpy( My_Whowas[slot].user, Client_User( Client ),

+ 2 - 3
src/ngircd/client.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: client.h,v 1.39 2005/06/12 16:18:49 alex Exp $
+ * $Id: client.h,v 1.42 2006/04/23 10:37:27 fw Exp $
  *
  * Client management (header)
  */
@@ -30,6 +30,7 @@
 
 #define CLIENT_TYPE int
 
+#include "defines.h"
 
 #if defined(__client_c__) | defined(S_SPLINT_S)
 
@@ -78,7 +79,6 @@ GLOBAL void Client_Exit PARAMS(( void ));
 GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, char *Hostname, int Type, bool Idented ));
 GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, char *Hostname, CLIENT *TopServer, int Hops, int Token, char *Info, bool Idented ));
 GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, char *Nick, int Hops, char *User, char *Hostname, int Token, char *Modes, char *Info, bool Idented ));
-GLOBAL CLIENT *Client_New PARAMS(( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname, char *Info, int Hops, int Token, char *Modes, bool Idented ));
 
 GLOBAL void Client_Destroy PARAMS(( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit ));
 #ifdef CONN_MODULE
@@ -87,7 +87,6 @@ GLOBAL void Client_DestroyNow PARAMS(( CLIENT *Client ));
 
 GLOBAL CLIENT *Client_ThisServer PARAMS(( void ));
 
-GLOBAL CLIENT *Client_GetFromConn PARAMS(( CONN_ID Idx ));
 GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, int Token ));
 
 GLOBAL CLIENT *Client_Search PARAMS(( char *ID ));

File diff suppressed because it is too large
+ 360 - 328
src/ngircd/conf.c


+ 12 - 12
src/ngircd/conf.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conf.h,v 1.34 2005/03/20 13:54:06 fw Exp $
+ * $Id: conf.h,v 1.40 2006/05/10 21:24:01 alex Exp $
  *
  * Configuration management (header)
  */
@@ -20,6 +20,7 @@
 #include <time.h>
 
 #include "defines.h"
+#include "array.h"
 #include "portab.h"
 
 typedef struct _Conf_Oper
@@ -39,7 +40,7 @@ typedef struct _Conf_Server
 	UINT16 port;			/* Server port */
 	int group;			/* Group of server */
 	time_t lasttry;			/* Last connect attempt */
-	RES_STAT *res_stat;		/* Status of the resolver */
+	RES_STAT res_stat;		/* Status of the resolver */
 	int flags;			/* Flags */
 	CONN_ID conn_id;		/* ID of server connection or NONE */
 } CONF_SERVER;
@@ -48,7 +49,7 @@ typedef struct _Conf_Channel
 {
 	char name[CHANNEL_NAME_LEN];	/* Name of the channel */
 	char modes[CHANNEL_MODE_LEN];	/* Initial channel modes */
-	char topic[CHANNEL_TOPIC_LEN];	/* Initial topic */
+	array topic;			/* Initial topic */
 } CONF_CHANNEL;
 
 
@@ -77,15 +78,14 @@ GLOBAL char Conf_MotdFile[FNAME_LEN];
 GLOBAL char Conf_MotdPhrase[LINE_LEN];
 
 /* Ports the server should listen on */
-GLOBAL UINT16 Conf_ListenPorts[MAX_LISTEN_PORTS];
-GLOBAL int Conf_ListenPorts_Count;
+GLOBAL array Conf_ListenPorts;
 
 /* Address to which the socket should be bound or empty (=all) */
 GLOBAL char Conf_ListenAddress[16];
 
 /* User and group ID the server should run with */
-GLOBAL unsigned int Conf_UID;
-GLOBAL unsigned int Conf_GID;
+GLOBAL uid_t Conf_UID;
+GLOBAL gid_t Conf_GID;
 
 /* A directory to chroot() in */
 GLOBAL char Conf_Chroot[FNAME_LEN];
@@ -102,14 +102,14 @@ GLOBAL int Conf_ConnectRetry;
 
 /* Operators */
 GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS];
-GLOBAL int Conf_Oper_Count;
+GLOBAL unsigned int Conf_Oper_Count;
 
 /* Servers */
 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
 
 /* Pre-defined channels */
 GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS];
-GLOBAL int Conf_Channel_Count;
+GLOBAL unsigned int Conf_Channel_Count;
 
 /* Are IRC operators allowed to always use MODE? */
 GLOBAL bool Conf_OperCanMode;
@@ -129,9 +129,9 @@ GLOBAL int Conf_MaxJoins;
 GLOBAL int Conf_MaxConnectionsIP;
 
 
-GLOBAL void Conf_Init PARAMS((void ));
-GLOBAL void Conf_Rehash PARAMS((void ));
-GLOBAL int Conf_Test PARAMS((void ));
+GLOBAL void Conf_Init PARAMS((void));
+GLOBAL void Conf_Rehash PARAMS((void));
+GLOBAL int Conf_Test PARAMS((void));
 
 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
 GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));

+ 18 - 10
src/ngircd/conn-func.c

@@ -16,7 +16,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: conn-func.c,v 1.6 2005/06/12 16:32:17 alex Exp $";
+static char UNUSED id[] = "$Id: conn-func.c,v 1.10 2006/05/10 21:24:01 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -73,7 +73,13 @@ Conn_SetPenalty( CONN_ID Idx, time_t Seconds )
 	assert( Seconds >= 0 );
 
 	t = time( NULL ) + Seconds;
-	if( t > My_Connections[Idx].delaytime ) My_Connections[Idx].delaytime = t;
+	if (t > My_Connections[Idx].delaytime)
+		My_Connections[Idx].delaytime = t;
+
+#ifdef DEBUG
+	Log(LOG_DEBUG, "Add penalty time on connection %d: %ld second(s).",
+			Idx, (long)Seconds);
+#endif
 } /* Conn_SetPenalty */
 
 
@@ -150,7 +156,7 @@ Conn_Next( CONN_ID Idx )
 } /* Conn_Next */
 
 
-GLOBAL int
+GLOBAL UINT16
 Conn_Options( CONN_ID Idx )
 {
 	assert( Idx > NONE );
@@ -171,7 +177,7 @@ Conn_StartTime( CONN_ID Idx )
 	assert(Idx > NONE);
 
 	/* Search client structure for this link ... */
-	c = Client_GetFromConn(Idx);
+	c = Conn_GetClient(Idx);
 	if(c != NULL)
 		return Client_StartTime(c);
 
@@ -179,17 +185,18 @@ Conn_StartTime( CONN_ID Idx )
 } /* Conn_StartTime */
 
 
-GLOBAL int
+GLOBAL size_t
 Conn_SendQ( CONN_ID Idx )
 {
 	/* Laenge der Daten im Schreibbuffer liefern */
 
 	assert( Idx > NONE );
 #ifdef ZLIB
-	if( My_Connections[Idx].options & CONN_ZIP ) return My_Connections[Idx].zip.wdatalen;
+	if( My_Connections[Idx].options & CONN_ZIP )
+		return array_bytes(&My_Connections[Idx].zip.wbuf);
 	else
 #endif
-	return My_Connections[Idx].wdatalen;
+	return array_bytes(&My_Connections[Idx].wbuf);
 } /* Conn_SendQ */
 
 
@@ -213,17 +220,18 @@ Conn_SendBytes( CONN_ID Idx )
 } /* Conn_SendBytes */
 
 
-GLOBAL int
+GLOBAL size_t
 Conn_RecvQ( CONN_ID Idx )
 {
 	/* Laenge der Daten im Lesebuffer liefern */
 
 	assert( Idx > NONE );
 #ifdef ZLIB
-	if( My_Connections[Idx].options & CONN_ZIP ) return My_Connections[Idx].zip.rdatalen;
+	if( My_Connections[Idx].options & CONN_ZIP )
+		return array_bytes(&My_Connections[Idx].zip.rbuf);
 	else
 #endif
-	return My_Connections[Idx].rdatalen;
+	return array_bytes(&My_Connections[Idx].rbuf);
 } /* Conn_RecvQ */
 
 

+ 4 - 4
src/ngircd/conn-func.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conn-func.h,v 1.4 2005/04/25 18:37:16 fw Exp $
+ * $Id: conn-func.h,v 1.5 2006/05/10 21:24:01 alex Exp $
  *
  * Connection management: Global functions (header)
  */
@@ -30,8 +30,8 @@ GLOBAL void Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
 GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
 GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
 GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx ));
-GLOBAL int Conn_SendQ PARAMS(( CONN_ID Idx ));
-GLOBAL int Conn_RecvQ PARAMS(( CONN_ID Idx ));
+GLOBAL size_t Conn_SendQ PARAMS(( CONN_ID Idx ));
+GLOBAL size_t Conn_RecvQ PARAMS(( CONN_ID Idx ));
 GLOBAL long Conn_SendMsg PARAMS(( CONN_ID Idx ));
 GLOBAL long Conn_RecvMsg PARAMS(( CONN_ID Idx ));
 GLOBAL long Conn_SendBytes PARAMS(( CONN_ID Idx ));
@@ -47,7 +47,7 @@ GLOBAL void Conn_SetFlag PARAMS(( CONN_ID Idx, int Flag ));
 GLOBAL CONN_ID Conn_First PARAMS(( void ));
 GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx ));
 
-GLOBAL int Conn_Options PARAMS(( CONN_ID Idx ));
+GLOBAL UINT16 Conn_Options PARAMS(( CONN_ID Idx ));
 
 GLOBAL void Conn_ResetWCounter PARAMS(( void ));
 GLOBAL long Conn_WCounter PARAMS(( void ));

+ 77 - 39
src/ngircd/conn-zip.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2006 Alexander Barton (alex@barton.de)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,10 @@
 
 #ifdef ZLIB
 
-static char UNUSED id[] = "$Id: conn-zip.c,v 1.7 2005/04/25 18:37:16 fw Exp $";
+/* enable more zlib related debug messages: */
+/* #define DEBUG_ZLIB */
+
+static char UNUSED id[] = "$Id: conn-zip.c,v 1.11 2006/07/23 15:19:20 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -30,6 +33,7 @@ static char UNUSED id[] = "$Id: conn-zip.c,v 1.7 2005/04/25 18:37:16 fw Exp $";
 #include "conn-func.h"
 #include "log.h"
 
+#include "array.h"
 #include "exp.h"
 #include "conn-zip.h"
 
@@ -79,7 +83,7 @@ Zip_InitConn( CONN_ID Idx )
 
 
 GLOBAL bool
-Zip_Buffer( CONN_ID Idx, char *Data, int Len )
+Zip_Buffer( CONN_ID Idx, char *Data, size_t Len )
 {
 	/* Daten zum Komprimieren im "Kompressions-Puffer" sammeln.
 	* Es wird true bei Erfolg, sonst false geliefert. */
@@ -87,19 +91,17 @@ Zip_Buffer( CONN_ID Idx, char *Data, int Len )
 	assert( Idx > NONE );
 	assert( Data != NULL );
 	assert( Len > 0 );
+	assert( Len <= ZWRITEBUFFER_LEN );
 
-	/* Ist noch Platz im Kompressions-Puffer? */
-	if( ZWRITEBUFFER_LEN - My_Connections[Idx].zip.wdatalen < Len + 50 )
-	{
-		/* Nein! Puffer zunaechst leeren ...*/
+	if (Len > ZWRITEBUFFER_LEN)
+		return false;
+
+	if ( array_bytes( &My_Connections[Idx].zip.wbuf ) >= ZWRITEBUFFER_LEN ) {
+		/* compression buffer is full, flush */
 		if( ! Zip_Flush( Idx )) return false;
 	}
 
-	/* Daten kopieren */
-	memmove( My_Connections[Idx].zip.wbuf + My_Connections[Idx].zip.wdatalen, Data, Len );
-	My_Connections[Idx].zip.wdatalen += Len;
-
-	return true;
+	return array_catb(&My_Connections[Idx].zip.wbuf, Data, Len);
 } /* Zip_Buffer */
 
 
@@ -109,16 +111,26 @@ Zip_Flush( CONN_ID Idx )
 	/* Daten komprimieren und in Schreibpuffer kopieren.
 	* Es wird true bei Erfolg, sonst false geliefert. */
 
-	int result, out_len;
+	int result;
+	unsigned char zipbuf[WRITEBUFFER_LEN];
+	int zipbuf_used = 0;
 	z_stream *out;
 
 	out = &My_Connections[Idx].zip.out;
 
-	out->next_in = (void *)My_Connections[Idx].zip.wbuf;
-	out->avail_in = My_Connections[Idx].zip.wdatalen;
-	out->next_out = (void *)(My_Connections[Idx].wbuf + My_Connections[Idx].wdatalen);
-	out->avail_out = WRITEBUFFER_LEN - My_Connections[Idx].wdatalen;
+	out->next_in = array_start(&My_Connections[Idx].zip.wbuf);
+	if (!out->next_in)
+		return false;
+
+	out->avail_in = (uInt)array_bytes(&My_Connections[Idx].zip.wbuf);
+
+	out->next_out = zipbuf;
+	out->avail_out = (uInt)sizeof zipbuf;
 
+#ifdef DEBUG_ZIP
+	Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d",
+		out->avail_in, out->avail_out);
+#endif
 	result = deflate( out, Z_SYNC_FLUSH );
 	if(( result != Z_OK ) || ( out->avail_in > 0 ))
 	{
@@ -127,11 +139,18 @@ Zip_Flush( CONN_ID Idx )
 		return false;
 	}
 
-	out_len = WRITEBUFFER_LEN - My_Connections[Idx].wdatalen - out->avail_out;
-	My_Connections[Idx].wdatalen += out_len;
-	My_Connections[Idx].bytes_out += out_len;
-	My_Connections[Idx].zip.bytes_out += My_Connections[Idx].zip.wdatalen;
-	My_Connections[Idx].zip.wdatalen = 0;
+	assert(out->avail_out <= WRITEBUFFER_LEN);
+	zipbuf_used = WRITEBUFFER_LEN - out->avail_out;
+#ifdef DEBUG_ZIP
+	Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used);
+#endif
+	if (!array_catb(&My_Connections[Idx].wbuf,
+			(char *)zipbuf, (size_t) zipbuf_used))
+		return false;
+
+	My_Connections[Idx].bytes_out += zipbuf_used;
+	My_Connections[Idx].zip.bytes_out += array_bytes(&My_Connections[Idx].zip.wbuf); 
+	array_trunc(&My_Connections[Idx].zip.wbuf);
 
 	return true;
 } /* Zip_Flush */
@@ -144,20 +163,34 @@ Unzip_Buffer( CONN_ID Idx )
 	* wird false geliefert, ansonsten true. Der Fall, dass keine
 	* Daten mehr zu entpacken sind, ist _kein_ Fehler! */
 
-	int result, in_len, out_len;
+	int result;
+	unsigned char unzipbuf[READBUFFER_LEN];
+	int unzipbuf_used = 0;
+	unsigned int z_rdatalen;
+	unsigned int in_len;
+	
 	z_stream *in;
 
 	assert( Idx > NONE );
 
-	if( My_Connections[Idx].zip.rdatalen <= 0 ) return true;
+	z_rdatalen = (unsigned int)array_bytes(&My_Connections[Idx].zip.rbuf);
+	if (z_rdatalen == 0)
+		return true;
 
 	in = &My_Connections[Idx].zip.in;
+	
+	in->next_in = array_start(&My_Connections[Idx].zip.rbuf);
+	if (!in->next_in)
+		return false;
 
-	in->next_in = (void *)My_Connections[Idx].zip.rbuf;
-	in->avail_in = My_Connections[Idx].zip.rdatalen;
-	in->next_out = (void *)(My_Connections[Idx].rbuf + My_Connections[Idx].rdatalen);
-	in->avail_out = READBUFFER_LEN - My_Connections[Idx].rdatalen - 1;
+	in->avail_in = z_rdatalen;
+	in->next_out = unzipbuf;
+	in->avail_out = (uInt)sizeof unzipbuf;
 
+#ifdef DEBUG_ZIP
+	Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d",
+		in->avail_in, in->avail_out);
+#endif
 	result = inflate( in, Z_SYNC_FLUSH );
 	if( result != Z_OK )
 	{
@@ -166,19 +199,24 @@ Unzip_Buffer( CONN_ID Idx )
 		return false;
 	}
 
-	in_len = My_Connections[Idx].zip.rdatalen - in->avail_in;
-	out_len = READBUFFER_LEN - My_Connections[Idx].rdatalen - 1 - in->avail_out;
-	My_Connections[Idx].rdatalen += out_len;
+	assert(z_rdatalen >= in->avail_in);
+	in_len = z_rdatalen - in->avail_in;
+	unzipbuf_used = READBUFFER_LEN - in->avail_out;
+#ifdef DEBUG_ZIP
+	Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
+		in->avail_out, unzipbuf_used);
+#endif
+	assert(unzipbuf_used <= READBUFFER_LEN);
+	if (!array_catb(&My_Connections[Idx].rbuf, (char*) unzipbuf,
+			(size_t)unzipbuf_used))
+		return false;
 
-	if( in->avail_in > 0 )
-	{
-		/* es konnten nicht alle Daten entpackt werden, vermutlich war
-		* im Ziel-Puffer kein Platz mehr. Umkopieren ... */
-		My_Connections[Idx].zip.rdatalen -= in_len;
-		memmove( My_Connections[Idx].zip.rbuf, My_Connections[Idx].zip.rbuf + in_len, My_Connections[Idx].zip.rdatalen );
+	if( in->avail_in > 0 ) {
+		array_moveleft(&My_Connections[Idx].zip.rbuf, 1, in_len );
+	} else {
+		array_trunc( &My_Connections[Idx].zip.rbuf );
+		My_Connections[Idx].zip.bytes_in += unzipbuf_used;
 	}
-	else My_Connections[Idx].zip.rdatalen = 0;
-	My_Connections[Idx].zip.bytes_in += out_len;
 
 	return true;
 } /* Unzip_Buffer */

+ 2 - 2
src/ngircd/conn-zip.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conn-zip.h,v 1.3 2005/03/19 18:43:48 fw Exp $
+ * $Id: conn-zip.h,v 1.4 2006/05/10 21:24:01 alex Exp $
  *
  * Connection compression using ZLIB (header)
  */
@@ -22,7 +22,7 @@
 
 GLOBAL bool Zip_InitConn PARAMS(( CONN_ID Idx ));
 
-GLOBAL bool Zip_Buffer PARAMS(( CONN_ID Idx, char *Data, int Len ));
+GLOBAL bool Zip_Buffer PARAMS(( CONN_ID Idx, char *Data, size_t Len ));
 GLOBAL bool Zip_Flush PARAMS(( CONN_ID Idx ));
 GLOBAL bool Unzip_Buffer PARAMS(( CONN_ID Idx ));
 

File diff suppressed because it is too large
+ 758 - 833
src/ngircd/conn.c


+ 11 - 17
src/ngircd/conn.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: conn.h,v 1.35.2.1 2005/07/30 23:24:50 alex Exp $
+ * $Id: conn.h,v 1.42 2006/05/10 21:24:01 alex Exp $
  *
  * Connection management (header)
  */
@@ -31,11 +31,13 @@
 
 typedef int CONN_ID;
 
+#include "client.h"
 
 #ifdef CONN_MODULE
 
 #include "defines.h"
 #include "resolve.h"
+#include "array.h"
 
 #ifdef ZLIB
 #include <zlib.h>
@@ -43,10 +45,8 @@ typedef struct _ZipData
 {
 	z_stream in;			/* "Handle" for input stream */
 	z_stream out;			/* "Handle" for output stream */
-	char rbuf[READBUFFER_LEN];	/* Read buffer */
-	int rdatalen;			/* Length of data in read buffer (compressed) */
-	char wbuf[WRITEBUFFER_LEN];	/* Write buffer */
-	int wdatalen;			/* Length of data in write buffer (uncompressed) */
+	array rbuf;			/* Read buffer (compressed) */
+	array wbuf;			/* Write buffer (uncompressed) */
 	long bytes_in, bytes_out;	/* Counter for statistics (uncompressed!) */
 } ZIPDATA;
 #endif /* ZLIB */
@@ -55,12 +55,10 @@ typedef struct _Connection
 {
 	int sock;			/* Socket handle */
 	struct sockaddr_in addr;	/* Client address */
-	RES_STAT *res_stat;		/* Status of resolver process, if any */
+	RES_STAT res_stat;		/* Status of resolver process */
 	char host[HOST_LEN];		/* Hostname */
-	char rbuf[READBUFFER_LEN];	/* Read buffer */
-	int rdatalen;			/* Length of data in read buffer */
-	char wbuf[WRITEBUFFER_LEN];	/* Write buffer */
-	int wdatalen;			/* Length of data in write buffer */
+	array rbuf;			/* Read buffer */
+	array wbuf;			/* Write buffer */
 	time_t lastdata;		/* Last activity */
 	time_t lastping;		/* Last PING */
 	time_t lastprivmsg;		/* Last PRIVMSG */
@@ -69,6 +67,7 @@ typedef struct _Connection
 	long msg_in, msg_out;		/* Received and sent IRC messages */
 	int flag;			/* Flag (see "irc-write" module) */
 	UINT16 options;			/* Link options / connection state */
+	CLIENT *client;			/* pointer to client structure */
 #ifdef ZLIB
 	ZIPDATA zip;			/* Compression information */
 #endif  /* ZLIB */
@@ -87,21 +86,16 @@ GLOBAL void Conn_Exit PARAMS(( void ));
 GLOBAL int Conn_InitListeners PARAMS(( void ));
 GLOBAL void Conn_ExitListeners PARAMS(( void ));
 
-GLOBAL bool Conn_NewListener PARAMS(( const UINT16 Port ));
-
 GLOBAL void Conn_Handler PARAMS(( void ));
 
-GLOBAL bool Conn_Write PARAMS(( CONN_ID Idx, char *Data, int Len ));
+GLOBAL bool Conn_Write PARAMS(( CONN_ID Idx, char *Data, size_t Len ));
 GLOBAL bool Conn_WriteStr PARAMS(( CONN_ID Idx, char *Format, ... ));
 
 GLOBAL void Conn_Close PARAMS(( CONN_ID Idx, char *LogMsg, char *FwdMsg, bool InformClient ));
 
 GLOBAL void Conn_SyncServerStruct PARAMS(( void ));
 
-GLOBAL int Conn_MaxFD;
-
-
+GLOBAL CLIENT* Conn_GetClient PARAMS((CONN_ID i));
 #endif
 
-
 /* -eof- */

+ 78 - 56
src/ngircd/defines.h

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2003 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -8,101 +8,123 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: defines.h,v 1.52.2.2 2005/07/05 22:58:25 alex Exp $
- *
- * Global defines of ngIRCd.
+ * $Id: defines.h,v 1.58 2006/06/15 20:28:15 alex Exp $
  */
 
+
 #ifndef __defines_h__
 #define __defines_h__
 
+/**
+ * @file
+ * Global constants ("#defines") used by the ngIRCd.
+ */
 
 #define NONE -1
 
-#define FNAME_LEN 256			/* max. length of file name */
+#define FNAME_LEN 256			/* Max. length of file name */
 
-#define LINE_LEN 256			/* max. length of a line in the configuration file */
+#define LINE_LEN 256			/* Max. length of a line in the
+					   configuration file */
 
-#define HOST_LEN 256			/* max. lenght of fully qualified host names */
+#define HOST_LEN 256			/* Max. lenght of fully qualified host
+					   names (e. g. "abc.domain.tld") */
 
-#define MAX_LISTEN_PORTS 16		/* max. count of listening ports */
+#define MAX_LISTEN_PORTS 16		/* Max. count of listening ports */
 
-#define MAX_OPERATORS 16		/* max. count of configurable operators */
+#define MAX_OPERATORS 16		/* Max. count of configurable IRC Ops */
 
-#define MAX_SERVERS 16			/* max. count of configurable servers ("peers") */
+#define MAX_SERVERS 16			/* Max. count of configurable servers */
 
-#define MAX_DEFCHANNELS 16		/* max. count of preconfigurable channels */
+#define MAX_DEFCHANNELS 16		/* Max. count of predefined channels */
 
-#define MAX_SERVICES 8			/* max. number of configurable services */
+#define MAX_SERVICES 8			/* Max. count of services */
 
-#define MAX_WHOWAS 64			/* max. number of WHOWAS items */
+#define MAX_WHOWAS 64			/* Max. number of WHOWAS items */
 #define DEFAULT_WHOWAS 5		/* default count for WHOWAS command */
 
-#define CONNECTION_POOL 100		/* size of default connection pool */
+#define CONNECTION_POOL 100		/* Size of default connection pool */
 
-#define CLIENT_ID_LEN 64		/* max. length of an IRC ID; see RFC 2812, 1.1 and 1.2.1 */
-#define CLIENT_NICK_LEN 10		/* max. nick length; see. RFC 2812, 1.2.1 */
-#define CLIENT_PASS_LEN 21		/* max. password length */
+#define CLIENT_ID_LEN 64		/* Max. length of an IRC ID; see RFC
+					   RFC 2812 section 1.1 and 1.2.1 */
+#define CLIENT_NICK_LEN 10		/* Max. nick length, see. RFC 2812
+					   section 1.2.1 */
+#define CLIENT_PASS_LEN 21		/* Max. password length */
 #define CLIENT_USER_LEN 10		/* Max. length of user name ("login")
- 					   see RFC 2812, section 1.2.1 */
-#define CLIENT_NAME_LEN 32		/* max. length of "real names" */
-#define CLIENT_HOST_LEN 64		/* max. host name length */
-#define CLIENT_MODE_LEN 8		/* max. lenth of all client modes */
-#define CLIENT_INFO_LEN 64		/* max. length of server info texts */
-#define CLIENT_AWAY_LEN 128		/* max. length of away messages */
-#define CLIENT_FLAGS_LEN 100		/* max. length of client flags */
-
-#define CHANNEL_NAME_LEN 51		/* max. length of a channel name, see. RFC 2812, 1.3 */
-#define CHANNEL_MODE_LEN 9		/* max. length of channel modes */
-#define CHANNEL_TOPIC_LEN 128		/* max. length of a channel topic */
-
-#define COMMAND_LEN 513			/* max. IRC command length, see. RFC 2812, 3.2 */
-
-#define READBUFFER_LEN 2048		/* size of the read buffer of a connection (bytes) */
-#define WRITEBUFFER_LEN 4096		/* size of the write buffer of a connection (bytes) */
+					   see RFC 2812, section 1.2.1 */
+#define CLIENT_NAME_LEN 32		/* Max. length of "real names" */
+#define CLIENT_HOST_LEN 64		/* Max. host name length */
+#define CLIENT_MODE_LEN 8		/* Max. lenth of all client modes */
+#define CLIENT_INFO_LEN 64		/* Max. length of server info texts */
+#define CLIENT_AWAY_LEN 128		/* Max. length of away messages */
+#define CLIENT_FLAGS_LEN 100		/* Max. length of client flags */
+
+#define CHANNEL_NAME_LEN 51		/* Max. length of a channel name, see
+					   RFC 2812 section 1.3 */
+#define CHANNEL_MODE_LEN 9		/* Max. length of channel modes */
+
+#define COMMAND_LEN 513			/* Max. IRC command length, see. RFC
+					   2812 section 3.2 */
+
+#define READBUFFER_LEN 2048		/* Size of the read buffer of a
+					   connection in bytes. */
+#define WRITEBUFFER_LEN 4096		/* Size of the write buffer of a
+					   connection in bytes. */
 
 #ifdef ZLIB
-#define ZREADBUFFER_LEN 1024		/* compressed read buffer of a connection (bytes) */
-#define ZWRITEBUFFER_LEN 4096		/* compressed write buffer of a connection (bytes) */
+#define ZREADBUFFER_LEN 1024		/* Size of the compressed read buffer
+					   of a connection in bytes. */
+#define ZWRITEBUFFER_LEN 4096		/* Size of the compressed write buffer
+					   of a connection in bytes. */
 #endif
 
-#define PROTOVER "0210"			/* implemented IRC protocol version (see RFC 2813, 4.1.1) */
-#define PROTOIRC "-IRC"			/* protocol suffix (see RFC 2813, 4.1.1) */
-#define PROTOIRCPLUS "-IRC+"		/* protokol suffix for IRC+ protocol (see doc/Protocol.txt) */
+#define PROTOVER "0210"			/* Implemented IRC protocol version,
+					   see RFC 2813 section 4.1.1. */
+#define PROTOIRC "-IRC"			/* Protocol suffix, see RFC 2813
+					   section 4.1.1 */
+#define PROTOIRCPLUS "-IRC+"		/* Protocol suffix used by the IRC+
+					   protocol, see doc/Protocol.txt */
 
 #ifdef IRCPLUS
-# define IRCPLUSFLAGS "CL"		/* standard IRC+ flags */
+# define IRCPLUSFLAGS "CL"		/* Standard IRC+ flags */
 #endif
 
-#define STARTUP_DELAY 1			/* delay outgoing connections n seconds after startup */
-#define RECONNECT_DELAY 3		/* time to delay re-connect attempts (seconds) */
+#define STARTUP_DELAY 1			/* Delay outgoing connections n seconds
+					   after startup. */
+#define RECONNECT_DELAY 3		/* Time to delay re-connect attempts
+					   in seconds. */
 
-#define USERMODES "aios"		/* supported user modes */
-#define CHANMODES "biklImnoPstv"	/* supported channel modes */
+#define USERMODES "aios"		/* Supported user modes. */
+#define CHANMODES "biIklmnoPstv"	/* Supported channel modes. */
 
-#define CONNECTED true			/* internal status codes */
+#define CONNECTED true			/* Internal status codes. */
 #define DISCONNECTED false
 
-#define DEFAULT_AWAY_MSG "Away"		/* away message for users connected to linked servers */
+#define DEFAULT_AWAY_MSG "Away"		/* Away message for users connected to
+					   linked servers. */
 
-#define CONFIG_FILE "/ngircd.conf"
-#define MOTD_FILE "/ngircd.motd"
-#define MOTD_PHRASE ""
-#define CHROOT_DIR ""
-#define PID_FILE ""
+#define DEFAULT_TOPIC_ID "-Server-"	/* Default ID for "topic owner". */
 
-#define ERROR_DIR "/tmp"
+#define CONFIG_FILE "/ngircd.conf"	/* Configuration file name. */
+#define MOTD_FILE "/ngircd.motd"	/* Name of the MOTD file. */
+#define MOTD_PHRASE ""			/* Default MOTD phrase string. */
+#define CHROOT_DIR ""			/* Default chroot() directory. */
+#define PID_FILE ""			/* Default file for the process ID. */
 
-#define MAX_LOG_MSG_LEN 256		/* max. length of a log message */
+#define ERROR_DIR "/tmp"		/* Error directory used in debug mode */
 
-#define TOKEN_OUTBOUND -2		/* tag for outbound server links */
+#define MAX_LOG_MSG_LEN 256		/* Max. length of a log message. */
 
-#define NOTICE_TXTPREFIX ""		/* prefix for NOTICEs from the server to users */
+#define TOKEN_OUTBOUND -2		/* Tag for outbound server links. */
+
+#define NOTICE_TXTPREFIX ""		/* Prefix for NOTICEs from the server
+					   to users. Some servers use '*'. */
 
 #define CUT_TXTSUFFIX "[CUT]"		/* Suffix for oversized messages that
 					   have been shortened and cut off. */
-#ifdef RENDEZVOUS
-#define RENDEZVOUS_TYPE "_ircu._tcp."	/* service type to register with Rendezvous */
+
+#ifdef ZEROCONF
+#define MDNS_TYPE "_ircu._tcp."		/* Service type to register with mDNS */
 #endif
 
 

+ 3 - 3
src/ngircd/hash.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: hash.c,v 1.11 2005/03/19 18:43:48 fw Exp $";
+static char UNUSED id[] = "$Id: hash.c,v 1.12 2005/07/31 20:13:08 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -27,7 +27,7 @@ static char UNUSED id[] = "$Id: hash.c,v 1.11 2005/03/19 18:43:48 fw Exp $";
 #include "hash.h"
 
 
-LOCAL UINT32 jenkins_hash PARAMS(( register UINT8 *k, register UINT32 length, register UINT32 initval ));
+static UINT32 jenkins_hash PARAMS(( register UINT8 *k, register UINT32 length, register UINT32 initval ));
 
 
 GLOBAL UINT32
@@ -72,7 +72,7 @@ Hash( char *String )
 } /* mix */
 
 
-LOCAL UINT32
+static UINT32
 jenkins_hash( register UINT8 *k, register UINT32 length, register UINT32 initval )
 {
 	/* k: the key

+ 605 - 0
src/ngircd/io.c

@@ -0,0 +1,605 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * Please read the file COPYING, README and AUTHORS for more information.
+ *
+ * I/O abstraction interface.
+ * Copyright (c) 2005 Florian Westphal (westphal@foo.fh-furtwangen.de)
+ *
+ */
+
+#include "portab.h"
+
+static char UNUSED id[] = "$Id: io.c,v 1.16 2006/07/23 23:11:44 alex Exp $";
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include "array.h"
+#include "io.h"
+#include "log.h"
+
+/* Enables extra debug messages in event add/delete/callback code. */
+/* #define DEBUG_IO */
+
+typedef struct {
+ void (*callback)(int, short);
+ short what;
+} io_event;
+
+#define INIT_IOEVENT    { NULL, -1, 0, NULL }
+#define IO_ERROR        4
+
+#ifdef HAVE_EPOLL_CREATE
+#define IO_USE_EPOLL    1
+#else
+# ifdef HAVE_KQUEUE
+#define IO_USE_KQUEUE   1
+# else
+#define IO_USE_SELECT   1
+#endif
+#endif
+
+static bool library_initialized;
+
+#ifdef IO_USE_EPOLL
+#include <sys/epoll.h>
+
+static int io_masterfd;
+static bool io_event_change_epoll(int fd, short what, const int action);
+static int io_dispatch_epoll(struct timeval *tv);
+#endif
+
+#ifdef IO_USE_KQUEUE
+#include <sys/types.h>
+#include <sys/event.h>
+static array io_evcache;
+static int io_masterfd;
+
+static int io_dispatch_kqueue(struct timeval *tv);
+static bool io_event_change_kqueue(int, short, const int action);
+#endif
+
+#ifdef IO_USE_SELECT
+#include "defines.h"	/* for conn.h */
+#include "conn.h"	/* for CONN_IDX (needed by resolve.h) */
+#include "resolve.h"	/* for RES_STAT (needed by conf.h) */
+#include "conf.h"	/* for Conf_MaxConnections */
+
+static fd_set readers;
+static fd_set writers;
+static int select_maxfd;		/* the select() interface sucks badly */
+static int io_dispatch_select(struct timeval *tv);
+#endif
+
+static array io_events;
+
+static void io_docallback PARAMS((int fd, short what));
+
+static io_event *
+io_event_get(int fd)
+{
+	io_event *i;
+
+	assert(fd >= 0);
+
+	i = (io_event *) array_get(&io_events, sizeof(io_event), (size_t) fd);
+
+	assert(i != NULL);
+
+	return i;
+}
+
+
+bool
+io_library_init(unsigned int eventsize)
+{
+#if defined(IO_USE_EPOLL) || defined(IO_USE_KQUEUE)
+	bool ret;
+#endif
+#ifdef IO_USE_EPOLL
+	int ecreate_hint = (int)eventsize;
+	if (ecreate_hint <= 0)
+		ecreate_hint = 128;
+#endif
+	if (library_initialized)
+		return true;
+
+#ifdef IO_USE_SELECT
+#ifdef FD_SETSIZE
+	if (eventsize >= FD_SETSIZE)
+		eventsize = FD_SETSIZE - 1;
+#endif
+#endif
+	if ((eventsize > 0) && !array_alloc(&io_events, sizeof(io_event), (size_t)eventsize))
+		eventsize = 0;
+
+#ifdef IO_USE_EPOLL
+	io_masterfd = epoll_create(ecreate_hint);
+	Log(LOG_INFO,
+	    "IO subsystem: epoll (hint size %d, initial maxfd %u, masterfd %d).",
+	    ecreate_hint, eventsize, io_masterfd);
+	ret = io_masterfd >= 0;
+	if (ret) library_initialized = true;
+
+	return ret;
+#endif
+#ifdef IO_USE_SELECT
+	Log(LOG_INFO, "IO subsystem: select (initial maxfd %u).",
+	    eventsize);
+	FD_ZERO(&readers);
+	FD_ZERO(&writers);
+#ifdef FD_SETSIZE
+	if (Conf_MaxConnections >= (int)FD_SETSIZE) {
+		Log(LOG_WARNING,
+		    "MaxConnections (%d) exceeds limit (%u), changed MaxConnections to %u.",
+		    Conf_MaxConnections, FD_SETSIZE, FD_SETSIZE - 1);
+
+		Conf_MaxConnections = FD_SETSIZE - 1;
+	}
+#else
+	Log(LOG_WARNING,
+	    "FD_SETSIZE undefined, don't know how many descriptors select() can handle on your platform ...");
+#endif /* FD_SETSIZE */
+	library_initialized = true;
+	return true;
+#endif /* SELECT */
+#ifdef IO_USE_KQUEUE
+	io_masterfd = kqueue();
+
+	Log(LOG_INFO,
+	    "IO subsystem: kqueue (initial maxfd %u, masterfd %d)",
+	    eventsize, io_masterfd);
+	ret = io_masterfd >= 0;
+	if (ret) library_initialized = true;
+
+	return ret;
+#endif
+}
+
+
+void
+io_library_shutdown(void)
+{
+#ifdef IO_USE_SELECT
+	FD_ZERO(&readers);
+	FD_ZERO(&writers);
+#else
+	close(io_masterfd);	/* kqueue, epoll */
+	io_masterfd = -1;
+#endif
+#ifdef IO_USE_KQUEUE
+	array_free(&io_evcache);
+#endif
+	library_initialized = false;
+}
+
+
+bool
+io_event_setcb(int fd, void (*cbfunc) (int, short))
+{
+	io_event *i = io_event_get(fd);
+	if (!i)
+		return false;
+
+	i->callback = cbfunc;
+	return true;
+}
+
+
+bool
+io_event_create(int fd, short what, void (*cbfunc) (int, short))
+{
+	bool ret;
+	io_event *i;
+
+	assert(fd >= 0);
+
+#ifdef IO_USE_SELECT
+#ifdef FD_SETSIZE
+	if (fd >= FD_SETSIZE) {
+		Log(LOG_ERR,
+		    "fd %d exceeds FD_SETSIZE (%u) (select can't handle more file descriptors)",
+		    fd, FD_SETSIZE);
+		return false;
+	}
+#endif				/* FD_SETSIZE */
+#endif				/* IO_USE_SELECT */
+
+	i = (io_event *) array_alloc(&io_events, sizeof(io_event), (size_t) fd);
+	if (!i) {
+		Log(LOG_WARNING,
+		    "array_alloc failed: could not allocate space for %d io_event structures",
+		    fd);
+		return false;
+	}
+
+	i->callback = cbfunc;
+	i->what = 0;
+#ifdef IO_USE_EPOLL
+	ret = io_event_change_epoll(fd, what, EPOLL_CTL_ADD);
+#endif
+#ifdef IO_USE_KQUEUE
+	ret = io_event_change_kqueue(fd, what, EV_ADD|EV_ENABLE);
+#endif
+#ifdef IO_USE_SELECT
+	ret = io_event_add(fd, what);
+#endif
+	if (ret) i->what = what;
+	return ret;
+}
+
+
+#ifdef IO_USE_EPOLL
+static bool
+io_event_change_epoll(int fd, short what, const int action)
+{
+	struct epoll_event ev = { 0, {0} };
+	ev.data.fd = fd;
+
+	if (what & IO_WANTREAD)
+		ev.events = EPOLLIN | EPOLLPRI;
+	if (what & IO_WANTWRITE)
+		ev.events |= EPOLLOUT;
+
+	return epoll_ctl(io_masterfd, action, fd, &ev) == 0;
+}
+#endif
+
+#ifdef IO_USE_KQUEUE
+static bool
+io_event_kqueue_commit_cache(void)
+{
+	struct kevent *events;
+	bool ret;
+	int len = (int) array_length(&io_evcache, sizeof (struct kevent));
+ 
+	if (!len) /* nothing to do */
+		return true;
+
+	assert(len>0);
+
+	if (len < 0) {
+		array_free(&io_evcache);
+		return false;
+	}
+
+	events = array_start(&io_evcache);
+
+	assert(events != NULL);
+
+	ret = kevent(io_masterfd, events, len, NULL, 0, NULL) == 0;
+	if (ret)
+		array_trunc(&io_evcache);
+	return ret;
+}
+
+
+static bool
+io_event_change_kqueue(int fd, short what, const int action)
+{
+	struct kevent kev;
+	bool ret = true;
+
+	if (what & IO_WANTREAD) {
+		EV_SET(&kev, fd, EVFILT_READ, action, 0, 0, 0);
+		ret = array_catb(&io_evcache, (char*) &kev, sizeof (kev));
+		if (!ret)
+			ret = kevent(io_masterfd, &kev,1, NULL, 0, NULL) == 0;
+	}	
+
+	if (ret && (what & IO_WANTWRITE)) {
+		EV_SET(&kev, fd, EVFILT_WRITE, action, 0, 0, 0);
+		ret = array_catb(&io_evcache, (char*) &kev, sizeof (kev));
+		if (!ret)
+			ret = kevent(io_masterfd, &kev, 1, NULL, 0, NULL) == 0;
+	}
+
+	if (array_length(&io_evcache, sizeof kev) >= 100)
+		io_event_kqueue_commit_cache();
+	return ret;
+}
+#endif
+
+
+bool
+io_event_add(int fd, short what)
+{
+	io_event *i = io_event_get(fd);
+
+	if (!i) return false;
+	if (i->what == what) return true;
+#ifdef DEBUG_IO
+	Log(LOG_DEBUG, "io_event_add(): fd %d (arg: %d), what %d.", i->fd, fd, what);
+#endif
+	i->what |= what;
+#ifdef IO_USE_EPOLL
+	return io_event_change_epoll(fd, i->what, EPOLL_CTL_MOD);
+#endif
+
+#ifdef IO_USE_KQUEUE
+	return io_event_change_kqueue(fd, what, EV_ADD | EV_ENABLE);
+#endif
+
+#ifdef IO_USE_SELECT
+	if (fd > select_maxfd)
+		select_maxfd = fd;
+
+	if (what & IO_WANTREAD)
+		FD_SET(fd, &readers);
+	if (what & IO_WANTWRITE)
+		FD_SET(fd, &writers);
+
+	return true;
+#endif
+}
+
+
+bool
+io_setnonblock(int fd)
+{
+	int flags = fcntl(fd, F_GETFL);
+	if (flags == -1)
+		return false;
+
+#ifndef O_NONBLOCK
+#define O_NONBLOCK O_NDELAY
+#endif
+	flags |= O_NONBLOCK;
+
+	return fcntl(fd, F_SETFL, flags) == 0;
+}
+
+
+bool
+io_close(int fd)
+{
+	io_event *i;
+#ifdef IO_USE_SELECT
+	FD_CLR(fd, &writers);
+	FD_CLR(fd, &readers);
+
+	if (fd == select_maxfd) {
+		while (select_maxfd>0) {
+			--select_maxfd; /* find largest fd */  
+			i = io_event_get(select_maxfd);
+			if (i && i->callback) break;
+		}	
+	}	
+#endif
+	i = io_event_get(fd);
+#ifdef IO_USE_KQUEUE
+	if (array_length(&io_evcache, sizeof (struct kevent)))	/* pending data in cache? */
+		io_event_kqueue_commit_cache();
+
+	/* both kqueue and epoll remove fd from all sets automatically on the last close
+	 * of the descriptor. since we don't know if this is the last close we'll have
+	 * to remove the set explicitly. */
+	if (i) {
+		io_event_change_kqueue(fd, i->what, EV_DELETE);
+		io_event_kqueue_commit_cache();
+	}	
+#endif
+#ifdef IO_USE_EPOLL
+	io_event_change_epoll(fd, 0, EPOLL_CTL_DEL);
+#endif
+	if (i) {
+		i->callback = NULL;
+		i->what = 0;
+	}
+	return close(fd) == 0;
+}
+
+
+bool
+io_event_del(int fd, short what)
+{
+	io_event *i = io_event_get(fd);
+#ifdef DEBUG_IO
+	Log(LOG_DEBUG, "io_event_del(): trying to delete eventtype %d on fd %d", what, fd);
+#endif
+	if (!i) return false;
+
+	i->what &= ~what;
+
+#ifdef IO_USE_EPOLL
+	return io_event_change_epoll(fd, i->what, EPOLL_CTL_MOD);
+#endif
+
+#ifdef IO_USE_KQUEUE
+	return io_event_change_kqueue(fd, what, EV_DISABLE);
+#endif
+#ifdef IO_USE_SELECT
+	if (what & IO_WANTWRITE)
+		FD_CLR(fd, &writers);
+
+	if (what & IO_WANTREAD)
+		FD_CLR(fd, &readers);
+
+	return true;
+#endif
+}
+
+
+#ifdef IO_USE_SELECT
+static int
+io_dispatch_select(struct timeval *tv)
+{
+	fd_set readers_tmp = readers;
+	fd_set writers_tmp = writers;
+	short what;
+	int ret, i;
+	int fds_ready;
+	ret = select(select_maxfd + 1, &readers_tmp, &writers_tmp, NULL, tv);
+	if (ret <= 0)
+		return ret;
+
+	fds_ready = ret;
+
+	for (i = 0; i <= select_maxfd; i++) {
+		what = 0;
+		if (FD_ISSET(i, &readers_tmp)) {
+			what = IO_WANTREAD;
+			fds_ready--;
+		}
+
+		if (FD_ISSET(i, &writers_tmp)) {
+			what |= IO_WANTWRITE;
+			fds_ready--;
+		}
+		if (what)
+			io_docallback(i, what);
+		if (fds_ready <= 0)
+			break;
+	}
+
+	return ret;
+}
+#endif
+
+
+#ifdef IO_USE_EPOLL
+static int
+io_dispatch_epoll(struct timeval *tv)
+{
+	time_t sec = tv->tv_sec * 1000;
+	int i, total = 0, ret, timeout = tv->tv_usec + sec;
+	struct epoll_event epoll_ev[100];
+	short type;
+
+	if (timeout < 0)
+		timeout = 1000;
+
+	do {
+		ret = epoll_wait(io_masterfd, epoll_ev, 100, timeout);
+		total += ret;
+		if (ret <= 0)
+			return total;
+
+		for (i = 0; i < ret; i++) {
+			type = 0;
+			if (epoll_ev[i].events & (EPOLLERR | EPOLLHUP))
+				type = IO_ERROR;
+
+			if (epoll_ev[i].events & (EPOLLIN | EPOLLPRI))
+				type |= IO_WANTREAD;
+
+			if (epoll_ev[i].events & EPOLLOUT)
+				type |= IO_WANTWRITE;
+
+			io_docallback(epoll_ev[i].data.fd, type);
+		}
+
+		timeout = 0;
+	} while (ret == 100);
+
+	return total;
+}
+#endif
+
+
+#ifdef IO_USE_KQUEUE
+static int
+io_dispatch_kqueue(struct timeval *tv)
+{
+	int i, total = 0, ret;
+	struct kevent kev[100];
+	struct kevent *newevents;
+	struct timespec ts;
+	int newevents_len;
+	ts.tv_sec = tv->tv_sec;
+	ts.tv_nsec = tv->tv_usec * 1000;
+	
+	do {
+		newevents_len = (int) array_length(&io_evcache, sizeof (struct kevent));
+		newevents = (newevents_len > 0) ? array_start(&io_evcache) : NULL;
+		assert(newevents_len >= 0);
+		if (newevents_len < 0)
+			newevents_len = 0;
+#ifdef DEBUG
+		if (newevents_len)
+			assert(newevents != NULL);
+#endif
+		ret = kevent(io_masterfd, newevents, newevents_len, kev,
+			     100, &ts);
+		if ((newevents_len>0) && ret != -1)
+			array_trunc(&io_evcache);
+
+		total += ret;
+		if (ret <= 0)
+			return total;
+
+		for (i = 0; i < ret; i++) {
+			if (kev[i].flags & EV_EOF) {
+#ifdef DEBUG
+				LogDebug("kev.flag has EV_EOF set, setting IO_ERROR",
+					kev[i].filter, kev[i].ident);
+#endif				
+				io_docallback((int)kev[i].ident, IO_ERROR);
+				continue;
+			}	
+
+			switch (kev[i].filter) {
+				case EVFILT_READ:
+					io_docallback((int)kev[i].ident, IO_WANTREAD);
+					break;
+				case EVFILT_WRITE:
+					io_docallback((int)kev[i].ident, IO_WANTWRITE);
+					break;
+				default:
+#ifdef DEBUG
+					LogDebug("Unknown kev.filter number %d for fd %d",
+						kev[i].filter, kev[i].ident); /* Fall through */
+#endif
+				case EV_ERROR:
+					io_docallback((int)kev[i].ident, IO_ERROR);
+					break;
+			}
+		}
+		ts.tv_sec = 0;
+		ts.tv_nsec = 0;
+	} while (ret == 100);
+
+	return total;
+}
+#endif
+
+
+int
+io_dispatch(struct timeval *tv)
+{
+#ifdef IO_USE_SELECT
+	return io_dispatch_select(tv);
+#endif
+#ifdef IO_USE_KQUEUE
+	return io_dispatch_kqueue(tv);
+#endif
+#ifdef IO_USE_EPOLL
+	return io_dispatch_epoll(tv);
+#endif
+}
+
+
+/* call the callback function inside the struct matching fd */
+static void
+io_docallback(int fd, short what)
+{
+	io_event *i;
+#ifdef DEBUG_IO
+	Log(LOG_DEBUG, "doing callback for fd %d, what %d", fd, what);
+#endif
+	i = io_event_get(fd);
+
+	if (i->callback) {	/* callback might be NULL if a previous callback function 
+				   called io_close on this fd */
+		i->callback(fd, (what & IO_ERROR) ? i->what : what);
+	}	
+	/* if error indicator is set, we return the event(s) that were registered */
+}

+ 51 - 0
src/ngircd/io.h

@@ -0,0 +1,51 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * Please read the file COPYING, README and AUTHORS for more information.
+ *
+ * I/O abstraction interface header
+ *
+ * $Id: io.h,v 1.3 2005/07/14 09:15:58 alex Exp $
+ */
+
+#ifndef io_H_inclucded
+#define io_H_included
+
+#include "portab.h"
+#include <sys/time.h>
+
+#define IO_WANTREAD	1
+#define IO_WANTWRITE	2
+
+/* init library.
+   sets up epoll/kqueue descriptors and tries to allocate space for ioevlen
+   file descriptors. ioevlen is just the _initial_ size, not a limit. */
+bool io_library_init PARAMS((unsigned int ioevlen));
+
+/* shutdown and free all internal data structures */
+void io_library_shutdown PARAMS((void));
+
+/* add fd to internal set, enable readability check, set callback */
+bool io_event_create PARAMS((int fd, short what, void (*cbfunc)(int, short)));
+
+/* change callback function associated with fd */
+bool io_event_setcb PARAMS((int fd, void (*cbfunc)(int, short)));
+
+/* watch fd for event of type what */
+bool io_event_add PARAMS((int fd, short what));
+
+/* do not watch fd for event of type what */
+bool io_event_del PARAMS((int fd, short what));
+
+/* remove fd from watchlist, close() fd.  */
+bool io_close PARAMS((int fd));
+
+/* set O_NONBLOCK */
+bool io_setnonblock PARAMS((int fd));
+
+/* watch fds for activity */
+int io_dispatch PARAMS((struct timeval *tv));
+
+#endif /* io_H_included */

+ 68 - 30
src/ngircd/irc-channel.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-channel.c,v 1.30 2005/06/12 18:23:59 alex Exp $";
+static char UNUSED id[] = "$Id: irc-channel.c,v 1.35 2006/03/16 20:14:16 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -43,11 +43,11 @@ static char UNUSED id[] = "$Id: irc-channel.c,v 1.30 2005/06/12 18:23:59 alex Ex
 GLOBAL bool
 IRC_JOIN( CLIENT *Client, REQUEST *Req )
 {
-	char *channame, *key, *flags, *topic, modes[8];
+	char *channame, *channame_ptr, *key, *key_ptr, *flags, *topic, modes[8];
 	bool is_new_chan, is_invited, is_banned;
 	CLIENT *target;
 	CHANNEL *chan;
-
+	
 	assert( Client != NULL );
 	assert( Req != NULL );
 
@@ -60,13 +60,20 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 	if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
 
 	/* Are channel keys given? */
-	if( Req->argc > 1 ) key = Req->argv[1];
-	else key = NULL;
+	if (Req->argc > 1) {
+		key = Req->argv[1];
+		key_ptr = strchr(key, ',');
+		if (key_ptr) *key_ptr = '\0';
+	}
+	else
+		key = key_ptr = NULL;
+
+	channame = Req->argv[0];
+	channame_ptr = strchr(channame, ',');
+	if (channame_ptr) *channame_ptr = '\0';
 
 	/* Channel-Namen durchgehen */
-	chan = NULL;
-	channame = strtok( Req->argv[0], "," );
-	while( channame )
+	while (channame)
 	{
 		chan = NULL; flags = NULL;
 
@@ -90,14 +97,9 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 		if( Client_Type( Client ) == CLIENT_USER )
 		{
 			/* Test if the user has reached his maximum channel count */
-			if( Client_Type( Client ) == CLIENT_USER )
-			{
-				if(( Conf_MaxJoins > 0 ) && ( Channel_CountForUser( Client ) >= Conf_MaxJoins ))
-				{
-					IRC_WriteStrClient( Client, ERR_TOOMANYCHANNELS_MSG, Client_ID( Client ), channame );
-					return CONNECTED;
-				}
-			}
+			if(( Conf_MaxJoins > 0 ) && ( Channel_CountForUser( Client ) >= Conf_MaxJoins ))
+				return IRC_WriteStrClient( Client, ERR_TOOMANYCHANNELS_MSG,
+							Client_ID( Client ), channame );
 
 			/* Existiert der Channel bereits, oder wird er im Moment neu erzeugt? */
 			if( is_new_chan )
@@ -211,17 +213,37 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 			/* an Client bestaetigen */
 			IRC_WriteStrClientPrefix( Client, target, "JOIN :%s", channame );
 
-			/* Topic an Client schicken */
-			topic = Channel_Topic( chan );
-			if( *topic ) IRC_WriteStrClient( Client, RPL_TOPIC_MSG, Client_ID( Client ), channame, topic );
+			/* Send topic to client, if any */
+			topic = Channel_Topic(chan);
+			if (*topic) {
+				IRC_WriteStrClient(Client, RPL_TOPIC_MSG,
+					Client_ID(Client), channame, topic);
+#ifndef STRICT_RFC
+				IRC_WriteStrClient(Client, RPL_TOPICSETBY_MSG,
+					Client_ID(Client), channame,
+					Channel_TopicWho(chan),
+					Channel_TopicTime(chan));
+#endif
+			}
 
 			/* Mitglieder an Client Melden */
 			IRC_Send_NAMES( Client, chan );
 			IRC_WriteStrClient( Client, RPL_ENDOFNAMES_MSG, Client_ID( Client ), Channel_Name( chan ));
 		}
 
-		/* naechsten Namen ermitteln */
-		channame = strtok( NULL, "," );
+		/* next channel? */
+		channame = channame_ptr;
+		if (channame) {
+			channame++;
+			channame_ptr = strchr(channame, ',');
+			if (channame_ptr) *channame_ptr = '\0';
+
+			if (key_ptr) {
+				key = ++key_ptr;
+				key_ptr = strchr(key, ',');
+				if (key_ptr) *key_ptr = '\0';
+			}
+		}
 	}
 	return CONNECTED;
 } /* IRC_JOIN */
@@ -268,6 +290,7 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req )
 	CHANNEL *chan;
 	CLIENT *from;
 	char *topic;
+	bool r;
 
 	assert( Client != NULL );
 	assert( Req != NULL );
@@ -288,10 +311,22 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req )
 
 	if( Req->argc == 1 )
 	{
-		/* Topic erfragen */
-		topic = Channel_Topic( chan );
-		if( *topic ) return IRC_WriteStrClient( from, RPL_TOPIC_MSG, Client_ID( from ), Channel_Name( chan ), topic );
-		else return IRC_WriteStrClient( from, RPL_NOTOPIC_MSG, Client_ID( from ), Channel_Name( chan ));
+		/* Request actual topic */
+		topic = Channel_Topic(chan);
+		if (*topic) {
+			r = IRC_WriteStrClient(from, RPL_TOPIC_MSG,
+				Client_ID(Client), Channel_Name(chan), topic);
+#ifndef STRICT_RFC
+			r = IRC_WriteStrClient(from, RPL_TOPICSETBY_MSG,
+				Client_ID(Client), Channel_Name(chan),
+				Channel_TopicWho(chan),
+				Channel_TopicTime(chan));
+#endif
+			return r;
+		}
+		else
+			 return IRC_WriteStrClient(from, RPL_NOTOPIC_MSG,
+					Client_ID(from), Channel_Name(chan));
 	}
 
 	if( strchr( Channel_Modes( chan ), 't' ))
@@ -300,9 +335,11 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req )
 		if( ! strchr( Channel_UserModes( chan, from ), 'o' )) return IRC_WriteStrClient( from, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( from ), Channel_Name( chan ));
 	}
 
-	/* Topic setzen */
-	Channel_SetTopic( chan, Req->argv[1] );
-	Log( LOG_DEBUG, "User \"%s\" set topic on \"%s\": %s", Client_Mask( from ), Channel_Name( chan ), Req->argv[1][0] ? Req->argv[1] : "<none>" );
+	/* Set new topic */
+	Channel_SetTopic(chan, from, Req->argv[1]);
+	Log(LOG_DEBUG, "User \"%s\" set topic on \"%s\": %s",
+		Client_Mask(from), Channel_Name(chan),
+		Req->argv[1][0] ? Req->argv[1] : "<none>");
 
 	/* im Channel bekannt machen und an Server weiterleiten */
 	IRC_WriteStrServersPrefix( Client, from, "TOPIC %s :%s", Req->argv[0], Req->argv[1] );
@@ -478,8 +515,9 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
 		if(( ! *ptr ) && ( Req->argv[arg_topic][0] ))
 		{
 			/* OK, there is no topic jet */
-			Channel_SetTopic( chan, Req->argv[arg_topic] );
-			IRC_WriteStrChannelPrefix( Client, chan, from, false, "TOPIC %s :%s", Req->argv[0], Channel_Topic( chan ));
+			Channel_SetTopic(chan, Client, Req->argv[arg_topic]);
+			IRC_WriteStrChannelPrefix(Client, chan, from, false,
+			     "TOPIC %s :%s", Req->argv[0], Channel_Topic(chan));
 		}
 	}
 

+ 35 - 21
src/ngircd/irc-info.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-info.c,v 1.30 2005/06/17 19:15:43 fw Exp $";
+static char UNUSED id[] = "$Id: irc-info.c,v 1.33.2.1 2006/09/16 13:49:15 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -377,7 +377,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
 			con = Conn_First( );
 			while( con != NONE )
 			{
-				cl = Client_GetFromConn( con );
+				cl = Conn_GetClient( con );
 				if( cl && (( Client_Type( cl ) == CLIENT_SERVER ) || ( cl == Client )))
 				{
 					/* Server link or our own connection */
@@ -870,47 +870,61 @@ IRC_Send_LUSERS( CLIENT *Client )
 } /* IRC_Send_LUSERS */
 
 
+static bool Show_MOTD_Start(CLIENT *Client)
+{
+	return IRC_WriteStrClient(Client, RPL_MOTDSTART_MSG,
+		Client_ID( Client ), Client_ID( Client_ThisServer( )));
+}
+
+static bool Show_MOTD_Sendline(CLIENT *Client, const char *msg)
+{
+	return IRC_WriteStrClient(Client, RPL_MOTD_MSG, Client_ID( Client ), msg);
+}
+
+static bool Show_MOTD_End(CLIENT *Client)
+{
+	return IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ));
+}
+
+
 GLOBAL bool
 IRC_Show_MOTD( CLIENT *Client )
 {
-	bool ok;
 	char line[127];
 	FILE *fd;
 
 	assert( Client != NULL );
 
-	if( Conf_MotdPhrase[0] )
-	{
-		if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED;
-		if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), Conf_MotdPhrase )) return DISCONNECTED;
-		return IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ));
+	if (Conf_MotdPhrase[0]) {
+		if (!Show_MOTD_Start(Client))
+			return DISCONNECTED;
+		if (!Show_MOTD_Sendline(Client, Conf_MotdPhrase))
+			return DISCONNECTED;
+
+		return Show_MOTD_End(Client);
 	}
 
 	fd = fopen( Conf_MotdFile, "r" );
-	if( ! fd )
-	{
+	if( ! fd ) {
 		Log( LOG_WARNING, "Can't read MOTD file \"%s\": %s", Conf_MotdFile, strerror( errno ));
 		return IRC_WriteStrClient( Client, ERR_NOMOTD_MSG, Client_ID( Client ) );
 	}
 
-	if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED;
-	while( true )
-	{
-		if( ! fgets( line, sizeof( line ), fd )) break;
+	if (!Show_MOTD_Start( Client )) {
+		fclose(fd);
+		return false;
+	}
 
+	while (fgets( line, (int)sizeof line, fd )) {
 		ngt_TrimLastChr( line, '\n');
 
-		if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line ))
-		{
+		if( ! Show_MOTD_Sendline( Client, line)) {
 			fclose( fd );
 			return false;
 		}
 	}
-	ok = IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ) );
-
-	fclose( fd );
-
-	return ok;
+	fclose(fd);
+	return Show_MOTD_End(Client);
 } /* IRC_Show_MOTD */
 
 

+ 107 - 49
src/ngircd/irc-login.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-login.c,v 1.44 2005/06/04 12:32:09 fw Exp $";
+static char UNUSED id[] = "$Id: irc-login.c,v 1.49 2005/09/01 10:51:24 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -41,8 +41,8 @@ static char UNUSED id[] = "$Id: irc-login.c,v 1.44 2005/06/04 12:32:09 fw Exp $"
 #include "irc-login.h"
 
 
-LOCAL bool Hello_User PARAMS(( CLIENT *Client ));
-LOCAL void Kill_Nick PARAMS(( char *Nick, char *Reason ));
+static bool Hello_User PARAMS(( CLIENT *Client ));
+static void Kill_Nick PARAMS(( char *Nick, char *Reason ));
 
 
 GLOBAL bool
@@ -427,77 +427,134 @@ IRC_QUIT( CLIENT *Client, REQUEST *Req )
 
 
 GLOBAL bool
-IRC_PING( CLIENT *Client, REQUEST *Req )
+IRC_PING(CLIENT *Client, REQUEST *Req)
 {
 	CLIENT *target, *from;
 
-	assert( Client != NULL );
-	assert( Req != NULL );
+	assert(Client != NULL);
+	assert(Req != NULL);
 
-	/* Falsche Anzahl Parameter? */
-	if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
+	/* Wrong number of arguments? */
+	if (Req->argc < 1)
+		return IRC_WriteStrClient(Client, ERR_NOORIGIN_MSG,
+					  Client_ID(Client));
 #ifdef STRICT_RFC
-	if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+	/* Don't ignore additional arguments when in "strict" mode */
+	if (Req->argc > 2)
+		 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+					   Client_ID(Client), Req->command);
 #endif
 
-	if( Req->argc > 1 )
-	{
-		/* es wurde ein Ziel-Client angegeben */
-		target = Client_Search( Req->argv[1] );
-		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
-		if( target != Client_ThisServer( ))
-		{
-			/* ok, forwarden */
-			if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
-			else from = Client;
-			if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
-			return IRC_WriteStrClientPrefix( target, from, "PING %s :%s", Client_ID( from ), Req->argv[1] );
+	if (Req->argc > 1) {
+		/* A target has been specified ... */
+		target = Client_Search(Req->argv[1]);
+
+		if (!target || Client_Type(target) != CLIENT_SERVER)
+			return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+					Client_ID(Client), Req->argv[1]);
+
+		if (target != Client_ThisServer()) {
+			/* Ok, we have to forward the PING */
+			if (Client_Type(Client) == CLIENT_SERVER)
+				from = Client_Search(Req->prefix);
+			else
+				from = Client;
+			if (!from)
+				return IRC_WriteStrClient(Client,
+						ERR_NOSUCHSERVER_MSG,
+						Client_ID(Client), Req->prefix);
+
+			return IRC_WriteStrClientPrefix(target, from,
+					"PING %s :%s", Req->argv[0],
+					Req->argv[1] );
 		}
 	}
 
-	Log( LOG_DEBUG, "Connection %d: got PING, sending PONG ...", Client_Conn( Client ));
-	return IRC_WriteStrClient( Client, "PONG %s :%s", Client_ID( Client_ThisServer( )), Client_ID( Client ));
+	if (Client_Type(Client) == CLIENT_SERVER) {
+		if (Req->prefix)
+			from = Client_Search(Req->prefix);
+		else
+			from = Client;
+	} else
+		from = Client_ThisServer();
+	if (!from)
+		return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+					Client_ID(Client), Req->prefix);
+
+	Log(LOG_DEBUG, "Connection %d: got PING, sending PONG ...",
+	    Client_Conn(Client));
+
+#ifdef STRICT_RFC
+	return IRC_WriteStrClient(Client, "PONG %s :%s",
+		Client_ID(from), Client_ID(Client));
+#else
+	/* Some clients depend on the argument being returned in the PONG
+         * reply (not mentioned in any RFC, though) */
+	return IRC_WriteStrClient(Client, "PONG %s :%s",
+		Client_ID(from), Req->argv[0]);
+#endif
 } /* IRC_PING */
 
 
 GLOBAL bool
-IRC_PONG( CLIENT *Client, REQUEST *Req )
+IRC_PONG(CLIENT *Client, REQUEST *Req)
 {
 	CLIENT *target, *from;
+	char *s;
 
-	assert( Client != NULL );
-	assert( Req != NULL );
-
-	/* Falsche Anzahl Parameter? */
-	if( Req->argc < 1 ) return IRC_WriteStrClient( Client, ERR_NOORIGIN_MSG, Client_ID( Client ));
-	if( Req->argc > 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+	assert(Client != NULL);
+	assert(Req != NULL);
 
-	/* forwarden? */
-	if( Req->argc == 2 )
-	{
-		target = Client_Search( Req->argv[1] );
-		if(( ! target ) || ( Client_Type( target ) != CLIENT_SERVER )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[1] );
-		if( target != Client_ThisServer( ))
-		{
-			/* ok, forwarden */
-			if( Client_Type( Client ) == CLIENT_SERVER ) from = Client_Search( Req->prefix );
-			else from = Client;
-			if( ! from ) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->prefix );
-			return IRC_WriteStrClientPrefix( target, from, "PONG %s :%s", Client_ID( from ), Req->argv[1] );
+	/* Wrong number of arguments? */
+	if (Req->argc < 1)
+		return IRC_WriteStrClient(Client, ERR_NOORIGIN_MSG,
+					  Client_ID(Client));
+	if (Req->argc > 2)
+		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+					  Client_ID(Client), Req->command);
+
+	/* Forward? */
+	if (Req->argc == 2 && Client_Type(Client) == CLIENT_SERVER) {
+		target = Client_Search(Req->argv[0]);
+		if (!target)
+			return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+					Client_ID(Client), Req->argv[0]);
+
+		from = Client_Search(Req->prefix);
+
+		if (target != Client_ThisServer() && target != from) {
+			/* Ok, we have to forward the message. */
+			if (!from)
+				return IRC_WriteStrClient(Client,
+						ERR_NOSUCHSERVER_MSG,
+						Client_ID(Client), Req->prefix);
+
+			if (Client_Type(Client_NextHop(target)) != CLIENT_SERVER)
+				s = Client_ID(from);
+			else
+				s = Req->argv[0];
+			return IRC_WriteStrClientPrefix(target, from,
+				 "PONG %s :%s", s, Req->argv[1]);
 		}
 	}
 
-	/* Der Connection-Timestamp wurde schon beim Lesen aus dem Socket
-	 * aktualisiert, daher muss das hier nicht mehr gemacht werden. */
+	/* The connection timestamp has already been updated when the data has
+	 * been read from so socket, so we don't need to update it here. */
 
-	if( Client_Conn( Client ) > NONE ) Log( LOG_DEBUG, "Connection %d: received PONG. Lag: %ld seconds.", Client_Conn( Client ), time( NULL ) - Conn_LastPing( Client_Conn( Client )));
-	else Log( LOG_DEBUG, "Connection %d: received PONG.", Client_Conn( Client ));
+	if (Client_Conn(Client) > NONE)
+		Log(LOG_DEBUG,
+			"Connection %d: received PONG. Lag: %ld seconds.",
+			Client_Conn(Client),
+			time(NULL) - Conn_LastPing(Client_Conn(Client)));
+	else
+		 Log(LOG_DEBUG,
+			"Connection %d: received PONG.", Client_Conn(Client));
 
 	return CONNECTED;
 } /* IRC_PONG */
 
 
-LOCAL bool
+static bool
 Hello_User( CLIENT *Client )
 {
 #ifdef CVSDATE
@@ -542,7 +599,8 @@ Hello_User( CLIENT *Client )
 #endif
 
 	/* Features */
-	if( ! IRC_WriteStrClient( Client, RPL_ISUPPORT_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1, CHANNEL_TOPIC_LEN - 1, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
+	if( ! IRC_WriteStrClient( Client, RPL_ISUPPORT_MSG, Client_ID( Client ), CLIENT_NICK_LEN - 1,
+			COMMAND_LEN - 23, CLIENT_AWAY_LEN - 1, Conf_MaxJoins )) return DISCONNECTED;
 
 	Client_SetType( Client, CLIENT_USER );
 
@@ -556,7 +614,7 @@ Hello_User( CLIENT *Client )
 } /* Hello_User */
 
 
-LOCAL void
+static void
 Kill_Nick( char *Nick, char *Reason )
 {
 	REQUEST r;

+ 26 - 21
src/ngircd/irc-mode.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-mode.c,v 1.43 2005/06/17 19:14:58 fw Exp $";
+static char UNUSED id[] = "$Id: irc-mode.c,v 1.45 2006/05/10 21:24:01 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -38,16 +38,16 @@ static char UNUSED id[] = "$Id: irc-mode.c,v 1.43 2005/06/17 19:14:58 fw Exp $";
 #include "irc-mode.h"
 
 
-LOCAL bool Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ));
-LOCAL bool Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel ));
+static bool Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ));
+static bool Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel ));
 
-LOCAL bool Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
-LOCAL bool Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
+static bool Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
+static bool Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
 
-LOCAL bool Del_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
-LOCAL bool Del_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
+static bool Del_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
+static bool Del_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ));
 
-LOCAL bool Send_ListChange PARAMS(( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Mask ));
+static bool Send_ListChange PARAMS(( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Mask ));
 
 
 GLOBAL bool
@@ -71,19 +71,24 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
 	else origin = Client;
 	
 	/* Channel or user mode? */
-	cl = chan = NULL;
-	if( Client_IsValidNick( Req->argv[0] )) cl = Client_Search( Req->argv[0] );
-	if( Channel_IsValidName( Req->argv[0] )) chan = Channel_Search( Req->argv[0] );
+	cl = NULL; chan = NULL;
+	if (Client_IsValidNick(Req->argv[0]))
+		cl = Client_Search(Req->argv[0]);
+	if (Channel_IsValidName(Req->argv[0]))
+		chan = Channel_Search(Req->argv[0]);
 
-	if( cl ) return Client_Mode( Client, Req, origin, cl );
-	if( chan ) return Channel_Mode( Client, Req, origin, chan );
+	if (cl)
+		return Client_Mode(Client, Req, origin, cl);
+	if (chan)
+		return Channel_Mode(Client, Req, origin, chan);
 
 	/* No target found! */
-	return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
+	return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
+			Client_ID(Client), Req->argv[0]);
 } /* IRC_MODE */
 
 
-LOCAL bool
+static bool
 Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
 {
 	/* Handle client mode requests */
@@ -236,7 +241,7 @@ client_exit:
 } /* Client_Mode */
 
 
-LOCAL bool
+static bool
 Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
 {
 	/* Handle channel and channel-user modes */
@@ -627,7 +632,7 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req )
 } /* IRC_AWAY */
 
 
-LOCAL bool
+static bool
 Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
 {
 	char *mask;
@@ -649,7 +654,7 @@ Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
 } /* Add_Invite */
 
 
-LOCAL bool
+static bool
 Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
 {
 	char *mask;
@@ -671,7 +676,7 @@ Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
 } /* Add_Ban */
 
 
-LOCAL bool
+static bool
 Del_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
 {
 	char *mask;
@@ -686,7 +691,7 @@ Del_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
 } /* Del_Invite */
 
 
-LOCAL bool
+static bool
 Del_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
 {
 	char *mask;
@@ -701,7 +706,7 @@ Del_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )
 } /* Del_Ban */
 
 
-LOCAL bool
+static bool
 Send_ListChange( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Mask )
 {
 	/* Bestaetigung an Client schicken & andere Server sowie Channel-User informieren */

+ 69 - 27
src/ngircd/irc-oper.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-oper.c,v 1.22 2005/06/12 18:02:09 fw Exp $";
+static char UNUSED id[] = "$Id: irc-oper.c,v 1.27 2006/07/23 15:43:18 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -23,7 +23,7 @@ static char UNUSED id[] = "$Id: irc-oper.c,v 1.22 2005/06/12 18:02:09 fw Exp $";
 
 #include "ngircd.h"
 #include "resolve.h"
-#include "conn.h"
+#include "conn-func.h"
 #include "conf.h"
 #include "client.h"
 #include "channel.h"
@@ -37,7 +37,7 @@ static char UNUSED id[] = "$Id: irc-oper.c,v 1.22 2005/06/12 18:02:09 fw Exp $";
 #include "irc-oper.h"
 
 
-LOCAL bool
+static bool
 Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg)
 {
 	Log( LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s", Client_Mask( Client ),
@@ -50,7 +50,7 @@ Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg)
 GLOBAL bool
 IRC_OPER( CLIENT *Client, REQUEST *Req )
 {
-	int i;
+	unsigned int i;
 
 	assert( Client != NULL );
 	assert( Req != NULL );
@@ -90,21 +90,46 @@ IRC_OPER( CLIENT *Client, REQUEST *Req )
 
 
 GLOBAL bool
-IRC_DIE( CLIENT *Client, REQUEST *Req )
+IRC_DIE(CLIENT * Client, REQUEST * Req)
 {
 	/* Shut down server */
 
-	assert( Client != NULL );
-	assert( Req != NULL );
+	CONN_ID c;
+	CLIENT *cl;
+
+	assert(Client != NULL);
+	assert(Req != NULL);
 
 	/* Not a local IRC operator? */
-	if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
-	
+	if ((!Client_HasMode(Client, 'o')) || (!Client_OperByMe(Client)))
+		return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG,
+					  Client_ID(Client));
+
 	/* Bad number of parameters? */
-	if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+#ifdef STRICT_RFC
+	if (Req->argc != 0)
+#else
+	if (Req->argc > 1)
+#endif
+		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+					  Client_ID(Client), Req->command);
+
+	/* Is a message given? */
+	if (Req->argc > 0) {
+		c = Conn_First();
+		while (c != NONE) {
+			cl = Conn_GetClient(c);
+			if (Client_Type(cl) == CLIENT_USER)
+				IRC_WriteStrClient(cl, "NOTICE %s :%s",
+						Client_ID(cl), Req->argv[0]);
+			c = Conn_Next(c);
+		}
+	}
 
-	Log( LOG_NOTICE|LOG_snotice, "Got DIE command from \"%s\" ...", Client_Mask( Client ));
+	Log(LOG_NOTICE | LOG_snotice, "Got DIE command from \"%s\" ...",
+	    Client_Mask(Client));
 	NGIRCd_SignalQuit = true;
+
 	return CONNECTED;
 } /* IRC_DIE */
 
@@ -150,35 +175,52 @@ IRC_RESTART( CLIENT *Client, REQUEST *Req )
 } /* IRC_RESTART */
 
 
+/**
+ * Connect configured or new server.
+ */
 GLOBAL bool
-IRC_CONNECT(CLIENT *Client, REQUEST *Req )
+IRC_CONNECT(CLIENT * Client, REQUEST * Req)
 {
-	/* Connect configured or new server */
 
-	assert( Client != NULL );
-	assert( Req != NULL );
+	assert(Client != NULL);
+	assert(Req != NULL);
 
 	/* Not a local IRC operator? */
-	if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
+	if ((!Client_HasMode(Client, 'o')) || (!Client_OperByMe(Client)))
+		return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG,
+					  Client_ID(Client));
 
 	/* Bad number of parameters? */
-	if(( Req->argc != 2 ) && ( Req->argc != 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+	if ((Req->argc != 2) && (Req->argc != 5))
+		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+					  Client_ID(Client), Req->command);
 
 	/* Invalid port number? */
-	if( atoi( Req->argv[1] ) < 1 )  return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
+	if (atoi(Req->argv[1]) < 1)
+		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+					  Client_ID(Client), Req->command);
 
-	Log( LOG_NOTICE|LOG_snotice, "Got CONNECT command from \"%s\" for \"%s\".", Client_Mask( Client ), Req->argv[0]);
+	Log(LOG_NOTICE | LOG_snotice,
+	    "Got CONNECT command from \"%s\" for \"%s\".", Client_Mask(Client),
+	    Req->argv[0]);
 
-	if( Req->argc == 2 )
-	{
+	if (Req->argc == 2) {
 		/* Connect configured server */
-		if( ! Conf_EnableServer( Req->argv[0], atoi( Req->argv[1] ))) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
-	}
-	else
-	{
+		if (!Conf_EnableServer
+		    (Req->argv[0], (UINT16) atoi(Req->argv[1])))
+			return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+						  Client_ID(Client),
+						  Req->argv[0]);
+	} else {
 		/* Add server */
-		if( ! Conf_AddServer( Req->argv[0], atoi( Req->argv[1] ), Req->argv[2], Req->argv[3], Req->argv[4] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
+		if (!Conf_AddServer
+		    (Req->argv[0], (UINT16) atoi(Req->argv[1]), Req->argv[2],
+		     Req->argv[3], Req->argv[4]))
+			return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
+						  Client_ID(Client),
+						  Req->argv[0]);
 	}
+
 	return CONNECTED;
 } /* IRC_CONNECT */
 
@@ -208,7 +250,7 @@ IRC_DISCONNECT(CLIENT *Client, REQUEST *Req )
 	if( ! Conf_DisableServer( Req->argv[0] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
 
 	/* Are we still connected or were we killed, too? */
-	if( Client_GetFromConn( my_conn )) return CONNECTED;
+	if( Conn_GetClient( my_conn )) return CONNECTED;
 	else return DISCONNECTED;
 } /* IRC_CONNECT */
 

+ 15 - 13
src/ngircd/irc-server.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2006 Alexander Barton (alex@barton.de)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-server.c,v 1.38 2005/03/19 18:43:49 fw Exp $";
+static char UNUSED id[] = "$Id: irc-server.c,v 1.39 2006/04/30 21:31:43 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -244,22 +244,24 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req )
 				if( ! IRC_WriteStrClient( Client, "%s", str )) return DISCONNECTED;
 			}
 
+			/* Get next channel ... */
+			chan = Channel_Next(chan);
+		}
+
 #ifdef IRCPLUS
-			if( strchr( Client_Flags( Client ), 'L' ))
-			{
+		if (strchr(Client_Flags(Client), 'L')) {
 #ifdef DEBUG
-				Log( LOG_DEBUG, "Synchronizing INVITE- and BAN-lists ..." );
+			Log(LOG_DEBUG,
+			    "Synchronizing INVITE- and BAN-lists ...");
 #endif
-				/* Synchronize INVITE- and BAN-lists */
-				if( ! Lists_SendInvites( Client )) return DISCONNECTED;
-				if( ! Lists_SendBans( Client )) return DISCONNECTED;
-			}
+			/* Synchronize INVITE- and BAN-lists */
+			if (! Lists_SendInvites(Client))
+				return DISCONNECTED;
+			if (! Lists_SendBans(Client))
+				return DISCONNECTED;
+		}
 #endif
 
-			/* naechsten Channel suchen */
-			chan = Channel_Next( chan );
-		}
-		
 		return CONNECTED;
 	}
 	else if( Client_Type( Client ) == CLIENT_SERVER )

+ 6 - 5
src/ngircd/irc-write.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-write.c,v 1.18 2005/04/27 07:39:18 alex Exp $";
+static char UNUSED id[] = "$Id: irc-write.c,v 1.20 2006/05/10 21:24:01 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -39,7 +39,7 @@ static char UNUSED id[] = "$Id: irc-write.c,v 1.18 2005/04/27 07:39:18 alex Exp
 #define SEND_TO_SERVER 2
 
 
-LOCAL char *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client ));
+static char *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client ));
 
 
 #ifdef PROTOTYPES
@@ -400,7 +400,7 @@ va_dcl
 
 
 GLOBAL void
-IRC_SetPenalty( CLIENT *Client, int Seconds )
+IRC_SetPenalty( CLIENT *Client, time_t Seconds )
 {
 	CONN_ID c;
 	
@@ -410,11 +410,12 @@ IRC_SetPenalty( CLIENT *Client, int Seconds )
 	if( Client_Type( Client ) == CLIENT_SERVER ) return;
 	
 	c = Client_Conn( Client );
-	if( c > NONE ) Conn_SetPenalty( c, Seconds );		
+	if (c > NONE)
+		Conn_SetPenalty(c, Seconds);
 } /* IRC_SetPenalty */
 
 
-LOCAL char *
+static char *
 Get_Prefix( CLIENT *Target, CLIENT *Client )
 {
 	assert( Target != NULL );

+ 2 - 2
src/ngircd/irc-write.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: irc-write.h,v 1.7 2005/03/19 18:43:49 fw Exp $
+ * $Id: irc-write.h,v 1.8 2006/05/10 21:24:01 alex Exp $
  *
  * Sending IRC commands over the network (header)
  */
@@ -30,7 +30,7 @@ GLOBAL void IRC_WriteStrServersPrefixFlag PARAMS(( CLIENT *ExceptOf, CLIENT *Pre
 
 GLOBAL bool IRC_WriteStrRelatedPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, bool Remote, char *Format, ... ));
 
-GLOBAL void IRC_SetPenalty PARAMS(( CLIENT *Client, int Seconds ));
+GLOBAL void IRC_SetPenalty PARAMS(( CLIENT *Client, time_t Seconds ));
 
 
 #endif

+ 11 - 10
src/ngircd/irc.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc.c,v 1.126.2.1 2005/08/02 23:08:27 alex Exp $";
+static char UNUSED id[] = "$Id: irc.c,v 1.131 2006/07/23 14:55:40 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -22,10 +22,9 @@ static char UNUSED id[] = "$Id: irc.c,v 1.126.2.1 2005/08/02 23:08:27 alex Exp $
 #include <string.h>
 
 #include "ngircd.h"
-#include "conn.h"
 #include "resolve.h"
-#include "conf.h"
 #include "conn-func.h"
+#include "conf.h"
 #include "client.h"
 #include "channel.h"
 #include "defines.h"
@@ -38,7 +37,7 @@ static char UNUSED id[] = "$Id: irc.c,v 1.126.2.1 2005/08/02 23:08:27 alex Exp $
 #include "irc.h"
 
 
-LOCAL char *Option_String PARAMS(( CONN_ID Idx ));
+static char *Option_String PARAMS(( CONN_ID Idx ));
 
 
 GLOBAL bool
@@ -160,7 +159,7 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
 		Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] );
 
 	/* Are we still connected or were we killed, too? */
-	if(( my_conn > NONE ) && ( Client_GetFromConn( my_conn )))
+	if(( my_conn > NONE ) && ( Conn_GetClient( my_conn )))
 		return CONNECTED;
 	else
 		return DISCONNECTED;
@@ -325,17 +324,19 @@ IRC_HELP( CLIENT *Client, REQUEST *Req )
 } /* IRC_HELP */
 
 
-LOCAL char *
+static char *
 Option_String( CONN_ID Idx )
 {
 	static char option_txt[8];
-	int options;
+	UINT16 options;
 
-	options = Conn_Options( Idx );
+	options = Conn_Options(Idx);
 
-	strcpy( option_txt, "F" );	/* No idea what this means but the original ircd sends it ... */
+	strcpy(option_txt, "F");	/* No idea what this means, but the
+					 * original ircd sends it ... */
 #ifdef ZLIB
-	if( options & CONN_ZIP ) strcat( option_txt, "z" );
+	if(options & CONN_ZIP)		/* zlib compression supported. */
+		strcat(option_txt, "z");
 #endif
 
 	return option_txt;

+ 8 - 8
src/ngircd/lists.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: lists.c,v 1.17 2005/03/19 18:43:49 fw Exp $";
+static char UNUSED id[] = "$Id: lists.c,v 1.18 2005/07/31 20:13:08 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -48,13 +48,13 @@ typedef struct _C2C
 } C2C;
 
 
-LOCAL C2C *My_Invites, *My_Bans;
+static C2C *My_Invites, *My_Bans;
 
 
-LOCAL C2C *New_C2C PARAMS(( char *Mask, CHANNEL *Chan, bool OnlyOnce ));
+static C2C *New_C2C PARAMS(( char *Mask, CHANNEL *Chan, bool OnlyOnce ));
 
-LOCAL bool Check_List PARAMS(( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Chan ));
-LOCAL bool Already_Registered PARAMS(( C2C *Cl2Chan, char *Mask, CHANNEL *Chan ));
+static bool Check_List PARAMS(( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Chan ));
+static bool Already_Registered PARAMS(( C2C *Cl2Chan, char *Mask, CHANNEL *Chan ));
 
 
 
@@ -407,7 +407,7 @@ Lists_MakeMask( char *Pattern )
 } /* Lists_MakeMask */
 
 
-LOCAL C2C *
+static C2C *
 New_C2C( char *Mask, CHANNEL *Chan, bool OnlyOnce )
 {
 	C2C *c2c;
@@ -431,7 +431,7 @@ New_C2C( char *Mask, CHANNEL *Chan, bool OnlyOnce )
 } /* New_C2C */
 
 
-LOCAL bool
+static bool
 Check_List( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Chan )
 {
 	C2C *c2c, *last;
@@ -470,7 +470,7 @@ Check_List( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Chan )
 } /* Check_List */
 
 
-LOCAL bool
+static bool
 Already_Registered( C2C *List, char *Mask, CHANNEL *Chan )
 {
 	C2C *c2c;

+ 60 - 7
src/ngircd/log.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: log.c,v 1.57.2.1 2005/08/29 11:19:48 alex Exp $";
+static char UNUSED id[] = "$Id: log.c,v 1.61 2006/07/23 23:23:45 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -44,15 +44,15 @@ static char UNUSED id[] = "$Id: log.c,v 1.57.2.1 2005/08/29 11:19:48 alex Exp $"
 #include "log.h"
 
 
-LOCAL char Init_Txt[127];
-LOCAL bool Is_Daemon;
+static char Init_Txt[127];
+static bool Is_Daemon;
 
 #ifdef DEBUG
-LOCAL char Error_File[FNAME_LEN];
+static char Error_File[FNAME_LEN];
 #endif
 
 
-LOCAL void Wall_ServerNotice PARAMS(( char *Msg ));
+static void Wall_ServerNotice PARAMS(( char *Msg ));
 
 
 GLOBAL void
@@ -162,6 +162,60 @@ Log_Exit( void )
 } /* Log_Exit */
 
 
+/**
+ * Log function for debug messages.
+ * This function is only functional when the program is compiled with debug
+ * code enabled; otherwise it is an empty function which the compiler will
+ * hopefully mangle down to "nothing". Therefore you should use LogDebug(...)
+ * in favor to Log(LOG_DEBUG, ...).
+ * @param Format Format string like printf().
+ * @param ... Further arguments.
+ */
+# ifdef PROTOTYPES
+GLOBAL void
+#ifdef DEBUG
+LogDebug( const char *Format, ... )
+#else
+LogDebug( UNUSED const char *Format, ... )
+#endif /* DEBUG */
+# else
+GLOBAL void
+LogDebug( Format, va_alist )
+const char *Format;
+va_dcl
+# endif /* PROTOTYPES */
+#ifdef DEBUG
+{
+	char msg[MAX_LOG_MSG_LEN];
+	va_list ap;
+
+	if (!NGIRCd_Debug) return;
+#ifdef PROTOTYPES
+	va_start( ap, Format );
+#else
+	va_start( ap );
+#endif
+	vsnprintf( msg, MAX_LOG_MSG_LEN, Format, ap );
+	va_end( ap );
+	Log(LOG_DEBUG, "%s", msg);
+}
+#else
+{
+	/* Do nothing.
+	 * The compiler should optimize this out, please ;-) */
+}
+#endif	/* DEBUG */
+
+	
+/**
+ * Logging function of ngIRCd.
+ * This function logs messages to the console and/or syslog, whichever is
+ * suitable for the mode ngIRCd is running in (daemon vs. non-daemon).
+ * Please note: you sould use LogDebug(...) for debug messages!
+ * @param Level syslog level (LOG_xxx)
+ * @param Format Format string like printf().
+ * @param ... Further arguments.
+ */
 #ifdef PROTOTYPES
 GLOBAL void
 Log( int Level, const char *Format, ... )
@@ -174,7 +228,6 @@ va_dcl
 #endif
 {
 	/* Eintrag in Logfile(s) schreiben */
-
 	char msg[MAX_LOG_MSG_LEN];
 	bool snotice;
 	va_list ap;
@@ -306,7 +359,7 @@ va_dcl
  * Send log messages to users flagged with the "s" mode.
  * @param Msg The message to send.
  */
-LOCAL void
+static void
 Wall_ServerNotice( char *Msg )
 {
 	CLIENT *c;

+ 2 - 1
src/ngircd/log.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: log.h,v 1.18 2005/06/24 19:55:10 alex Exp $
+ * $Id: log.h,v 1.19 2006/02/08 17:33:28 fw Exp $
  *
  * Logging functions (header)
  */
@@ -39,6 +39,7 @@ GLOBAL void Log_Init PARAMS(( bool Daemon_Mode ));
 GLOBAL void Log_Exit PARAMS(( void ));
 
 GLOBAL void Log PARAMS(( int Level, const char *Format, ... ));
+GLOBAL void LogDebug PARAMS(( const char *Format, ... ));
 
 GLOBAL void Log_Init_Resolver PARAMS(( void ));
 GLOBAL void Log_Exit_Resolver PARAMS(( void ));

+ 5 - 5
src/ngircd/match.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: match.c,v 1.3 2005/03/19 18:43:49 fw Exp $";
+static char UNUSED id[] = "$Id: match.c,v 1.4 2005/07/31 20:13:08 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -32,8 +32,8 @@ static char UNUSED id[] = "$Id: match.c,v 1.3 2005/03/19 18:43:49 fw Exp $";
  */
 
 
-LOCAL int Matche PARAMS(( char *p, char *t ));
-LOCAL int Matche_After_Star PARAMS(( char *p, char *t ));
+static int Matche PARAMS(( char *p, char *t ));
+static int Matche_After_Star PARAMS(( char *p, char *t ));
 
 
 #define MATCH_PATTERN	6	/* bad pattern */
@@ -53,7 +53,7 @@ Match( char *Pattern, char *String )
 } /* Match */
 
 
-LOCAL int
+static int
 Matche( char *p, char *t )
 {
 	register char range_start, range_end;
@@ -200,7 +200,7 @@ Matche( char *p, char *t )
 } /* Matche */
 
 
-LOCAL int
+static int
 Matche_After_Star( char *p, char *t )
 {
 	register int nextp, match = 0;

+ 2 - 1
src/ngircd/messages.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: messages.h,v 1.66 2004/02/28 02:18:16 alex Exp $
+ * $Id: messages.h,v 1.67 2005/09/02 12:50:25 alex Exp $
  *
  * IRC numerics (Header)
  */
@@ -62,6 +62,7 @@
 #define RPL_CHANNELMODEIS_MSG		"324 %s %s +%s"
 #define RPL_NOTOPIC_MSG			"331 %s %s :No topic is set"
 #define RPL_TOPIC_MSG			"332 %s %s :%s"
+#define RPL_TOPICSETBY_MSG		"333 %s %s %s %u"
 #define RPL_INVITING_MSG		"341 %s %s %s"
 #define RPL_INVITELIST_MSG		"346 %s %s %s"
 #define RPL_ENDOFINVITELIST_MSG		"347 %s %s :End of channel invite list"

+ 52 - 51
src/ngircd/ngircd.c

@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2005 by Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2006 Alexander Barton (alex@barton.de).
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -12,7 +12,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: ngircd.c,v 1.102.2.2 2005/07/08 23:20:04 alex Exp $";
+static char UNUSED id[] = "$Id: ngircd.c,v 1.113 2006/07/23 12:07:33 alex Exp $";
 
 /**
  * @file
@@ -48,7 +48,7 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.102.2.2 2005/07/08 23:20:04 alex Ex
 #include "parse.h"
 #include "irc.h"
 
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
 #include "rendezvous.h"
 #endif
 
@@ -56,20 +56,20 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.102.2.2 2005/07/08 23:20:04 alex Ex
 #include "ngircd.h"
 
 
-LOCAL void Initialize_Signal_Handler PARAMS(( void ));
-LOCAL void Signal_Handler PARAMS(( int Signal ));
+static void Initialize_Signal_Handler PARAMS(( void ));
+static void Signal_Handler PARAMS(( int Signal ));
 
-LOCAL void Show_Version PARAMS(( void ));
-LOCAL void Show_Help PARAMS(( void ));
+static void Show_Version PARAMS(( void ));
+static void Show_Help PARAMS(( void ));
 
-LOCAL void Pidfile_Create PARAMS(( long ));
-LOCAL void Pidfile_Delete PARAMS(( void ));
+static void Pidfile_Create PARAMS(( pid_t pid ));
+static void Pidfile_Delete PARAMS(( void ));
 
-LOCAL void Fill_Version PARAMS(( void ));
+static void Fill_Version PARAMS(( void ));
 
-LOCAL void Setup_FDStreams PARAMS(( void ));
+static void Setup_FDStreams PARAMS(( void ));
 
-LOCAL bool NGIRCd_Init PARAMS(( bool ));
+static bool NGIRCd_Init PARAMS(( bool ));
 
 /**
  * The main() function of ngIRCd.
@@ -262,18 +262,19 @@ main( int argc, const char *argv[] )
 		Log_Init( ! NGIRCd_NoDaemon );
 		Conf_Init( );
 
-		if (!NGIRCd_Init( NGIRCd_NoDaemon )) {
-			Log(LOG_WARNING, "Fatal: Initialization failed");
+		/* Initialize the "main program": chroot environment, user and
+		 * group ID, ... */
+		if (!NGIRCd_Init(NGIRCd_NoDaemon)) {
+			Log(LOG_ALERT, "Fatal: Initialization failed");
 			exit(1);
 		}
 
 		/* Initialize modules, part II: these functions are eventually
 		 * called with already dropped privileges ... */
-		Resolve_Init( );
 		Lists_Init( );
 		Channel_Init( );
 		Client_Init( );
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
 		Rendezvous_Init( );
 #endif
 		Conn_Init( );
@@ -322,7 +323,7 @@ main( int argc, const char *argv[] )
 
 		/* Alles abmelden */
 		Conn_Exit( );
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
 		Rendezvous_Exit( );
 #endif
 		Client_Exit( );
@@ -342,7 +343,7 @@ main( int argc, const char *argv[] )
  * further usage, for example by the IRC command VERSION and the --version
  * command line switch.
  */
-LOCAL void
+static void
 Fill_Version( void )
 {
 	NGIRCd_VersionAddition[0] = '\0';
@@ -362,11 +363,11 @@ Fill_Version( void )
 
 	strlcat( NGIRCd_VersionAddition, "TCPWRAP", sizeof NGIRCd_VersionAddition );
 #endif
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
 	if( NGIRCd_VersionAddition[0] )
 		strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
 
-	strlcat( NGIRCd_VersionAddition, "RENDEZVOUS", sizeof NGIRCd_VersionAddition );
+	strlcat( NGIRCd_VersionAddition, "ZEROCONF", sizeof NGIRCd_VersionAddition );
 #endif
 #ifdef IDENTAUTH
 	if( NGIRCd_VersionAddition[0] )
@@ -439,7 +440,7 @@ NGIRCd_Rehash( void )
 	/* Recover old server name: it can't be changed during run-time */
 	if( strcmp( old_name, Conf_ServerName ) != 0 )
 	{
-		strcpy( Conf_ServerName, old_name );
+		strlcpy( Conf_ServerName, old_name, sizeof Conf_ServerName );
 		Log( LOG_ERR, "Can't change \"ServerName\" on runtime! Ignored new name." );
 	}
 
@@ -459,7 +460,7 @@ NGIRCd_Rehash( void )
 /**
  * Initialize the signal handler.
  */
-LOCAL void
+static void
 Initialize_Signal_Handler( void )
 {
 	/* Signal-Handler initialisieren: einige Signale
@@ -481,27 +482,27 @@ Initialize_Signal_Handler( void )
 #endif
 
 	/* Signal-Handler einhaengen */
-	sigaction( SIGINT, &saction, NULL );
-	sigaction( SIGQUIT, &saction, NULL );
-	sigaction( SIGTERM, &saction, NULL);
-	sigaction( SIGHUP, &saction, NULL);
-	sigaction( SIGCHLD, &saction, NULL);
+	sigaction(SIGINT, &saction, NULL);
+	sigaction(SIGQUIT, &saction, NULL);
+	sigaction(SIGTERM, &saction, NULL);
+	sigaction(SIGHUP, &saction, NULL);
+	sigaction(SIGCHLD, &saction, NULL);
 
 	/* einige Signale ignorieren */
 	saction.sa_handler = SIG_IGN;
-	sigaction( SIGPIPE, &saction, NULL );
+	sigaction(SIGPIPE, &saction, NULL);
 #else
 	/* kein sigaction() vorhanden */
 
 	/* Signal-Handler einhaengen */
-	signal( SIGINT, Signal_Handler );
-	signal( SIGQUIT, Signal_Handler );
-	signal( SIGTERM, Signal_Handler );
-	signal( SIGHUP, Signal_Handler );
-	signal( SIGCHLD, Signal_Handler );
+	signal(SIGINT, Signal_Handler);
+	signal(SIGQUIT, Signal_Handler);
+	signal(SIGTERM, Signal_Handler);
+	signal(SIGHUP, Signal_Handler);
+	signal(SIGCHLD, Signal_Handler);
 
 	/* einige Signale ignorieren */
-	signal( SIGPIPE, SIG_IGN );
+	signal(SIGPIPE, SIG_IGN);
 #endif
 } /* Initialize_Signal_Handler */
 
@@ -512,7 +513,7 @@ Initialize_Signal_Handler( void )
  * user and/or the system to it. For example SIGTERM and SIGHUP.
  * @param Signal Number of the signal to handle.
  */
-LOCAL void
+static void
 Signal_Handler( int Signal )
 {
 	switch( Signal )
@@ -543,12 +544,12 @@ Signal_Handler( int Signal )
 /**
  * Display copyright and version information of ngIRCd on the console.
  */
-LOCAL void
+static void
 Show_Version( void )
 {
 	puts( NGIRCd_Version );
-	puts( "Copyright (c)2001-2005 by Alexander Barton (<alex@barton.de>)." );
-	puts( "Homepage: <http://arthur.ath.cx/~alex/ngircd/>\n" );
+	puts( "Copyright (c)2001-2006 Alexander Barton (<alex@barton.de>) and Contributors." );
+	puts( "Homepage: <http://ngircd.barton.de/>\n" );
 	puts( "This is free software; see the source for copying conditions. There is NO" );
 	puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
 } /* Show_Version */
@@ -559,7 +560,7 @@ Show_Version( void )
  * This help depends on the configuration of the executable and only shows
  * options that are actually enabled.
  */
-LOCAL void
+static void
 Show_Help( void )
 {
 #ifdef DEBUG
@@ -580,7 +581,7 @@ Show_Help( void )
 /**
  * Delete the file containing the process ID (PID).
  */
-LOCAL void
+static void
 Pidfile_Delete( void )
 {
 	/* Pidfile configured? */
@@ -599,8 +600,8 @@ Pidfile_Delete( void )
  * Create the file containing the process ID of ngIRCd ("PID file").
  * @param pid The process ID to be stored in this file.
  */
-LOCAL void
-Pidfile_Create( long pid )
+static void
+Pidfile_Create(pid_t pid)
 {
 	int pidfd;
 	char pidbuf[64];
@@ -619,13 +620,13 @@ Pidfile_Create( long pid )
 		return;
 	}
 
-	len = snprintf( pidbuf, sizeof pidbuf, "%ld\n", pid );
-	if (len < 0|| len < (int)sizeof pid) {
+	len = snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid);
+	if (len < 0 || len >= (int)sizeof pidbuf) {
 		Log( LOG_ERR, "Error converting pid");
 		return;
 	}
 	
-	if( write( pidfd, pidbuf, len) != len)
+	if (write(pidfd, pidbuf, (size_t)len) != (ssize_t)len)
 		Log( LOG_ERR, "Can't write PID file (%s): %s", Conf_PidFile, strerror( errno ));
 
 	if( close(pidfd) != 0 )
@@ -636,7 +637,7 @@ Pidfile_Create( long pid )
 /**
  * Redirect stdin, stdout and stderr to apropriate file handles.
  */
-LOCAL void
+static void
 Setup_FDStreams( void )
 {
 	int fd;
@@ -661,8 +662,8 @@ Setup_FDStreams( void )
 } /* Setup_FDStreams */
 
 
-LOCAL bool
-NGIRCd_getNobodyID(unsigned int *uid, unsigned int *gid )
+static bool
+NGIRCd_getNobodyID(uid_t *uid, gid_t *gid )
 {
 	struct passwd *pwd;
 
@@ -680,7 +681,7 @@ NGIRCd_getNobodyID(unsigned int *uid, unsigned int *gid )
 }
 
 
-LOCAL bool
+static bool
 NGIRCd_Init( bool NGIRCd_NoDaemon ) 
 {
 	static bool initialized;
@@ -688,7 +689,7 @@ NGIRCd_Init( bool NGIRCd_NoDaemon )
 	struct passwd *pwd;
 	struct group *grp;
 	int real_errno;
-	long pid;
+	pid_t pid;
 
 	if (initialized)
 		return true;
@@ -748,7 +749,7 @@ NGIRCd_Init( bool NGIRCd_NoDaemon )
 	 * connected to ther controlling terminal. Use "--nodaemon"
 	 * to disable this "daemon mode" (useful for debugging). */
 	if ( ! NGIRCd_NoDaemon ) {
-		pid = (long)fork( );
+		pid = fork( );
 		if( pid > 0 ) {
 			/* "Old" process: exit. */
 			exit( 0 );

+ 20 - 17
src/ngircd/parse.c

@@ -12,7 +12,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: parse.c,v 1.63.2.1 2005/07/24 21:06:51 alex Exp $";
+static char UNUSED id[] = "$Id: parse.c,v 1.67 2006/04/23 10:37:27 fw Exp $";
 
 /**
  * @file
@@ -103,13 +103,13 @@ COMMAND My_Commands[] =
 };
 
 
-LOCAL void Init_Request PARAMS(( REQUEST *Req ));
+static void Init_Request PARAMS(( REQUEST *Req ));
 
-LOCAL bool Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
-LOCAL bool Validate_Command PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
-LOCAL bool Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
+static bool Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
+static bool Validate_Command PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
+static bool Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed ));
 
-LOCAL bool Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req ));
+static bool Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req ));
 
 
 /**
@@ -247,7 +247,7 @@ Parse_Request( CONN_ID Idx, char *Request )
  * Initialize request structure.
  * @param Req Request structure to be initialized.
  */
-LOCAL void
+static void
 Init_Request( REQUEST *Req )
 {
 	/* Neue Request-Struktur initialisieren */
@@ -263,7 +263,7 @@ Init_Request( REQUEST *Req )
 } /* Init_Request */
 
 
-LOCAL bool
+static bool
 Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed )
 {
 	CLIENT *client, *c;
@@ -277,7 +277,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed )
 	if( ! Req->prefix ) return true;
 
 	/* Client-Struktur der Connection ermitteln */
-	client = Client_GetFromConn( Idx );
+	client = Conn_GetClient( Idx );
 	assert( client != NULL );
 
 	/* nur validieren, wenn bereits registrierte Verbindung */
@@ -306,7 +306,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed )
 	{
 		/* das angegebene Prefix ist aus dieser Richtung, also
 		 * aus der gegebenen Connection, ungueltig! */
-		Log( LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d, command %s)!", Req->prefix, Client_Mask( Client_GetFromConn( Idx )), Idx, Req->command );
+		Log( LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d, command %s)!", Req->prefix, Client_Mask( Conn_GetClient( Idx )), Idx, Req->command );
 		Conn_Close( Idx, NULL, "Spoofed prefix", true);
 		*Closed = true;
 		return false;
@@ -316,7 +316,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed )
 } /* Validate_Prefix */
 
 
-LOCAL bool
+static bool
 Validate_Command( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed )
 {
 	assert( Idx >= 0 );
@@ -327,7 +327,7 @@ Validate_Command( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed )
 } /* Validate_Comman */
 
 
-LOCAL bool
+static bool
 Validate_Args( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed )
 {
 	assert( Idx >= 0 );
@@ -338,7 +338,7 @@ Validate_Args( UNUSED CONN_ID Idx, UNUSED REQUEST *Req, bool *Closed )
 } /* Validate_Args */
 
 
-LOCAL bool
+static bool
 Handle_Request( CONN_ID Idx, REQUEST *Req )
 {
 	/* Client-Request verarbeiten. Bei einem schwerwiegenden Fehler
@@ -354,7 +354,7 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
 	assert( Req != NULL );
 	assert( Req->command != NULL );
 
-	client = Client_GetFromConn( Idx );
+	client = Conn_GetClient( Idx );
 	assert( client != NULL );
 
 	/* Statuscode? */
@@ -445,9 +445,12 @@ Handle_Request( CONN_ID Idx, REQUEST *Req )
 			Req->argc == 1 ? "parameter" : "parameters",
 			Req->prefix ? "" : " no" );
 
-	if( Client_Type( client ) != CLIENT_SERVER )
-		return IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG,
-				Client_ID( client ), Req->command );
+	if (Client_Type(client) != CLIENT_SERVER) {
+		result = IRC_WriteStrClient(client, ERR_UNKNOWNCOMMAND_MSG,
+				Client_ID(client), Req->command);
+		Conn_SetPenalty(Idx, 1);
+		return result;
+	}
 
 	return true;
 } /* Handle_Request */

+ 17 - 15
src/ngircd/rendezvous.c

@@ -18,10 +18,10 @@
 
 #include "portab.h"
 
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
 
 
-static char UNUSED id[] = "$Id: rendezvous.c,v 1.5 2005/03/19 18:43:49 fw Exp $";
+static char UNUSED id[] = "$Id: rendezvous.c,v 1.8 2006/05/10 21:24:01 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -72,10 +72,10 @@ typedef struct _service
 #endif
 } SERVICE;
 
-LOCAL SERVICE My_Rendezvous[MAX_RENDEZVOUS];
+static SERVICE My_Rendezvous[MAX_RENDEZVOUS];
 
 
-LOCAL void Unregister( int Idx );
+static void Unregister( int Idx );
 
 
 /* -- Apple API -- */
@@ -84,7 +84,7 @@ LOCAL void Unregister( int Idx );
 
 #define MAX_MACH_MSG_SIZE 512
 
-LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context );
+static void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context );
 
 #endif /* Apple */
 
@@ -93,10 +93,10 @@ LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrC
 
 #ifdef HOWL
 
-LOCAL sw_discovery My_Discovery_Session = NULL;
-LOCAL sw_salt My_Salt;
+static sw_discovery My_Discovery_Session = NULL;
+static sw_salt My_Salt;
 
-LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, sw_discovery_oid Id, sw_opaque Extra );
+static sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, sw_discovery_oid Id, sw_opaque Extra );
 
 #endif /* Howl */
 
@@ -144,7 +144,7 @@ GLOBAL void Rendezvous_Exit( void )
 } /* Rendezvous_Exit */
 
 
-GLOBAL bool Rendezvous_Register( char *Name, char *Type, unsigned int Port )
+GLOBAL bool Rendezvous_Register( char *Name, char *Type, UINT16 Port )
 {
 	/* Register new service */
 
@@ -263,7 +263,7 @@ GLOBAL void Rendezvous_Handler( void )
 } /* Rendezvous_Handler */
 
 
-LOCAL void Unregister( int Idx )
+static void Unregister( int Idx )
 {
 	/* Unregister service */
 
@@ -289,7 +289,7 @@ LOCAL void Unregister( int Idx )
 #ifdef APPLE
 
 
-LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context )
+static void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context )
 {
 	SERVICE *s = (SERVICE *)Context;
 	char txt[50];
@@ -310,7 +310,8 @@ LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrC
 			strcpy( txt, "name conflict!" );
 			break;
 		default:
-			sprintf( txt, "error code %ld!", (long)ErrCode );
+			snprintf(txt, sizeof txt, "error code %ld!",
+			 	 (long)ErrCode);
 	}
 
 	Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", s->Desc, txt );
@@ -326,7 +327,7 @@ LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrC
 #ifdef HOWL
 
 
-LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, UNUSED sw_discovery_oid Id, sw_opaque Extra )
+static sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, UNUSED sw_discovery_oid Id, sw_opaque Extra )
 {
 	SERVICE *s = (SERVICE *)Extra;
 	char txt[50];
@@ -347,7 +348,8 @@ LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_di
 			strcpy( txt, "name conflict!" );
 			break;
 		default:
-			sprintf( txt, "error code %ld!", (long)Status );
+			snprintf(txt, sizeof txt, "error code %ld!",
+			 	 (long)Status);
 	}
 
 	Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", s->Desc, txt );
@@ -360,7 +362,7 @@ LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_di
 #endif /* Howl */
 
 
-#endif	/* RENDEZVOUS */
+#endif	/* ZEROCONF */
 
 
 /* -eof- */

+ 4 - 4
src/ngircd/rendezvous.h

@@ -8,13 +8,13 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: rendezvous.h,v 1.2 2005/03/19 18:43:49 fw Exp $
+ * $Id: rendezvous.h,v 1.4 2006/05/10 21:24:01 alex Exp $
  *
  * "Rendezvous" functions (Header)
  */
 
 
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
 
 #ifndef __rdezvous_h__
 #define __rdezvous_h__
@@ -23,7 +23,7 @@
 GLOBAL void Rendezvous_Init( void );
 GLOBAL void Rendezvous_Exit( void );
 
-GLOBAL bool Rendezvous_Register( char *Name, char *Type, unsigned int Port );
+GLOBAL bool Rendezvous_Register( char *Name, char *Type, UINT16 Port );
 
 GLOBAL bool Rendezvous_Unregister( char *Name );
 GLOBAL void Rendezvous_UnregisterListeners( void );
@@ -33,7 +33,7 @@ GLOBAL void Rendezvous_Handler( void );
 
 #endif	/* __rdezvous_h__ */
 
-#endif	/* RENDEZVOUS */
+#endif	/* ZEROCONF */
 
 
 /* -eof- */

+ 206 - 158
src/ngircd/resolve.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: resolve.c,v 1.12.2.1 2005/09/02 22:07:38 fw Exp $";
+static char UNUSED id[] = "$Id: resolve.c,v 1.24 2006/05/10 21:24:01 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -39,195 +39,206 @@ static char UNUSED id[] = "$Id: resolve.c,v 1.12.2.1 2005/09/02 22:07:38 fw Exp
 
 #include "exp.h"
 #include "resolve.h"
+#include "io.h"
 
 
-#ifdef IDENTAUTH
-LOCAL void Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, int Sock, int w_fd ));
-#else
-LOCAL void Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, int w_fd ));
-#endif
-
-LOCAL void Do_ResolveName PARAMS(( char *Host, int w_fd ));
+static void Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, int Sock, int w_fd ));
+static void Do_ResolveName PARAMS(( const char *Host, int w_fd ));
+static bool register_callback PARAMS((RES_STAT *s, void (*cbfunc)(int, short)));
 
 #ifdef h_errno
-LOCAL char *Get_Error PARAMS(( int H_Error ));
+static char *Get_Error PARAMS(( int H_Error ));
 #endif
 
-LOCAL RES_STAT *New_Res_Stat PARAMS(( void ));
-
-
-GLOBAL void
-Resolve_Init( void )
+static pid_t
+Resolver_fork(int *pipefds)
 {
-	/* Initialize module */
+	pid_t pid;
 
-	FD_ZERO( &Resolver_FDs );
-} /* Resolve_Init */
+	if (pipe(pipefds) != 0) {
+                Log( LOG_ALERT, "Resolver: Can't create output pipe: %s!", strerror( errno ));
+                return -1;
+	}
 
+	pid = fork();
+	switch(pid) {
+		case -1:
+			Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
+			close(pipefds[0]);
+			close(pipefds[1]);
+			return -1;
+		case 0: /* child */
+			close(pipefds[0]);
+			Log_Init_Resolver( );
+			return 0;
+	}
+	/* parent */
+	close(pipefds[1]);
+	return pid; 
+}
 
-#ifdef IDENTAUTH
-GLOBAL RES_STAT *
-Resolve_Addr( struct sockaddr_in *Addr, int Sock )
-#else
-GLOBAL RES_STAT *
-Resolve_Addr( struct sockaddr_in *Addr )
-#endif
-{
-	/* Resolve IP (asynchronous!). On errors, e.g. if the child process
-	 * can't be forked, this functions returns NULL. */
 
-	RES_STAT *s;
-	int pid;
+/**
+ * Resolve IP (asynchronous!).
+ */
+GLOBAL bool
+Resolve_Addr(RES_STAT * s, struct sockaddr_in *Addr, int identsock,
+	     void (*cbfunc) (int, short))
+{
+	int pipefd[2];
+	pid_t pid;
 
-	s = New_Res_Stat( );
-	if( ! s ) return NULL;
+	assert(s != NULL);
 
-	/* For sub-process */
-	pid = fork( );
-	if( pid > 0 )
-	{
-		/* Main process */
+	pid = Resolver_fork(pipefd);
+	if (pid > 0) {
+#ifdef DEBUG
 		Log( LOG_DEBUG, "Resolver for %s created (PID %d).", inet_ntoa( Addr->sin_addr ), pid );
-		FD_SET( s->pipe[0], &Resolver_FDs );
-		if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0];
+#endif
 		s->pid = pid;
-		return s;
-	}
-	else if( pid == 0 )
-	{
+		s->resolver_fd = pipefd[0];
+		return register_callback(s, cbfunc);
+	} else if( pid == 0 ) {
 		/* Sub process */
-		Log_Init_Resolver( );
-#ifdef IDENTAUTH
-		Do_ResolveAddr( Addr, Sock, s->pipe[1] );
-#else
-		Do_ResolveAddr( Addr, s->pipe[1] );
-#endif
+		Do_ResolveAddr( Addr, identsock, pipefd[1]);
 		Log_Exit_Resolver( );
-		exit( 0 );
-	}
-	else
-	{
-		/* Error! */
-		close(s->pipe[0]);
-		close(s->pipe[1]);
-		free( s );
-		Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
-		return NULL;
+		exit(0);
 	}
+	return false;
 } /* Resolve_Addr */
 
 
-GLOBAL RES_STAT *
-Resolve_Name( char *Host )
+/**
+ * Resolve hostname (asynchronous!).
+ */
+GLOBAL bool
+Resolve_Name( RES_STAT *s, const char *Host, void (*cbfunc)(int, short))
 {
-	/* Resolve hostname (asynchronous!). On errors, e.g. if the child
-	 * process can't be forked, this functions returns NULL. */
-
-	RES_STAT *s;
-	int pid;
+	int pipefd[2];
+	pid_t pid;
 
-	s = New_Res_Stat( );
-	if( ! s ) return NULL;
+	assert(s != NULL);
 
-	/* Fork sub-process */
-	pid = fork( );
-	if( pid > 0 )
-	{
+	pid = Resolver_fork(pipefd);
+	if (pid > 0) {
 		/* Main process */
+#ifdef DEBUG
 		Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid );
-		FD_SET( s->pipe[0], &Resolver_FDs );
-		if( s->pipe[0] > Conn_MaxFD ) Conn_MaxFD = s->pipe[0];
+#endif
 		s->pid = pid;
-		return s;
-	}
-	else if( pid == 0 )
-	{
+		s->resolver_fd = pipefd[0];
+		return register_callback(s, cbfunc);
+	} else if( pid == 0 ) {
 		/* Sub process */
-		Log_Init_Resolver( );
-		Do_ResolveName( Host, s->pipe[1] );
+		Do_ResolveName(Host, pipefd[1]);
 		Log_Exit_Resolver( );
-		exit( 0 );
-	}
-	else
-	{
-		/* Error! */
-		close(s->pipe[0]);
-		close(s->pipe[1]);
-		free( s );
-		Log( LOG_CRIT, "Resolver: Can't fork: %s!", strerror( errno ));
-		return NULL;
+		exit(0);
 	}
+	return false;
 } /* Resolve_Name */
 
 
-#ifdef IDENTAUTH
-LOCAL void
-Do_ResolveAddr( struct sockaddr_in *Addr, int Sock, int w_fd )
-#else
-LOCAL void
-Do_ResolveAddr( struct sockaddr_in *Addr, int w_fd )
-#endif
+GLOBAL void
+Resolve_Init(RES_STAT *s)
+{
+	assert(s != NULL);
+	s->resolver_fd = -1;
+	s->pid = 0;
+}
+
+
+static void
+Do_ResolveAddr( struct sockaddr_in *Addr, int identsock, int w_fd )
 {
 	/* Resolver sub-process: resolve IP address and write result into
 	 * pipe to parent. */
 
 	char hostname[HOST_LEN];
+	char ipstr[HOST_LEN];
 	struct hostent *h;
 	size_t len;
+	struct in_addr *addr;
+	char *ntoaptr;
+	array resolved_addr;
 #ifdef IDENTAUTH
 	char *res;
 #endif
-
+	array_init(&resolved_addr);
 	/* Resolve IP address */
+#ifdef DEBUG
 	Log_Resolver( LOG_DEBUG, "Now resolving %s ...", inet_ntoa( Addr->sin_addr ));
+#endif
 	h = gethostbyaddr( (char *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET );
-	if( h ) strlcpy( hostname, h->h_name, sizeof( hostname ));
-	else
-	{
+	if (!h) {
 #ifdef h_errno
 		Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\": %s!", inet_ntoa( Addr->sin_addr ), Get_Error( h_errno ));
 #else
 		Log_Resolver( LOG_WARNING, "Can't resolve address \"%s\"!", inet_ntoa( Addr->sin_addr ));
 #endif	
 		strlcpy( hostname, inet_ntoa( Addr->sin_addr ), sizeof( hostname ));
+	} else {
+ 		strlcpy( hostname, h->h_name, sizeof( hostname ));
+
+		h = gethostbyname( hostname );
+		if ( h ) {
+			if (memcmp(h->h_addr, &Addr->sin_addr, sizeof (struct in_addr))) {
+				addr = (struct in_addr*) h->h_addr;
+				strlcpy(ipstr, inet_ntoa(*addr), sizeof ipstr); 
+				ntoaptr = inet_ntoa( Addr->sin_addr );
+				Log(LOG_WARNING,"Possible forgery: %s resolved to %s (which is at ip %s!)",
+										ntoaptr, hostname, ipstr);
+				strlcpy( hostname, ntoaptr, sizeof hostname);
+			}
+		} else {
+			ntoaptr = inet_ntoa( Addr->sin_addr );
+			Log(LOG_WARNING, "Possible forgery: %s resolved to %s (which has no ip address)",
+											ntoaptr, hostname);
+			strlcpy( hostname, ntoaptr, sizeof hostname);
+		}
 	}
 	Log_Resolver( LOG_DEBUG, "Ok, translated %s to \"%s\".", inet_ntoa( Addr->sin_addr ), hostname );
 
-	/* Write resolver result into pipe to parent */
 	len = strlen( hostname ); 
 	hostname[len] = '\n'; len++;
-	if( (size_t)write( w_fd, hostname, len ) != (size_t)len )
-	{
-		Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
+	if (!array_copyb(&resolved_addr, hostname, len )) {
+		Log_Resolver( LOG_CRIT, "Resolver: Can't copy resolved name: %s!", strerror( errno ));
 		close( w_fd );
 		return;
 	}
 
 #ifdef IDENTAUTH
-	/* Do "IDENT" (aka "AUTH") lookup and write result to parent */
-	Log_Resolver( LOG_DEBUG, "Doing IDENT lookup on socket %d ...", Sock );
-	res = ident_id( Sock, 10 );
-	Log_Resolver( LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"", Sock, res ? res : "" );
-
-	/* Write IDENT result into pipe to parent */
-	if (res) {
-		len = strlen(res);
-		res[len] = '\n';
-		len++;
-	} else len = 1;
-
-	if( (size_t)write( w_fd, res ? res : "\n", len ) != (size_t)len )
-	{
-		Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent (IDENT): %s!", strerror( errno ));
-		close( w_fd );
+	assert(identsock >= 0);
+	if (identsock >= 0) {
+		/* Do "IDENT" (aka "AUTH") lookup and append result to resolved_addr array */
+#ifdef DEBUG
+		Log_Resolver( LOG_DEBUG, "Doing IDENT lookup on socket %d ...", identsock );
+#endif
+		res = ident_id( identsock, 10 );
+#ifdef DEBUG
+		Log_Resolver(LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"",
+							identsock, res ? res : "(NULL)" );
+#endif
+		if (res && !array_cats(&resolved_addr, res)) {
+			Log_Resolver(LOG_WARNING, "Resolver: Cannot copy IDENT result: %s!", strerror(errno));
+			/* omit ident and return hostname only */ 
+		}
+
+		if (res) free(res);
 	}
-	free( res );
+#else
+	(void)identsock;
 #endif
+	len = array_bytes(&resolved_addr);
+	if( (size_t)write( w_fd, array_start(&resolved_addr), len) != len )
+		Log_Resolver( LOG_CRIT, "Resolver: Can't write result to parent: %s!", strerror( errno ));
+
+	close(w_fd);
+	array_free(&resolved_addr);
 } /* Do_ResolveAddr */
 
 
-LOCAL void
-Do_ResolveName( char *Host, int w_fd )
+static void
+Do_ResolveName( const char *Host, int w_fd )
 {
 	/* Resolver sub-process: resolve name and write result into pipe
 	 * to parent. */
@@ -235,33 +246,30 @@ Do_ResolveName( char *Host, int w_fd )
 	char ip[16];
 	struct hostent *h;
 	struct in_addr *addr;
-	int len;
+	size_t len;
 
 	Log_Resolver( LOG_DEBUG, "Now resolving \"%s\" ...", Host );
 
 	/* Resolve hostname */
 	h = gethostbyname( Host );
-	if( h )
-	{
+	if( h ) {
 		addr = (struct in_addr *)h->h_addr;
 		strlcpy( ip, inet_ntoa( *addr ), sizeof( ip ));
-	}
-	else
-	{
+	} else {
 #ifdef h_errno
 		Log_Resolver( LOG_WARNING, "Can't resolve \"%s\": %s!", Host, Get_Error( h_errno ));
 #else
 		Log_Resolver( LOG_WARNING, "Can't resolve \"%s\"!", Host );
 #endif
-		ip[0] = '\0';
+		close(w_fd);
+		return;
 	}
-	if( ip[0] ) Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
-
+#ifdef DEBUG
+	Log_Resolver( LOG_DEBUG, "Ok, translated \"%s\" to %s.", Host, ip );
+#endif
 	/* Write result into pipe to parent */
 	len = strlen( ip );
-	ip[len] = '\n'; len++;
-	if( (size_t)write( w_fd, ip, len ) != (size_t)len )
-	{
+	if ((size_t)write( w_fd, ip, len ) != len) {
 		Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
 		close( w_fd );
 	}
@@ -270,7 +278,7 @@ Do_ResolveName( char *Host, int w_fd )
 
 #ifdef h_errno
 
-LOCAL char *
+static char *
 Get_Error( int H_Error )
 {
 	/* Get error message for H_Error */
@@ -293,33 +301,73 @@ Get_Error( int H_Error )
 #endif
 
 
-LOCAL RES_STAT *
-New_Res_Stat( void )
+static bool
+register_callback( RES_STAT *s, void (*cbfunc)(int, short))
 {
-	RES_STAT *s;
+	assert(cbfunc != NULL);
+	assert(s != NULL);
+	assert(s->resolver_fd >= 0);
 
-	/* Allocate memory */
-	s = (RES_STAT *)malloc( sizeof( RES_STAT ));
-	if( ! s )
-	{
-		Log( LOG_EMERG, "Resolver: Can't allocate memory! [Resolve_Addr]" );
-		return NULL;
-	}
+	if (io_setnonblock(s->resolver_fd) &&
+		io_event_create(s->resolver_fd, IO_WANTREAD, cbfunc))
+			return true;
 
-	/* Initialize pipe for result */
-	if( pipe( s->pipe ) != 0 )
-	{
-		free( s );
-		Log( LOG_ALERT, "Resolver: Can't create output pipe: %s!", strerror( errno ));
-		return NULL;
-	}
+	Log( LOG_CRIT, "Resolver: Could not register callback function: %s!", strerror(errno));
+	Resolve_Shutdown(s);
+	return false;
+}
 
-	s->stage = 0;
-	s->bufpos = 0;
-	s->pid = -1;
 
-	return s;
-} /* New_Res_Stat */
+GLOBAL bool
+Resolve_Shutdown( RES_STAT *s)
+{
+	bool ret = false;
+
+	assert(s != NULL);
+	assert(s->resolver_fd >= 0);
 
+	if (s->resolver_fd >= 0)
+		ret = io_close(s->resolver_fd);
 
+	Resolve_Init(s);
+	return ret;
+}
+
+                
+/**
+ * Read result of resolver sub-process from pipe
+ */
+GLOBAL size_t
+Resolve_Read( RES_STAT *s, void* readbuf, size_t buflen)
+{
+	int err;
+	ssize_t bytes_read;
+
+	assert(buflen > 0);
+
+	/* Read result from pipe */
+	errno = 0;
+	bytes_read = read(s->resolver_fd, readbuf, buflen);
+	if (bytes_read < 0) {
+		if (errno != EAGAIN) {
+			err = errno;
+			Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror(err));
+			Resolve_Shutdown(s);
+			errno = err;
+			return 0;
+		}
+		return 0;
+	}
+
+	Resolve_Shutdown(s);
+	if (bytes_read == 0) {	/* EOF: lookup failed */
+#ifdef DEBUG
+		Log( LOG_DEBUG, "Resolver: Can't read result: EOF");
+#endif
+		return 0;
+	}
+
+	return (size_t)bytes_read;
+}
 /* -eof- */
+

+ 13 - 28
src/ngircd/resolve.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: resolve.h,v 1.8 2005/03/19 18:43:49 fw Exp $
+ * $Id: resolve.h,v 1.13 2006/05/10 21:24:02 alex Exp $
  *
  * Asynchronous resolver (header)
  */
@@ -17,39 +17,24 @@
 #ifndef __resolve_h__
 #define __resolve_h__
 
-
-#ifdef HAVE_SYS_SELECT_H
-#	include <sys/select.h>
-#endif
-#include <sys/types.h>
+#include "array.h"
 #include <netinet/in.h>
 
-
-typedef struct _Res_Stat
-{
-	int pid;			/* PID des Child-Prozess */
-	int pipe[2];			/* Pipe fuer IPC */
-	int stage;			/* Hostname/IP(0) or IDENT(1)? */
-	int bufpos;			/* Position in buffer */
-	char buffer[HOST_LEN];		/* Buffer */
+/* This struct must not be accessed directly */
+typedef struct _Res_Stat {
+	pid_t pid;			/* PID of resolver process */
+	int resolver_fd;		/* pipe fd for lookup result. */
 } RES_STAT;
 
 
-GLOBAL fd_set Resolver_FDs;
-
-
-GLOBAL void Resolve_Init PARAMS(( void ));
-
-#ifdef IDENTAUTH
-GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr_in *Addr, int Sock ));
-#else
-GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr_in *Addr ));
-#endif
-
-GLOBAL RES_STAT *Resolve_Name PARAMS(( char *Host ));
+#define Resolve_Getfd(x)		((x)->resolver_fd)
+#define Resolve_INPROGRESS(x)		((x)->resolver_fd >= 0)
 
+GLOBAL bool Resolve_Addr PARAMS(( RES_STAT *s, struct sockaddr_in *Addr, int identsock, void (*cbfunc)(int, short)));
+GLOBAL bool Resolve_Name PARAMS(( RES_STAT *s, const char *Host, void (*cbfunc)(int, short) ));
+GLOBAL size_t Resolve_Read PARAMS(( RES_STAT *s, void *buf, size_t buflen));
+GLOBAL void Resolve_Init PARAMS(( RES_STAT *s));
+GLOBAL bool Resolve_Shutdown PARAMS(( RES_STAT *s));
 
 #endif
-
-
 /* -eof- */

+ 113 - 111
src/portab/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -28,6 +28,9 @@
 # $Id: Makefile.am,v 1.8 2005/04/16 09:23:01 fw Exp $
 #
 
+
+SOURCES = $(libngportab_a_SOURCES) $(portabtest_SOURCES)
+
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -35,7 +38,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ../..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -49,7 +51,45 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+ANSI2KNR = @ANSI2KNR@
+check_PROGRAMS = portabtest$(EXEEXT)
+subdir = src/portab
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in ansi2knr.1 ansi2knr.c
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libngportab_a_AR = $(AR) $(ARFLAGS)
+libngportab_a_LIBADD =
+am_libngportab_a_OBJECTS = strlcpy$U.$(OBJEXT) strdup$U.$(OBJEXT) \
+	vsnprintf$U.$(OBJEXT)
+libngportab_a_OBJECTS = $(am_libngportab_a_OBJECTS)
+am_portabtest_OBJECTS = portabtest$U.$(OBJEXT)
+portabtest_OBJECTS = $(am_portabtest_OBJECTS)
+portabtest_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libngportab_a_SOURCES) $(portabtest_SOURCES)
+DIST_SOURCES = $(libngportab_a_SOURCES) $(portabtest_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -103,6 +143,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -123,6 +165,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -134,69 +177,47 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 AUTOMAKE_OPTIONS = ansi2knr
-
 noinst_LIBRARIES = libngportab.a
-
 libngportab_a_SOURCES = strlcpy.c strdup.c vsnprintf.c
-
-check_PROGRAMS = portabtest
-
 portabtest_SOURCES = portabtest.c
-
 portabtest_LDFLAGS = -L.
-
 portabtest_LDADD = -lngportab
-
 noinst_HEADERS = imp.h exp.h portab.h
-
 TESTS = portabtest
-subdir = src/portab
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-
-libngportab_a_AR = $(AR) cru
-libngportab_a_LIBADD =
-am_libngportab_a_OBJECTS = strlcpy$U.$(OBJEXT) strdup$U.$(OBJEXT) \
-	vsnprintf$U.$(OBJEXT)
-libngportab_a_OBJECTS = $(am_libngportab_a_OBJECTS)
-check_PROGRAMS = portabtest$(EXEEXT)
-am_portabtest_OBJECTS = portabtest$U.$(OBJEXT)
-portabtest_OBJECTS = $(am_portabtest_OBJECTS)
-portabtest_DEPENDENCIES =
-
-DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)/src
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/portabtest$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/strdup$U.Po ./$(DEPDIR)/strlcpy$U.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/vsnprintf$U.Po
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-DIST_SOURCES = $(libngportab_a_SOURCES) $(portabtest_SOURCES)
-HEADERS = $(noinst_HEADERS)
-
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am \
-	ansi2knr.1 ansi2knr.c
-SOURCES = $(libngportab_a_SOURCES) $(portabtest_SOURCES)
-
 all: all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .o .obj
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/portab/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  src/portab/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
-
-AR = ar
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
@@ -212,12 +233,10 @@ portabtest$(EXEEXT): $(portabtest_OBJECTS) $(portabtest_DEPENDENCIES)
 	$(LINK) $(portabtest_LDFLAGS) $(portabtest_OBJECTS) $(portabtest_LDADD) $(LIBS)
 
 mostlyclean-compile:
-	-rm -f *.$(OBJEXT) core *.core
+	-rm -f *.$(OBJEXT)
 
 distclean-compile:
 	-rm -f *.tab.c
-
-ANSI2KNR = @ANSI2KNR@
 ansi2knr: ansi2knr.$(OBJEXT)
 	$(LINK) ansi2knr.$(OBJEXT) $(LIBS)
 ansi2knr.$(OBJEXT): $(CONFIG_HEADER)
@@ -234,26 +253,18 @@ mostlyclean-kr:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsnprintf$U.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@	fi
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@	fi
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 portabtest_.c: portabtest.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/portabtest.c; then echo $(srcdir)/portabtest.c; else echo portabtest.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 strdup_.c: strdup.c $(ANSI2KNR)
@@ -266,14 +277,6 @@ portabtest_.$(OBJEXT) strdup_.$(OBJEXT) strlcpy_.$(OBJEXT) \
 vsnprintf_.$(OBJEXT) : $(ANSI2KNR)
 uninstall-info-am:
 
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
-tags: TAGS
-
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -282,6 +285,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	mkid -fID $$unique
+tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -293,10 +297,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
-
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -333,24 +338,24 @@ check-TESTS: $(TESTS)
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
 	      *" $$tst "*) \
-	        xpass=`expr $$xpass + 1`; \
-	        failed=`expr $$failed + 1`; \
-	        echo "XPASS: $$tst"; \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		echo "XPASS: $$tst"; \
 	      ;; \
 	      *) \
-	        echo "PASS: $$tst"; \
+		echo "PASS: $$tst"; \
 	      ;; \
 	      esac; \
 	    elif test $$? -ne 77; then \
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
 	      *" $$tst "*) \
-	        xfail=`expr $$xfail + 1`; \
-	        echo "XFAIL: $$tst"; \
+		xfail=`expr $$xfail + 1`; \
+		echo "XFAIL: $$tst"; \
 	      ;; \
 	      *) \
-	        failed=`expr $$failed + 1`; \
-	        echo "FAIL: $$tst"; \
+		failed=`expr $$failed + 1`; \
+		echo "FAIL: $$tst"; \
 	      ;; \
 	      esac; \
 	    else \
@@ -375,27 +380,23 @@ check-TESTS: $(TESTS)
 	  skipped=""; \
 	  if test "$$skip" -ne 0; then \
 	    skipped="($$skip tests were not run)"; \
-	    test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
 	      dashes="$$skipped"; \
 	  fi; \
 	  report=""; \
 	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
 	    report="Please report to $(PACKAGE_BUGREPORT)"; \
-	    test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
 	      dashes="$$report"; \
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
 	  echo "$$dashes"; \
 	  echo "$$banner"; \
-	  test -n "$$skipped" && echo "$$skipped"; \
-	  test -n "$$report" && echo "$$report"; \
+	  test -z "$$skipped" || echo "$$skipped"; \
+	  test -z "$$report" || echo "$$report"; \
 	  echo "$$dashes"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -409,7 +410,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -429,7 +430,6 @@ check-am: all-am
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
 all-am: Makefile $(ANSI2KNR) $(LIBRARIES) $(HEADERS)
-
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -450,7 +450,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -470,6 +470,8 @@ dvi: dvi-am
 
 dvi-am:
 
+html: html-am
+
 info: info-am
 
 info-am:
@@ -507,14 +509,14 @@ uninstall-am: uninstall-info-am
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
 	clean-checkPROGRAMS clean-generic clean-krextra \
 	clean-noinstLIBRARIES ctags distclean distclean-compile \
-	distclean-generic distclean-tags distdir dvi dvi-am info \
-	info-am install install-am install-data install-data-am \
-	install-exec install-exec-am install-info install-info-am \
-	install-man install-strip installcheck installcheck-am \
-	installdirs maintainer-clean maintainer-clean-generic \
-	maintainer-clean-local mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-kr pdf pdf-am ps ps-am tags \
-	uninstall uninstall-am uninstall-info-am
+	distclean-generic distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic maintainer-clean-local mostlyclean \
+	mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf \
+	pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
 
 
 maintainer-clean-local:

+ 1 - 4
src/portab/portab.h

@@ -8,7 +8,7 @@
  * (at your option) any later version.
  * Please read the file COPYING, README and AUTHORS for more information.
  *
- * $Id: portab.h,v 1.21 2005/04/16 09:23:01 fw Exp $
+ * $Id: portab.h,v 1.22 2005/07/31 20:13:11 alex Exp $
  *
  * Portability functions and declarations (header for libngbportab).
  */
@@ -65,9 +65,6 @@
 #endif
 
 
-/* keywords */
-#define LOCAL static
-
 /* datatypes */
 
 #ifndef PROTOTYPES

+ 3 - 3
src/portab/portabtest.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: portabtest.c,v 1.12 2005/03/19 18:43:50 fw Exp $";
+static char UNUSED id[] = "$Id: portabtest.c,v 1.13 2005/07/31 20:13:11 alex Exp $";
 
 #include "imp.h"
 #include <stdarg.h>
@@ -25,7 +25,7 @@ static char UNUSED id[] = "$Id: portabtest.c,v 1.12 2005/03/19 18:43:50 fw Exp $
 #include "exp.h"
 
 
-LOCAL void Panic PARAMS (( char *Reason, int Code ));
+static void Panic PARAMS (( char *Reason, int Code ));
 
 
 GLOBAL int
@@ -51,7 +51,7 @@ main( void )
 } /* portab_check_types */
 
 
-LOCAL void
+static void
 Panic( char *Reason, int Code )
 {
 	/* Oops, something failed!? */

+ 71 - 46
src/testsuite/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -27,7 +27,6 @@
 #
 # $Id: Makefile.am,v 1.14 2004/09/08 09:40:51 alex Exp $
 #
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -35,7 +34,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ../..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -49,7 +47,21 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+subdir = src/testsuite
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -103,6 +115,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -123,6 +137,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -134,11 +149,8 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 AUTOMAKE_OPTIONS = ../portab/ansi2knr
-
 INCLUDES = -I$(srcdir)/../portab
-
 EXTRA_DIST = \
 	README functions.inc getpid.sh \
 	start-server.sh stop-server.sh tests.sh stress-server.sh \
@@ -147,9 +159,7 @@ EXTRA_DIST = \
 	stress-A.e stress-B.e check-idle.e \
 	ngircd-test.conf
 
-
 check_SCRIPTS = ngircd-TEST-Binary tests.sh
-
 TESTS = start-server.sh \
 	connect-test \
 	channel-test \
@@ -157,21 +167,38 @@ TESTS = start-server.sh \
 	stress-server.sh \
 	stop-server.sh
 
-subdir = src/testsuite
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am
 all: all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/testsuite/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  src/testsuite/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 uninstall-info-am:
 tags: TAGS
 TAGS:
@@ -193,24 +220,24 @@ check-TESTS: $(TESTS)
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
 	      *" $$tst "*) \
-	        xpass=`expr $$xpass + 1`; \
-	        failed=`expr $$failed + 1`; \
-	        echo "XPASS: $$tst"; \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		echo "XPASS: $$tst"; \
 	      ;; \
 	      *) \
-	        echo "PASS: $$tst"; \
+		echo "PASS: $$tst"; \
 	      ;; \
 	      esac; \
 	    elif test $$? -ne 77; then \
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
 	      *" $$tst "*) \
-	        xfail=`expr $$xfail + 1`; \
-	        echo "XFAIL: $$tst"; \
+		xfail=`expr $$xfail + 1`; \
+		echo "XFAIL: $$tst"; \
 	      ;; \
 	      *) \
-	        failed=`expr $$failed + 1`; \
-	        echo "FAIL: $$tst"; \
+		failed=`expr $$failed + 1`; \
+		echo "FAIL: $$tst"; \
 	      ;; \
 	      esac; \
 	    else \
@@ -235,27 +262,23 @@ check-TESTS: $(TESTS)
 	  skipped=""; \
 	  if test "$$skip" -ne 0; then \
 	    skipped="($$skip tests were not run)"; \
-	    test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
 	      dashes="$$skipped"; \
 	  fi; \
 	  report=""; \
 	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
 	    report="Please report to $(PACKAGE_BUGREPORT)"; \
-	    test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
 	      dashes="$$report"; \
 	  fi; \
 	  dashes=`echo "$$dashes" | sed s/./=/g`; \
 	  echo "$$dashes"; \
 	  echo "$$banner"; \
-	  test -n "$$skipped" && echo "$$skipped"; \
-	  test -n "$$report" && echo "$$report"; \
+	  test -z "$$skipped" || echo "$$skipped"; \
+	  test -z "$$report" || echo "$$report"; \
 	  echo "$$dashes"; \
 	  test "$$failed" -eq 0; \
 	else :; fi
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -269,7 +292,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -289,7 +312,6 @@ check-am: all-am
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
 all-am: Makefile
-
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -310,7 +332,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -327,6 +349,8 @@ dvi: dvi-am
 
 dvi-am:
 
+html: html-am
+
 info: info-am
 
 info-am:
@@ -361,13 +385,14 @@ ps-am:
 uninstall-am: uninstall-info-am
 
 .PHONY: all all-am check check-TESTS check-am clean clean-generic \
-	clean-local distclean distclean-generic distdir dvi dvi-am info \
-	info-am install install-am install-data install-data-am \
-	install-exec install-exec-am install-info install-info-am \
-	install-man install-strip installcheck installcheck-am \
-	installdirs maintainer-clean maintainer-clean-generic \
-	maintainer-clean-local mostlyclean mostlyclean-generic pdf \
-	pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
+	clean-local distclean distclean-generic distdir dvi dvi-am \
+	html html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic maintainer-clean-local mostlyclean \
+	mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
 
 
 all:

+ 3 - 1
src/testsuite/stress-A.e

@@ -1,4 +1,6 @@
-# $Id: stress-A.e,v 1.1 2002/09/09 22:56:07 alex Exp $
+# $Id: stress-A.e,v 1.2 2005/08/12 21:35:12 alex Exp $
+
+set timeout 30
 
 spawn telnet localhost 6789
 expect {

+ 19 - 11
src/testsuite/stress-B.e

@@ -1,11 +1,13 @@
-# $Id: stress-B.e,v 1.1 2002/09/09 22:56:07 alex Exp $
+# $Id: stress-B.e,v 1.3 2005/12/30 22:12:28 alex Exp $
 
 send "user user . . :User\r"
 expect {
 	timeout { exit 1 }
-	"376"
+	" 376"
 }
 
+sleep 2
+
 send "oper TestOp 123\r"
 expect {
 	timeout { exit 1 }
@@ -13,53 +15,59 @@ expect {
 }
 expect {
 	timeout { exit 1 }
-	"381 test*"
+	" 381 test"
 }
 
+sleep 2
+
 send "join #channel\r"
 expect {
 	timeout { exit 1 }
-	":test*!~user@* JOIN :#channel"
+	" 353 * = #channel "
 }
 expect {
 	timeout { exit 1 }
-	"366"
+	" 366 * #channel :"
 }
 
 send "mode #channel\r"
 expect {
 	timeout { exit 1 }
-	"324 test* #channel"
+	" 324 test* #channel"
 }
 
 send "join #channel2\r"
 expect {
 	timeout { exit 1 }
-	":test*!~user@* JOIN :#channel2"
+	" 353 * = #channel2 "
 }
 expect {
 	timeout { exit 1 }
-	"366"
+	" 366 * #channel2 :"
 }
 
 send "names\r"
 expect {
 	timeout { exit 1 }
-	"366"
+	" 366 "
 }
 
+sleep 3
+
 send "part #channel2\r"
 expect {
 	timeout { exit 1 }
-	":test*!~user@* PART #channel2"
+	" PART #channel2 "
 }
 
 send "part #channel\r"
 expect {
 	timeout { exit 1 }
-	":test*!~user@* PART #channel"
+	" PART #channel "
 }
 
+sleep 1
+
 send "quit\r"
 expect {
 	timeout { exit 1 }

+ 11 - 1
src/testsuite/stress-server.sh

@@ -9,7 +9,7 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: stress-server.sh,v 1.15 2004/09/06 22:04:06 alex Exp $
+# $Id: stress-server.sh,v 1.16 2005/12/30 22:13:21 alex Exp $
 #
 
 # detect source directory
@@ -50,6 +50,16 @@ while [ ${no} -lt $CLIENTS ]; do
   no=`expr ${no} + 1`
 done
 
+# run first script and check if it succeeds
+echo_n "      checking stress script ..."
+expect tests/0.e > logs/stress-0.log 2> /dev/null
+if [ $? -ne 0 ]; then
+  echo " failure!"
+  exit 1
+else
+  echo " ok."
+fi
+
 no=0
 while [ ${no} -lt $CLIENTS ]; do
   expect tests/${no}.e > logs/stress-${no}.log 2> /dev/null &

+ 4 - 1
src/testsuite/wait-tests.sh

@@ -9,11 +9,14 @@
 # (at your option) any later version.
 # Please read the file COPYING, README and AUTHORS for more information.
 #
-# $Id: wait-tests.sh,v 1.4 2004/09/06 22:04:06 alex Exp $
+# $Id: wait-tests.sh,v 1.5 2005/08/12 21:34:19 alex Exp $
 #
 
 [ "$1" -gt 0 ] 2> /dev/null && MAX="$1" || MAX=5
 
+# detect source directory
+[ -z "$srcdir" ] && srcdir=`dirname $0`
+
 PS_FLAGS="-f"
 ps $PS_FLAGS >/dev/null 2>&1
 [ $? -ne 0 ] && PS_FLAGS="a"

+ 92 - 83
src/tool/Makefile.in

@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -27,6 +27,9 @@
 # $Id: Makefile.am,v 1.1 2003/01/13 12:20:16 alex Exp $
 #
 
+
+SOURCES = $(libngtool_a_SOURCES)
+
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -34,7 +37,6 @@ pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 top_builddir = ../..
-
 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
@@ -48,7 +50,40 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
+build_triplet = @build@
 host_triplet = @host@
+target_triplet = @target@
+ANSI2KNR = @ANSI2KNR@
+subdir = src/tool
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in ansi2knr.1 ansi2knr.c
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libngtool_a_AR = $(AR) $(ARFLAGS)
+libngtool_a_LIBADD =
+am_libngtool_a_OBJECTS = tool$U.$(OBJEXT)
+libngtool_a_OBJECTS = $(am_libngtool_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libngtool_a_SOURCES)
+DIST_SOURCES = $(libngtool_a_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMDEP_FALSE = @AMDEP_FALSE@
 AMDEP_TRUE = @AMDEP_TRUE@
@@ -102,6 +137,8 @@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
 bindir = @bindir@
 build = @build@
 build_alias = @build_alias@
@@ -122,6 +159,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localstatedir = @localstatedir@
 mandir = @mandir@
+mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
@@ -133,54 +171,44 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
-
 AUTOMAKE_OPTIONS = ansi2knr
-
 INCLUDES = -I$(srcdir)/../portab
-
 noinst_LIBRARIES = libngtool.a
-
 libngtool_a_SOURCES = tool.c
-
 noinst_HEADERS = tool.h
-subdir = src/tool
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-
-libngtool_a_AR = $(AR) cru
-libngtool_a_LIBADD =
-am_libngtool_a_OBJECTS = tool$U.$(OBJEXT)
-libngtool_a_OBJECTS = $(am_libngtool_a_OBJECTS)
-
-DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)/src
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/tool$U.Po
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-DIST_SOURCES = $(libngtool_a_SOURCES)
-HEADERS = $(noinst_HEADERS)
-
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am \
-	ansi2knr.1 ansi2knr.c
-SOURCES = $(libngtool_a_SOURCES)
-
 all: all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .o .obj
-$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/tool/Makefile'; \
 	cd $(top_srcdir) && \
 	  $(AUTOMAKE) --gnu  src/tool/Makefile
-Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
-
-AR = ar
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
 clean-noinstLIBRARIES:
 	-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
@@ -190,12 +218,10 @@ libngtool.a: $(libngtool_a_OBJECTS) $(libngtool_a_DEPENDENCIES)
 	$(RANLIB) libngtool.a
 
 mostlyclean-compile:
-	-rm -f *.$(OBJEXT) core *.core
+	-rm -f *.$(OBJEXT)
 
 distclean-compile:
 	-rm -f *.tab.c
-
-ANSI2KNR = @ANSI2KNR@
 ansi2knr: ansi2knr.$(OBJEXT)
 	$(LINK) ansi2knr.$(OBJEXT) $(LIBS)
 ansi2knr.$(OBJEXT): $(CONFIG_HEADER)
@@ -209,39 +235,23 @@ mostlyclean-kr:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tool$U.Po@am__quote@
 
 .c.o:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@	fi
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c $<
 
 .c.obj:
-@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@	fi
+@am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c `$(CYGPATH_W) '$<'`
 tool_.c: tool.c $(ANSI2KNR)
 	$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tool.c; then echo $(srcdir)/tool.c; else echo tool.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
 tool_.$(OBJEXT) : $(ANSI2KNR)
 uninstall-info-am:
 
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
-tags: TAGS
-
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
@@ -250,6 +260,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 	mkid -fID $$unique
+tags: TAGS
 
 TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -261,10 +272,11 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	  done | \
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$tags$$unique" \
-	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	     $$tags $$unique
-
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
 ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
@@ -287,10 +299,6 @@ GTAGS:
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
@@ -304,7 +312,7 @@ distdir: $(DISTFILES)
 	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
 	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
 	    dir="/$$dir"; \
-	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
 	  else \
 	    dir=''; \
 	  fi; \
@@ -322,7 +330,6 @@ distdir: $(DISTFILES)
 check-am: all-am
 check: check-am
 all-am: Makefile $(ANSI2KNR) $(LIBRARIES) $(HEADERS)
-
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -343,7 +350,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-	-rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
@@ -363,6 +370,8 @@ dvi: dvi-am
 
 dvi-am:
 
+html: html-am
+
 info: info-am
 
 info-am:
@@ -400,10 +409,10 @@ uninstall-am: uninstall-info-am
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
 	clean-krextra clean-noinstLIBRARIES ctags distclean \
 	distclean-compile distclean-generic distclean-tags distdir dvi \
-	dvi-am info info-am install install-am install-data \
-	install-data-am install-exec install-exec-am install-info \
-	install-info-am install-man install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic maintainer-clean-local mostlyclean \
 	mostlyclean-compile mostlyclean-generic mostlyclean-kr pdf \
 	pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am

+ 29 - 17
src/tool/tool.c

@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: tool.c,v 1.3 2005/03/19 18:43:52 fw Exp $";
+static char UNUSED id[] = "$Id: tool.c,v 1.6 2006/04/09 12:53:07 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -26,28 +26,40 @@ static char UNUSED id[] = "$Id: tool.c,v 1.3 2005/03/19 18:43:52 fw Exp $";
 #include "tool.h"
 
 
+/**
+ * Removes all leading and trailing whitespaces of a string.
+ * @param String The string to remove whitespaces from.
+ */
 GLOBAL void
-ngt_TrimStr( char *String )
+ngt_TrimStr(char *String)
 {
-	/* Mit ngt_TrimStr() werden fuehrende und folgende Leerzeichen,
-	 * Tabulatoren und Zeilenumbrueche (ASCII 10 und ASCII 13) aus
-	 * dem String entfernt. */
-	
-	char *start, *ptr;
+	char *start, *end;
 
-	assert( String != NULL );
+	assert(String != NULL);
 
 	start = String;
-	
-	/* Zeichen am Anfang pruefen ... */
-	while(( *start == ' ' ) || ( *start == 9 )) start++;
-	
-	/* Zeichen am Ende pruefen ... */
-	ptr = strchr( start, '\0' ) - 1;
-	while((( *ptr == ' ' ) || ( *ptr == 9 ) || ( *ptr == 10 ) || ( *ptr == 13 )) && ptr >= start ) ptr--;
-	*(++ptr) = '\0';
 
-	memmove( String, start, strlen( start ) + 1 );
+	/* Remove whitespaces at the beginning of the string ... */
+	while (*start == ' ' || *start == '\t' ||
+	       *start == '\n' || *start == '\r')
+		start++;
+
+	if (!*start) {
+		*String = '\0';
+		return;
+	}
+
+	/* ... and at the end: */
+	end = strchr(start, '\0');
+	end--;
+	while ((*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r')
+	       && end >= start)
+		end--;
+
+	/* New trailing NULL byte */
+	*(++end) = '\0';
+
+	memmove(String, start, (size_t)(end - start)+1);
 } /* ngt_TrimStr */