diff --git a/src/libraries/libisc-new/ChangeLog b/src/libraries/libisc-new/ChangeLog
index afbfb3a31a70afc8baf2a860f931c3b7beacc1ed..21053ea32948d999b7ab2b5aa2290534e3cbc52a 100644
--- a/src/libraries/libisc-new/ChangeLog
+++ b/src/libraries/libisc-new/ChangeLog
@@ -1,5 +1,117 @@
+1999-04-17  Per Cederqvist  <ceder@lysator.liu.se>
+
+	Added full support for fd relocation.
+	* src/isc_relocate.c (isc_relocate_fd): Implemented for real.
+	* src/isc_event.c (isc_getnextevent): Return
+	ISC_EVENT_LOGIN_UNRELOCATED instead of ISC_EVENT_LOGIN if a
+	file descriptor relocation failed.
+	* src/isc.h (IscEventType): New event: ISC_EVENT_LOGIN_UNRELOCATED.
+
+1999-04-17  Per Cederqvist  <ceder@gratia>
+
+	Added limited support for fd relocation.  Error handling still
+	needed.
+	* src/isc_udp.c (isc_createudp): Relocate the fd.
+	* src/isc_tcp.c (isc_tcp_accept_fn): isc_createtcp will close the
+	file descriptor if it fails, so don't re-close it here.
+	isc_createtcp will also set the fd attribute of the session; don't
+	set it again.
+	(isc_createtcp): Relocate the fd.  Be careful to always close it
+	if an error occurs.
+	* src/isc_relocate.c (isc_relocate_fd): New file and function.
+	This is still a dummy implementation.
+	* src/isc_master.c (isc_initialize): Expect master config version
+	1006 and session config 1002.  Handle fd_relocate.
+	* src/isc.h (IscSessionConfig): Added fd_relocate.
+	* src/intern.h (isc_relocate_fd): New function.
+	* src/Makefile.am (libisc_a_SOURCES): Added isc_relocate.c.
+
+1999-04-16  Per Cederqvist  <ceder@gratia>
+
+	Simplify the use of IscHandlerList.  (This needs more
+	documentation.)
+	* src/isc.h (IscSession): Removed the "IscHandlerCache fun"
+	member.
+	(ISC_HCALLFUN1): Adapted to IscHandlerList changes.
+	(ISC_HCALLFUN2): Adapted to IscHandlerList changes.
+	(ISC_HCALLFUN3): Adapted to IscHandlerList changes.
+	* src/intern.h (ISC_SCALLFUN1): Use ISC_HCALLFUN1 to simplify
+	code.  Adapted to IscHandlerList changes.
+	(ISC_SCALLFUN2): Analogous.
+	(ISC_SCALLFUN3): Analogous.
+	* src/isc_handler.c (isc_pushhandler): Modified so that the
+ 	members of the member "current" of IscHandlerList objects points
+ 	to the IscHandler object where the callbacks that should be used
+ 	exist.  Once that changes was done, there is no need for the
+ 	"scb->fun" member, so it was removed.
+	(isc_pophandler): Adjusted accordingly.
+	* src/isc_session.c (isc_create): Removed the code that
+	initialized scb->fun.
+	(isc_destroy): Use scb->handlers->current instead of scb->fun.
+	* src/isc_event.c (isc_getnextevent): Use scb->handlers->current
+	instead of scb->fun.
+
+1999-04-15  Per Cederqvist  <ceder@lysator.liu.se>
+
+	Allow disabled sessions to emit data.  It is input from the
+	sessions that is disabled.
+	* src/isc_stdout.c (isc_putc): Allow output to sessions that are
+	in state ISC_STATE_DISABLED.
+	(isc_write): Likewise.
+	* src/isc_output.c (isc_flush): Flush pending output even
+	when the session is in ISC_STATE_DISABLED.
+	(isc_oflush): Likewise.
+	* src/isc_event.c (isc_getnextevent): Flush pending output even
+	when the session is in ISC_STATE_DISABLED.
+
+1999-04-11  Per Cederqvist  <ceder@gratia>
+
+	Rebuild more often.
+	* src/Makefile.am (isc_stdout.o): Depend on ../config.status.
+
+1999-04-05  Per Cederqvist  <ceder@gratia>
+
+	Get rid of useless compiler warnings.
+	* configure.in: Don't use -Wtraditional.
+
+1999-02-05  Per Cederqvist  <ceder@gratia>
+
+	Get rid of a compiler warning.
+	* src/isc_alloc.c (ISC_MAGIC_ALLOC): This is an unsigned constant.
+	(ISC_MAGIC_FREE): Likewise.
+
+1999-01-18  David Byers  <davby@ida.liu.se>
+
+	* src/.cvsignore: Added .bbg, .bb, .da and .gcov files.
+
+1999-01-15  David Byers  <davby@ida.liu.se>
+
+	* configure.in: Added --with-checker, --with-gcov and
+	--with-optimization.
+
+1998-10-06  Per Cederqvist  <ceder@gratia>
+
+	Port to glibc2.
+	* src/isc_session.c: Include <time.h>.
+
+1998-07-10  Per Cederqvist  <ceder@lysator.liu.se>
+
+	The LysKOM server should not install isc thingies.
+	* src/Makefile.am (noinst_LIBRARIES, noinst_HEADERS): Use instead
+	of lib_LIBRARIES and include_HEADERS so that nothing from isc gets
+	installed by lyskomd.
+	* man/Makefile.am (noinst_MANS): Use noinst_MANS instead of
+	man_MANS so that nothing from isc gets installed by lyskomd.
+
+1998-07-09  Per Cederqvist  <ceder@lysator.liu.se>
+
+	--enable-isc-printf was broken.
+	* src/isc_wait.c: Include <stdarg.h>.
+
 1998-07-06  Per Cederqvist  <ceder@lysator.liu.se>
 
+	* Version 0.99 released.
+
 	Release preparations.
 	* NEWS: Updated.
 	* README: Updated.
