diff --git a/src/libraries/libisc-new/.cvsignore b/src/libraries/libisc-new/.cvsignore
index bfa1ce9eb40d19804150f0a1ff2c5faa8d55b8b7..18113ed1701bbbbd50c570aa23a67de0a6d4241a 100644
--- a/src/libraries/libisc-new/.cvsignore
+++ b/src/libraries/libisc-new/.cvsignore
@@ -1,2 +1,8 @@
 Makefile
-dependencies
+Makefile.in
+aclocal.m4
+config.cache
+config.log
+config.status
+configure
+isc-*
diff --git a/src/libraries/libisc-new/ChangeLog b/src/libraries/libisc-new/ChangeLog
index afbfb3a31a70afc8baf2a860f931c3b7beacc1ed..996e7fafbf2e5f9c6748fccebe82c2658264738b 100644
--- a/src/libraries/libisc-new/ChangeLog
+++ b/src/libraries/libisc-new/ChangeLog
@@ -1,5 +1,7 @@
 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/.cvsignore b/src/libraries/libisc-new/build/.cvsignore
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..10b961ad963604811a8842ba7da40feb9c077580 100644
--- a/src/libraries/libisc-new/build/.cvsignore
+++ b/src/libraries/libisc-new/build/.cvsignore
@@ -0,0 +1 @@
+remove me
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/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/mux.c b/src/libraries/libisc-new/demo/mux.c
index faea614f161ed5e59fcb4dfa6ac153adaff9d18d..a06df4fd3c48321d483eb98c65a98c1c26eca1e8 100644
--- a/src/libraries/libisc-new/demo/mux.c
+++ b/src/libraries/libisc-new/demo/mux.c
@@ -2,7 +2,7 @@
 ** libmux.c                A set of functions to implement a multiplexing
 **                         protocol above the ISC library
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
diff --git a/src/libraries/libisc-new/demo/mux.h b/src/libraries/libisc-new/demo/mux.h
index 8885a8fc2bfd4b552d3134663c1ee389e9f731e9..1b8a68f9e54a2096f06e808c60f49d7547a5018d 100644
--- a/src/libraries/libisc-new/demo/mux.h
+++ b/src/libraries/libisc-new/demo/mux.h
@@ -2,7 +2,7 @@
 ** mux.h                   A set of functions to implement a multiplexing
 **                         protocol above the ISC library
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
diff --git a/src/libraries/libisc-new/doc/.cvsignore b/src/libraries/libisc-new/doc/.cvsignore
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..282522db0342d8750454b3dc162493b5fc709cc8 100644
--- a/src/libraries/libisc-new/doc/.cvsignore
+++ b/src/libraries/libisc-new/doc/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/src/libraries/libisc-new/man/.cvsignore b/src/libraries/libisc-new/man/.cvsignore
index f3c7a7c5da68804a1bdf391127ba34aed33c3cca..282522db0342d8750454b3dc162493b5fc709cc8 100644
--- a/src/libraries/libisc-new/man/.cvsignore
+++ b/src/libraries/libisc-new/man/.cvsignore
@@ -1 +1,2 @@
 Makefile
+Makefile.in
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/src/.cvsignore b/src/libraries/libisc-new/src/.cvsignore
index 6b5b73a097325cccd40e0382a7cc3ace76825ca8..e9955884756af11fe171e89bf99e459ac44f1a2a 100644
--- a/src/libraries/libisc-new/src/.cvsignore
+++ b/src/libraries/libisc-new/src/.cvsignore
@@ -1,3 +1,3 @@
+.deps
 Makefile
