summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@debian.org>2003-12-01 17:11:15 +0000
committerManoj Srivastava <srivasta@debian.org>2003-12-01 17:11:15 +0000
commit371472d9fb6a936149b105a6563a0550d35bdf1a (patch)
tree6d23751e44a7dddf4e29918551f1ea0513352622 /lib
Initial import of upstream branch
Initial import of upstream branch git-archimport-id: srivasta@debian.org--2003-primary/dist--upstream--3.70--base-0
Diffstat (limited to 'lib')
-rw-r--r--lib/C/Jmakefile20
-rw-r--r--lib/C/Makefile.SH188
-rw-r--r--lib/C/fake/Jmakefile29
-rw-r--r--lib/C/fake/Makefile.SH156
-rw-r--r--lib/C/fake/dup2.C78
-rw-r--r--lib/C/fake/getopt.C133
-rw-r--r--lib/C/fake/rename.C45
-rw-r--r--lib/C/fake/scandir.C131
-rw-r--r--lib/C/fake/setsid.C64
-rw-r--r--lib/Jmakefile57
-rw-r--r--lib/Makefile.SH246
-rw-r--r--lib/errnolist.a52
-rw-r--r--lib/errnolist.mk42
-rw-r--r--lib/errnolist.sh44
-rw-r--r--lib/makedepend.sh169
-rw-r--r--lib/makedir.sh86
16 files changed, 1540 insertions, 0 deletions
diff --git a/lib/C/Jmakefile b/lib/C/Jmakefile
new file mode 100644
index 0000000..ac58b46
--- /dev/null
+++ b/lib/C/Jmakefile
@@ -0,0 +1,20 @@
+/*
+ * Jmakefile for C subdirectory.
+ */
+
+;# $Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:38 ram Exp $
+;#
+;# Copyright (c) 1991-1993, Raphael Manfredi
+;#
+;# You may redistribute only under the terms of the Artistic Licence,
+;# as specified in the README file that comes with the distribution.
+;# You may reuse parts of this distribution only within the terms of
+;# that same Artistic Licence; a copy of which may be found at the root
+;# of the source tree for dist 3.0.
+;#
+;# $Log: Jmakefile,v $
+;# Revision 3.0.1.1 1994/01/24 13:43:38 ram
+;# patch16: created
+;#
+
+SetSubdirs(fake)
diff --git a/lib/C/Makefile.SH b/lib/C/Makefile.SH
new file mode 100644
index 0000000..13286b2
--- /dev/null
+++ b/lib/C/Makefile.SH
@@ -0,0 +1,188 @@
+: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL44]
+: $X-Id: Jmake.tmpl,v 3.0.1.1 1993/08/20 07:36:36 ram Exp ram $
+
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+CURRENT=lib/C
+DIR=`echo $CURRENT/ | sed -e 's/\.\///g'`
+echo "Extracting ${DIR}Makefile (with variable substitutions)"
+
+DATE=`date`
+
+$spitshell >Makefile <<!GROK!THIS!
+########################################################################
+# Makefile generated from Makefile.SH on $DATE
+
+SHELL = /bin/sh
+JMAKE = jmake
+TOP = ../..
+CURRENT = $CURRENT
+DIR = $DIR
+
+########################################################################
+# Parameters set by Configure -- edit config.sh if changes are needed
+
+CTAGS = ctags
+MAKE = make
+MV = $mv
+RM = $rm -f
+
+########################################################################
+# Automatically generated parameters -- do not edit
+
+SUBDIRS = fake
+
+!GROK!THIS!
+$spitshell >>Makefile <<'!NO!SUBS!'
+########################################################################
+# Jmake rules for building libraries, programs, scripts, and data files
+# $X-Id: Jmake.rules,v 3.0.1.1 1994/10/29 15:46:30 ram Exp ram $
+
+########################################################################
+# Start of Jmakefile
+
+# $X-Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:38 ram Exp ram $
+#
+# Copyright (c) 1991-1993, Raphael Manfredi
+#
+# You may redistribute only under the terms of the Artistic Licence,
+# as specified in the README file that comes with the distribution.
+# You may reuse parts of this distribution only within the terms of
+# that same Artistic Licence; a copy of which may be found at the root
+# of the source tree for dist 3.0.
+#
+# $X-Log: Jmakefile,v $
+# Revision 3.0.1.1 1994/01/24 13:43:38 ram
+# patch16: created
+#
+
+########################################################################
+# Common rules for all Makefiles -- do not edit
+
+emptyrule::
+
+clean: sub_clean local_clean
+realclean: sub_realclean local_realclean
+clobber: sub_clobber local_clobber
+
+local_clean::
+ $(RM) core *~ *.o
+
+local_realclean:: local_clean
+
+local_clobber:: local_realclean
+ $(RM) Makefile config.sh
+
+Makefile.SH: Jmakefile
+ -@if test -f $(TOP)/.package; then \
+ if test -f Makefile.SH; then \
+ echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \
+ $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \
+ fi; \
+ echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \
+ $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \
+ else touch $@; exit 0; fi
+
+Makefile: Makefile.SH
+ /bin/sh Makefile.SH
+
+tags::
+ $(CTAGS) -w *.[ch]
+ $(CTAGS) -xw *.[ch] > tags
+
+local_clobber::
+ $(RM) tags
+
+########################################################################
+# Rules for building in sub-directories -- do not edit
+
+subdirs:
+ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+ for i in $(SUBDIRS) ;\
+ do \
+ (cd $$i ; echo $(VERB) "in $(DIR)$$i..."; \
+ $(MAKE) $(MFLAGS) $(FLAGS) $(TARGET)); \
+ done
+
+install::
+ @$(MAKE) subdirs TARGET=install VERB="Installing" FLAGS=
+
+deinstall::
+ @$(MAKE) subdirs TARGET=deinstall VERB="Deinstalling" FLAGS=
+
+install.man::
+ @$(MAKE) subdirs TARGET=install.man VERB="Installing man pages" FLAGS=
+
+deinstall.man::
+ @$(MAKE) subdirs TARGET=deinstall.man VERB="Deinstalling man pages" FLAGS=
+
+sub_clean::
+ @$(MAKE) subdirs TARGET=clean VERB="Cleaning" FLAGS=
+ @echo "Back to $(CURRENT) for "clean...
+
+sub_realclean::
+ @$(MAKE) subdirs TARGET=realclean VERB="Real cleaning" FLAGS=
+ @echo "Back to $(CURRENT) for "realclean...
+
+sub_clobber::
+ @$(MAKE) subdirs TARGET=clobber VERB="Clobbering" FLAGS=
+ @echo "Back to $(CURRENT) for "clobber...
+
+tag::
+ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+ for i in $(SUBDIRS) ;\
+ do \
+ (cd $$i ; echo "Tagging" "in $(DIR)$$i..."; \
+ $(MAKE) $(MFLAGS) tag); \
+ done
+
+Makefiles::
+ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+ for i in $(SUBDIRS);\
+ do \
+ echo "Making "Makefiles" in $(DIR)$$i..."; \
+ (cd $$i || exit 1; \
+ if test ! -f Makefile; then /bin/sh Makefile.SH; fi; \
+ $(MAKE) $(MFLAGS) Makefiles) \
+ done
+
+Makefiles.SH:: Makefile.SH
+ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+ for i in $(SUBDIRS);\
+ do \
+ case "$(DIR)$$i/" in \
+ */*/*/*/) newtop=../../../..;; \
+ */*/*/) newtop=../../..;; \
+ */*/) newtop=../..;; \
+ */) newtop=..;; \
+ esac; \
+ case "$(TOP)" in \
+ /*) newtop="$(TOP)" ;; \
+ esac; \
+ echo "Making Makefiles.SH in $(DIR)$$i..."; \
+ (cd $$i || exit 1; $(MAKE) $(MFLAGS) -f ../Makefile \
+ Makefile TOP=$$newtop CURRENT=$(DIR)$$i;\
+ $(MAKE) $(MFLAGS) Makefiles.SH) \
+ done
+
+all::
+ @$(MAKE) subdirs TARGET=all VERB="Making all" FLAGS=
+
+!NO!SUBS!
+chmod 644 Makefile
+$eunicefix Makefile
+
diff --git a/lib/C/fake/Jmakefile b/lib/C/fake/Jmakefile
new file mode 100644
index 0000000..379744c
--- /dev/null
+++ b/lib/C/fake/Jmakefile
@@ -0,0 +1,29 @@
+/*
+ * Jmakefile for C/fake subdirectory.
+ */
+
+;# $Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:44 ram Exp $
+;#
+;# Copyright (c) 1991-1993, Raphael Manfredi
+;#
+;# You may redistribute only under the terms of the Artistic Licence,
+;# as specified in the README file that comes with the distribution.
+;# You may reuse parts of this distribution only within the terms of
+;# that same Artistic Licence; a copy of which may be found at the root
+;# of the source tree for dist 3.0.
+;#
+;# $Log: Jmakefile,v $
+;# Revision 3.0.1.1 1994/01/24 13:43:44 ram
+;# patch16: created
+;#
+
+FILES = dup2.C getopt.C rename.C scandir.C setsid.C
+
+INSTALLFLAGS = -m 444
+
+all:: /* So that default make does not default to install */
+
+>PRIVLIB /* Grrr.. Have to let jmake know I need this */
+
+MakeDirectories(install,$(PRIVLIB)/lib/C/fake)
+InstallMultiple($(FILES),$(PRIVLIB)/lib/C/fake)
diff --git a/lib/C/fake/Makefile.SH b/lib/C/fake/Makefile.SH
new file mode 100644
index 0000000..a5eb2db
--- /dev/null
+++ b/lib/C/fake/Makefile.SH
@@ -0,0 +1,156 @@
+: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL44]
+: $X-Id: Jmake.tmpl,v 3.0.1.1 1993/08/20 07:36:36 ram Exp ram $
+
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+CURRENT=lib/C/fake
+DIR=`echo $CURRENT/ | sed -e 's/\.\///g'`
+echo "Extracting ${DIR}Makefile (with variable substitutions)"
+
+INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'`
+INSTALLDIR=`echo $installdir | sed -e 's,\./i,\$(TOP)/i,'`
+DATE=`date`
+
+$spitshell >Makefile <<!GROK!THIS!
+########################################################################
+# Makefile generated from Makefile.SH on $DATE
+
+SHELL = /bin/sh
+JMAKE = jmake
+TOP = ../../..
+CURRENT = $CURRENT
+DIR = $DIR
+INSTALL = $INSTALL
+INSTALLDIR = $INSTALLDIR
+
+########################################################################
+# Parameters set by Configure -- edit config.sh if changes are needed
+
+CTAGS = ctags
+MAKE = make
+MV = $mv
+PRIVLIB = $installprivlib
+RM = $rm -f
+
+!GROK!THIS!
+$spitshell >>Makefile <<'!NO!SUBS!'
+########################################################################
+# Jmake rules for building libraries, programs, scripts, and data files
+# $X-Id: Jmake.rules,v 3.0.1.1 1994/10/29 15:46:30 ram Exp ram $
+
+########################################################################
+# Start of Jmakefile
+
+# $X-Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:44 ram Exp ram $
+#
+# Copyright (c) 1991-1993, Raphael Manfredi
+#
+# You may redistribute only under the terms of the Artistic Licence,
+# as specified in the README file that comes with the distribution.
+# You may reuse parts of this distribution only within the terms of
+# that same Artistic Licence; a copy of which may be found at the root
+# of the source tree for dist 3.0.
+#
+# $X-Log: Jmakefile,v $
+# Revision 3.0.1.1 1994/01/24 13:43:44 ram
+# patch16: created
+#
+
+FILES = dup2.C getopt.C rename.C scandir.C setsid.C
+
+INSTALLFLAGS = -m 444
+
+all::
+
+install::
+ @for dir in $(PRIVLIB)/lib/C/fake; do \
+ case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ (set -x; test -d $$dir || $(INSTALLDIR) $$dir); \
+ done
+
+install:: $(FILES)
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ for i in $(FILES); do \
+ (set -x; $(INSTALL) -c $(INSTALLFLAGS) $$i $(PRIVLIB)/lib/C/fake); \
+ done
+
+deinstall::
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ for i in $(FILES); do \
+ (set -x; $(RM) $(PRIVLIB)/lib/C/fake/$$i); \
+ done
+
+########################################################################
+# Common rules for all Makefiles -- do not edit
+
+emptyrule::
+
+clean: local_clean
+realclean: local_realclean
+clobber: local_clobber
+
+local_clean::
+ $(RM) core *~ *.o
+
+local_realclean:: local_clean
+
+local_clobber:: local_realclean
+ $(RM) Makefile config.sh
+
+Makefile.SH: Jmakefile
+ -@if test -f $(TOP)/.package; then \
+ if test -f Makefile.SH; then \
+ echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \
+ $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \
+ fi; \
+ echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \
+ $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \
+ else touch $@; exit 0; fi
+
+Makefile: Makefile.SH
+ /bin/sh Makefile.SH
+
+tags::
+ $(CTAGS) -w *.[ch]
+ $(CTAGS) -xw *.[ch] > tags
+
+local_clobber::
+ $(RM) tags
+
+########################################################################
+# Empty rules for directories with no sub-directories -- do not edit
+
+install::
+ @echo "install in $(CURRENT) done."
+
+deinstall::
+ @echo "deinstall in $(CURRENT) done."
+
+install.man::
+ @echo "install.man in $(CURRENT) done."
+
+deinstall.man::
+ @echo "deinstall.man in $(CURRENT) done."
+
+Makefiles::
+
+Makefiles.SH::
+
+!NO!SUBS!
+chmod 644 Makefile
+$eunicefix Makefile
+
diff --git a/lib/C/fake/dup2.C b/lib/C/fake/dup2.C
new file mode 100644
index 0000000..27c3c48
--- /dev/null
+++ b/lib/C/fake/dup2.C
@@ -0,0 +1,78 @@
+/*
+ * dup2.C -- A dup2 emulation.
+ */
+
+/*
+ * $Id: dup2.C,v 3.0.1.1 1994/01/24 13:58:37 ram Exp $
+ *
+ * Copyright (c) 1991-1993, Raphael Manfredi
+ *
+ * You may redistribute only under the terms of the Artistic Licence,
+ * as specified in the README file that comes with the distribution.
+ * You may reuse parts of this distribution only within the terms of
+ * that same Artistic Licence; a copy of which may be found at the root
+ * of the source tree for dist 3.0.
+ *
+ * Original Author: Larry Wall <lwall@netlabs.com>
+ *
+ * $Log: dup2.C,v $
+ * Revision 3.0.1.1 1994/01/24 13:58:37 ram
+ * patch16: created
+ *
+ */
+
+#include "config.h"
+
+#ifdef I_FCNTL
+#include <fcntl.h>
+#endif
+
+#include "confmagic.h" /* Remove if not metaconfig -M */
+
+#ifndef HAS_DUP2
+/*
+ * dup2
+ *
+ * This routine duplicates file descriptor 'old' into 'new'. After the
+ * operation, both 'new' and 'old' refer to the same file 'old' was referring
+ * to in the first place.
+ *
+ * Returns 0 if OK, -1 on failure with errno being set to indicate the error.
+ *
+ */
+V_FUNC(int dup2, (old, new),
+ int old /* Opened file descriptor */ NXT_ARG
+ int new /* File descriptor we'd like to get */)
+{
+#ifdef HAS_FCNTL
+#ifdef F_DUPFD
+#define USE_FNCTL
+#endif
+#endif
+
+#ifdef USE_FCNTL
+ if (old == new)
+ return 0;
+
+ close(new);
+ return fcntl(old, F_DUPFD, new);
+#else
+ int fd_used[256]; /* Fixed stack used to record dup'ed files */
+ int fd_top = 0; /* Top in the fixed stack */
+ int fd; /* Currently dup'ed file descriptor */
+
+ if (old == new)
+ return 0;
+
+ close(new); /* Ensure one free slot */
+ while ((fd = dup(old)) != new) /* Until dup'ed file matches */
+ fd_used[fd_top++] = fd; /* Remember we have to close it later */
+
+ while (fd_top > 0) /* Close all useless dup'ed slots */
+ close(fd_used[--fd_top]);
+
+ return 0;
+#endif
+}
+#endif
+
diff --git a/lib/C/fake/getopt.C b/lib/C/fake/getopt.C
new file mode 100644
index 0000000..a05cfd7
--- /dev/null
+++ b/lib/C/fake/getopt.C
@@ -0,0 +1,133 @@
+/*
+ * getopt.C -- A getopt implementation.
+ */
+
+/*
+ * $Id: getopt.C,v 3.0.1.1 1994/01/24 13:58:40 ram Exp $
+ *
+ * Copyright (c) 1991-1993, Raphael Manfredi
+ *
+ * You may redistribute only under the terms of the Artistic Licence,
+ * as specified in the README file that comes with the distribution.
+ * You may reuse parts of this distribution only within the terms of
+ * that same Artistic Licence; a copy of which may be found at the root
+ * of the source tree for dist 3.0.
+ *
+ * Original Author: unknown, got this off net.sources
+ *
+ * $Log: getopt.C,v $
+ * Revision 3.0.1.1 1994/01/24 13:58:40 ram
+ * patch16: created
+ *
+ */
+
+#include "config.h"
+#include <stdio.h>
+
+#ifdef I_STRING
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include "confmagic.h" /* Remove if not metaconfig -M */
+
+#ifndef HAS_GETOPT
+
+/*
+ * Get option letter from argument vector
+ */
+
+int opterr = 1, /* Useless, never set or used */
+ optind = 1, /* Index into parent argv vector */
+ optopt; /* Character checked for validity */
+char *optarg; /* Argument associated with option */
+
+#define BADCH (int) '?'
+#define EMSG ""
+
+#define tell(s) \
+do { \
+ fputs(*nargv, stderr); \
+ fputs(s, stderr); \
+ fputc(optopt, stderr); \
+ fputc('\n', stderr); \
+ return BADCH; \
+} while (0)
+
+/*
+ * getopt
+ *
+ * Parses command line flags and arguments. Given the original arguments
+ * via the (nargc, nargv) tuple, and a list of flags via 'ostr', it returns
+ * the next flag recognized, and sets the externally visible 'optarg'
+ * variable to point to the start of the flags's parameter, if any expected.
+ *
+ * When facing an invalid flag, getopt() returns '?'.
+ *
+ * The 'ostr' string is a list of allowed flag characters, optionally by ':'
+ * when the flag expects a parameter, which can immediately follow the
+ * flag or come as the next word.
+ *
+ * In any case, the 'optopt' variable is set upon return to the flag being
+ * looked at, whether it was a valid flag or not.
+ */
+V_FUNC(int getopt, (nargc, nargv, ostr)
+ int nargc /* Argument count */ NXT_ARG
+ char **nargv /* Argument vector */ NXT_ARG
+ char *ostr /* String specifying options */)
+{
+ static char *place = EMSG; /* Option letter processing */
+ register1 char *oli; /* Option letter list index */
+
+ /*
+ * Update scanning pointer.
+ */
+
+ if (!*place) {
+ if(
+ optind >= nargc ||
+ *(place = nargv[optind]) != '-' ||
+ !*++place
+ )
+ return EOF;
+ if (*place == '-') { /* Found "--", end option processing */
+ ++optind;
+ return EOF;
+ }
+ }
+
+ /*
+ * Is option letter OK?
+ */
+
+ if (
+ (optopt = (int)*place++) == (int)':' ||
+ !(oli = index(ostr,optopt))
+ ) {
+ if (!*place) ++optind;
+ tell(": illegal option -- ");
+ }
+
+ /*
+ * Found a valid option, process it.
+ */
+
+ if (*++oli != ':') { /* Don't need argument */
+ optarg = NULL;
+ if (!*place) ++optind;
+ } else { /* Need an argument */
+ if (*place) optarg = place; /* No white space */
+ else if (nargc <= ++optind) { /* No argument */
+ place = EMSG;
+ tell(": option requires an argument -- ");
+ } else
+ optarg = nargv[optind]; /* White space */
+ place = EMSG;
+ ++optind;
+ }
+
+ return optopt; /* Dump back option letter */
+}
+#endif
+
diff --git a/lib/C/fake/rename.C b/lib/C/fake/rename.C
new file mode 100644
index 0000000..b1457d8
--- /dev/null
+++ b/lib/C/fake/rename.C
@@ -0,0 +1,45 @@
+/*
+ * rename.C -- A rename emulation, for renaming files only.
+ */
+
+/*
+ * $Id: rename.C,v 3.0.1.1 1994/01/24 13:58:42 ram Exp $
+ *
+ * Copyright (c) 1991-1993, Raphael Manfredi
+ *
+ * You may redistribute only under the terms of the Artistic Licence,
+ * as specified in the README file that comes with the distribution.
+ * You may reuse parts of this distribution only within the terms of
+ * that same Artistic Licence; a copy of which may be found at the root
+ * of the source tree for dist 3.0.
+ *
+ * $Log: rename.C,v $
+ * Revision 3.0.1.1 1994/01/24 13:58:42 ram
+ * patch16: created
+ *
+ */
+
+#include "config.h"
+#include "confmagic.h" /* Remove if not metaconfig -M */
+
+#ifndef HAS_RENAME
+/*
+ * rename
+ *
+ * Renames a file within a file system. This cannot be used to rename
+ * directories, unfortunately.
+ */
+V_FUNC(int rename, (from, to),
+ char *from /* Original name */ NXT_ARG
+ char *to /* Target name */)
+{
+ (void) unlink(to);
+ if (-1 == link(from, to))
+ return -1;
+ if (-1 == unlink(from))
+ return -1;
+
+ return 0;
+}
+#endif
+
diff --git a/lib/C/fake/scandir.C b/lib/C/fake/scandir.C
new file mode 100644
index 0000000..b74d4ee
--- /dev/null
+++ b/lib/C/fake/scandir.C
@@ -0,0 +1,131 @@
+/*
+ * scandir.C -- A scandir implementation.
+ */
+
+/*
+ * $Id: scandir.C,v 3.0.1.1 1994/01/24 13:58:45 ram Exp $
+ *
+ * Copyright (c) 1991-1993, Raphael Manfredi
+ *
+ * You may redistribute only under the terms of the Artistic Licence,
+ * as specified in the README file that comes with the distribution.
+ * You may reuse parts of this distribution only within the terms of
+ * that same Artistic Licence; a copy of which may be found at the root
+ * of the source tree for dist 3.0.
+ *
+ * $Log: scandir.C,v $
+ * Revision 3.0.1.1 1994/01/24 13:58:45 ram
+ * patch16: created
+ *
+ */
+
+#include "config.h"
+
+#ifdef I_STRING
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#ifdef I_DIRENT
+#include <dirent.h>
+#else
+#ifdef I_SYS_NDIR
+#include <sys/ndir.h>
+#else
+#ifdef I_SYS_DIR
+#include <sys/dir.h>
+#endif
+#endif
+#endif
+
+#include "confmagic.h" /* Remove if not metaconfig -M */
+
+#ifndef HAS_SCANDIR
+
+extern Malloc_t malloc();
+extern Malloc_t realloc();
+
+extern DIR *opendir();
+extern Direntry_t *readdir();
+
+#define DIR_NULL ((DIR *) 0)
+#define ENTRY_NULL ((Direntry_t *) 0)
+
+static int alphasort _((Direntry_t **, Direntry_t **));
+
+/*
+ * scandir
+ *
+ * This routine reads the directory `dirnam' and builds an array of
+ * pointers to directory entries using malloc(). The second parameter
+ * is the address of a pointer to an array of structure pointers. The
+ * third parameter is a pointer to a routine which is called with a
+ * pointer to a directory entry and should return a non zero value
+ * if the directory entry should be included in the arrary. If this
+ * pointer is NULL, then all the directory entries will be included.
+ * The last argument is a pointer to a routine which is passed to
+ * qsort() to sort the completed array. If this pointer is NULL, the
+ * array is not sorted.
+ * scandir() returns the number of entries in the array and a pointer
+ * to the array through the parameter namlist.
+ * alphasort() is a routine which sorts the array alphabetically.
+ */
+V_FUNC(int scandir, (dirnam, namelist, sel, comp),
+ char *dirnam /* Direcotry name */ NXT_ARG
+ Direntry_t ***namelist /* Pointer to an array of struct ptrs */ NXT_ARG
+ int (*sel)() /* Routine to select entries */ NXT_ARG
+ int (*comp)() /* Routine passed to qsort */)
+{
+ DIR *dirp; /* Returned by opendir() */
+ Direntry_t *dp; /* Read entry */
+ Direntry_t *dp_save; /* Place where entry is stored */
+ Direntry_t **tmplist; /* Where the array list is stored */
+ int nent = 0; /* Number of entries */
+
+ dirp = opendir(dirnam);
+ if (dirp == DIR_NULL)
+ return -1; /* Directory cannot be opened for reading */
+
+ for (dp = readdir(dirp); dp != ENTRY_NULL; dp = readdir(dirp)) {
+ if (sel == ((int (*)()) 0) || (*sel)(dp)) {
+ /* If entry has to be included */
+ nent++; /* One more entry */
+
+ if (nent == 1) { /* Create array for first entry */
+ tmplist = (Direntry_t **)
+ malloc(sizeof(Direntry_t *));
+ if (tmplist == (Direntry_t **) 0)
+ return -1; /* Cannot create array */
+ } else { /* Reallocate for a new entry */
+ tmplist = (Direntry_t **)
+ realloc(tmplist, nent*sizeof(Direntry_t *));
+ if (tmplist == (Direntry_t **) 0)
+ return -1; /* Cannot reallocate array */
+ }
+
+ dp_save = (Direntry_t *) malloc(sizeof(Direntry_t));
+ if (dp_save == ENTRY_NULL)
+ return -1; /* No space to save entry */
+ bcopy((char *) dp, (char *) dp_save, sizeof(Direntry_t));
+ *(tmplist+(nent-1)) = dp_save;
+ }
+ }
+
+ if (comp != ((int (*)()) 0) && nent) /* Need sorting ? */
+ qsort(tmplist, nent, sizeof(Direntry_t *), comp);
+
+ *namelist = tmplist; /* Passes the address of the arrray */
+ closedir(dirp); /* Close directory */
+
+ return nent; /* Number of items */
+}
+
+P_FUNC(int alphasort, (d1, d2),
+ Direntry_t **d1 NXT_ARG Direntry_t **d2)
+{
+ return strcmp((*d1)->d_name, (*d2)->d_name);
+}
+
+#endif
+
diff --git a/lib/C/fake/setsid.C b/lib/C/fake/setsid.C
new file mode 100644
index 0000000..58611b8
--- /dev/null
+++ b/lib/C/fake/setsid.C
@@ -0,0 +1,64 @@
+/*
+ * setsid.C -- A setsid replacement.
+ */
+
+/*
+ * $Id: setsid.C,v 3.0.1.1 1994/01/24 13:58:47 ram Exp $
+ *
+ * Copyright (c) 1991-1993, Raphael Manfredi
+ *
+ * You may redistribute only under the terms of the Artistic Licence,
+ * as specified in the README file that comes with the distribution.
+ * You may reuse parts of this distribution only within the terms of
+ * that same Artistic Licence; a copy of which may be found at the root
+ * of the source tree for dist 3.0.
+ *
+ * $Log: setsid.C,v $
+ * Revision 3.0.1.1 1994/01/24 13:58:47 ram
+ * patch16: created
+ *
+ */
+
+#include "config.h"
+#include "confmagic.h" /* Remove if not metaconfig -M */
+
+#ifndef HAS_SETSID
+/*
+ * setsid
+ *
+ * Set the process group ID and create a new session for the process.
+ *
+ * This is a pale imitation of the setsid() system call, since a session
+ * and a process group are two distinct things for the kernel. However,
+ * when setsid() is not available, the effects should be comparable.
+ */
+V_FUNC_VOID(int setsid)
+{
+ int error = 0;
+
+#ifdef HAS_SETPGID
+ /*
+ * setpgid() supersedes setpgrp() in OSF/1.
+ */
+ error = setpgid(0 ,getpid());
+#else
+#ifdef HAS_SETPGRP
+ /*
+ * Good old way to get a process group leader.
+ */
+#ifdef USE_BSDPGRP
+ error = setpgrp(0 ,getpid()); /* bsd way */
+#else
+ error = setpgrp(); /* usg way */
+#endif
+#endif
+#endif
+
+ /*
+ * When none of the above is defined, do nothing.
+ */
+
+ return error;
+}
+#endif
+
diff --git a/lib/Jmakefile b/lib/Jmakefile
new file mode 100644
index 0000000..dee3c63
--- /dev/null
+++ b/lib/Jmakefile
@@ -0,0 +1,57 @@
+/*
+ * Jmakefile for lib subdirectory.
+ */
+
+;# $Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:31 ram Exp $
+;#
+;# Copyright (c) 1991-1993, Raphael Manfredi
+;#
+;# You may redistribute only under the terms of the Artistic Licence,
+;# as specified in the README file that comes with the distribution.
+;# You may reuse parts of this distribution only within the terms of
+;# that same Artistic Licence; a copy of which may be found at the root
+;# of the source tree for dist 3.0.
+;#
+;# $Log: Jmakefile,v $
+;# Revision 3.0.1.1 1994/01/24 13:43:31 ram
+;# patch16: added new directory for C code sources
+;#
+;# Revision 3.0 1993/08/18 12:04:34 ram
+;# Baseline for dist 3.0 netwide release.
+;#
+
+FILES = errnolist.a errnolist.mk
+FILES_SH = errnolist makedepend makedir
+
+INSTALLFLAGS = -m 444
+
+all:: /* So that default make does not default to install */
+
+>PRIVLIB /* Grrr.. Have to let jmake know I need this */
+
+MakeDirectories(install,$(PRIVLIB)/lib)
+InstallMultiple($(FILES),$(PRIVLIB)/lib)
+
+/*
+ * InstallSingleExt:
+ * This rule installs a single file whose basename is 'file' and
+ * extension is 'old' into 'file^^new'. This allows changing the
+ * dot extension of a file, for instance file.sh can be installed as
+ * file.SH.
+ */
+#define InstallSingleExt(step,file,dest,flags,old,new) @!\
+>INSTALL @!\
+>RM @!\
+step:: file^^old @@\
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\
+ (set -x; $(INSTALL) -c flags file^^old dest/file^^new) @@\
+ @!\
+de^^step:: @@\
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\
+ (set -x; $(RM) dest/file^^new)
+
+#define install_rule \
+ InstallSingleExt(install,!f,$(PRIVLIB)/lib,-m 444,.sh,.SH)
+
+Expand(install_rule,f!$(FILES_SH)!)
+SetSubdirs(C)
diff --git a/lib/Makefile.SH b/lib/Makefile.SH
new file mode 100644
index 0000000..ec79f14
--- /dev/null
+++ b/lib/Makefile.SH
@@ -0,0 +1,246 @@
+: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL44]
+: $X-Id: Jmake.tmpl,v 3.0.1.1 1993/08/20 07:36:36 ram Exp ram $
+
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+CURRENT=lib
+DIR=`echo $CURRENT/ | sed -e 's/\.\///g'`
+echo "Extracting ${DIR}Makefile (with variable substitutions)"
+
+INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'`
+INSTALLDIR=`echo $installdir | sed -e 's,\./i,\$(TOP)/i,'`
+DATE=`date`
+
+$spitshell >Makefile <<!GROK!THIS!
+########################################################################
+# Makefile generated from Makefile.SH on $DATE
+
+SHELL = /bin/sh
+JMAKE = jmake
+TOP = ..
+CURRENT = $CURRENT
+DIR = $DIR
+INSTALL = $INSTALL
+INSTALLDIR = $INSTALLDIR
+
+########################################################################
+# Parameters set by Configure -- edit config.sh if changes are needed
+
+CTAGS = ctags
+MAKE = make
+MV = $mv
+PRIVLIB = $installprivlib
+RM = $rm -f
+
+########################################################################
+# Automatically generated parameters -- do not edit
+
+SUBDIRS = C
+
+!GROK!THIS!
+$spitshell >>Makefile <<'!NO!SUBS!'
+########################################################################
+# Jmake rules for building libraries, programs, scripts, and data files
+# $X-Id: Jmake.rules,v 3.0.1.1 1994/10/29 15:46:30 ram Exp ram $
+
+########################################################################
+# Start of Jmakefile
+
+# $X-Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:31 ram Exp ram $
+#
+# Copyright (c) 1991-1993, Raphael Manfredi
+#
+# You may redistribute only under the terms of the Artistic Licence,
+# as specified in the README file that comes with the distribution.
+# You may reuse parts of this distribution only within the terms of
+# that same Artistic Licence; a copy of which may be found at the root
+# of the source tree for dist 3.0.
+#
+# $X-Log: Jmakefile,v $
+# Revision 3.0.1.1 1994/01/24 13:43:31 ram
+# patch16: added new directory for C code sources
+#
+# Revision 3.0 1993/08/18 12:04:34 ram
+# Baseline for dist 3.0 netwide release.
+#
+
+FILES = errnolist.a errnolist.mk
+FILES_SH = errnolist makedepend makedir
+
+INSTALLFLAGS = -m 444
+
+all::
+
+install::
+ @for dir in $(PRIVLIB)/lib; do \
+ case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ (set -x; test -d $$dir || $(INSTALLDIR) $$dir); \
+ done
+
+install:: $(FILES)
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ for i in $(FILES); do \
+ (set -x; $(INSTALL) -c $(INSTALLFLAGS) $$i $(PRIVLIB)/lib); \
+ done
+
+deinstall::
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ for i in $(FILES); do \
+ (set -x; $(RM) $(PRIVLIB)/lib/$$i); \
+ done
+
+
+install:: errnolist.sh
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ (set -x; $(INSTALL) -c -m 444 errnolist.sh $(PRIVLIB)/lib/errnolist.SH)
+
+deinstall::
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ (set -x; $(RM) $(PRIVLIB)/lib/errnolist.SH)
+
+install:: makedepend.sh
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ (set -x; $(INSTALL) -c -m 444 makedepend.sh $(PRIVLIB)/lib/makedepend.SH)
+
+deinstall::
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ (set -x; $(RM) $(PRIVLIB)/lib/makedepend.SH)
+
+install:: makedir.sh
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ (set -x; $(INSTALL) -c -m 444 makedir.sh $(PRIVLIB)/lib/makedir.SH)
+
+deinstall::
+ @case '${MFLAGS}' in *[i]*) set +e;; esac; \
+ (set -x; $(RM) $(PRIVLIB)/lib/makedir.SH)
+
+########################################################################
+# Common rules for all Makefiles -- do not edit
+
+emptyrule::
+
+clean: sub_clean local_clean
+realclean: sub_realclean local_realclean
+clobber: sub_clobber local_clobber
+
+local_clean::
+ $(RM) core *~ *.o
+
+local_realclean:: local_clean
+
+local_clobber:: local_realclean
+ $(RM) Makefile config.sh
+
+Makefile.SH: Jmakefile
+ -@if test -f $(TOP)/.package; then \
+ if test -f Makefile.SH; then \
+ echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \
+ $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \
+ fi; \
+ echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \
+ $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \
+ else touch $@; exit 0; fi
+
+Makefile: Makefile.SH
+ /bin/sh Makefile.SH
+
+tags::
+ $(CTAGS) -w *.[ch]
+ $(CTAGS) -xw *.[ch] > tags
+
+local_clobber::
+ $(RM) tags
+
+########################################################################
+# Rules for building in sub-directories -- do not edit
+
+subdirs:
+ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+ for i in $(SUBDIRS) ;\
+ do \
+ (cd $$i ; echo $(VERB) "in $(DIR)$$i..."; \
+ $(MAKE) $(MFLAGS) $(FLAGS) $(TARGET)); \
+ done
+
+install::
+ @$(MAKE) subdirs TARGET=install VERB="Installing" FLAGS=
+
+deinstall::
+ @$(MAKE) subdirs TARGET=deinstall VERB="Deinstalling" FLAGS=
+
+install.man::
+ @$(MAKE) subdirs TARGET=install.man VERB="Installing man pages" FLAGS=
+
+deinstall.man::
+ @$(MAKE) subdirs TARGET=deinstall.man VERB="Deinstalling man pages" FLAGS=
+
+sub_clean::
+ @$(MAKE) subdirs TARGET=clean VERB="Cleaning" FLAGS=
+ @echo "Back to $(CURRENT) for "clean...
+
+sub_realclean::
+ @$(MAKE) subdirs TARGET=realclean VERB="Real cleaning" FLAGS=
+ @echo "Back to $(CURRENT) for "realclean...
+
+sub_clobber::
+ @$(MAKE) subdirs TARGET=clobber VERB="Clobbering" FLAGS=
+ @echo "Back to $(CURRENT) for "clobber...
+
+tag::
+ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+ for i in $(SUBDIRS) ;\
+ do \
+ (cd $$i ; echo "Tagging" "in $(DIR)$$i..."; \
+ $(MAKE) $(MFLAGS) tag); \
+ done
+
+Makefiles::
+ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+ for i in $(SUBDIRS);\
+ do \
+ echo "Making "Makefiles" in $(DIR)$$i..."; \
+ (cd $$i || exit 1; \
+ if test ! -f Makefile; then /bin/sh Makefile.SH; fi; \
+ $(MAKE) $(MFLAGS) Makefiles) \
+ done
+
+Makefiles.SH:: Makefile.SH
+ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+ for i in $(SUBDIRS);\
+ do \
+ case "$(DIR)$$i/" in \
+ */*/*/*/) newtop=../../../..;; \
+ */*/*/) newtop=../../..;; \
+ */*/) newtop=../..;; \
+ */) newtop=..;; \
+ esac; \
+ case "$(TOP)" in \
+ /*) newtop="$(TOP)" ;; \
+ esac; \
+ echo "Making Makefiles.SH in $(DIR)$$i..."; \
+ (cd $$i || exit 1; $(MAKE) $(MFLAGS) -f ../Makefile \
+ Makefile TOP=$$newtop CURRENT=$(DIR)$$i;\
+ $(MAKE) $(MFLAGS) Makefiles.SH) \
+ done
+
+all::
+ @$(MAKE) subdirs TARGET=all VERB="Making all" FLAGS=
+
+!NO!SUBS!
+chmod 644 Makefile
+$eunicefix Makefile
+
diff --git a/lib/errnolist.a b/lib/errnolist.a
new file mode 100644
index 0000000..a548a11
--- /dev/null
+++ b/lib/errnolist.a
@@ -0,0 +1,52 @@
+# $Id: errnolist.a,v 3.0 1993/08/18 12:04:35 ram Exp $
+#
+# Copyright (c) 1991-1993, Raphael Manfredi
+#
+# You may redistribute only under the terms of the Artistic Licence,
+# as specified in the README file that comes with the distribution.
+# You may reuse parts of this distribution only within the terms of
+# that same Artistic Licence; a copy of which may be found at the root
+# of the source tree for dist 3.0.
+#
+# Original Author: Harlan Stenn <harlan@mumps.pfcs.com>
+#
+# $Log: errnolist.a,v $
+# Revision 3.0 1993/08/18 12:04:35 ram
+# Baseline for dist 3.0 netwide release.
+#
+#
+# This is a simple-minded awk script to generate an initialization for
+# sys_errnolist on systems that don't have it.
+# This file now depends only on sys/errno.h error numbers under maxerr being
+# in order. It will complain and die if not. NOTE: It will still produce
+# a compilable output file, even with errors, so you must check the output.
+
+
+BEGIN {
+ format = "\t\"%s\",\n"
+ printf("/*\n** This is a generated file. Do NOT edit it unless you really have to...\n*/\n\n")
+ printf("char *sys_errnolist[] = {\n")
+ maxerr = 89
+ }
+
+$1=="#define" {
+ if(count > maxerr || substr($2,1,1) != "E")
+ next # we're not interested
+ if($3 < count) { # this is bad
+ printf("Fatal error: %s out of order at %s\n",\
+ FILENAME, $2)>"/dev/tty"
+ exit 1
+ }
+ # fill in the blanks
+ while($3 > count) {
+ dummy=sprintf("EDUMMY%d",count)
+ printf(format,dummy)
+ count++
+ }
+ printf(format,$2)
+ count++
+ }
+
+END {
+ printf("\t0\n};\n")
+ }
diff --git a/lib/errnolist.mk b/lib/errnolist.mk
new file mode 100644
index 0000000..0cf2753
--- /dev/null
+++ b/lib/errnolist.mk
@@ -0,0 +1,42 @@
+# $Id: errnolist.mk,v 3.0.1.1 1994/01/24 13:59:32 ram Exp $
+#
+# Copyright (c) 1991-1993, Raphael Manfredi
+#
+# You may redistribute only under the terms of the Artistic Licence,
+# as specified in the README file that comes with the distribution.
+# You may reuse parts of this distribution only within the terms of
+# that same Artistic Licence; a copy of which may be found at the root
+# of the source tree for dist 3.0.
+#
+# Original Author: Harlan Stenn <harlan@mumps.pfcs.com>
+#
+# $Log: errnolist.mk,v $
+# Revision 3.0.1.1 1994/01/24 13:59:32 ram
+# patch16: now uses modern shell metaconfig symbols
+#
+# Revision 3.0 1993/08/18 12:04:36 ram
+# Baseline for dist 3.0 netwide release.
+#
+#
+# Make rules for the errnolist stuff
+
+case "$errnolist" in
+'') ;;
+*)
+ $spitshell >>Makefile <<!GROK!THIS!
+$errnolist_c: $errnolist_SH $errnolist_a
+ sh ./$errnolist_SH
+
+!GROK!THIS!
+ ;;
+esac
+
+$spitshell >>Makefile <<!GROK!THIS!
+ERRNOLIST_OBJ=$errnolist_o
+!GROK!THIS!
+
+$spitshell >>Makefile <<'!NO!SUBS!'
+
+foo: foo.o $(ERRNOLIST_OBJ)
+ $(CC) -o $@ foo.o $(ERRNOLIST_OBJ)
+!NO!SUBS!
diff --git a/lib/errnolist.sh b/lib/errnolist.sh
new file mode 100644
index 0000000..1385e73
--- /dev/null
+++ b/lib/errnolist.sh
@@ -0,0 +1,44 @@
+# $Id: errnolist.sh,v 3.0.1.1 1994/01/24 14:00:00 ram Exp $
+#
+# Copyright (c) 1991-1993, Raphael Manfredi
+#
+# You may redistribute only under the terms of the Artistic Licence,
+# as specified in the README file that comes with the distribution.
+# You may reuse parts of this distribution only within the terms of
+# that same Artistic Licence; a copy of which may be found at the root
+# of the source tree for dist 3.0.
+#
+# Original Author: Harlan Stenn <harlan@mumps.pfcs.com>
+#
+# $Log: errnolist.sh,v $
+# Revision 3.0.1.1 1994/01/24 14:00:00 ram
+# patch16: changed top ln-style config.sh lookup into test-style one
+#
+# Revision 3.0 1993/08/18 12:04:36 ram
+# Baseline for dist 3.0 netwide release.
+#
+
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+case "$errnolistc" in
+'') ;;
+*)
+ echo "Making $errnolistc ..."
+ awk -f errnolist.a < /usr/include/sys/errno.h > $errnolistc
+ echo "It would be a good idea to make sure that $errnolistc is correct."
+esac
+
diff --git a/lib/makedepend.sh b/lib/makedepend.sh
new file mode 100644
index 0000000..1e83386
--- /dev/null
+++ b/lib/makedepend.sh
@@ -0,0 +1,169 @@
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+echo "Extracting makedepend (with variable substitutions)"
+$spitshell >makedepend <<!GROK!THIS!
+$startsh
+# $Id: makedepend.sh,v 3.0.1.1 1994/01/24 14:00:05 ram Exp $
+#
+# Copyright (c) 1991-1993, Raphael Manfredi
+#
+# You may redistribute only under the terms of the Artistic Licence,
+# as specified in the README file that comes with the distribution.
+# You may reuse parts of this distribution only within the terms of
+# that same Artistic Licence; a copy of which may be found at the root
+# of the source tree for dist 3.0.
+#
+# Original Author: Larry Wall <lwall@netlabs.com>
+#
+# $Log: makedepend.sh,v $
+# Revision 3.0.1.1 1994/01/24 14:00:05 ram
+# patch16: changed top ln-style config.sh lookup into test-style one
+#
+# Revision 3.0 1993/08/18 12:04:37 ram
+# Baseline for dist 3.0 netwide release.
+#
+
+export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
+
+cat='$cat'
+cppflags='$cppflags'
+cp='$cp'
+cpp='$cppstdin'
+echo='$echo'
+egrep='$egrep'
+expr='$expr'
+mv='$mv'
+rm='$rm'
+sed='$sed'
+sort='$sort'
+test='$test'
+tr='$tr'
+uniq='$uniq'
+!GROK!THIS!
+
+$spitshell >>makedepend <<'!NO!SUBS!'
+
+$cat /dev/null >.deptmp
+$rm -f *.c.c c/*.c.c
+if test -f Makefile; then
+ mf=Makefile
+else
+ mf=makefile
+fi
+if test -f $mf; then
+ defrule=`<$mf sed -n \
+ -e '/^\.c\.o:.*;/{' \
+ -e 's/\$\*\.c//' \
+ -e 's/^[^;]*;[ ]*//p' \
+ -e q \
+ -e '}' \
+ -e '/^\.c\.o: *$/{' \
+ -e N \
+ -e 's/\$\*\.c//' \
+ -e 's/^.*\n[ ]*//p' \
+ -e q \
+ -e '}'`
+fi
+case "$defrule" in
+'') defrule='$(CC) -c $(CFLAGS)' ;;
+esac
+
+make clist || ($echo "Searching for .c files..."; \
+ $echo *.c | $tr ' ' '\012' | $egrep -v '\*' >.clist)
+gotnone=true
+for file in `$cat .clist`; do
+# for file in `cat /dev/null`; do
+ case "$file" in
+ *.c) filebase=`basename $file .c` ;;
+ *.y) filebase=`basename $file .c` ;;
+ '') continue ;;
+ esac
+ gotnone=false
+ $echo "Finding dependencies for $filebase.o."
+ $sed -n <$file >$file.c \
+ -e "/^${filebase}_init(/q" \
+ -e '/^#/{' \
+ -e 's|/\*.*$||' \
+ -e 's|\\$||' \
+ -e p \
+ -e '}'
+ $cpp -I/usr/local/include -I. $cppflags $file.c | \
+ $sed \
+ -e '/^# *[0-9]/!d' \
+ -e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
+ -e 's|: \./|: |' \
+ -e 's|\.c\.c|.c|' | \
+ $uniq | $sort | $uniq >> .deptmp
+done
+
+$sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'
+
+make shlist || ($echo "Searching for .SH files..."; \
+ $echo *.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
+if $gotnone || $test -s .deptmp; then
+ for file in `cat .shlist`; do
+ $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
+ /bin/sh $file >> .deptmp
+ done
+ $echo "Updating Makefile..."
+ $echo "# If this runs make out of memory, delete /usr/include lines." \
+ >> Makefile.new
+ $sed 's|^\(.*\.o:\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
+ >>Makefile.new
+else
+ make hlist || ($echo "Searching for .h files..."; \
+ $echo *.h | $tr ' ' '\012' | $egrep -v '\*' >.hlist)
+ $echo "You don't seem to have a proper C preprocessor. Using grep instead."
+ $egrep '^#include ' `cat .clist` `cat .hlist` >.deptmp
+ $echo "Updating Makefile..."
+ <.clist $sed -n \
+ -e '/\//{' \
+ -e 's|^\(.*\)/\(.*\)\.c|\2.o: \1/\2.c; '"$defrule \1/\2.c|p" \
+ -e d \
+ -e '}' \
+ -e 's|^\(.*\)\.c|\1.o: \1.c|p' >> Makefile.new
+ <.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed
+ <.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \
+ $sed 's|^[^;]*/||' | \
+ $sed -f .hsed >> Makefile.new
+ <.deptmp $sed -n 's|c:#include <\(.*\)>.*$|o: /usr/include/\1|p' \
+ >> Makefile.new
+ <.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \
+ $sed -f .hsed >> Makefile.new
+ <.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
+ >> Makefile.new
+ for file in `$cat .shlist`; do
+ $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
+ /bin/sh $file >> Makefile.new
+ done
+fi
+$rm -f Makefile.old
+$cp Makefile Makefile.old
+$cp Makefile.new Makefile
+$rm Makefile.new
+$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
+$rm -f .deptmp `sed 's/\.c/.c.c/' .clist` .shlist .clist .hlist .hsed
+
+!NO!SUBS!
+$eunicefix makedepend
+chmod +x makedepend
+case `pwd` in
+*SH)
+ $rm -f ../makedepend
+ ln makedepend ../makedepend
+ ;;
+esac
diff --git a/lib/makedir.sh b/lib/makedir.sh
new file mode 100644
index 0000000..b77f158
--- /dev/null
+++ b/lib/makedir.sh
@@ -0,0 +1,86 @@
+case $CONFIG in
+'')
+ if test -f config.sh; then TOP=.;
+ elif test -f ../config.sh; then TOP=..;
+ elif test -f ../../config.sh; then TOP=../..;
+ elif test -f ../../../config.sh; then TOP=../../..;
+ elif test -f ../../../../config.sh; then TOP=../../../..;
+ else
+ echo "Can't find config.sh."; exit 1
+ fi
+ . $TOP/config.sh
+ ;;
+esac
+case "$0" in
+*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
+esac
+echo "Extracting makedir (with variable substitutions)"
+$spitshell >makedir <<!GROK!THIS!
+$startsh
+# $Id: makedir.sh,v 3.0.1.1 1994/01/24 14:00:08 ram Exp $
+#
+# Copyright (c) 1991-1993, Raphael Manfredi
+#
+# You may redistribute only under the terms of the Artistic Licence,
+# as specified in the README file that comes with the distribution.
+# You may reuse parts of this distribution only within the terms of
+# that same Artistic Licence; a copy of which may be found at the root
+# of the source tree for dist 3.0.
+#
+# Original Author: Larry Wall <lwall@netlabs.com>
+#
+# $Log: makedir.sh,v $
+# Revision 3.0.1.1 1994/01/24 14:00:08 ram
+# patch16: changed top ln-style config.sh lookup into test-style one
+#
+# Revision 3.0 1993/08/18 12:04:38 ram
+# Baseline for dist 3.0 netwide release.
+#
+
+export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
+
+case \$# in
+ 0)
+ $echo "makedir pathname filenameflag"
+ exit 1
+ ;;
+esac
+
+: guarantee one slash before 1st component
+case \$1 in
+ /*) ;;
+ *) set ./\$1 \$2 ;;
+esac
+
+: strip last component if it is to be a filename
+case X\$2 in
+ X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
+ *) set \$1 ;;
+esac
+
+: return reasonable status if nothing to be created
+if $test -d "\$1" ; then
+ exit 0
+fi
+
+list=''
+while true ; do
+ case \$1 in
+ */*)
+ list="\$1 \$list"
+ set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+set \$list
+
+for dir do
+ $mkdir \$dir >/dev/null 2>&1
+done
+!GROK!THIS!
+$eunicefix makedir
+chmod +x makedir