diff --git a/src/libraries/libisc-new/build/gmkdep b/src/libraries/libisc-new/build/gmkdep
deleted file mode 100755
index 653fc311c29a3e978e2888c8177f307a511149f2..0000000000000000000000000000000000000000
--- a/src/libraries/libisc-new/build/gmkdep
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/sh -
-#
-# Copyright (c) 1987 Regents of the University of California.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms are permitted
-# provided that the above copyright notice and this paragraph are
-# duplicated in all such forms and that any documentation,
-# advertising materials, and other materials related to such
-# distribution and use acknowledge that the software was developed
-# by the University of California, Berkeley.  The name of the
-# University may not be used to endorse or promote products derived
-# from this software without specific prior written permission.
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-#	@(#)mkdep.sh	5.12 (Berkeley) 6/30/88
-#
-PATH=/bin:/usr/bin:/usr/ucb
-export PATH
-SED=""
-MAKE=Makefile			# default makefile name is "Makefile"
-
-while :
-	do case "$1" in
-		# -f allows you to select a makefile name
-		-f)
-			MAKE=$2
-			shift; shift ;;
-
-		# the -p flag produces "program: program.c" style dependencies
-		# so .o's don't get produced
-		-p)
-			SED='s;\.o;;'
-			shift ;;
-		*)
-			break ;;
-	esac
-done
-
-if [ $# = 0 ] ; then
-	echo 'usage: gmkdep [-p] [-f makefile] [flags] file ...'
-	exit 1
-fi
-
-if [ ! -w $MAKE ]; then
-	echo "gmkdep: no writeable file \"$MAKE\""
-	exit 1
-fi
-
-TMP=/tmp/mkdep$$
-
-trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
-
-cp $MAKE ${MAKE}.bak
-
-sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
-
-cat << _EOF_ >> $TMP
-# DO NOT DELETE THIS LINE -- mkdep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-
-_EOF_
-
-# If your compiler doesn't have -M, add it.  If you can't, the next two
-# lines will try and replace the "cc -M".  The real problem is that this
-# hack can't deal with anything that requires a search path, and doesn't
-# even try for anything using bracket (<>) syntax.
-#
-# egrep '^#include[ 	]*".*"' /dev/null $* |
-# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
-
-/usr/gnu/bin/gcc -M $* |
-sed "
-	s; \./; ;g
-	$SED" |
-awk '{
-	if ($1 != prev) {
-		if (rec != "")
-			print rec;
-		rec = $0;
-		prev = $1;
-	}
-	else {
-		if (length(rec $2) > 78) {
-			print rec;
-			rec = $0;
-		}
-		else
-			rec = rec " " $2
-	}
-}
-END {
-	print rec
-}' >> $TMP
-
-cat << _EOF_ >> $TMP
-
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
-_EOF_
-
-# copy to preserve permissions
-cp $TMP $MAKE
-rm -f ${MAKE}.bak $TMP
-exit 0
diff --git a/src/libraries/libisc-new/build/stddef.h b/src/libraries/libisc-new/build/stddef.h
deleted file mode 100644
index ecaf3f1f09119f9274b2970dea14522ea0a33add..0000000000000000000000000000000000000000
--- a/src/libraries/libisc-new/build/stddef.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef _STDDEF_H
-#define _STDDEF_H
-
-/* Signed type of difference of two pointers.  */
-
-
-#if defined(__GNUC__) && defined(__sparc__)
-# if !defined(__sys_stdtypes_h)
-#  include <sys/stdtypes.h>
-# endif
-# define size_t     _sys_size_t
-# define ptrdiff_t  _sys_ptrdiff_t
-#endif
-
-#ifndef _PTRDIFF_T	/* in case <sys/types.h> has defined it. */
-#ifndef _T_PTRDIFF
-#ifndef __PTRDIFF_T
-#ifndef _PTRDIFF_T_
-#ifndef ___int_ptrdiff_t_h
-#define _PTRDIFF_T
-#define _T_PTRDIFF
-#define __PTRDIFF_T
-#define _PTRDIFF_T_
-#define ___int_ptrdiff_t_h
-typedef long ptrdiff_t;
-#endif /* ___int_ptrdiff_t_h */
-#endif /* _PTRDIFF_T_ */
-#endif /* __PTRDIFF_T */
-#endif /* _T_PTRDIFF */
-#endif /* _PTRDIFF_T */
-
-/* Unsigned type of `sizeof' something.  */
-
-#ifndef _SIZE_T	/* in case <sys/types.h> has defined it. */
-#ifndef _T_SIZE
-#ifndef __SIZE_T
-#ifndef _SIZE_T_
-#ifndef ___int_size_t_h
-#define _SIZE_T
-#define _T_SIZE
-#define __SIZE_T
-#define _SIZE_T_
-#define ___int_size_t_h
-typedef unsigned long size_t;
-#endif /* ___int_size_t_h */
-#endif /* _SIZE_T_ */
-#endif /* __SIZE_T */
-#endif /* _T_SIZE */
-#endif /* _SIZE_T */
-
-/* A null pointer constant.  */
-
-#undef NULL		/* in case <stdio.h> has defined it. */
-#define NULL ((void *)0)
-
-/* Offset of member MEMBER in a struct of type TYPE.  */
-
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-
-#endif /* _STDDEF_H */
diff --git a/src/libraries/libisc-new/configure.in b/src/libraries/libisc-new/configure.in
index 737d69502619f1422314684d61bec91d6cb28329..eb9eb02060f29434caf1f561fce3be884bc69004 100644
--- a/src/libraries/libisc-new/configure.in
+++ b/src/libraries/libisc-new/configure.in
@@ -18,13 +18,29 @@ dnl  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 dnl Process this file with autoconf to produce a configure script.
 
-AC_REVISION($Revision: 1.1 $)dnl
+AC_REVISION($Revision: 1.3 $)dnl
 AC_INIT(src/isc_master.c)
 AM_INIT_AUTOMAKE(isc, 0.99)
 
 AC_ARG_ENABLE([isc-printf],
 	[  --enable-isc-printf     include isc_printf support (non-portable)])
 