-dependencies
-isc-new.h
+Makefile.in
diff --git a/src/libraries/libisc-new/src/ChangeLog b/src/libraries/libisc-new/src/ChangeLog
deleted file mode 100644
index 0c78b487b8f09a4b6fb20cf8641f27c33b4a6cb6..0000000000000000000000000000000000000000
--- a/src/libraries/libisc-new/src/ChangeLog
+++ /dev/null
@@ -1,105 +0,0 @@
-Tue Aug 12 21:13:17 1997  Per Cederqvist  <ceder@lysator.liu.se>
-
-	Port to NetBSD1.1/SPARC (patch from teddy@fukt.hk-r.se).
-	* isc_event.c: Include unistd.h (needed because of select) and
- 	string.h (needed because of bzero).
-
-Fri Jun  6 23:38:12 1997  Per Cederqvist  <ceder@lysator.liu.se>
-
-	Port to AIX.
-	* isc_tcp.c: Don't declare sleep.
-	* isc_session.c: Don't declare read or write.
-
-Sun Aug  4 03:24:47 1996  Per Cederqvist  <ceder@lysator.liu.se>
-
-	* isc_event.c: Don't declare bzero.
-
-Sat Aug  3 17:54:41 1996  Per Cederqvist  <ceder@lysator.liu.se>
-
-	* isc_socket.c: Don't declare bzero.
-
-	* isc_event.c: Include <sys/select.h> if HAVE_SYS_SELECT_H.
-
-Mon Jul 29 01:28:25 1996  Per Cederqvist  <ceder@lysator.liu.se>
-
-	* isc.h (isc_printf): Tell GCC that the second argument is a
-	printf-style format string if HAVE_ATTRIBUTE_FORMAT_PRINTF is set.
-
-Fri Sep  1 20:46:55 1995  Per Cederqvist  (ceder@lysator.liu.se)
-
-	* isc_socket.c (isc_gethostname): Return NULL if given a NULL
-	IscAddress.
-
-	* isc_tcp.c (isc_createtcp): Fixed calls to setsockopt with
-	SO_LINGER and SO_REUSEADDR arguments.  The old-style style
-	previously used should no longer be necessary on modern operating
-	systems, and in fact it no longer works everywere.
-	(isc_listentcp): Clear errno on each loop in the retry loop.
-
-Sun Mar  6 20:46:04 1994  Per Cederqvist  (ceder@lysator.liu.se)
-
-	* isc_output.c: Include sys/types.h.
-
-Sat Mar  5 18:23:22 1994  Per Cederqvist  (ceder@lysator.liu.se)
-
-	* Makefile.src: New file.
-
-Mon Oct 18 13:20:39 1993  Per Cederqvist  (ceder@lysator.liu.se)
-
-	* isc.h: Don't include any include files.
-
-Sat Oct 16 17:47:44 1993  Per Cederqvist  (ceder@lysator.liu.se)
-
-	* isc.h: Test HAVE_STDARG_H.
-	(isc_printf, isc_vprintf): Don't declare unless HAVE_STDARG_H.
-	* isc_stdout.c (isc_printf, isc_vprintf): Don't define unles
-	HAVE_STDARG_H.
-
-Wed Oct 13 00:51:03 1993  Per Cederqvist  (ceder@lysator.liu.se)
-
-	* printf.c (UCB_printf): Renamed _printf to UCB_printf (to avoid
-	conflicts on HPUX).
-	* isc_stdout.c (isc_printf): Update call to UCB_printf.
-
-	* isc_socket.c, isc_tcp.c, isc_udp.c: Dont include <sys/socket.h>
-	(included from "isc.h").
-
-Sun Oct 10 17:00:49 1993  Per Cederqvist  (ceder@lysator.liu.se)
-
-	* isc_alloc.c (calloc): don't declare (clashed with SunOS 5.2).
-
-	* isc_tcp.c (isc_createtcp): Don't try to set SO_DONTLINGER if
-	SO_DONTLINGER is undefined.
-	* isc_udp.c (isc_createudp): Likewise.
-
-	* Use O_NONBLOCK instead of FNDELAY if FNDELAY is undefined:
-	* isc_sesscion.c (isc_openfd): Do it.
-	* isc_tcp.c (isc_createtcp): Do it.
-	* isc_udp.c (isc_createudp): Do it.
-
-	* Don't declare the following functions, since they conflicts with
-	system include files on at least one version of Linux:
-	* isc_session.c, isc_tcp.c, isc_udp.c (memset): don't declare.
-	* isc_socket.c, isc_stdout.c, isc_tcp.c, isc_udp.c (memcpy): don't
-	declare.
-	* isc_tcp.c, isc_udp.c (setsockopt): don't declare.
-	* isc_tcp.c, isc_udp.c (atoi): don't declare.
-	* isc_udp.c (recvfrom, sendto): don't declare.
-	* printf.c (memchr): don't declare.
-
-Fri Sep 24 16:16:36 1993  Per Cederqvist  (ceder@lysator.liu.se)
-
-	* isc_event.c (isc_getnextevent): event->session was sometimes set
-	erronously if an error occured in select() or if a timeout occured.
-
-Sun Jan 17 02:56:47 1993  Per Cederqvist  (ceder@konrad)
-
-	* isc_session.c (isc_remove): Fix memory leak: Free the list-head.
-
-	* isc_tcp.c (isc_tcp_destroy_fn): Fix another memory leak: Pop any
-	  remaining handlers. 
-
-Sun May 31 01:49:22 1992  Per Cederqvist  (ceder@lysator)
-
-	* isc_master (isc_initialize): Allocate the master control block
-	with the allocator that is passed in IscConfig (if any).
diff --git a/src/libraries/libisc-new/src/Makefile.src b/src/libraries/libisc-new/src/Makefile.src
index ab75a3645bd11d63cfc5226aa755fcfdb2ec0ea6..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
--- a/src/libraries/libisc-new/src/Makefile.src
+++ b/src/libraries/libisc-new/src/Makefile.src
@@ -1,21 +0,0 @@
-#
-# Makefile for libisc
-#
-# Copyright (c) 1992, 1993, 1994 Peter Eriksson and Per Cederqvist of the
-#                    Lysator Academic Computer Association.
-#
-#
-#
-#
-LK_STD
-LK_STD_LIB([libisc-new$(PROFILE-LIB-SUFFIX).a],
-	[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])
-LK_INSTALL_BUILT_HDRS(isc-new.h)
-LK_ALL_C_DEPEND
-LK_DESCEND
-[tags:
-	etags -t *.[hc]]
-[isc-new.h: isc.h
-	cp $(srcdir)/isc.h isc-new.h]
diff --git a/src/libraries/libisc-new/src/intern.h b/src/libraries/libisc-new/src/intern.h
index d99bb1dcf8ea670541be445532db92c994ed0d1b..800d7ed0032a3d05e3be1270fb359628e0fec776 100644
--- a/src/libraries/libisc-new/src/intern.h
+++ b/src/libraries/libisc-new/src/intern.h
@@ -1,7 +1,7 @@
 /*
 ** intern.h                Definitions and prototypes used internally
 **
-** Copyright (c) 1991, 1992 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
diff --git a/src/libraries/libisc-new/src/isc.h b/src/libraries/libisc-new/src/isc.h
index b7ee5fd61a785dff90d51a27af028ca8517e8d38..bf0a488613a43c5dbdeed53ae1309b8252dbcfb9 100644
--- a/src/libraries/libisc-new/src/isc.h
+++ b/src/libraries/libisc-new/src/isc.h
@@ -1,7 +1,7 @@
 /*
 ** isc.h                        structures and defines used in a ISC server
 **
-** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -143,6 +143,7 @@ typedef enum
   ISC_STATE_RUNNING,
   ISC_STATE_DISABLED,
   ISC_STATE_CLOSING,
+  ISC_STATE_CLOSING2,		/* An ISC_EVENT_LOGOUT has been generated. */
   ISC_STATE_LISTENING
 } IscSessionState;
 
