Quellcode durchsuchen

Merge branch 'maint'

* maint: (30 commits)
  Remove useless utc-time.cc
  Avoid crashing due to different ptr for key creating empty set
  Show CC for c and CXX for c++
  Rework compiler output
  This should not be silent
  Allow parallelizing bdlib/libelf builds
  Remove bogus -I
  Let src/ cleanup stringfix
  Make building src/crypto non-recursive
  Make building src/compat non-recursive
  Consistently use tabs
  This too should not use $*
  Stringfix is used for help.h
  Raise the MAX_LINE_LEN higher. "set" is 32018 bytes long on next.
  Fix build without debugging.
  Make module building non-recursive
  Support nested objects for creating .deps dirs
  $* doesn't make sense here.
  Show these lines when not running -s
  Re-enable TCL by default now that the warnings are fixed.
  ...

Conflicts:
	Makefile.in
	build/autotools/configure.ac
	configure
	lib/Makefile.in
	src/Makefile.in
	src/generate_defs.sh
Bryan Drewery vor 11 Jahren
Ursprung
Commit
fe656a6240

+ 0 - 1
.gitignore

@@ -12,7 +12,6 @@
 /hub
 /leaf.*
 /hub.*
-/utctime
 /wraith
 /ts
 /...

+ 13 - 73
Makefile.in

@@ -12,7 +12,7 @@ VPATH = @srcdir@
 CCDEPMODE = @CCDEPMODE@
 BINEXEC = wraith@EXEEXT@
 
-STATICMAKEFILES = lib/Makefile src/mod/Makefile src/crypto/Makefile src/compat/Makefile src/Makefile Makefile
+STATICMAKEFILES = lib/Makefile src/Makefile Makefile
 CONFIGFILES = build/config.cache build/config.log build/config.status src/config.h src/buildinfo.h
 
 DISTROFILES = README.md LICENSE build doc scripts lib Makefile.in build.sh configure src BSDmakefile
@@ -26,13 +26,12 @@ VERSION 	:= $(shell git describe)
 DISTRIB = wraith-$(VERSION)
 
 HELPFILE = doc/help.txt
-SETTINGSFILE = doc/settings.txt
-RESPONSESFILE = doc/responses.txt
 
 # defaults
 CXX = @CXX@
-LD = @CXX@
 CC = @CC@
+LD_DYNAMIC = @CXX@
+LD_STATIC = @CXX@ @STATIC@
 LD_DEBUG = @CXX@
 STRIP = @STRIP@
 DIFF = @DIFF@
@@ -47,20 +46,18 @@ CXXFLAGS = @CXXFLAGS@ $(CFLGS) @GCC3_CXXFLAGS@ -fno-rtti
 
 MAKEFLAGS = -s
 
-STRINGFIX = src/stringfix
-
-MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX) @STATIC@' 'CC=$(CC) @STATIC@' 'LD=$(LD) @STATIC@' 'INCLUDES=$(INCLUDES)' \
+MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD_STATIC)' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_STATIC' 'STRINGFIX=$(STRINGFIX)' \
+'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_STATIC' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
 
-MAKE_DYNAMIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'LD=$(LD)' 'INCLUDES=$(INCLUDES)' \
+MAKE_DYNAMIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'LD=$(LD_DYNAMIC)' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_DYNAMIC' 'STRINGFIX=$(STRINGFIX)' \
+'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_DYNAMIC' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
 MAKE_DEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'LD=$(LD_DEBUG) -g' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
-'STRIP=touch' 'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS) -DBIN_TYPE_DYNAMIC' 'STRINGFIX=' \
+'STRIP=touch' 'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS) -DBIN_TYPE_DYNAMIC' \
 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(debug)'
 
 MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
@@ -69,27 +66,24 @@ MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'STRIP=touch' 'INCLU
 
 MAKE_UTILS_NR = $(MAKE) 'CXX=$(CXX)' 'CC=$(CC)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
 'CCDEPMODE=$(CCDEPMODE)' \
-'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD) -g'
+'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD_DYNAMIC) -g'
 
 MAKE_CONFIG = $(MAKE) 'MAKE=$(MAKE)'
 
-.PHONY: checkclean.static checkclean.dynamic checkclean.debug lib wraith dwraith lib.debug debug test general crypto utils sorthelp makehelp makeset makeres stringfix set res help sort indent tar distrib distclean clean cleanutils test all dynamic static tags
+.PHONY: checkclean.static checkclean.dynamic checkclean.debug lib wraith dwraith lib.debug debug test general sorthelp sort indent tar distrib distclean clean cleanutils test all dynamic static tags
 
 all: dynamic
 
 test:
 
 cleanutils:
-	@rm -f $(STRINGFIX) src/sorthelp@EXEEXT@ src/makehelp@EXEEXT@ src/makeres@EXEEXT@ src/makeset@EXEEXT@
+	@rm -f src/sorthelp@EXEEXT@
 
 clean:  cleanutils
 	+@cd src && $(MAKE) clean