+AC_ARG_WITH([checker],
+        [  --with-checker             compile with Gnu Checker],
+        [use_checker=$withval],
+        [use_checker=no])
+
+AC_ARG_WITH([gcov],
+        [  --with-gcov                instrument for gcov (requires gcc)],
+        [use_gcov=$withval],
+        [use_gcov=no])
+
+AC_ARG_WITH([optimization],
+        [  --with-optimization        select level of optimization],
+        [opt_level=$withval],
+        [opt_level=""])
+
+
 [if test "$enable_isc_printf" = yes
 then]
 	AC_DEFINE(ISC_PRINTF_SUPPORT)
@@ -57,8 +73,10 @@ AC_TYPE_SIZE_T
 
 CMOD_C_ATTRIBUTE_UNUSED
 
-[if test -n "$GCC"; then
-    CFLAGS="$CFLAGS -Wall -W -Wtraditional -Wshadow -Wpointer-arith"]
+[if test -n "$GCC"; then]
+    dnl "-Wtraditional" isn't really useful: we don't support
+    dnl pre-c89-compilers.
+    [CFLAGS="$CFLAGS -Wall -W -Wshadow -Wpointer-arith"]
     CMOD_COMPILER_CC_ACCEPTS([-Wbad-function-cast])
     CMOD_COMPILER_CC_ACCEPTS([-Wcast-qual])
     CMOD_COMPILER_CC_ACCEPTS([-Wcast-align])
@@ -71,4 +89,27 @@ CMOD_C_ATTRIBUTE_UNUSED
     CMOD_COMPILER_CC_ACCEPTS([-pipe])
 [fi]
 
+
+[if test "$use_gcov" = "yes" -a -n "$GCC"; then]
+        CMOD_COMPILER_CC_ACCEPTS([-ftest-coverage])
+        CMOD_COMPILER_CC_ACCEPTS([-fprofile-arcs])
+[fi]
+
+
+[if test -n "$opt_level" -a "$opt_level" != "yes" ; then
+    CFLAGS=`echo "$CFLAGS" | sed "s/-O[0-9]*//"`
+    if test "$opt_level" != "no" ; then
+        CFLAGS="$CFLAGS -O$opt_level"
+    fi
+fi]
+
+# Check for checker
+
+[if test "$use_checker" = "yes"
+then]
+        AC_CHECK_PROGS(CHECKER, checker)
+        [ CC="checker $CC"
+          LIBS="-lchkr_m $LIBS" ]
+[fi]
+
 AC_OUTPUT(Makefile src/Makefile man/Makefile doc/Makefile demo/Makefile)
diff --git a/src/libraries/libisc-new/demo/.cvsignore b/src/libraries/libisc-new/demo/.cvsignore
index a12fc1f1131a7144827122d58c34797fb12f30e7..282522db0342d8750454b3dc162493b5fc709cc8 100644
--- a/src/libraries/libisc-new/demo/.cvsignore
+++ b/src/libraries/libisc-new/demo/.cvsignore
@@ -1 +1,2 @@
-Topdir.make
+Makefile
+Makefile.in
diff --git a/src/libraries/libisc-new/demo/Makefile b/src/libraries/libisc-new/demo/Makefile
deleted file mode 100644
index 8d7bd39b08dac187c22f5a3a0a88e75c9f7db5e7..0000000000000000000000000000000000000000
--- a/src/libraries/libisc-new/demo/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-INCDIRS=-I$(HOME)/include
-LIBDIRS=-L$(HOME)/lib
-SOURCES=tcp.c udp.c
-CFLAGS= -g $(LIBDIRS) $(INCDIRS)
-CC=gcc
-
-tcp:	tcp.c $(HOME)/include/isc.h $(HOME)/lib/libisc.a
-	gcc $(CFLAGS) -o tcp tcp.c -lisc -lansi
-
-udp:	udp.c $(HOME)/include/isc.h $(HOME)/lib/libisc.a
-	gcc $(CFLAGS) -o udp udp.c -lisc -lansi
-
-clean:
-	rm -f *~ *.o a.out core tcp udp \#*\#
-
-depend:
-	gmkdep $(INCDIRS) $(SOURCES)
-
-# DO NOT DELETE THIS LINE -- mkdep uses it.
diff --git a/src/libraries/libisc-new/demo/Makefile.in b/src/libraries/libisc-new/demo/Makefile.in
deleted file mode 100644
index 05922af70cb0ad7065a1a8ccf35207ecf3f65b7a..0000000000000000000000000000000000000000
--- a/src/libraries/libisc-new/demo/Makefile.in
+++ /dev/null
@@ -1,158 +0,0 @@
-# Makefile.in generated automatically by automake 1.3 from Makefile.am
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998 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.
-
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DISTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-CC = @CC@
-CPP = @CPP@
-LIBOBJS = @LIBOBJS@
-MAKEINFO = @MAKEINFO@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-U = @U@
-VERSION = @VERSION@
-
-EXTRA_DIST = mux.c mux.h tcp.c udp.c
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_CLEAN_FILES = 
-DIST_COMMON =  README Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP = --best
-all: Makefile
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
-	cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps demo/Makefile
-
-Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) \
-	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-tags: TAGS
-TAGS:
-
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = demo
-
-distdir: $(DISTFILES)
-	@for file in $(DISTFILES); do \
-	  d=$(srcdir); \
-	  test -f $(distdir)/$$file \
-	  || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-	  || cp -p $$d/$$file $(distdir)/$$file; \
-	done
-info:
-dvi:
-check: all
-	$(MAKE)
-installcheck:
-install-exec: 
-	@$(NORMAL_INSTALL)
-
-install-data: 
-	@$(NORMAL_INSTALL)
-
-install: install-exec install-data all
-	@:
-
-uninstall: 
-
-install-strip:
-	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
-installdirs:
-
-
-mostlyclean-generic:
-	-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
-	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
-	-rm -f Makefile $(DISTCLEANFILES)
-	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-mostlyclean:  mostlyclean-generic
-
-clean:  clean-generic mostlyclean
-
-distclean:  distclean-generic clean
-	-rm -f config.status
-
-maintainer-clean:  maintainer-clean-generic distclean
-	@echo "This command is intended for maintainers to use;"
-	@echo "it deletes files that may require special tools to rebuild."
-
-.PHONY: tags distdir info dvi installcheck install-exec install-data \
-install uninstall all installdirs mostlyclean-generic distclean-generic \
-clean-generic maintainer-clean-generic clean mostlyclean distclean \
-maintainer-clean
-
-
-# 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:
diff --git a/src/libraries/libisc-new/man/Makefile b/src/libraries/libisc-new/man/Makefile
deleted file mode 100644
index 15b12eff02a30102e80451d72053076511f1e890..0000000000000000000000000000000000000000
--- a/src/libraries/libisc-new/man/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Makefile - for Manual pages
-#
-INSTROOT=/usr/local
-MANROOT=$(INSTROOT)/man
-MANSECT=man3
-MANDIR=$(MANROOT)/$(MANSECT)
-#
-FILES=	isc.3x isc_initialize.3x isc_shutdown.3x isc_openfd.3x \
-	isc_openfile.3x isc_opentcp.3x isc_close.3x isc_listentcp.3x \
-	isc_unlisten.3x
-#
-install:
-	cp $(FILES) $(MANDIR)
-
-clean:
-	rm -f *~ \#*\#
-
-all:
-	@echo "Nothing done."
diff --git a/src/libraries/libisc-new/man/Makefile.am b/src/libraries/libisc-new/man/Makefile.am
index bc936b7002ef7976f60ca82751d5e3e4b2240d1c..456a34f81ae23e4a6baecfd9fd8a472e922c3d00 100644
--- a/src/libraries/libisc-new/man/Makefile.am
+++ b/src/libraries/libisc-new/man/Makefile.am
@@ -19,8 +19,8 @@
 
 ## Process this file with automake to produce Makefile.in
 