@@ -359,6 +360,7 @@ IscEvent
   IscEventType      event;
   IscSession      * session;
   IscMessage      * msg;
+  IscSession	  * listen_session;
 };
 
 
@@ -457,6 +459,12 @@ isc_getnextevent(IscMaster  * mcb,
 
 
 
+/*
+** Wait for pending connections.
+*/
+IscEvent *
+isc_wait(IscMaster *mcb, long timeout);
+ 
 /*
 ** This should be used to discard an event when it has been processed.
 */
@@ -505,27 +513,25 @@ isc_putc(int           chr,
 
 
 
+#ifdef ISC_PRINTF_SUPPORT
+#  ifndef HAVE_STDARG_H
+#    error isc_printf is not available on systems that lack stdarg.h.
+#  else
+
 /*
-** Put a formatted string on the transmit queue. Not available unless
-** your system supports <stdarg.h>. Avoid these functions. They are
-** likely to disappear in future versions of ISC.
+** Put a formatted string on the transmit queue
 */
-#ifdef HAVE_STDARG_H
 extern int
 isc_printf(IscSession  * scb,
 	   const char  * format,
-	   ...)
-#  if HAVE_ATTRIBUTE_FORMAT_PRINTF
-    __attribute__ ((format (printf, 2, 3)))
-#  endif
-    ;
-#endif
+	   ...);
 
-#ifdef HAVE_STDARG_H
 extern int
 isc_vprintf(IscSession  * scb,
 	    const char  * format,
 	    va_list       AP);
+
+#  endif
 #endif
 
 
diff --git a/src/libraries/libisc-new/src/isc_abort.c b/src/libraries/libisc-new/src/isc_abort.c
index 8cd625e2b4aff04baf420b663dba6a00c2a7ecc3..cee65280e1206b75beb191b71a2b123ba8d93733 100644
--- a/src/libraries/libisc-new/src/isc_abort.c
+++ b/src/libraries/libisc-new/src/isc_abort.c
@@ -1,7 +1,7 @@
 /*
 ** isc_abort.c                                  Route to handle fatal errors
 **
-** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -10,7 +10,7 @@
 
 #include <stdio.h>
 #ifdef HAVE_STDLIB_H
-#include <stdlib.h>
+#  include <stdlib.h>
 #endif
 #ifdef HAVE_STDDEF_H
 #  include <stddef.h>
diff --git a/src/libraries/libisc-new/src/isc_alloc.c b/src/libraries/libisc-new/src/isc_alloc.c
index 214d59f810bc432d815a2826d7f7086539f4948b..054628f661fac23d1f33225f2f6420c027471c53 100644
--- a/src/libraries/libisc-new/src/isc_alloc.c
+++ b/src/libraries/libisc-new/src/isc_alloc.c
@@ -1,7 +1,7 @@
 /*
 ** isc_alloc.c                               ISC storage allocation routines
 **
-** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -38,16 +38,6 @@
 #define ISC_MAGIC_FREE  0xEE47A37F
 
 
-/*
-** External declarations
-*/
-#if defined(__sun__) && !defined(__stdlib_h)
-extern void *malloc(size_t);
-/*extern void *calloc(int, size_t);*/
-extern void *realloc(void *, size_t);
-extern void free(void *);
-#endif
-
 /*
 ** Pointers to functions to handle storage allocation
 */
@@ -74,14 +64,14 @@ isc_setallocfn(void * (*mallocfn)(size_t size),
 void *
 isc_malloc(size_t size)
 {
-  unsigned int  * buf;
+  unsigned long  * buf;
 
 
   if (isc_mallocfn)
-    buf = (unsigned int *) (*isc_mallocfn)(size + sizeof(unsigned int));
+    buf = (unsigned long *) (*isc_mallocfn)(size + sizeof(unsigned long));
   else
   {
-    buf = (unsigned int *) malloc(size + sizeof(unsigned int));
+    buf = (unsigned long *) malloc(size + sizeof(unsigned long));
     if (!buf)
       isc_abort("isc_malloc");
   }
@@ -95,33 +85,24 @@ isc_malloc(size_t size)
 void *
 isc_realloc(void *oldbuf, size_t size)
 {
-  unsigned int *buf;
+  unsigned long *buf;
 
 
   if (!oldbuf)
     return isc_malloc(size);
 
-  buf = (unsigned int *) oldbuf;
-  switch (*--buf)
-  {
-    case ISC_MAGIC_ALLOC:
-      break;
-
-    case ISC_MAGIC_FREE:
-      isc_abort("isc_realloc");
-
-    default:
-      isc_abort("isc_realloc");
-  }
+  buf = (unsigned long *) oldbuf;
+  if (*--buf != ISC_MAGIC_ALLOC)
+    isc_abort("isc_realloc");
 
   *buf = ISC_MAGIC_FREE;
   
   if (isc_reallocfn)
-    buf = (unsigned int *) (*isc_reallocfn)((void *) buf,
-					    size + sizeof(unsigned int));
+    buf = (unsigned long *) (*isc_reallocfn)((void *) buf,
+					     size + sizeof(unsigned long));
   else
   {
-    buf = (void *) realloc((void *) buf, size + sizeof(unsigned int));
+    buf = (void *) realloc((void *) buf, size + sizeof(unsigned long));
     if (!buf)
       isc_abort("isc_realloc");
   }
@@ -135,24 +116,15 @@ isc_realloc(void *oldbuf, size_t size)
 void
 isc_free(void *buf)
 {
-  unsigned int *ibuf;
+  unsigned long *ibuf;
 
   
   if (!buf)
     isc_abort("isc_free");
     
-  ibuf = (unsigned int *) buf;
-  switch (*--ibuf)
-  {
-    case ISC_MAGIC_ALLOC:
-      break;
-
-    case ISC_MAGIC_FREE:
-      isc_abort("isc_free");
-
-    default:
-      isc_abort("isc_free");
-  }
+  ibuf = (unsigned long *) buf;
+  if (*--ibuf != ISC_MAGIC_ALLOC)
+    isc_abort("isc_free");
 
   *ibuf = ISC_MAGIC_FREE;
   
diff --git a/src/libraries/libisc-new/src/isc_event.c b/src/libraries/libisc-new/src/isc_event.c
index e7eeea7ee2ade082bce2e52e30c8bbca0e042eda..603ff257a6c20d0a9b588d99ddff67ac3d6a3967 100644
--- a/src/libraries/libisc-new/src/isc_event.c
+++ b/src/libraries/libisc-new/src/isc_event.c
@@ -1,7 +1,7 @@
 /*
 ** isc_event.c            		 definitions of ISC subsystem routines
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -18,7 +18,9 @@
 #ifdef HAVE_STDARG_H
 #  include <stdarg.h>
 #endif
-#include <time.h>
+#ifdef TIME_WITH_SYS_TIME
+#  include <time.h>
+#endif
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/socket.h>
@@ -30,10 +32,10 @@
 #  include <sys/select.h>
 #endif
 #ifdef HAVE_UNISTD_H
-#  include <unistd.h>
+#  include <unistd.h>	/* Needed on NetBSD1.1/SPARC due to select */
 #endif
 #ifdef HAVE_STRING_H
-#  include <string.h>
+#  include <string.h>	/* Needed on NetBSD1.1/SPARC due to bzero */
 #endif
 
 #include "isc.h"
@@ -41,17 +43,6 @@
 
 
 
-/*
- * External function declarations.
- */
-/*extern void *bzero(void *buf, unsigned length);*/
-extern time_t time(time_t *buf);
-/*extern int select(int setsize,
-		  fd_set *rs, fd_set *rw, fd_set *es,
-		  struct timeval *wait);*/
-
-
-
 IscEvent *
 isc_getnextevent(IscMaster *mcb, long timeout)
 {
@@ -74,6 +65,7 @@ isc_getnextevent(IscMaster *mcb, long timeout)
   ISC_XNEW(event);
   event->msg     = NULL;
   event->session = NULL;
+  event->listen_session = NULL;
 
 RETRY:
   /* Set up the list of file descriptors to wait on */
@@ -113,6 +105,7 @@ RETRY:
 	if (scb->fd == -1 || !isc_pollqueue(scb->wr_msg_q))
 	{
 	  event->event = ISC_EVENT_LOGOUT;
+	  scb->state = ISC_STATE_CLOSING2;
 	
 	  /* Move the session pointer to the next in the circular queue */
 	  mcb->sessions = mcb->sessions->next;
@@ -296,13 +289,15 @@ RETRY:
       {
 	event->event   = ISC_EVENT_ERROR;
 	event->session = NULL;
-	event->msg = isc_mkstrmsg("Failed isc_getnextevent() in new session");
+	event->msg     = isc_mkstrmsg("Failed isc_getnextevent() "
+				      "in new session");
 	return event;
       }
 	    
       /* Fill in the event info structure */
       event->session = new_scb;
       event->event   = ISC_EVENT_LOGIN;
+      event->listen_session = scb;
 
       /* Move the session pointer to the next in the circular queue */
       mcb->sessions = mcb->sessions->next;
@@ -336,7 +331,7 @@ RETRY:
       break;
   }
 
-  goto RETRY; /* This happens if/when only transmits where pending.. */
+  goto RETRY; /* This happens if/when only transmits were pending... */
 }
 
 
diff --git a/src/libraries/libisc-new/src/isc_handler.c b/src/libraries/libisc-new/src/isc_handler.c
index a319c986a55fb2831ce975b2c304d736c5c17ccb..853c8d196d9ab478a277f9badd50130c2ad3940b 100644
--- a/src/libraries/libisc-new/src/isc_handler.c
+++ b/src/libraries/libisc-new/src/isc_handler.c
@@ -1,7 +1,7 @@
 /*
 ** isc_handler.c                 Routines to handle IscSession handlers
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
diff --git a/src/libraries/libisc-new/src/isc_master.c b/src/libraries/libisc-new/src/isc_master.c
index 63204833390e667f7f1fbe29127cc19bc52a2d0e..262d73c47884c59133738886d8c5e6e1fcb498e2 100644
--- a/src/libraries/libisc-new/src/isc_master.c
+++ b/src/libraries/libisc-new/src/isc_master.c
@@ -1,7 +1,7 @@
 /*
 ** isc_master.c                               IscMaster control functions
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -10,7 +10,7 @@
 
 #include <errno.h>
 #ifdef HAVE_STDLIB_H
-#include <stdlib.h>
+#  include <stdlib.h>
 #endif
 #ifdef HAVE_STDDEF_H
 #  include <stddef.h>
diff --git a/src/libraries/libisc-new/src/isc_message.c b/src/libraries/libisc-new/src/isc_message.c
index e98ede17872e0a8b753b0f6652f859bb35668ebc..8d311af08199c71e6d886c6c803591b93c34c2a1 100644
--- a/src/libraries/libisc-new/src/isc_message.c
+++ b/src/libraries/libisc-new/src/isc_message.c
@@ -1,7 +1,7 @@
 /*
 ** isc_message.c                      Generic "IscMessage" handling functions
 **
-** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
diff --git a/src/libraries/libisc-new/src/isc_output.c b/src/libraries/libisc-new/src/isc_output.c
index 6cceb46e52a1e715d3f945bda879945ad4786661..bd7292c5c6c63d8b99879176586108ef61336d2f 100644
--- a/src/libraries/libisc-new/src/isc_output.c
+++ b/src/libraries/libisc-new/src/isc_output.c
@@ -1,7 +1,7 @@
 /*
 ** isc_output.c                                   Isc data output functions
 **
-** Copyright (c) 1991, 1992, 1993, 1994 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -17,7 +17,7 @@
 #endif
 #include <errno.h>
 #ifdef HAVE_STRING_H
-#include <string.h>
+#  include <string.h>
 #endif
 #include <sys/file.h>
 #include <errno.h>
@@ -37,6 +37,7 @@ void isc_flush(IscSession *scb)
   switch (scb->state)
   {
     case ISC_STATE_CLOSING:
+    case ISC_STATE_CLOSING2:
       if (scb->wr_msg_q)
       {
 	isc_killqueue(scb->wr_msg_q);
@@ -91,7 +92,8 @@ 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_CLOSING) || scb->fd == -1)
+       scb->state != ISC_STATE_CLOSING &&
+       scb->state != ISC_STATE_CLOSING2) || scb->fd == -1)
     return;
   
   /* Queued entries? Send as much as possible */
diff --git a/src/libraries/libisc-new/src/isc_queue.c b/src/libraries/libisc-new/src/isc_queue.c
index 481155f4e8ea7f5ceca796b592f58c464926d8e5..6b253425ad55aaa406c2d36f9bbdcd0a898fae4a 100644
--- a/src/libraries/libisc-new/src/isc_queue.c
+++ b/src/libraries/libisc-new/src/isc_queue.c
@@ -1,7 +1,7 @@
 /*
 ** isc_queue.c                           Handle queues for the ISC subsystem
 **
-** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -24,6 +24,7 @@
 #include "isc.h"
 #include "intern.h"
 
+
 IscMsgQueue *
 isc_newqueue(void)
 {
diff --git a/src/libraries/libisc-new/src/isc_session.c b/src/libraries/libisc-new/src/isc_session.c
index 3e22b3d076f2c67557a1c34253268fb839a5de51..2dd2904ebfa71d7cba8eb950875338f9f7682c7a 100644
--- a/src/libraries/libisc-new/src/isc_session.c
+++ b/src/libraries/libisc-new/src/isc_session.c
@@ -1,7 +1,7 @@
 /*
 ** isc_session.c                              Routines to handle ISC sessions
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -25,25 +25,20 @@
 #ifndef NULL
 #  include <stdio.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
 
 #include "isc.h"
 #include "intern.h"
-
-
-
-/*
-** External function declarations
-*/
-/*extern void *memset(void *, int, int);*/
-extern int close(int);
-extern time_t time(time_t *);
+#include "unused.h"
 
 
 
 /*
 ** ISC-Internal default function to read data
 */
-IscMessage *isc_default_read_fn(IscHandlerList *hl, IscSession *scb)
+IscMessage *isc_default_read_fn(IscHandlerList *UNUSED(hl), IscSession *scb)
 {
   int status;
   IscMessage *msg;
@@ -68,7 +63,7 @@ IscMessage *isc_default_read_fn(IscHandlerList *hl, IscSession *scb)
 
 
 
-int isc_default_write_fn(IscHandlerList *hl,
+int isc_default_write_fn(IscHandlerList *UNUSED(hl),
 			 IscSession *scb,
 			 IscMessage *msg)
 {
@@ -77,7 +72,7 @@ int isc_default_write_fn(IscHandlerList *hl,
 
 
 
-int isc_default_close_fn(IscHandlerList *hl,
+int isc_default_close_fn(IscHandlerList *UNUSED(hl),
 			 IscSession *scb)
 {
   int code = 0;
@@ -225,7 +220,7 @@ isc_create(IscSessionConfig *cfg, IscHandler *fun)
   scb->fd       = -1;
   scb->type     = ISC_TYPE_UNKNOWN;
   scb->state    = ISC_STATE_UNKNOWN;
-  scb->isc_errno    = 0;
+  scb->isc_errno= 0;
   scb->rd_msg_q = NULL;
   scb->wr_msg_q = NULL; 
   scb->handlers = NULL;
@@ -369,12 +364,12 @@ isc_openfd(IscMaster *mcb,
     close(fd);
     return NULL;
   }
-  
-#ifdef FNDELAY
-  if (fcntl(fd, F_SETFL, res | FNDELAY) == -1)
-#else
+
+  /* If compilation fails on the next line, please report it as a bug
+     to ceder@lysator.liu.se.  I'd like to talk to you so that you can
+     test an autoconf solution to this problem.  As a workaround, you
+     can change "O_NONBLOCK" to "FNDELAY". */
   if (fcntl(fd, F_SETFL, res | O_NONBLOCK) == -1)
-#endif   
   {
     close(fd);
     return NULL;
@@ -396,7 +391,7 @@ isc_openfd(IscMaster *mcb,
 
 
 static void
-isc_file_destroy_fn(IscHandlerList *hl,
+isc_file_destroy_fn(IscHandlerList *UNUSED(hl),
 		    IscSession *scb)
 {
   if (scb->info.file.pathname)
diff --git a/src/libraries/libisc-new/src/isc_socket.c b/src/libraries/libisc-new/src/isc_socket.c
index a04a164ebae2ac700f1ad253eab405cb7d1aedfa..6de9ae642d79c81495a98f45c4cbecf313ac4f84 100644
--- a/src/libraries/libisc-new/src/isc_socket.c
+++ b/src/libraries/libisc-new/src/isc_socket.c
@@ -1,7 +1,7 @@
 /*
 ** isc_socket.c                               Socket specified code
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -9,7 +9,9 @@
 */
 
 #include <stdio.h>
-#include <time.h>
+#ifdef TIME_WITH_SYS_TIME
+#  include <time.h>
+#endif
 #include <sys/types.h>
 #include <sys/time.h>
 #include <netinet/in.h>
@@ -30,27 +32,11 @@
 #endif
 #include <fcntl.h>
 
-
 #include "isc.h"
 #include "intern.h"
 
 
 
-/*
- * External function declarations.
- */
-/*extern void *bzero(void *buf, unsigned length);*/
-/*extern void *memcpy(void *, const void *, int);*/
-/*extern int getsockname(int fd, struct sockaddr *, int *);*/
-/*extern int getpeername(int fd, struct sockaddr *, int *);*/
-extern time_t time(time_t *buf);
-/*extern int select(int setsize,
-		  fd_set *rs, fd_set *rw, fd_set *es,
-		  struct timeval *wait);*/
-/*extern int accept(int fd, struct sockaddr *sock, int *len);*/
-
-
-
 #if defined(__GNUC__) && defined(__sparc__)
 /*
 ** inet_ntoa() is buggy on SPARCs running SunOS 4.1.1, so
@@ -186,7 +172,7 @@ char *isc_gethostname(IscAddress *ia, char *buf, int len)
   
   if (ia == NULL)
   {
-      return NULL;
+    return NULL;
   }
 
   if (!buf)
@@ -197,7 +183,7 @@ char *isc_gethostname(IscAddress *ia, char *buf, int len)
   
   addr = (struct sockaddr_in *) &ia->ip.saddr;
   
-  hp = gethostbyaddr(&addr->sin_addr,sizeof(struct in_addr),AF_INET);
+  hp = gethostbyaddr((char*)&addr->sin_addr, sizeof(struct in_addr), AF_INET);
   if (!hp)
     return NULL;
   
diff --git a/src/libraries/libisc-new/src/isc_stdout.c b/src/libraries/libisc-new/src/isc_stdout.c
index 8d14d510799fcbf63c33eab5cffceb9199427601..8c5bec104f4275f875c38d016524c88945aa4df9 100644
--- a/src/libraries/libisc-new/src/isc_stdout.c
+++ b/src/libraries/libisc-new/src/isc_stdout.c
@@ -1,7 +1,7 @@
 /*
 ** isc_stdout.c                 Some nice-to-have functions for output..
 **
-** Copyright (c) 1991, 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1991 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -21,9 +21,9 @@
 
 #include "isc.h"
 
-
+#ifdef ISC_PRINTF_SUPPORT
 extern int UCB_printf( int (*fctn)(int chr), const char *format, ...);
-/*extern void *memcpy(void *, const void *, int);*/
+#endif
 
 int
 isc_putc(int           chr,
@@ -83,6 +83,8 @@ isc_write(IscSession  * scb,
 
 
 
+#ifdef ISC_PRINTF_SUPPORT
+
 static IscSession  * send_scb;  /* Used by isc_printf */
 
 static int send_putc(int c)
@@ -90,7 +92,7 @@ static int send_putc(int c)
   return isc_putc(c, send_scb);
 }
 
-#ifdef HAVE_STDARG_H
+
 int
 isc_vprintf(IscSession  * scb,
 	    const char  * format,
@@ -100,9 +102,8 @@ isc_vprintf(IscSession  * scb,
   
   return UCB_printf(send_putc, format, AP);
 }
-#endif
 
-#ifdef HAVE_STDARG_H
+
 int
 isc_printf(IscSession  * scb,
 	   const char  * format,
@@ -122,4 +123,5 @@ isc_printf(IscSession  * scb,
 
   return cnt;
 }
-#endif
+
+#endif /* ISC_PRINTF_SUPPORT */
diff --git a/src/libraries/libisc-new/src/isc_tcp.c b/src/libraries/libisc-new/src/isc_tcp.c
index 164649590ad233cf80a7db8f19d75228675857df..00aba05396c0ece3843cc9f618699ed74f4613d1 100644
--- a/src/libraries/libisc-new/src/isc_tcp.c
+++ b/src/libraries/libisc-new/src/isc_tcp.c
@@ -1,7 +1,7 @@
 /*
 ** isc_tcp.c                          Routines to handle TCP ISC sessions
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -33,32 +33,19 @@
 #ifndef NULL
 #  include <stdio.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
 
 #include "isc.h"
 #include "intern.h"
+#include "unused.h"
 
 
-
-/*
-** External function declarations
-*/
-/*extern void *memset(void *, int, int);*/
-/*extern void *memcpy(void *, const void *, int);*/
-extern int socket(int, int, int);
-/*extern int setsockopt(int, int, int, char *, int);*/
-/* extern int listen(int, int); */
-/*extern int connect(int, struct sockaddr *, int);*/
-/*extern int bind(int, struct sockaddr *, int);*/
-extern int close(int);
-/*extern int atoi(const char *str);*/
-/*extern int accept(int fd, struct sockaddr *sock, int *len);*/
-
-
-
-IscSession *
-isc_tcp_accept_fn(IscHandlerList *hl,
+static IscSession *
+isc_tcp_accept_fn(IscHandlerList *UNUSED(hl),
 		  IscSession *scb,
-		  IscMessage *msg)
+		  IscMessage *UNUSED(msg))
 {
   IscSession *new_scb;
   int fd;
@@ -90,8 +77,8 @@ isc_tcp_accept_fn(IscHandlerList *hl,
 
 
 
-void
-isc_tcp_destroy_fn(IscHandlerList *hl,
+static void
+isc_tcp_destroy_fn(IscHandlerList *UNUSED(hl),
 		   IscSession *scb)
 {
   if (scb->info.tcp.raddr)
@@ -128,7 +115,7 @@ static IscHandler isc_tcp_funs =
 /*
 ** Create a TCP Session Address
 */
-IscAddress *
+static IscAddress *
 isc_mktcpaddress(const char *address,
 		 const char *service)
 {
@@ -145,7 +132,7 @@ isc_mktcpaddress(const char *address,
     addr.sin_family = AF_INET;
     addr.sin_addr.s_addr = htonl(INADDR_ANY);
   }
-  else if (isdigit(address[0]))
+  else if (isdigit((int)(unsigned char)address[0]))
   {
     addr.sin_family = AF_INET;
     addr.sin_addr.s_addr = inet_addr(address);
@@ -160,7 +147,7 @@ isc_mktcpaddress(const char *address,
     memcpy(&addr.sin_addr, hp->h_addr, sizeof(addr.sin_addr));
   }
   
-  if (isdigit(service[0]))
+  if (isdigit((int)(unsigned char)service[0]))
     addr.sin_port = htons(atoi(service));
   else if ((sp = getservbyname(service, "tcp")) == NULL)
     return NULL;
@@ -195,11 +182,11 @@ isc_createtcp(IscSessionConfig *cfg, int fd)
     return NULL;
   }
     
-#ifdef FNDELAY
-  if (fcntl(fd, F_SETFL, res | FNDELAY) == -1)
-#else
+  /* If compilation fails on the next line, please report it as a bug
+     to ceder@lysator.liu.se.  I'd like to talk to you so that you can
+     test an autoconf solution to this problem.  As a workaround, you
+     can change "O_NONBLOCK" to "FNDELAY". */
   if (fcntl(fd, F_SETFL, res | O_NONBLOCK) == -1)
-#endif      
   {
     close(fd);
     return NULL;
@@ -210,13 +197,14 @@ isc_createtcp(IscSessionConfig *cfg, int fd)
      apparently now obsolete.  It doesn't work on some Linux boxes. */
   setsockopt(fd, SOL_SOCKET, SO_DONTLINGER, 0, 0); 
   setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, 0, 0);
-#endif
-
+#else
+  /* This is the modern way to turn off linger and turn on reuseaddr. */
   ling.l_onoff = 0;
   ling.l_linger = 0;
   setsockopt(fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling)); 
   flag = 1;
   setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag));
+#endif
   
   scb = isc_create(cfg, &isc_tcp_funs);
   if (!scb)
@@ -282,7 +270,6 @@ isc_connecttcp(IscSession *scb,
     address = "localhost";
 
   ia = isc_mktcpaddress(address, service);
-
   if (!ia)
     return -1;
   
diff --git a/src/libraries/libisc-new/src/isc_udp.c b/src/libraries/libisc-new/src/isc_udp.c
index 905124f752d352caf424f2fc9413894dd7205e00..05cbe8bb6cc813f65359cb069f3b59b4bdfc4c73 100644
--- a/src/libraries/libisc-new/src/isc_udp.c
+++ b/src/libraries/libisc-new/src/isc_udp.c
@@ -1,7 +1,7 @@
 /*
 ** isc_udp.c                          Routines to handle UDP ISC sessions
 **
-** Copyright (c) 1992, 1993 Peter Eriksson and Per Cederqvist of the
+** Copyright (c) 1992 Peter Eriksson and Per Cederqvist of the
 **                    Lysator Academic Computer Association.
 **
 ** history:
@@ -30,36 +30,25 @@
 #  include <string.h>
 #endif
 #include <fcntl.h>
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
 #ifndef NULL
 #  include <stdio.h>
 #endif
 
 #include "isc.h"
 #include "intern.h"
-
-
-
-/*extern void *memset(void *, int, int);*/
-/*extern void *memcpy(void *, const void *, int);*/
-extern int socket(int, int, int);
-/*extern int setsockopt(int, int, int, char *, int);*/
-/*extern int connect(int, struct sockaddr *, int);*/
-/*extern int bind(int, struct sockaddr *, int);*/
-extern int close(int);
-/*extern int atoi(const char *str);*/
-/*extern int recvfrom(int fd, char *buf, int len, int flags,
-		    struct sockaddr *from, int *flen);*/
-/*extern int sendto(int fd, char *buf, int len, int flags,
-		  struct sockaddr *from, int flen);*/
-extern int sprintf(char *, const char *, ...);
+#include "unused.h"
 
 
 
 /*
 ** Receive an UDP message and put it into an IscMessage
 */
-IscMessage *isc_udp_read_fn(IscHandlerList *hl,
-			    IscSession *scb)
+static IscMessage *
+isc_udp_read_fn(IscHandlerList *UNUSED(hl),
+		IscSession *scb)
 {
   IscMessage *msg;
   struct sockaddr addr;
@@ -92,9 +81,10 @@ IscMessage *isc_udp_read_fn(IscHandlerList *hl,
 /*
 ** Transmit an UDP message to a remote service
 */
-int isc_udp_write_fn(IscHandlerList *hl,
-		     IscSession *scb,
-		     IscMessage *msg)
+static int
+isc_udp_write_fn(IscHandlerList *hl,
+		 IscSession *scb,
+		 IscMessage *msg)
 {
   /* No target and no default target? Then fail. */
   if (!msg->address && !scb->info.udp.raddr)
@@ -115,8 +105,8 @@ int isc_udp_write_fn(IscHandlerList *hl,
 
 
 
-void
-isc_udp_destroy_fn(IscHandlerList *hl,
+static void
+isc_udp_destroy_fn(IscHandlerList *UNUSED(hl),
 		   IscSession *scb)
 {
   if (scb->info.udp.raddr)
@@ -137,7 +127,7 @@ isc_udp_destroy_fn(IscHandlerList *hl,
 /*
 ** Create an UDP Session Address
 */
-IscAddress *
+static IscAddress *
 isc_mkudpaddress(const char *address,
 		 const char *service)
 {
@@ -160,7 +150,7 @@ isc_mkudpaddress(const char *address,
     addr.sin_family = AF_INET;
     addr.sin_addr.s_addr = htonl(INADDR_BROADCAST);
   }
-  else if (isdigit(address[0]))
+  else if (isdigit((int)(unsigned char)address[0]))
   {
     addr.sin_family = AF_INET;
     addr.sin_addr.s_addr = inet_addr(address);
@@ -175,7 +165,7 @@ isc_mkudpaddress(const char *address,
     memcpy(&addr.sin_addr, hp->h_addr, sizeof(addr.sin_addr));
   }
   
-  if (isdigit(service[0]))
+  if (isdigit((int)(unsigned char)service[0]))
     addr.sin_port = htons(atoi(service));
   else if ((sp = getservbyname(service, "udp")) == NULL)
     return NULL;
@@ -208,7 +198,8 @@ isc_createudp(IscSessionConfig *cfg)
 {
   IscSession *scb;
   int fd, res;
-  
+  int flag;
+  struct linger ling;
   
   if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
     return NULL;
@@ -220,20 +211,29 @@ isc_createudp(IscSessionConfig *cfg)
     return NULL;
   }
     
-#ifdef FNDELAY
-  if (fcntl(fd, F_SETFL, res | FNDELAY) == -1)
-#else
+  /* If compilation fails on the next line, please report it as a bug
+     to ceder@lysator.liu.se.  I'd like to talk to you so that you can
+     test an autoconf solution to this problem.  As a workaround, you
+     can change "O_NONBLOCK" to "FNDELAY". */
   if (fcntl(fd, F_SETFL, res | O_NONBLOCK) == -1)
-#endif      
   {
     close(fd);
     return NULL;
   }
   
-#ifdef SO_DONTLINGER
+#if 0
+  /* The setsockopt calls below used to look like this, but this style is
+     apparently now obsolete.  It doesn't work on some Linux boxes. */
   setsockopt(fd, SOL_SOCKET, SO_DONTLINGER, 0, 0); 
-#endif
   setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, 0, 0);
+#else
+  /* This is the modern way to turn off linger and turn on reuseaddr. */
+  ling.l_onoff = 0;
+  ling.l_linger = 0;
+  setsockopt(fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling)); 
+  flag = 1;
+  setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag));
+#endif
   
   scb = isc_create(cfg, &isc_udp_funs);
   if (!scb)
diff --git a/src/libraries/libisc-new/src/printf.c b/src/libraries/libisc-new/src/printf.c
index bf493d8397ff28ff2f6a30101f73ed0a3081ed0d..121af126c6eac072927c42228e1e35fc402b01d9 100644
--- a/src/libraries/libisc-new/src/printf.c
+++ b/src/libraries/libisc-new/src/printf.c
@@ -1,6 +1,3 @@
-#ifndef HAVE_STDARG_H
-int NoPrintf='Q';
-#else  /* HAVE_STDARG_H */
 /*
  * print.c
  *
@@ -57,15 +54,12 @@ static char sccsid[] = "@(#)doprnt.c	5.39 (Berkeley) 6/28/90";
 #ifdef HAVE_STRING_H
 #  include <string.h>
 #endif
+#ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+#endif
 #include <math.h>
 
 
-/*
- * External function declarations
- */
-/*extern char *memchr(char *, int, int);*/
-
-
 /* 11-bit exponent (VAX G floating point) is 308 decimal digits */
 #define	MAXEXP		308
 /* 128 bit fraction takes up 39 decimal digits; max reasonable precision */
@@ -711,4 +705,3 @@ isspecial(d, bufp, signp)
 }
 #endif
 
-#endif /* HAVE_STDARG_H */