-	+@cd src/compat && $(MAKE) clean
-	+@cd src/crypto && $(MAKE) clean
-	+@cd src/mod && $(MAKE) clean
 	-+@cd lib && $(MAKE) clean
 	@rm -f $(BINEXEC) build/stamp.* *~ src/*~ configure.temp .mangled stamp.*
-	@rm -f src/help.h src/response.h src/responses.h utctime@EXEEXT@ ts@EXEEXT@
+	@rm -f ts@EXEEXT@
 
 distclean: clean
 	@rm -rf *-$(VERSION)/ autom4te.cache/ autoscan.log configure.scan
@@ -144,61 +138,10 @@ sort: sorthelp
 	@(src/sorthelp@EXEEXT@ $(HELPFILE) $(HELPFILE) || (cp -f help.txt~ $(HELPFILE); echo "Sort failed, restoring backup."))
 	@rm -f help.txt~
 
-help: makehelp
-	@src/makehelp@EXEEXT@ $(HELPFILE) src/help.h~
-	@(if [ ! -f src/help.h ]; then \
-	touch src/help.h; \
-	fi)
-	@(if test "x`$(DIFF) -qurN src/help.h~ src/help.h`" != "x"; then \
-	cp -f src/help.h~ src/help.h; \
-	fi)
-
-set: makeset
-	@src/makeset@EXEEXT@ $(SETTINGSFILE) src/set_default.h~
-	@(if [ ! -f src/set_default.h ]; then \
-	touch src/set_default.h; \
-	fi)
-	@(if test "x`$(DIFF) -qurN src/set_default.h~ src/set_default.h`" != "x"; then \
-	cp -f src/set_default.h~ src/set_default.h; \
-	fi)
-
-
-res: makeres
-	@src/makeres@EXEEXT@ $(RESPONSESFILE) src/ 1
-	@(if [ ! -f src/response.h ]; then \
-	touch src/response.h; \
-	fi)
-	@(if [ ! -f src/responses.h ]; then \
-	touch src/responses.h; \
-	fi)
-	@(if test "x`$(DIFF) -qurN src/response.h~ src/response.h`" != "x"; then \
-	cp -f src/response.h~ src/response.h; \
-	fi)
-	@(if test "x`$(DIFF) -qurN src/responses.h~ src/responses.h`" != "x"; then \
-	cp -f src/responses.h~ src/responses.h; \
-	fi)
-
-stringfix: src/stringfix.cc src/config.h
-	+@cd src && ${MAKE_UTILS} stringfix
-
-makeres: src/makeres.cc
-	+@cd src && ${MAKE_UTILS} makeres
-
-makeset: src/makeset.cc
-	+@cd src && ${MAKE_UTILS} makeset
-
-makehelp: src/makehelp.cc
-	+@cd src && ${MAKE_UTILS} makehelp
-
 sorthelp: src/sorthelp.cc
 	+@cd src && ${MAKE_UTILS} sorthelp
 
-utils: stringfix makehelp
-
-crypto:
-	+@cd src/crypto && ${MAKE_UTILS} crypto
-
-general: help res set stringfix
+general:
 
 .NOTPARALLEL: checkclean.static checkclean.dynamic checkclean.debug
 
@@ -231,7 +174,6 @@ dynamic: checkclean.dynamic lib general
 	@echo "Making dynamic binary"
 	@echo ""
 	@echo ""
-	+@cd src/mod && $(MAKE_DYNAMIC) static
 	+@cd src && $(MAKE_DYNAMIC) $(BINEXEC)
 	@echo ""
 
@@ -240,7 +182,6 @@ static: checkclean.static lib general
 	@echo "Making static binary"
 	@echo ""
 	@echo ""
-	+@cd src/mod && $(MAKE_STATIC) static
 	+@cd src && $(MAKE_STATIC) $(BINEXEC)
 	@echo ""
 
@@ -254,7 +195,6 @@ debug: checkclean.debug lib.debug general
 	@echo "Making debug binary"
 	@echo ""
 	@echo ""
-	+@cd src/mod && $(MAKE_DEBUG) static
 	+@cd src && $(MAKE_DEBUG) $(BINEXEC)
 	@echo ""
 

+ 5 - 2
build/autotools/configure.ac

@@ -231,10 +231,9 @@ AC_CACHE_SAVE
 
 EGG_SUBST_VERSION
 #FIND_WRAPS
-EGG_SUBST_MOD_UPDIR
 DO_DEPS
 
-AC_CONFIG_FILES([Makefile lib/Makefile src/Makefile src/compat/Makefile src/crypto/Makefile src/mod/Makefile src/buildinfo.h])
+AC_CONFIG_FILES([Makefile lib/Makefile src/Makefile src/buildinfo.h])
 
 AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member])
 AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member])
@@ -263,6 +262,10 @@ if test -d .git; then
   git submodule init
   git submodule update
   git submodule foreach --recursive git clean -fdx
+  # Restore as it may have been removed by an older 'make distclean'
+  if ! test -f src/response.h; then
+    git checkout src/response.h
+  fi
 fi
 ]
 

+ 0 - 20
build/autotools/includes/acinclude.m4

@@ -710,26 +710,6 @@ AC_SUBST(NUMVER)dnl
 ])
 
 
-dnl  EGG_SUBST_MOD_UPDIR()
-dnl
-dnl  Since module's Makefiles aren't generated by configure, some
-dnl  paths in src/mod/Makefile.in take care of them. For correct
-dnl  path "calculation", we need to keep absolute paths in mind
-dnl  (which don't need a "../" pre-pended).
-AC_DEFUN([EGG_SUBST_MOD_UPDIR],
-[
-case "$srcdir" in
-  [[\\/]]* | ?:[[\\/]]*)
-    MOD_UPDIR=""
-  ;;
-  *)
-    MOD_UPDIR="../"
-  ;;
-esac
-AC_SUBST(MOD_UPDIR)dnl
-])dnl
-
-
 dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS)
 dnl
 dnl Replace FILE-NAME if the newly created contents differs from the existing

+ 10 - 4
build/autotools/includes/depend.m4

@@ -24,13 +24,13 @@ AC_SUBST(GCC4DEB)dnl
 
 AC_DEFUN([DO_DEPS],
 [
-files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
+files="src/Makefile.in"
 for mf in $files; do
   # Strip MF so we end up with the name of the file.
   mf=${mf%%:*}
-  dirpart=${mf%/*}
-  rm -f "$dirpart/.deps/includes"
-  test -d "$dirpart/.deps" || mkdir "$dirpart/.deps"
+  dirmf=${mf%/*}
+  rm -f "$dirmf/.deps/includes"
+  test -d "$dirmf/.deps" || mkdir "$dirmf/.deps"
   for file in `sed -n -e '
     /^OBJS = .*\\\\$/ {
       s/^OBJS = //
@@ -43,6 +43,12 @@ for mf in $files; do
     }
     /^OBJS = / s/^OBJS = //p' < "$mf"`;
   do
+    dirpart="${dirmf}/${file}"
+    dirpart="${dirpart%/*}"
+    if [[ "${dirpart}" != "${dirmf}" ]]; then
+      test -d "${dirpart}/.deps" || mkdir "${dirpart}/.deps"
+    fi
+    file="${file##*/}"
     suffix=${file##*.}
     base=${file%%.*}
     test -f "$dirpart/$base.cc" || test -f "$dirpart/$base.c" || continue

+ 61 - 36
build/build.mk

@@ -1,72 +1,97 @@
 depcomp = /bin/sh $(top_srcdir)/build/autotools/depcomp
 
-.SUFFIXES:
-.SUFFIXES: .c .cc .h .o .So
+STRINGFIX= $(srcdir)/stringfix
 
-.cc.So:
-	@echo -e "{CC}	\033[1m$*\033[0m"
-	set -e; trap "rm -f '.deps/$*.TPo' $*.ii $*.fail; exit 1" 1 2 3 5 10 13 15; \
+$(STRINGFIX): $(STRINGFIX).cc
+	@echo -e "[CXX]	\033[1m$@\033[0m"
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< $(LDFLAGS) -o $(STRINGFIX)
+
+# Cannot use .SUFFIXES as it won't allow a dependency on $(STRINGFIX)
+
+%.So: %.cc $(STRINGFIX)
+	@echo -e "{CXX}	\033[1m$<\033[0m"
+	file="$*"; \
+	dirname="$${file%/*}"; \
+	if [ "$${dirname}" = "$${file}" ]; then dirname=.; fi; \
+	file="$${file##*/}"; \
+	deps="$${dirname}/.deps/$${file}"; \
+	set -e; trap "rm -f "$${deps}.TPo" $*.ii $*.fail; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if { { $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CXXFLAGS) $(CPPFLAGS) -E $< || :> $*.fail; } | \
-	    $(top_srcdir)/src/stringfix > $*.ii; } && ! [ -f $*.fail ]; then \
-	    echo '$@: $(top_srcdir)/src/stringfix' >> '.deps/$*.TPo'; \
-	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
+	  if { { $(CXX) -MT '$@' -MD -MP -MF "$${deps}.TPo" $(CXXFLAGS) $(CPPFLAGS) -E $< || :> $*.fail; } | \
+	    $(STRINGFIX) > $*.ii; } && ! [ -f $*.fail ]; then \
+	    echo '$@: $(STRINGFIX)' >> "$${deps}.TPo"; \
+	    mv "$${deps}.TPo" "$${deps}.Po"; \
 	   else \
-	     rm -f '.deps/$*.TPo' $*.ii $*.fail; \
+	     rm -f "$${deps}.TPo" $*.ii $*.fail; \
 	     exit 1; \
 	  fi; \
 	else \
-	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.ii; \
+	  libtool=no source='$<' object='$@' depfile="$${deps}.Po" tmpdepfile="$${deps}.TPo" depmode=$(CCDEPMODE) $(depcomp) \
+	  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -E $< | $(STRINGFIX) > $*.ii; \
 	fi; \
 	$(CXX) $(CXXFLAGS) -c $*.ii -o $@; \
 	rm -f $*.ii
 
-.c.So:
-	@echo -e "{C }	\033[1m$*\033[0m"
-	set -e; trap "rm -f '.deps/$*.TPo' $*.i $*.fail; exit 1" 1 2 3 5 10 13 15; \
+%.So: %.c $(STRINGFIX)
+	@echo -e "{CC }	\033[1m$<\033[0m"
+	file="$*"; \
+	dirname="$${file%/*}"; \
+	if [ "$${dirname}" = "$${file}" ]; then dirname=.; fi; \
+	file="$${file##*/}"; \
+	deps="$${dirname}/.deps/$${file}"; \
+	set -e; trap "rm -f "$${deps}.TPo" $*.i $*.fail; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if { { $(CC) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CPPFLAGS) $(CFLAGS) -E $< || :> $*.fail; } | \
-	    $(top_srcdir)/src/stringfix > $*.i; } && ! [ -f $*.fail ]; then \
-	    echo '$@: $(top_srcdir)/src/stringfix' >> '.deps/$*.TPo'; \
-	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
+	  if { { $(CC) -MT '$@' -MD -MP -MF "$${deps}.TPo" $(CPPFLAGS) $(CFLAGS) -E $< || :> $*.fail; } | \
+	    $(STRINGFIX) > $*.i; } && ! [ -f $*.fail ]; then \
+	    echo '$@: $(STRINGFIX)' >> "$${deps}.TPo"; \
+	    mv "$${deps}.TPo" "$${deps}.Po"; \
 	   else \
-	     rm -f '.deps/$*.TPo' $*.i $*.fail; \
+	     rm -f "$${deps}.TPo" $*.i $*.fail; \
 	     exit 1; \
 	  fi; \
 	else \
-	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
-	  $(CC) $(CPPFLAGS) $(CFLAGS) -E $< | $(top_srcdir)/src/stringfix > $*.i; \
+	  libtool=no source='$<' object='$@' depfile="$${deps}.Po" tmpdepfile="$${deps}.TPo" depmode=$(CCDEPMODE) $(depcomp) \
+	  $(CC) $(CPPFLAGS) $(CFLAGS) -E $< | $(STRINGFIX) > $*.i; \
 	fi; \
 	$(CC) $(CFLAGS) -c $*.i -o $@; \
 	rm -f $*.i
 
-.cc.o:
-	@echo -e "[CC]	\033[1m$*\033[0m"
-	set -e; trap "rm -f '.deps/$*.TPo'; exit 1" 1 2 3 5 10 13 15; \
+%.o: %.cc
+	@echo -e "[CXX]	\033[1m$<\033[0m"
+	file="$*"; \
+	dirname="$${file%/*}"; \
+	if [ "$${dirname}" = "$${file}" ]; then dirname=.; fi; \
+	file="$${file##*/}"; \
+	deps="$${dirname}/.deps/$${file}"; \
+	set -e; trap "rm -f "$${deps}.TPo"; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if $(CXX) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@; then \
-	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
+	  if $(CXX) -MT '$@' -MD -MP -MF "$${deps}.TPo" $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@; then \
+	    mv "$${deps}.TPo" "$${deps}.Po"; \
 	   else \
-	     rm -f '.deps/$*.TPo'; \
+	     rm -f "$${deps}.TPo"; \
 	     exit 1; \
 	  fi; \
 	else \
-	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
+	  libtool=no source='$<' object='$@' depfile="$${deps}.Po" tmpdepfile="$${deps}.TPo" depmode=$(CCDEPMODE) $(depcomp) \
 	  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@; \
 	fi
 
-.c.o:
-	@echo -e "[C]	\033[1m$*\033[0m"
-	set -e; trap "rm -f '.deps/$*.TPo'; exit 1" 1 2 3 5 10 13 15; \
+%.o: %.c
+	@echo -e "[CC ]	\033[1m$<\033[0m"
+	file="$*"; \
+	dirname="$${file%/*}"; \
+	if [ "$${dirname}" = "$${file}" ]; then dirname=.; fi; \
+	file="$${file##*/}"; \
+	deps="$${dirname}/.deps/$${file}"; \
+	set -e; trap "rm -f "$${deps}.TPo"; exit 1" 1 2 3 5 10 13 15; \
 	if [ "$(CCDEPMODE)" = "gcc3" ]; then \
-	  if $(CC) -MT '$@' -MD -MP -MF '.deps/$*.TPo' $(CPPFLAGS) $(CFLAGS) -c $< -o $@; then \
-	    mv '.deps/$*.TPo' '.deps/$*.Po'; \
+	  if $(CC) -MT '$@' -MD -MP -MF "$${deps}.TPo" $(CPPFLAGS) $(CFLAGS) -c $< -o $@; then \
+	    mv "$${deps}.TPo" "$${deps}.Po"; \
 	   else \
-	     rm -f '.deps/$*.TPo'; \
+	     rm -f "$${deps}.TPo"; \
 	     exit 1; \
 	  fi; \
 	else \
-	  libtool=no source='$<' object='$@' depfile='.deps/$*.Po' tmpdepfile='.deps/$*.TPo' depmode=$(CCDEPMODE) $(depcomp) \
+	  libtool=no source='$<' object='$@' depfile="$${deps}.Po" tmpdepfile="$${deps}.TPo" depmode=$(CCDEPMODE) $(depcomp) \
 	  $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@; \
 	fi

+ 42 - 0
build/makehelp.sh

@@ -0,0 +1,42 @@
+#! /bin/sh
+
+echo "/* Generated by $0 */"
+echo "#include \"cmds.h\""
+echo "help_t help[] = {"
+needcomma=0
+IFS="
+"
+sed -e 's,["],\\&,g' | while read -r line; do
+	if [ -z "${line%%:*}" ]; then
+		if [ ${needcomma} -eq 1 ]; then
+			printf "\""
+			[ ${garble} -eq 1 ] && printf ")"
+			printf "},\n"
+		fi
+		line="${line#:}"
+		garble=0
+		if [ "${line%:}" != "${line}" ]; then
+			garble=1
+			line="${line%:}"
+		fi
+		type="${line%:*}"
+		cmd="${line#*:}"
+		[ "${cmd}" = "end" ] && break
+		case ${type} in
+			hub)  type_int=1 ;;
+			leaf) type_int=2 ;;
+			*)    type_int=0 ;;
+		esac
+
+		if [ ${garble} -eq 0 ]; then
+			printf "  {%d, \"%s\", %d, \"" ${type_int} "${cmd}" ${garble}
+		else
+			printf "  {%d, \"%s\", %d, STR(\"" ${type_int} "${cmd}" ${garble}
+	fi
+		needcomma=0
+	else
+		printf "%s\\\n" "${line}"
+		needcomma=1
+	fi
+done
+echo "};"