-man_MANS = isc.3x isc_initialize.3x isc_shutdown.3x isc_openfd.3x \
+noinst_MANS = isc.3x isc_initialize.3x isc_shutdown.3x isc_openfd.3x \
 	isc_openfile.3x isc_opentcp.3x isc_close.3x isc_listentcp.3x \
 	isc_unlisten.3x isc_createtcp.3x isc_destroy.3x
 
-EXTRA_DIST = $(man_MANS) TEMPLATE FUNCTIONS .cvsignore
+EXTRA_DIST = $(noinst_MANS) TEMPLATE FUNCTIONS .cvsignore
diff --git a/src/libraries/libisc-new/src/.cvsignore b/src/libraries/libisc-new/src/.cvsignore
index e9955884756af11fe171e89bf99e459ac44f1a2a..34f3730f702e80fbc0f8e77989278c4712b437ea 100644
--- a/src/libraries/libisc-new/src/.cvsignore
+++ b/src/libraries/libisc-new/src/.cvsignore
@@ -1,3 +1,7 @@
 .deps
 Makefile
 Makefile.in
+*.da
+*.bb
+*.bbg
+*.gcov
diff --git a/src/libraries/libisc-new/src/Makefile b/src/libraries/libisc-new/src/Makefile
deleted file mode 100644
index 7c3e4b30ca9fef0bb97190a42ee670f082f2dd7e..0000000000000000000000000000000000000000
--- a/src/libraries/libisc-new/src/Makefile
+++ /dev/null
@@ -1,150 +0,0 @@
-#
-# Makefile for libisc
-#
-# Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
-#                    Lysator Academic Computer Association.
-#
-INSTROOT=/usr/local
-#
-LIBDIR=$(INSTROOT)/lib
-INCDIR=$(INSTROOT)/include
-#
-INCLUDES=-I$(HOME)/include -I/usr/local/include
-CC=gcc
-CFLAGS=-g -O -I. -pipe -Wall -ansi $(INCLUDES)
-#
-SOURCES=isc_event.c isc_session.c isc_abort.c isc_alloc.c isc_master.c\
-        isc_output.c isc_queue.c isc_message.c isc_handler.c\
-        isc_stdout.c isc_socket.c isc_tcp.c isc_udp.c printf.c
-OBJECTS=isc_event.o isc_session.o isc_abort.o isc_alloc.o isc_master.o\
-        isc_output.o isc_queue.o isc_message.o isc_handler.o\
-        isc_stdout.o isc_socket.o isc_tcp.o isc_udp.o printf.o
-
-
-all: 		libisc.a
-
-install:	$(LIBDIR)/libisc.a $(INCDIR)/isc.h
-
-$(LIBDIR)/libisc.a: libisc.a
-	cp libisc.a $(LIBDIR)
-	ranlib $(LIBDIR)/libisc.a
-
-$(INCDIR)/isc.h:    isc.h
-	cp isc.h $(INCDIR)
-
-tags:
-	etags -t *.[hc]
-
-depend:
-	gmkdep $(INCLUDES) $(SOURCES)
-
-
-clean:
-	rm -f *~ *.o libisc.a core \#*\#
-
-
-libisc.a: 	$(OBJECTS)
-	touch libisc.a
-	rm -f libisc.a
-	ar q libisc.a $(OBJECTS)
-	ranlib libisc.a
-
-# DO NOT DELETE THIS LINE -- mkdep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-
-isc_event.o : isc_event.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdio.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h \
-  /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h /usr/include/sys/sysmacros.h \
-  /usr/include/sys/time.h /usr/include/errno.h /usr/bsd/include/sys/errno.h /usr/include/sys/errno.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h \
-  isc.h /usr/include/sys/socket.h intern.h 
-isc_session.o : isc_session.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h /usr/include/sys/sysmacros.h \
-  /usr/include/errno.h /usr/bsd/include/sys/errno.h /usr/include/sys/errno.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h \
-  /usr/include/fcntl.h /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h isc.h \
-  /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h /usr/include/sys/socket.h \
-  intern.h 
-isc_abort.o : isc_abort.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdio.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h \
-  isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h \
-  /usr/include/sys/sysmacros.h /usr/include/sys/socket.h intern.h 
-isc_alloc.o : isc_alloc.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h \
-  isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h \
-  /usr/include/sys/sysmacros.h /usr/include/sys/socket.h intern.h 
-isc_master.o : isc_master.c /usr/include/errno.h /usr/bsd/include/sys/errno.h \
-  /usr/include/sys/errno.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h /usr/include/sys/file.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h \
-  /usr/include/sys/sysmacros.h /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h \
-  isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h /usr/include/sys/socket.h \
-  intern.h 
-isc_output.o : isc_output.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h \
-  /usr/include/errno.h /usr/bsd/include/sys/errno.h /usr/include/sys/errno.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h \
-  /usr/include/sys/file.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h \
-  /usr/include/sys/sysmacros.h /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h \
-  isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h /usr/include/sys/socket.h \
-  intern.h 
-isc_queue.o : isc_queue.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h /usr/include/sys/sysmacros.h \
-  /usr/include/sys/socket.h intern.h 
-isc_message.o : isc_message.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h /usr/include/sys/sysmacros.h \
-  /usr/include/sys/socket.h intern.h 
-isc_handler.o : isc_handler.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdio.h \
-  isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h \
-  /usr/include/sys/sysmacros.h /usr/include/sys/socket.h intern.h 
-isc_stdout.o : isc_stdout.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdio.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h isc.h /usr/include/time.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h /usr/include/sys/sysmacros.h \
-  /usr/include/sys/socket.h 
-isc_socket.o : isc_socket.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdio.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h \
-  /usr/include/sys/sysmacros.h /usr/include/sys/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/netinet/in.h \
-  /usr/include/sys/socket.h /usr/bsd/include/arpa/inet.h /usr/bsd/include/sys/cdefs.h \
-  /usr/include/sys/file.h /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h \
-  /usr/include/sys/ioctl.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttychars.h \
-  /usr/include/sys/ttydev.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttold.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ioccom.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttycom.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/filio.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/sockio.h \
-  /usr/include/errno.h /usr/bsd/include/sys/errno.h /usr/include/sys/errno.h /usr/include/netdb.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h \
-  /usr/include/fcntl.h isc.h intern.h 
-isc_tcp.o : isc_tcp.c /usr/include/errno.h /usr/bsd/include/sys/errno.h /usr/include/sys/errno.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h /usr/include/ctype.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h \
-  /usr/include/sys/sysmacros.h /usr/include/sys/socket.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/netinet/in.h \
-  /usr/bsd/include/arpa/inet.h /usr/bsd/include/sys/cdefs.h /usr/include/sys/file.h \
-  /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h /usr/include/sys/ioctl.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttychars.h /usr/include/sys/ttydev.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttold.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ioccom.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttycom.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/filio.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/sockio.h /usr/include/netdb.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h \
-  /usr/include/fcntl.h isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h \
-  intern.h 
-isc_udp.o : isc_udp.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h \
-  /usr/include/sys/sysmacros.h /usr/include/errno.h /usr/bsd/include/sys/errno.h \
-  /usr/include/sys/errno.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stddef.h \
-  /usr/include/ctype.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/netinet/in.h /usr/include/sys/socket.h \
-  /usr/bsd/include/arpa/inet.h /usr/bsd/include/sys/cdefs.h /usr/include/sys/file.h \
-  /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h /usr/include/sys/ioctl.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttychars.h /usr/include/sys/ttydev.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttold.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ioccom.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ttycom.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/filio.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/sockio.h /usr/include/netdb.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h \
-  /usr/include/fcntl.h isc.h /usr/include/time.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdarg.h \
-  intern.h 
-printf.o : printf.c /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/types.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/stdtypes.h \
-  /usr/include/sys/sysmacros.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/varargs.h \
-  /usr/gnu/var/gcc/sunos4.1.1/2.0/include/va-sparc.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdio.h \
-  /usr/include/ctype.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/string.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/stdlib.h \
-  /usr/include/math.h /usr/include/floatingpoint.h /usr/gnu/var/gcc/sunos4.1.1/2.0/include/sys/ieeefp.h 
-
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/src/libraries/libisc-new/src/Makefile.am b/src/libraries/libisc-new/src/Makefile.am
index f2de040a6d7997a4d09fb7aa905a4fda6d2b2cc4..48dc3ee9f93fb6d2ec143b6a1c942f1589c6b508 100644
--- a/src/libraries/libisc-new/src/Makefile.am
+++ b/src/libraries/libisc-new/src/Makefile.am
@@ -19,16 +19,20 @@
 
 ## Process this file with automake to produce Makefile.in
 
-lib_LIBRARIES = libisc.a
+noinst_LIBRARIES = libisc.a
 
 libisc_a_SOURCES = \
 	isc_event.c isc_session.c isc_abort.c isc_alloc.c isc_master.c \
 	isc_output.c isc_queue.c isc_message.c isc_handler.c \
 	isc_stdout.c isc_socket.c isc_tcp.c isc_udp.c unused.h intern.h \
-	isc_wait.c
+	isc_wait.c isc_relocate.c
 
 libisc_a_LIBADD = @LIBOBJS@
 
-include_HEADERS = isc.h
+noinst_HEADERS = isc.h
 
 EXTRA_DIST = .cvsignore
+
+# This file depends on ISC_PRINTF_SUPPORT which can be changed when
+# configure is run.
+isc_stdout.o: ../config.status
diff --git a/src/libraries/libisc-new/src/intern.h b/src/libraries/libisc-new/src/intern.h
index 800d7ed0032a3d05e3be1270fb359628e0fec776..8f9adb08df598eedf396d0080f7c839861ea1cb1 100644
--- a/src/libraries/libisc-new/src/intern.h
+++ b/src/libraries/libisc-new/src/intern.h
@@ -98,19 +98,29 @@ extern void
 isc_setabortfn(void (*abortfn)(const char  * msg));
 
 
+/*
+ * Move a file descriptor FD the first unused file descriptor higher
+ * than or equal to LIMIT.  Return the new file descriptor.  Close FD.
+ *
+ * On failure, the old FD will be returned, and errno will be set.
+ *
+ * Do nothing (and return FD) if LIMIT is 0.
+ */
+extern int
+isc_relocate_fd(int fd, int limit);
 
 
 #define ISC_XNEW(var)   (var = isc_malloc(sizeof(*var)))
 
 
 #define ISC_SCALLFUN1(SCB, NAME, ARG) \
-      (*SCB->fun.NAME->hcb->NAME)(SCB->fun.NAME, ARG)
+	ISC_HCALLFUN1(SCB->handlers, NAME, ARG)
 	
 #define ISC_SCALLFUN2(SCB, NAME, A1, A2) \