+ 36 - 0
build/makeres.sh

@@ -0,0 +1,36 @@
+#! /bin/sh
+
+echo "/* Generated by $0 */"
+needcomma=0
+types=
+while read -r line; do
+	[ -z "${line%%#*}" ] && continue # skip comments
+	if [ -z "${line%%:*}" ]; then
+		[ ${needcomma} -eq 1 ] && printf ",\n};\n\n"
+		type="${line#:}"
+		[ "${type}" = "end" ] && break
+		printf "static const char* res_%s[] = {\n" "${type}"
+		needcomma=0
+		types="${types}${types:+ }${type}"
+	else
+		[ ${needcomma} -eq 1 ] && printf ",\n"
+		printf "\t\"%s\"" "${line}"
+		needcomma=1
+	fi
+done
+
+echo "typedef struct {"
+echo "  const char*  name;"
+echo "  const char** res;"
+echo "  const size_t size;"
+echo "} res_t;"
+echo
+echo "static const res_t res[] = {"
+needcomma=0
+for type in ${types}; do
+	[ ${needcomma} -eq 1 ] && printf ",\n"
+	printf "\t{\"%s\",\tres_%s,\tsizeof(res_%s)/sizeof(res_%s[0])}" "${type}" "${type}" "${type}" "${type}"
+	needcomma=1
+done
+echo
+echo "};"