-      (*SCB->fun.NAME->hcb->NAME)(SCB->fun.NAME, A1, A2)
+	ISC_HCALLFUN2(SCB->handlers, NAME, A1, A2)
 	
 #define ISC_SCALLFUN3(SCB, NAME, A1, A2, A3) \
-      (*SCB->fun.NAME->hcb->NAME)(SCB->fun.NAME, A1, A2, A3)
+	ISC_HCALLFUN3(SCB->handlers, NAME, A1, A2, A3)
 
 
 #endif
diff --git a/src/libraries/libisc-new/src/isc.h b/src/libraries/libisc-new/src/isc.h
index bf0a488613a43c5dbdeed53ae1309b8252dbcfb9..95a26383c24c8840d954828c107eb1cdb8b1b60c 100644
--- a/src/libraries/libisc-new/src/isc.h
+++ b/src/libraries/libisc-new/src/isc.h
@@ -61,7 +61,7 @@
 */
 IscSessionConfig
 {
-  int version;     /* This is version 1001 */
+  int version;     /* This is version 1002 */
   struct
   {
     int msgsize;
@@ -70,6 +70,7 @@ IscSessionConfig
     int openretries;
     int backlog;
   } max;
+  int fd_relocate;
 };
 
 
@@ -96,7 +97,7 @@ IscMasterConfig
 */
 IscConfig
 {
-  int               version;  /* This is version 1005 */
+  int               version;  /* This is version 1006 */
   IscSessionConfig  session;
   IscMasterConfig   master;
 };
@@ -111,6 +112,7 @@ typedef enum
   ISC_EVENT_ERROR,
   ISC_EVENT_TIMEOUT,
   ISC_EVENT_LOGIN,
+  ISC_EVENT_LOGIN_UNRELOCATED,
   ISC_EVENT_LOGOUT,
   ISC_EVENT_MESSAGE,
   ISC_EVENT_CONNECTED,
@@ -282,7 +284,6 @@ IscSession
   IscSessionStats     stats;
 
   IscHandlerList    * handlers;
-  IscHandlerCache     fun;
   
   ISC_UDGTYPE       * udg;   /* User defined garbage :-) */
 };
@@ -323,7 +324,7 @@ IscHandlerList
 {
   IscHandlerList  * next;
   IscHandler      * hcb;
-  IscHandlerCache   old;
+  IscHandlerCache   current;
 };
 
 
@@ -690,13 +691,13 @@ isc_pophandler(IscSession *scb);
 ** Handler call function macros
 */
 #define ISC_HCALLFUN1(HLIST,NAME,ARG) \
-  (*HLIST->old.NAME->hcb->NAME)(HLIST->old.NAME, ARG)
+  (*(HLIST)->current.NAME->hcb->NAME)((HLIST), (ARG))
 
 #define ISC_HCALLFUN2(HLIST,NAME,A1,A2) \
-  (*HLIST->old.NAME->hcb->NAME)(HLIST->old.NAME, A1, A2)
+  (*(HLIST)->current.NAME->hcb->NAME)((HLIST), (A1), (A2))
 
 #define ISC_HCALLFUN3(HLIST,NAME,A1,A2,A3) \
-  (*HLIST->old.NAME->hcb->NAME)(HLIST->old.NAME, A1, A2, A3)
+  (*(HLIST)->current.NAME->hcb->NAME)((HLIST), (A1), (A2), (A3))
 	
 
 
diff --git a/src/libraries/libisc-new/src/isc_alloc.c b/src/libraries/libisc-new/src/isc_alloc.c
index 054628f661fac23d1f33225f2f6420c027471c53..d960aa43390bd3f3a95408a3c37577551612034f 100644
--- a/src/libraries/libisc-new/src/isc_alloc.c
+++ b/src/libraries/libisc-new/src/isc_alloc.c
@@ -34,8 +34,8 @@
 /*
 ** Some magic numbers
 */