+ 18 - 0
build/makeset.sh

@@ -0,0 +1,18 @@
+#! /bin/sh
+
+echo "/* Generated by $0 */"
+needcomma=0
+while read -r line; do
+	[ -z "${line%%#*}" ] && continue # skip comments
+	if [ -z "${line%%:*}" ]; then
+		[ ${needcomma} -eq 1 ] && printf "\"\n\n"
+		type="${line#:}"
+		[ "${type}" = "end" ] && break
+		printf "#define DEFAULT_%s \"%c\n" $(echo "${type}" | tr '[:lower:]' '[:upper:]') '\'
+		needcomma=0
+	else
+		[ ${needcomma} -eq 1 ] && printf ",%c\n" '\'
+		printf "%s" "${line}"
+		needcomma=1
+	fi
+done

+ 15 - 19
configure

@@ -628,7 +628,6 @@ ac_func_list=
 enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 subdirs
-MOD_UPDIR
 NUMVER
 VERSION
 LIBOBJS
@@ -9155,23 +9154,13 @@ _ACEOF
 
 #FIND_WRAPS
 
-case "$srcdir" in
-  [\\/]* | ?:[\\/]*)
-    MOD_UPDIR=""
-  ;;
-  *)
-    MOD_UPDIR="../"
-  ;;
-esac
-
-
-files="src/Makefile.in src/compat/Makefile.in src/crypto/Makefile.in src/mod/channels.mod/Makefile src/mod/compress.mod/Makefile src/mod/console.mod/Makefile src/mod/ctcp.mod/Makefile src/mod/irc.mod/Makefile src/mod/server.mod/Makefile src/mod/share.mod/Makefile src/mod/transfer.mod/Makefile src/mod/update.mod/Makefile"
+files="src/Makefile.in"
 for mf in $files; do
   # Strip MF so we end up with the name of the file.
   mf=${mf%%:*}
-  dirpart=${mf%/*}
-  rm -f "$dirpart/.deps/includes"
-  test -d "$dirpart/.deps" || mkdir "$dirpart/.deps"
+  dirmf=${mf%/*}
+  rm -f "$dirmf/.deps/includes"
+  test -d "$dirmf/.deps" || mkdir "$dirmf/.deps"
   for file in `sed -n -e '
     /^OBJS = .*\\\\$/ {
       s/^OBJS = //
@@ -9184,6 +9173,12 @@ for mf in $files; do
     }
     /^OBJS = / s/^OBJS = //p' < "$mf"`;
   do
+    dirpart="${dirmf}/${file}"
+    dirpart="${dirpart%/*}"
+    if [ "${dirpart}" != "${dirmf}" ]; then
+      test -d "${dirpart}/.deps" || mkdir "${dirpart}/.deps"
+    fi
+    file="${file##*/}"
     suffix=${file##*.}
     base=${file%%.*}
     test -f "$dirpart/$base.cc" || test -f "$dirpart/$base.c" || continue
@@ -9199,7 +9194,7 @@ for mf in $files; do
 done
 
 
-ac_config_files="$ac_config_files Makefile lib/Makefile src/Makefile src/compat/Makefile src/crypto/Makefile src/mod/Makefile src/buildinfo.h"
+ac_config_files="$ac_config_files Makefile lib/Makefile src/Makefile src/buildinfo.h"
 
 
 
@@ -9229,6 +9224,10 @@ if test -d .git; then
   git submodule init
   git submodule update
   git submodule foreach --recursive git clean -fdx
+  # Restore as it may have been removed by an older 'make distclean'
+  if ! test -f src/response.h; then
+    git checkout src/response.h
+  fi
 fi
 
 
@@ -9937,9 +9936,6 @@ do
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-    "src/compat/Makefile") CONFIG_FILES="$CONFIG_FILES src/compat/Makefile" ;;
-    "src/crypto/Makefile") CONFIG_FILES="$CONFIG_FILES src/crypto/Makefile" ;;
-    "src/mod/Makefile") CONFIG_FILES="$CONFIG_FILES src/mod/Makefile" ;;
     "src/buildinfo.h") CONFIG_FILES="$CONFIG_FILES src/buildinfo.h" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;

+ 2 - 0
doc/UPDATES

@@ -11,6 +11,8 @@ maint
   * Fix simulated terminal mode (-nt) not having color supported.
   * Fix race between DCC and terminal output which could result in
     bolds being backwards (#86).
+  * Fix TCL warnings during build if TCL is not being used.
+  * Rework the build to parallelize better and rebuild some things less often.
 
 1.4.5
   * Remove ahbl as it now positively identifies all hosts as abusive

+ 1 - 1
doc/responses.txt

@@ -15,7 +15,7 @@
 :manualop
  Manual opping is not allowed
 :manualopped
- Manuaally opped
+ Manually opped
 :closed
  Channel is closed
 :flood

+ 5 - 6
lib/Makefile.in

@@ -8,7 +8,7 @@ VPATH = @srcdir@
 
 #include $(top_srcdir)/build/build.mk
 
-.PHONY: default clean distclean normal debug general buildcheck notice notice_debug build units libelf libelf_notice
+.PHONY: default clean distclean normal debug general buildcheck notice notice_debug build units libelf libelf_notice bdlib
 
 default: normal
 
@@ -41,14 +41,13 @@ $(top_srcdir)/lib/libelf/lib/libelf.a: libelf_notice
 
 libelf: @LIBELF_BUNDLED@
 
-bdlib/libbdlib.a:
+$(top_srcdir)/lib/bdlib/libbdlib.a:
 	+@cd bdlib && $(MAKE)
 
-build: bdlib/libbdlib.a
-	+@$(MAKE) libelf
+bdlib: $(top_srcdir)/lib/bdlib/libbdlib.a
 
-build.debug: bdlib/libbdlib.a
-	+@$(MAKE) libelf
+build: $(top_srcdir)/lib/bdlib/libbdlib.a @LIBELF_BUNDLED@
+build.debug: $(top_srcdir)/lib/bdlib/libbdlib.a @LIBELF_BUNDLED@
 
 buildcheck: build
 

+ 1 - 5
src/.gitignore

@@ -4,15 +4,11 @@
 /_*.cc
 /*~
 /help.h
-/response.h
-/responses.h
+/responses.cc
 /.deps
 /.defs
 /stringfix
-/makehelp
 /sorthelp
-/makeres
-/makeset
 /set_default.h
 *.o
 *.So

+ 50 - 47
src/Makefile.in

@@ -11,6 +11,9 @@ CXXFLAGS = $(CXXFLAGS)
 CFLAGS = $(CFLGS)
 CPPFLAGS = @CPPFLAGS@ -I. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/pack @DEFS@ $(INCLUDES) '-DCOMMIT="$(COMMIT)"' '-DBRANCH="$(BRANCH)"' -DBUILDTS=$(BUILDTS) '-DVERSION="$(VERSION)"'
 LDFLAGS = @LDFLAGS@
+SETTINGSFILE = $(top_srcdir)/doc/settings.txt
+RESPONSESFILE = $(top_srcdir)/doc/responses.txt
+HELPFILE = $(top_srcdir)/doc/help.txt
 
 include $(top_srcdir)/build/build.mk
 
@@ -57,17 +60,30 @@ OBJS = auth.So \
 	sprintf.So \
 	userent.So \
 	userrec.So \
-	users.So
-
-MODOBJS = mod/channels.mod/channels.So \
-        mod/console.mod/console.So \
-        mod/ctcp.mod/ctcp.So \
-        mod/irc.mod/irc.So \
-        mod/server.mod/server.So \
-        mod/share.mod/share.So \
-        mod/transfer.mod/transfer.So \
-        mod/update.mod/update.So
-
+	users.So \
+	mod/channels.mod/channels.So \
+	mod/console.mod/console.So \
+	mod/ctcp.mod/ctcp.So \
+	mod/irc.mod/irc.So \
+	mod/server.mod/server.So \
+	mod/share.mod/share.So \
+	mod/transfer.mod/transfer.So \
+	mod/update.mod/update.So \
+	compat/dirname.o \
+	compat/dn_expand.o \
+	compat/inet_ntop.o \
+	compat/snprintf.o \
+	compat/memcpy.o \
+	compat/memmem.o \
+	compat/memset.o \
+	compat/memutil.o \
+	compat/strcasecmp.o \
+	compat/strftime.o \
+	compat/strlcpy.o \
+	compat/strsep.o \
+	crypto/aes_util.o \
+	crypto/bf_util.o \
+	crypto/dh_util.o
 
 MAKE_GENERIC = $(MAKE) 'MAKE=$(MAKE)' 'MAKEFLAGS=$(MAKEFLAGS)' 'CXX=$(CXX)' 'LD=$(LD)' 'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS)' 'CCDEPMODE=$(CCDEPMODE)'
 
@@ -76,57 +92,44 @@ blah:
 	@echo "Use the build script."
 	@echo ""
 
-makeres: makeres.cc ../lib/bdlib/libbdlib.a
-	@echo -e "Compiling: \033[1mmakeres\033[0m"
-	@$(CXX) $(CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a $(LDFLAGS) -o $@
-	@$(STRIP) $@@EXEEXT@
+set.cc: set_default.h
 
-makeset: makeset.cc ../lib/bdlib/libbdlib.a
-	@echo -e "Compiling: \033[1mmakeset\033[0m"
-	@$(CXX) $(CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a $(LDFLAGS) -o $@
-	@$(STRIP) $@@EXEEXT@
+set_default.h: $(SETTINGSFILE) $(top_srcdir)/build/makeset.sh
+	@echo -e "[GEN]	\033[1m$<\033[0m -> \033[1m$@\033[0m"
+	$(top_srcdir)/build/makeset.sh < $(SETTINGSFILE) > $@
 
-makehelp: makehelp.cc ../lib/bdlib/libbdlib.a
-	@echo -e "Compiling: \033[1mmakehelp\033[0m"
-	@$(CXX) $(CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a $(LDFLAGS) -o $@
-	@$(STRIP) $@@EXEEXT@
+response.cc: responses.cc
 
-sorthelp: sorthelp.cc ../lib/bdlib/libbdlib.a
-	@echo -e "Compiling: \033[1msorthelp\033[0m"
-	@$(CXX) $(CPPFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/pack $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a $(LDFLAGS) -o $@
-	@$(STRIP) $@@EXEEXT@
+responses.cc: $(RESPONSESFILE) $(top_srcdir)/build/makeres.sh
+	@echo -e "[GEN]	\033[1m$<\033[0m -> \033[1m$@\033[0m"
+	$(top_srcdir)/build/makeres.sh < $(RESPONSESFILE) > $@
 
-stringfix: stringfix.cc common.h config.h eggdrop.h
-	@echo -e "Compiling: \033[1mstringfix\033[0m"
-	@$(CXX) $(CPPFLAGS) -I$(top_srcdir) -I$(top_srcdir)/pack $(CXXFLAGS) $< $(LDFLAGS) -o stringfix
+cmds.cc: help.h
+
+help.h: $(HELPFILE) $(top_srcdir)/build/makehelp.sh $(STRINGFIX)
+	@echo -e "{GEN}	\033[1m$<\033[0m -> \033[1m$@\033[0m"
+	$(top_srcdir)/build/makehelp.sh < $(HELPFILE) | $(STRINGFIX) > $@
+
+sorthelp: sorthelp.cc ../lib/bdlib/src/libbdlib.a
+	@echo -e "[CXX]	\033[1m$<\033[0m"
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< ../lib/bdlib/libbdlib.a $(LDFLAGS) -o $@
 	@$(STRIP) $@@EXEEXT@
 
-#../$(EGGEXEC): build_msg $(OBJS) mycrypto compatability
-../$(EGGEXEC): build_msg $(OBJS) mycrypto compatability ../lib/bdlib/libbdlib.a @LIBELF_BUNDLED@
-	@echo "[*] Linking"
-	@echo ""
-	@echo "Linking wraith... $(EGGBUILD)"
-	@echo ""
-	$(LD) $(LDFLAGS) -o ../$(EGGEXEC) $(OBJS) $(MODOBJS) compat/*.o crypto/*.o ../lib/bdlib/libbdlib.a $(LIBS) @LIBELF_LIB@
+../$(EGGEXEC): build_msg $(OBJS) ../lib/bdlib/libbdlib.a @LIBELF_BUNDLED@
+	@echo -e "[LD ]	\033[1m$@\033[0m"
+	$(LD) $(LDFLAGS) -o ../$(EGGEXEC) $(OBJS) ../lib/bdlib/libbdlib.a $(LIBS) @LIBELF_LIB@
 	@$(STRIP) ../$(EGGEXEC)
 	@$(OBJCOPY) ../$(EGGEXEC)
 	@echo "Successful compile: $(EGGEXEC)"
 	@echo ""
 
-$(EGGEXEC): stringfix ../$(EGGEXEC)
+$(EGGEXEC): ../$(EGGEXEC)
 
 clean:
-	@rm -f .depend *.o *.So *~ _*.c _*.cc *.ii *.i
+	@rm -f .depend *.o $(OBJS) *~ _*.c _*.cc *.ii *.i set_default.h \
+	    responses.cc help.h $(STRINGFIX)
 
 build_msg:
 	@echo "[*] Compiling core components"
 
-compatability:
-	@echo "[*] Compiling compatability components"
-	+@cd compat && $(MAKE_GENERIC) compat
-
-mycrypto:
-	@echo "[*] Compiling crypto"
-	+@cd crypto && $(MAKE_GENERIC) crypto
-
 include ./.deps/includes

+ 0 - 41
src/compat/Makefile.in

@@ -1,41 +0,0 @@
-# Makefile for src/compat/
-
-SHELL = @SHELL@
-top_srcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(top_srcdir)/build/build.mk
-
-@SET_MAKE@
-
-STRIP = @STRIP@
-CXXFLAGS = $(CXXFLAGS)
-CFLAGS = $(CFLGS)
-CPPFLAGS = @CPPFLAGS@ -I../.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/src @DEFS@
-
-OBJS = dirname.o \
-	dn_expand.o \
-	inet_ntop.o \
-	snprintf.o \
-	memcpy.o \
-	memmem.o \
-	memset.o \
-	memutil.o \
-	strcasecmp.o \
-	strftime.o \
-	strlcpy.o \
-	strsep.o
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../.. && $(MAKE)
-
-clean:
-	@rm -f .depend *.o *~
-
-compat: $(OBJS)
-
-include ./.deps/includes

+ 0 - 32
src/crypto/Makefile.in

@@ -1,32 +0,0 @@
-
-top_srcdir = @top_srcdir@
-srcdir = @srcdir@
-
-SHELL = @SHELL@
-CXXFLAGS = $(CXXFLAGS)
-CFLAGS = $(CFLGS)
-CPPFLAGS = @CPPFLAGS@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @DEFS@
-STRIP = @STRIP@
-VPATH = @srcdir@
-
-include $(top_srcdir)/build/build.mk
-
-@SET_MAKE@
-
-OBJS = \
-       aes_util.o \
-       bf_util.o \
-       dh_util.o
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../.. && $(MAKE)
-
-clean:
-	@rm -f .depend *.o *~
-
-crypto: $(OBJS)
-
-include ./.deps/includes

+ 4 - 0
src/dl.h

@@ -32,4 +32,8 @@
 
 extern bd::HashTable<bd::String, FunctionPtr> dl_symbol_table;
 
+#ifdef GENERATE_DEFS
+#undef DLSYM_GLOBAL
+#endif
+
 #endif /* !_DL_H_ */

+ 3 - 2
src/generate_defs.sh

@@ -13,6 +13,7 @@ INCLUDES="${TCL_INCLUDES} ${SSL_INCLUDES}"
 mkdir -p src/.defs > /dev/null 2>&1
 TMPFILE=$(mktemp "/tmp/pre.XXXXXX")
 files=$(grep -l DLSYM_GLOBAL src/*.cc|grep -v "src/_")
+
 for file in ${files}; do
   suffix=${file##*.}
   basename=${file%%.*}
@@ -44,13 +45,13 @@ for file in ${files}; do
   echo "extern \"C\" {" > $defsFile_post
 
   cd src
-  $CXX $CXXFLAGS -E -I. -I.. -I../lib ${INCLUDES} -DHAVE_CONFIG_H ../${file} > $TMPFILE
+  $CXX $CXXFLAGS -E -I. -I.. -I../lib ${INCLUDES} -DHAVE_CONFIG_H -DGENERATE_DEFS ../${file} > $TMPFILE
   # Fix wrapped prototypes
   $SED -e :a -e N -e '$!ba' -e 's/,\n/,/g' $TMPFILE > $TMPFILE.sed
   mv $TMPFILE.sed $TMPFILE
   cd ..
 
-  for symbol in $($SED -n -e 's/.*DLSYM_GLOBAL(.*, \([^)]*\).*/\1/p' $file|sort -u); do
+  for symbol in $($SED -n -e 's/.*DLSYM_GLOBAL(.*, \([^)]*\).*/\1/p' $TMPFILE|sort -u); do
     # Check if the typedef is already defined ...
     typedef=$(grep "^typedef .*(\*${symbol}_t)" ${dirname}/${basename}.h)
     # ... if not, generate it

+ 1 - 1
src/main.cc

@@ -827,7 +827,7 @@ int main(int argc, char **argv)
   Auth::InitTimer();
   init_vars();			/* needed for cfg */
   init_botcmd();
-  init_responses();		/* zeros out response[] */
+  init_responses();
 
   egg_dns_init();
   channels_init();

+ 0 - 107
src/makeres.cc

@@ -1,107 +0,0 @@
-
-#include <bdlib/src/String.h>
-#include <bdlib/src/Stream.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <algorithm>
-
-int skipline (const char *line, int *skip) {
-  static int multi = 0;
-  if ((!strncmp(line, "//", 2))) {
-    (*skip)++;
-  } else if ( (strstr(line, "/*")) && (strstr(line, "*/")) ) {
-    multi = 0;
-    (*skip)++;
-  } else if ( (strstr(line, "/*")) ) {
-    (*skip)++;
-    multi = 1;
-  } else if ( (strstr(line, "*/")) ) {
-    multi = 0;
-  } else {
-    if (!multi) (*skip) = 0;
-  }
-  return (*skip);
-}
-
-int parse_res(const bd::String& inFile, const bd::String& outFile, const bd::String& outsFile) {
-  bd::Stream in, out, outs;
-  bd::String buffer, cmd, buf, lower_resps;
-
-  int skip = 0, total_responses = 0;
-
-  in.loadFile(inFile);
-  printf("Parsing res file '%s'", inFile.c_str());
-
-  out << bd::String::printf( "/* DO NOT EDIT THIS FILE. */\n\
-#ifndef _RESPONSE_H\n\
-#define _RESPONSE_H\n\
-\n\
-typedef unsigned int response_t;\n\n\
-enum {\n");
-
-  outs << bd::String::printf("/* DO NOT EDIT THIS FILE. */\n\
-#ifndef _RESPONSES_H\n\
-#define _RESPONSES_H\n\
-\n\
-typedef const char * res_t;\n\n");
-
-  while (in.tell() < in.length()) {
-    buffer = in.getline().chomp();
-    if ((skipline(buffer.c_str(), &skip))) continue;
-    if (buffer[0] == ':') { /* New cmd */
-      if (cmd.length()) {		/* CLOSE LAST RES */
-        out << ",\n";	/* for enum */
-        outs << "\tNULL\n};\n\n";
-        cmd.clear();
-      }
-
-      cmd = buffer(1);
-      if (cmd != "end") {		/* NEXT RES */
-        ++total_responses;
-        printf(".");
-
-        bd::String cmdUpper(cmd);
-        std::transform(cmdUpper.begin(), cmdUpper.end(), cmdUpper.mdata(), (int(*)(int)) toupper);
-        out << bd::String::printf("\tRES_%s", cmdUpper.c_str());
-        if (total_responses == 1)
-          out << " = 1";
-        outs << bd::String::printf("static res_t res_%s[] = {\n", cmd.c_str());
-        lower_resps += bd::String::printf(",\n\tres_%s", cmd.c_str());
-      } else {			/* END */
-        out << bd::String::printf("\tRES_END\n};\n\n#define RES_TYPES %d\n", total_responses);
-        out << bd::String::printf("const char *response(response_t);\nvoid init_responses();\nconst char *r_banned(struct chanset_t* chan);\n\n#endif /* !_RESPONSE_H */\n");
-        outs << bd::String::printf("static res_t *res[] = {\n\tNULL%s\n};\n#endif /* !_RESPONSES_H */\n", lower_resps.c_str());
-      }
-    } else {				/* NEXT RES TEXT */
-      ++buffer;
-      outs << bd::String::printf("\t\"%s\",\n", buffer.c_str());
-    }
-  }
-
-  if (out.writeFile(outFile)) {
-    fprintf(stderr, "Failure writing %s\n", outFile.c_str());
-    return 1;
-  }
-
-  if (outs.writeFile(outsFile)) {
-    fprintf(stderr, "Failure writing %s\n", outsFile.c_str());
-    return 1;
-  }
-
-  printf(" Success\n");
-
-  return 0;
-}
-
-int main(int argc, char **argv) {
-  if (argc < 3) return 1;
-
-  bd::String in(argv[1]), out, outs;
-
-  out = bd::String::printf("%s/response.h%s", argv[2], argc == 4 ? "~" : "");
-  outs = bd::String::printf("%s/responses.h%s", argv[2], argc == 4 ? "~" : "");
-  return parse_res(in, out, outs);
-}
-/* vim: set sts=2 sw=2 ts=8 et: */

+ 0 - 50
src/makeset.cc

@@ -1,50 +0,0 @@
-#include <bdlib/src/Stream.h>
-#include <bdlib/src/String.h>
-#include <cctype>
-#include <algorithm>
-#include <cstring>
-using namespace std;
-
-int main(int argc, char *argv[]) {
-  if (argc == 2)
-    return 1;
-
-  bd::Stream file, out;
-  file.loadFile(argv[1]);
-
-  bd::String type, line;
-  char c;
-
-  while (file.tell() < file.length()) {
-    line = file.getline().chomp();
-    if (line[0] == '#') continue;
-    if (line[0] == ':') {
-      type = line(1);
-      if (type == "end")
-        break;
-
-      transform(type.begin(), type.end(), type.mdata(), (int(*)(int)) toupper);
-
-      type = "DEFAULT_" + type;
-      out << "#define " << type << " \"\\" << "\n";
-    } else {
-      if (!type.length()) 
-        continue;
-
-      out << line;
-      c = file.peek()[0];
-      if (strchr("\n:", c)) {
-        out << "\"\n\n";
-        type = "";
-      } else
-        out << ",\\\n";
-    }
-  }
-
-  if (out.writeFile(argv[2])) {
-    fprintf(stderr, "Failure writing %s\n", argv[2]);
-    return 1;
-  }
-  return 0;
-}
-/* vim: set sts=2 sw=2 ts=8 et: */

+ 0 - 2
src/mod/.gitignore

@@ -1,2 +0,0 @@
-/Makefile
-*.o

+ 0 - 95
src/mod/Makefile.in

@@ -1,95 +0,0 @@
-# Makefile for src/mod/
-
-SHELL = @SHELL@
-top_srcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-MOD_UPDIR = @MOD_UPDIR@
-
-@SET_MAKE@
-
-STRIP = @STRIP@
-CXXFLAGS = $(CXXFLAGS)
-CFLAGS = $(CFLGS)
-CPPFLAGS = @CPPFLAGS@ -I../.. -I$(top_srcdir)
-MOD_CXXFLAGS = $(CXXFLAGS)
-MOD_CPPFLAGS = @CPPFLAGS@ -I. -I$(MOD_UPDIR)$(top_srcdir)/src -I$(MOD_UPDIR)$(top_srcdir) \
-  -I$(MOD_UPDIR)$(top_srcdir)/src/mod -I$(MOD_UPDIR)$(top_srcdir)/lib @DEFS@
-LIBS = @LIBS@
-
-mods = channels.mod \
-	console.mod \
-	ctcp.mod \
-	irc.mod \
-	server.mod \
-	share.mod \
-	transfer.mod \
-	update.mod
-
-mod_objs = channels.mod_o \
-	console.mod_o \
-	ctcp.mod_o \
-	irc.mod_o \
-	server.mod_o \
-	share.mod_o \
-	transfer.mod_o \
-	update.mod_o
-
-
-egg_ac_parameters = @egg_ac_parameters@
-
-MAKE_MOD = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD)' \
-'CCDEPMODE=$(CCDEPMODE)' 'top_srcdir=$(MOD_UPDIR)$(top_srcdir)' \
-'STRIP=$(STRIP)' 'CXXFLAGS=$(MOD_CXXFLAGS)' 'CPPFLAGS=$(MOD_CPPFLAGS)' \
-'LIBS=$(LIBS)' 'SHELL=$(SHELL)'
-
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../.. && $(MAKE)
-
-static: build_msg $(mod_objs)
-
-build_msg:
-	@echo "[*] Compiling modules"
-
-.SUFFIXES:
-.SUFFIXES: .mod .mod_o
-
-.mod.mod_o:
-	+@if test ! -d $*.mod; then mkdir $*.mod; fi; \
-	if test ! -r $*.mod/Makefile; then \
-		cp $(srcdir)/$*.mod/Makefile $*.mod/Makefile; \
-	fi; \
-	cd $*.mod && $(MAKE_MOD) 'VPATH=$(MOD_UPDIR)$(srcdir)/$*.mod' 'srcdir=$(MOD_UPDIR)$(srcdir)/$*.mod' static;
-
-clean:
-	@rm -f *.o *.So *~
-	@for i in *.mod; do \
-		if test ! -d $$i; then mkdir $$i; fi; \
-		if (test ! -r $$i/Makefile) && \
-		   (test -r $(srcdir)/$$i/Makefile); then \
-			cp $(srcdir)/$$i/Makefile $$i/Makefile; \
-		fi; \
-		if (test -r $$i/Makefile); then \
-			(cd $$i; $(MAKE) "VPATH=$(MOD_UPDIR)$(srcdir)/$$i" top_srcdir="$(MOD_UPDIR)$(top_srcdir)" "srcdir=$(MOD_UPDIR)$(srcdir)/$$i" 'MAKE=$(MAKE)' clean); \
-		fi; \
-	done
-
-distclean:
-	@rm -f *.o *.So *~
-	@for i in *.mod; do \
-		if test ! -d $$i; then mkdir $$i; fi; \
-		if (test ! -r $$i/Makefile) && \
-		   (test -r $(srcdir)/$$i/Makefile); then \
-			cp $(srcdir)/$$i/Makefile $$i/Makefile; \
-		fi; \
-		if (test -r $$i/Makefile); then \
-			(cd $$i; $(MAKE) "VPATH=$(MOD_UPDIR)$(srcdir)/$$i" top_srcdir="$(MOD_UPDIR)$(top_srcdir)" "srcdir=$(MOD_UPDIR)$(srcdir)/$$i" 'MAKE=$(MAKE)' distclean); \
-		fi; \
-	done
-
-
-#safety hash

+ 0 - 22
src/mod/channels.mod/Makefile

@@ -1,22 +0,0 @@
-# Makefile for src/mod/channels.mod/
-
-srcdir = .
-
-OBJS = channels.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean
-

+ 0 - 22
src/mod/compress.mod/Makefile

@@ -1,22 +0,0 @@
-# Makefile for src/mod/compress.mod/
-
-srcdir = .
-
-OBJS = compress.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean
-

+ 0 - 21
src/mod/console.mod/Makefile

@@ -1,21 +0,0 @@
-# Makefile for src/mod/console.mod/
-
-srcdir = .
-
-OBJS = console.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean

+ 0 - 21
src/mod/ctcp.mod/Makefile

@@ -1,21 +0,0 @@
-# Makefile for src/mod/ctcp.mod/
-
-srcdir = .
-
-OBJS = ctcp.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean

+ 0 - 22
src/mod/irc.mod/Makefile

@@ -1,22 +0,0 @@
-# Makefile for src/mod/irc.mod/
-
-srcdir = .
-
-OBJS = irc.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean
-

+ 0 - 21
src/mod/server.mod/Makefile

@@ -1,21 +0,0 @@
-# Makefile for src/mod/server.mod/
-
-srcdir = .
-
-OBJS = server.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean

+ 0 - 22
src/mod/share.mod/Makefile

@@ -1,22 +0,0 @@
-# Makefile for src/mod/share.mod/
-
-srcdir = .
-
-OBJS = share.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean
-

+ 0 - 22
src/mod/transfer.mod/Makefile

@@ -1,22 +0,0 @@
-# Makefile for src/mod/transfer.mod/
-
-srcdir = .
-
-OBJS = transfer.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean
-

+ 0 - 22
src/mod/update.mod/Makefile

@@ -1,22 +0,0 @@
-# Makefile for src/mod/update.mod/
-
-srcdir = .
-
-OBJS = update.So
-
-include ./.deps/includes
-include $(top_srcdir)/build/build.mk
-
-doofus:
-	@echo ""
-	@echo "Let's try this from the right directory..."
-	@echo ""
-	@cd ../../../ && make
-
-static: $(OBJS)
-
-clean:
-	@rm -f .depend *.So *~
-
-distclean: clean
-

+ 9 - 32
src/response.cc

@@ -5,49 +5,26 @@
  *
  */
 
-
 #include "common.h"
 #include "response.h"
-#include "main.h"
-#include "responses.h"
+#include "responses.cc"
+#include <bdlib/src/HashTable.h>
+#include <bdlib/src/String.h>
+#include <vector>
 
-static response_t response_totals[RES_TYPES + 1];
+static bd::HashTable<bd::String, std::vector<const char*> > res_map;
 
 void
 init_responses()
 {
-  for (response_t i = 0; i <= RES_TYPES; i++)
-    response_totals[i] = 0;
-}
-
-static void
-count_responses(response_t type)
-{
-  response_t total = 0;
-
-  for (total = 0; res[type][total]; total++) 
-    ;
-
-  response_totals[type] = total;
-  /* printf("Type: %d has %d total responses!\n", type, response_totals[type]); */
+  for (size_t i = 0; i < sizeof(res)/sizeof(res[0]); ++i)
+    res_map[res[i].name] = std::vector<const char*>(res[i].res,
+        res[i].res + res[i].size);
 }
 
 const char *
 response(response_t type)
 {
-  if (!type)
-    type = randint(RES_TYPES) + 1;
-
-  /* wait to count the totals until it's used for the first time */
-  if (!response_totals[type])
-    count_responses(type);
-
-  return res[type][randint(response_totals[type])];
-}
-
-const char *
-r_banned(struct chanset_t *chan)
-{
-  return response(RES_BANNED);
+  return res_map[type].at(randint(res_map[type].size()));
 }
 /* vim: set sts=2 sw=2 ts=8 et: */

+ 36 - 0
src/response.h

@@ -0,0 +1,36 @@
+#ifndef _RESPONSE_H
+#define _RESPONSE_H
+
+#define RES_BANNED	"banned"
+#define RES_KICKBAN	"kickban"
+#define RES_MASSDEOP	"massdeop"
+#define RES_BADOP	"badop"
+#define RES_BADOPPED	"badopped"
+#define RES_BITCHOP	"bitchop"
+#define RES_BITCHOPPED	"bitchopped"
+#define RES_MANUALOP	"manualop"
+#define RES_MANUALOPPED	"manualopped"
+#define RES_CLOSED	"closed"
+#define RES_FLOOD	"flood"
+#define RES_NICKFLOOD	"nickflood"
+#define RES_KICKFLOOD	"kickflood"
+#define RES_REVENGE	"revenge"
+#define RES_USERNAME	"username"
+#define RES_PASSWORD	"password"
+#define RES_BADUSERPASS	"baduserpass"
+#define RES_MIRCVER	"mIRCver"
+#define RES_MIRCSCRIPT	"mIRCscript"
+#define RES_OTHERSCRIPT	"otherscript"
+
+typedef const char* response_t;
+
+void init_responses();
+const char *response(response_t);
+
+inline const char *
+r_banned(struct chanset_t *chan)
+{
+  return response(RES_BANNED);
+}
+
+#endif /* !_RESPONSE_H */

+ 5 - 11
src/stringfix.cc

@@ -9,16 +9,12 @@
 #include <stdio.h>
 #include <string.h>
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define WTF 1524
+#define MAX_LINE_LEN 35000
 int help = 0;
 
 void garble(char **inptr, char **outptr)
 {
-  char *in = *inptr, *out = NULL, *p = NULL, obuf[WTF] = "";
+  char *in = *inptr, *out = NULL, *p = NULL, obuf[MAX_LINE_LEN] = "";
   size_t chars = 0;
   unsigned char x = 0;
 
@@ -98,12 +94,10 @@ void garble(char **inptr, char **outptr)
 
 void processline(char *line)
 {
-  char tmpin[WTF] = "", tmpout[WTF] = "", *in = NULL, *out = NULL;
+  char tmpout[MAX_LINE_LEN] = "", *in = NULL, *out = NULL;
   size_t outlen = 0;
 
-  strcpy(tmpin, line); 
-  memset((char *) &tmpin[strlen(tmpin)], 0, 20);
-  in = tmpin;
+  in = line;
   out = tmpout;
   if (*in) {
     while (*in) {
@@ -128,7 +122,7 @@ int main(int argc, char *argv[])
 
   if (argc == 2)
     help = 1;
-  char tempBuf[1024] = "";
+  char tempBuf[MAX_LINE_LEN] = "";
   while (!feof(stdin)) {
     if (fgets(tempBuf, sizeof(tempBuf), stdin) && !feof(stdin)) {
       processline(tempBuf);

+ 0 - 15
src/utc-time.cc

@@ -1,15 +0,0 @@
-/* This file simply returns number of seconds since epoch in UTC 
- */
-
-
-#include <time.h>
-#include <stdio.h>
-
-int main() {
-  time_t now = time(NULL);
-
-  printf("%li\n", mktime(gmtime(&now)));
-  return 0;
-}
-
-/* vim: set sts=2 sw=2 ts=8 et: */