-#define ISC_MAGIC_ALLOC	0x12F54ACE
-#define ISC_MAGIC_FREE  0xEE47A37F
+#define ISC_MAGIC_ALLOC	0x12F54ACEu
+#define ISC_MAGIC_FREE  0xEE47A37Fu
 
 
 /*
diff --git a/src/libraries/libisc-new/src/isc_event.c b/src/libraries/libisc-new/src/isc_event.c
index 603ff257a6c20d0a9b588d99ddff67ac3d6a3967..f91f56677a5f966ad69787e7547f388930d0ec08 100644
--- a/src/libraries/libisc-new/src/isc_event.c
+++ b/src/libraries/libisc-new/src/isc_event.c
@@ -121,7 +121,8 @@ RETRY:
      * are messages in the outgoing queue.
      */
     if (scb->state == ISC_STATE_CONNECTING ||
-	(scb->state == ISC_STATE_RUNNING &&
+	((scb->state == ISC_STATE_RUNNING ||
+	  scb->state == ISC_STATE_DISABLED) &&
 	 (scb->sendindex > 0 || isc_pollqueue(scb->wr_msg_q))))
       FD_SET(scb->fd, &write_set);
 
@@ -187,6 +188,7 @@ RETRY:
       switch (scb->state)
       {
 	case ISC_STATE_RUNNING:
+        case ISC_STATE_DISABLED:
           isc_oflush(scb);
 	  break;
 
@@ -251,7 +253,7 @@ RETRY:
 	scb->stats.rx.bytes += msg->length;
 	scb->stats.rx.packets++;
 	
-	if (scb->fun.parse)
+	if (scb->handlers->current.parse)
 	{
 	  event2 = ISC_SCALLFUN2(scb, parse, scb, msg);
 	  if (event2)
@@ -282,7 +284,7 @@ RETRY:
 
     if (scb->state == ISC_STATE_LISTENING &&
 	FD_ISSET(scb->fd, &read_set) &&
-	scb->fun.accept != NULL)
+	scb->handlers->current.accept != NULL)
     {
       new_scb = ISC_SCALLFUN2(scb, accept, scb, NULL);
       if (new_scb == NULL)
@@ -297,6 +299,11 @@ RETRY:
       /* Fill in the event info structure */
       event->session = new_scb;
       event->event   = ISC_EVENT_LOGIN;
+
+      if (new_scb->cfg->fd_relocate > 0
+	  && new_scb->fd <= new_scb->cfg->fd_relocate)
+	event->event = ISC_EVENT_LOGIN_UNRELOCATED;
+
       event->listen_session = scb;
 
       /* Move the session pointer to the next in the circular queue */
diff --git a/src/libraries/libisc-new/src/isc_handler.c b/src/libraries/libisc-new/src/isc_handler.c
index 853c8d196d9ab478a277f9badd50130c2ad3940b..3d38a70574f6b14570460b42b9d16c8e63bd0d2b 100644
--- a/src/libraries/libisc-new/src/isc_handler.c
+++ b/src/libraries/libisc-new/src/isc_handler.c
@@ -72,25 +72,36 @@ isc_pushhandler(IscSession *scb, IscHandler *hcb)
   
   ISC_XNEW(ihl);
   ihl->hcb = hcb;
-  ihl->old = scb->fun;
   ihl->next = scb->handlers;
+  if (scb->handlers)
+      ihl->current = scb->handlers->current;
+  else
+  {
+      ihl->current.read = NULL;
+      ihl->current.write = NULL;
+      ihl->current.close = NULL;
+      ihl->current.poll = NULL;
+      ihl->current.accept = NULL;
+      ihl->current.destroy = NULL;
+      ihl->current.parse = NULL;
+  }
   
   scb->handlers = ihl;
 
   if (hcb->read)
-    scb->fun.read = ihl;
+    ihl->current.read = ihl;
   if (hcb->write)
-    scb->fun.write = ihl;
+    ihl->current.write = ihl;
   if (hcb->close)
-    scb->fun.close = ihl;
+    ihl->current.close = ihl;
   if (hcb->poll)
-    scb->fun.poll = ihl;
+    ihl->current.poll = ihl;
   if (hcb->accept)
-    scb->fun.accept = ihl;
+    ihl->current.accept = ihl;
   if (hcb->destroy)
-    scb->fun.destroy = ihl;
+    ihl->current.destroy = ihl;
   if (hcb->parse)
-    scb->fun.parse = ihl;
+    ihl->current.parse = ihl;
 }
 
 
@@ -106,7 +117,6 @@ isc_pophandler(IscSession *scb)
 
   ip = scb->handlers;
   scb->handlers = ip->next;
-  scb->fun = ip->old;
   hcb = ip->hcb;
     
   isc_free(ip);
diff --git a/src/libraries/libisc-new/src/isc_master.c b/src/libraries/libisc-new/src/isc_master.c
index 262d73c47884c59133738886d8c5e6e1fcb498e2..67b1d4a1e0f31ca92b8bc4ec9eb617bb690c36bc 100644
--- a/src/libraries/libisc-new/src/isc_master.c
+++ b/src/libraries/libisc-new/src/isc_master.c
@@ -48,7 +48,7 @@ isc_initialize(IscConfig  * cfg)
       case 0:
         break;
 	
-      case 1005:
+      case 1006:
 	mcfg = &cfg->master;
 	
 	switch (mcfg->version)
@@ -89,12 +89,13 @@ isc_initialize(IscConfig  * cfg)
   mcb->scfg.max.dequeuelen  = ISC_DEFAULT_MAX_DEQUEUE_LEN;
   mcb->scfg.max.openretries = ISC_DEFAULT_MAX_OPEN_RETRIES;
   mcb->scfg.max.backlog     = ISC_DEFAULT_MAX_BACKLOG;
+  mcb->scfg.fd_relocate     = 0;
   
   /* Handle user specified defaults */
   if (cfg)
     switch (cfg->version)
     {
-      case 1005:
+      case 1006:
         scfg = &cfg->session;
 	
 	switch (scfg->version)
@@ -102,7 +103,7 @@ isc_initialize(IscConfig  * cfg)
 	  case 0:
 	    break;
 	    
-	  case 1001:
+	  case 1002:
 	    if (scfg->max.msgsize >= 0)
 	      mcb->scfg.max.msgsize = scfg->max.msgsize;
 	    if (scfg->max.queuedsize >= 0)
@@ -113,6 +114,8 @@ isc_initialize(IscConfig  * cfg)
 	      mcb->scfg.max.openretries = scfg->max.openretries;
 	    if (scfg->max.backlog >= 0)
 	      mcb->scfg.max.backlog = scfg->max.backlog;
+	    if (scfg->fd_relocate > 0)
+	      mcb->scfg.fd_relocate = scfg->fd_relocate;
 	    break;
 
 	  default:
diff --git a/src/libraries/libisc-new/src/isc_output.c b/src/libraries/libisc-new/src/isc_output.c
index bd7292c5c6c63d8b99879176586108ef61336d2f..1fd40d144ce1be3a34e6a67da97ab6c0e8e3d1c3 100644
--- a/src/libraries/libisc-new/src/isc_output.c
+++ b/src/libraries/libisc-new/src/isc_output.c
@@ -52,6 +52,7 @@ void isc_flush(IscSession *scb)
       return;
 
     case ISC_STATE_RUNNING:
+    case ISC_STATE_DISABLED:
     case ISC_STATE_CONNECTING:
       isc_oflush(scb);
       return;
@@ -92,6 +93,7 @@ void isc_oflush(IscSession *scb)
 
   /* We only try to transmit messages for RUNNING or CLOSING sessions */
   if ((scb->state != ISC_STATE_RUNNING &&
+       scb->state != ISC_STATE_DISABLED &&
        scb->state != ISC_STATE_CLOSING &&
        scb->state != ISC_STATE_CLOSING2) || scb->fd == -1)
     return;
diff --git a/src/libraries/libisc-new/src/isc_relocate.c b/src/libraries/libisc-new/src/isc_relocate.c
new file mode 100644
index 0000000000000000000000000000000000000000..15981052c31a9e23c8c93136ad68fb4b14b9e5e1
--- /dev/null
+++ b/src/libraries/libisc-new/src/isc_relocate.c
@@ -0,0 +1,35 @@
+/*
+** isc_relocate.c             Relocate file descriptors
+**
+** Copyright (c) 1999  Lysator Academic Computer Association.
+**
+*/
+
+#ifdef HAVE_STDARG_H
+#  include <stdarg.h>
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+
+#include "isc.h"
+#include "intern.h"
+
+int
+isc_relocate_fd(int fd,
+		int limit)
+{
+    int high_fd;
+
+    if (limit <= 0)
+	return fd;
+
+    high_fd = fcntl(fd, F_DUPFD, limit);
+    if (high_fd < 0)
+	return fd;
+
+    close(fd);
+    return high_fd;
+}
diff --git a/src/libraries/libisc-new/src/isc_session.c b/src/libraries/libisc-new/src/isc_session.c
index 2dd2904ebfa71d7cba8eb950875338f9f7682c7a..8a5dbfee214b0204f4660fc749f65a7b5a0c4c88 100644
--- a/src/libraries/libisc-new/src/isc_session.c
+++ b/src/libraries/libisc-new/src/isc_session.c
@@ -15,6 +15,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <errno.h>
+#include <time.h>
 #ifdef HAVE_STDDEF_H
 #  include <stddef.h>
 #endif
@@ -225,14 +226,6 @@ isc_create(IscSessionConfig *cfg, IscHandler *fun)
   scb->wr_msg_q = NULL; 
   scb->handlers = NULL;
 
-  scb->fun.read = NULL;
-  scb->fun.write = NULL;
-  scb->fun.close = NULL;
-  scb->fun.poll = NULL;
-  scb->fun.accept = NULL;
-  scb->fun.destroy = NULL;
-  scb->fun.parse = NULL;
-
   scb->cfg = cfg;
   
   scb->stats.rx.bytes   = 0;
@@ -281,7 +274,7 @@ isc_destroy(IscMaster *mcb,
   */
   if (scb->nlinks <= 0)
   {
-    if (scb->fun.destroy)
+    if (scb->handlers->current.destroy)
       ISC_SCALLFUN1(scb, destroy, scb);
 
     while (isc_pophandler(scb))
diff --git a/src/libraries/libisc-new/src/isc_stdout.c b/src/libraries/libisc-new/src/isc_stdout.c
index 8c5bec104f4275f875c38d016524c88945aa4df9..25ef1c977b16c7c9dc0018d07c8ef0b9ed0642ac 100644
--- a/src/libraries/libisc-new/src/isc_stdout.c
+++ b/src/libraries/libisc-new/src/isc_stdout.c
@@ -30,6 +30,7 @@ isc_putc(int           chr,
 	 IscSession  * scb)
 {
   if (scb->state != ISC_STATE_CONNECTING &&
+      scb->state != ISC_STATE_DISABLED &&
       scb->state != ISC_STATE_RUNNING)
     return EOF;
   
@@ -53,6 +54,7 @@ isc_write(IscSession  * scb,
 
 
   if (scb->state != ISC_STATE_CONNECTING &&
+      scb->state != ISC_STATE_DISABLED &&
       scb->state != ISC_STATE_RUNNING)
     return EOF;
   
diff --git a/src/libraries/libisc-new/src/isc_tcp.c b/src/libraries/libisc-new/src/isc_tcp.c
index 00aba05396c0ece3843cc9f618699ed74f4613d1..88522173548afcccefa37d01dc6d830865043248 100644
--- a/src/libraries/libisc-new/src/isc_tcp.c
+++ b/src/libraries/libisc-new/src/isc_tcp.c
@@ -58,13 +58,9 @@ isc_tcp_accept_fn(IscHandlerList *UNUSED(hl),
   
   new_scb = isc_createtcp(scb->cfg, fd);
   if (!new_scb)
-  {
-    close(fd);
     return NULL;
-  }
   
   /* Fill in the session info structure */
-  new_scb->fd    = fd;
   new_scb->state = ISC_STATE_RUNNING;
   new_scb->mode  = O_RDWR;
   new_scb->info.tcp.raddr = isc_getraddress(new_scb);
@@ -160,7 +156,8 @@ isc_mktcpaddress(const char *address,
 
 		  
 /*
-** Create a TCP session
+** Create a TCP session.
+** Will close fd and return NULL if an error occurs.
 */
 IscSession *
 isc_createtcp(IscSessionConfig *cfg, int fd)
@@ -174,6 +171,8 @@ isc_createtcp(IscSessionConfig *cfg, int fd)
   if (fd == -1)
     if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
       return NULL;
+
+  fd = isc_relocate_fd(fd, cfg->fd_relocate);
   
   /* Set non blocking write mode */
   if ((res = fcntl(fd, F_GETFL, 0)) == -1)
@@ -208,7 +207,10 @@ isc_createtcp(IscSessionConfig *cfg, int fd)
   
   scb = isc_create(cfg, &isc_tcp_funs);
   if (!scb)
+  {
+    close(fd);
     return NULL;
+  }
 
   scb->type = ISC_TYPE_TCP;
   scb->fd = fd;
diff --git a/src/libraries/libisc-new/src/isc_udp.c b/src/libraries/libisc-new/src/isc_udp.c
index 05cbe8bb6cc813f65359cb069f3b59b4bdfc4c73..e6d781a5b8367c3b81736c145cda02021cbde59c 100644
--- a/src/libraries/libisc-new/src/isc_udp.c
+++ b/src/libraries/libisc-new/src/isc_udp.c
@@ -203,6 +203,8 @@ isc_createudp(IscSessionConfig *cfg)
   
   if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
     return NULL;
+
+  fd = isc_relocate_fd(fd, cfg->fd_relocate);
   
   /* Set non blocking write mode */
   if ((res = fcntl(fd, F_GETFL, 0)) == -1)
diff --git a/src/libraries/libisc-new/src/isc_wait.c b/src/libraries/libisc-new/src/isc_wait.c
index 2f52a8bbd240d39cc4864578d70ac896a50f13d2..4f0e101646645b8c275ca841bf61c0977554765c 100644
--- a/src/libraries/libisc-new/src/isc_wait.c
+++ b/src/libraries/libisc-new/src/isc_wait.c
@@ -18,6 +18,9 @@
 #ifdef HAVE_STDDEF_H
 #  include <stddef.h>
 #endif
+#ifdef HAVE_STDARG_H
+#  include <stdarg.h>
+#endif
 
 #include "isc.h"
 #include "intern.h"