summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-11-12 13:06:02 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2007-11-12 13:06:02 -0800
commitb7fc9e0f6d6105ba2203f219743d4b269415e84b (patch)
treeef6586dfc62798c2b17487b443864699aca55f31 /support
downloadvyatta-bash-b7fc9e0f6d6105ba2203f219743d4b269415e84b.tar.gz
vyatta-bash-b7fc9e0f6d6105ba2203f219743d4b269415e84b.zip
initial import from bash_3.1dfsg.orig.tar.gz
Diffstat (limited to 'support')
-rw-r--r--support/Makefile.in87
-rw-r--r--support/SYMLINKS17
-rw-r--r--support/bash.xbm59
-rw-r--r--support/bashbug.sh272
-rw-r--r--support/bashversion.c145
-rwxr-xr-xsupport/config.guess1403
-rwxr-xr-xsupport/config.rpath548
-rwxr-xr-xsupport/config.sub1470
-rwxr-xr-xsupport/fixlinks89
-rwxr-xr-xsupport/install.sh247
-rw-r--r--support/man2html.c4073
-rwxr-xr-xsupport/missing188
-rwxr-xr-xsupport/mkclone123
-rwxr-xr-xsupport/mkconffiles80
-rwxr-xr-xsupport/mkdirs48
-rwxr-xr-xsupport/mkinstalldirs111
-rw-r--r--support/mksignames.c446
-rwxr-xr-xsupport/mkversion.sh164
-rw-r--r--support/printenv.c71
-rwxr-xr-xsupport/printenv.sh27
-rw-r--r--support/recho.c66
-rwxr-xr-xsupport/rlvers.sh113
-rwxr-xr-xsupport/shobj-conf530
-rwxr-xr-xsupport/texi2dvi660
-rwxr-xr-xsupport/texi2html5429
-rwxr-xr-xsupport/xenix-link.sh84
-rw-r--r--support/zecho.c42
27 files changed, 16592 insertions, 0 deletions
diff --git a/support/Makefile.in b/support/Makefile.in
new file mode 100644
index 0000000..b49bd45
--- /dev/null
+++ b/support/Makefile.in
@@ -0,0 +1,87 @@
+#
+# Simple Makefile for the support programs.
+#
+# documentation support: man2html
+# testing support: printenv recho zecho
+#
+# bashbug lives here but is created by the top-level makefile
+#
+# Currently only man2html is built
+#
+#
+# Copyright (C) 1998 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+#
+# Boilerplate
+#
+topdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = .:@srcdir@
+BUILD_DIR = @BUILD_DIR@
+
+RM = rm -f
+SHELL = @MAKE_SHELL@
+CC = @CC@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+
+EXEEXT = @EXEEXT@
+
+#
+# Compiler options:
+#
+PROFILE_FLAGS = @PROFILE_FLAGS@
+
+CFLAGS = @CFLAGS@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
+LOCAL_CFLAGS = @LOCAL_CFLAGS@
+DEFS = @DEFS@
+LOCAL_DEFS = @LOCAL_DEFS@
+
+LOCAL_LDFLAGS = @LOCAL_LDFLAGS@
+LIBS = @LIBS@
+LDFLAGS = @LDFLAGS@ $(LOCAL_LDFLAGS) $(CFLAGS)
+LDFLAGS_FOR_BUILD = $(LDFLAGS)
+
+INCLUDES = -I${BUILD_DIR} -I${topdir}
+
+BASE_CCFLAGS = ${PROFILE_FLAGS} $(DEFS) $(LOCAL_DEFS) $(SYSTEM_FLAGS) \
+ ${INCLUDES} $(LOCAL_CFLAGS)
+
+CCFLAGS = $(BASE_CCFLAGS) $(CPPFLAGS) $(CFLAGS)
+CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
+
+SRC1 = man2html.c
+OBJ1 = man2html.o
+
+.c.o:
+ $(RM) $@
+ $(CC_FOR_BUILD) -c $(CCFLAGS_FOR_BUILD) $<
+
+all: man2html$(EXEEXT)
+
+man2html$(EXEEXT): $(OBJ1)
+ $(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) $(OBJ1) -o $@ ${LIBS}
+
+clean:
+ $(RM) man2html$(EXEEXT)
+
+distclean maintainer-clean mostlyclean: clean
+ $(RM) $(OBJ1)
+
+man2html.o: man2html.c
diff --git a/support/SYMLINKS b/support/SYMLINKS
new file mode 100644
index 0000000..119acbd
--- /dev/null
+++ b/support/SYMLINKS
@@ -0,0 +1,17 @@
+#
+# symlink map for bash source tree
+#
+# link name link target
+#
+lib/readline/tilde.c ../tilde/tilde.c
+lib/readline/tilde.h ../tilde/tilde.h
+#
+lib/readline/ansi_stdlib.h ../../include/ansi_stdlib.h
+lib/readline/posixdir.h ../../include/posixdir.h
+lib/readline/posixjmp.h ../../include/posixjmp.h
+lib/readline/posixstat.h ../../include/posixstat.h
+#lib/readline/rlstdc.h ../../include/stdc.h
+#lib/readline/xmalloc.c ../malloc/xmalloc.c
+#
+#lib/tilde/memalloc.h ../../include/memalloc.h
+#
diff --git a/support/bash.xbm b/support/bash.xbm
new file mode 100644
index 0000000..5c32613
--- /dev/null
+++ b/support/bash.xbm
@@ -0,0 +1,59 @@
+From: Simon Marshall <sm2@sequent.cc.hull.ac.uk>
+Date: Wed, 8 May 91 17:15:58 +0100
+To: bug-bash@ai.mit.edu
+Subject: X bitmap for bash
+
+ Since other GNU software comes with its very own X bitmap, I
+ thought it was about time bash had one too & here it is! To use,
+ stick the stuff after my signature in a file <path>/bash.xbm. If
+ using a twm window manager, insert the lines:
+
+IconDirectory "<path>"
+Icons {
+ "<xterm title>" "bash.xbm"
+}
+ in your ~/.twmrc file. The <xterm title> can be a prefix, so if
+ you have titles "bash@machine", the prefix "bash" will do. I'm not
+ familiar enough with other window managers, but they should be
+ similar.
+
+ If you like it, you're welcome to it...
+
+ Simon.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#define bash_width 64
+#define bash_height 48
+static char bash_bits[] = {
+ 0x00, 0x60, 0x06, 0x30, 0x04, 0x00, 0x00, 0x00, 0x60, 0x98, 0x01, 0x40,
+ 0x03, 0x00, 0x00, 0x00, 0x19, 0x00, 0xa0, 0x80, 0x80, 0xff, 0x00, 0x00,
+ 0x06, 0x00, 0x1c, 0x03, 0xe1, 0x5f, 0x03, 0x00, 0x02, 0x00, 0x22, 0x0c,
+ 0x5d, 0xf4, 0x0e, 0x00, 0xe1, 0x02, 0x09, 0x19, 0x17, 0x91, 0x3d, 0x00,
+ 0xf8, 0x87, 0x40, 0x90, 0x88, 0x88, 0x6e, 0x00, 0x8e, 0x9b, 0x04, 0x62,
+ 0x22, 0x22, 0xd6, 0x00, 0x02, 0xee, 0x4c, 0x68, 0x44, 0x44, 0x6c, 0x01,
+ 0x02, 0xf8, 0xa1, 0x4a, 0x11, 0x11, 0xb1, 0x02, 0x05, 0xa0, 0x22, 0xe0,
+ 0x88, 0x88, 0x68, 0x03, 0x42, 0x50, 0x5d, 0x40, 0x22, 0x22, 0xa2, 0x05,
+ 0x11, 0x81, 0x00, 0x44, 0x44, 0x44, 0x44, 0x07, 0x02, 0x20, 0x84, 0x60,
+ 0x11, 0x11, 0xd1, 0x0d, 0x02, 0x0a, 0x02, 0xc0, 0x88, 0x88, 0x48, 0x0b,
+ 0x44, 0x40, 0x00, 0x42, 0x22, 0x22, 0xa2, 0x1d, 0x24, 0x08, 0x02, 0x64,
+ 0x44, 0x44, 0xc4, 0x1a, 0x08, 0x00, 0x20, 0x20, 0x11, 0x11, 0x91, 0x15,
+ 0x88, 0x00, 0x00, 0xe1, 0xff, 0xff, 0xff, 0x1a, 0x10, 0x08, 0x22, 0x10,
+ 0x00, 0x00, 0xc0, 0x15, 0x31, 0x40, 0x00, 0xf2, 0x03, 0xc0, 0xc1, 0x1a,
+ 0x41, 0x24, 0x48, 0x6c, 0x06, 0x80, 0xc1, 0x15, 0x82, 0x01, 0x00, 0x66,
+ 0x06, 0x80, 0xc1, 0x1a, 0x04, 0x22, 0x12, 0x67, 0x06, 0x80, 0xc1, 0x15,
+ 0x0a, 0x04, 0xe0, 0x66, 0xe6, 0xb8, 0xc7, 0x1a, 0x09, 0xf0, 0x17, 0xee,
+ 0xb3, 0xa5, 0xcf, 0x15, 0x30, 0x00, 0x00, 0x6e, 0x86, 0x8d, 0xcd, 0x1a,
+ 0x00, 0x01, 0x80, 0x67, 0xe6, 0xbd, 0xcd, 0x15, 0x00, 0x46, 0x40, 0x66,
+ 0xb6, 0xb1, 0xcd, 0x1a, 0x00, 0x38, 0x3c, 0x66, 0xb6, 0xa5, 0xcd, 0x15,
+ 0x00, 0x00, 0x02, 0xf6, 0xe3, 0x9d, 0xdd, 0x1a, 0x00, 0x04, 0x60, 0x06,
+ 0x00, 0x00, 0xc0, 0x15, 0x00, 0x04, 0x40, 0xfe, 0xff, 0xff, 0xff, 0x1a,
+ 0x00, 0x02, 0x80, 0x12, 0x11, 0x11, 0x91, 0x15, 0x00, 0x00, 0x00, 0x8a,
+ 0x88, 0x88, 0x88, 0x1a, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0xa2, 0x15,
+ 0x00, 0x00, 0x00, 0x46, 0x44, 0x44, 0xc4, 0x9a, 0x00, 0x00, 0x00, 0x12,
+ 0x11, 0x11, 0x91, 0xb5, 0x00, 0x00, 0x10, 0x8a, 0x88, 0x88, 0x88, 0xba,
+ 0x00, 0x00, 0x10, 0x22, 0x22, 0x22, 0xa2, 0xd5, 0x00, 0x00, 0x30, 0xc6,
+ 0x44, 0x44, 0xcc, 0xdf, 0x00, 0x20, 0x39, 0x96, 0x15, 0x51, 0x99, 0xf5,
+ 0x80, 0xf2, 0x56, 0x8b, 0x9a, 0xea, 0x9b, 0xff, 0xc1, 0xad, 0x5e, 0xaf,
+ 0xbb, 0xfa, 0xba, 0xdf, 0x22, 0x9b, 0xae, 0xd7, 0x54, 0x5d, 0xd7, 0xbf,
+ 0x3b, 0x32, 0xce, 0xff, 0xff, 0xff, 0xff, 0xab, 0xae, 0x2b, 0x59, 0xaf,
+ 0xd4, 0xae, 0x2e, 0xc3, 0xdd, 0x43, 0xa9, 0xd1, 0xba, 0xae, 0x2c, 0xcd};
diff --git a/support/bashbug.sh b/support/bashbug.sh
new file mode 100644
index 0000000..8c4e1ec
--- /dev/null
+++ b/support/bashbug.sh
@@ -0,0 +1,272 @@
+#!/bin/sh -
+#
+# bashbug - create a bug report and mail it to the bug address
+#
+# The bug address depends on the release status of the shell. Versions
+# with status `devel', `alpha', `beta', or `rc' mail bug reports to
+# chet@cwru.edu and, optionally, to bash-testers@cwru.edu.
+# Other versions send mail to bug-bash@gnu.org.
+#
+# Copyright (C) 1996-2004 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+#
+# configuration section:
+# these variables are filled in by the make target in Makefile
+#
+MACHINE="!MACHINE!"
+OS="!OS!"
+CC="!CC!"
+CFLAGS="!CFLAGS!"
+RELEASE="!RELEASE!"
+PATCHLEVEL="!PATCHLEVEL!"
+RELSTATUS="!RELSTATUS!"
+MACHTYPE="!MACHTYPE!"
+
+PATH=/bin:/usr/bin:/usr/local/bin:$PATH
+export PATH
+
+# Check if TMPDIR is set, default to /tmp
+: ${TMPDIR:=/tmp}
+
+#Securely create a temporary directory for the temporary files
+TEMPDIR=$TMPDIR/bbug.$$
+(umask 077 && mkdir $TEMPDIR) || {
+ echo "$0: could not create temporary directory" >&2
+ exit 1
+}
+
+TEMPFILE1=$TEMPDIR/bbug1
+TEMPFILE2=$TEMPDIR/bbug2
+
+USAGE="Usage: $0 [--help] [--version] [bug-report-email-address]"
+VERSTR="GNU bashbug, version ${RELEASE}.${PATCHLEVEL}-${RELSTATUS}"
+
+do_help= do_version=
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --help) shift ; do_help=y ;;
+ --version) shift ; do_version=y ;;
+ --) shift ; break ;;
+ -*) echo "bashbug: ${1}: invalid option" >&2
+ echo "$USAGE" >& 2
+ exit 2 ;;
+ *) break ;;
+ esac
+done
+
+if [ -n "$do_version" ]; then
+ echo "${VERSTR}"
+ exit 0
+fi
+
+if [ -n "$do_help" ]; then
+ echo "${VERSTR}"
+ echo "${USAGE}"
+ echo
+ cat << HERE_EOF
+Bashbug is used to send mail to the Bash maintainers
+for when Bash doesn't behave like you'd like, or expect.
+
+Bashbug will start up your editor (as defined by the shell's
+EDITOR environment variable) with a preformatted bug report
+template for you to fill in. The report will be mailed to the
+bash maintainers by default. See the manual for details.
+
+If you invoke bashbug by accident, just quit your editor without
+saving any changes to the template, and no bug report will be sent.
+HERE_EOF
+ exit 0
+fi
+
+# Figure out how to echo a string without a trailing newline
+N=`echo 'hi there\c'`
+case "$N" in
+*c) n=-n c= ;;
+*) n= c='\c' ;;
+esac
+
+BASHTESTERS="bash-testers@cwru.edu"
+
+case "$RELSTATUS" in
+alpha*|beta*|devel*|rc*) BUGBASH=chet@cwru.edu ;;
+*) BUGBASH=bug-bash@gnu.org ;;
+esac
+
+case "$RELSTATUS" in
+alpha*|beta*|devel*|rc*)
+ echo "$0: This is a testing release. Would you like your bug report"
+ echo "$0: to be sent to the bash-testers mailing list?"
+ echo $n "$0: Send to bash-testers? $c"
+ read ans
+ case "$ans" in
+ y*|Y*) BUGBASH="${BUGBASH},${BASHTESTERS}" ;;
+ esac ;;
+esac
+
+BUGADDR="${1-$BUGBASH}"
+
+if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
+ if [ -x /usr/bin/editor ]; then
+ DEFEDITOR=editor
+ elif [ -x /usr/local/bin/ce ]; then
+ DEFEDITOR=ce
+ elif [ -x /usr/local/bin/emacs ]; then
+ DEFEDITOR=emacs
+ elif [ -x /usr/contrib/bin/emacs ]; then
+ DEFEDITOR=emacs
+ elif [ -x /usr/bin/emacs ]; then
+ DEFEDITOR=emacs
+ elif [ -x /usr/bin/xemacs ]; then
+ DEFEDITOR=xemacs
+ elif [ -x /usr/contrib/bin/jove ]; then
+ DEFEDITOR=jove
+ elif [ -x /usr/local/bin/jove ]; then
+ DEFEDITOR=jove
+ elif [ -x /usr/bin/vi ]; then
+ DEFEDITOR=vi
+ else
+ echo "$0: No default editor found: attempting to use vi" >&2
+ DEFEDITOR=vi
+ fi
+fi
+
+
+: ${EDITOR=$DEFEDITOR}
+
+: ${USER=${LOGNAME-`whoami`}}
+
+trap 'rm -rf "$TEMPDIR"; exit 1' 1 2 3 13 15
+trap 'rm -rf "$TEMPDIR"' 0
+
+UN=
+if (uname) >/dev/null 2>&1; then
+ UN=`uname -a`
+fi
+
+if [ -f /usr/lib/sendmail ] ; then
+ RMAIL="/usr/lib/sendmail"
+ SMARGS="-i -t"
+elif [ -f /usr/sbin/sendmail ] ; then
+ RMAIL="/usr/sbin/sendmail"
+ SMARGS="-i -t"
+else
+ RMAIL=rmail
+ SMARGS="$BUGADDR"
+fi
+
+INITIAL_SUBJECT='[50 character or so descriptive subject here (for reference)]'
+
+cat > "$TEMPFILE1" <<EOF
+From: ${USER}
+To: ${BUGADDR}
+Subject: ${INITIAL_SUBJECT}
+
+Configuration Information [Automatically generated, do not change]:
+Machine: $MACHINE
+OS: $OS
+Compiler: $CC
+Compilation CFLAGS: $CFLAGS
+uname output: $UN
+Machine Type: $MACHTYPE
+
+Bash Version: $RELEASE
+Patch Level: $PATCHLEVEL
+Release Status: $RELSTATUS
+
+Description:
+ [Detailed description of the problem, suggestion, or complaint.]
+
+Repeat-By:
+ [Describe the sequence of events that causes the problem
+ to occur.]
+
+Fix:
+ [Description of how to fix the problem. If you don't know a
+ fix for the problem, don't include this section.]
+EOF
+
+cp "$TEMPFILE1" "$TEMPFILE2"
+chmod u+w "$TEMPFILE1"
+
+trap '' 2 # ignore interrupts while in editor
+
+edstat=1
+while [ $edstat -ne 0 ]; do
+ $EDITOR "$TEMPFILE1"
+ edstat=$?
+
+ if [ $edstat -ne 0 ]; then
+ echo "$0: editor \`$EDITOR' exited with nonzero status."
+ echo "$0: Perhaps it was interrupted."
+ echo "$0: Type \`y' to give up, and lose your bug report;"
+ echo "$0: type \`n' to re-enter the editor."
+ echo $n "$0: Do you want to give up? $c"
+
+ read ans
+ case "$ans" in
+ [Yy]*) exit 1 ;;
+ esac
+
+ continue
+ fi
+
+ # find the subject from the temp file and see if it's been changed
+ CURR_SUB=`grep '^Subject: ' "$TEMPFILE1" | sed 's|^Subject:[ ]*||' | sed 1q`
+
+ case "$CURR_SUB" in
+ "${INITIAL_SUBJECT}")
+ echo
+ echo "$0: You have not changed the subject from the default."
+ echo "$0: Please use a more descriptive subject header."
+ echo "$0: Type \`y' to give up, and lose your bug report;"
+ echo "$0: type \`n' to re-enter the editor."
+ echo $n "$0: Do you want to give up? $c"
+
+ read ans
+ case "$ans" in
+ [Yy]*) exit 1 ;;
+ esac
+
+ echo "$0: The editor will be restarted in five seconds."
+ sleep 5
+ edstat=1
+ ;;
+ esac
+
+done
+
+trap 'rm -rf "$TEMPDIR"; exit 1' 2 # restore trap on SIGINT
+
+if cmp -s "$TEMPFILE1" "$TEMPFILE2"
+then
+ echo "File not changed, no bug report submitted."
+ exit
+fi
+
+echo $n "Send bug report? [y/n] $c"
+read ans
+case "$ans" in
+[Nn]*) exit 0 ;;
+esac
+
+${RMAIL} $SMARGS < "$TEMPFILE1" || {
+ cat "$TEMPFILE1" >> $HOME/dead.bashbug
+ echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2
+}
+
+exit 0
diff --git a/support/bashversion.c b/support/bashversion.c
new file mode 100644
index 0000000..abf1aa8
--- /dev/null
+++ b/support/bashversion.c
@@ -0,0 +1,145 @@
+/* bashversion.c -- Display bash version information. */
+
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Bash; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#include "config.h"
+
+#include "stdc.h"
+
+#include <stdio.h>
+
+#if defined (HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
+
+#include "bashansi.h"
+
+#include "version.h"
+#include "conftypes.h"
+
+#define RFLAG 0x0001
+#define VFLAG 0x0002
+#define MFLAG 0x0004
+#define PFLAG 0x0008
+#define SFLAG 0x0010
+#define LFLAG 0x0020
+#define XFLAG 0x0040
+
+extern int optind;
+extern char *optarg;
+
+extern char *dist_version;
+extern int patch_level;
+
+char *shell_name = "bash";
+char *progname;
+
+static void
+usage()
+{
+ fprintf(stderr, "%s: usage: %s [-hrvpmlsx]\n", progname, progname);
+}
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ int opt, oflags;
+ char dv[128], *rv;
+
+ if (progname = strrchr (argv[0], '/'))
+ progname++;
+ else
+ progname = argv[0];
+
+ oflags = 0;
+ while ((opt = getopt(argc, argv, "hrvmpslx")) != EOF)
+ {
+ switch (opt)
+ {
+ case 'h':
+ usage ();
+ exit (0);
+ case 'r':
+ oflags |= RFLAG; /* release */
+ break;
+ case 'v':
+ oflags |= VFLAG; /* version */
+ break;
+ case 'm':
+ oflags |= MFLAG; /* machtype */
+ break;
+ case 'p':
+ oflags |= PFLAG; /* patchlevel */
+ break;
+ case 's': /* short version string */
+ oflags |= SFLAG;
+ break;
+ case 'l': /* long version string */
+ oflags |= LFLAG;
+ break;
+ case 'x': /* extended version information */
+ oflags |= XFLAG;
+ break;
+ default:
+ usage ();
+ exit (2);
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 0)
+ {
+ usage ();
+ exit (2);
+ }
+
+ /* default behavior */
+ if (oflags == 0)
+ oflags = SFLAG;
+
+ if (oflags & (RFLAG|VFLAG))
+ {
+ strcpy (dv, dist_version);
+ rv = strchr (dv, '.');
+ if (rv)
+ *rv++ = '\0';
+ else
+ rv = "00";
+ }
+ if (oflags & RFLAG)
+ printf ("%s\n", dv);
+ else if (oflags & VFLAG)
+ printf ("%s\n", rv);
+ else if (oflags & MFLAG)
+ printf ("%s\n", MACHTYPE);
+ else if (oflags & PFLAG)
+ printf ("%d\n", patch_level);
+ else if (oflags & SFLAG)
+ printf ("%s\n", shell_version_string ());
+ else if (oflags & LFLAG)
+ show_shell_version (0);
+ else if (oflags & XFLAG)
+ show_shell_version (1);
+
+ exit (0);
+}
diff --git a/support/config.guess b/support/config.guess
new file mode 100755
index 0000000..6d90d6f
--- /dev/null
+++ b/support/config.guess
@@ -0,0 +1,1403 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-11-30'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# This shell variable is my proudest work .. or something. --bje
+
+set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+ || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+dummy=$tmpdir/dummy ;
+files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ rm -f $files ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ;
+unset files'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvmeppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ eval $set_cc_for_build
+ cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
+ if test "$?" = 0 ; then
+ case `$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ 2-1307)
+ UNAME_MACHINE="alphaev68"
+ ;;
+ 3-1307)
+ UNAME_MACHINE="alphaev7"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy && rmdir $tmpdir
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit 0;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ DRS?6000:UNIX_SV:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7 && exit 0 ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c \
+ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+ rm -f $dummy.c $dummy && rmdir $tmpdir
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit 0 ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+ rm -f $dummy.c $dummy && rmdir $tmpdir
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy && rmdir $tmpdir
+ fi ;;
+ esac
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+ rm -f $dummy.c $dummy && rmdir $tmpdir
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3D:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ amd64:FreeBSD:*:*)
+ echo x86_64-unknown-freebsd
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ # Determine whether the default compiler uses glibc.
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #if __GLIBC__ >= 2
+ LIBC=gnu
+ #else
+ LIBC=
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ rm -f $dummy.c && rmdir $tmpdir
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ x86:Interix*:3*)
+ echo i586-pc-interix3
+ exit 0 ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ rm -f $dummy.c && rmdir $tmpdir
+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ rm -f $dummy.c && rmdir $tmpdir
+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit 0 ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0 ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ rm -f $dummy.c && rmdir $tmpdir
+ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit 0 ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[DGKLNPTVWXY]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+rm -f $dummy.c $dummy && rmdir $tmpdir
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/support/config.rpath b/support/config.rpath
new file mode 100755
index 0000000..fa24bfc
--- /dev/null
+++ b/support/config.rpath
@@ -0,0 +1,548 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+# Copyright 1996-2003 Free Software Foundation, Inc.
+# Taken from GNU libtool, 2001
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+#
+# The first argument passed to this file is the canonical host specification,
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+# than 256 bytes, otherwise the compiler driver will dump core. The only
+# known workaround is to choose shorter directory names for the build
+# directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+ wl='-Wl,'
+else
+ case "$host_os" in
+ aix*)
+ wl='-Wl,'
+ ;;
+ mingw* | pw32* | os2*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ wl='-Wl,'
+ ;;
+ irix5* | irix6* | nonstopux*)
+ wl='-Wl,'
+ ;;
+ newsos6)
+ ;;
+ linux*)
+ case $CC in
+ icc|ecc)
+ wl='-Wl,'
+ ;;
+ ccc)
+ wl='-Wl,'
+ ;;
+ esac
+ ;;
+ osf3* | osf4* | osf5*)
+ wl='-Wl,'
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ wl='-Wl,'
+ ;;
+ sunos4*)
+ wl='-Qoption ld '
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ wl='-Wl,'
+ ;;
+ sysv4*MP*)
+ ;;
+ uts4*)
+ ;;
+ esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+ cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ case "$host_os" in
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can use
+ # them.
+ ld_shlibs=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ cygwin* | mingw* | pw32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ netbsd*)
+ ;;
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ sunos4*)
+ hardcode_direct=yes
+ ;;
+ *)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ :
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ if test "$ld_shlibs" = yes; then
+ # Unlike libtool, we use -rpath here, not --rpath, since the documented
+ # option of GNU ld is called -rpath, not --rpath.
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ fi
+else
+ case "$host_os" in
+ aix3*)
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ else
+ aix_use_runtimelinking=no
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ esac
+ fi
+ hardcode_direct=yes
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ esac
+ fi
+ # Begin _LT_AC_SYS_LIBPATH_AIX.
+ echo 'int main () { return 0; }' > conftest.c
+ ${CC} ${LDFLAGS} conftest.c -o conftest
+ aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
+}'`
+ fi
+ if test -z "$aix_libpath"; then
+ aix_libpath="/usr/lib:/lib"
+ fi
+ rm -f conftest.c conftest
+ # End _LT_AC_SYS_LIBPATH_AIX.
+ if test "$aix_use_runtimelinking" = yes; then
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ fi
+ fi
+ ;;
+ amigaos*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+ bsdi4*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ libext=lib
+ ;;
+ darwin* | rhapsody*)
+ if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
+ hardcode_direct=no
+ fi
+ ;;
+ dgux*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+ freebsd2.2*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ freebsd2*)
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ freebsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ hpux10* | hpux11*)
+ if test "$with_gnu_ld" = no; then
+ case "$host_cpu" in
+ hppa*64*)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=no
+ ;;
+ ia64*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=no
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+ irix5* | irix6* | nonstopux*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ netbsd*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ ;;
+ newsos6)
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ openbsd*)
+ hardcode_direct=yes
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ else
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ osf3*)
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+ osf4* | osf5*)
+ if test "$GCC" = yes; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ # Both cc and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ sunos4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ hardcode_direct=no
+ ;;
+ motorola)
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ ;;
+ sysv4.3*)
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ ld_shlibs=yes
+ fi
+ ;;
+ sysv4.2uw2*)
+ hardcode_direct=yes
+ hardcode_minus_L=no
+ ;;
+ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
+ ;;
+ sysv5*)
+ hardcode_libdir_flag_spec=
+ ;;
+ uts4*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+libname_spec='lib$name'
+case "$host_os" in
+ aix3*)
+ ;;
+ aix4* | aix5*)
+ ;;
+ amigaos*)
+ ;;
+ beos*)
+ ;;
+ bsdi4*)
+ ;;
+ cygwin* | mingw* | pw32*)
+ shrext=.dll
+ ;;
+ darwin* | rhapsody*)
+ shrext=.dylib
+ ;;
+ dgux*)
+ ;;
+ freebsd1*)
+ ;;
+ freebsd*)
+ ;;
+ gnu*)
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case "$host_cpu" in
+ ia64*)
+ shrext=.so
+ ;;
+ hppa*64*)
+ shrext=.sl
+ ;;
+ *)
+ shrext=.sl
+ ;;
+ esac
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case "$host_os" in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+ *) libsuff= shlibsuff= ;;
+ esac
+ ;;
+ esac
+ ;;
+ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+ linux*)
+ ;;
+ netbsd*)
+ ;;
+ newsos6)
+ ;;
+ nto-qnx)
+ ;;
+ openbsd*)
+ ;;
+ os2*)
+ libname_spec='$name'
+ shrext=.dll
+ ;;
+ osf3* | osf4* | osf5*)
+ ;;
+ sco3.2v5*)
+ ;;
+ solaris*)
+ ;;
+ sunos4*)
+ ;;
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ ;;
+ sysv4*MP*)
+ ;;
+ uts4*)
+ ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
diff --git a/support/config.sub b/support/config.sub
new file mode 100755
index 0000000..aefb7e1
--- /dev/null
+++ b/support/config.sub
@@ -0,0 +1,1470 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-11-30'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit 0;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k \
+ | m32r | m68000 | m68k | m88k | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | ns16k | ns32k \
+ | openrisc | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64 | amd64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | amd64-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+ | clipper-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* \
+ | m32r-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39 | mipstx39el \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+ | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ or32 | or32-*)
+ basic_machine=or32-unknown
+ os=-coff
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i686-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3d)
+ basic_machine=alpha-cray
+ os=-unicos
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic4x | c4x*)
+ basic_machine=tic4x-unknown
+ os=-coff
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+ basic_machine=sh-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparc | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/support/fixlinks b/support/fixlinks
new file mode 100755
index 0000000..13a86c8
--- /dev/null
+++ b/support/fixlinks
@@ -0,0 +1,89 @@
+#! /bin/sh
+#
+# fixlinks - make symlinks in the bash source tree so that there is
+# exactly one version of any given source file.
+#
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+SRCDIR=.
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -s) shift; SRCDIR=$1 ;;
+ -u) unfix=yes ;;
+ -h) hardlinks=yes ;;
+ -*) echo "$0: $1: bad option" 1>&2
+ echo "$0: usage: $0 [-hu] [-s srcdir] [linkmap]" 1>&2
+ exit 1;;
+ *) break ;;
+ esac
+ shift
+done
+
+if [ ! -d $SRCDIR/builtins ]; then
+ echo "$0: must be run with valid -s argument or from source directory" 1>&2
+ exit 1
+fi
+
+if [ $# -eq 0 ]; then
+ linkfile=$SRCDIR/support/SYMLINKS
+else
+ linkfile=$1
+fi
+
+if [ ! -f "$linkfile" ]; then
+ echo "$0: symlink map file \`$linkfile' does not exist"
+ exit 1
+fi
+
+rm_ltmp=false
+LINKTEMP=`mktemp -t linktmp.XXXXXXXX 2>/dev/null`
+if [ -z "$LINKTEMP" ]; then
+ : ${TMPDIR:=/tmp}
+ LINKTEMP=${TMPDIR}/linktmp.$$
+ rm_ltmp=true
+fi
+
+$rm_ltmp && rm -f ${LINKTEMP}
+# if the user specified hard links, then do that. otherwise, try to use
+# symlinks if they're present
+if [ -n "$hardlinks" ]; then
+ LN=ln
+elif (ln -s /dev/null ${LINKTEMP}) >/dev/null 2>&1; then
+ LN="ln -s"
+else
+ LN=ln
+fi
+rm -f ${LINKTEMP}
+
+while read name target
+do
+ case "$name" in
+ \#*) continue;;
+ esac
+
+ rm -f $name
+ case "$unfix" in
+ yes) dirname=`expr "$name" ':' '^\(.*\)/[^/]*'`
+ [ -z "$dirname" ] && dirname=.
+ cp $dirname/$target $name
+ echo $target copied to $name ;;
+ *) $LN $target $name ; echo "$name -> $target" ;;
+ esac
+
+done < $linkfile
+
+exit 0
diff --git a/support/install.sh b/support/install.sh
new file mode 100755
index 0000000..0cac004
--- /dev/null
+++ b/support/install.sh
@@ -0,0 +1,247 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+tranformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/support/man2html.c b/support/man2html.c
new file mode 100644
index 0000000..2432c13
--- /dev/null
+++ b/support/man2html.c
@@ -0,0 +1,4073 @@
+/*
+ * This program was written by Richard Verhoeven (NL:5482ZX35)
+ * at the Eindhoven University of Technology. Email: rcb5@win.tue.nl
+ *
+ * Permission is granted to distribute, modify and use this program as long
+ * as this comment is not removed or changed.
+ *
+ * THIS IS A MODIFIED VERSION. IT WAS MODIFIED BY chet@po.cwru.edu FOR
+ * USE BY BASH.
+ */
+
+/*
+ * man2html will add links to the converted manpages. The function add_links
+ * is used for that. At the moment it will add links as follows, where
+ * indicates what should match to start with:
+ * ^^^
+ * Recognition Item Link
+ * ----------------------------------------------------------
+ * name(*) Manpage ../man?/name.*
+ * ^
+ * name@hostname Email address mailto:name@hostname
+ * ^
+ * method://string URL method://string
+ * ^^^
+ * www.host.name WWW server http://www.host.name
+ * ^^^^
+ * ftp.host.name FTP server ftp://ftp.host.name
+ * ^^^^
+ * <file.h> Include file file:/usr/include/file.h
+ * ^^^
+ *
+ * Since man2html does not check if manpages, hosts or email addresses exist,
+ * some links might not work. For manpages, some extra checks are performed
+ * to make sure not every () pair creates a link. Also out of date pages
+ * might point to incorrect places.
+ *
+ * The program will not allow users to get system specific files, such as
+ * /etc/passwd. It will check that "man" is part of the specified file and
+ * that "/../" isn't. Even if someone manages to get such file, man2html will
+ * handle it like a manpage and will usually not produce any output (or crash).
+ *
+ * If you find any bugs when normal manpages are converted, please report
+ * them to me (rcb5@win.tue.nl) after you have checked that man(1) can handle
+ * the manpage correct.
+ *
+ * Known bugs and missing features:
+ *
+ * * Equations are not converted at all.
+ * * Tables are converted but some features are not possible in html.
+ * * The tabbing environment is converted by counting characters and adding
+ * spaces. This might go wrong (outside <PRE>)
+ * * Some pages look beter if man2html works in troff mode, especially pages
+ * with tables. You can deside at compile time which made you want to use.
+ *
+ * -DNROFF=0 troff mode
+ * -DNROFF=1 nroff mode (default)
+ *
+ * if you install both modes, you should compile with the correct CGIBASE.
+ * * Some manpages rely on the fact that troff/nroff is used to convert
+ * them and use features which are not descripted in the man manpages.
+ * (definitions, calculations, conditionals, requests). I can't guarantee
+ * that all these features work on all manpages. (I didn't have the
+ * time to look through all the available manpages.)
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define NROFF 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <time.h>
+#include <sys/time.h>
+#include <errno.h>
+
+#define NULL_TERMINATED(n) ((n) + 1)
+
+#define HUGE_STR_MAX 10000
+#define LARGE_STR_MAX 2000
+#define MED_STR_MAX 500
+#define SMALL_STR_MAX 100
+#define TINY_STR_MAX 10
+
+#define MAX_MAN_PATHS 100 /* Max number of directories */
+#define MAX_ZCATS 10 /* Max number of zcat style programs */
+#define MAX_WORDLIST 100
+
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+#ifndef EXIT_USAGE
+#define EXIT_USAGE 2
+#endif
+
+static char location_base[NULL_TERMINATED(MED_STR_MAX)] = "";
+
+static char th_page_and_sec[128] = { '\0' };
+static char th_datestr[128] = { '\0' };
+static char th_version[128] = { '\0' };
+
+char *signature = "<HR>\nThis document was created by man2html from %s.<BR>\nTime: %s\n";
+
+/* timeformat for signature */
+#define TIMEFORMAT "%d %B %Y %T %Z"
+
+char *manpage;
+
+/* BSD mandoc Bl/El lists to HTML list types */
+#define BL_DESC_LIST 1
+#define BL_BULLET_LIST 2
+#define BL_ENUM_LIST 4
+
+/* BSD mandoc Bd/Ed example(?) blocks */
+#define BD_LITERAL 1
+#define BD_INDENT 2
+
+#ifndef HAVE_STRERROR
+static char *
+strerror(int e)
+{
+ static char emsg[40];
+
+#if defined (HAVE_SYS_ERRLIST)
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+
+ if (e > 0 && e < sys_nerr)
+ return (sys_errlist[e]);
+ else
+#endif /* HAVE_SYS_ERRLIST */
+ {
+ sprintf(emsg, "Unknown system error %d", e);
+ return (&emsg[0]);
+ }
+}
+#endif /* !HAVE_STRERROR */
+
+static char *
+strgrow(char *old, int len)
+{
+ char *new = realloc(old, (strlen(old) + len + 1) * sizeof(char));
+
+ if (!new) {
+ fprintf(stderr, "man2html: out of memory");
+ exit(EXIT_FAILURE);
+ }
+ return new;
+}
+
+static char *
+stralloc(int len)
+{
+ /* allocate enough for len + NULL */
+ char *new = malloc((len + 1) * sizeof(char));
+
+ if (!new) {
+ fprintf(stderr, "man2html: out of memory");
+ exit(EXIT_FAILURE);
+ }
+ return new;
+}
+
+/*
+ * Some systems don't have strdup so lets use our own - which can also
+ * check for out of memory.
+ */
+static char *
+strduplicate(char *from)
+{
+ char *new = stralloc(strlen(from));
+
+ strcpy(new, from);
+ return new;
+}
+
+/* Assumes space for n plus a null */
+static char *
+strmaxcpy(char *to, char *from, int n)
+{
+ int len = strlen(from);
+
+ strncpy(to, from, n);
+ to[(len <= n) ? len : n] = '\0';
+ return to;
+}
+
+static char *
+strmaxcat(char *to, char *from, int n)
+{
+ int to_len = strlen(to);
+
+ if (to_len < n) {
+ int from_len = strlen(from);
+ int cp = (to_len + from_len <= n) ? from_len : n - to_len;
+
+ strncpy(to + to_len, from, cp);
+ to[to_len + cp] = '\0';
+ }
+ return to;
+}
+
+/* Assumes space for limit plus a null */
+static char *
+strlimitcpy(char *to, char *from, int n, int limit)
+{
+ int len = n > limit ? limit : n;
+
+ strmaxcpy(to, from, len);
+ to[len] = '\0';
+ return to;
+}
+
+/*
+ * takes string and escapes all metacharacters. should be used before
+ * including string in system() or similar call.
+ */
+static char *
+escape_input(char *str)
+{
+ int i, j = 0;
+ static char new[NULL_TERMINATED(MED_STR_MAX)];
+
+ if (strlen(str) * 2 + 1 > MED_STR_MAX) {
+ fprintf(stderr,
+ "man2html: escape_input - str too long:\n%-80s...\n",
+ str);
+ exit(EXIT_FAILURE);
+ }
+ for (i = 0; i < strlen(str); i++) {
+ if (!(((str[i] >= 'A') && (str[i] <= 'Z')) ||
+ ((str[i] >= 'a') && (str[i] <= 'z')) ||
+ ((str[i] >= '0') && (str[i] <= '9')))) {
+ new[j] = '\\';
+ j++;
+ }
+ new[j] = str[i];
+ j++;
+ }
+ new[j] = '\0';
+ return new;
+}
+
+static void
+usage(void)
+{
+ fprintf(stderr, "man2html: usage: man2html filename\n");
+}
+
+
+
+/*
+ * below this you should not change anything unless you know a lot
+ * about this program or about troff.
+ */
+
+typedef struct STRDEF STRDEF;
+struct STRDEF {
+ int nr, slen;
+ char *st;
+ STRDEF *next;
+};
+
+typedef struct INTDEF INTDEF;
+struct INTDEF {
+ int nr;
+ int val;
+ int incr;
+ INTDEF *next;
+};
+
+static char NEWLINE[2] = "\n";
+static char idxlabel[6] = "ixAAA";
+
+#define INDEXFILE "/tmp/manindex.list"
+
+static char *fname;
+static FILE *idxfile;
+
+static STRDEF *chardef, *strdef, *defdef;
+static INTDEF *intdef;
+
+#define V(A,B) ((A)*256+(B))
+
+static INTDEF standardint[] = {
+ {V('n', ' '), NROFF, 0, NULL},
+ {V('t', ' '), 1 - NROFF, 0, NULL},
+ {V('o', ' '), 1, 0, NULL},
+ {V('e', ' '), 0, 0, NULL},
+ {V('.', 'l'), 70, 0, NULL},
+ {V('.', '$'), 0, 0, NULL},
+ {V('.', 'A'), NROFF, 0, NULL},
+ {V('.', 'T'), 1 - NROFF, 0, NULL},
+ {V('.', 'V'), 1, 0, NULL}, /* the me package tests for this */
+{0, 0, 0, NULL}};
+
+static STRDEF standardstring[] = {
+ {V('R', ' '), 1, "&#174;", NULL},
+ {V('l', 'q'), 2, "``", NULL},
+ {V('r', 'q'), 2, "''", NULL},
+ {0, 0, NULL, NULL}
+};
+
+
+static STRDEF standardchar[] = {
+ {V('*', '*'), 1, "*", NULL},
+ {V('*', 'A'), 1, "A", NULL},
+ {V('*', 'B'), 1, "B", NULL},
+ {V('*', 'C'), 2, "Xi", NULL},
+ {V('*', 'D'), 5, "Delta", NULL},
+ {V('*', 'E'), 1, "E", NULL},
+ {V('*', 'F'), 3, "Phi", NULL},
+ {V('*', 'G'), 5, "Gamma", NULL},
+ {V('*', 'H'), 5, "Theta", NULL},
+ {V('*', 'I'), 1, "I", NULL},
+ {V('*', 'K'), 1, "K", NULL},
+ {V('*', 'L'), 6, "Lambda", NULL},
+ {V('*', 'M'), 1, "M", NULL},
+ {V('*', 'N'), 1, "N", NULL},
+ {V('*', 'O'), 1, "O", NULL},
+ {V('*', 'P'), 2, "Pi", NULL},
+ {V('*', 'Q'), 3, "Psi", NULL},
+ {V('*', 'R'), 1, "P", NULL},
+ {V('*', 'S'), 5, "Sigma", NULL},
+ {V('*', 'T'), 1, "T", NULL},
+ {V('*', 'U'), 1, "Y", NULL},
+ {V('*', 'W'), 5, "Omega", NULL},
+ {V('*', 'X'), 1, "X", NULL},
+ {V('*', 'Y'), 1, "H", NULL},
+ {V('*', 'Z'), 1, "Z", NULL},
+ {V('*', 'a'), 5, "alpha", NULL},
+ {V('*', 'b'), 4, "beta", NULL},
+ {V('*', 'c'), 2, "xi", NULL},
+ {V('*', 'd'), 5, "delta", NULL},
+ {V('*', 'e'), 7, "epsilon", NULL},
+ {V('*', 'f'), 3, "phi", NULL},
+ {V('*', 'g'), 5, "gamma", NULL},
+ {V('*', 'h'), 5, "theta", NULL},
+ {V('*', 'i'), 4, "iota", NULL},
+ {V('*', 'k'), 5, "kappa", NULL},
+ {V('*', 'l'), 6, "lambda", NULL},
+ {V('*', 'm'), 1, "&#181;", NULL},
+ {V('*', 'n'), 2, "nu", NULL},
+ {V('*', 'o'), 1, "o", NULL},
+ {V('*', 'p'), 2, "pi", NULL},
+ {V('*', 'q'), 3, "psi", NULL},
+ {V('*', 'r'), 3, "rho", NULL},
+ {V('*', 's'), 5, "sigma", NULL},
+ {V('*', 't'), 3, "tau", NULL},
+ {V('*', 'u'), 7, "upsilon", NULL},
+ {V('*', 'w'), 5, "omega", NULL},
+ {V('*', 'x'), 3, "chi", NULL},
+ {V('*', 'y'), 3, "eta", NULL},
+ {V('*', 'z'), 4, "zeta", NULL},
+ {V('t', 's'), 5, "sigma", NULL},
+ {V('+', '-'), 1, "&#177;", NULL},
+ {V('1', '2'), 1, "&#189;", NULL},
+ {V('1', '4'), 1, "&#188;", NULL},
+ {V('3', '4'), 1, "&#190;", NULL},
+ {V('F', 'i'), 3, "ffi", NULL},
+ {V('F', 'l'), 3, "ffl", NULL},
+ {V('a', 'a'), 1, "&#180;", NULL},
+ {V('a', 'p'), 1, "~", NULL},
+ {V('b', 'r'), 1, "|", NULL},
+ {V('b', 'u'), 1, "*", NULL},
+ {V('b', 'v'), 1, "|", NULL},
+ {V('c', 'i'), 1, "o", NULL},
+ {V('c', 'o'), 1, "&#169;", NULL},
+ {V('c', 't'), 1, "&#162;", NULL},
+ {V('d', 'e'), 1, "&#176;", NULL},
+ {V('d', 'g'), 1, "+", NULL},
+ {V('d', 'i'), 1, "&#247;", NULL},
+ {V('e', 'm'), 1, "-", NULL},
+ {V('e', 'm'), 3, "---", NULL},
+ {V('e', 'q'), 1, "=", NULL},
+ {V('e', 's'), 1, "&#216;", NULL},
+ {V('f', 'f'), 2, "ff", NULL},
+ {V('f', 'i'), 2, "fi", NULL},
+ {V('f', 'l'), 2, "fl", NULL},
+ {V('f', 'm'), 1, "&#180;", NULL},
+ {V('g', 'a'), 1, "`", NULL},
+ {V('h', 'y'), 1, "-", NULL},
+ {V('l', 'c'), 2, "|&#175;", NULL},
+ {V('l', 'f'), 2, "|_", NULL},
+ {V('l', 'k'), 1, "<FONT SIZE=+2>{</FONT>", NULL},
+ {V('m', 'i'), 1, "-", NULL},
+ {V('m', 'u'), 1, "&#215;", NULL},
+ {V('n', 'o'), 1, "&#172;", NULL},
+ {V('o', 'r'), 1, "|", NULL},
+ {V('p', 'l'), 1, "+", NULL},
+ {V('r', 'c'), 2, "&#175;|", NULL},
+ {V('r', 'f'), 2, "_|", NULL},
+ {V('r', 'g'), 1, "&#174;", NULL},
+ {V('r', 'k'), 1, "<FONT SIZE=+2>}</FONT>", NULL},
+ {V('r', 'n'), 1, "&#175;", NULL},
+ {V('r', 'u'), 1, "_", NULL},
+ {V('s', 'c'), 1, "&#167;", NULL},
+ {V('s', 'l'), 1, "/", NULL},
+ {V('s', 'q'), 2, "[]", NULL},
+ {V('u', 'l'), 1, "_", NULL},
+ {0, 0, NULL, NULL}
+};
+
+/* default: print code */
+
+
+static char eqndelimopen = 0, eqndelimclose = 0;
+static char escapesym = '\\', nobreaksym = '\'', controlsym = '.', fieldsym = 0, padsym = 0;
+
+static char *buffer = NULL;
+static int buffpos = 0, buffmax = 0;
+static int scaninbuff = 0;
+static int itemdepth = 0;
+static int dl_set[20] = {0};
+static int still_dd = 0;
+static int tabstops[20] = {8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96};
+static int maxtstop = 12;
+static int curpos = 0;
+
+static char *scan_troff(char *c, int san, char **result);
+static char *scan_troff_mandoc(char *c, int san, char **result);
+
+static char **argument = NULL;
+
+static char charb[TINY_STR_MAX];
+
+static void
+print_sig(void)
+{
+ char datbuf[NULL_TERMINATED(MED_STR_MAX)];
+ struct tm *timetm;
+ time_t clock;
+
+ datbuf[0] = '\0';
+ clock = time(NULL);
+ timetm = localtime(&clock);
+ strftime(datbuf, MED_STR_MAX, TIMEFORMAT, timetm);
+ printf(signature, manpage, datbuf);
+}
+
+static char *
+expand_char(int nr)
+{
+ STRDEF *h;
+
+ h = chardef;
+ if (!nr)
+ return NULL;
+ while (h)
+ if (h->nr == nr) {
+ curpos += h->slen;
+ return h->st;
+ } else
+ h = h->next;
+ charb[0] = nr / 256;
+ charb[1] = nr % 256;
+ charb[2] = '\0';
+ if (charb[0] == '<') { /* Fix up <= */
+ charb[4] = charb[1];
+ strncpy(charb, "&lt;", 4);
+ charb[5] = '\0';
+ }
+ curpos += 2;
+ return charb;
+}
+
+static char *
+expand_string(int nr)
+{
+ STRDEF *h = strdef;
+
+ if (!nr)
+ return NULL;
+ while (h)
+ if (h->nr == nr) {
+ curpos += h->slen;
+ return h->st;
+ } else
+ h = h->next;
+ return NULL;
+}
+
+static char *
+read_man_page(char *filename)
+{
+ char *man_buf = NULL;
+ int i;
+ FILE *man_stream = NULL;
+ struct stat stbuf;
+ int buf_size;
+
+ if (stat(filename, &stbuf) == -1)
+ return NULL;
+
+ buf_size = stbuf.st_size;
+ man_buf = stralloc(buf_size + 5);
+ man_stream = fopen(filename, "r");
+ if (man_stream) {
+ man_buf[0] = '\n';
+ if (fread(man_buf + 1, 1, buf_size, man_stream) == buf_size) {
+ man_buf[buf_size] = '\n';
+ man_buf[buf_size + 1] = man_buf[buf_size + 2] = '\0';
+ } else {
+ man_buf = NULL;
+ }
+ fclose(man_stream);
+ }
+ return man_buf;
+}
+
+
+static char outbuffer[NULL_TERMINATED(HUGE_STR_MAX)];
+static int obp = 0;
+static int no_newline_output = 0;
+static int newline_for_fun = 0;
+static int output_possible = 0;
+static int out_length = 0;
+
+/*
+ * Add the links to the output. At the moment the following are
+ * recognized:
+ *
+#if 0
+ * name(*) -> ../man?/name.*
+#endif
+ * method://string -> method://string
+ * www.host.name -> http://www.host.name
+ * ftp.host.name -> ftp://ftp.host.name
+ * name@host -> mailto:name@host
+ * <name.h> -> file:/usr/include/name.h (guess)
+ *
+ * Other possible links to add in the future:
+ *
+ * /dir/dir/file -> file:/dir/dir/file
+ */
+static void
+add_links(char *c)
+{
+ int i, j, nr;
+ char *f, *g, *h;
+ char *idtest[6]; /* url, mailto, www, ftp, manpage */
+
+ out_length += strlen(c);
+ /* search for (section) */
+ nr = 0;
+ idtest[0] = strstr(c + 1, "://");
+ idtest[1] = strchr(c + 1, '@');
+ idtest[2] = strstr(c, "www.");
+ idtest[3] = strstr(c, "ftp.");
+#if 0
+ idtest[4] = strchr(c + 1, '(');
+#else
+ idtest[4] = 0;
+#endif
+ idtest[5] = strstr(c + 1, ".h&gt;");
+ for (i = 0; i < 6; i++)
+ nr += (idtest[i] != NULL);
+ while (nr) {
+ j = -1;
+ for (i = 0; i < 6; i++)
+ if (idtest[i] && (j < 0 || idtest[i] < idtest[j]))
+ j = i;
+ switch (j) {
+ case 5: /* <name.h> */
+ f = idtest[5];
+ h = f + 2;
+ g = f;
+ while (g > c && g[-1] != ';')
+ g--;
+ if (g != c) {
+ char t;
+
+ t = *g;
+ *g = '\0';
+ fputs(c, stdout);
+ *g = t;
+ *h = '\0';
+ printf("<A HREF=\"file:/usr/include/%s\">%s</A>&gt;", g, g);
+ c = f + 6;
+ } else {
+ f[5] = '\0';
+ fputs(c, stdout);
+ f[5] = ';';
+ c = f + 5;
+ }
+ break;
+ case 4: /* manpage */
+#if 0
+ f = idtest[j];
+ /* check section */
+ g = strchr(f, ')');
+ if (g && f - g < 6 && (isalnum(f[-1]) || f[-1] == '>') &&
+ ((isdigit(f[1]) && f[1] != '0' &&
+ (f[2] == ')' || (isalpha(f[2]) && f[3] == ')') || f[2] == 'X')) ||
+ (f[2] == ')' && (f[1] == 'n' || f[1] == 'l')))) {
+ /* this might be a link */
+ h = f - 1;
+ /* skip html makeup */
+ while (h > c && *h == '>') {
+ while (h != c && *h != '<')
+ h--;
+ if (h != c)
+ h--;
+ }
+ if (isalnum(*h)) {
+ char t, sec, subsec, *e;
+
+ e = h + 1;
+ sec = f[1];
+ subsec = f[2];
+ if ((subsec == 'X' && f[3] != ')') || subsec == ')')
+ subsec = '\0';
+ while (h > c && (isalnum(h[-1]) || h[-1] == '_' ||
+ h[-1] == '-' || h[-1] == '.'))
+ h--;
+ t = *h;
+ *h = '\0';
+ fputs(c, stdout);
+ *h = t;
+ t = *e;
+ *e = '\0';
+ if (subsec)
+ printf("<A HREF=\""
+ CGIBASE
+ "?man%c/%s.%c%c\">%s</A>",
+ sec, h, sec, tolower(subsec), h);
+ else
+ printf("<A HREF=\""
+ CGIBASE
+ "?man%c/%s.%c\">%s</A>",
+ sec, h, sec, h);
+ *e = t;
+ c = e;
+ }
+ }
+ *f = '\0';
+ fputs(c, stdout);
+ *f = '(';
+ idtest[4] = f - 1;
+ c = f;
+#endif
+ break; /* manpage */
+ case 3: /* ftp */
+ case 2: /* www */
+ g = f = idtest[j];
+ while (*g && (isalnum(*g) || *g == '_' || *g == '-' || *g == '+' ||
+ *g == '.'))
+ g++;
+ if (g[-1] == '.')
+ g--;
+ if (g - f > 4) {
+ char t;
+
+ t = *f;
+ *f = '\0';
+ fputs(c, stdout);
+ *f = t;
+ t = *g;
+ *g = '\0';
+ printf("<A HREF=\"%s://%s\">%s</A>", (j == 3 ? "ftp" : "http"),
+ f, f);
+ *g = t;
+ c = g;
+ } else {
+ f[3] = '\0';
+ fputs(c, stdout);
+ c = f + 3;
+ f[3] = '.';
+ }
+ break;
+ case 1: /* mailto */
+ g = f = idtest[1];
+ while (g > c && (isalnum(g[-1]) || g[-1] == '_' || g[-1] == '-' ||
+ g[-1] == '+' || g[-1] == '.' || g[-1] == '%'))
+ g--;
+ h = f + 1;
+ while (*h && (isalnum(*h) || *h == '_' || *h == '-' || *h == '+' ||
+ *h == '.'))
+ h++;
+ if (*h == '.')
+ h--;
+ if (h - f > 4 && f - g > 1) {
+ char t;
+
+ t = *g;
+ *g = '\0';
+ fputs(c, stdout);
+ *g = t;
+ t = *h;
+ *h = '\0';
+ printf("<A HREF=\"mailto:%s\">%s</A>", g, g);
+ *h = t;
+ c = h;
+ } else {
+ *f = '\0';
+ fputs(c, stdout);
+ *f = '@';
+ idtest[1] = c;
+ c = f;
+ }
+ break;
+ case 0: /* url */
+ g = f = idtest[0];
+ while (g > c && isalpha(g[-1]) && islower(g[-1]))
+ g--;
+ h = f + 3;
+ while (*h && !isspace(*h) && *h != '<' && *h != '>' && *h != '"' &&
+ *h != '&')
+ h++;
+ if (f - g > 2 && f - g < 7 && h - f > 3) {
+ char t;
+
+ t = *g;
+ *g = '\0';
+ fputs(c, stdout);
+ *g = t;
+ t = *h;
+ *h = '\0';
+ printf("<A HREF=\"%s\">%s</A>", g, g);
+ *h = t;
+ c = h;
+ } else {
+ f[1] = '\0';
+ fputs(c, stdout);
+ f[1] = '/';
+ c = f + 1;
+ }
+ break;
+ default:
+ break;
+ }
+ nr = 0;
+ if (idtest[0] && idtest[0] < c)
+ idtest[0] = strstr(c + 1, "://");
+ if (idtest[1] && idtest[1] < c)
+ idtest[1] = strchr(c + 1, '@');
+ if (idtest[2] && idtest[2] < c)
+ idtest[2] = strstr(c, "www.");
+ if (idtest[3] && idtest[3] < c)
+ idtest[3] = strstr(c, "ftp.");
+ if (idtest[4] && idtest[4] < c)
+ idtest[4] = strchr(c + 1, '(');
+ if (idtest[5] && idtest[5] < c)
+ idtest[5] = strstr(c + 1, ".h&gt;");
+ for (i = 0; i < 6; i++)
+ nr += (idtest[i] != NULL);
+ }
+ fputs(c, stdout);
+}
+
+static int current_font = 0;
+static int current_size = 0;
+static int fillout = 1;
+
+static void
+out_html(char *c)
+{
+ if (!c)
+ return;
+ if (no_newline_output) {
+ int i = 0;
+
+ no_newline_output = 1;
+ while (c[i]) {
+ if (!no_newline_output)
+ c[i - 1] = c[i];
+ if (c[i] == '\n')
+ no_newline_output = 1;
+ i++;
+ }
+ if (!no_newline_output)
+ c[i - 1] = 0;
+ }
+ if (scaninbuff) {
+ while (*c) {
+ if (buffpos >= buffmax) {
+ char *h;
+
+ h = realloc(buffer, buffmax * 2);
+ if (!h)
+ return;
+ buffer = h;
+ buffmax *= 2;
+ }
+ buffer[buffpos++] = *c++;
+ }
+ } else if (output_possible) {
+ while (*c) {
+ outbuffer[obp++] = *c;
+ if (*c == '\n' || obp > HUGE_STR_MAX) {
+ outbuffer[obp] = '\0';
+ add_links(outbuffer);
+ obp = 0;
+ }
+ c++;
+ }
+ }
+}
+
+#define FO0 ""
+#define FC0 ""
+#define FO1 "<I>"
+#define FC1 "</I>"
+#define FO2 "<B>"
+#define FC2 "</B>"
+#define FO3 "<TT>"
+#define FC3 "</TT>"
+
+static char *switchfont[16] = {
+ "", FC0 FO1, FC0 FO2, FC0 FO3,
+ FC1 FO0, "", FC1 FO2, FC1 FO3,
+ FC2 FO0, FC2 FO1, "", FC2 FO3,
+ FC3 FO0, FC3 FO1, FC3 FO2, ""
+};
+
+static char *
+change_to_font(int nr)
+{
+ int i;
+
+ switch (nr) {
+ case '0':
+ nr++;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ nr = nr - '1';
+ break;
+ case V('C', 'W'):
+ nr = 3;
+ break;
+ case 'L':
+ nr = 3;
+ break;
+ case 'B':
+ nr = 2;
+ break;
+ case 'I':
+ nr = 1;
+ break;
+ case 'P':
+ case 'R':
+ nr = 0;
+ break;
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ break;
+ default:
+ nr = 0;
+ break;
+ }
+ i = current_font * 4 + nr % 4;
+ current_font = nr % 4;
+ return switchfont[i];
+}
+
+static char sizebuf[200];
+
+static char *
+change_to_size(int nr)
+{
+ int i;
+
+ switch (nr) {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ nr = nr - '0';
+ break;
+ case '\0':
+ break;
+ default:
+ nr = current_size + nr;
+ if (nr > 9)
+ nr = 9;
+ if (nr < -9)
+ nr = -9;
+ break;
+ }
+ if (nr == current_size)
+ return "";
+ i = current_font;
+ sizebuf[0] = '\0';
+ strcat(sizebuf, change_to_font(0));
+ if (current_size)
+ strcat(sizebuf, "</FONT>");
+ current_size = nr;
+ if (nr) {
+ int l;
+
+ strcat(sizebuf, "<FONT SIZE=");
+ l = strlen(sizebuf);
+ if (nr > 0)
+ sizebuf[l++] = '+';
+ else
+ sizebuf[l++] = '-', nr = -nr;
+ sizebuf[l++] = nr + '0';
+ sizebuf[l++] = '>';
+ sizebuf[l] = '\0';
+ }
+ strcat(sizebuf, change_to_font(i));
+ return sizebuf;
+}
+
+static int asint = 0;
+static int intresult = 0;
+
+#define SKIPEOL while (*c && *c++!='\n')
+
+static int skip_escape = 0;
+static int single_escape = 0;
+
+static char *
+scan_escape(char *c)
+{
+ char *h = NULL;
+ char b[5];
+ INTDEF *intd;
+ int exoutputp, exskipescape;
+ int i, j;
+
+ intresult = 0;
+ switch (*c) {
+ case 'e':
+ h = "\\";
+ curpos++;
+ break;
+ case '0':
+ case ' ':
+ h = "&nbsp;";
+ curpos++;
+ break;
+ case '|':
+ h = "";
+ break;
+ case '"':
+ SKIPEOL;
+ c--;
+ h = "";
+ break;
+ case '$':
+ if (argument) {
+ c++;
+ i = (*c - '1');
+ if (!(h = argument[i]))
+ h = "";
+ }
+ break;
+ case 'z':
+ c++;
+ if (*c == '\\') {
+ c = scan_escape(c + 1);
+ c--;
+ h = "";
+ } else {
+ b[0] = *c;
+ b[1] = '\0';
+ h = "";
+ }
+ break;
+ case 'k':
+ c++;
+ if (*c == '(')
+ c += 2;
+ case '^':
+ case '!':
+ case '%':
+ case 'a':
+ case 'd':
+ case 'r':
+ case 'u':
+ case '\n':
+ case '&':
+ h = "";
+ break;
+ case '(':
+ c++;
+ i = c[0] * 256 + c[1];
+ c++;
+ h = expand_char(i);
+ break;
+ case '*':
+ c++;
+ if (*c == '(') {
+ c++;
+ i = c[0] * 256 + c[1];
+ c++;
+ } else
+ i = *c * 256 + ' ';
+ h = expand_string(i);
+ break;
+ case 'f':
+ c++;
+ if (*c == '\\') {
+ c++;
+ c = scan_escape(c);
+ c--;
+ i = intresult;
+ } else if (*c != '(')
+ i = *c;
+ else {
+ c++;
+ i = c[0] * 256 + c[1];
+ c++;
+ }
+ if (!skip_escape)
+ h = change_to_font(i);
+ else
+ h = "";
+ break;
+ case 's':
+ c++;
+ j = 0;
+ i = 0;
+ if (*c == '-') {
+ j = -1;
+ c++;
+ } else if (*c == '+') {
+ j = 1;
+ c++;
+ }
+ if (*c == '0')
+ c++;
+ else if (*c == '\\') {
+ c++;
+ c = scan_escape(c);
+ i = intresult;
+ if (!j)
+ j = 1;
+ } else
+ while (isdigit(*c) && (!i || (!j && i < 4)))
+ i = i * 10 + (*c++) - '0';
+ if (!j) {
+ j = 1;
+ if (i)
+ i = i - 10;
+ }
+ if (!skip_escape)
+ h = change_to_size(i * j);
+ else
+ h = "";
+ c--;
+ break;
+ case 'n':
+ c++;
+ j = 0;
+ switch (*c) {
+ case '+':
+ j = 1;
+ c++;
+ break;
+ case '-':
+ j = -1;
+ c++;
+ break;
+ default:
+ break;
+ }
+ if (*c == '(') {
+ c++;
+ i = V(c[0], c[1]);
+ c = c + 1;
+ } else {
+ i = V(c[0], ' ');
+ }
+ intd = intdef;
+ while (intd && intd->nr != i)
+ intd = intd->next;
+ if (intd) {
+ intd->val = intd->val + j * intd->incr;
+ intresult = intd->val;
+ } else {
+ switch (i) {
+ case V('.', 's'):
+ intresult = current_size;
+ break;
+ case V('.', 'f'):
+ intresult = current_font;
+ break;
+ default:
+ intresult = 0;
+ break;
+ }
+ }
+ h = "";
+ break;
+ case 'w':
+ c++;
+ i = *c;
+ c++;
+ exoutputp = output_possible;
+ exskipescape = skip_escape;
+ output_possible = 0;
+ skip_escape = 1;
+ j = 0;
+ while (*c != i) {
+ j++;
+ if (*c == escapesym)
+ c = scan_escape(c + 1);
+ else
+ c++;
+ }
+ output_possible = exoutputp;
+ skip_escape = exskipescape;
+ intresult = j;
+ break;
+ case 'l':
+ h = "<HR>";
+ curpos = 0;
+ case 'b':
+ case 'v':
+ case 'x':
+ case 'o':
+ case 'L':
+ case 'h':
+ c++;
+ i = *c;
+ c++;
+ exoutputp = output_possible;
+ exskipescape = skip_escape;
+ output_possible = 0;
+ skip_escape = 1;
+ while (*c != i)
+ if (*c == escapesym)
+ c = scan_escape(c + 1);
+ else
+ c++;
+ output_possible = exoutputp;
+ skip_escape = exskipescape;
+ break;
+ case 'c':
+ no_newline_output = 1;
+ break;
+ case '{':
+ newline_for_fun++;
+ h = "";
+ break;
+ case '}':
+ if (newline_for_fun)
+ newline_for_fun--;
+ h = "";
+ break;
+ case 'p':
+ h = "<BR>\n";
+ curpos = 0;
+ break;
+ case 't':
+ h = "\t";
+ curpos = (curpos + 8) & 0xfff8;
+ break;
+ case '<':
+ h = "&lt;";
+ curpos++;
+ break;
+ case '>':
+ h = "&gt;";
+ curpos++;
+ break;
+ case '\\':
+ if (single_escape) {
+ c--;
+ break;
+ }
+ default:
+ b[0] = *c;
+ b[1] = 0;
+ h = b;
+ curpos++;
+ break;
+ }
+ c++;
+ if (!skip_escape)
+ out_html(h);
+ return c;
+}
+
+typedef struct TABLEITEM TABLEITEM;
+
+struct TABLEITEM {
+ char *contents;
+ int size, align, valign, colspan, rowspan, font, vleft, vright, space,
+ width;
+ TABLEITEM *next;
+};
+
+static TABLEITEM emptyfield = {NULL, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, NULL};
+
+typedef struct TABLEROW TABLEROW;
+
+struct TABLEROW {
+ TABLEITEM *first;
+ TABLEROW *prev, *next;
+};
+
+static char *tableopt[] = {
+ "center", "expand", "box", "allbox", "doublebox",
+ "tab", "linesize", "delim", NULL
+};
+static int tableoptl[] = {6, 6, 3, 6, 9, 3, 8, 5, 0};
+
+static void
+clear_table(TABLEROW * table)
+{
+ TABLEROW *tr1, *tr2;
+ TABLEITEM *ti1, *ti2;
+
+ tr1 = table;
+ while (tr1->prev)
+ tr1 = tr1->prev;
+ while (tr1) {
+ ti1 = tr1->first;
+ while (ti1) {
+ ti2 = ti1->next;
+ if (ti1->contents)
+ free(ti1->contents);
+ free(ti1);
+ ti1 = ti2;
+ }
+ tr2 = tr1;
+ tr1 = tr1->next;
+ free(tr2);
+ }
+}
+
+static char *scan_expression(char *c, int *result);
+
+static char *
+scan_format(char *c, TABLEROW ** result, int *maxcol)
+{
+ TABLEROW *layout, *currow;
+ TABLEITEM *curfield;
+ int i, j;
+
+ if (*result) {
+ clear_table(*result);
+ }
+ layout = currow = (TABLEROW *) malloc(sizeof(TABLEROW));
+ currow->next = currow->prev = NULL;
+ currow->first = curfield = (TABLEITEM *) malloc(sizeof(TABLEITEM));
+ *curfield = emptyfield;
+ while (*c && *c != '.') {
+ switch (*c) {
+ case 'C':
+ case 'c':
+ case 'N':
+ case 'n':
+ case 'R':
+ case 'r':
+ case 'A':
+ case 'a':
+ case 'L':
+ case 'l':
+ case 'S':
+ case 's':
+ case '^':
+ case '_':
+ if (curfield->align) {
+ curfield->next = (TABLEITEM *) malloc(sizeof(TABLEITEM));
+ curfield = curfield->next;
+ *curfield = emptyfield;
+ }
+ curfield->align = toupper(*c);
+ c++;
+ break;
+ case 'i':
+ case 'I':
+ case 'B':
+ case 'b':
+ curfield->font = toupper(*c);
+ c++;
+ break;
+ case 'f':
+ case 'F':
+ c++;
+ curfield->font = toupper(*c);
+ c++;
+ if (!isspace(*c))
+ c++;
+ break;
+ case 't':
+ case 'T':
+ curfield->valign = 't';
+ c++;
+ break;
+ case 'p':
+ case 'P':
+ c++;
+ i = j = 0;
+ if (*c == '+') {
+ j = 1;
+ c++;
+ }
+ if (*c == '-') {
+ j = -1;
+ c++;
+ }
+ while (isdigit(*c))
+ i = i * 10 + (*c++) - '0';
+ if (j)
+ curfield->size = i * j;
+ else
+ curfield->size = j - 10;
+ break;
+ case 'v':
+ case 'V':
+ case 'w':
+ case 'W':
+ c = scan_expression(c + 2, &curfield->width);
+ break;
+ case '|':
+ if (curfield->align)
+ curfield->vleft++;
+ else
+ curfield->vright++;
+ c++;
+ break;
+ case 'e':
+ case 'E':
+ c++;
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ i = 0;
+ while (isdigit(*c))
+ i = i * 10 + (*c++) - '0';
+ curfield->space = i;
+ break;
+ case ',':
+ case '\n':
+ currow->next = (TABLEROW *) malloc(sizeof(TABLEROW));
+ currow->next->prev = currow;
+ currow = currow->next;
+ currow->next = NULL;
+ curfield = currow->first = (TABLEITEM *) malloc(sizeof(TABLEITEM));
+ *curfield = emptyfield;
+ c++;
+ break;
+ default:
+ c++;
+ break;
+ }
+ }
+ if (*c == '.')
+ while (*c++ != '\n');
+ *maxcol = 0;
+ currow = layout;
+ while (currow) {
+ curfield = layout->first;
+ i = 0;
+ while (curfield) {
+ i++;
+ curfield = curfield->next;
+ }
+ if (i > *maxcol)
+ *maxcol = i;
+ currow = currow->next;
+ }
+ *result = layout;
+ return c;
+}
+
+static TABLEROW *
+next_row(TABLEROW * tr)
+{
+ if (tr->next) {
+ tr = tr->next;
+ if (!tr->next)
+ next_row(tr);
+ return tr;
+ } else {
+ TABLEITEM *ti, *ti2;
+
+ tr->next = (TABLEROW *) malloc(sizeof(TABLEROW));
+ tr->next->prev = tr;
+ ti = tr->first;
+ tr = tr->next;
+ tr->next = NULL;
+ if (ti)
+ tr->first = ti2 = (TABLEITEM *) malloc(sizeof(TABLEITEM));
+ else
+ tr->first = ti2 = NULL;
+ while (ti != ti2) {
+ *ti2 = *ti;
+ ti2->contents = NULL;
+ if ((ti = ti->next)) {
+ ti2->next = (TABLEITEM *) malloc(sizeof(TABLEITEM));
+ }
+ ti2 = ti2->next;
+ }
+ return tr;
+ }
+}
+
+static char itemreset[20] = "\\fR\\s0";
+
+static char *
+scan_table(char *c)
+{
+ char *t, *h, *g;
+ int center = 0, expand = 0, box = 0, border = 0, linesize = 1;
+ int i, j, maxcol = 0, finished = 0;
+ int oldfont, oldsize, oldfillout;
+ char itemsep = '\t';
+ TABLEROW *layout = NULL, *currow, *ftable;
+ TABLEITEM *curfield;
+
+ while (*c++ != '\n');
+ h = c;
+ if (*h == '.')
+ return c - 1;
+ oldfont = current_font;
+ oldsize = current_size;
+ oldfillout = fillout;
+ out_html(change_to_font(0));
+ out_html(change_to_size(0));
+ if (!fillout) {
+ fillout = 1;
+ out_html("</PRE>");
+ }
+ while (*h && *h != '\n')
+ h++;
+ if (h[-1] == ';') {
+ /* scan table options */
+ while (c < h) {
+ while (isspace(*c))
+ c++;
+ for (i = 0; tableopt[i] && strncmp(tableopt[i], c, tableoptl[i]); i++);
+ c = c + tableoptl[i];
+ switch (i) {
+ case 0:
+ center = 1;
+ break;
+ case 1:
+ expand = 1;
+ break;
+ case 2:
+ box = 1;
+ break;
+ case 3:
+ border = 1;
+ break;
+ case 4:
+ box = 2;
+ break;
+ case 5:
+ while (*c++ != '(');
+ itemsep = *c++;
+ break;
+ case 6:
+ while (*c++ != '(');
+ linesize = 0;
+ while (isdigit(*c))
+ linesize = linesize * 10 + (*c++) - '0';
+ break;
+ case 7:
+ while (*c != ')')
+ c++;
+ default:
+ break;
+ }
+ c++;
+ }
+ c = h + 1;
+ }
+ /* scan layout */
+ c = scan_format(c, &layout, &maxcol);
+ currow = layout;
+ next_row(currow);
+ curfield = layout->first;
+ i = 0;
+ while (!finished) {
+ /* search item */
+ h = c;
+ if ((*c == '_' || *c == '=') && (c[1] == itemsep || c[1] == '\n')) {
+ if (c[-1] == '\n' && c[1] == '\n') {
+ if (currow->prev) {
+ currow->prev->next = (TABLEROW *) malloc(sizeof(TABLEROW));
+ currow->prev->next->next = currow;
+ currow->prev->next->prev = currow->prev;
+ currow->prev = currow->prev->next;
+ } else {
+ currow->prev = layout = (TABLEROW *) malloc(sizeof(TABLEROW));
+ currow->prev->prev = NULL;
+ currow->prev->next = currow;
+ }
+ curfield = currow->prev->first =
+ (TABLEITEM *) malloc(sizeof(TABLEITEM));
+ *curfield = emptyfield;
+ curfield->align = *c;
+ curfield->colspan = maxcol;
+ curfield = currow->first;
+ c = c + 2;
+ } else {
+ if (curfield) {
+ curfield->align = *c;
+ do {
+ curfield = curfield->next;
+ } while (curfield && curfield->align == 'S');
+ }
+ if (c[1] == '\n') {
+ currow = next_row(currow);
+ curfield = currow->first;
+ }
+ c = c + 2;
+ }
+ } else if (*c == 'T' && c[1] == '{') {
+ h = c + 2;
+ c = strstr(h, "\nT}");
+ c++;
+ *c = '\0';
+ g = NULL;
+ scan_troff(h, 0, &g);
+ scan_troff(itemreset, 0, &g);
+ *c = 'T';
+ c += 3;
+ if (curfield) {
+ curfield->contents = g;
+ do {
+ curfield = curfield->next;
+ } while (curfield && curfield->align == 'S');
+ } else if (g)
+ free(g);
+ if (c[-1] == '\n') {
+ currow = next_row(currow);
+ curfield = currow->first;
+ }
+ } else if (*c == '.' && c[1] == 'T' && c[2] == '&' && c[-1] == '\n') {
+ TABLEROW *hr;
+
+ while (*c++ != '\n');
+ hr = currow;
+ currow = currow->prev;
+ hr->prev = NULL;
+ c = scan_format(c, &hr, &i);
+ hr->prev = currow;
+ currow->next = hr;
+ currow = hr;
+ next_row(currow);
+ curfield = currow->first;
+ } else if (*c == '.' && c[1] == 'T' && c[2] == 'E' && c[-1] == '\n') {
+ finished = 1;
+ while (*c++ != '\n');
+ if (currow->prev)
+ currow->prev->next = NULL;
+ currow->prev = NULL;
+ clear_table(currow);
+ } else if (*c == '.' && c[-1] == '\n' && !isdigit(c[1])) {
+ /*
+ * skip troff request inside table (usually only .sp
+ * )
+ */
+ while (*c++ != '\n');
+ } else {
+ h = c;
+ while (*c && (*c != itemsep || c[-1] == '\\') &&
+ (*c != '\n' || c[-1] == '\\'))
+ c++;
+ i = 0;
+ if (*c == itemsep) {
+ i = 1;
+ *c = '\n';
+ }
+ if (h[0] == '\\' && h[2] == '\n' &&
+ (h[1] == '_' || h[1] == '^')) {
+ if (curfield) {
+ curfield->align = h[1];
+ do {
+ curfield = curfield->next;
+ } while (curfield && curfield->align == 'S');
+ }
+ h = h + 3;
+ } else {
+ g = NULL;
+ h = scan_troff(h, 1, &g);
+ scan_troff(itemreset, 0, &g);
+ if (curfield) {
+ curfield->contents = g;
+ do {
+ curfield = curfield->next;
+ } while (curfield && curfield->align == 'S');
+ } else if (g)
+ free(g);
+ }
+ if (i)
+ *c = itemsep;
+ c = h;
+ if (c[-1] == '\n') {
+ currow = next_row(currow);
+ curfield = currow->first;
+ }
+ }
+ }
+ /* calculate colspan and rowspan */
+ currow = layout;
+ while (currow->next)
+ currow = currow->next;
+ while (currow) {
+ TABLEITEM *ti, *ti1 = NULL, *ti2 = NULL;
+
+ ti = currow->first;
+ if (currow->prev)
+ ti1 = currow->prev->first;
+ while (ti) {
+ switch (ti->align) {
+ case 'S':
+ if (ti2) {
+ ti2->colspan++;
+ if (ti2->rowspan < ti->rowspan)
+ ti2->rowspan = ti->rowspan;
+ }
+ break;
+ case '^':
+ if (ti1)
+ ti1->rowspan++;
+ default:
+ if (!ti2)
+ ti2 = ti;
+ else {
+ do {
+ ti2 = ti2->next;
+ } while (ti2 && curfield->align == 'S');
+ }
+ break;
+ }
+ ti = ti->next;
+ if (ti1)
+ ti1 = ti1->next;
+ }
+ currow = currow->prev;
+ }
+ /* produce html output */
+ if (center)
+ out_html("<CENTER>");
+ if (box == 2)
+ out_html("<TABLE BORDER><TR><TD>");
+ out_html("<TABLE");
+ if (box || border) {
+ out_html(" BORDER");
+ if (!border)
+ out_html("><TR><TD><TABLE");
+ if (expand)
+ out_html(" WIDTH=100%");
+ }
+ out_html(">\n");
+ currow = layout;
+ while (currow) {
+ j = 0;
+ out_html("<TR VALIGN=top>");
+ curfield = currow->first;
+ while (curfield) {
+ if (curfield->align != 'S' && curfield->align != '^') {
+ out_html("<TD");
+ switch (curfield->align) {
+ case 'N':
+ curfield->space += 4;
+ case 'R':
+ out_html(" ALIGN=right");
+ break;
+ case 'C':
+ out_html(" ALIGN=center");
+ default:
+ break;
+ }
+ if (!curfield->valign && curfield->rowspan > 1)
+ out_html(" VALIGN=center");
+ if (curfield->colspan > 1) {
+ char buf[5];
+
+ out_html(" COLSPAN=");
+ sprintf(buf, "%i", curfield->colspan);
+ out_html(buf);
+ }
+ if (curfield->rowspan > 1) {
+ char buf[5];
+
+ out_html(" ROWSPAN=");
+ sprintf(buf, "%i", curfield->rowspan);
+ out_html(buf);
+ }
+ j = j + curfield->colspan;
+ out_html(">");
+ if (curfield->size)
+ out_html(change_to_size(curfield->size));
+ if (curfield->font)
+ out_html(change_to_font(curfield->font));
+ switch (curfield->align) {
+ case '=':
+ out_html("<HR><HR>");
+ break;
+ case '_':
+ out_html("<HR>");
+ break;
+ default:
+ if (curfield->contents)
+ out_html(curfield->contents);
+ break;
+ }
+ if (curfield->space)
+ for (i = 0; i < curfield->space; i++)
+ out_html("&nbsp;");
+ if (curfield->font)
+ out_html(change_to_font(0));
+ if (curfield->size)
+ out_html(change_to_size(0));
+ if (j >= maxcol && curfield->align > '@' && curfield->align != '_')
+ out_html("<BR>");
+ out_html("</TD>");
+ }
+ curfield = curfield->next;
+ }
+ out_html("</TR>\n");
+ currow = currow->next;
+ }
+ if (box && !border)
+ out_html("</TABLE>");
+ out_html("</TABLE>");
+ if (box == 2)
+ out_html("</TABLE>");
+ if (center)
+ out_html("</CENTER>\n");
+ else
+ out_html("\n");
+ if (!oldfillout)
+ out_html("<PRE>");
+ fillout = oldfillout;
+ out_html(change_to_size(oldsize));
+ out_html(change_to_font(oldfont));
+ return c;
+}
+
+static char *
+scan_expression(char *c, int *result)
+{
+ int value = 0, value2, j = 0, sign = 1, opex = 0;
+ char oper = 'c';
+
+ if (*c == '!') {
+ c = scan_expression(c + 1, &value);
+ value = (!value);
+ } else if (*c == 'n') {
+ c++;
+ value = NROFF;
+ } else if (*c == 't') {
+ c++;
+ value = 1 - NROFF;
+ } else if (*c == '\'' || *c == '"' || *c < ' ' || (*c == '\\' && c[1] == '(')) {
+ /*
+ * ?string1?string2? test if string1 equals string2.
+ */
+ char *st1 = NULL, *st2 = NULL, *h;
+ char *tcmp = NULL;
+ char sep;
+
+ sep = *c;
+ if (sep == '\\') {
+ tcmp = c;
+ c = c + 3;
+ }
+ c++;
+ h = c;
+ while (*c != sep && (!tcmp || strncmp(c, tcmp, 4)))
+ c++;
+ *c = '\n';
+ scan_troff(h, 1, &st1);
+ *c = sep;
+ if (tcmp)
+ c = c + 3;
+ c++;
+ h = c;
+ while (*c != sep && (!tcmp || strncmp(c, tcmp, 4)))
+ c++;
+ *c = '\n';
+ scan_troff(h, 1, &st2);
+ *c = sep;
+ if (!st1 && !st2)
+ value = 1;
+ else if (!st1 || !st2)
+ value = 0;
+ else
+ value = (!strcmp(st1, st2));
+ if (st1)
+ free(st1);
+ if (st2)
+ free(st2);
+ if (tcmp)
+ c = c + 3;
+ c++;
+ } else {
+ while (*c && !isspace(*c) && *c != ')') {
+ opex = 0;
+ switch (*c) {
+ case '(':
+ c = scan_expression(c + 1, &value2);
+ value2 = sign * value2;
+ opex = 1;
+ break;
+ case '.':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':{
+ int num = 0, denum = 1;
+
+ value2 = 0;
+ while (isdigit(*c))
+ value2 = value2 * 10 + ((*c++) - '0');
+ if (*c == '.') {
+ c++;
+ while (isdigit(*c)) {
+ num = num * 10 + ((*c++) - '0');
+ denum = denum * 10;
+ }
+ }
+ if (isalpha(*c)) {
+ /* scale indicator */
+ switch (*c) {
+ case 'i': /* inch -> 10pt */
+ value2 = value2 * 10 + (num * 10 + denum / 2) / denum;
+ num = 0;
+ break;
+ default:
+ break;
+ }
+ c++;
+ }
+ value2 = value2 + (num + denum / 2) / denum;
+ value2 = sign * value2;
+ opex = 1;
+ break;
+ }
+ case '\\':
+ c = scan_escape(c + 1);
+ value2 = intresult * sign;
+ if (isalpha(*c))
+ c++; /* scale indicator */
+ opex = 1;
+ break;
+ case '-':
+ if (oper) {
+ sign = -1;
+ c++;
+ break;
+ }
+ case '>':
+ case '<':
+ case '+':
+ case '/':
+ case '*':
+ case '%':
+ case '&':
+ case '=':
+ case ':':
+ if (c[1] == '=')
+ oper = (*c++) + 16;
+ else
+ oper = *c;
+ c++;
+ break;
+ default:
+ c++;
+ break;
+ }
+ if (opex) {
+ sign = 1;
+ switch (oper) {
+ case 'c':
+ value = value2;
+ break;
+ case '-':
+ value = value - value2;
+ break;
+ case '+':
+ value = value + value2;
+ break;
+ case '*':
+ value = value * value2;
+ break;
+ case '/':
+ if (value2)
+ value = value / value2;
+ break;
+ case '%':
+ if (value2)
+ value = value % value2;
+ break;
+ case '<':
+ value = (value < value2);
+ break;
+ case '>':
+ value = (value > value2);
+ break;
+ case '>' + 16:
+ value = (value >= value2);
+ break;
+ case '<' + 16:
+ value = (value <= value2);
+ break;
+ case '=':
+ case '=' + 16:
+ value = (value == value2);
+ break;
+ case '&':
+ value = (value && value2);
+ break;
+ case ':':
+ value = (value || value2);
+ break;
+ default:
+ fprintf(stderr, "man2html: unknown operator %c.\n", oper);
+ }
+ oper = 0;
+ }
+ }
+ if (*c == ')')
+ c++;
+ }
+ *result = value;
+ return c;
+}
+
+static void
+trans_char(char *c, char s, char t)
+{
+ char *sl = c;
+ int slash = 0;
+
+ while (*sl != '\n' || slash) {
+ if (!slash) {
+ if (*sl == escapesym)
+ slash = 1;
+ else if (*sl == s)
+ *sl = t;
+ } else
+ slash = 0;
+ sl++;
+ }
+}
+
+/* Remove \a from C in place. Return modified C. */
+static char *
+unescape (char *c)
+{
+ int i, l;
+
+ l = strlen (c);
+ i = 0;
+ while (i < l && c[i]) {
+ if (c[i] == '\a') {
+ if (c[i+1])
+ strcpy(c + i, c + i + 1); /* should be memmove */
+ else {
+ c[i] = '\0';
+ break;
+ }
+ }
+ i++;
+ }
+ return c;
+}
+
+static char *
+fill_words(char *c, char *words[], int *n)
+{
+ char *sl = c;
+ int slash = 0;
+ int skipspace = 0;
+
+ *n = 0;
+ words[*n] = sl;
+ while (*sl && (*sl != '\n' || slash)) {
+ if (!slash) {
+ if (*sl == '"') {
+ *sl = '\a';
+ skipspace = !skipspace;
+ } else if (*sl == '\a') {
+ /* handle already-translated " */
+ skipspace = !skipspace;
+ } else if (*sl == escapesym)
+ slash = 1;
+ else if ((*sl == ' ' || *sl == '\t') && !skipspace) {
+ *sl = '\n';
+ if (words[*n] != sl)
+ (*n)++;
+ words[*n] = sl + 1;
+ }
+ } else {
+ if (*sl == '"') {
+ sl--;
+ *sl = '\n';
+ if (words[*n] != sl)
+ (*n)++;
+ sl++;
+ while (*sl && *sl != '\n')
+ sl++;
+ words[*n] = sl;
+ sl--;
+ }
+ slash = 0;
+ }
+ sl++;
+ }
+ if (sl != words[*n])
+ (*n)++;
+ return sl;
+}
+
+static char *abbrev_list[] = {
+ "GSBG", "Getting Started ",
+ "SUBG", "Customizing SunOS",
+ "SHBG", "Basic Troubleshooting",
+ "SVBG", "SunView User's Guide",
+ "MMBG", "Mail and Messages",
+ "DMBG", "Doing More with SunOS",
+ "UNBG", "Using the Network",
+ "GDBG", "Games, Demos &amp; Other Pursuits",
+ "CHANGE", "SunOS 4.1 Release Manual",
+ "INSTALL", "Installing SunOS 4.1",
+ "ADMIN", "System and Network Administration",
+ "SECUR", "Security Features Guide",
+ "PROM", "PROM User's Manual",
+ "DIAG", "Sun System Diagnostics",
+ "SUNDIAG", "Sundiag User's Guide",
+ "MANPAGES", "SunOS Reference Manual",
+ "REFMAN", "SunOS Reference Manual",
+ "SSI", "Sun System Introduction",
+ "SSO", "System Services Overview",
+ "TEXT", "Editing Text Files",
+ "DOCS", "Formatting Documents",
+ "TROFF", "Using <B>nroff</B> and <B>troff</B>",
+ "INDEX", "Global Index",
+ "CPG", "C Programmer's Guide",
+ "CREF", "C Reference Manual",
+ "ASSY", "Assembly Language Reference",
+ "PUL", "Programming Utilities and Libraries",
+ "DEBUG", "Debugging Tools",
+ "NETP", "Network Programming",
+ "DRIVER", "Writing Device Drivers",
+ "STREAMS", "STREAMS Programming",
+ "SBDK", "SBus Developer's Kit",
+ "WDDS", "Writing Device Drivers for the SBus",
+ "FPOINT", "Floating-Point Programmer's Guide",
+ "SVPG", "SunView 1 Programmer's Guide",
+ "SVSPG", "SunView 1 System Programmer's Guide",
+ "PIXRCT", "Pixrect Reference Manual",
+ "CGI", "SunCGI Reference Manual",
+ "CORE", "SunCore Reference Manual",
+ "4ASSY", "Sun-4 Assembly Language Reference",
+ "SARCH", "<FONT SIZE=-1>SPARC</FONT> Architecture Manual",
+ "KR", "The C Programming Language",
+NULL, NULL};
+
+static char *
+lookup_abbrev(char *c)
+{
+ int i = 0;
+
+ if (!c)
+ return "";
+ while (abbrev_list[i] && strcmp(c, abbrev_list[i]))
+ i = i + 2;
+ if (abbrev_list[i])
+ return abbrev_list[i + 1];
+ else
+ return c;
+}
+
+static char manidx[NULL_TERMINATED(HUGE_STR_MAX)];
+static int subs = 0;
+static int mip = 0;
+static char label[5] = "lbAA";
+
+static void
+add_to_index(int level, char *item)
+{
+ char *c = NULL;
+
+ label[3]++;
+ if (label[3] > 'Z') {
+ label[3] = 'A';
+ label[2]++;
+ }
+ if (level != subs) {
+ if (subs) {
+ strmaxcpy(manidx + mip, "</DL>\n", HUGE_STR_MAX - mip);
+ mip += 6;
+ } else {
+ strmaxcpy(manidx + mip, "<DL>\n", HUGE_STR_MAX - mip);
+ mip += 5;
+ }
+ }
+ subs = level;
+ scan_troff(item, 1, &c);
+ sprintf(manidx + mip, "<DT><A HREF=\"#%s\">%s</A><DD>\n", label, c);
+ if (c)
+ free(c);
+ while (manidx[mip])
+ mip++;
+}
+
+static char *
+skip_till_newline(char *c)
+{
+ int lvl = 0;
+
+ while (*c && *c != '\n' || lvl > 0) {
+ if (*c == '\\') {
+ c++;
+ if (*c == '}')
+ lvl--;
+ else if (*c == '{')
+ lvl++;
+ }
+ c++;
+ }
+ c++;
+ if (lvl < 0 && newline_for_fun) {
+ newline_for_fun = newline_for_fun + lvl;
+ if (newline_for_fun < 0)
+ newline_for_fun = 0;
+ }
+ return c;
+}
+
+static void
+outputPageHeader(char *l, char *c, char *r)
+{
+ out_html("<TABLE WIDTH=100%>\n<TR>\n");
+ out_html("<TH ALIGN=LEFT width=33%>");
+ out_html(l);
+ out_html("<TH ALIGN=CENTER width=33%>");
+ out_html(c);
+ out_html("<TH ALIGN=RIGHT width=33%>");
+ out_html(r);
+ out_html("\n</TR>\n</TABLE>\n");
+}
+
+static void
+outputPageFooter(char *l, char *c, char *r)
+{
+ out_html("<HR>\n");
+ outputPageHeader(l, c, r);
+}
+
+static int ifelseval = 0;
+
+static char *
+scan_request(char *c)
+{
+ /* BSD Mandoc stuff */
+ static int mandoc_synopsis = 0; /* True if we are in the synopsis
+ * section */
+ static int mandoc_command = 0; /* True if this is mandoc page */
+ static int mandoc_bd_options; /* Only copes with non-nested Bd's */
+
+ int i, j, mode = 0;
+ char *h;
+ char *wordlist[MAX_WORDLIST];
+ int words;
+ char *sl;
+ STRDEF *owndef;
+
+ while (*c == ' ' || *c == '\t')
+ c++;
+ if (c[0] == '\n')
+ return c + 1;
+ if (c[1] == '\n')
+ j = 1;
+ else
+ j = 2;
+ while (c[j] == ' ' || c[j] == '\t')
+ j++;
+ if (c[0] == escapesym) {
+ /* some pages use .\" .\$1 .\} */
+ /* .\$1 is too difficult/stupid */
+ if (c[1] == '$')
+ c = skip_till_newline(c);
+ else
+ c = scan_escape(c + 1);
+ } else {
+ i = V(c[0], c[1]);
+ switch (i) {
+ case V('a', 'b'):
+ h = c + j;
+ while (*h && *h != '\n')
+ h++;
+ *h = '\0';
+ if (scaninbuff && buffpos) {
+ buffer[buffpos] = '\0';
+ puts(buffer);
+ }
+ /* fprintf(stderr, "%s\n", c+2); */
+ exit(0);
+ break;
+ case V('d', 'i'):
+ {
+ STRDEF *de;
+ int oldcurpos = curpos;
+
+ c = c + j;
+ i = V(c[0], c[1]);
+ if (*c == '\n') {
+ c++;
+ break;
+ }
+ while (*c && *c != '\n')
+ c++;
+ c++;
+ h = c;
+ while (*c && strncmp(c, ".di", 3))
+ while (*c && *c++ != '\n');
+ *c = '\0';
+ de = strdef;
+ while (de && de->nr != i)
+ de = de->next;
+ if (!de) {
+ de = (STRDEF *) malloc(sizeof(STRDEF));
+ de->nr = i;
+ de->slen = 0;
+ de->next = strdef;
+ de->st = NULL;
+ strdef = de;
+ } else {
+ if (de->st)
+ free(de->st);
+ de->slen = 0;
+ de->st = NULL;
+ }
+ scan_troff(h, 0, &de->st);
+ *c = '.';
+ while (*c && *c++ != '\n');
+ break;
+ }
+ case V('d', 's'):
+ mode = 1;
+ case V('a', 's'):
+ {
+ STRDEF *de;
+ int oldcurpos = curpos;
+
+ c = c + j;
+ i = V(c[0], c[1]);
+ j = 0;
+ while (c[j] && c[j] != '\n')
+ j++;
+ if (j < 3) {
+ c = c + j;
+ break;
+ }
+ if (c[1] == ' ')
+ c = c + 1;
+ else
+ c = c + 2;
+ while (isspace(*c))
+ c++;
+ if (*c == '"')
+ c++;
+ de = strdef;
+ while (de && de->nr != i)
+ de = de->next;
+ single_escape = 1;
+ curpos = 0;
+ if (!de) {
+ char *h;
+
+ de = (STRDEF *) malloc(sizeof(STRDEF));
+ de->nr = i;
+ de->slen = 0;
+ de->next = strdef;
+ de->st = NULL;
+ strdef = de;
+ h = NULL;
+ c = scan_troff(c, 1, &h);
+ de->st = h;
+ de->slen = curpos;
+ } else {
+ if (mode) {
+ char *h = NULL;
+
+ c = scan_troff(c, 1, &h);
+ free(de->st);
+ de->slen = 0;
+ de->st = h;
+ } else
+ c = scan_troff(c, 1, &de->st);
+ de->slen += curpos;
+ }
+ single_escape = 0;
+ curpos = oldcurpos;
+ }
+ break;
+ case V('b', 'r'):
+ if (still_dd)
+ out_html("<DD>");
+ else
+ out_html("<BR>\n");
+ curpos = 0;
+ c = c + j;
+ if (c[0] == escapesym) {
+ c = scan_escape(c + 1);
+ }
+ c = skip_till_newline(c);
+ break;
+ case V('c', '2'):
+ c = c + j;
+ if (*c != '\n') {
+ nobreaksym = *c;
+ } else
+ nobreaksym = '\'';
+ c = skip_till_newline(c);
+ break;
+ case V('c', 'c'):
+ c = c + j;
+ if (*c != '\n') {
+ controlsym = *c;
+ } else
+ controlsym = '.';
+ c = skip_till_newline(c);
+ break;
+ case V('c', 'e'):
+ c = c + j;
+ if (*c == '\n') {
+ i = 1;
+ } else {
+ i = 0;
+ while ('0' <= *c && *c <= '9') {
+ i = i * 10 + *c - '0';
+ c++;
+ }
+ }
+ c = skip_till_newline(c);
+ /* center next i lines */
+ if (i > 0) {
+ out_html("<CENTER>\n");
+ while (i && *c) {
+ char *line = NULL;
+
+ c = scan_troff(c, 1, &line);
+ if (line && strncmp(line, "<BR>", 4)) {
+ out_html(line);
+ out_html("<BR>\n");
+ i--;
+ }
+ }
+ out_html("</CENTER>\n");
+ curpos = 0;
+ }
+ break;
+ case V('e', 'c'):
+ c = c + j;
+ if (*c != '\n') {
+ escapesym = *c;
+ } else
+ escapesym = '\\';
+ break;
+ c = skip_till_newline(c);
+ case V('e', 'o'):
+ escapesym = '\0';
+ c = skip_till_newline(c);
+ break;
+ case V('e', 'x'):
+ exit(0);
+ break;
+ case V('f', 'c'):
+ c = c + j;
+ if (*c == '\n') {
+ fieldsym = padsym = '\0';
+ } else {
+ fieldsym = c[0];
+ padsym = c[1];
+ }
+ c = skip_till_newline(c);
+ break;
+ case V('f', 'i'):
+ if (!fillout) {
+ out_html(change_to_font(0));
+ out_html(change_to_size('0'));
+ out_html("</PRE>\n");
+ }
+ curpos = 0;
+ fillout = 1;
+ c = skip_till_newline(c);
+ break;
+ case V('f', 't'):
+ c = c + j;
+ if (*c == '\n') {
+ out_html(change_to_font(0));
+ } else {
+ if (*c == escapesym) {
+ int fn;
+
+ c = scan_expression(c, &fn);
+ c--;
+ out_html(change_to_font(fn));
+ } else {
+ out_html(change_to_font(*c));
+ c++;
+ }
+ }
+ c = skip_till_newline(c);
+ break;
+ case V('e', 'l'):
+ /* .el anything : else part of if else */
+ if (ifelseval) {
+ c = c + j;
+ c[-1] = '\n';
+ c = scan_troff(c, 1, NULL);
+ } else
+ c = skip_till_newline(c + j);
+ break;
+ case V('i', 'e'):
+ /* .ie c anything : then part of if else */
+ case V('i', 'f'):
+ /*
+ * .if c anything .if !c anything .if N anything .if
+ * !N anything .if 'string1'string2' anything .if
+ * !'string1'string2' anything
+ */
+ c = c + j;
+ c = scan_expression(c, &i);
+ ifelseval = !i;
+ if (i) {
+ *c = '\n';
+ c++;
+ c = scan_troff(c, 1, NULL);
+ } else
+ c = skip_till_newline(c);
+ break;
+ case V('i', 'g'):
+ {
+ char *endwith = "..\n";
+
+ i = 3;
+ c = c + j;
+ if (*c != '\n') {
+ endwith = c - 1;
+ i = 1;
+ c[-1] = '.';
+ while (*c && *c != '\n')
+ c++, i++;
+ }
+ c++;
+ while (*c && strncmp(c, endwith, i))
+ while (*c++ != '\n');
+ while (*c++ != '\n');
+ break;
+ }
+ case V('n', 'f'):
+ if (fillout) {
+ out_html(change_to_font(0));
+ out_html(change_to_size('0'));
+ out_html("<PRE>\n");
+ }
+ curpos = 0;
+ fillout = 0;
+ c = skip_till_newline(c);
+ break;
+ case V('p', 's'):
+ c = c + j;
+ if (*c == '\n') {
+ out_html(change_to_size('0'));
+ } else {
+ j = 0;
+ i = 0;
+ if (*c == '-') {
+ j = -1;
+ c++;
+ } else if (*c == '+') {
+ j = 1;
+ c++;
+ }
+ c = scan_expression(c, &i);
+ if (!j) {
+ j = 1;
+ if (i > 5)
+ i = i - 10;
+ }
+ out_html(change_to_size(i * j));
+ }
+ c = skip_till_newline(c);
+ break;
+ case V('s', 'p'):
+ c = c + j;
+ if (fillout)
+ out_html("<P>");
+ else {
+ out_html(NEWLINE);
+ NEWLINE[0] = '\n';
+ }
+ curpos = 0;
+ c = skip_till_newline(c);
+ break;
+ case V('s', 'o'):
+ {
+ FILE *f;
+ struct stat stbuf;
+ int l = 0;
+ char *buf;
+ char *name = NULL;
+
+ curpos = 0;
+ c = c + j;
+ if (*c == '/') {
+ h = c;
+ } else {
+ h = c - 3;
+ h[0] = '.';
+ h[1] = '.';
+ h[2] = '/';
+ }
+ while (*c != '\n')
+ c++;
+ *c = '\0';
+ scan_troff(h, 1, &name);
+ if (name[3] == '/')
+ h = name + 3;
+ else
+ h = name;
+ if (stat(h, &stbuf) != -1)
+ l = stbuf.st_size;
+ buf = stralloc(l + 4);
+#if NOCGI
+ if (!out_length) {
+ char *t, *s;
+
+ t = strrchr(fname, '/');
+ if (!t)
+ t = fname;
+ fprintf(stderr, "ln -s %s.html %s.html\n", h, t);
+ s = strrchr(t, '.');
+ if (!s)
+ s = t;
+ printf("<HTML><HEAD><TITLE> Manpage of %s</TITLE>\n"
+ "</HEAD><BODY>\n"
+ "See the manpage for <A HREF=\"%s.html\">%s</A>.\n"
+ "</BODY></HTML>\n",
+ s, h, h);
+ } else
+#endif
+ {
+ /*
+ * this works alright, except for
+ * section 3
+ */
+ buf = read_man_page(h);
+ if (!buf) {
+
+ fprintf(stderr, "man2html: unable to open or read file %s.\n",
+ h);
+ out_html("<BLOCKQUOTE>"
+ "man2html: unable to open or read file.\n");
+ out_html(h);
+ out_html("</BLOCKQUOTE>\n");
+ } else {
+ buf[0] = buf[l] = '\n';
+ buf[l + 1] = buf[l + 2] = '\0';
+ scan_troff(buf + 1, 0, NULL);
+ }
+ if (buf)
+ free(buf);
+ }
+ *c++ = '\n';
+ break;
+ }
+ case V('t', 'a'):
+ c = c + j;
+ j = 0;
+ while (*c != '\n') {
+ sl = scan_expression(c, &tabstops[j]);
+ if (*c == '-' || *c == '+')
+ tabstops[j] += tabstops[j - 1];
+ c = sl;
+ while (*c == ' ' || *c == '\t')
+ c++;
+ j++;
+ }
+ maxtstop = j;
+ curpos = 0;
+ break;
+ case V('t', 'i'):
+ /*
+ * while (itemdepth || dl_set[itemdepth]) {
+ * out_html("</DL>\n"); if (dl_set[itemdepth])
+ * dl_set[itemdepth]=0; else itemdepth--; }
+ */
+ out_html("<BR>\n");
+ c = c + j;
+ c = scan_expression(c, &j);
+ for (i = 0; i < j; i++)
+ out_html("&nbsp;");
+ curpos = j;
+ c = skip_till_newline(c);
+ break;
+ case V('t', 'm'):
+ c = c + j;
+ h = c;
+ while (*c != '\n')
+ c++;
+ *c = '\0';
+ /* fprintf(stderr,"%s\n", h); */
+ *c = '\n';
+ break;
+ case V('B', ' '):
+ case V('B', '\n'):
+ case V('I', ' '):
+ case V('I', '\n'):
+ /* parse one line in a certain font */
+ out_html(change_to_font(*c));
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ c = scan_troff(c, 1, NULL);
+ out_html(change_to_font('R'));
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('O', 'P'): /* groff manpages use this
+ * construction */
+ /* .OP a b : [ <B>a</B> <I>b</I> ] */
+ mode = 1;
+ c[0] = 'B';
+ c[1] = 'I';
+ out_html(change_to_font('R'));
+ out_html("[");
+ curpos++;
+ case V('B', 'R'):
+ case V('B', 'I'):
+ case V('I', 'B'):
+ case V('I', 'R'):
+ case V('R', 'B'):
+ case V('R', 'I'):
+ {
+ char font[2];
+
+ font[0] = c[0];
+ font[1] = c[1];
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ sl = fill_words(c, wordlist, &words);
+ c = sl + 1;
+ /*
+ * .BR name (section) indicates a link. It
+ * will be added in the output routine.
+ */
+ for (i = 0; i < words; i++) {
+ if (mode) {
+ out_html(" ");
+ curpos++;
+ }
+ wordlist[i][-1] = ' ';
+ out_html(change_to_font(font[i & 1]));
+ scan_troff(wordlist[i], 1, NULL);
+ }
+ out_html(change_to_font('R'));
+ if (mode) {
+ out_html(" ]");
+ curpos++;
+ }
+ out_html(NEWLINE);
+ if (!fillout)
+ curpos = 0;
+ else
+ curpos++;
+ }
+ break;
+ case V('D', 'T'):
+ for (j = 0; j < 20; j++)
+ tabstops[j] = (j + 1) * 8;
+ maxtstop = 20;
+ c = skip_till_newline(c);
+ break;
+ case V('I', 'P'):
+ sl = fill_words(c + j, wordlist, &words);
+ c = sl + 1;
+ if (!dl_set[itemdepth]) {
+ out_html("<DL COMPACT>\n");
+ dl_set[itemdepth] = 1;
+ }
+ out_html("<DT>");
+ if (words) {
+ scan_troff(wordlist[0], 1, NULL);
+ }
+ out_html("<DD>");
+ curpos = 0;
+ break;
+ case V('T', 'P'):
+ if (!dl_set[itemdepth]) {
+ out_html("<DL COMPACT>\n");
+ dl_set[itemdepth] = 1;
+ }
+ out_html("<DT>");
+ c = skip_till_newline(c);
+ /* somewhere a definition ends with '.TP' */
+ if (!*c)
+ still_dd = 1;
+ else {
+ c = scan_troff(c, 1, NULL);
+ out_html("<DD>");
+ }
+ curpos = 0;
+ break;
+ case V('I', 'X'):
+ /* general index */
+ sl = fill_words(c + j, wordlist, &words);
+ c = sl + 1;
+ j = 4;
+ while (idxlabel[j] == 'Z')
+ idxlabel[j--] = 'A';
+ idxlabel[j]++;
+#ifdef MAKEINDEX
+ fprintf(idxfile, "%s@%s@", fname, idxlabel);
+ for (j = 0; j < words; j++) {
+ h = NULL;
+ scan_troff(wordlist[j], 1, &h);
+ fprintf(idxfile, "_\b@%s", h);
+ free(h);
+ }
+ fprintf(idxfile, "\n");
+#endif
+ out_html("<A NAME=\"");
+ out_html(idxlabel);
+ /*
+ * this will not work in mosaic (due to a bug).
+ * Adding '&nbsp;' between '>' and '<' solves it, but
+ * creates some space. A normal space does not work.
+ */
+ out_html("\"></A>");
+ break;
+ case V('L', 'P'):
+ case V('P', 'P'):
+ if (dl_set[itemdepth]) {
+ out_html("</DL>\n");
+ dl_set[itemdepth] = 0;
+ }
+ if (fillout)
+ out_html("<P>\n");
+ else {
+ out_html(NEWLINE);
+ NEWLINE[0] = '\n';
+ }
+ curpos = 0;
+ c = skip_till_newline(c);
+ break;
+ case V('H', 'P'):
+ if (!dl_set[itemdepth]) {
+ out_html("<DL COMPACT>");
+ dl_set[itemdepth] = 1;
+ }
+ out_html("<DT>\n");
+ still_dd = 1;
+ c = skip_till_newline(c);
+ curpos = 0;
+ break;
+ case V('P', 'D'):
+ c = skip_till_newline(c);
+ break;
+ case V('R', 's'): /* BSD mandoc */
+ case V('R', 'S'):
+ sl = fill_words(c + j, wordlist, &words);
+ j = 1;
+ if (words > 0)
+ scan_expression(wordlist[0], &j);
+ if (j >= 0) {
+ itemdepth++;
+ dl_set[itemdepth] = 0;
+ out_html("<DL COMPACT><DT><DD>");
+ c = skip_till_newline(c);
+ curpos = 0;
+ break;
+ }
+ case V('R', 'e'): /* BSD mandoc */
+ case V('R', 'E'):
+ if (itemdepth > 0) {
+ if (dl_set[itemdepth])
+ out_html("</DL>");
+ out_html("</DL>\n");
+ itemdepth--;
+ }
+ c = skip_till_newline(c);
+ curpos = 0;
+ break;
+ case V('S', 'B'):
+ out_html(change_to_size(-1));
+ out_html(change_to_font('B'));
+ c = scan_troff(c + j, 1, NULL);
+ out_html(change_to_font('R'));
+ out_html(change_to_size('0'));
+ break;
+ case V('S', 'M'):
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html(change_to_size(-1));
+ trans_char(c, '"', '\a');
+ c = scan_troff(c, 1, NULL);
+ out_html(change_to_size('0'));
+ break;
+ case V('S', 's'): /* BSD mandoc */
+ mandoc_command = 1;
+ case V('S', 'S'):
+ mode = 1;
+ case V('S', 'h'): /* BSD mandoc */
+ /* hack for fallthru from above */
+ mandoc_command = !mode || mandoc_command;
+ case V('S', 'H'):
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ while (itemdepth || dl_set[itemdepth]) {
+ out_html("</DL>\n");
+ if (dl_set[itemdepth])
+ dl_set[itemdepth] = 0;
+ else if (itemdepth > 0)
+ itemdepth--;
+ }
+ out_html(change_to_font(0));
+ out_html(change_to_size(0));
+ if (!fillout) {
+ fillout = 1;
+ out_html("</PRE>");
+ }
+ trans_char(c, '"', '\a');
+ add_to_index(mode, c);
+ out_html("<A NAME=\"");
+ out_html(label);
+ /* &nbsp; for mosaic users */
+ if (mode)
+ out_html("\">&nbsp;</A>\n<H4>");
+ else
+ out_html("\">&nbsp;</A>\n<H3>");
+ mandoc_synopsis = strncmp(c, "SYNOPSIS", 8) == 0;
+ c = mandoc_command ? scan_troff_mandoc(c, 1, NULL) : scan_troff(c, 1, NULL);
+ if (mode)
+ out_html("</H4>\n");
+ else
+ out_html("</H3>\n");
+ curpos = 0;
+ break;
+ case V('T', 'S'):
+ c = scan_table(c);
+ break;
+ case V('D', 't'): /* BSD mandoc */
+ mandoc_command = 1;
+ case V('T', 'H'):
+ if (!output_possible) {
+ sl = fill_words(c + j, wordlist, &words);
+ if (words > 1) {
+ char *t;
+ for (i = 1; i < words; i++)
+ wordlist[i][-1] = '\0';
+ *sl = '\0';
+ output_possible = 1;
+ sprintf(th_page_and_sec, "%s(%s)", wordlist[0], wordlist[1]);
+ if (words > 2) {
+ t = unescape(wordlist[2]);
+ strncpy(th_datestr, t, sizeof(th_datestr));
+ th_datestr[sizeof(th_datestr) - 1] = '\0';
+ } else
+ th_datestr[0] = '\0';
+ if (words > 3) {
+ t = unescape(wordlist[3]);
+ strncpy(th_version, t, sizeof(th_version));
+ th_version[sizeof(th_version) - 1] = '\0';
+ } else
+ th_version[0] = '\0';
+ out_html("<HTML><HEAD>\n<TITLE>");
+ out_html(th_page_and_sec);
+ out_html(" Manual Page");
+ out_html("</TITLE>\n</HEAD>\n<BODY>");
+
+ outputPageHeader(th_page_and_sec, th_datestr, th_page_and_sec);
+
+ out_html("<BR><A HREF=\"#index\">Index</A>\n");
+ *sl = '\n';
+ out_html("<HR>\n");
+ if (mandoc_command)
+ out_html("<BR>BSD mandoc<BR>");
+ }
+ c = sl + 1;
+ } else
+ c = skip_till_newline(c);
+ curpos = 0;
+ break;
+ case V('T', 'X'):
+ sl = fill_words(c + j, wordlist, &words);
+ *sl = '\0';
+ out_html(change_to_font('I'));
+ if (words > 1)
+ wordlist[1][-1] = '\0';
+ c = lookup_abbrev(wordlist[0]);
+ curpos += strlen(c);
+ out_html(c);
+ out_html(change_to_font('R'));
+ if (words > 1)
+ out_html(wordlist[1]);
+ *sl = '\n';
+ c = sl + 1;
+ break;
+ case V('r', 'm'):
+ /* .rm xx : Remove request, macro or string */
+ case V('r', 'n'):
+ /*
+ * .rn xx yy : Rename request, macro or string xx to
+ * yy
+ */
+ {
+ STRDEF *de;
+
+ c = c + j;
+ i = V(c[0], c[1]);
+ c = c + 2;
+ while (isspace(*c) && *c != '\n')
+ c++;
+ j = V(c[0], c[1]);
+ while (*c && *c != '\n')
+ c++;
+ c++;
+ de = strdef;
+ while (de && de->nr != j)
+ de = de->next;
+ if (de) {
+ if (de->st)
+ free(de->st);
+ de->nr = 0;
+ }
+ de = strdef;
+ while (de && de->nr != i)
+ de = de->next;
+ if (de)
+ de->nr = j;
+ break;
+ }
+ case V('n', 'x'):
+ /* .nx filename : next file. */
+ case V('i', 'n'):
+ /* .in +-N : Indent */
+ c = skip_till_newline(c);
+ break;
+ case V('n', 'r'):
+ /*
+ * .nr R +-N M: define and set number register R by
+ * +-N; auto-increment by M
+ */
+ {
+ INTDEF *intd;
+
+ c = c + j;
+ i = V(c[0], c[1]);
+ c = c + 2;
+ intd = intdef;
+ while (intd && intd->nr != i)
+ intd = intd->next;
+ if (!intd) {
+ intd = (INTDEF *) malloc(sizeof(INTDEF));
+ intd->nr = i;
+ intd->val = 0;
+ intd->incr = 0;
+ intd->next = intdef;
+ intdef = intd;
+ }
+ while (*c == ' ' || *c == '\t')
+ c++;
+ c = scan_expression(c, &intd->val);
+ if (*c != '\n') {
+ while (*c == ' ' || *c == '\t')
+ c++;
+ c = scan_expression(c, &intd->incr);
+ }
+ c = skip_till_newline(c);
+ break;
+ }
+ case V('a', 'm'):
+ /* .am xx yy : append to a macro. */
+ /* define or handle as .ig yy */
+ mode = 1;
+ case V('d', 'e'):
+ /*
+ * .de xx yy : define or redefine macro xx; end at
+ * .yy (..)
+ */
+ /* define or handle as .ig yy */
+ {
+ STRDEF *de;
+ int olen = 0;
+
+ c = c + j;
+ sl = fill_words(c, wordlist, &words);
+ i = V(c[0], c[1]);
+ j = 2;
+ if (words == 1)
+ wordlist[1] = "..";
+ else {
+ wordlist[1]--;
+ wordlist[1][0] = '.';
+ j = 3;
+ }
+ c = sl + 1;
+ sl = c;
+ while (*c && strncmp(c, wordlist[1], j))
+ c = skip_till_newline(c);
+ de = defdef;
+ while (de && de->nr != i)
+ de = de->next;
+ if (mode && de)
+ olen = strlen(de->st);
+ j = olen + c - sl;
+ h = stralloc(j * 2 + 4);
+ if (h) {
+ for (j = 0; j < olen; j++)
+ h[j] = de->st[j];
+ if (!j || h[j - 1] != '\n')
+ h[j++] = '\n';
+ while (sl != c) {
+ if (sl[0] == '\\' && sl[1] == '\\') {
+ h[j++] = '\\';
+ sl++;
+ } else
+ h[j++] = *sl;
+ sl++;
+ }
+ h[j] = '\0';
+ if (de) {
+ if (de->st)
+ free(de->st);
+ de->st = h;
+ } else {
+ de = (STRDEF *) malloc(sizeof(STRDEF));
+ de->nr = i;
+ de->next = defdef;
+ de->st = h;
+ defdef = de;
+ }
+ }
+ }
+ c = skip_till_newline(c);
+ break;
+ case V('B', 'l'): /* BSD mandoc */
+ {
+ char list_options[NULL_TERMINATED(MED_STR_MAX)];
+ char *nl = strchr(c, '\n');
+
+ c = c + j;
+ if (dl_set[itemdepth]) { /* These things can
+ * nest. */
+ itemdepth++;
+ }
+ if (nl) { /* Parse list options */
+ strlimitcpy(list_options, c, nl - c, MED_STR_MAX);
+ }
+ if (strstr(list_options, "-bullet")) { /* HTML Unnumbered List */
+ dl_set[itemdepth] = BL_BULLET_LIST;
+ out_html("<UL>\n");
+ } else if (strstr(list_options, "-enum")) { /* HTML Ordered List */
+ dl_set[itemdepth] = BL_ENUM_LIST;
+ out_html("<OL>\n");
+ } else { /* HTML Descriptive List */
+ dl_set[itemdepth] = BL_DESC_LIST;
+ out_html("<DL COMPACT>\n");
+ }
+ if (fillout)
+ out_html("<P>\n");
+ else {
+ out_html(NEWLINE);
+ NEWLINE[0] = '\n';
+ }
+ curpos = 0;
+ c = skip_till_newline(c);
+ break;
+ }
+ case V('E', 'l'): /* BSD mandoc */
+ c = c + j;
+ if (dl_set[itemdepth] & BL_DESC_LIST) {
+ out_html("</DL>\n");
+ } else if (dl_set[itemdepth] & BL_BULLET_LIST) {
+ out_html("</UL>\n");
+ } else if (dl_set[itemdepth] & BL_ENUM_LIST) {
+ out_html("</OL>\n");
+ }
+ dl_set[itemdepth] = 0;
+ if (itemdepth > 0)
+ itemdepth--;
+ if (fillout)
+ out_html("<P>\n");
+ else {
+ out_html(NEWLINE);
+ NEWLINE[0] = '\n';
+ }
+ curpos = 0;
+ c = skip_till_newline(c);
+ break;
+ case V('I', 't'): /* BSD mandoc */
+ c = c + j;
+ if (strncmp(c, "Xo", 2) == 0 && isspace(*(c + 2))) {
+ c = skip_till_newline(c);
+ }
+ if (dl_set[itemdepth] & BL_DESC_LIST) {
+ out_html("<DT>");
+ out_html(change_to_font('B'));
+ if (*c == '\n') { /* Don't allow embedded
+ * comms after a newline */
+ c++;
+ c = scan_troff(c, 1, NULL);
+ } else { /* Do allow embedded comms on
+ * the same line. */
+ c = scan_troff_mandoc(c, 1, NULL);
+ }
+ out_html(change_to_font('R'));
+ out_html(NEWLINE);
+ out_html("<DD>");
+ } else if (dl_set[itemdepth] & (BL_BULLET_LIST | BL_ENUM_LIST)) {
+ out_html("<LI>");
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(NEWLINE);
+ }
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('B', 'k'): /* BSD mandoc */
+ case V('E', 'k'): /* BSD mandoc */
+ case V('D', 'd'): /* BSD mandoc */
+ case V('O', 's'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('B', 't'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ out_html(" is currently in beta test.");
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('B', 'x'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html("BSD ");
+ c = scan_troff_mandoc(c, 1, NULL);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('D', 'l'): /* BSD mandoc */
+ c = c + j;
+ out_html(NEWLINE);
+ out_html("<BLOCKQUOTE>");
+ out_html(change_to_font('L'));
+ if (*c == '\n')
+ c++;
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(change_to_font('R'));
+ out_html("</BLOCKQUOTE>");
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('B', 'd'): /* BSD mandoc */
+ { /* Seems like a kind of example/literal mode */
+ char bd_options[NULL_TERMINATED(MED_STR_MAX)];
+ char *nl = strchr(c, '\n');
+
+ c = c + j;
+ if (nl) {
+ strlimitcpy(bd_options, c, nl - c, MED_STR_MAX);
+ }
+ out_html(NEWLINE);
+ mandoc_bd_options = 0; /* Remember options for
+ * terminating Bl */
+ if (strstr(bd_options, "-offset indent")) {
+ mandoc_bd_options |= BD_INDENT;
+ out_html("<BLOCKQUOTE>\n");
+ }
+ if (strstr(bd_options, "-literal")
+ || strstr(bd_options, "-unfilled")) {
+ if (fillout) {
+ mandoc_bd_options |= BD_LITERAL;
+ out_html(change_to_font(0));
+ out_html(change_to_size('0'));
+ out_html("<PRE>\n");
+ }
+ curpos = 0;
+ fillout = 0;
+ }
+ c = skip_till_newline(c);
+ break;
+ }
+ case V('E', 'd'): /* BSD mandoc */
+ if (mandoc_bd_options & BD_LITERAL) {
+ if (!fillout) {
+ out_html(change_to_font(0));
+ out_html(change_to_size('0'));
+ out_html("</PRE>\n");
+ }
+ }
+ if (mandoc_bd_options & BD_INDENT)
+ out_html("</BLOCKQUOTE>\n");
+ curpos = 0;
+ fillout = 1;
+ c = skip_till_newline(c);
+ break;
+ case V('B', 'e'): /* BSD mandoc */
+ c = c + j;
+ if (fillout)
+ out_html("<P>");
+ else {
+ out_html(NEWLINE);
+ NEWLINE[0] = '\n';
+ }
+ curpos = 0;
+ c = skip_till_newline(c);
+ break;
+ case V('X', 'r'): /* BSD mandoc */
+ {
+ /*
+ * Translate xyz 1 to xyz(1) Allow for
+ * multiple spaces. Allow the section to be
+ * missing.
+ */
+ char buff[NULL_TERMINATED(MED_STR_MAX)];
+ char *bufptr;
+
+ trans_char(c, '"', '\a');
+ bufptr = buff;
+ c = c + j;
+ if (*c == '\n')
+ c++; /* Skip spaces */
+ while (isspace(*c) && *c != '\n')
+ c++;
+ while (isalnum(*c)) { /* Copy the xyz part */
+ *bufptr = *c;
+ bufptr++;
+ if (bufptr >= buff + MED_STR_MAX)
+ break;
+ c++;
+ }
+ while (isspace(*c) && *c != '\n')
+ c++; /* Skip spaces */
+ if (isdigit(*c)) { /* Convert the number if
+ * there is one */
+ *bufptr = '(';
+ bufptr++;
+ if (bufptr < buff + MED_STR_MAX) {
+ while (isalnum(*c)) {
+ *bufptr = *c;
+ bufptr++;
+ if (bufptr >= buff + MED_STR_MAX)
+ break;
+ c++;
+ }
+ if (bufptr < buff + MED_STR_MAX) {
+ *bufptr = ')';
+ bufptr++;
+ }
+ }
+ }
+ while (*c != '\n') { /* Copy the remainder */
+ if (!isspace(*c)) {
+ *bufptr = *c;
+ bufptr++;
+ if (bufptr >= buff + MED_STR_MAX)
+ break;
+ }
+ c++;
+ }
+ *bufptr = '\n';
+ scan_troff_mandoc(buff, 1, NULL);
+
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ }
+ break;
+ case V('F', 'l'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ out_html("-");
+ if (*c != '\n') {
+ out_html(change_to_font('B'));
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(change_to_font('R'));
+ }
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('P', 'a'): /* BSD mandoc */
+ case V('P', 'f'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('P', 'p'): /* BSD mandoc */
+ if (fillout)
+ out_html("<P>\n");
+ else {
+ out_html(NEWLINE);
+ NEWLINE[0] = '\n';
+ }
+ curpos = 0;
+ c = skip_till_newline(c);
+ break;
+ case V('D', 'q'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html("``");
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html("''");
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('O', 'p'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html(change_to_font('R'));
+ out_html("[");
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(change_to_font('R'));
+ out_html("]");
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('O', 'o'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html(change_to_font('R'));
+ out_html("[");
+ c = scan_troff_mandoc(c, 1, NULL);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('O', 'c'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(change_to_font('R'));
+ out_html("]");
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('P', 'q'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html("(");
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(")");
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('Q', 'l'): /* BSD mandoc */
+ { /* Single quote first word in the line */
+ char *sp;
+
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ sp = c;
+ do { /* Find first whitespace after the
+ * first word that isn't a mandoc
+ * macro */
+ while (*sp && isspace(*sp))
+ sp++;
+ while (*sp && !isspace(*sp))
+ sp++;
+ } while (*sp && isupper(*(sp - 2)) && islower(*(sp - 1)));
+
+ /*
+ * Use a newline to mark the end of text to
+ * be quoted
+ */
+ if (*sp)
+ *sp = '\n';
+ out_html("`"); /* Quote the text */
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html("'");
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ }
+ case V('S', 'q'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html("`");
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html("'");
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('A', 'r'): /* BSD mandoc */
+ /* parse one line in italics */
+ out_html(change_to_font('I'));
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n') { /* An empty Ar means "file
+ * ..." */
+ out_html("file ...");
+ } else {
+ c = scan_troff_mandoc(c, 1, NULL);
+ }
+ out_html(change_to_font('R'));
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('A', 'd'): /* BSD mandoc */
+ case V('E', 'm'): /* BSD mandoc */
+ case V('V', 'a'): /* BSD mandoc */
+ case V('X', 'c'): /* BSD mandoc */
+ /* parse one line in italics */
+ out_html(change_to_font('I'));
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(change_to_font('R'));
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('N', 'd'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html(" - ");
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('N', 'm'): /* BSD mandoc */
+ {
+ static char mandoc_name[NULL_TERMINATED(SMALL_STR_MAX)] = "";
+
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (mandoc_synopsis) { /* Break lines only in
+ * the Synopsis. The
+ * Synopsis section
+ * seems to be treated
+ * as a special case -
+ * Bummer! */
+ static int count = 0; /* Don't break on the
+ * first Nm */
+
+ if (count) {
+ out_html("<BR>");
+ } else {
+ char *end = strchr(c, '\n');
+
+ if (end) { /* Remember the name for
+ * later. */
+ strlimitcpy(mandoc_name, c, end - c, SMALL_STR_MAX);
+ }
+ }
+ count++;
+ }
+ out_html(change_to_font('B'));
+ while (*c == ' ' || *c == '\t')
+ c++;
+ if (*c == '\n') { /* If Nm has no
+ * argument, use one
+ * from an earlier Nm
+ * command that did have
+ * one. Hope there
+ * aren't too many
+ * commands that do
+ * this. */
+ out_html(mandoc_name);
+ } else {
+ c = scan_troff_mandoc(c, 1, NULL);
+ }
+ out_html(change_to_font('R'));
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ }
+ case V('C', 'd'): /* BSD mandoc */
+ case V('C', 'm'): /* BSD mandoc */
+ case V('I', 'c'): /* BSD mandoc */
+ case V('M', 's'): /* BSD mandoc */
+ case V('O', 'r'): /* BSD mandoc */
+ case V('S', 'y'): /* BSD mandoc */
+ /* parse one line in bold */
+ out_html(change_to_font('B'));
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(change_to_font('R'));
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('D', 'v'): /* BSD mandoc */
+ case V('E', 'v'): /* BSD mandoc */
+ case V('F', 'r'): /* BSD mandoc */
+ case V('L', 'i'): /* BSD mandoc */
+ case V('N', 'o'): /* BSD mandoc */
+ case V('N', 's'): /* BSD mandoc */
+ case V('T', 'n'): /* BSD mandoc */
+ case V('n', 'N'): /* BSD mandoc */
+ trans_char(c, '"', '\a');
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ out_html(change_to_font('B'));
+ c = scan_troff_mandoc(c, 1, NULL);
+ out_html(change_to_font('R'));
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('%', 'A'): /* BSD mandoc biblio stuff */
+ case V('%', 'D'):
+ case V('%', 'N'):
+ case V('%', 'O'):
+ case V('%', 'P'):
+ case V('%', 'Q'):
+ case V('%', 'V'):
+ c = c + j;
+ if (*c == '\n')
+ c++;
+ c = scan_troff(c, 1, NULL); /* Don't allow embedded
+ * mandoc coms */
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ case V('%', 'B'):
+ case V('%', 'J'):
+ case V('%', 'R'):
+ case V('%', 'T'):
+ c = c + j;
+ out_html(change_to_font('I'));
+ if (*c == '\n')
+ c++;
+ c = scan_troff(c, 1, NULL); /* Don't allow embedded
+ * mandoc coms */
+ out_html(change_to_font('R'));
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ break;
+ default:
+ /* search macro database of self-defined macros */
+ owndef = defdef;
+ while (owndef && owndef->nr != i)
+ owndef = owndef->next;
+ if (owndef) {
+ char **oldargument;
+ int deflen;
+ int onff;
+
+ sl = fill_words(c + j, wordlist, &words);
+ c = sl + 1;
+ *sl = '\0';
+ for (i = 1; i < words; i++)
+ wordlist[i][-1] = '\0';
+ for (i = 0; i < words; i++) {
+ char *h = NULL;
+
+ if (mandoc_command) {
+ scan_troff_mandoc(wordlist[i], 1, &h);
+ } else {
+ scan_troff(wordlist[i], 1, &h);
+ }
+ wordlist[i] = h;
+ }
+ for (i = words; i < 20; i++)
+ wordlist[i] = NULL;
+ deflen = strlen(owndef->st);
+ for (i = 0; owndef->st[deflen + 2 + i] = owndef->st[i]; i++);
+ oldargument = argument;
+ argument = wordlist;
+ onff = newline_for_fun;
+ if (mandoc_command) {
+ scan_troff_mandoc(owndef->st + deflen + 2, 0, NULL);
+ } else {
+ scan_troff(owndef->st + deflen + 2, 0, NULL);
+ }
+ newline_for_fun = onff;
+ argument = oldargument;
+ for (i = 0; i < words; i++)
+ if (wordlist[i])
+ free(wordlist[i]);
+ *sl = '\n';
+ } else if (mandoc_command &&
+ ((isupper(*c) && islower(*(c + 1)))
+ || (islower(*c) && isupper(*(c + 1))))
+ ) { /* Let through any BSD mandoc
+ * commands that haven't been delt
+ * with. I don't want to miss
+ * anything out of the text. */
+ char buf[4];
+
+ strncpy(buf, c, 2);
+ buf[2] = ' ';
+ buf[3] = '\0';
+ out_html(buf); /* Print the command (it
+ * might just be text). */
+ c = c + j;
+ trans_char(c, '"', '\a');
+ if (*c == '\n')
+ c++;
+ out_html(change_to_font('R'));
+ c = scan_troff(c, 1, NULL);
+ out_html(NEWLINE);
+ if (fillout)
+ curpos++;
+ else
+ curpos = 0;
+ } else {
+ c = skip_till_newline(c);
+ }
+ break;
+ }
+ }
+ if (fillout) {
+ out_html(NEWLINE);
+ curpos++;
+ }
+ NEWLINE[0] = '\n';
+ return c;
+}
+
+static void
+flush(void)
+{
+}
+
+static int contained_tab = 0;
+static int mandoc_line = 0; /* Signals whether to look for embedded
+ * mandoc commands. */
+
+/* san : stop at newline */
+static char *
+scan_troff(char *c, int san, char **result)
+{
+ char *h;
+ char intbuff[NULL_TERMINATED(MED_STR_MAX)];
+ int ibp = 0;
+ int i;
+ char *exbuffer;
+ int exbuffpos, exbuffmax, exscaninbuff, exnewline_for_fun;
+ int usenbsp = 0;
+
+#define FLUSHIBP if (ibp) { intbuff[ibp]=0; out_html(intbuff); ibp=0; }
+
+ exbuffer = buffer;
+ exbuffpos = buffpos;
+ exbuffmax = buffmax;
+ exnewline_for_fun = newline_for_fun;
+ exscaninbuff = scaninbuff;
+ newline_for_fun = 0;
+ if (result) {
+ if (*result) {
+ buffer = *result;
+ buffpos = strlen(buffer);
+ buffmax = buffpos;
+ } else {
+ buffer = stralloc(LARGE_STR_MAX);
+ buffpos = 0;
+ buffmax = LARGE_STR_MAX;
+ }
+ scaninbuff = 1;
+ }
+ h = c;
+ /* start scanning */
+
+ while (*h && (!san || newline_for_fun || *h != '\n')) {
+
+ if (*h == escapesym) {
+ h++;
+ FLUSHIBP;
+ h = scan_escape(h);
+ } else if (*h == controlsym && h[-1] == '\n') {
+ h++;
+ FLUSHIBP;
+ h = scan_request(h);
+ if (san && h[-1] == '\n')
+ h--;
+ } else if (mandoc_line
+ && *(h) && isupper(*(h))
+ && *(h + 1) && islower(*(h + 1))
+ && *(h + 2) && isspace(*(h + 2))) {
+ /*
+ * BSD imbedded command eg ".It Fl Ar arg1 Fl Ar
+ * arg2"
+ */
+ FLUSHIBP;
+ h = scan_request(h);
+ if (san && h[-1] == '\n')
+ h--;
+ } else if (*h == nobreaksym && h[-1] == '\n') {
+ h++;
+ FLUSHIBP;
+ h = scan_request(h);
+ if (san && h[-1] == '\n')
+ h--;
+ } else {
+ int mx;
+
+ if (h[-1] == '\n' && still_dd && isalnum(*h)) {
+ /*
+ * sometimes a .HP request is not followed by
+ * a .br request
+ */
+ FLUSHIBP;
+ out_html("<DD>");
+ curpos = 0;
+ still_dd = 0;
+ }
+ switch (*h) {
+ case '&':
+ intbuff[ibp++] = '&';
+ intbuff[ibp++] = 'a';
+ intbuff[ibp++] = 'm';
+ intbuff[ibp++] = 'p';
+ intbuff[ibp++] = ';';
+ curpos++;
+ break;
+ case '<':
+ intbuff[ibp++] = '&';
+ intbuff[ibp++] = 'l';
+ intbuff[ibp++] = 't';
+ intbuff[ibp++] = ';';
+ curpos++;
+ break;
+ case '>':
+ intbuff[ibp++] = '&';
+ intbuff[ibp++] = 'g';
+ intbuff[ibp++] = 't';
+ intbuff[ibp++] = ';';
+ curpos++;
+ break;
+ case '"':
+ intbuff[ibp++] = '&';
+ intbuff[ibp++] = 'q';
+ intbuff[ibp++] = 'u';
+ intbuff[ibp++] = 'o';
+ intbuff[ibp++] = 't';
+ intbuff[ibp++] = ';';
+ curpos++;
+ break;
+ case '\n':
+ if (h[-1] == '\n' && fillout) {
+ intbuff[ibp++] = '<';
+ intbuff[ibp++] = 'P';
+ intbuff[ibp++] = '>';
+ }
+ if (contained_tab && fillout) {
+ intbuff[ibp++] = '<';
+ intbuff[ibp++] = 'B';
+ intbuff[ibp++] = 'R';
+ intbuff[ibp++] = '>';
+ }
+ contained_tab = 0;
+ curpos = 0;
+ usenbsp = 0;
+ intbuff[ibp++] = '\n';
+ break;
+ case '\t':
+ {
+ int curtab = 0;
+
+ contained_tab = 1;
+ FLUSHIBP;
+ /* like a typewriter, not like TeX */
+ tabstops[19] = curpos + 1;
+ while (curtab < maxtstop && tabstops[curtab] <= curpos)
+ curtab++;
+ if (curtab < maxtstop) {
+ if (!fillout) {
+ while (curpos < tabstops[curtab]) {
+ intbuff[ibp++] = ' ';
+ if (ibp > 480) {
+ FLUSHIBP;
+ }
+ curpos++;
+ }
+ } else {
+ out_html("<TT>");
+ while (curpos < tabstops[curtab]) {
+ out_html("&nbsp;");
+ curpos++;
+ }
+ out_html("</TT>");
+ }
+ }
+ }
+ break;
+ default:
+ if (*h == ' ' && (h[-1] == '\n' || usenbsp)) {
+ FLUSHIBP;
+ if (!usenbsp && fillout) {
+ out_html("<BR>");
+ curpos = 0;
+ }
+ usenbsp = fillout;
+ if (usenbsp)
+ out_html("&nbsp;");
+ else
+ intbuff[ibp++] = ' ';
+ } else if (*h > 31 && *h < 127)
+ intbuff[ibp++] = *h;
+ else if (((unsigned char) (*h)) > 127) {
+ intbuff[ibp++] = '&';
+ intbuff[ibp++] = '#';
+ intbuff[ibp++] = '0' + ((unsigned char) (*h)) / 100;
+ intbuff[ibp++] = '0' + (((unsigned char) (*h)) % 100) / 10;
+ intbuff[ibp++] = '0' + ((unsigned char) (*h)) % 10;
+ intbuff[ibp++] = ';';
+ }
+ curpos++;
+ break;
+ }
+ if (ibp > (MED_STR_MAX - 20))
+ FLUSHIBP;
+ h++;
+ }
+ }
+ FLUSHIBP;
+ if (buffer)
+ buffer[buffpos] = '\0';
+ if (san && *h)
+ h++;
+ newline_for_fun = exnewline_for_fun;
+ if (result) {
+ *result = buffer;
+ buffer = exbuffer;
+ buffpos = exbuffpos;
+ buffmax = exbuffmax;
+ scaninbuff = exscaninbuff;
+ }
+ return h;
+}
+
+
+static char *
+scan_troff_mandoc(char *c, int san, char **result)
+{
+ char *ret, *end = c;
+ int oldval = mandoc_line;
+
+ mandoc_line = 1;
+ while (*end && *end != '\n') {
+ end++;
+ }
+
+ if (end > c + 2
+ && ispunct(*(end - 1))
+ && isspace(*(end - 2)) && *(end - 2) != '\n') {
+ /*
+ * Don't format lonely punctuation E.g. in "xyz ," format the
+ * xyz and then append the comma removing the space.
+ */
+ *(end - 2) = '\n';
+ ret = scan_troff(c, san, result);
+ *(end - 2) = *(end - 1);
+ *(end - 1) = ' ';
+ } else {
+ ret = scan_troff(c, san, result);
+ }
+ mandoc_line = oldval;
+ return ret;
+}
+
+main(int argc, char **argv)
+{
+ FILE *f;
+ char *t;
+ int l, i;
+ char *buf;
+ char *h, *fullname;
+ STRDEF *stdf;
+
+ t = NULL;
+ while ((i = getopt(argc, argv, "")) != EOF) {
+ switch (i) {
+ default:
+ usage();
+ exit(EXIT_USAGE);
+ }
+ }
+
+ if (argc != 2) {
+ usage();
+ exit(EXIT_USAGE);
+ }
+ manpage = h = t = argv[1];
+ i = 0;
+
+ buf = read_man_page(h);
+ if (!buf) {
+ fprintf(stderr, "man2html: cannot read %s: %s\n", h, strerror(errno));
+ exit(1);
+ }
+#ifdef MAKEINDEX
+ idxfile = fopen(INDEXFILE, "a");
+#endif
+ stdf = &standardchar[0];
+ i = 0;
+ while (stdf->nr) {
+ stdf->next = &standardchar[i];
+ stdf = stdf->next;
+ i++;
+ }
+ chardef = &standardchar[0];
+
+ stdf = &standardstring[0];
+ i = 0;
+ while (stdf->nr) {
+ stdf->next = &standardstring[i];
+ stdf = stdf->next;
+ i++;
+ }
+ strdef = &standardstring[0];
+
+ intdef = &standardint[0];
+ i = 0;
+ while (intdef->nr) {
+ intdef->next = &standardint[i];
+ intdef = intdef->next;
+ i++;
+ }
+ intdef = &standardint[0];
+
+ defdef = NULL;
+
+ scan_troff(buf + 1, 0, NULL);
+
+ while (itemdepth || dl_set[itemdepth]) {
+ out_html("</DL>\n");
+ if (dl_set[itemdepth])
+ dl_set[itemdepth] = 0;
+ else if (itemdepth > 0)
+ itemdepth--;
+ }
+
+ out_html(change_to_font(0));
+ out_html(change_to_size(0));
+ if (!fillout) {
+ fillout = 1;
+ out_html("</PRE>");
+ }
+ out_html(NEWLINE);
+
+ if (output_possible) {
+ outputPageFooter(th_version, th_datestr, th_page_and_sec);
+ /* &nbsp; for mosaic users */
+ fputs("<HR>\n<A NAME=\"index\">&nbsp;</A><H2>Index</H2>\n<DL>\n", stdout);
+ manidx[mip] = 0;
+ fputs(manidx, stdout);
+ if (subs)
+ fputs("</DL>\n", stdout);
+ fputs("</DL>\n", stdout);
+ print_sig();
+ fputs("</BODY>\n</HTML>\n", stdout);
+ } else
+ fprintf(stderr, "man2html: no output produced\n");
+#ifdef MAKEINDEX
+ if (idxfile)
+ fclose(idxfile);
+#endif
+ exit(EXIT_SUCCESS);
+}
diff --git a/support/missing b/support/missing
new file mode 100755
index 0000000..cbe2b0e
--- /dev/null
+++ b/support/missing
@@ -0,0 +1,188 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing - GNU libit 0.0"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acinclude.m4' or \`configure.in'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`configure.in'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acconfig.h' or \`configure.in'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in`
+ if test -z "$files"; then
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in`
+ test -z "$files" || files="$files.in"
+ else
+ files=`echo "$files" | sed -e 's/:/ /g'`
+ fi
+ test -z "$files" && files="config.h.in"
+ touch $files
+ ;;
+
+ automake)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print \
+ | sed 's/^\(.*\).am$/touch \1.in/' \
+ | sh
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/support/mkclone b/support/mkclone
new file mode 100755
index 0000000..10b08c0
--- /dev/null
+++ b/support/mkclone
@@ -0,0 +1,123 @@
+#! /bin/bash
+#
+# mkclone - symlink every file appearing in $src/MANIFEST to a corresponding
+# file in the target directory ($1). Directories specified in
+# MANIFEST are created in the target directory
+#
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+#
+prog=`basename $0`
+
+SRCDIR=src
+
+USAGE="usage: $prog [-m manifest] [-s srcdir] [-v] [-d] [-h] target"
+while getopts dhm:s:v opt
+do
+ case "$opt" in
+ m) MANIFEST=$OPTARG ;;
+ s) SRCDIR=$OPTARG ;;
+ v) verbose=y ;;
+ d) ECHO=echo debug=y ;;
+ h) hardlinks=y ;;
+ ?) echo $USAGE >&2
+ exit 2;;
+ esac
+done
+
+: ${MANIFEST:=${SRCDIR}/MANIFEST}
+
+[ -n "$debug" ] && verbose=
+
+shift $(( $OPTIND - 1 ))
+
+if [ $# -lt 1 ]; then
+ echo $USAGE >&2
+ exit 2
+fi
+
+if [ ! -f $MANIFEST ]; then
+ echo "$prog: $MANIFEST: no such file or directory" >&2
+ echo "$prog: must be run with valid -s argument or from source directory" >&2
+ exit 1
+fi
+
+rm_ltmp=false
+LINKTEMP=`mktemp -t linktmp.XXXXXXXX 2>/dev/null`
+if [ -z "$LINKTEMP" ]; then
+ : ${TMPDIR:=/tmp}
+ LINKTEMP=${TMPDIR}/linktmp.$$
+ rm_ltmp=true
+fi
+
+$rm_ltmp && rm -f ${LINKTEMP}
+# if the user specified hard links, then do that. otherwise, try to use
+# symlinks if they're present
+if [ -n "$hardlinks" ]; then
+ LN=ln
+elif (ln -s /dev/null ${LINKTEMP}) >/dev/null 2>&1; then
+ LN="ln -s"
+else
+ LN=ln
+fi
+rm -f ${LINKTEMP}
+
+TARGET=$1
+
+if [ ! -d "$TARGET" ]; then
+ mkdir "$TARGET"
+fi
+
+echo "${prog}: creating clone of bash source tree (from $SRCDIR) in $TARGET"
+
+cd "$TARGET" || { echo "${prog}: cannot cd to $TARGET" >&2 ; exit 1; }
+
+while read fname type mode
+do
+ [ -z "$fname" ] && continue
+
+ case "$fname" in
+ \#*) continue ;;
+ esac
+
+ case "$type" in
+ d) [ -n "$verbose" ] && echo mkdir $fname
+ $ECHO mkdir $fname ;; # already in $TARGET
+ f) fn=${fname##*/}
+ case "$fname" in
+ */*) dn=${fname%/*} ;;
+ *) dn=. ;;
+ esac
+ if [ -n "$verbose" ] || [ -n "$debug" ]; then
+ echo "( cd $dn && $LN $SRCDIR/$fname $fn )"
+ fi
+ [ -z "$debug" ] && ( cd $dn && $LN $SRCDIR/$fname $fn )
+ ;;
+ *) echo "${prog}: ${fname}: unknown file type $type" 1>&2 ;;
+ esac
+done < $MANIFEST
+
+# special
+SPECIAL="parser-built y.tab.c y.tab.h"
+
+rm -f $SPECIAL
+for sf in $SPECIAL
+do
+ [ -n "$verbose" ] && echo cp -p $SRCDIR/$sf $TARGET
+ $ECHO cp -p $SRCDIR/$sf $TARGET
+done
+
+exit 0
diff --git a/support/mkconffiles b/support/mkconffiles
new file mode 100755
index 0000000..ec52614
--- /dev/null
+++ b/support/mkconffiles
@@ -0,0 +1,80 @@
+#! /bin/sh
+#
+# mkconffiles - create _distribution and _patchlevel files in preparation
+# for recreating `configure' from `configure.in'
+#
+# options:
+# -s srcdir directory where `configure' resides (defaults to `.')
+# -d outdir directory where the files should be written (defaults
+# to "$srcdir")
+# -v verbose
+# -n nocreate - don't create the output files
+#
+# Chet Ramey
+# chet@po.cwru.edu
+
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+PROG=`basename $0`
+
+# defaults
+srcdir=.
+
+distname="_distribution"
+patchname="_patchlevel"
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -s) shift; srcdir="$1"; shift;;
+ -d) shift; outdir="$1"; shift;;
+ -v) shift; verbose=yes ;;
+ -n) shift; nocreate=yes;;
+ --) shift; break;;
+ *) echo "${PROG}: usage: ${PROG} [-s srcdir] [-d outdir] [-nv]" >&2; exit 2;;
+ esac
+done
+
+if [ ! -f ${srcdir}/configure ]; then
+ echo "${PROG}: ${srcdir}/configure not found" >&2
+ exit 1
+fi
+
+# default output directory to source directory
+if [ -z "$outdir" ]; then
+ outdir=${srcdir}
+fi
+
+DISTRIB=`grep '^BASHVERS' ${srcdir}/configure | sed 's:.*=::'`
+PATCH=`grep '^BASHPATCH' ${srcdir}/configure | sed 's:.*=::'`
+
+if [ -n "$verbose" ]; then
+ echo "${PROG}: creating new distribution files for bash-${DISTRIB}.${PATCH} in ${outdir}"
+fi
+
+distout=${outdir}/${distname}
+patchout=${outdir}/${patchname}
+
+if [ -z "$nocreate" ]; then
+ echo "$DISTRIB" > $distout
+ echo "$PATCH" > $patchout
+fi
+
+if [ -n "$verbose" ]; then
+ echo "${PROG}: created $distout and $patchout"
+fi
+
+exit 0
diff --git a/support/mkdirs b/support/mkdirs
new file mode 100755
index 0000000..ce4fb23
--- /dev/null
+++ b/support/mkdirs
@@ -0,0 +1,48 @@
+#! /bin/sh
+#
+# mkdirs - a work-alike for `mkdir -p'
+#
+# Chet Ramey
+# chet@po.cwru.edu
+
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+for dir
+do
+
+ test -d "$dir" && continue
+
+ tomake=$dir
+ while test -n "$dir" ; do
+ # dir=${dir%/*}
+ # dir=`expr "$dir" ':' '\(/.*\)/[^/]*'`
+ if dir=`expr "$dir" ':' '\(.*\)/[^/]*'`; then
+ tomake="$dir $tomake"
+ else
+ dir=
+ fi
+ done
+
+ for d in $tomake
+ do
+ test -d "$d" && continue
+ echo mkdir "$d"
+ mkdir "$d"
+ done
+done
+
+exit 0
diff --git a/support/mkinstalldirs b/support/mkinstalldirs
new file mode 100755
index 0000000..d2d5f21
--- /dev/null
+++ b/support/mkinstalldirs
@@ -0,0 +1,111 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+ case $1 in
+ -h | --help | --h*) # -h for help
+ echo "$usage" 1>&2
+ exit 0
+ ;;
+ -m) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ dirmode=$1
+ shift
+ ;;
+ --) # stop option processing
+ shift
+ break
+ ;;
+ -*) # unknown option
+ echo "$usage" 1>&2
+ exit 1
+ ;;
+ *) # first non-opt arg
+ break
+ ;;
+ esac
+done
+
+for file
+do
+ if test -d "$file"; then
+ shift
+ else
+ break
+ fi
+done
+
+case $# in
+ 0) exit 0 ;;
+esac
+
+case $dirmode in
+ '')
+ if mkdir -p -- . 2>/dev/null; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ fi
+ ;;
+ *)
+ if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ fi
+ ;;
+esac
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case $pathcomp in
+ -*) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+ lasterr=""
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
+ fi
+ fi
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# End:
+# mkinstalldirs ends here
diff --git a/support/mksignames.c b/support/mksignames.c
new file mode 100644
index 0000000..e6a1518
--- /dev/null
+++ b/support/mksignames.c
@@ -0,0 +1,446 @@
+/* signames.c -- Create and write `signames.h', which contains an array of
+ signal names. */
+
+/* Copyright (C) 1992-2003 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Bash; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <signal.h>
+#if defined (HAVE_STDLIB_H)
+# include <stdlib.h>
+#else
+# include "ansi_stdlib.h"
+#endif /* HAVE_STDLIB_H */
+
+#if !defined (NSIG)
+# define NSIG 64
+#endif
+
+/*
+ * Special traps:
+ * EXIT == 0
+ * DEBUG == NSIG
+ * ERR == NSIG+1
+ * RETURN == NSIG+2
+ */
+#define LASTSIG NSIG+2
+
+char *signal_names[2 * (LASTSIG)];
+
+#define signal_names_size (sizeof(signal_names)/sizeof(signal_names[0]))
+
+char *progname;
+
+/* AIX 4.3 defines SIGRTMIN and SIGRTMAX as 888 and 999 respectively.
+ I don't want to allocate so much unused space for the intervening signal
+ numbers, so we just punt if SIGRTMAX is past the bounds of the
+ signal_names array (handled in configure). */
+#if defined (SIGRTMAX) && defined (UNUSABLE_RT_SIGNALS)
+# undef SIGRTMAX
+# undef SIGRTMIN
+#endif
+
+#if defined (SIGRTMAX) || defined (SIGRTMIN)
+# define RTLEN 14
+# define RTLIM 256
+#endif
+
+void
+initialize_signames ()
+{
+ register int i;
+#if defined (SIGRTMAX) || defined (SIGRTMIN)
+ int rtmin, rtmax, rtcnt;
+#endif
+
+ for (i = 1; i < signal_names_size; i++)
+ signal_names[i] = (char *)NULL;
+
+ /* `signal' 0 is what we do on exit. */
+ signal_names[0] = "EXIT";
+
+ /* Place signal names which can be aliases for more common signal
+ names first. This allows (for example) SIGABRT to overwrite SIGLOST. */
+
+ /* POSIX 1003.1b-1993 real time signals, but take care of incomplete
+ implementations. Acoording to the standard, both, SIGRTMIN and
+ SIGRTMAX must be defined, SIGRTMIN must be stricly less than
+ SIGRTMAX, and the difference must be at least 7, that is, there
+ must be at least eight distinct real time signals. */
+
+ /* The generated signal names are SIGRTMIN, SIGRTMIN+1, ...,
+ SIGRTMIN+x, SIGRTMAX-x, ..., SIGRTMAX-1, SIGRTMAX. If the number
+ of RT signals is odd, there is an extra SIGRTMIN+(x+1).
+ These names are the ones used by ksh and /usr/xpg4/bin/sh on SunOS5. */
+
+#if defined (SIGRTMIN)
+ rtmin = SIGRTMIN;
+ signal_names[rtmin] = "SIGRTMIN";
+#endif
+
+#if defined (SIGRTMAX)
+ rtmax = SIGRTMAX;
+ signal_names[rtmax] = "SIGRTMAX";
+#endif
+
+#if defined (SIGRTMAX) && defined (SIGRTMIN)
+ if (rtmax > rtmin)
+ {
+ rtcnt = (rtmax - rtmin - 1) / 2;
+ /* croak if there are too many RT signals */
+ if (rtcnt >= RTLIM/2)
+ {
+ rtcnt = RTLIM/2-1;
+ fprintf(stderr, "%s: error: more than %i real time signals, fix `%s'\n",
+ progname, RTLIM, progname);
+ }
+
+ for (i = 1; i <= rtcnt; i++)
+ {
+ signal_names[rtmin+i] = (char *)malloc(RTLEN);
+ if (signal_names[rtmin+i])
+ sprintf (signal_names[rtmin+i], "SIGRTMIN+%d", i);
+ signal_names[rtmax-i] = (char *)malloc(RTLEN);
+ if (signal_names[rtmax-i])
+ sprintf (signal_names[rtmax-i], "SIGRTMAX-%d", i);
+ }
+
+ if (rtcnt < RTLIM/2-1 && rtcnt != (rtmax-rtmin)/2)
+ {
+ /* Need an extra RTMIN signal */
+ signal_names[rtmin+rtcnt+1] = (char *)malloc(RTLEN);
+ if (signal_names[rtmin+rtcnt+1])
+ sprintf (signal_names[rtmin+rtcnt+1], "SIGRTMIN+%d", rtcnt+1);
+ }
+ }
+#endif /* SIGRTMIN && SIGRTMAX */
+
+#if defined (SIGLOST) /* resource lost (eg, record-lock lost) */
+ signal_names[SIGLOST] = "SIGLOST";
+#endif
+
+/* AIX */
+#if defined (SIGMSG) /* HFT input data pending */
+ signal_names[SIGMSG] = "SIGMSG";
+#endif
+
+#if defined (SIGDANGER) /* system crash imminent */
+ signal_names[SIGDANGER] = "SIGDANGER";
+#endif
+
+#if defined (SIGMIGRATE) /* migrate process to another CPU */
+ signal_names[SIGMIGRATE] = "SIGMIGRATE";
+#endif
+
+#if defined (SIGPRE) /* programming error */
+ signal_names[SIGPRE] = "SIGPRE";
+#endif
+
+#if defined (SIGVIRT) /* AIX virtual time alarm */
+ signal_names[SIGVIRT] = "SIGVIRT";
+#endif
+
+#if defined (SIGALRM1) /* m:n condition variables */
+ signal_names[SIGALRM1] = "SIGALRM1";
+#endif
+
+#if defined (SIGWAITING) /* m:n scheduling */
+ signal_names[SIGWAITING] = "SIGWAITING";
+#endif
+
+#if defined (SIGGRANT) /* HFT monitor mode granted */
+ signal_names[SIGGRANT] = "SIGGRANT";
+#endif
+
+#if defined (SIGKAP) /* keep alive poll from native keyboard */
+ signal_names[SIGKAP] = "SIGKAP";
+#endif
+
+#if defined (SIGRETRACT) /* HFT monitor mode retracted */
+ signal_names[SIGRETRACT] = "SIGRETRACT";
+#endif
+
+#if defined (SIGSOUND) /* HFT sound sequence has completed */
+ signal_names[SIGSOUND] = "SIGSOUND";
+#endif
+
+#if defined (SIGSAK) /* Secure Attention Key */
+ signal_names[SIGSAK] = "SIGSAK";
+#endif
+
+/* SunOS5 */
+#if defined (SIGLWP) /* special signal used by thread library */
+ signal_names[SIGLWP] = "SIGLWP";
+#endif
+
+#if defined (SIGFREEZE) /* special signal used by CPR */
+ signal_names[SIGFREEZE] = "SIGFREEZE";
+#endif
+
+#if defined (SIGTHAW) /* special signal used by CPR */
+ signal_names[SIGTHAW] = "SIGTHAW";
+#endif
+
+#if defined (SIGCANCEL) /* thread cancellation signal used by libthread */
+ signal_names[SIGCANCEL] = "SIGCANCEL";
+#endif
+
+#if defined (SIGXRES) /* resource control exceeded */
+ signal_names[SIGXRES] = "SIGXRES";
+#endif
+
+/* HP-UX */
+#if defined (SIGDIL) /* DIL signal (?) */
+ signal_names[SIGDIL] = "SIGDIL";
+#endif
+
+/* System V */
+#if defined (SIGCLD) /* Like SIGCHLD. */
+ signal_names[SIGCLD] = "SIGCLD";
+#endif
+
+#if defined (SIGPWR) /* power state indication */
+ signal_names[SIGPWR] = "SIGPWR";
+#endif
+
+#if defined (SIGPOLL) /* Pollable event (for streams) */
+ signal_names[SIGPOLL] = "SIGPOLL";
+#endif
+
+/* Unknown */
+#if defined (SIGWINDOW)
+ signal_names[SIGWINDOW] = "SIGWINDOW";
+#endif
+
+/* Linux */
+#if defined (SIGSTKFLT)
+ signal_names[SIGSTKFLT] = "SIGSTKFLT";
+#endif
+
+/* FreeBSD */
+#if defined (SIGTHR) /* thread interrupt */
+ signal_names[SIGTHR] = "SIGTHR";
+#endif
+
+/* Common */
+#if defined (SIGHUP) /* hangup */
+ signal_names[SIGHUP] = "SIGHUP";
+#endif
+
+#if defined (SIGINT) /* interrupt */
+ signal_names[SIGINT] = "SIGINT";
+#endif
+
+#if defined (SIGQUIT) /* quit */
+ signal_names[SIGQUIT] = "SIGQUIT";
+#endif
+
+#if defined (SIGILL) /* illegal instruction (not reset when caught) */
+ signal_names[SIGILL] = "SIGILL";
+#endif
+
+#if defined (SIGTRAP) /* trace trap (not reset when caught) */
+ signal_names[SIGTRAP] = "SIGTRAP";
+#endif
+
+#if defined (SIGIOT) /* IOT instruction */
+ signal_names[SIGIOT] = "SIGIOT";
+#endif
+
+#if defined (SIGABRT) /* Cause current process to dump core. */
+ signal_names[SIGABRT] = "SIGABRT";
+#endif
+
+#if defined (SIGEMT) /* EMT instruction */
+ signal_names[SIGEMT] = "SIGEMT";
+#endif
+
+#if defined (SIGFPE) /* floating point exception */
+ signal_names[SIGFPE] = "SIGFPE";
+#endif
+
+#if defined (SIGKILL) /* kill (cannot be caught or ignored) */
+ signal_names[SIGKILL] = "SIGKILL";
+#endif
+
+#if defined (SIGBUS) /* bus error */
+ signal_names[SIGBUS] = "SIGBUS";
+#endif
+
+#if defined (SIGSEGV) /* segmentation violation */
+ signal_names[SIGSEGV] = "SIGSEGV";
+#endif
+
+#if defined (SIGSYS) /* bad argument to system call */
+ signal_names[SIGSYS] = "SIGSYS";
+#endif
+
+#if defined (SIGPIPE) /* write on a pipe with no one to read it */
+ signal_names[SIGPIPE] = "SIGPIPE";
+#endif
+
+#if defined (SIGALRM) /* alarm clock */
+ signal_names[SIGALRM] = "SIGALRM";
+#endif
+
+#if defined (SIGTERM) /* software termination signal from kill */
+ signal_names[SIGTERM] = "SIGTERM";
+#endif
+
+#if defined (SIGURG) /* urgent condition on IO channel */
+ signal_names[SIGURG] = "SIGURG";
+#endif
+
+#if defined (SIGSTOP) /* sendable stop signal not from tty */
+ signal_names[SIGSTOP] = "SIGSTOP";
+#endif
+
+#if defined (SIGTSTP) /* stop signal from tty */
+ signal_names[SIGTSTP] = "SIGTSTP";
+#endif
+
+#if defined (SIGCONT) /* continue a stopped process */
+ signal_names[SIGCONT] = "SIGCONT";
+#endif
+
+#if defined (SIGCHLD) /* to parent on child stop or exit */
+ signal_names[SIGCHLD] = "SIGCHLD";
+#endif
+
+#if defined (SIGTTIN) /* to readers pgrp upon background tty read */
+ signal_names[SIGTTIN] = "SIGTTIN";
+#endif
+
+#if defined (SIGTTOU) /* like TTIN for output if (tp->t_local&LTOSTOP) */
+ signal_names[SIGTTOU] = "SIGTTOU";
+#endif
+
+#if defined (SIGIO) /* input/output possible signal */
+ signal_names[SIGIO] = "SIGIO";
+#endif
+
+#if defined (SIGXCPU) /* exceeded CPU time limit */
+ signal_names[SIGXCPU] = "SIGXCPU";
+#endif
+
+#if defined (SIGXFSZ) /* exceeded file size limit */
+ signal_names[SIGXFSZ] = "SIGXFSZ";
+#endif
+
+#if defined (SIGVTALRM) /* virtual time alarm */
+ signal_names[SIGVTALRM] = "SIGVTALRM";
+#endif
+
+#if defined (SIGPROF) /* profiling time alarm */
+ signal_names[SIGPROF] = "SIGPROF";
+#endif
+
+#if defined (SIGWINCH) /* window changed */
+ signal_names[SIGWINCH] = "SIGWINCH";
+#endif
+
+/* 4.4 BSD */
+#if defined (SIGINFO) && !defined (_SEQUENT_) /* information request */
+ signal_names[SIGINFO] = "SIGINFO";
+#endif
+
+#if defined (SIGUSR1) /* user defined signal 1 */
+ signal_names[SIGUSR1] = "SIGUSR1";
+#endif
+
+#if defined (SIGUSR2) /* user defined signal 2 */
+ signal_names[SIGUSR2] = "SIGUSR2";
+#endif
+
+#if defined (SIGKILLTHR) /* BeOS: Kill Thread */
+ signal_names[SIGKILLTHR] = "SIGKILLTHR";
+#endif
+
+ for (i = 0; i < NSIG; i++)
+ if (signal_names[i] == (char *)NULL)
+ {
+ signal_names[i] = (char *)malloc (18);
+ if (signal_names[i])
+ sprintf (signal_names[i], "SIGJUNK(%d)", i);
+ }
+
+ signal_names[NSIG] = "DEBUG";
+ signal_names[NSIG+1] = "ERR";
+ signal_names[NSIG+2] = "RETURN";
+}
+
+void
+write_signames (stream)
+ FILE *stream;
+{
+ register int i;
+
+ fprintf (stream, "/* This file was automatically created by %s.\n",
+ progname);
+ fprintf (stream, " Do not edit. Edit support/mksignames.c instead. */\n\n");
+ fprintf (stream,
+ "/* A translation list so we can be polite to our users. */\n");
+ fprintf (stream, "char *signal_names[NSIG + 4] = {\n");
+
+ for (i = 0; i <= LASTSIG; i++)
+ fprintf (stream, " \"%s\",\n", signal_names[i]);
+
+ fprintf (stream, " (char *)0x0\n");
+ fprintf (stream, "};\n");
+}
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ char *stream_name;
+ FILE *stream;
+
+ progname = argv[0];
+
+ if (argc == 1)
+ {
+ stream_name = "stdout";
+ stream = stdout;
+ }
+ else if (argc == 2)
+ {
+ stream_name = argv[1];
+ stream = fopen (stream_name, "w");
+ }
+ else
+ {
+ fprintf (stderr, "Usage: %s [output-file]\n", progname);
+ exit (1);
+ }
+
+ if (!stream)
+ {
+ fprintf (stderr, "%s: %s: cannot open for writing\n",
+ progname, stream_name);
+ exit (2);
+ }
+
+ initialize_signames ();
+ write_signames (stream);
+ exit (0);
+}
diff --git a/support/mkversion.sh b/support/mkversion.sh
new file mode 100755
index 0000000..6aca944
--- /dev/null
+++ b/support/mkversion.sh
@@ -0,0 +1,164 @@
+#! /bin/sh
+
+# Simple program to make new version numbers for the shell.
+# Big deal, but it was getting out of hand to do everything
+# in the makefile. This creates a file named by the -o option,
+# otherwise everything is echoed to the standard output.
+
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+PROGNAME=`basename $0`
+USAGE="$PROGNAME [-b] [-S srcdir] -d version -p patchlevel [-s status] [-o outfile]"
+
+source_dir="."
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -o) shift; OUTFILE=$1; shift ;;
+ -b) shift; inc_build=yes ;;
+ -s) shift; rel_status=$1; shift ;;
+ -p) shift; patch_level=$1; shift ;;
+ -d) shift; dist_version=$1; shift ;;
+ -S) shift; source_dir="$1"; shift ;;
+ *) echo "$PROGNAME: usage: $USAGE" >&2 ; exit 2 ;;
+ esac
+done
+
+# Required arguments
+if [ -z "$dist_version" ]; then
+ echo "${PROGNAME}: required argument -d missing" >&2
+ echo "$PROGNAME: usage: $USAGE" >&2
+ exit 1
+fi
+
+#if [ -z "$patch_level" ]; then
+# echo "${PROGNAME}: required argument -p missing" >&2
+# echo "$PROGNAME: usage: $USAGE" >&2
+# exit 1
+#fi
+
+# Defaults
+if [ -z "$rel_status" ]; then
+ rel_status="release"
+fi
+
+build_ver=
+if [ -r .build ]; then
+ build_ver=`cat .build`
+fi
+if [ -z "$build_ver" ]; then
+ build_ver=0
+fi
+
+# increment the build version if that's what's required
+
+if [ -n "$inc_build" ]; then
+ build_ver=`expr $build_ver + 1`
+fi
+
+# what's the patch level?
+if [ -z "$patch_level" ]; then
+ patchlevel_h=$source_dir/patchlevel.h
+ if [ -s $patchlevel_h ]; then
+ patch_level=`cat $patchlevel_h | grep '^#define[ ]*PATCHLEVEL' | awk '{print $NF}'`
+ fi
+fi
+if [ -z "$patch_level" ]; then
+ patch_level=0
+fi
+
+# If we have an output file specified, make it the standard output
+if [ -n "$OUTFILE" ]; then
+ if exec >$OUTFILE; then
+ :
+ else
+ echo "${PROGNAME}: cannot redirect standard output to $OUTFILE" >&2
+ exit 1
+ fi
+fi
+
+# Output the leading comment.
+echo "/* Version control for the shell. This file gets changed when you say"
+echo " \`make version.h' to the Makefile. It is created by mkversion. */"
+
+# Output the distribution version. Single numbers are converted to x.00.
+# Allow, as a special case, `[:digit:].[:digit:][:alpha:]' for
+# intermediate versions (e.g., `2.5a').
+# Any characters other than digits and `.' are invalid.
+case "$dist_version" in
+[0-9].[0-9][a-z]) ;; # special case
+*[!0-9.]*) echo "mkversion.sh: ${dist_version}: bad distribution version" >&2
+ exit 1 ;;
+*.*) ;;
+*) dist_version=${dist_version}.00 ;;
+esac
+
+dist_major=`echo $dist_version | sed 's:\..*$::'`
+[ -z "${dist_major}" ] && dist_major=0
+
+dist_minor=`echo $dist_version | sed 's:^.*\.::'`
+case "$dist_minor" in
+"") dist_minor=0 ;;
+[a-z]) dist_minor=0${dist_minor} ;;
+?) dist_minor=${dist_minor} ;;
+*) ;;
+esac
+
+#float_dist=`echo $dist_version | awk '{printf "%.2f\n", $1}'`
+float_dist=${dist_major}.${dist_minor}
+
+echo
+echo "/* The distribution version number of this shell. */"
+echo "#define DISTVERSION \"${float_dist}\""
+
+# Output the patch level
+#echo
+#echo "/* The patch level of this version of the shell. */"
+#echo "#define PATCHLEVEL ${patch_level}"
+
+# Output the build version
+echo
+echo "/* The last built version of this shell. */"
+echo "#define BUILDVERSION ${build_ver}"
+
+# Output the release status
+echo
+echo "/* The release status of this shell. */"
+echo "#define RELSTATUS \"${rel_status}\""
+
+# Output the SCCS version string
+sccs_string="${float_dist}.${patch_level}(${build_ver}) ${rel_status} GNU"
+echo
+echo "/* A version string for use by sccs and the what command. */"
+echo "#define SCCSVERSION \"@(#)Bash version ${sccs_string}\""
+
+# extern function declarations
+#echo
+#echo '/* Functions from version.c. */'
+#echo 'extern char *shell_version_string __P((void));'
+#echo 'extern void show_shell_version __P((int));'
+
+if [ -n "$inc_build" ]; then
+ # Make sure we can write to .build
+ if [ -f .build ] && [ ! -w .build ]; then
+ echo "$PROGNAME: cannot write to .build, not incrementing build version" >&2
+ else
+ echo "$build_ver" > .build
+ fi
+fi
+
+exit 0
diff --git a/support/printenv.c b/support/printenv.c
new file mode 100644
index 0000000..f835792
--- /dev/null
+++ b/support/printenv.c
@@ -0,0 +1,71 @@
+/* printenv -- minimal clone of BSD printenv(1).
+
+ usage: printenv [varname]
+
+ Chet Ramey
+ chet@po.cwru.edu
+*/
+
+/* Copyright (C) 1997-2002 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Bash; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+
+#include "bashansi.h"
+
+extern char **environ;
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ register char **envp, *eval;
+ int len;
+
+ argv++;
+ argc--;
+
+ /* printenv */
+ if (argc == 0)
+ {
+ for (envp = environ; *envp; envp++)
+ puts (*envp);
+ exit (0);
+ }
+
+ /* printenv varname */
+ len = strlen (*argv);
+ for (envp = environ; *envp; envp++)
+ {
+ if (**argv == **envp && strncmp (*envp, *argv, len) == 0)
+ {
+ eval = *envp + len;
+ /* If the environment variable doesn't have an `=', ignore it. */
+ if (*eval == '=')
+ {
+ puts (eval + 1);
+ exit (0);
+ }
+ }
+ }
+ exit (1);
+}
+
diff --git a/support/printenv.sh b/support/printenv.sh
new file mode 100755
index 0000000..b3a716c
--- /dev/null
+++ b/support/printenv.sh
@@ -0,0 +1,27 @@
+#! /bin/sh -
+
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+if [ $# -eq 0 ]; then
+ env
+ exit
+elif eval [ "\${$1-unset}" = "unset" ]; then
+ exit 1
+else
+ eval echo \$$1
+ exit 0
+fi
diff --git a/support/recho.c b/support/recho.c
new file mode 100644
index 0000000..287fffb
--- /dev/null
+++ b/support/recho.c
@@ -0,0 +1,66 @@
+/*
+ recho -- really echo args, bracketed with <> and with invisible chars
+ made visible.
+
+ Chet Ramey
+ chet@po.cwru.edu
+*/
+
+/* Copyright (C) 2002-2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Bash; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+
+#include "bashansi.h"
+#include <stdio.h>
+
+void strprint();
+
+int
+main(argc, argv)
+int argc;
+char **argv;
+{
+ register int i;
+
+ for (i = 1; i < argc; i++) {
+ printf("argv[%d] = <", i);
+ strprint(argv[i]);
+ printf(">\n");
+ }
+ exit(0);
+}
+
+void
+strprint(str)
+char *str;
+{
+ register unsigned char *s;
+
+ for (s = (unsigned char *)str; s && *s; s++) {
+ if (*s < ' ') {
+ putchar('^');
+ putchar(*s+64);
+ } else if (*s == 127) {
+ putchar('^');
+ putchar('?');
+ } else
+ putchar(*s);
+ }
+}
diff --git a/support/rlvers.sh b/support/rlvers.sh
new file mode 100755
index 0000000..b3de8fe
--- /dev/null
+++ b/support/rlvers.sh
@@ -0,0 +1,113 @@
+#! /bin/sh
+#
+# rlvers.sh -- run a program that prints out the readline version number
+# using locally-installed readline libraries
+#
+
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+PROGNAME=`basename $0`
+
+: ${TMPDIR:=/tmp}
+TDIR=$TMPDIR/rlvers
+
+# defaults
+CC=cc
+RL_LIBDIR=/usr/local/lib
+RL_INCDIR=/usr/local/include
+
+TERMCAP_LIB="-ltermcap"
+
+# cannot rely on the presence of getopts
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -C) shift ; CC="$1"; shift ;;
+ -I) shift ; RL_INCDIR="$1" ; shift ;;
+ -L) shift ; RL_LIBDIR="$1" ; shift ;;
+ -T) shift ; TERMCAP_LIB="$1" ; shift ;;
+ -v) shift ; verbose=y ;;
+ --) shift ; break ;;
+ *) echo "${PROGNAME}: usage: $PROGNAME [-C compiler] [-L libdir] [-v]" >&2 ; exit 2;;
+ esac
+done
+
+# if someone happened to install examples/rlversion, use it (it's not
+# installed by default)
+if test -f ${RL_LIBDIR}/rlversion ; then
+ if [ -n "$verbose" ]; then
+ echo "${PROGNAME}: using installed rlversion from ${RL_LIBDIR}/rlversion"
+ fi
+ v=`${RL_LIBDIR}/rlversion 2>/dev/null`
+ case "$v" in
+ unknown | "") echo 0 ;;
+ *) echo "$v" ;;
+ esac
+ exit 0
+fi
+
+if [ -n "$verbose" ]; then
+ echo "${PROGNAME}: using ${RL_LIBDIR} to find libreadline"
+ echo "${PROGNAME}: attempting program compilation"
+fi
+
+# make $TDIR mode 0700
+mkdir $TDIR || {
+ echo "${PROGNAME}: ${TDIR}: file exists" >&2
+ echo 0
+ exit 1
+}
+chmod 700 $TDIR
+
+trap 'rm -f $TDIR/rlvers $TDIR/rlvers.? ; rmdir $TDIR' 0 1 2 3 6 15
+
+cat > $TDIR/rlvers.c << EOF
+#include <stdio.h>
+extern char *rl_library_version;
+
+main()
+{
+ printf("%s\n", rl_library_version ? rl_library_version : "0");
+ exit(0);
+}
+EOF
+
+opwd=`pwd`
+
+cd $TDIR || {
+ echo "${PROGNAME}: cannot cd to $TDIR" >&2
+ echo 0
+ exit 1
+}
+
+if eval ${CC} -L${RL_LIBDIR} -I${RL_INCDIR} -o $TDIR/rlvers $TDIR/rlvers.c -lreadline ${TERMCAP_LIB};
+then
+ v=`$TDIR/rlvers`
+else
+ if [ -n "$verbose" ] ; then
+ echo "${PROGNAME}: compilation failed: status $?"
+ echo "${PROGNAME}: using version 0"
+ fi
+ v=0
+fi
+
+case "$v" in
+unknown | "") echo 0 ;;
+*) echo "$v" ;;
+esac
+
+cd $opwd
+exit 0
diff --git a/support/shobj-conf b/support/shobj-conf
new file mode 100755
index 0000000..0e306bc
--- /dev/null
+++ b/support/shobj-conf
@@ -0,0 +1,530 @@
+#! /bin/sh
+#
+# shobj-conf -- output a series of variable assignments to be substituted
+# into a Makefile by configure which specify system-dependent
+# information for creating shared objects that may be loaded
+# into bash with `enable -f'
+#
+# usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vendor
+#
+# Chet Ramey
+# chet@po.cwru.edu
+
+# Copyright (C) 1996-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+#
+# defaults
+#
+SHOBJ_STATUS=supported
+SHLIB_STATUS=supported
+
+SHOBJ_CC=cc
+SHOBJ_CFLAGS=
+SHOBJ_LD=
+SHOBJ_LDFLAGS=
+SHOBJ_XLDFLAGS=
+SHOBJ_LIBS=
+
+SHLIB_XLDFLAGS=
+SHLIB_LIBS=
+
+SHLIB_DOT='.'
+SHLIB_LIBPREF='lib'
+SHLIB_LIBSUFF='so'
+
+SHLIB_LIBVERSION='$(SHLIB_LIBSUFF)'
+SHLIB_DLLVERSION='$(SHLIB_MAJOR)'
+
+PROGNAME=`basename $0`
+USAGE="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor"
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -C) shift; SHOBJ_CC="$1"; shift ;;
+ -c) shift; host_cpu="$1"; shift ;;
+ -o) shift; host_os="$1"; shift ;;
+ -v) shift; host_vendor="$1"; shift ;;
+ *) echo "$USAGE" >&2 ; exit 2;;
+ esac
+done
+
+case "${host_os}-${SHOBJ_CC}" in
+sunos4*-*gcc*)
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD=/usr/bin/ld
+ SHOBJ_LDFLAGS='-assert pure-text'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ ;;
+
+sunos4*)
+ SHOBJ_CFLAGS=-pic
+ SHOBJ_LD=/usr/bin/ld
+ SHOBJ_LDFLAGS='-assert pure-text'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ ;;
+
+sunos5*-*gcc*|solaris2*-*gcc*)
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD='${CC}'
+ ld_used=`gcc -print-prog-name=ld`
+ if ${ld_used} -V 2>&1 | grep GNU >/dev/null 2>&1; then
+ # This line works for the GNU ld
+ SHOBJ_LDFLAGS='-shared -Wl,-h,$@'
+ else
+ # This line works for the Solaris linker in /usr/ccs/bin/ld
+ SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
+ fi
+
+# SHLIB_XLDFLAGS='-R $(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sunos5*|solaris2*)
+ SHOBJ_CFLAGS='-K pic'
+ SHOBJ_LD=/usr/ccs/bin/ld
+ SHOBJ_LDFLAGS='-G -dy -z text -i -h $@'
+
+# SHLIB_XLDFLAGS='-R $(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+# All versions of Linux or the semi-mythical GNU Hurd.
+linux*-*|gnu*-*|k*bsd*-gnu-*)
+ SHOBJ_CFLAGS=-fPIC
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+ SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ ;;
+
+freebsd2* | netbsd*)
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS='-x -Bshareable'
+
+ SHLIB_XLDFLAGS='-R$(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ ;;
+
+# FreeBSD-3.x ELF
+freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD='${CC}'
+
+ if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+ SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ else
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_XLDFLAGS='-R$(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ fi
+ ;;
+
+# Darwin/MacOS X
+darwin*|macosx*)
+ SHOBJ_STATUS=unsupported
+ SHLIB_STATUS=supported
+
+ SHOBJ_CFLAGS='-fno-common'
+
+ SHOBJ_LD='${CC}'
+
+ SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
+ SHLIB_LIBSUFF='dylib'
+
+ case "${host_os}" in
+ darwin[78]*) SHOBJ_LDFLAGS=''
+ SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+ ;;
+ *) SHOBJ_LDFLAGS='-dynamic'
+ SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+ ;;
+ esac
+
+ SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
+ ;;
+
+openbsd*)
+ SHOBJ_CFLAGS=-fPIC
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_XLDFLAGS='-R$(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ ;;
+
+bsdi2*)
+ SHOBJ_CC=shlicc2
+ SHOBJ_CFLAGS=
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS=-r
+ SHOBJ_LIBS=-lc_s.2.1.0
+
+ # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
+ # the ass -- they require changing {/usr/lib,etc}/shlib.map on
+ # each system, and the library creation process is byzantine
+ SHLIB_STATUS=unsupported
+ ;;
+
+bsdi3*)
+ SHOBJ_CC=shlicc2
+ SHOBJ_CFLAGS=
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS=-r
+ SHOBJ_LIBS=-lc_s.3.0.0
+
+ # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
+ # the ass -- they require changing {/usr/lib,etc}/shlib.map on
+ # each system, and the library creation process is byzantine
+ SHLIB_STATUS=unsupported
+ ;;
+
+bsdi4*)
+ # BSD/OS 4.x now supports ELF and SunOS-style dynamically-linked
+ # shared libraries. gcc 2.x is the standard compiler, and the
+ # `normal' gcc options should work as they do in Linux.
+
+ SHOBJ_CFLAGS=-fPIC
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ ;;
+
+osf*-*gcc*)
+ # Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+ SHLIB_XLDFLAGS='-rpath $(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+osf*)
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"'
+
+ SHLIB_XLDFLAGS='-rpath $(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD='ld'
+ SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
+ SHOBJ_XLDFLAGS='-G'
+
+ SHLIB_XLDFLAGS='-bM:SRE'
+ SHLIB_LIBS='-lcurses -lc'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+aix4.[2-9]*)
+ SHOBJ_CFLAGS=-K
+ SHOBJ_LD='ld'
+ SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
+ SHOBJ_XLDFLAGS='-G'
+
+ SHLIB_XLDFLAGS='-bM:SRE'
+ SHLIB_LIBS='-lcurses -lc'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+#
+# THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface
+#
+irix[56]*-*gcc*)
+ SHOBJ_CFLAGS='-fpic'
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+ SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+irix[56]*)
+ SHOBJ_CFLAGS='-K PIC'
+ SHOBJ_LD=ld
+# SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
+# Change from David Kaelbling <drk@sgi.com>. If you have problems,
+# remove the `-no_unresolved'
+ SHOBJ_LDFLAGS='-shared -no_unresolved -soname $@'
+
+ SHLIB_XLDFLAGS='-rpath $(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+hpux9*-*gcc*)
+ # must use gcc; the bundled cc cannot compile PIC code
+ SHOBJ_CFLAGS='-fpic'
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
+
+ SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
+ SHLIB_LIBSUFF='sl'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+hpux9*)
+ SHOBJ_STATUS=unsupported
+ SHLIB_STATUS=unsupported
+
+ # If you are using the HP ANSI C compiler, you can uncomment and use
+ # this code (I have not tested it)
+# SHOBJ_STATUS=supported
+# SHLIB_STATUS=supported
+#
+# SHOBJ_CFLAGS='+z'
+# SHOBJ_LD='ld'
+# SHOBJ_LDFLAGS='-b +s'
+#
+# SHLIB_XLDFLAGS='+b $(libdir)'
+# SHLIB_LIBSUFF='sl'
+# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+
+ ;;
+
+hpux10*-*gcc*)
+ # must use gcc; the bundled cc cannot compile PIC code
+ SHOBJ_CFLAGS='-fpic'
+ SHOBJ_LD='${CC}'
+ # if you have problems linking here, moving the `-Wl,+h,$@' from
+ # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
+ SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
+
+ SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
+ SHLIB_LIBSUFF='sl'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+hpux10*)
+ SHOBJ_STATUS=unsupported
+ SHLIB_STATUS=unsupported
+
+ # If you are using the HP ANSI C compiler, you can uncomment and use
+ # this code (I have not tested it)
+# SHOBJ_STATUS=supported
+# SHLIB_STATUS=supported
+#
+# SHOBJ_CFLAGS='+z'
+# SHOBJ_LD='ld'
+# SHOBJ_LDFLAGS='-b +s +h $@'
+#
+# SHLIB_XLDFLAGS='+b $(libdir)'
+# SHLIB_LIBSUFF='sl'
+# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+
+ ;;
+
+hpux11*-*gcc*)
+ # must use gcc; the bundled cc cannot compile PIC code
+ SHOBJ_CFLAGS='-fpic'
+ SHOBJ_LD='${CC}'
+# SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@'
+ SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s -Wl,+h,$@'
+
+ SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
+ SHLIB_LIBSUFF='sl'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+hpux11*)
+ SHOBJ_STATUS=unsupported
+ SHLIB_STATUS=unsupported
+
+ # If you are using the HP ANSI C compiler, you can uncomment and use
+ # this code (I have not tested it)
+# SHOBJ_STATUS=supported
+# SHLIB_STATUS=supported
+#
+# SHOBJ_CFLAGS='+z'
+# SHOBJ_LD='ld'
+# SHOBJ_LDFLAGS='-b +s +h $@'
+#
+# SHLIB_XLDFLAGS='+b $(libdir)'
+# SHLIB_LIBSUFF='sl'
+# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+
+ ;;
+
+sysv4*-*gcc*)
+ SHOBJ_CFLAGS=-shared
+ SHOBJ_LDFLAGS='-shared -h $@'
+ SHOBJ_LD='${CC}'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sysv4*)
+ SHOBJ_CFLAGS='-K PIC'
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS='-dy -z text -G -h $@'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sco3.2v5*-*gcc*)
+ SHOBJ_CFLAGS='-fpic' # DEFAULTS TO ELF
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sco3.2v5*)
+ SHOBJ_CFLAGS='-K pic -b elf'
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS='-G -b elf -dy -z text -h $@'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sysv5uw7*-*gcc*)
+ SHOBJ_CFLAGS='-fpic'
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sysv5uw7*)
+ SHOBJ_CFLAGS='-K PIC'
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS='-G -dy -z text -h $@'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sysv5UnixWare*-*gcc*)
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sysv5UnixWare*)
+ SHOBJ_CFLAGS='-K PIC'
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS='-G -dy -z text -h $@'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sysv5OpenUNIX*-*gcc*)
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+sysv5OpenUNIX*)
+ SHOBJ_CFLAGS='-K PIC'
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS='-G -dy -z text -h $@'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+dgux*-*gcc*)
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+dgux*)
+ SHOBJ_CFLAGS='-K pic'
+ SHOBJ_LD=ld
+ SHOBJ_LDFLAGS='-G -dy -h $@'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+msdos*)
+ SHOBJ_STATUS=unsupported
+ SHLIB_STATUS=unsupported
+ ;;
+
+cygwin*)
+ SHOBJ_LD='$(CC)'
+ SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
+ SHLIB_LIBPREF='cyg'
+ SHLIB_LIBSUFF='dll'
+ SHLIB_LIBVERSION='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
+ SHLIB_LIBS='$(TERMCAP_LIB)'
+
+ SHLIB_DOT=
+ # For official cygwin releases, DLLVERSION will be defined in the
+ # environment of configure, and will be incremented any time the API
+ # changes in a non-backwards compatible manner. Otherwise, it is just
+ # SHLIB_MAJOR.
+ if [ -n "$DLLVERSION" ] ; then
+ SHLIB_DLLVERSION="$DLLVERSION"
+ fi
+ ;;
+
+#
+# Rely on correct gcc configuration for everything else
+#
+*-*gcc*)
+ SHOBJ_CFLAGS=-fpic
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
+*)
+ SHOBJ_STATUS=unsupported
+ SHLIB_STATUS=unsupported
+ ;;
+
+esac
+
+echo SHOBJ_CC=\'"$SHOBJ_CC"\'
+echo SHOBJ_CFLAGS=\'"$SHOBJ_CFLAGS"\'
+echo SHOBJ_LD=\'"$SHOBJ_LD"\'
+echo SHOBJ_LDFLAGS=\'"$SHOBJ_LDFLAGS"\'
+echo SHOBJ_XLDFLAGS=\'"$SHOBJ_XLDFLAGS"\'
+echo SHOBJ_LIBS=\'"$SHOBJ_LIBS"\'
+
+echo SHLIB_XLDFLAGS=\'"$SHLIB_XLDFLAGS"\'
+echo SHLIB_LIBS=\'"$SHLIB_LIBS"\'
+
+echo SHLIB_DOT=\'"$SHLIB_DOT"\'
+
+echo SHLIB_LIBPREF=\'"$SHLIB_LIBPREF"\'
+echo SHLIB_LIBSUFF=\'"$SHLIB_LIBSUFF"\'
+
+echo SHLIB_LIBVERSION=\'"$SHLIB_LIBVERSION"\'
+echo SHLIB_DLLVERSION=\'"$SHLIB_DLLVERSION"\'
+
+echo SHOBJ_STATUS=\'"$SHOBJ_STATUS"\'
+echo SHLIB_STATUS=\'"$SHLIB_STATUS"\'
+
+exit 0
diff --git a/support/texi2dvi b/support/texi2dvi
new file mode 100755
index 0000000..010b586
--- /dev/null
+++ b/support/texi2dvi
@@ -0,0 +1,660 @@
+#! /bin/sh
+# texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources.
+# $Id: texi2dvi,v 1.14 2003/02/05 00:42:33 karl Exp $
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
+# 2002, 2003 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can either send email to this
+# program's maintainer or write to: The Free Software Foundation,
+# Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
+#
+# Original author: Noah Friedman <friedman@gnu.org>.
+#
+# Please send bug reports, etc. to bug-texinfo@gnu.org.
+# If possible, please send a copy of the output of the script called with
+# the `--debug' option when making a bug report.
+
+# This string is expanded by rcs automatically when this file is checked out.
+rcs_revision='$Revision: 1.14 $'
+rcs_version=`set - $rcs_revision; echo $2`
+program=`echo $0 | sed -e 's!.*/!!'`
+version="texi2dvi (GNU Texinfo 4.5) $rcs_version
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+There is NO warranty. You may redistribute this software
+under the terms of the GNU General Public License.
+For more information about these matters, see the files named COPYING."
+
+usage="Usage: $program [OPTION]... FILE...
+
+Run each Texinfo or LaTeX FILE through TeX in turn until all
+cross-references are resolved, building all indices. The directory
+containing each FILE is searched for included files. The suffix of FILE
+is used to determine its language (LaTeX or Texinfo).
+
+Makeinfo is used to perform Texinfo macro expansion before running TeX
+when needed.
+
+Operation modes:
+ -b, --batch no interaction
+ -c, --clean remove all auxiliary files
+ -D, --debug turn on shell debugging (set -x)
+ -h, --help display this help and exit successfully
+ -o, --output=OFILE leave output in OFILE (implies --clean);
+ Only one input FILE may be specified in this case
+ -q, --quiet no output unless errors (implies --batch)
+ -s, --silent same as --quiet
+ -v, --version display version information and exit successfully
+ -V, --verbose report on what is done
+
+TeX tuning:
+ -@ use @input instead of \input; for preloaded Texinfo
+ -e, -E, --expand force macro expansion using makeinfo
+ -I DIR search DIR for Texinfo files
+ -l, --language=LANG specify the LANG of FILE (LaTeX or Texinfo)
+ -p, --pdf use pdftex or pdflatex for processing
+ -t, --texinfo=CMD insert CMD after @setfilename in copy of input file
+ multiple values accumulate
+
+The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO,
+TEX (or PDFTEX), and TEXINDEX environment variables are used to run
+those commands, if they are set.
+
+Email bug reports to <bug-texinfo@gnu.org>,
+general questions and discussion to <help-texinfo@gnu.org>.
+Texinfo home page: http://www.gnu.org/software/texinfo/"
+
+# Initialize variables for option overriding and otherwise.
+# Don't use `unset' since old bourne shells don't have this command.
+# Instead, assign them an empty value.
+batch=false # eval for batch mode
+clean=
+debug=
+escape='\'
+expand= # t for expansion via makeinfo
+miincludes= # makeinfo include path
+oformat=dvi
+oname= # --output
+quiet= # by default let the tools' message be displayed
+set_language=
+textra=
+tmpdir=${TMPDIR:-/tmp}/t2d$$ # avoid collisions on 8.3 filesystems.
+txincludes= # TEXINPUTS extensions, with trailing colon
+txiprereq=19990129 # minimum texinfo.tex version to have macro expansion
+verbose=false # echo for verbose mode
+
+orig_pwd=`pwd`
+
+# Systems which define $COMSPEC or $ComSpec use semicolons to separate
+# directories in TEXINPUTS.
+if test -n "$COMSPEC$ComSpec"; then
+ path_sep=";"
+else
+ path_sep=":"
+fi
+
+# Pacify verbose cds.
+CDPATH=${ZSH_VERSION+.}$path_sep
+
+# In case someone crazy insists on using grep -E.
+: ${EGREP=egrep}
+
+# Save this so we can construct a new TEXINPUTS path for each file.
+TEXINPUTS_orig="$TEXINPUTS"
+# Unfortunately makeindex does not read TEXINPUTS.
+INDEXSTYLE_orig="$INDEXSTYLE"
+export TEXINPUTS INDEXSTYLE
+
+# Push a token among the arguments that will be used to notice when we
+# ended options/arguments parsing.
+# Use "set dummy ...; shift" rather than 'set - ..." because on
+# Solaris set - turns off set -x (but keeps set -e).
+# Use ${1+"$@"} rather than "$@" because Digital Unix and Ultrix 4.3
+# still expand "$@" to a single argument (the empty string) rather
+# than nothing at all.
+arg_sep="$$--$$"
+set dummy ${1+"$@"} "$arg_sep"; shift
+
+#
+# Parse command line arguments.
+while test x"$1" != x"$arg_sep"; do
+
+ # Handle --option=value by splitting apart and putting back on argv.
+ case "$1" in
+ --*=*)
+ opt=`echo "$1" | sed -e 's/=.*//'`
+ val=`echo "$1" | sed -e 's/[^=]*=//'`
+ shift
+ set dummy "$opt" "$val" ${1+"$@"}; shift
+ ;;
+ esac
+
+ # This recognizes --quark as --quiet. So what.
+ case "$1" in
+ -@ ) escape=@;;
+ # Silently and without documentation accept -b and --b[atch] as synonyms.
+ -b | --b*) batch=eval;;
+ -q | -s | --q* | --s*) quiet=t; batch=eval;;
+ -c | --c*) clean=t;;
+ -D | --d*) debug=t;;
+ -e | -E | --e*) expand=t;;
+ -h | --h*) echo "$usage"; exit 0;;
+ -I | --I*)
+ shift
+ miincludes="$miincludes -I $1"
+ txincludes="$txincludes$1$path_sep"
+ ;;
+ -l | --l*) shift; set_language=$1;;
+ -o | --o*)
+ shift
+ clean=t
+ case "$1" in
+ /* | ?:/*) oname=$1;;
+ *) oname="$orig_pwd/$1";;
+ esac;;
+ -p | --p*) oformat=pdf;;
+ -t | --t*) shift; textra="$textra\\
+$1";;
+ -v | --vers*) echo "$version"; exit 0;;
+ -V | --verb*) verbose=echo;;
+ --) # What remains are not options.
+ shift
+ while test x"$1" != x"$arg_sep"; do
+ set dummy ${1+"$@"} "$1"; shift
+ shift
+ done
+ break;;
+ -*)
+ echo "$0: Unknown or ambiguous option \`$1'." >&2
+ echo "$0: Try \`--help' for more information." >&2
+ exit 1;;
+ *) set dummy ${1+"$@"} "$1"; shift;;
+ esac
+ shift
+done
+# Pop the token
+shift
+
+# Interpret remaining command line args as filenames.
+case $# in
+ 0)
+ echo "$0: Missing file arguments." >&2
+ echo "$0: Try \`--help' for more information." >&2
+ exit 2
+ ;;
+ 1) ;;
+ *)
+ if test -n "$oname"; then
+ echo "$0: Can't use option \`--output' with more than one argument." >&2
+ exit 2
+ fi
+ ;;
+esac
+
+# Prepare the temporary directory. Remove it at exit, unless debugging.
+if test -z "$debug"; then
+ trap "cd / && rm -rf $tmpdir" 0 1 2 15
+fi
+
+# Create the temporary directory with strict rights
+(umask 077 && mkdir $tmpdir) || exit 1
+
+# Prepare the tools we might need. This may be extra work in some
+# cases, but improves the readibility of the script.
+utildir=$tmpdir/utils
+mkdir $utildir || exit 1
+
+# A sed script that preprocesses Texinfo sources in order to keep the
+# iftex sections only. We want to remove non TeX sections, and
+# comment (with `@c texi2dvi') TeX sections so that makeinfo does not
+# try to parse them. Nevertheless, while commenting TeX sections,
+# don't comment @macro/@end macro so that makeinfo does propagate
+# them. Unfortunately makeinfo --iftex --no-ifhtml --no-ifinfo
+# doesn't work well enough (yet) to use that, so work around with sed.
+comment_iftex_sed=$utildir/comment.sed
+cat <<EOF >$comment_iftex_sed
+/^@tex/,/^@end tex/{
+ s/^/@c texi2dvi/
+}
+/^@iftex/,/^@end iftex/{
+ s/^/@c texi2dvi/
+ /^@c texi2dvi@macro/,/^@c texi2dvi@end macro/{
+ s/^@c texi2dvi//
+ }
+}
+/^@html/,/^@end html/{
+ s/^/@c (texi2dvi)/
+}
+/^@ifhtml/,/^@end ifhtml/{
+ s/^/@c (texi2dvi)/
+}
+/^@ifnottex/,/^@end ifnottex/{
+ s/^/@c (texi2dvi)/
+}
+/^@ifinfo/,/^@end ifinfo/{
+ /^@node/p
+ /^@menu/,/^@end menu/p
+ t
+ s/^/@c (texi2dvi)/
+}
+s/^@ifnotinfo/@c texi2dvi@ifnotinfo/
+s/^@end ifnotinfo/@c texi2dvi@end ifnotinfo/
+EOF
+# Uncommenting is simple: Remove any leading `@c texi2dvi'.
+uncomment_iftex_sed=$utildir/uncomment.sed
+cat <<EOF >$uncomment_iftex_sed
+s/^@c texi2dvi//
+EOF
+
+# A shell script that computes the list of xref files.
+# Takes the filename (without extension) of which we look for xref
+# files as argument. The index files must be reported last.
+get_xref_files=$utildir/get_xref.sh
+cat <<\EOF >$get_xref_files
+#! /bin/sh
+
+# Get list of xref files (indexes, tables and lists).
+# Find all files having root filename with a two-letter extension,
+# saves the ones that are really Texinfo-related files. .?o? catches
+# many files: .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
+for this_file in "$1".?o? "$1".aux "$1".?? "$1".idx; do
+ # If file is empty, skip it.
+ test -s "$this_file" || continue
+ # If the file is not suitable to be an index or xref file, don't
+ # process it. The file can't be if its first character is not a
+ # backslash or single quote.
+ first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
+ if test "x$first_character" = "x\\" \
+ || test "x$first_character" = "x'"; then
+ xref_files="$xref_files ./$this_file"
+ fi
+done
+echo "$xref_files"
+EOF
+chmod 500 $get_xref_files
+
+# File descriptor usage:
+# 0 standard input
+# 1 standard output (--verbose messages)
+# 2 standard error
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 5 tools output (turned off by --quiet)
+
+# Tools' output. If quiet, discard, else redirect to the message flow.
+if test "$quiet" = t; then
+ exec 5>/dev/null
+else
+ exec 5>&1
+fi
+
+# Enable tracing
+test "$debug" = t && set -x
+
+#
+# TeXify files.
+
+for command_line_filename in ${1+"$@"}; do
+ $verbose "Processing $command_line_filename ..."
+
+ # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
+ # prepend `./' in order to avoid that the tools take it as an option.
+ echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >/dev/null \
+ || command_line_filename="./$command_line_filename"
+
+ # See if the file exists. If it doesn't we're in trouble since, even
+ # though the user may be able to reenter a valid filename at the tex
+ # prompt (assuming they're attending the terminal), this script won't
+ # be able to find the right xref files and so forth.
+ if test ! -r "$command_line_filename"; then
+ echo "$0: Could not read $command_line_filename, skipping." >&2
+ continue
+ fi
+
+ # Get the name of the current directory. We want the full path
+ # because in clean mode we are in tmp, in which case a relative
+ # path has no meaning.
+ filename_dir=`echo $command_line_filename | sed 's!/[^/]*$!!;s!^$!.!'`
+ filename_dir=`cd "$filename_dir" >/dev/null && pwd`
+
+ # Strip directory part but leave extension.
+ filename_ext=`basename "$command_line_filename"`
+ # Strip extension.
+ filename_noext=`echo "$filename_ext" | sed 's/\.[^.]*$//'`
+ ext=`echo "$filename_ext" | sed 's/^.*\.//'`
+
+ # _src. Use same basename since we want to generate aux files with
+ # the same basename as the manual. If --expand, then output the
+ # macro-expanded file to here, else copy the original file.
+ tmpdir_src=$tmpdir/src
+ filename_src=$tmpdir_src/$filename_noext.$ext
+
+ # _xtr. The file with the user's extra commands.
+ tmpdir_xtr=$tmpdir/xtr
+ filename_xtr=$tmpdir_xtr/$filename_noext.$ext
+
+ # _bak. Copies of the previous xref files (another round is run if
+ # they differ from the new one).
+ tmpdir_bak=$tmpdir/bak
+
+ # Make all those directories and give up if we can't succeed.
+ mkdir $tmpdir_src $tmpdir_xtr $tmpdir_bak || exit 1
+
+ # Source file might include additional sources.
+ # We want `.:$orig_pwd' before anything else. (We'll add `.:' later
+ # after all other directories have been turned into absolute paths.)
+ # `.' goes first to ensure that any old .aux, .cps,
+ # etc. files in ${directory} don't get used in preference to fresher
+ # files in `.'. Include orig_pwd in case we are in clean mode, where
+ # we've cd'd to a temp directory.
+ common="$orig_pwd$path_sep$filename_dir$path_sep$txincludes"
+ TEXINPUTS="$common$TEXINPUTS_orig"
+ INDEXSTYLE="$common$INDEXSTYLE_orig"
+
+ # Convert relative paths to absolute paths, so we can run in another
+ # directory (e.g., in --clean mode, or during the macro-support
+ # detection.)
+ #
+ # Empty path components are meaningful to tex. We rewrite them
+ # as `EMPTY' so they don't get lost when we split on $path_sep.
+ TEXINPUTS=`echo $TEXINPUTS |sed 's/^:/EMPTY:/;s/:$/:EMPTY/;s/::/:EMPTY:/g'`
+ INDEXSTYLE=`echo $INDEXSTYLE |sed 's/^:/EMPTY:/;s/:$/:EMPTY/;s/::/:EMPTY:/g'`
+ save_IFS=$IFS
+ IFS=$path_sep
+ set x $TEXINPUTS; shift
+ TEXINPUTS=.
+ for dir
+ do
+ case $dir in
+ EMPTY)
+ TEXINPUTS=$TEXINPUTS$path_sep
+ ;;
+ [\\/]* | ?:[\\/]*) # Absolute paths don't need to be expansed.
+ TEXINPUTS=$TEXINPUTS$path_sep$dir
+ ;;
+ *)
+ abs=`cd "$dir" && pwd` && TEXINPUTS=$TEXINPUTS$path_sep$abs
+ ;;
+ esac
+ done
+ set x $INDEXSTYLE; shift
+ INDEXSTYLE=.
+ for dir
+ do
+ case $dir in
+ EMPTY)
+ INDEXSTYLE=$INDEXSTYLE$path_sep
+ ;;
+ [\\/]* | ?:[\\/]*) # Absolute paths don't need to be expansed.
+ INDEXSTYLE=$INDEXSTYLE$path_sep$dir
+ ;;
+ *)
+ abs=`cd "$dir" && pwd` && INDEXSTYLE=$INDEXSTYLE$path_sep$abs
+ ;;
+ esac
+ done
+ IFS=$save_IFS
+
+ # If the user explicitly specified the language, use that.
+ # Otherwise, if the first line is \input texinfo, assume it's texinfo.
+ # Otherwise, guess from the file extension.
+ if test -n "$set_language"; then
+ language=$set_language
+ elif sed 1q "$command_line_filename" | grep 'input texinfo' >/dev/null; then
+ language=texinfo
+ else
+ language=
+ fi
+
+ # Get the type of the file (latex or texinfo) from the given language
+ # we just guessed, or from the file extension if not set yet.
+ case ${language:-$filename_ext} in
+ [lL]a[tT]e[xX] | *.ltx | *.tex)
+ # Assume a LaTeX file. LaTeX needs bibtex and uses latex for
+ # compilation. No makeinfo.
+ bibtex=${BIBTEX:-bibtex}
+ makeinfo= # no point in running makeinfo on latex source.
+ texindex=${MAKEINDEX:-makeindex}
+ if test $oformat = dvi; then
+ tex=${LATEX:-latex}
+ else
+ tex=${PDFLATEX:-pdflatex}
+ fi
+ ;;
+
+ *)
+ # Assume a Texinfo file. Texinfo files need makeinfo, texindex and tex.
+ bibtex=
+ texindex=${TEXINDEX:-texindex}
+ if test $oformat = dvi; then
+ tex=${TEX:-tex}
+ else
+ tex=${PDFTEX:-pdftex}
+ fi
+ # Unless required by the user, makeinfo expansion is wanted only
+ # if texinfo.tex is too old.
+ if test "$expand" = t; then
+ makeinfo=${MAKEINFO:-makeinfo}
+ else
+ # Check if texinfo.tex performs macro expansion by looking for
+ # its version. The version is a date of the form YEAR-MO-DA.
+ # We don't need to use [0-9] to match the digits since anyway
+ # the comparison with $txiprereq, a number, will fail with non
+ # digits.
+ txiversion_tex=txiversion.tex
+ echo '\input texinfo.tex @bye' >$tmpdir/$txiversion_tex
+ # Run in the tmpdir to avoid leaving files.
+ eval `cd $tmpdir >/dev/null &&
+ $tex $txiversion_tex 2>/dev/null |
+ sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p'`
+ $verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' ..."
+ if test "$txiprereq" -le "$txiversion" >/dev/null 2>&1; then
+ makeinfo=
+ else
+ makeinfo=${MAKEINFO:-makeinfo}
+ fi
+ # As long as we had to run TeX, offer the user this convenience
+ if test "$txiformat" = Texinfo; then
+ escape=@
+ fi
+ fi
+ ;;
+ esac
+
+ # Expand macro commands in the original source file using Makeinfo.
+ # Always use `end' footnote style, since the `separate' style
+ # generates different output (arguably this is a bug in -E).
+ # Discard main info output, the user asked to run TeX, not makeinfo.
+ if test -n "$makeinfo"; then
+ $verbose "Macro-expanding $command_line_filename to $filename_src ..."
+ sed -f $comment_iftex_sed "$command_line_filename" \
+ | $makeinfo --footnote-style=end -I "$filename_dir" $miincludes \
+ -o /dev/null --macro-expand=- \
+ | sed -f $uncomment_iftex_sed >"$filename_src"
+ filename_input=$filename_src
+ fi
+
+ # If makeinfo failed (or was not even run), use the original file as input.
+ if test $? -ne 0 \
+ || test ! -r "$filename_src"; then
+ $verbose "Reverting to $command_line_filename ..."
+ filename_input=$filename_dir/$filename_ext
+ fi
+
+ # Used most commonly for @finalout, @smallbook, etc.
+ if test -n "$textra"; then
+ $verbose "Inserting extra commands: $textra"
+ sed '/^@setfilename/a\
+'"$textra" "$filename_input" >$filename_xtr
+ filename_input=$filename_xtr
+ fi
+
+ # If clean mode was specified, then move to the temporary directory.
+ if test "$clean" = t; then
+ $verbose "cd $tmpdir_src"
+ cd "$tmpdir_src" || exit 1
+ fi
+
+ while :; do # will break out of loop below
+ orig_xref_files=`$get_xref_files "$filename_noext"`
+
+ # Save copies of originals for later comparison.
+ if test -n "$orig_xref_files"; then
+ $verbose "Backing up xref files: `echo $orig_xref_files | sed 's|\./||g'`"
+ cp $orig_xref_files $tmpdir_bak
+ fi
+
+ # Run bibtex on current file.
+ # - If its input (AUX) exists.
+ # - If AUX contains both `\bibdata' and `\bibstyle'.
+ # - If some citations are missing (LOG contains `Citation').
+ # or the LOG complains of a missing .bbl
+ #
+ # We run bibtex first, because I can see reasons for the indexes
+ # to change after bibtex is run, but I see no reason for the
+ # converse.
+ #
+ # Don't try to be too smart. Running bibtex only if the bbl file
+ # exists and is older than the LaTeX file is wrong, since the
+ # document might include files that have changed. Because there
+ # can be several AUX (if there are \include's), but a single LOG,
+ # looking for missing citations in LOG is easier, though we take
+ # the risk to match false messages.
+ if test -n "$bibtex" \
+ && test -r "$filename_noext.aux" \
+ && test -r "$filename_noext.log" \
+ && (grep '^\\bibdata[{]' "$filename_noext.aux" \
+ && grep '^\\bibstyle[{]' "$filename_noext.aux" \
+ && (grep 'Warning:.*Citation.*undefined' "$filename_noext.log" \
+ || grep 'No file .*\.bbl\.' "$filename_noext.log")) \
+ >/dev/null 2>&1; \
+ then
+ $verbose "Running $bibtex $filename_noext ..."
+ if $bibtex "$filename_noext" >&5; then :; else
+ echo "$0: $bibtex exited with bad status, quitting." >&2
+ exit 1
+ fi
+ fi
+
+ # What we'll run texindex on -- exclude non-index files.
+ # Since we know index files are last, it is correct to remove everything
+ # before .aux and .?o?. But don't really do <anything>o<anything>
+ # -- don't match whitespace as <anything>.
+ # Otherwise, if orig_xref_files contains something like
+ # foo.xo foo.whatever
+ # the space after the o will get matched.
+ index_files=`echo "$orig_xref_files" \
+ | sed "s!.*\.aux!!g;
+ s!./$filename_noext\.[^ ]o[^ ]!!g;
+ s/^[ ]*//;s/[ ]*$//"`
+ # Run texindex (or makeindex) on current index files. If they
+ # already exist, and after running TeX a first time the index
+ # files don't change, then there's no reason to run TeX again.
+ # But we won't know that if the index files are out of date or
+ # nonexistent.
+ if test -n "$texindex" && test -n "$index_files"; then
+ $verbose "Running $texindex $index_files ..."
+ if $texindex $index_files 2>&5 1>&2; then :; else
+ echo "$0: $texindex exited with bad status, quitting." >&2
+ exit 1
+ fi
+ fi
+
+ # Finally, run TeX.
+ # Prevent $ESCAPE from being interpreted by the shell if it happens
+ # to be `/'.
+ $batch tex_args="\\${escape}nonstopmode\ \\${escape}input"
+ cmd="$tex $tex_args $filename_input"
+ $verbose "Running $cmd ..."
+ if $cmd >&5; then :; else
+ echo "$0: $tex exited with bad status, quitting." >&2
+ echo "$0: see $filename_noext.log for errors." >&2
+ test "$clean" = t \
+ && cp "$filename_noext.log" "$orig_pwd"
+ exit 1
+ fi
+
+
+ # Decide if looping again is needed.
+ finished=t
+
+ # LaTeX (and the package changebar) report in the LOG file if it
+ # should be rerun. This is needed for files included from
+ # subdirs, since texi2dvi does not try to compare xref files in
+ # subdirs. Performing xref files test is still good since LaTeX
+ # does not report changes in xref files.
+ if grep "Rerun to get" "$filename_noext.log" >/dev/null 2>&1; then
+ finished=
+ fi
+
+ # Check if xref files changed.
+ new_xref_files=`$get_xref_files "$filename_noext"`
+ $verbose "Original xref files = `echo $orig_xref_files | sed 's|\./||g'`"
+ $verbose "New xref files = `echo $new_xref_files | sed 's|\./||g'`"
+
+ # If old and new lists don't at least have the same file list,
+ # then one file or another has definitely changed.
+ test "x$orig_xref_files" != "x$new_xref_files" && finished=
+
+ # File list is the same. We must compare each file until we find
+ # a difference.
+ if test -n "$finished"; then
+ for this_file in $new_xref_files; do
+ $verbose "Comparing xref file `echo $this_file | sed 's|\./||g'` ..."
+ # cmp -s returns nonzero exit status if files differ.
+ if cmp -s "$this_file" "$tmpdir_bak/$this_file"; then :; else
+ # We only need to keep comparing until we find one that
+ # differs, because we'll have to run texindex & tex again no
+ # matter how many more there might be.
+ finished=
+ $verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..."
+ test "$debug" = t && diff -c "$tmpdir_bak/$this_file" "$this_file"
+ break
+ fi
+ done
+ fi
+
+ # If finished, exit the loop, else rerun the loop.
+ test -n "$finished" && break
+ done
+
+ # If we were in clean mode, compilation was in a tmp directory.
+ # Copy the DVI (or PDF) file into the directory where the compilation
+ # has been done. (The temp dir is about to get removed anyway.)
+ # We also return to the original directory so that
+ # - the next file is processed in correct conditions
+ # - the temporary file can be removed
+ if test -n "$clean"; then
+ if test -n "$oname"; then
+ dest=$oname
+ else
+ dest=$orig_pwd
+ fi
+ $verbose "Copying $oformat file from `pwd` to $dest"
+ cp -p "./$filename_noext.$oformat" "$dest"
+ cd / # in case $orig_pwd is on a different drive (for DOS)
+ cd $orig_pwd || exit 1
+ fi
+
+ # Remove temporary files.
+ if test "x$debug" = "x"; then
+ $verbose "Removing $tmpdir_src $tmpdir_xtr $tmpdir_bak ..."
+ cd /
+ rm -rf $tmpdir_src $tmpdir_xtr $tmpdir_bak
+ fi
+done
+
+$verbose "$0 done."
+exit 0 # exit successfully, not however we ended the loop.
diff --git a/support/texi2html b/support/texi2html
new file mode 100755
index 0000000..bdb3bee
--- /dev/null
+++ b/support/texi2html
@@ -0,0 +1,5429 @@
+#! /usr/bin/perl
+'di ';
+'ig 00 ';
+#+##############################################################################
+#
+# texi2html: Program to transform Texinfo documents to HTML
+#
+# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#-##############################################################################
+
+# This requires perl version 5 or higher
+require 5.0;
+
+#++##############################################################################
+#
+# NOTE FOR DEBUGGING THIS SCRIPT:
+# You can run 'perl texi2html.pl' directly, provided you have
+# the environment variable T2H_HOME set to the directory containing
+# the texi2html.init file
+#
+#--##############################################################################
+
+# CVS version:
+# $Id: texi2html.pl,v 1.55 2000/07/27 14:39:41 obachman Exp $
+
+# Homepage:
+$T2H_HOMEPAGE = <<EOT;
+http://www.mathematik.uni-kl.de/~obachman/Texi2html
+EOT
+
+# Authors:
+$T2H_AUTHORS = <<EOT;
+Written by: Lionel Cons <Lionel.Cons\@cern.ch> (original author)
+ Karl Berry <karl\@freefriends.org>
+ Olaf Bachmann <obachman\@mathematik.uni-kl.de>
+ and many others.
+Maintained by: Olaf Bachmann <obachman\@mathematik.uni-kl.de>
+Send bugs and suggestions to <texi2html\@mathematik.uni-kl.de>
+EOT
+
+# Version: set in configure.in
+$THISVERSION = '1.64';
+$THISPROG = "texi2html $THISVERSION"; # program name and version
+
+# The man page for this program is included at the end of this file and can be
+# viewed using the command 'nroff -man texi2html'.
+
+# Identity:
+
+$T2H_TODAY = &pretty_date; # like "20 September 1993"
+# the eval prevents this from breaking on system which do not have
+# a proper getpwuid implemented
+eval { ($T2H_USER = (getpwuid ($<))[6]) =~ s/,.*//;}; # Who am i
+
+#+++############################################################################
+# #
+# Initialization #
+# Pasted content of File $(srcdir)/texi2html.init: Default initializations #
+# #
+#---############################################################################
+
+# leave this within comments, and keep the require statement
+# This way, you can directly run texi2html.pl, if $ENV{T2H_HOME}/texi2html.init
+# exists.
+
+#
+# -*-perl-*-
+######################################################################
+# File: texi2html.init
+#
+# Sets default values for command-line arguments and for various customizable
+# procedures
+#
+# A copy of this file is pasted into the beginning of texi2html by
+# 'make texi2html'
+#
+# Copy this file and make changes to it, if you like.
+# Afterwards, either, load it with command-line option -init_file <your_init_file>
+#
+# $Id: texi2html.init,v 1.34 2000/07/27 14:09:02 obachman Exp $
+
+######################################################################
+# stuff which can also be set by command-line options
+#
+#
+# Note: values set here, overwrite values set by the command-line
+# options before -init_file and might still be overwritten by
+# command-line arguments following the -init_file option
+#
+
+# T2H_OPTIONS is a hash whose keys are the (long) names of valid
+# command-line options and whose values are a hash with the following keys:
+# type ==> one of !|=i|:i|=s|:s (see GetOpt::Long for more info)
+# linkage ==> ref to scalar, array, or subroutine (see GetOpt::Long for more info)
+# verbose ==> short description of option (displayed by -h)
+# noHelp ==> if 1 -> for "not so important options": only print description on -h 1
+# 2 -> for obsolete options: only print description on -h 2
+
+$T2H_DEBUG = 0;
+$T2H_OPTIONS -> {debug} =
+{
+ type => '=i',
+ linkage => \$main::T2H_DEBUG,
+ verbose => 'output HTML with debuging information',
+};
+
+$T2H_DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
+$T2H_OPTIONS -> {doctype} =
+{
+ type => '=s',
+ linkage => \$main::T2H_DOCTYPE,
+ verbose => 'document type which is output in header of HTML files',
+ noHelp => 1
+};
+
+$T2H_CHECK = 0;
+$T2H_OPTIONS -> {check} =
+{
+ type => '!',
+ linkage => \$main::T2H_CHECK,
+ verbose => 'if set, only check files and output all things that may be Texinfo commands',
+ noHelp => 1
+};
+
+# -expand
+# if set to "tex" (or, "info") expand @iftex and @tex (or, @ifinfo) sections
+# else, neither expand @iftex, @tex, nor @ifinfo sections
+$T2H_EXPAND = "info";
+$T2H_OPTIONS -> {expand} =
+{
+ type => '=s',
+ linkage => \$T2H_EXPAND,
+ verbose => 'Expand info|tex|none section of texinfo source',
+};
+
+# - glossary
+#if set, uses section named `Footnotes' for glossary
+$T2H_USE_GLOSSARY = 0;
+T2H_OPTIONS -> {glossary} =
+{
+ type => '!',
+ linkage => \$T2H_USE_GLOSSARY,
+ verbose => "if set, uses section named `Footnotes' for glossary",
+ noHelp => 1,
+};
+
+
+# -invisible
+# $T2H_INVISIBLE_MARK is the text used to create invisible destination
+# anchors for index links (you can for instance use the invisible.xbm
+# file shipped with this program). This is a workaround for a known
+# bug of many WWW browsers, including netscape.
+# For me, it works fine without it -- on the contrary: if there, it
+# inserts space between headers and start of text (obachman 3/99)
+$T2H_INVISIBLE_MARK = '';
+# $T2H_INVISIBLE_MARK = '&#160;';
+$T2H_OPTIONS -> {invisible} =
+{
+ type => '=s',
+ linkage => \$T2H_INVISIBLE_MARK,
+ verbose => 'use text in invisble anchot',
+ noHelp => 1,
+};
+
+# -iso
+# if set, ISO8879 characters are used for special symbols (like copyright, etc)
+$T2H_USE_ISO = 0;
+$T2H_OPTIONS -> {iso} =
+{
+ type => 'iso',
+ linkage => \$T2H_USE_ISO,
+ verbose => 'if set, ISO8879 characters are used for special symbols (like copyright, etc)',
+ noHelp => 1,
+};
+
+# -I
+# list directories where @include files are searched for (besides the
+# directory of the doc file) additional '-I' args add to this list
+@T2H_INCLUDE_DIRS = (".");
+$T2H_OPTIONS -> {I} =
+{
+ type => '=s',
+ linkage => \@T2H_INCLUDE_DIRS,
+ verbose => 'append $s to the @include search path',
+};
+
+# -top_file
+# uses file of this name for top-level file
+# extension is manipulated appropriately, if necessary.
+# If empty, <basename of document>.html is used
+# Typically, you would set this to "index.html".
+$T2H_TOP_FILE = '';
+$T2H_OPTIONS -> {top_file} =
+{
+ type => '=s',
+ linkage => \$T2H_TOP_FILE,
+ verbose => 'use $s as top file, instead of <docname>.html',
+};
+
+
+# -toc_file
+# uses file of this name for table of contents file
+# extension is manipulated appropriately, if necessary.
+# If empty, <basename of document>_toc.html is used
+$T2H_TOC_FILE = '';
+$T2H_OPTIONS -> {toc_file} =
+{
+ type => '=s',
+ linkage => \$T2H_TOC_FILE,
+ verbose => 'use $s as ToC file, instead of <docname>_toc.html',
+};
+
+# -frames
+# if set, output two additional files which use HTML 4.0 "frames".
+$T2H_FRAMES = 0;
+$T2H_OPTIONS -> {frames} =
+{
+ type => '!',
+ linkage => \$T2H_FRAMES,
+ verbose => 'output files which use HTML 4.0 frames (experimental)',
+ noHelp => 1,
+};
+
+
+# -menu | -nomenu
+# if set, show the Texinfo menus
+$T2H_SHOW_MENU = 1;
+$T2H_OPTIONS -> {menu} =
+{
+ type => '!',
+ linkage => \$T2H_SHOW_MENU,
+ verbose => 'ouput Texinfo menus',
+};
+
+# -number | -nonumber
+# if set, number sections and show section names and numbers in references
+# and menus
+$T2H_NUMBER_SECTIONS = 1;
+$T2H_OPTIONS -> {number} =
+{
+ type => '!',
+ linkage => \$T2H_NUMBER_SECTIONS,
+ verbose => 'use numbered sections'
+};
+
+# if set, and T2H_NUMBER_SECTIONS is set, then use node names in menu
+# entries, instead of section names
+$T2H_NODE_NAME_IN_MENU = 0;
+
+# if set and menu entry equals menu descr, then do not print menu descr.
+# Likewise, if node name equals entry name, do not print entry name.
+$T2H_AVOID_MENU_REDUNDANCY = 1;
+
+# -split section|chapter|none
+# if set to 'section' (resp. 'chapter') create one html file per (sub)section
+# (resp. chapter) and separate pages for Top, ToC, Overview, Index,
+# Glossary, About.
+# otherwise, create monolithic html file which contains whole document
+#$T2H_SPLIT = 'section';
+$T2H_SPLIT = '';
+$T2H_OPTIONS -> {split} =
+{
+ type => '=s',
+ linkage => \$T2H_SPLIT,
+ verbose => 'split document on section|chapter else no splitting',
+};
+
+# -section_navigation|-no-section_navigation
+# if set, then navigation panels are printed at the beginning of each section
+# and, possibly at the end (depending on whether or not there were more than
+# $T2H_WORDS_IN_PAGE words on page
+# This is most useful if you do not want to have section navigation
+# on -split chapter
+$T2H_SECTION_NAVIGATION = 1;
+$T2H_OPTIONS -> {sec_nav} =
+{
+ type => '!',
+ linkage => \$T2H_SECTION_NAVIGATION,
+ verbose => 'output navigation panels for each section',
+};
+
+# -subdir
+# if set put result files in this directory
+# if not set result files are put into current directory
+#$T2H_SUBDIR = 'html';
+$T2H_SUBDIR = '';
+$T2H_OPTIONS -> {subdir} =
+{
+ type => '=s',
+ linkage => \$T2H_SUBDIR,
+ verbose => 'put HTML files in directory $s, instead of $cwd',
+};
+
+# -short_extn
+# If this is set all HTML file will have extension ".htm" instead of
+# ".html". This is helpful when shipping the document to PC systems.
+$T2H_SHORTEXTN = 0;
+$T2H_OPTIONS -> {short_ext} =
+{
+ type => '!',
+ linkage => \$T2H_SHORTEXTN,
+ verbose => 'use "htm" extension for output HTML files',
+};
+
+
+# -prefix
+# Set the output file prefix, prepended to all .html, .gif and .pl files.
+# By default, this is the basename of the document
+$T2H_PREFIX = '';
+$T2H_OPTIONS -> {prefix} =
+{
+ type => '=s',
+ linkage => \$T2H_PREFIX,
+ verbose => 'use as prefix for output files, instead of <docname>',
+};
+
+# -o filename
+# If set, generate monolithic document output html into $filename
+$T2H_OUT = '';
+$T2H_OPTIONS -> {out_file} =
+{
+ type => '=s',
+ linkage => sub {$main::T2H_OUT = @_[1]; $T2H_SPLIT = '';},
+ verbose => 'if set, all HTML output goes into file $s',
+};
+
+# -short_ref
+#if set cross-references are given without section numbers
+$T2H_SHORT_REF = '';
+$T2H_OPTIONS -> {short_ref} =
+{
+ type => '!',
+ linkage => \$T2H_SHORT_REF,
+ verbose => 'if set, references are without section numbers',
+};
+
+# -idx_sum
+# if value is set, then for each @prinindex $what
+# $docu_name_$what.idx is created which contains lines of the form
+# $key\t$ref sorted alphabetically (case matters)
+$T2H_IDX_SUMMARY = 0;
+$T2H_OPTIONS -> {idx_sum} =
+{
+ type => '!',
+ linkage => \$T2H_IDX_SUMMARY,
+ verbose => 'if set, also output index summary',
+ noHelp => 1,
+};
+
+# -verbose
+# if set, chatter about what we are doing
+$T2H_VERBOSE = '';
+$T2H_OPTIONS -> {Verbose} =
+{
+ type => '!',
+ linkage => \$T2H_VERBOSE,
+ verbose => 'print progress info to stdout',
+};
+
+# -lang
+# For page titles use $T2H_WORDS->{$T2H_LANG}->{...} as title.
+# To add a new language, supply list of titles (see $T2H_WORDS below).
+# and use ISO 639 language codes (see e.g. perl module Locale-Codes-1.02
+# for definitions)
+# Default's to 'en' if not set or no @documentlanguage is specified
+$T2H_LANG = '';
+$T2H_OPTIONS -> {lang} =
+{
+ type => '=s',
+ linkage => sub {SetDocumentLanguage($_[1])},
+ verbose => 'use $s as document language (ISO 639 encoding)',
+};
+
+# -l2h
+# if set, uses latex2html for generation of math content
+$T2H_L2H = '';
+$T2H_OPTIONS -> {l2h} =
+{
+ type => '!',
+ linkage => \$T2H_L2H,
+ verbose => 'if set, uses latex2html for @math and @tex',
+};
+
+######################
+# The following options are only relevant if $T2H_L2H is set
+#
+# -l2h_l2h
+# name/location of latex2html progam
+$T2H_L2H_L2H = "latex2html";
+$T2H_OPTIONS -> {l2h_l2h} =
+{
+ type => '=s',
+ linkage => \$T2H_L2H_L2H,
+ verbose => 'program to use for latex2html translation',
+ noHelp => 1,
+};
+
+# -l2h_skip
+# if set, skips actual call to latex2html tries to reuse previously generated
+# content, instead
+$T2H_L2H_SKIP = '';
+$T2H_OPTIONS -> {l2h_skip} =
+{
+ type => '!',
+ linkage => \$T2H_L2H_SKIP,
+ verbose => 'if set, tries to reuse previously latex2html output',
+ noHelp => 1,
+};
+
+# -l2h_tmp
+# if set, l2h uses this directory for temporarary files. The path
+# leading to this directory may not contain a dot (i.e., a "."),
+# otherwise, l2h will fail
+$T2H_L2H_TMP = '';
+$T2H_OPTIONS -> {l2h_tmp} =
+{
+ type => '=s',
+ linkage => \$T2H_L2H_TMP,
+ verbose => 'if set, uses $s as temporary latex2html directory',
+ noHelp => 1,
+};
+
+# if set, cleans intermediate files (they all have the prefix $doc_l2h_)
+# of l2h
+$T2H_L2H_CLEAN = 1;
+$T2H_OPTIONS -> {l2h_clean} =
+{
+ type => '!',
+ linkage => \$T2H_L2H_CLEAN,
+ verbose => 'if set, do not keep intermediate latex2html files for later reuse',
+ noHelp => 1,
+};
+
+$T2H_OPTIONS -> {D} =
+{
+ type => '=s',
+ linkage => sub {$main::value{@_[1]} = 1;},
+ verbose => 'equivalent to Texinfo "@set $s 1"',
+ noHelp => 1,
+};
+
+$T2H_OPTIONS -> {init_file} =
+{
+ type => '=s',
+ linkage => \&LoadInitFile,
+ verbose => 'load init file $s'
+};
+
+
+##############################################################################
+#
+# The following can only be set in the init file
+#
+##############################################################################
+
+# if set, center @image by default
+# otherwise, do not center by default
+$T2H_CENTER_IMAGE = 1;
+
+# used as identation for block enclosing command @example, etc
+# If not empty, must be enclosed in <td></td>
+$T2H_EXAMPLE_INDENT_CELL = '<td>&nbsp;</td>';
+# same as above, only for @small
+$T2H_SMALL_EXAMPLE_INDENT_CELL = '<td>&nbsp;</td>';
+# font size for @small
+$T2H_SMALL_FONT_SIZE = '-1';
+
+# if non-empty, and no @..heading appeared in Top node, then
+# use this as header for top node/section, otherwise use value of
+# @settitle or @shorttitle (in that order)
+$T2H_TOP_HEADING = '';
+
+# if set, use this chapter for 'Index' button, else
+# use first chapter whose name matches 'index' (case insensitive)
+$T2H_INDEX_CHAPTER = '';
+
+# if set and $T2H_SPLIT is set, then split index pages at the next letter
+# after they have more than that many entries
+$T2H_SPLIT_INDEX = 100;
+
+# if set (e.g., to index.html) replace hrefs to this file
+# (i.e., to index.html) by ./
+$T2H_HREF_DIR_INSTEAD_FILE = '';
+
+########################################################################
+# Language dependencies:
+# To add a new language extend T2H_WORDS hash and create $T2H_<...>_WORDS hash
+# To redefine one word, simply do:
+# $T2H_WORDS->{<language>}->{<word>} = 'whatever' in your personal init file.
+#
+$T2H_WORDS_EN =
+{
+ # titles of pages
+ 'ToC_Title' => 'Table of Contents',
+ 'Overview_Title' => 'Short Table of Contents',
+ 'Index_Title' => 'Index',
+ 'About_Title' => 'About this document',
+ 'Footnotes_Title' => 'Footnotes',
+ 'See' => 'See',
+ 'see' => 'see',
+ 'section' => 'section',
+# If necessary, we could extend this as follows:
+# # text for buttons
+# 'Top_Button' => 'Top',
+# 'ToC_Button' => 'Contents',
+# 'Overview_Button' => 'Overview',
+# 'Index_button' => 'Index',
+# 'Back_Button' => 'Back',
+# 'FastBack_Button' => 'FastBack',
+# 'Prev_Button' => 'Prev',
+# 'Up_Button' => 'Up',
+# 'Next_Button' => 'Next',
+# 'Forward_Button' =>'Forward',
+# 'FastWorward_Button' => 'FastForward',
+# 'First_Button' => 'First',
+# 'Last_Button' => 'Last',
+# 'About_Button' => 'About'
+};
+
+$T2H_WORD_DE =
+{
+ 'ToC_Title' => 'Inhaltsverzeichniss',
+ 'Overview_Title' => 'Kurzes Inhaltsverzeichniss',
+ 'Index_Title' => 'Index',
+ 'About_Title' => '&Uuml;ber dieses Dokument',
+ 'Footnotes_Title' => 'Fu&szlig;noten',
+ 'See' => 'Siehe',
+ 'see' => 'siehe',
+ 'section' => 'Abschnitt',
+};
+
+$T2H_WORD_NL =
+{
+ 'ToC_Title' => 'Inhoudsopgave',
+ 'Overview_Title' => 'Korte inhoudsopgave',
+ 'Index_Title' => 'Index', #Not sure ;-)
+ 'About_Title' => 'No translation available!', #No translation available!
+ 'Footnotes_Title' => 'No translation available!', #No translation available!
+ 'See' => 'Zie',
+ 'see' => 'zie',
+ 'section' => 'sectie',
+};
+
+$T2H_WORD_ES =
+{
+ 'ToC_Title' => '&iacute;ndice General',
+ 'Overview_Title' => 'Resumen del Contenido',
+ 'Index_Title' => 'Index', #Not sure ;-)
+ 'About_Title' => 'No translation available!', #No translation available!
+ 'Footnotes_Title' => 'Fu&szlig;noten',
+ 'See' => 'V&eacute;ase',
+ 'see' => 'v&eacute;ase',
+ 'section' => 'secci&oacute;n',
+};
+
+$T2H_WORD_NO =
+{
+ 'ToC_Title' => 'Innholdsfortegnelse',
+ 'Overview_Title' => 'Kort innholdsfortegnelse',
+ 'Index_Title' => 'Indeks', #Not sure ;-)
+ 'About_Title' => 'No translation available!', #No translation available!
+ 'Footnotes_Title' => 'No translation available!',
+ 'See' => 'Se',
+ 'see' => 'se',
+ 'section' => 'avsnitt',
+};
+
+$T2H_WORD_PT =
+{
+ 'ToC_Title' => 'Sum&aacute;rio',
+ 'Overview_Title' => 'Breve Sum&aacute;rio',
+ 'Index_Title' => '&Iacute;ndice', #Not sure ;-)
+ 'About_Title' => 'No translation available!', #No translation available!
+ 'Footnotes_Title' => 'No translation available!',
+ 'See' => 'Veja',
+ 'see' => 'veja',
+ 'section' => 'Se&ccedil;&atilde;o',
+};
+
+$T2H_WORDS =
+{
+ 'en' => $T2H_WORDS_EN,
+ 'de' => $T2H_WORDS_DE,
+ 'nl' => $T2H_WORDS_NL,
+ 'es' => $T2H_WORDS_ES,
+ 'no' => $T2H_WORDS_NO,
+ 'pt' => $T2H_WORDS_PT
+};
+
+@MONTH_NAMES_EN =
+(
+ 'January', 'February', 'March', 'April', 'May',
+ 'June', 'July', 'August', 'September', 'October',
+ 'November', 'December'
+);
+
+@MONTH_NAMES_DE =
+(
+ 'Januar', 'Februar', 'M&auml;rz', 'April', 'Mai',
+ 'Juni', 'Juli', 'August', 'September', 'Oktober',
+ 'November', 'Dezember'
+);
+
+@MONTH_NAMES_NL =
+(
+ 'Januari', 'Februari', 'Maart', 'April', 'Mei',
+ 'Juni', 'Juli', 'Augustus', 'September', 'Oktober',
+ 'November', 'December'
+);
+
+@MONTH_NAMES_ES =
+(
+ 'enero', 'febrero', 'marzo', 'abril', 'mayo',
+ 'junio', 'julio', 'agosto', 'septiembre', 'octubre',
+ 'noviembre', 'diciembre'
+);
+
+@MONTH_NAMES_NO =
+(
+
+ 'januar', 'februar', 'mars', 'april', 'mai',
+ 'juni', 'juli', 'august', 'september', 'oktober',
+ 'november', 'desember'
+);
+
+@MONTH_NAMES_PT =
+(
+ 'Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio',
+ 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro',
+ 'Novembro', 'Dezembro'
+);
+
+
+$MONTH_NAMES =
+{
+ 'en' => \@MONTH_NAMES_EN,
+ 'de' => \@MONTH_NAMES_DE,
+ 'es' => \@MONTH_NAMES_ES,
+ 'nl' => \@MONTH_NAMES_NL,
+ 'no' => \@MONTH_NAMES_NO,
+ 'pt' => \@MONTH_NAMES_PT
+};
+########################################################################
+# Control of Page layout:
+# You can make changes of the Page layout at two levels:
+# 1.) For small changes, it is often enough to change the value of
+# some global string/hash/array variables
+# 2.) For larger changes, reimplement one of the T2H_DEFAULT_<fnc>* routines,
+# give them another name, and assign them to the respective
+# $T2H_<fnc> variable.
+
+# As a general interface, the hashes T2H_HREF, T2H_NAME, T2H_NODE hold
+# href, html-name, node-name of
+# This -- current section (resp. html page)
+# Top -- top page ($T2H_TOP_FILE)
+# Contents -- Table of contents
+# Overview -- Short table of contents
+# Index -- Index page
+# About -- page which explain "navigation buttons"
+# First -- first node
+# Last -- last node
+#
+# Whether or not the following hash values are set, depends on the context
+# (all values are w.r.t. 'This' section)
+# Next -- next node of texinfo
+# Prev -- previous node of texinfo
+# Up -- up node of texinfo
+# Forward -- next node in reading order
+# Back -- previous node in reading order
+# FastForward -- if leave node, up and next, else next node
+# FastBackward-- if leave node, up and prev, else prev node
+#
+# Furthermore, the following global variabels are set:
+# $T2H_THISDOC{title} -- title as set by @setttile
+# $T2H_THISDOC{fulltitle} -- full title as set by @title...
+# $T2H_THISDOC{subtitle} -- subtitle as set by @subtitle
+# $T2H_THISDOC{author} -- author as set by @author
+#
+# and pointer to arrays of lines which need to be printed by t2h_print_lines
+# $T2H_OVERVIEW -- lines of short table of contents
+# $T2H_TOC -- lines of table of contents
+# $T2H_TOP -- lines of Top texinfo node
+# $T2H_THIS_SECTION -- lines of 'This' section
+
+#
+# There are the following subs which control the layout:
+#
+$T2H_print_section = \&T2H_DEFAULT_print_section;
+$T2H_print_Top_header = \&T2H_DEFAULT_print_Top_header;
+$T2H_print_Top_footer = \&T2H_DEFAULT_print_Top_footer;
+$T2H_print_Top = \&T2H_DEFAULT_print_Top;
+$T2H_print_Toc = \&T2H_DEFAULT_print_Toc;
+$T2H_print_Overview = \&T2H_DEFAULT_print_Overview;
+$T2H_print_Footnotes = \&T2H_DEFAULT_print_Footnotes;
+$T2H_print_About = \&T2H_DEFAULT_print_About;
+$T2H_print_misc_header = \&T2H_DEFAULT_print_misc_header;
+$T2H_print_misc_footer = \&T2H_DEFAULT_print_misc_footer;
+$T2H_print_misc = \&T2H_DEFAULT_print_misc;
+$T2H_print_chapter_header = \&T2H_DEFAULT_print_chapter_header;
+$T2H_print_chapter_footer = \&T2H_DEFAULT_print_chapter_footer;
+$T2H_print_page_head = \&T2H_DEFAULT_print_page_head;
+$T2H_print_page_foot = \&T2H_DEFAULT_print_page_foot;
+$T2H_print_head_navigation = \&T2H_DEFAULT_print_head_navigation;
+$T2H_print_foot_navigation = \&T2H_DEFAULT_print_foot_navigation;
+$T2H_button_icon_img = \&T2H_DEFAULT_button_icon_img;
+$T2H_print_navigation = \&T2H_DEFAULT_print_navigation;
+$T2H_about_body = \&T2H_DEFAULT_about_body;
+$T2H_print_frame = \&T2H_DEFAULT_print_frame;
+$T2H_print_toc_frame = \&T2H_DEFAULT_print_toc_frame;
+
+########################################################################
+# Layout for html for every sections
+#
+sub T2H_DEFAULT_print_section
+{
+ my $fh = shift;
+ local $T2H_BUTTONS = \@T2H_SECTION_BUTTONS;
+ &$T2H_print_head_navigation($fh) if $T2H_SECTION_NAVIGATION;
+ my $nw = t2h_print_lines($fh);
+ if ($T2H_SPLIT eq 'section' && $T2H_SECTION_NAVIGATION)
+ {
+ &$T2H_print_foot_navigation($fh, $nw);
+ }
+ else
+ {
+ print $fh '<HR SIZE="6">' . "\n";
+ }
+}
+
+###################################################################
+# Layout of top-page I recommend that you use @ifnothtml, @ifhtml,
+# @html within the Top texinfo node to specify content of top-level
+# page.
+#
+# If you enclose everything in @ifnothtml, then title, subtitle,
+# author and overview is printed
+# T2H_HREF of Next, Prev, Up, Forward, Back are not defined
+# if $T2H_SPLIT then Top page is in its own html file
+sub T2H_DEFAULT_print_Top_header
+{
+ &$T2H_print_page_head(@_) if $T2H_SPLIT;
+ t2h_print_label(@_); # this needs to be called, otherwise no label set
+ &$T2H_print_head_navigation(@_);
+}
+sub T2H_DEFAULT_print_Top_footer
+{
+ &$T2H_print_foot_navigation(@_);
+ &$T2H_print_page_foot(@_) if $T2H_SPLIT;
+}
+sub T2H_DEFAULT_print_Top
+{
+ my $fh = shift;
+
+ # for redefining navigation buttons use:
+ # local $T2H_BUTTONS = [...];
+ # as it is, 'Top', 'Contents', 'Index', 'About' are printed
+ local $T2H_BUTTONS = \@T2H_MISC_BUTTONS;
+ &$T2H_print_Top_header($fh);
+ if ($T2H_THIS_SECTION)
+ {
+ # if top-level node has content, then print it with extra header
+ print $fh "<H1>$T2H_NAME{Top}</H1>"
+ unless ($T2H_HAS_TOP_HEADING);
+ t2h_print_lines($fh, $T2H_THIS_SECTION)
+ }
+ else
+ {
+ # top-level node is fully enclosed in @ifnothtml
+ # print fulltitle, subtitle, author, Overview
+ print $fh
+ "<CENTER>\n<H1>" .
+ join("</H1>\n<H1>", split(/\n/, $T2H_THISDOC{fulltitle})) .
+ "</H1>\n";
+ print $fh "<H2>$T2H_THISDOC{subtitle}</H2>\n" if $T2H_THISDOC{subtitle};
+ print $fh "$T2H_THISDOC{author}\n" if $T2H_THISDOC{author};
+ print $fh <<EOT;
+</CENTER>
+<HR>
+<P></P>
+<H2> Overview: </H2>
+<BLOCKQUOTE>
+EOT
+ t2h_print_lines($fh, $T2H_OVERVIEW);
+ print $fh "</BLOCKQUOTE>\n";
+ }
+ &$T2H_print_Top_footer($fh);
+}
+
+###################################################################
+# Layout of Toc, Overview, and Footnotes pages
+# By default, we use "normal" layout
+# T2H_HREF of Next, Prev, Up, Forward, Back, etc are not defined
+# use: local $T2H_BUTTONS = [...] to redefine navigation buttons
+sub T2H_DEFAULT_print_Toc
+{
+ return &$T2H_print_misc(@_);
+}
+sub T2H_DEFAULT_print_Overview
+{
+ return &$T2H_print_misc(@_);
+}
+sub T2H_DEFAULT_print_Footnotes
+{
+ return &$T2H_print_misc(@_);
+}
+sub T2H_DEFAULT_print_About
+{
+ return &$T2H_print_misc(@_);
+}
+
+sub T2H_DEFAULT_print_misc_header
+{
+ &$T2H_print_page_head(@_) if $T2H_SPLIT;
+ # this needs to be called, otherwise, no labels are set
+ t2h_print_label(@_);
+ &$T2H_print_head_navigation(@_);
+}
+sub T2H_DEFAULT_print_misc_footer
+{
+ &$T2H_print_foot_navigation(@_);
+ &$T2H_print_page_foot(@_) if $T2H_SPLIT;
+}
+sub T2H_DEFAULT_print_misc
+{
+ my $fh = shift;
+ local $T2H_BUTTONS = \@T2H_MISC_BUTTONS;
+ &$T2H_print_misc_header($fh);
+ print $fh "<H1>$T2H_NAME{This}</H1>\n";
+ t2h_print_lines($fh);
+ &$T2H_print_misc_footer($fh);
+}
+
+###################################################################
+# chapter_header and chapter_footer are only called if
+# T2H_SPLIT eq 'chapter'
+# chapter_header: after print_page_header, before print_section
+# chapter_footer: after print_section of last section, before print_page_footer
+#
+# If you want to get rid of navigation stuff after each section,
+# redefine print_section such that it does not call print_navigation,
+# and put print_navigation into print_chapter_header
+@T2H_CHAPTER_BUTTONS =
+ (
+ 'FastBack', 'FastForward', ' ',
+ ' ', ' ', ' ', ' ',
+ 'Top', 'Contents', 'Index', 'About',
+ );
+
+sub T2H_DEFAULT_print_chapter_header
+{
+ # nothing to do there, by default
+ if (! $T2H_SECTION_NAVIGATION)
+ {
+ my $fh = shift;
+ local $T2H_BUTTONS = \@T2H_CHAPTER_BUTTONS;
+ &$T2H_print_navigation($fh);
+ print $fh "\n<HR SIZE=2>\n";
+ }
+}
+
+sub T2H_DEFAULT_print_chapter_footer
+{
+ local $T2H_BUTTONS = \@T2H_CHAPTER_BUTTONS;
+ &$T2H_print_navigation(@_);
+}
+###################################################################
+$T2H_TODAY = &pretty_date; # like "20 September 1993"
+
+sub pretty_date {
+ local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
+
+ ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
+ $year += ($year < 70) ? 2000 : 1900;
+ # obachman: Let's do it as the Americans do
+ return($MONTH_NAMES->{$T2H_LANG}[$mon] . ", " . $mday . " " . $year);
+}
+
+
+###################################################################
+# Layout of standard header and footer
+#
+
+# Set the default body text, inserted between <BODY ... >
+###$T2H_BODYTEXT = 'LANG="EN" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"';
+$T2H_BODYTEXT = 'LANG="' . $T2H_LANG . '" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"';
+# text inserted after <BODY ...>
+$T2H_AFTER_BODY_OPEN = '';
+#text inserted before </BODY>
+$T2H_PRE_BODY_CLOSE = '';
+# this is used in footer
+$T2H_ADDRESS = "by <I>$T2H_USER</I> " if $T2H_USER;
+$T2H_ADDRESS .= "on <I>$T2H_TODAY</I>";
+# this is added inside <HEAD></HEAD> after <TITLE> and some META NAME stuff
+# can be used for <style> <script>, <meta> tags
+$T2H_EXTRA_HEAD = '';
+
+sub T2H_DEFAULT_print_page_head
+{
+ my $fh = shift;
+ my $longtitle = "$T2H_THISDOC{title}: $T2H_NAME{This}";
+ print $fh <<EOT;
+<HTML>
+$T2H_DOCTYPE
+<!-- Created on $T2H_TODAY by $THISPROG -->
+<!--
+$T2H_AUTHORS
+-->
+<HEAD>
+<TITLE>$longtitle</TITLE>
+
+<META NAME="description" CONTENT="$longtitle">
+<META NAME="keywords" CONTENT="$longtitle">
+<META NAME="resource-type" CONTENT="document">
+<META NAME="distribution" CONTENT="global">
+<META NAME="Generator" CONTENT="$THISPROG">
+$T2H_EXTRA_HEAD
+</HEAD>
+
+<BODY $T2H_BODYTEXT>
+$T2H_AFTER_BODY_OPEN
+EOT
+}
+
+sub T2H_DEFAULT_print_page_foot
+{
+ my $fh = shift;
+ print $fh <<EOT;
+<BR>
+<FONT SIZE="-1">
+This document was generated
+$T2H_ADDRESS
+using <A HREF="$T2H_HOMEPAGE"><I>texi2html</I></A>
+$T2H_PRE_BODY_CLOSE
+</BODY>
+</HTML>
+EOT
+}
+
+###################################################################
+# Layout of navigation panel
+
+# if this is set, then a vertical navigation panel is used
+$T2H_VERTICAL_HEAD_NAVIGATION = 0;
+sub T2H_DEFAULT_print_head_navigation
+{
+ my $fh = shift;
+ if ($T2H_VERTICAL_HEAD_NAVIGATION)
+ {
+ print $fh <<EOT;
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
+<TR VALIGN="TOP">
+<TD ALIGN="LEFT">
+EOT
+ }
+ &$T2H_print_navigation($fh, $T2H_VERTICAL_HEAD_NAVIGATION);
+ if ($T2H_VERTICAL_HEAD_NAVIGATION)
+ {
+ print $fh <<EOT;
+</TD>
+<TD ALIGN="LEFT">
+EOT
+ }
+ elsif ($T2H_SPLIT eq 'section')
+ {
+ print $fh "<HR SIZE=1>\n";
+ }
+}
+
+# Specifies the minimum page length required before a navigation panel
+# is placed at the bottom of a page (the default is that of latex2html)
+# T2H_THIS_WORDS_IN_PAGE holds number of words of current page
+$T2H_WORDS_IN_PAGE = 300;
+sub T2H_DEFAULT_print_foot_navigation
+{
+ my $fh = shift;
+ my $nwords = shift;
+ if ($T2H_VERTICAL_HEAD_NAVIGATION)
+ {
+ print $fh <<EOT;
+</TD>
+</TR>
+</TABLE>
+EOT
+ }
+ print $fh "<HR SIZE=1>\n";
+ &$T2H_print_navigation($fh) if ($nwords >= $T2H_WORDS_IN_PAGE)
+}
+
+######################################################################
+# navigation panel
+#
+# specify in this array which "buttons" should appear in which order
+# in the navigation panel for sections; use ' ' for empty buttons (space)
+@T2H_SECTION_BUTTONS =
+ (
+ 'Back', 'Forward', ' ', 'FastBack', 'Up', 'FastForward',
+ ' ', ' ', ' ', ' ',
+ 'Top', 'Contents', 'Index', 'About',
+ );
+
+# buttons for misc stuff
+@T2H_MISC_BUTTONS = ('Top', 'Contents', 'Index', 'About');
+
+# insert here name of icon images for buttons
+# Icons are used, if $T2H_ICONS and resp. value are set
+%T2H_ACTIVE_ICONS =
+ (
+ 'Top', '',
+ 'Contents', '',
+ 'Overview', '',
+ 'Index', '',
+ 'Back', '',
+ 'FastBack', '',
+ 'Prev', '',
+ 'Up', '',
+ 'Next', '',
+ 'Forward', '',
+ 'FastForward', '',
+ 'About' , '',
+ 'First', '',
+ 'Last', '',
+ ' ', ''
+ );
+
+# insert here name of icon images for these, if button is inactive
+%T2H_PASSIVE_ICONS =
+ (
+ 'Top', '',
+ 'Contents', '',
+ 'Overview', '',
+ 'Index', '',
+ 'Back', '',
+ 'FastBack', '',
+ 'Prev', '',
+ 'Up', '',
+ 'Next', '',
+ 'Forward', '',
+ 'FastForward', '',
+ 'About', '',
+ 'First', '',
+ 'Last', '',
+ );
+
+# how to create IMG tag
+sub T2H_DEFAULT_button_icon_img
+{
+ my $button = shift;
+ my $icon = shift;
+ my $name = shift;
+ return qq{<IMG SRC="$icon" BORDER="0" ALT="$button: $name" ALIGN="MIDDLE">};
+}
+
+# Names of text as alternative for icons
+%T2H_NAVIGATION_TEXT =
+ (
+ 'Top', 'Top',
+ 'Contents', 'Contents',
+ 'Overview', 'Overview',
+ 'Index', 'Index',
+ ' ', ' &nbsp; ',
+ 'Back', ' &lt; ',
+ 'FastBack', ' &lt;&lt; ',
+ 'Prev', 'Prev',
+ 'Up', ' Up ',
+ 'Next', 'Next',
+ 'Forward', ' &gt; ',
+ 'FastForward', ' &gt;&gt; ',
+ 'About', ' ? ',
+ 'First', ' |&lt; ',
+ 'Last', ' &gt;| '
+ );
+
+sub T2H_DEFAULT_print_navigation
+{
+ my $fh = shift;
+ my $vertical = shift;
+ my $spacing = 1;
+ print $fh "<TABLE CELLPADDING=$spacing CELLSPACING=$spacing BORDER=0>\n";
+
+ print $fh "<TR>" unless $vertical;
+ for $button (@$T2H_BUTTONS)
+ {
+ print $fh qq{<TR VALIGN="TOP" ALIGN="LEFT">\n} if $vertical;
+ print $fh qq{<TD VALIGN="MIDDLE" ALIGN="LEFT">};
+
+ if (ref($button) eq 'CODE')
+ {
+ &$button($fh, $vertical);
+ }
+ elsif ($button eq ' ')
+ { # handle space button
+ print $fh
+ $T2H_ICONS && $T2H_ACTIVE_ICONS{' '} ?
+ &$T2H_button_icon_img($button, $T2H_ACTIVE_ICONS{' '}) :
+ $T2H_NAVIGATION_TEXT{' '};
+ next;
+ }
+ elsif ($T2H_HREF{$button})
+ { # button is active
+ print $fh
+ $T2H_ICONS && $T2H_ACTIVE_ICONS{$button} ? # use icon ?
+ t2h_anchor('', $T2H_HREF{$button}, # yes
+ &$T2H_button_icon_img($button,
+ $T2H_ACTIVE_ICONS{$button},
+ $T2H_NAME{$button}))
+ : # use text
+ "[" .
+ t2h_anchor('', $T2H_HREF{$button}, $T2H_NAVIGATION_TEXT{$button}) .
+ "]";
+ }
+ else
+ { # button is passive
+ print $fh
+ $T2H_ICONS && $T2H_PASSIVE_ICONS{$button} ?
+ &$T2H_button_icon_img($button,
+ $T2H_PASSIVE_ICONS{$button},
+ $T2H_NAME{$button}) :
+
+ "[" . $T2H_NAVIGATION_TEXT{$button} . "]";
+ }
+ print $fh "</TD>\n";
+ print $fh "</TR>\n" if $vertical;
+ }
+ print $fh "</TR>" unless $vertical;
+ print $fh "</TABLE>\n";
+}
+
+######################################################################
+# Frames: this is from "Richard Y. Kim" <ryk@coho.net>
+# Should be improved to be more conforming to other _print* functions
+
+sub T2H_DEFAULT_print_frame
+{
+ my $fh = shift;
+ print $fh <<EOT;
+<HTML>
+<HEAD><TITLE>$T2H_THISDOC{title}</TITLE></HEAD>
+<FRAMESET cols="140,*">
+ <FRAME name=toc src="$docu_toc_frame_file">
+ <FRAME name=main src="$docu_doc">
+</FRAMESET>
+</HTML>
+EOT
+}
+
+sub T2H_DEFAULT_print_toc_frame
+{
+ my $fh = shift;
+ &$T2H_print_page_head($fh);
+ print $fh <<EOT;
+<H2>Content</H2>
+EOT
+ print $fh map {s/HREF=/target=\"main\" HREF=/; $_;} @stoc_lines;
+ print $fh "</BODY></HTML>\n";
+}
+
+######################################################################
+# About page
+#
+
+# T2H_PRE_ABOUT might be a function
+$T2H_PRE_ABOUT = <<EOT;
+This document was generated $T2H_ADDRESS
+using <A HREF="$T2H_HOMEPAGE"><I>texi2html</I></A>
+<P></P>
+EOT
+$T2H_AFTER_ABOUT = '';
+
+sub T2H_DEFAULT_about_body
+{
+ my $about;
+ if (ref($T2H_PRE_ABOUT) eq 'CODE')
+ {
+ $about = &$T2H_PRE_ABOUT();
+ }
+ else
+ {
+ $about = $T2H_PRE_ABOUT;
+ }
+ $about .= <<EOT;
+The buttons in the navigation panels have the following meaning:
+<P></P>
+<table border = "1">
+<TR>
+<TH> Button </TH>
+<TH> Name </TH>
+<TH> Go to </TH>
+<TH> From 1.2.3 go to</TH>
+</TR>
+EOT
+
+ for $button (@T2H_SECTION_BUTTONS)
+ {
+ next if $button eq ' ' || ref($button) eq 'CODE';
+ $about .= <<EOT;
+<TR>
+<TD ALIGN="CENTER">
+EOT
+ $about .=
+ ($T2H_ICONS && $T2H_ACTIVE_ICONS{$button} ?
+ &$T2H_button_icon_img($button, $T2H_ACTIVE_ICONS{$button}) :
+ " [" . $T2H_NAVIGATION_TEXT{$button} . "] ");
+ $about .= <<EOT;
+</TD>
+<TD ALIGN="CENTER">
+$button
+</TD>
+<TD>
+$T2H_BUTTONS_GOTO{$button}
+</TD>
+<TD>
+$T2H_BUTTONS_EXAMPLE{$button}
+</TD>
+</TR>
+EOT
+ }
+
+ $about .= <<EOT;
+</TABLE>
+<P></P>
+where the <STRONG> Example </STRONG> assumes that the current position
+is at <STRONG> Subsubsection One-Two-Three </STRONG> of a document of
+the following structure:
+<UL>
+<LI> 1. Section One </LI>
+<UL>
+<LI>1.1 Subsection One-One</LI>
+<UL>
+<LI> ... </LI>
+</UL>
+<LI>1.2 Subsection One-Two</LI>
+<UL>
+<LI>1.2.1 Subsubsection One-Two-One
+</LI><LI>1.2.2 Subsubsection One-Two-Two
+</LI><LI>1.2.3 Subsubsection One-Two-Three &nbsp; &nbsp; <STRONG>
+&lt;== Current Position </STRONG>
+</LI><LI>1.2.4 Subsubsection One-Two-Four
+</LI></UL>
+<LI>1.3 Subsection One-Three</LI>
+<UL>
+<LI> ... </LI>
+</UL>
+<LI>1.4 Subsection One-Four</LI>
+</UL>
+</UL>
+$T2H_AFTER_ABOUT
+EOT
+ return $about;
+}
+
+
+%T2H_BUTTONS_GOTO =
+ (
+ 'Top', 'cover (top) of document',
+ 'Contents', 'table of contents',
+ 'Overview', 'short table of contents',
+ 'Index', 'concept index',
+ 'Back', 'previous section in reading order',
+ 'FastBack', 'previous or up-and-previous section ',
+ 'Prev', 'previous section same level',
+ 'Up', 'up section',
+ 'Next', 'next section same level',
+ 'Forward', 'next section in reading order',
+ 'FastForward', 'next or up-and-next section',
+ 'About' , 'this page',
+ 'First', 'first section in reading order',
+ 'Last', 'last section in reading order',
+ );
+
+%T2H_BUTTONS_EXAMPLE =
+(
+ 'Top', ' &nbsp; ',
+ 'Contents', ' &nbsp; ',
+ 'Overview', ' &nbsp; ',
+ 'Index', ' &nbsp; ',
+ 'Back', '1.2.2',
+ 'FastBack', '1.1',
+ 'Prev', '1.2.2',
+ 'Up', '1.2',
+ 'Next', '1.2.4',
+ 'Forward', '1.2.4',
+ 'FastForward', '1.3',
+ 'About', ' &nbsp; ',
+ 'First', '1.',
+ 'Last', '1.2.4',
+);
+
+
+######################################################################
+# from here on, its l2h init stuff
+#
+
+## initialization for latex2html as for Singular manual generation
+## obachman 3/99
+
+#
+# Options controlling Titles, File-Names, Tracing and Sectioning
+#
+$TITLE = '';
+
+$SHORTEXTN = 0;
+
+$LONG_TITLES = 0;
+
+$DESTDIR = ''; # should be overwritten by cmd-line argument
+
+$NO_SUBDIR = 0;# should be overwritten by cmd-line argument
+
+$PREFIX = ''; # should be overwritten by cmd-line argument
+
+$AUTO_PREFIX = 0; # this is needed, so that prefix settings are used
+
+$AUTO_LINK = 0;
+
+$SPLIT = 0;
+
+$MAX_LINK_DEPTH = 0;
+
+$TMP = ''; # should be overwritten by cmd-line argument
+
+$DEBUG = 0;
+
+$VERBOSE = 1;
+
+#
+# Options controlling Extensions and Special Features
+#
+$HTML_VERSION = "3.2";
+
+$TEXDEFS = 1; # we absolutely need that
+
+$EXTERNAL_FILE = '';
+
+$SCALABLE_FONTS = 1;
+
+$NO_SIMPLE_MATH = 1;
+
+$LOCAL_ICONS = 1;
+
+$SHORT_INDEX = 0;
+
+$NO_FOOTNODE = 1;
+
+$ADDRESS = '';
+
+$INFO = '';
+
+#
+# Switches controlling Image Generation
+#
+$ASCII_MODE = 0;
+
+$NOLATEX = 0;
+
+$EXTERNAL_IMAGES = 0;
+
+$PS_IMAGES = 0;
+
+$NO_IMAGES = 0;
+
+$IMAGES_ONLY = 0;
+
+$REUSE = 2;
+
+$ANTI_ALIAS = 1;
+
+$ANTI_ALIAS_TEXT = 1;
+
+#
+#Switches controlling Navigation Panels
+#
+$NO_NAVIGATION = 1;
+$ADDRESS = '';
+$INFO = 0; # 0 = do not make a "About this document..." section
+
+#
+#Switches for Linking to other documents
+#
+# actuall -- we don't care
+
+$MAX_SPLIT_DEPTH = 0; # Stop making separate files at this depth
+
+$MAX_LINK_DEPTH = 0; # Stop showing child nodes at this depth
+
+$NOLATEX = 0; # 1 = do not pass unknown environments to Latex
+
+$EXTERNAL_IMAGES = 0; # 1 = leave the images outside the document
+
+$ASCII_MODE = 0; # 1 = do not use any icons or internal images
+
+# 1 = use links to external postscript images rather than inlined bitmap
+# images.
+$PS_IMAGES = 0;
+$SHOW_SECTION_NUMBERS = 0;
+
+### Other global variables ###############################################
+$CHILDLINE = "";
+
+# This is the line width measured in pixels and it is used to right justify
+# equations and equation arrays;
+$LINE_WIDTH = 500;
+
+# Used in conjunction with AUTO_NAVIGATION
+$WORDS_IN_PAGE = 300;
+
+# Affects ONLY the way accents are processed
+$default_language = 'english';
+
+# The value of this variable determines how many words to use in each
+# title that is added to the navigation panel (see below)
+#
+$WORDS_IN_NAVIGATION_PANEL_TITLES = 0;
+
+# This number will determine the size of the equations, special characters,
+# and anything which will be converted into an inlined image
+# *except* "image generating environments" such as "figure", "table"
+# or "minipage".
+# Effective values are those greater than 0.
+# Sensible values are between 0.1 - 4.
+$MATH_SCALE_FACTOR = 1.5;
+
+# This number will determine the size of
+# image generating environments such as "figure", "table" or "minipage".
+# Effective values are those greater than 0.
+# Sensible values are between 0.1 - 4.
+$FIGURE_SCALE_FACTOR = 1.6;
+
+
+# If both of the following two variables are set then the "Up" button
+# of the navigation panel in the first node/page of a converted document
+# will point to $EXTERNAL_UP_LINK. $EXTERNAL_UP_TITLE should be set
+# to some text which describes this external link.
+$EXTERNAL_UP_LINK = "";
+$EXTERNAL_UP_TITLE = "";
+
+# If this is set then the resulting HTML will look marginally better if viewed
+# with Netscape.
+$NETSCAPE_HTML = 1;
+
+# Valid paper sizes are "letter", "legal", "a4","a3","a2" and "a0"
+# Paper sizes has no effect other than in the time it takes to create inlined
+# images and in whether large images can be created at all ie
+# - larger paper sizes *MAY* help with large image problems
+# - smaller paper sizes are quicker to handle
+$PAPERSIZE = "a4";
+
+# Replace "english" with another language in order to tell LaTeX2HTML that you
+# want some generated section titles (eg "Table of Contents" or "References")
+# to appear in a different language. Currently only "english" and "french"
+# is supported but it is very easy to add your own. See the example in the
+# file "latex2html.config"
+$TITLES_LANGUAGE = "english";
+
+1; # This must be the last non-comment line
+
+# End File texi2html.init
+######################################################################
+
+
+require "$ENV{T2H_HOME}/texi2html.init"
+ if ($0 =~ /\.pl$/ &&
+ -e "$ENV{T2H_HOME}/texi2html.init" && -r "$ENV{T2H_HOME}/texi2html.init");
+
+#+++############################################################################
+# #
+# Initialization #
+# Pasted content of File $(srcdir)/MySimple.pm: Command-line processing #
+# #
+#---############################################################################
+
+# leave this within comments, and keep the require statement
+# This way, you can directly run texi2html.pl, if $ENV{T2H_HOME}/texi2html.init
+# exists.
+
+#
+package Getopt::MySimple;
+
+# Name:
+# Getopt::MySimple.
+#
+# Documentation:
+# POD-style (incomplete) documentation is in file MySimple.pod
+#
+# Tabs:
+# 4 spaces || die.
+#
+# Author:
+# Ron Savage rpsavage@ozemail.com.au.
+# 1.00 19-Aug-97 Initial version.
+# 1.10 13-Oct-97 Add arrays of switches (eg '=s@').
+# 1.20 3-Dec-97 Add 'Help' on a per-switch basis.
+# 1.30 11-Dec-97 Change 'Help' to 'verbose'. Make all hash keys lowercase.
+# 1.40 10-Nov-98 Change width of help report. Restructure tests.
+# 1-Jul-00 Modifications for Texi2html
+
+# --------------------------------------------------------------------------
+# Locally modified by obachman (Display type instead of env, order by cmp)
+# $Id: MySimple.pm,v 1.1 2000/07/03 08:44:13 obachman Exp $
+
+# use strict;
+# no strict 'refs';
+
+use vars qw(@EXPORT @EXPORT_OK @ISA);
+use vars qw($fieldWidth $opt $VERSION);
+
+use Exporter();
+use Getopt::Long;
+
+@ISA = qw(Exporter);
+@EXPORT = qw();
+@EXPORT_OK = qw($opt); # An alias for $self -> {'opt'}.
+
+# --------------------------------------------------------------------------
+
+$fieldWidth = 20;
+$VERSION = '1.41';
+
+# --------------------------------------------------------------------------
+
+sub byOrder
+{
+ my($self) = @_;
+
+ return uc($a) cmp (uc($b));
+}
+
+# --------------------------------------------------------------------------
+
+sub dumpOptions
+{
+ my($self) = @_;
+
+ print 'Option', ' ' x ($fieldWidth - length('Option') ), "Value\n";
+
+ for (sort byOrder keys(%{$self -> {'opt'} }) )
+ {
+ print "-$_", ' ' x ($fieldWidth - (1 + length) ), "${$self->{'opt'} }{$_}\n";
+ }
+
+ print "\n";
+
+} # End of dumpOptions.
+
+# --------------------------------------------------------------------------
+# Return:
+# 0 -> Error.
+# 1 -> Ok.
+
+sub getOptions
+{
+ push(@_, 0) if ($#_ == 2); # Default for $ignoreCase is 0.
+ push(@_, 1) if ($#_ == 3); # Default for $helpThenExit is 1.
+
+ my($self, $default, $helpText, $versionText,
+ $helpThenExit, $versionThenExit, $ignoreCase) = @_;
+
+ $helpThenExit = 1 unless (defined($helpThenExit));
+ $versionThenExit = 1 unless (defined($versionThenExit));
+ $ignoreCase = 0 unless (defined($ignoreCase));
+
+ $self -> {'default'} = $default;
+ $self -> {'helpText'} = $helpText;
+ $self -> {'versionText'} = $versionText;
+ $Getopt::Long::ignorecase = $ignoreCase;
+
+ unless (defined($self -> {'default'}{'help'}))
+ {
+ $self -> {'default'}{'help'} =
+ {
+ type => ':i',
+ default => '',
+ linkage => sub {$self->helpOptions($_[1]); exit (0) if $helpThenExit;},
+ verbose => "print help and exit"
+ };
+ }
+
+ unless (defined($self -> {'default'}{'version'}))
+ {
+ $self -> {'default'}{'version'} =
+ {
+ type => '',
+ default => '',
+ linkage => sub {print $self->{'versionText'}; exit (0) if versionTheExit;},
+ verbose => "print version and exit"
+ };
+ }
+
+ for (keys(%{$self -> {'default'} }) )
+ {
+ my $type = ${$self -> {'default'} }{$_}{'type'};
+ push(@{$self -> {'type'} }, "$_$type");
+ $self->{'opt'}->{$_} = ${$self -> {'default'} }{$_}{'linkage'}
+ if ${$self -> {'default'} }{$_}{'linkage'};
+ }
+
+ my($result) = &GetOptions($self -> {'opt'}, @{$self -> {'type'} });
+
+ return $result unless $result;
+
+ for (keys(%{$self -> {'default'} }) )
+ {
+ if (! defined(${$self -> {'opt'} }{$_})) #{
+ {
+ ${$self -> {'opt'} }{$_} = ${$self -> {'default'} }{$_}{'default'};
+ }
+ }
+
+ $result;
+} # End of getOptions.
+
+# --------------------------------------------------------------------------
+
+sub helpOptions
+{
+ my($self) = shift;
+ my($noHelp) = shift;
+ $noHelp = 0 unless $noHelp;
+ my($optwidth, $typewidth, $defaultwidth, $maxlinewidth, $valind, $valwidth)
+ = (10, 5, 9, 78, 4, 11);
+
+ print "$self->{'helpText'}" if ($self -> {'helpText'});
+
+ print ' Option', ' ' x ($optwidth - length('Option') -1 ),
+ 'Type', ' ' x ($typewidth - length('Type') + 1),
+ 'Default', ' ' x ($defaultwidth - length('Default') ),
+ "Description\n";
+
+ for (sort byOrder keys(%{$self -> {'default'} }) )
+ {
+ my($line, $help, $option, $val);
+ $option = $_;
+ next if ${$self->{'default'} }{$_}{'noHelp'} && ${$self->{'default'} }{$_}{'noHelp'} > $noHelp;
+ $line = " -$_ " . ' ' x ($optwidth - (2 + length) ) .
+ "${$self->{'default'} }{$_}{'type'} ".
+ ' ' x ($typewidth - (1+length(${$self -> {'default'} }{$_}{'type'}) ));
+
+ $val = ${$self->{'default'} }{$_}{'linkage'};
+ if ($val)
+ {
+ if (ref($val) eq 'SCALAR')
+ {
+ $val = $$val;
+ }
+ else
+ {
+ $val = '';
+ }
+ }
+ else
+ {
+ $val = ${$self->{'default'} }{$_}{'default'};
+ }
+ $line .= "$val ";
+ $line .= ' ' x ($optwidth + $typewidth + $defaultwidth + 1 - length($line));
+
+ if (defined(${$self -> {'default'} }{$_}{'verbose'}) &&
+ ${$self -> {'default'} }{$_}{'verbose'} ne '')
+ {
+ $help = "${$self->{'default'} }{$_}{'verbose'}";
+ }
+ else
+ {
+ $help = ' ';
+ }
+ if ((length("$line") + length($help)) < $maxlinewidth)
+ {
+ print $line , $help, "\n";
+ }
+ else
+ {
+ print $line, "\n", ' ' x $valind, $help, "\n";
+ }
+ for $val (sort byOrder keys(%{${$self->{'default'}}{$option}{'values'}}))
+ {
+ print ' ' x ($valind + 2);
+ print $val, ' ', ' ' x ($valwidth - length($val) - 2);
+ print ${$self->{'default'}}{$option}{'values'}{$val}, "\n";
+ }
+ }
+
+ print <<EOT;
+Note: 'Options' may be abbreviated. 'Type' specifications mean:
+ <none>| ! no argument: variable is set to 1 on -foo (or, to 0 on -nofoo)
+ =s | :s mandatory (or, optional) string argument
+ =i | :i mandatory (or, optional) integer argument
+EOT
+} # End of helpOptions.
+
+#-------------------------------------------------------------------
+
+sub new
+{
+ my($class) = @_;
+ my($self) = {};
+ $self -> {'default'} = {};
+ $self -> {'helpText'} = '';
+ $self -> {'opt'} = {};
+ $opt = $self -> {'opt'}; # An alias for $self -> {'opt'}.
+ $self -> {'type'} = ();
+
+ return bless $self, $class;
+
+} # End of new.
+
+# --------------------------------------------------------------------------
+
+1;
+
+# End MySimple.pm
+
+require "$ENV{T2H_HOME}/MySimple.pm"
+ if ($0 =~ /\.pl$/ &&
+ -e "$ENV{T2H_HOME}/texi2html.init" && -r "$ENV{T2H_HOME}/texi2html.init");
+
+package main;
+
+#+++############################################################################
+# #
+# Constants #
+# #
+#---############################################################################
+
+$DEBUG_TOC = 1;
+$DEBUG_INDEX = 2;
+$DEBUG_BIB = 4;
+$DEBUG_GLOSS = 8;
+$DEBUG_DEF = 16;
+$DEBUG_HTML = 32;
+$DEBUG_USER = 64;
+$DEBUG_L2H = 128;
+
+
+$BIBRE = '\[[\w\/-]+\]'; # RE for a bibliography reference
+$FILERE = '[\/\w.+-]+'; # RE for a file name
+$VARRE = '[^\s\{\}]+'; # RE for a variable name
+$NODERE = '[^,:]+'; # RE for a node name
+$NODESRE = '[^:]+'; # RE for a list of node names
+
+$ERROR = "***"; # prefix for errors
+$WARN = "**"; # prefix for warnings
+
+ # program home page
+$PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections
+
+$CHAPTEREND = "<!-- End chapter -->\n"; # to know where a chpater ends
+$SECTIONEND = "<!-- End section -->\n"; # to know where section ends
+$TOPEND = "<!-- End top -->\n"; # to know where top ends
+
+
+
+#
+# pre-defined indices
+#
+$index_properties =
+{
+ 'c' => { name => 'cp'},
+ 'f' => { name => 'fn', code => 1},
+ 'v' => { name => 'vr', code => 1},
+ 'k' => { name => 'ky', code => 1},
+ 'p' => { name => 'pg', code => 1},
+ 't' => { name => 'tp', code => 1}
+};
+
+
+%predefined_index = (
+ 'cp', 'c',
+ 'fn', 'f',
+ 'vr', 'v',
+ 'ky', 'k',
+ 'pg', 'p',
+ 'tp', 't',
+ );
+
+#
+# valid indices
+#
+%valid_index = (
+ 'c', 1,
+ 'f', 1,
+ 'v', 1,
+ 'k', 1,
+ 'p', 1,
+ 't', 1,
+ );
+
+#
+# texinfo section names to level
+#
+%sec2level = (
+ 'top', 0,
+ 'chapter', 1,
+ 'unnumbered', 1,
+ 'majorheading', 1,
+ 'chapheading', 1,
+ 'appendix', 1,
+ 'section', 2,
+ 'unnumberedsec', 2,
+ 'heading', 2,
+ 'appendixsec', 2,
+ 'appendixsection', 2,
+ 'subsection', 3,
+ 'unnumberedsubsec', 3,
+ 'subheading', 3,
+ 'appendixsubsec', 3,
+ 'subsubsection', 4,
+ 'unnumberedsubsubsec', 4,
+ 'subsubheading', 4,
+ 'appendixsubsubsec', 4,
+ );
+
+#
+# accent map, TeX command to ISO name
+#
+%accent_map = (
+ '"', 'uml',
+ '~', 'tilde',
+ '^', 'circ',
+ '`', 'grave',
+ '\'', 'acute',
+ );
+
+#
+# texinfo "simple things" (@foo) to HTML ones
+#
+%simple_map = (
+ # cf. makeinfo.c
+ "*", "<BR>", # HTML+
+ " ", " ",
+ "\t", " ",
+ "-", "&#173;", # soft hyphen
+ "\n", "\n",
+ "|", "",
+ 'tab', '<\/TD><TD>',
+ # spacing commands
+ ":", "",
+ "!", "!",
+ "?", "?",
+ ".", ".",
+ "-", "",
+ );
+
+#
+# texinfo "things" (@foo{}) to HTML ones
+#
+%things_map = (
+ 'TeX', 'TeX',
+ 'br', '<P>', # paragraph break
+ 'bullet', '*',
+ 'copyright', '(C)',
+ 'dots', '<small>...<\/small>',
+ 'enddots', '<small>....<\/small>',
+ 'equiv', '==',
+ 'error', 'error-->',
+ 'expansion', '==>',
+ 'minus', '-',
+ 'point', '-!-',
+ 'print', '-|',
+ 'result', '=>',
+ 'today', $T2H_TODAY,
+ 'aa', '&aring;',
+ 'AA', '&Aring;',
+ 'ae', '&aelig;',
+ 'oe', '&#156;',
+ 'AE', '&AElig;',
+ 'OE', '&#140;',
+ 'o', '&oslash;',
+ 'O', '&Oslash;',
+ 'ss', '&szlig;',
+ 'l', '\/l',
+ 'L', '\/L',
+ 'exclamdown', '&iexcl;',
+ 'questiondown', '&iquest;',
+ 'pounds', '&pound;'
+ );
+
+#
+# texinfo styles (@foo{bar}) to HTML ones
+#
+%style_map = (
+ 'acronym', '&do_acronym',
+ 'asis', '',
+ 'b', 'B',
+ 'cite', 'CITE',
+ 'code', 'CODE',
+ 'command', 'CODE',
+ 'ctrl', '&do_ctrl', # special case
+ 'dfn', 'EM', # DFN tag is illegal in the standard
+ 'dmn', '', # useless
+ 'email', '&do_email', # insert a clickable email address
+ 'emph', 'EM',
+ 'env', 'CODE',
+ 'file', '"TT', # will put quotes, cf. &apply_style
+ 'i', 'I',
+ 'kbd', 'KBD',
+ 'key', 'KBD',
+ 'math', '&do_math',
+ 'option', '"SAMP', # will put quotes, cf. &apply_style
+ 'r', '', # unsupported
+ 'samp', '"SAMP', # will put quotes, cf. &apply_style
+ 'sc', '&do_sc', # special case
+ 'strong', 'STRONG',
+ 't', 'TT',
+ 'titlefont', '', # useless
+ 'uref', '&do_uref', # insert a clickable URL
+ 'url', '&do_url', # insert a clickable URL
+ 'var', 'VAR',
+ 'w', '', # unsupported
+ 'H', '&do_accent',
+ 'dotaccent', '&do_accent',
+ 'ringaccent','&do_accent',
+ 'tieaccent', '&do_accent',
+ 'u','&do_accent',
+ 'ubaraccent','&do_accent',
+ 'udotaccent','&do_accent',
+ 'v', '&do_accent',
+ ',', '&do_accent',
+ 'dotless', '&do_accent'
+ );
+
+#
+# texinfo format (@foo/@end foo) to HTML ones
+#
+%format_map = (
+ 'quotation', 'BLOCKQUOTE',
+ # lists
+ 'itemize', 'UL',
+ 'enumerate', 'OL',
+ # poorly supported
+ 'flushleft', 'PRE',
+ 'flushright', 'PRE',
+ );
+
+#
+# an eval of these $complex_format_map->{what}->[0] yields beginning
+# an eval of these $complex_format_map->{what}->[1] yieleds end
+$complex_format_map =
+{
+ example =>
+ [
+ q{"<TABLE><tr>$T2H_EXAMPLE_INDENT_CELL<td class=example><pre>"},
+ q{'</pre></td></tr></table>'}
+ ],
+ smallexample =>
+ [
+ q{"<TABLE><tr>$T2H_SMALL_EXAMPLE_INDENT_CELL<td class=smallexample><FONT SIZE=$T2H_SMALL_FONT_SIZE><pre>"},
+ q{'</FONT></pre></td></tr></table>'}
+ ],
+ display =>
+ [
+ q{"<TABLE><tr>$T2H_EXAMPLE_INDENT_CELL<td class=display><pre " . 'style="font-family: serif">'},
+ q{'</pre></td></tr></table>'}
+ ],
+ smalldisplay =>
+ [
+ q{"<TABLE><tr>$T2H_SMALL_EXAMPLE_INDENT_CELL<td class=smalldisplay><FONT SIZE=$T2H_SMALL_FONT_SIZE><pre " . 'style="font-family: serif">'},
+ q{'</pre></FONT></td></tr></table>'}
+ ]
+};
+
+$complex_format_map->{lisp} = $complex_format_map->{example};
+$complex_format_map->{smalllisp} = $complex_format_map->{smallexample};
+$complex_format_map->{format} = $complex_format_map->{display};
+$complex_format_map->{smallformat} = $complex_format_map->{smalldisplay};
+
+#
+# texinfo definition shortcuts to real ones
+#
+%def_map = (
+ # basic commands
+ 'deffn', 0,
+ 'defvr', 0,
+ 'deftypefn', 0,
+ 'deftypevr', 0,
+ 'defcv', 0,
+ 'defop', 0,
+ 'deftp', 0,
+ # basic x commands
+ 'deffnx', 0,
+ 'defvrx', 0,
+ 'deftypefnx', 0,
+ 'deftypevrx', 0,
+ 'defcvx', 0,
+ 'defopx', 0,
+ 'deftpx', 0,
+ # shortcuts
+ 'defun', 'deffn Function',
+ 'defmac', 'deffn Macro',
+ 'defspec', 'deffn {Special Form}',
+ 'defvar', 'defvr Variable',
+ 'defopt', 'defvr {User Option}',
+ 'deftypefun', 'deftypefn Function',
+ 'deftypevar', 'deftypevr Variable',
+ 'defivar', 'defcv {Instance Variable}',
+ 'deftypeivar', 'defcv {Instance Variable}', # NEW: FIXME
+ 'defmethod', 'defop Method',
+ 'deftypemethod', 'defop Method', # NEW:FIXME
+ # x shortcuts
+ 'defunx', 'deffnx Function',
+ 'defmacx', 'deffnx Macro',
+ 'defspecx', 'deffnx {Special Form}',
+ 'defvarx', 'defvrx Variable',
+ 'defoptx', 'defvrx {User Option}',
+ 'deftypefunx', 'deftypefnx Function',
+ 'deftypevarx', 'deftypevrx Variable',
+ 'defivarx', 'defcvx {Instance Variable}',
+ 'defmethodx', 'defopx Method',
+ );
+
+#
+# things to skip
+#
+%to_skip = (
+ # comments
+ 'c', 1,
+ 'comment', 1,
+ 'ifnotinfo', 1,
+ 'ifnottex', 1,
+ 'ifhtml', 1,
+ 'end ifhtml', 1,
+ 'end ifnotinfo', 1,
+ 'end ifnottex', 1,
+ # useless
+ 'detailmenu', 1,
+ 'direntry', 1,
+ 'contents', 1,
+ 'shortcontents', 1,
+ 'summarycontents', 1,
+ 'footnotestyle', 1,
+ 'end ifclear', 1,
+ 'end ifset', 1,
+ 'titlepage', 1,
+ 'end titlepage', 1,
+ # unsupported commands (formatting)
+ 'afourpaper', 1,
+ 'cropmarks', 1,
+ 'finalout', 1,
+ 'headings', 1,
+ 'sp', 1,
+ 'need', 1,
+ 'page', 1,
+ 'setchapternewpage', 1,
+ 'everyheading', 1,
+ 'everyfooting', 1,
+ 'evenheading', 1,
+ 'evenfooting', 1,
+ 'oddheading', 1,
+ 'oddfooting', 1,
+ 'smallbook', 1,
+ 'vskip', 1,
+ 'filbreak', 1,
+ 'paragraphindent', 1,
+ # unsupported formats
+ 'cartouche', 1,
+ 'end cartouche', 1,
+ 'group', 1,
+ 'end group', 1,
+ );
+
+#+++############################################################################
+# #
+# Argument parsing, initialisation #
+# #
+#---############################################################################
+
+#
+# flush stdout and stderr after every write
+#
+select(STDERR);
+$| = 1;
+select(STDOUT);
+$| = 1;
+
+
+%value = (); # hold texinfo variables, see also -D
+$use_bibliography = 1;
+$use_acc = 1;
+
+#
+# called on -init-file
+sub LoadInitFile
+{
+ my $init_file = shift;
+ # second argument is value of options
+ $init_file = shift;
+ if (-f $init_file)
+ {
+ print "# reading initialization file from $init_file\n"
+ if ($T2H_VERBOSE);
+ require($init_file);
+ }
+ else
+ {
+ print "$ERROR Error: can't read init file $int_file\n";
+ $init_file = '';
+ }
+}
+
+#
+# called on -lang
+sub SetDocumentLanguage
+{
+ my $lang = shift;
+ if (! exists($T2H_WORDS->{$lang}))
+ {
+ warn "$ERROR: Language specs for '$lang' do not exists. Reverting to '" .
+ ($T2H_LANG ? T2H_LANG : "en") . "'\n";
+ }
+ else
+ {
+ print "# using '$lang' as document language\n" if ($T2H_VERBOSE);
+ $T2H_LANG = $lang;
+ }
+}
+
+##
+## obsolete cmd line options
+##
+$T2H_OBSOLETE_OPTIONS -> {'no-section_navigation'} =
+{
+ type => '!',
+ linkage => sub {$main::T2H_SECTION_NAVIGATION = 0;},
+ verbose => 'obsolete, use -nosec_nav',
+ noHelp => 2,
+};
+$T2H_OBSOLETE_OPTIONS -> {use_acc} =
+{
+ type => '!',
+ linkage => \$use_acc,
+ verbose => 'obsolete',
+ noHelp => 2
+};
+$T2H_OBSOLETE_OPTIONS -> {expandinfo} =
+{
+ type => '!',
+ linkage => sub {$main::T2H_EXPAND = 'info';},
+ verbose => 'obsolete, use "-expand info" instead',
+ noHelp => 2,
+};
+$T2H_OBSOLETE_OPTIONS -> {expandtex} =
+{
+ type => '!',
+ linkage => sub {$main::T2H_EXPAND = 'tex';},
+ verbose => 'obsolete, use "-expand tex" instead',
+ noHelp => 2,
+};
+$T2H_OBSOLETE_OPTIONS -> {monolithic} =
+{
+ type => '!',
+ linkage => sub {$main::T2H_SPLIT = '';},
+ verbose => 'obsolete, use "-split no" instead',
+ noHelp => 2
+};
+$T2H_OBSOLETE_OPTIONS -> {split_node} =
+{
+ type => '!',
+ linkage => sub{$main::T2H_SPLIT = 'section';},
+ verbose => 'obsolete, use "-split section" instead',
+ noHelp => 2,
+};
+$T2H_OBSOLETE_OPTIONS -> {split_chapter} =
+{
+ type => '!',
+ linkage => sub{$main::T2H_SPLIT = 'chapter';},
+ verbose => 'obsolete, use "-split chapter" instead',
+ noHelp => 2,
+};
+$T2H_OBSOLETE_OPTIONS -> {no_verbose} =
+{
+ type => '!',
+ linkage => sub {$main::T2H_VERBOSE = 0;},
+ verbose => 'obsolete, use -noverbose instead',
+ noHelp => 2,
+};
+$T2H_OBSOLETE_OPTIONS -> {output_file} =
+{
+ type => '=s',
+ linkage => sub {$main::T2H_OUT = @_[1]; $T2H_SPLIT = '';},
+ verbose => 'obsolete, use -out_file instead',
+ noHelp => 2
+};
+
+$T2H_OBSOLETE_OPTIONS -> {section_navigation} =
+{
+ type => '!',
+ linkage => \$T2H_SECTION_NAVIGATION,
+ verbose => 'obsolete, use -sec_nav instead',
+ noHelp => 2,
+};
+
+$T2H_OBSOLETE_OPTIONS -> {verbose} =
+{
+ type => '!',
+ linkage => \$T2H_VERBOSE,
+ verbose => 'obsolete, use -Verbose instead',
+ noHelp => 2
+};
+
+# read initialzation from $sysconfdir/texi2htmlrc or $HOME/.texi2htmlrc
+my $home = $ENV{HOME};
+defined($home) or $home = '';
+foreach $i ('/usr/local/etc/texi2htmlrc', "$home/.texi2htmlrc") {
+ if (-f $i) {
+ print "# reading initialization file from $i\n"
+ if ($T2H_VERBOSE);
+ require($i);
+ }
+}
+
+
+#+++############################################################################
+# #
+# parse command-line options
+# #
+#---############################################################################
+$T2H_USAGE_TEXT = <<EOT;
+Usage: texi2html [OPTIONS] TEXINFO-FILE
+Translates Texinfo source documentation to HTML.
+EOT
+$T2H_FAILURE_TEXT = <<EOT;
+Try 'texi2html -help' for usage instructions.
+EOT
+$options = new Getopt::MySimple;
+
+# some older version of GetOpt::Long don't have
+# Getopt::Long::Configure("pass_through")
+eval {Getopt::Long::Configure("pass_through");};
+$Configure_failed = $@ && <<EOT;
+**WARNING: Parsing of obsolete command-line options could have failed.
+ Consider to use only documented command-line options (run
+ 'texi2html -help 2' for a complete list) or upgrade to perl
+ version 5.005 or higher.
+EOT
+
+if (! $options->getOptions($T2H_OPTIONS, $T2H_USAGE_TEXT, "$THISVERSION\n"))
+{
+ print $Configure_failed if $Configure_failed;
+ die $T2H_FAILURE_TEXT;
+}
+
+if (@ARGV > 1)
+{
+ eval {Getopt::Long::Configure("no_pass_through");};
+ if (! $options->getOptions($T2H_OBSOLETE_OPTIONS, $T2H_USAGE_TEXT, "$THISVERSION\n"))
+ {
+ print $Configure_failed if $Configure_failed;
+ die $T2H_FAILURE_TEXT;
+ }
+}
+
+if ($T2H_CHECK) {
+ die "Need file to check\n$T2H_FAILURE_TEXT" unless @ARGV > 0;
+ &check;
+ exit;
+}
+
+#+++############################################################################
+# #
+# evaluation of cmd line options
+# #
+#---############################################################################
+
+if ($T2H_EXPAND eq 'info')
+{
+ $to_skip{'ifinfo'} = 1;
+ $to_skip{'end ifinfo'} = 1;
+}
+elsif ($T2H_EXPAND eq 'tex')
+{
+ $to_skip{'iftex'} = 1;
+ $to_skip{'end iftex'} = 1;
+
+}
+
+$T2H_INVISIBLE_MARK = '<IMG SRC="invisible.xbm">' if $T2H_INVISIBLE_MARK eq 'xbm';
+
+#
+# file name buisness
+#
+die "Need exactly one file to translate\n$T2H_FAILURE_TEXT" unless @ARGV == 1;
+$docu = shift(@ARGV);
+if ($docu =~ /.*\//) {
+ chop($docu_dir = $&);
+ $docu_name = $';
+} else {
+ $docu_dir = '.';
+ $docu_name = $docu;
+}
+unshift(@T2H_INCLUDE_DIRS, $docu_dir);
+$docu_name =~ s/\.te?x(i|info)?$//; # basename of the document
+$docu_name = $T2H_PREFIX if ($T2H_PREFIX);
+
+# subdir
+if ($T2H_SUBDIR && ! $T2H_OUT)
+{
+ $T2H_SUBDIR =~ s|/*$||;
+ unless (-d "$T2H_SUBDIR" && -w "$T2H_SUBDIR")
+ {
+ if ( mkdir($T2H_SUBDIR, oct(755)))
+ {
+ print "# created directory $T2H_SUBDIR\n" if ($T2H_VERBOSE);
+ }
+ else
+ {
+ warn "$ERROR can't create directory $T2H_SUBDIR. Put results into current directory\n";
+ $T2H_SUBDIR = '';
+ }
+ }
+}
+
+if ($T2H_SUBDIR && ! $T2H_OUT)
+{
+ $docu_rdir = "$T2H_SUBDIR/";
+ print "# putting result files into directory $docu_rdir\n" if ($T2H_VERBOSE);
+}
+else
+{
+ if ($T2H_OUT && $T2H_OUT =~ m|(.*)/|)
+ {
+ $docu_rdir = "$1/";
+ print "# putting result files into directory $docu_rdir\n" if ($T2H_VERBOSE);
+ }
+ else
+ {
+ print "# putting result files into current directory \n" if ($T2H_VERBOSE);
+ $docu_rdir = '';
+ }
+}
+
+# extension
+if ($T2H_SHORTEXTN)
+{
+ $docu_ext = "htm";
+}
+else
+{
+ $docu_ext = "html";
+}
+if ($T2H_TOP_FILE =~ /\..*$/)
+{
+ $T2H_TOP_FILE = $`.".$docu_ext";
+}
+
+# result files
+if (! $T2H_OUT && ($T2H_SPLIT =~ /section/i || $T2H_SPLIT =~ /node/i))
+{
+ $T2H_SPLIT = 'section';
+}
+elsif (! $T2H_OUT && $T2H_SPLIT =~ /chapter/i)
+{
+ $T2H_SPLIT = 'chapter'
+}
+else
+{
+ undef $T2H_SPLIT;
+}
+
+$docu_doc = "$docu_name.$docu_ext"; # document's contents
+$docu_doc_file = "$docu_rdir$docu_doc";
+if ($T2H_SPLIT)
+{
+ $docu_toc = $T2H_TOC_FILE || "${docu_name}_toc.$docu_ext"; # document's table of contents
+ $docu_stoc = "${docu_name}_ovr.$docu_ext"; # document's short toc
+ $docu_foot = "${docu_name}_fot.$docu_ext"; # document's footnotes
+ $docu_about = "${docu_name}_abt.$docu_ext"; # about this document
+ $docu_top = $T2H_TOP_FILE || $docu_doc;
+}
+else
+{
+ if ($T2H_OUT)
+ {
+ $docu_doc = $T2H_OUT;
+ $docu_doc =~ s|.*/||;
+ }
+ $docu_toc = $docu_foot = $docu_stoc = $docu_about = $docu_top = $docu_doc;
+}
+
+$docu_toc_file = "$docu_rdir$docu_toc";
+$docu_stoc_file = "$docu_rdir$docu_stoc";
+$docu_foot_file = "$docu_rdir$docu_foot";
+$docu_about_file = "$docu_rdir$docu_about";
+$docu_top_file = "$docu_rdir$docu_top";
+
+$docu_frame_file = "$docu_rdir${docu_name}_frame.$docu_ext";
+$docu_toc_frame_file = "$docu_rdir${docu_name}_toc_frame.$docu_ext";
+
+#
+# variables
+#
+$value{'html'} = 1; # predefine html (the output format)
+$value{'texi2html'} = $THISVERSION; # predefine texi2html (the translator)
+# _foo: internal to track @foo
+foreach ('_author', '_title', '_subtitle',
+ '_settitle', '_setfilename', '_shorttitle') {
+ $value{$_} = ''; # prevent -w warnings
+}
+%node2sec = (); # node to section name
+%sec2node = (); # section to node name
+%sec2number = (); # section to number
+%number2sec = (); # number to section
+%idx2node = (); # index keys to node
+%node2href = (); # node to HREF
+%node2next = (); # node to next
+%node2prev = (); # node to prev
+%node2up = (); # node to up
+%bib2href = (); # bibliography reference to HREF
+%gloss2href = (); # glossary term to HREF
+@sections = (); # list of sections
+%tag2pro = (); # protected sections
+
+#
+# initial indexes
+#
+$bib_num = 0;
+$foot_num = 0;
+$gloss_num = 0;
+$idx_num = 0;
+$sec_num = 0;
+$doc_num = 0;
+$html_num = 0;
+
+#
+# can I use ISO8879 characters? (HTML+)
+#
+if ($T2H_USE_ISO) {
+ $things_map{'bullet'} = "&bull;";
+ $things_map{'copyright'} = "&copy;";
+ $things_map{'dots'} = "&hellip;";
+ $things_map{'equiv'} = "&equiv;";
+ $things_map{'expansion'} = "&rarr;";
+ $things_map{'point'} = "&lowast;";
+ $things_map{'result'} = "&rArr;";
+}
+
+#
+# read texi2html extensions (if any)
+#
+$extensions = 'texi2html.ext'; # extensions in working directory
+if (-f $extensions) {
+ print "# reading extensions from $extensions\n" if $T2H_VERBOSE;
+ require($extensions);
+}
+($progdir = $0) =~ s/[^\/]+$//;
+if ($progdir && ($progdir ne './')) {
+ $extensions = "${progdir}texi2html.ext"; # extensions in texi2html directory
+ if (-f $extensions) {
+ print "# reading extensions from $extensions\n" if $T2H_VERBOSE;
+ require($extensions);
+ }
+}
+
+
+print "# reading from $docu\n" if $T2H_VERBOSE;
+
+#########################################################################
+#
+# latex2html stuff
+#
+# latex2html conversions consist of three stages:
+# 1) ToLatex: Put "latex" code into a latex file
+# 2) ToHtml: Use latex2html to generate corresponding html code and images
+# 3) FromHtml: Extract generated code and images from latex2html run
+#
+
+##########################
+# default settings
+#
+
+# defaults for files and names
+
+sub l2h_Init
+{
+ local($root) = @_;
+
+ return 0 unless ($root);
+
+ $l2h_name = "${root}_l2h";
+
+ $l2h_latex_file = "$docu_rdir${l2h_name}.tex";
+ $l2h_cache_file = "${docu_rdir}l2h_cache.pm";
+ $T2H_L2H_L2H = "latex2html" unless ($T2H_L2H_L2H);
+
+ # destination dir -- generated images are put there, should be the same
+ # as dir of enclosing html document --
+ $l2h_html_file = "$docu_rdir${l2h_name}.html";
+ $l2h_prefix = "${l2h_name}_";
+ return 1;
+}
+
+
+##########################
+#
+# First stage: Generation of Latex file
+# Initialize with: l2h_InitToLatex
+# Add content with: l2h_ToLatex($text) --> HTML placeholder comment
+# Finish with: l2h_FinishToLatex
+#
+
+$l2h_latex_preample = <<EOT;
+% This document was automatically generated by the l2h extenstion of texi2html
+% DO NOT EDIT !!!
+\\documentclass{article}
+\\usepackage{html}
+\\begin{document}
+EOT
+
+$l2h_latex_closing = <<EOT;
+\\end{document}
+EOT
+
+# return used latex 1, if l2h could be initalized properly, 0 otherwise
+sub l2h_InitToLatex
+{
+ %l2h_to_latex = ();
+ unless ($T2H_L2H_SKIP)
+ {
+ unless (open(L2H_LATEX, ">$l2h_latex_file"))
+ {
+ warn "$ERROR Error l2h: Can't open latex file '$latex_file' for writing\n";
+ return 0;
+ }
+ print "# l2h: use ${l2h_latex_file} as latex file\n" if ($T2H_VERBOSE);
+ print L2H_LATEX $l2h_latex_preample;
+ }
+ # open database for caching
+ l2h_InitCache();
+ $l2h_latex_count = 0;
+ $l2h_to_latex_count = 0;
+ $l2h_cached_count = 0;
+ return 1;
+}
+
+# print text (1st arg) into latex file (if not already there), return
+# HTML commentary which can be later on replaced by the latex2html
+# generated text
+sub l2h_ToLatex
+{
+ my($text) = @_;
+ my($count);
+
+ $l2h_to_latex_count++;
+ $text =~ s/(\s*)$//;
+
+ # try whether we can cache it
+ my $cached_text = l2h_FromCache($text);
+ if ($cached_text)
+ {
+ $l2h_cached_count++;
+ return $cached_text;
+ }
+
+ # try whether we have text already on things to do
+ unless ($count = $l2h_to_latex{$text})
+ {
+ $count = $l2h_latex_count;
+ $l2h_latex_count++;
+ $l2h_to_latex{$text} = $count;
+ $l2h_to_latex[$count] = $text;
+ unless ($T2H_L2H_SKIP)
+ {
+ print L2H_LATEX "\\begin{rawhtml}\n";
+ print L2H_LATEX "<!-- l2h_begin ${l2h_name} ${count} -->\n";
+ print L2H_LATEX "\\end{rawhtml}\n";
+
+ print L2H_LATEX "$text\n";
+
+ print L2H_LATEX "\\begin{rawhtml}\n";
+ print L2H_LATEX "<!-- l2h_end ${l2h_name} ${count} -->\n";
+ print L2H_LATEX "\\end{rawhtml}\n";
+ }
+ }
+ return "<!-- l2h_replace ${l2h_name} ${count} -->";
+}
+
+# print closing into latex file and close it
+sub l2h_FinishToLatex
+{
+ local ($reused);
+
+ $reused = $l2h_to_latex_count - $l2h_latex_count - $l2h_cached_count;
+ unless ($T2H_L2H_SKIP)
+ {
+ print L2H_LATEX $l2h_latex_closing;
+ close(L2H_LATEX);
+ }
+ print "# l2h: finished to latex ($l2h_cached_count cached, $reused reused, $l2h_latex_count contents)\n" if ($T2H_VERBOSE);
+ unless ($l2h_latex_count)
+ {
+ l2h_Finish();
+ return 0;
+ }
+ return 1;
+}
+
+###################################
+# Second stage: Use latex2html to generate corresponding html code and images
+#
+# l2h_ToHtml([$l2h_latex_file, [$l2h_html_dir]]):
+# Call latex2html on $l2h_latex_file
+# Put images (prefixed with $l2h_name."_") and html file(s) in $l2h_html_dir
+# Return 1, on success
+# 0, otherwise
+#
+sub l2h_ToHtml
+{
+ local($call, $ext, $root, $dotbug);
+
+ if ($T2H_L2H_SKIP)
+ {
+ print "# l2h: skipping latex2html run\n" if ($T2H_VERBOSE);
+ return 1;
+ }
+
+ # Check for dot in directory where dvips will work
+ if ($T2H_L2H_TMP)
+ {
+ if ($T2H_L2H_TMP =~ /\./)
+ {
+ warn "$ERROR Warning l2h: l2h_tmp dir contains a dot. Use /tmp, instead\n";
+ $dotbug = 1;
+ }
+ }
+ else
+ {
+ if (&getcwd =~ /\./)
+ {
+ warn "$ERROR Warning l2h: current dir contains a dot. Use /tmp as l2h_tmp dir \n";
+ $dotbug = 1;
+ }
+ }
+ # fix it, if necessary and hope that it works
+ $T2H_L2H_TMP = "/tmp" if ($dotbug);
+
+ $call = $T2H_L2H_L2H;
+ # use init file, if specified
+ $call = $call . " -init_file " . $init_file if ($init_file && -f $init_file);
+ # set output dir
+ $call .= ($docu_rdir ? " -dir $docu_rdir" : " -no_subdir");
+ # use l2h_tmp, if specified
+ $call = $call . " -tmp $T2H_L2H_TMP" if ($T2H_L2H_TMP);
+ # options we want to be sure of
+ $call = $call ." -address 0 -info 0 -split 0 -no_navigation -no_auto_link";
+ $call = $call ." -prefix ${l2h_prefix} $l2h_latex_file";
+
+ print "# l2h: executing '$call'\n" if ($T2H_VERBOSE);
+ if (system($call))
+ {
+ warn "l2h ***Error: '${call}' did not succeed\n";
+ return 0;
+ }
+ else
+ {
+ print "# l2h: latex2html finished successfully\n" if ($T2H_VERBOSE);
+ return 1;
+ }
+}
+
+# this is directly pasted over from latex2html
+sub getcwd {
+ local($_) = `pwd`;
+
+ die "'pwd' failed (out of memory?)\n"
+ unless length;
+ chop;
+ $_;
+}
+
+
+##########################
+# Third stage: Extract generated contents from latex2html run
+# Initialize with: l2h_InitFromHtml
+# open $l2h_html_file for reading
+# reads in contents into array indexed by numbers
+# return 1, on success -- 0, otherwise
+# Extract Html code with: l2h_FromHtml($text)
+# replaces in $text all previosuly inserted comments by generated html code
+# returns (possibly changed) $text
+# Finish with: l2h_FinishFromHtml
+# closes $l2h_html_dir/$l2h_name.".$docu_ext"
+
+sub l2h_InitFromHtml
+{
+ local($h_line, $h_content, $count, %l2h_img);
+
+ if (! open(L2H_HTML, "<${l2h_html_file}"))
+ {
+ print "$ERROR Error l2h: Can't open ${l2h_html_file} for reading\n";
+ return 0;
+ }
+ print "# l2h: use ${l2h_html_file} as html file\n" if ($T2H_VERBOSE);
+
+ $l2h_html_count = 0;
+
+ while ($h_line = <L2H_HTML>)
+ {
+ if ($h_line =~ /^<!-- l2h_begin $l2h_name ([0-9]+) -->/)
+ {
+ $count = $1;
+ $h_content = "";
+ while ($h_line = <L2H_HTML>)
+ {
+ if ($h_line =~ /^<!-- l2h_end $l2h_name $count -->/)
+ {
+ chomp $h_content;
+ chomp $h_content;
+ $l2h_html_count++;
+ $h_content = l2h_ToCache($count, $h_content);
+ $l2h_from_html[$count] = $h_content;
+ $h_content = '';
+ last;
+ }
+ $h_content = $h_content.$h_line;
+ }
+ if ($hcontent)
+ {
+ print "$ERROR Warning l2h: l2h_end $l2h_name $count not found\n"
+ if ($T2H_VERBOSE);
+ close(L2H_HTML);
+ return 0;
+ }
+ }
+ }
+ print "# l2h: Got $l2h_html_count of $l2h_latex_count html contents\n"
+ if ($T2H_VERBOSE);
+
+ close(L2H_HTML);
+ return 1;
+}
+
+sub l2h_FromHtml
+{
+ local($text) = @_;
+ local($done, $to_do, $count);
+
+ $to_do = $text;
+
+ while ($to_do =~ /([^\000]*)<!-- l2h_replace $l2h_name ([0-9]+) -->([^\000]*)/)
+ {
+ $to_do = $1;
+ $count = $2;
+ $done = $3.$done;
+
+ $done = "<!-- l2h_end $l2h_name $count -->".$done
+ if ($T2H_DEBUG & $DEBUG_L2H);
+
+ $done = &l2h_ExtractFromHtml($count) . $done;
+
+ $done = "<!-- l2h_begin $l2h_name $count -->".$done
+ if ($T2H_DEBUG & $DEBUG_L2H);
+ }
+ return $to_do.$done;
+}
+
+
+sub l2h_ExtractFromHtml
+{
+ local($count) = @_;
+
+ return $l2h_from_html[$count] if ($l2h_from_html[$count]);
+
+ if ($count >= 0 && $count < $l2h_latex_count)
+ {
+ # now we are in trouble
+ local($l_l2h, $_);
+
+ $l2h_extract_error++;
+ print "$ERROR l2h: can't extract content $count from html\n"
+ if ($T2H_VERBOSE);
+ # try simple (ordinary) substition (without l2h)
+ $l_l2h = $T2H_L2H;
+ $T2H_L2H = 0;
+ $_ = $l2h_to_latex{$count};
+ $_ = &substitute_style($_);
+ &unprotect_texi;
+ $_ = "<!-- l2h: ". __LINE__ . " use texi2html -->" . $_
+ if ($T2H_DEBUG & $DEBUG_L2H);
+ $T2H_L2H = $l_l2h;
+ return $_;
+ }
+ else
+ {
+ # now we have been incorrectly called
+ $l2h_range_error++;
+ print "$ERROR l2h: Request of $count content which is out of valide range [0,$l2h_latex_count)\n";
+ return "<!-- l2h: ". __LINE__ . " out of range count $count -->"
+ if ($T2H_DEBUG & $DEBUG_L2H);
+ return "<!-- l2h: out of range count $count -->";
+ }
+}
+
+sub l2h_FinishFromHtml
+{
+ if ($T2H_VERBOSE)
+ {
+ if ($l2h_extract_error + $l2h_range_error)
+ {
+ print "# l2h: finished from html ($l2h_extract_error extract and $l2h_range_error errors)\n";
+ }
+ else
+ {
+ print "# l2h: finished from html (no errors)\n";
+ }
+ }
+}
+
+sub l2h_Finish
+{
+ l2h_StoreCache();
+ if ($T2H_L2H_CLEAN)
+ {
+ print "# l2h: removing temporary files generated by l2h extension\n"
+ if $T2H_VERBOSE;
+ while (<"$docu_rdir$l2h_name"*>)
+ {
+ unlink $_;
+ }
+ }
+ print "# l2h: Finished\n" if $T2H_VERBOSE;
+ return 1;
+}
+
+##############################
+# stuff for l2h caching
+#
+
+# I tried doing this with a dbm data base, but it did not store all
+# keys/values. Hence, I did as latex2html does it
+sub l2h_InitCache
+{
+ if (-r "$l2h_cache_file")
+ {
+ my $rdo = do "$l2h_cache_file";
+ warn("$ERROR l2h Error: could not load $docu_rdir$l2h_cache_file: $@\n")
+ unless ($rdo);
+ }
+}
+
+sub l2h_StoreCache
+{
+ return unless $l2h_latex_count;
+
+ my ($key, $value);
+ open(FH, ">$l2h_cache_file") || return warn"$ERROR l2h Error: could not open $docu_rdir$l2h_cache_file for writing: $!\n";
+
+
+ while (($key, $value) = each %l2h_cache)
+ {
+ # escape stuff
+ $key =~ s|/|\\/|g;
+ $key =~ s|\\\\/|\\/|g;
+ # weird, a \ at the end of the key results in an error
+ # maybe this also broke the dbm database stuff
+ $key =~ s|\\$|\\\\|;
+ $value =~ s/\|/\\\|/g;
+ $value =~ s/\\\\\|/\\\|/g;
+ $value =~ s|\\\\|\\\\\\\\|g;
+ print FH "\n\$l2h_cache_key = q/$key/;\n";
+ print FH "\$l2h_cache{\$l2h_cache_key} = q|$value|;\n";
+ }
+ print FH "1;";
+ close(FH);
+}
+
+# return cached html, if it exists for text, and if all pictures
+# are there, as well
+sub l2h_FromCache
+{
+ my $text = shift;
+ my $cached = $l2h_cache{$text};
+ if ($cached)
+ {
+ while ($cached =~ m/SRC="(.*?)"/g)
+ {
+ unless (-e "$docu_rdir$1")
+ {
+ return undef;
+ }
+ }
+ return $cached;
+ }
+ return undef;
+}
+
+# insert generated html into cache, move away images,
+# return transformed html
+$maximage = 1;
+sub l2h_ToCache
+{
+ my $count = shift;
+ my $content = shift;
+ my @images = ($content =~ /SRC="(.*?)"/g);
+ my ($src, $dest);
+
+ for $src (@images)
+ {
+ $dest = $l2h_img{$src};
+ unless ($dest)
+ {
+ my $ext;
+ if ($src =~ /.*\.(.*)$/ && $1 ne $docu_ext)
+ {
+ $ext = $1;
+ }
+ else
+ {
+ warn "$ERROR: L2h image $src has invalid extension\n";
+ next;
+ }
+ while (-e "$docu_rdir${docu_name}_$maximage.$ext") { $maximage++;}
+ $dest = "${docu_name}_$maximage.$ext";
+ system("cp -f $docu_rdir$src $docu_rdir$dest");
+ $l2h_img{$src} = $dest;
+ unlink "$docu_rdir$src" unless ($DEBUG & DEBUG_L2H);
+ }
+ $content =~ s/$src/$dest/g;
+ }
+ $l2h_cache{$l2h_to_latex[$count]} = $content;
+ return $content;
+}
+
+
+#+++############################################################################
+# #
+# Pass 1: read source, handle command, variable, simple substitution #
+# #
+#---############################################################################
+
+@lines = (); # whole document
+@toc_lines = (); # table of contents
+@stoc_lines = (); # table of contents
+$curlevel = 0; # current level in TOC
+$node = ''; # current node name
+$node_next = ''; # current node next name
+$node_prev = ''; # current node prev name
+$node_up = ''; # current node up name
+$in_table = 0; # am I inside a table
+$table_type = ''; # type of table ('', 'f', 'v', 'multi')
+@tables = (); # nested table support
+$in_bibliography = 0; # am I inside a bibliography
+$in_glossary = 0; # am I inside a glossary
+$in_top = 0; # am I inside the top node
+$has_top = 0; # did I see a top node?
+$has_top_command = 0; # did I see @top for automatic pointers?
+$in_pre = 0; # am I inside a preformatted section
+$in_list = 0; # am I inside a list
+$in_html = 0; # am I inside an HTML section
+$first_line = 1; # is it the first line
+$dont_html = 0; # don't protect HTML on this line
+$deferred_ref = ''; # deferred reference for indexes
+@html_stack = (); # HTML elements stack
+$html_element = ''; # current HTML element
+&html_reset;
+%macros = (); # macros
+
+# init l2h
+$T2H_L2H = &l2h_Init($docu_name) if ($T2H_L2H);
+$T2H_L2H = &l2h_InitToLatex if ($T2H_L2H);
+
+# build code for simple substitutions
+# the maps used (%simple_map and %things_map) MUST be aware of this
+# watch out for regexps, / and escaped characters!
+$subst_code = '';
+foreach (keys(%simple_map)) {
+ ($re = $_) =~ s/(\W)/\\$1/g; # protect regexp chars
+ $subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n";
+}
+foreach (keys(%things_map)) {
+ $subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n";
+}
+if ($use_acc) {
+ # accentuated characters
+ foreach (keys(%accent_map)) {
+ if ($_ eq "`") {
+ $subst_code .= "s/$;3";
+ } elsif ($_ eq "'") {
+ $subst_code .= "s/$;4";
+ } else {
+ $subst_code .= "s/\\\@\\$_";
+ }
+ $subst_code .= "([a-z])/&\${1}$accent_map{$_};/gi;\n";
+ }
+}
+eval("sub simple_substitutions { $subst_code }");
+
+&init_input;
+INPUT_LINE: while ($_ = &next_line) {
+ #
+ # remove \input on the first lines only
+ #
+ if ($first_line) {
+ next if /^\\input/;
+ $first_line = 0;
+ }
+ # non-@ substitutions cf. texinfmt.el
+ #
+ # parse texinfo tags
+ #
+ $tag = '';
+ $end_tag = '';
+ if (/^\s*\@end\s+(\w+)\b/) {
+ $end_tag = $1;
+ } elsif (/^\s*\@(\w+)\b/) {
+ $tag = $1;
+ }
+ #
+ # handle @html / @end html
+ #
+ if ($in_html) {
+ if ($end_tag eq 'html') {
+ $in_html = 0;
+ } else {
+ $tag2pro{$in_html} .= $_;
+ }
+ next;
+ } elsif ($tag eq 'html') {
+ $in_html = $PROTECTTAG . ++$html_num;
+ push(@lines, $in_html);
+ next;
+ }
+
+ #
+ # try to remove inlined comments
+ # syntax from tex-mode.el comment-start-skip
+ #
+ s/((^|[^\@])(\@\@)*)\@c(omment | |\{|$).*/$1/;
+
+# Sometimes I use @c right at the end of a line ( to suppress the line feed )
+# s/((^|[^\@])(\@\@)*)\@c(omment)?$/$1/;
+# s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/;
+# s/(.*)\@c{.*?}(.*)/$1$2/;
+# s/(.*)\@comment{.*?}(.*)/$1$2/;
+# s/^(.*)\@c /$1/;
+# s/^(.*)\@comment /$1/;
+
+ #############################################################
+ # value substitution before macro expansion, so that
+ # it works in macro arguments
+ s/\@value{($VARRE)}/$value{$1}/eg;
+
+ #############################################################
+ # macro substitution
+ while (/\@(\w+)/g)
+ {
+ if (exists($macros->{$1}))
+ {
+ my $before = $`;
+ my $name = $1;
+ my $after = $';
+ my @args;
+ my $args;
+ if ($after =~ /^\s*{(.*?[^\\])}(.*)/)
+ {
+ $args = $1;
+ $after = $2;
+ }
+ elsif (@{$macros->{$name}->{Args}} == 1)
+ {
+ $args = $after;
+ $args =~ s/^\s*//;
+ $args =~ s/\s*$//;
+ $after = '';
+ }
+ $args =~ s|\\\\|\\|g;
+ $args =~ s|\\{|{|g;
+ $args =~ s|\\}|}|g;
+ if (@{$macros->{$name}->{Args}} > 1)
+ {
+ $args =~ s/(^|[^\\]),/$1$;/g ;
+ $args =~ s|\\,|,|g;
+ @args = split(/$;\s*/, $args) if (@{$macros->{$name}->{Args}} > 1);
+ }
+ else
+ {
+ $args =~ s|\\,|,|g;
+ @args = ($args);
+ }
+ my $macrobody = $macros->{$name}->{Body};
+ for ($i=0; $i<=$#args; $i++)
+ {
+ $macrobody =~ s|\\$macros->{$name}->{Args}->[$i]\\|$args[$i]|g;
+ }
+ $macrobody =~ s|\\\\|\\|g;
+ $_ = $before . $macrobody . $after;
+ unshift @input_spool, map {$_ = $_."\n"} split(/\n/, $_);
+ next INPUT_LINE;
+ }
+ } #
+
+
+ #
+ # try to skip the line
+ #
+ if ($end_tag) {
+ $in_titlepage = 0 if $end_tag eq 'titlepage';
+ next if $to_skip{"end $end_tag"};
+ } elsif ($tag) {
+ $in_titlepage = 1 if $tag eq 'titlepage';
+ next if $to_skip{$tag};
+ last if $tag eq 'bye';
+ }
+ if ($in_top) {
+ # parsing the top node
+ if ($tag eq 'node' ||
+ ($sec2level{$tag} && $tag !~ /unnumbered/ && $tag !~ /heading/))
+ {
+ # no more in top
+ $in_top = 0;
+ push(@lines, $TOPEND);
+ }
+ }
+ unless ($in_pre) {
+ s/``/\"/g;
+ s/''/\"/g;
+ s/([\w ])---([\w ])/$1--$2/g;
+ }
+ #
+ # analyze the tag
+ #
+ if ($tag) {
+ # skip lines
+ &skip_until($tag), next if $tag eq 'ignore';
+ &skip_until($tag), next if $tag eq 'ifnothtml';
+ if ($tag eq 'ifinfo')
+ {
+ &skip_until($tag), next unless $T2H_EXPAND eq 'info';
+ }
+ if ($tag eq 'iftex')
+ {
+ &skip_until($tag), next unless $T2H_EXPAND eq 'tex';
+ }
+ if ($tag eq 'tex')
+ {
+ # add to latex2html file
+ if ($T2H_EXPAND eq 'tex' && $T2H_L2H && ! $in_pre)
+ {
+ # add space to the end -- tex(i2dvi) does this, as well
+ push(@lines, &l2h_ToLatex(&string_until($tag) . " "));
+ }
+ else
+ {
+ &skip_until($tag);
+ }
+ next;
+ }
+ if ($tag eq 'titlepage')
+ {
+ next;
+ }
+ # handle special tables
+ if ($tag =~ /^(|f|v|multi)table$/) {
+ $table_type = $1;
+ $tag = 'table';
+ }
+ # special cases
+ if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*,/i)) {
+ $in_top = 1;
+ $has_top = 1;
+ $has_top_command = 1 if $tag eq 'top';
+ @lines = (); # ignore all lines before top (title page garbage)
+ next;
+ } elsif ($tag eq 'node') {
+ if ($in_top)
+ {
+ $in_top = 0;
+ push(@lines, $TOPEND);
+ }
+ warn "$ERROR Bad node line: $_" unless $_ =~ /^\@node\s$NODESRE$/o;
+ # request of "Richard Y. Kim" <ryk@ap.com>
+ s/^\@node\s+//;
+ $_ = &protect_html($_); # if node contains '&' for instance
+ ($node, $node_next, $node_prev, $node_up) = split(/,/);
+ &normalise_node($node);
+ &normalise_node($node_next);
+ &normalise_node($node_prev);
+ &normalise_node($node_up);
+ $node =~ /\"/ ?
+ push @lines, &html_debug("<A NAME='$node'></A>\n", __LINE__) :
+ push @lines, &html_debug("<A NAME=\"$node\"></A>\n", __LINE__);
+ next;
+ } elsif ($tag eq 'include') {
+ if (/^\@include\s+($FILERE)\s*$/o) {
+ $file = LocateIncludeFile($1);
+ if ($file && -e $file) {
+ &open($file);
+ print "# including $file\n" if $T2H_VERBOSE;
+ } else {
+ warn "$ERROR Can't find $1, skipping";
+ }
+ } else {
+ warn "$ERROR Bad include line: $_";
+ }
+ next;
+ } elsif ($tag eq 'ifclear') {
+ if (/^\@ifclear\s+($VARRE)\s*$/o) {
+ next unless defined($value{$1});
+ &skip_until($tag);
+ } else {
+ warn "$ERROR Bad ifclear line: $_";
+ }
+ next;
+ } elsif ($tag eq 'ifset') {
+ if (/^\@ifset\s+($VARRE)\s*$/o) {
+ next if defined($value{$1});
+ &skip_until($tag);
+ } else {
+ warn "$ERROR Bad ifset line: $_";
+ }
+ next;
+ } elsif ($tag eq 'menu') {
+ unless ($T2H_SHOW_MENU) {
+ &skip_until($tag);
+ next;
+ }
+ &html_push_if($tag);
+ push(@lines, &html_debug('', __LINE__));
+ } elsif ($format_map{$tag}) {
+ $in_pre = 1 if $format_map{$tag} eq 'PRE';
+ &html_push_if($format_map{$tag});
+ push(@lines, &html_debug('', __LINE__));
+ $in_list++ if $format_map{$tag} eq 'UL' || $format_map{$tag} eq 'OL' ;
+# push(@lines, &debug("<BLOCKQUOTE>\n", __LINE__))
+# if $tag =~ /example/i;
+ # sunshine@sunshineco.com: <PRE>bla</PRE> looks better than
+ # <PRE>\nbla</PRE> (at least on NeXTstep browser
+ push(@lines, &debug("<$format_map{$tag}>" .
+ ($in_pre ? '' : "\n"), __LINE__));
+ next;
+ }
+ elsif (exists $complex_format_map->{$tag})
+ {
+ my $start = eval $complex_format_map->{$tag}->[0];
+ if ($@)
+ {
+ print "$ERROR: eval of complex_format_map->{$tag}->[0] $complex_format_map->{$tag}->[0]: $@";
+ $start = '<pre>'
+ }
+ $in_pre = 1 if $start =~ /<pre/;
+ push(@lines, html_debug($start. ($in_pre ? '' : "\n"), __LINE__));
+ next;
+ } elsif ($tag eq 'table') {
+ # anorland@hem2.passagen.se
+ # if (/^\s*\@(|f|v|multi)table\s+\@(\w+)/) {
+ if (/^\s*\@(|f|v|multi)table\s+\@(\w+)|(\{[^\}]*\})/) {
+ $in_table = $2;
+ unshift(@tables, join($;, $table_type, $in_table));
+ if ($table_type eq "multi") {
+ # don't use borders -- gets confused by empty cells
+ push(@lines, &debug("<TABLE>\n", __LINE__));
+ &html_push_if('TABLE');
+ } else {
+ push(@lines, &debug("<DL COMPACT>\n", __LINE__));
+ &html_push_if('DL');
+ }
+ push(@lines, &html_debug('', __LINE__));
+ } else {
+ warn "$ERROR Bad table line: $_";
+ }
+ next;
+ }
+ elsif ($tag eq 'synindex' || $tag eq 'syncodeindex')
+ {
+ if (/^\@$tag\s+(\w+)\s+(\w+)\s*$/)
+ {
+ my $from = $1;
+ my $to = $2;
+ my $prefix_from = IndexName2Prefix($from);
+ my $prefix_to = IndexName2Prefix($to);
+
+ warn("$ERROR unknown from index name $from ind syn*index line: $_"), next
+ unless $prefix_from;
+ warn("$ERROR unknown to index name $to ind syn*index line: $_"), next
+ unless $prefix_to;
+
+ if ($tag eq 'syncodeindex')
+ {
+ $index_properties->{$prefix_to}->{'from_code'}->{$prefix_from} = 1;
+ }
+ else
+ {
+ $index_properties->{$prefix_to}->{'from'}->{$prefix_from} = 1;
+ }
+ }
+ else
+ {
+ warn "$ERROR Bad syn*index line: $_";
+ }
+ next;
+ }
+ elsif ($tag eq 'defindex' || $tag eq 'defcodeindex')
+ {
+ if (/^\@$tag\s+(\w+)\s*$/)
+ {
+ my $name = $1;
+ $index_properties->{$name}->{name} = $name;
+ $index_properties->{$name}->{code} = 1 if $tag eq 'defcodeindex';
+ }
+ else
+ {
+ warn "$ERROR Bad defindex line: $_";
+ }
+ next;
+ }
+ elsif (/^\@printindex/)
+ {
+ push (@lines, "<!--::${section}::-->$_");
+ next;
+ }
+ elsif ($tag eq 'sp') {
+ push(@lines, &debug("<P>\n", __LINE__));
+ next;
+ } elsif ($tag eq 'center') {
+ push(@lines, &debug("<center>\n", __LINE__));
+ s/\@center//;
+ } elsif ($tag eq 'setref') {
+ &protect_html; # if setref contains '&' for instance
+ if (/^\@$tag\s*{($NODERE)}\s*$/) {
+ $setref = $1;
+ $setref =~ s/\s+/ /g; # normalize
+ $setref =~ s/ $//;
+ $node2sec{$setref} = $name;
+ $sec2node{$name} = $setref;
+ $node2href{$setref} = "$docu_doc#$docid";
+ } else {
+ warn "$ERROR Bad setref line: $_";
+ }
+ next;
+ } elsif ($tag eq 'lowersections') {
+ local ($sec, $level);
+ while (($sec, $level) = each %sec2level) {
+ $sec2level{$sec} = $level + 1;
+ }
+ next;
+ } elsif ($tag eq 'raisesections') {
+ local ($sec, $level);
+ while (($sec, $level) = each %sec2level) {
+ $sec2level{$sec} = $level - 1;
+ }
+ next;
+ }
+ elsif ($tag eq 'macro' || $tag eq 'rmacro')
+ {
+ if (/^\@$tag\s*(\w+)\s*(.*)/)
+ {
+ my $name = $1;
+ my @args;
+ @args = split(/\s*,\s*/ , $1)
+ if ($2 =~ /^\s*{(.*)}\s*/);
+
+ $macros->{$name}->{Args} = \@args;
+ $macros->{$name}->{Body} = '';
+ while (($_ = &next_line) && $_ !~ /\@end $tag/)
+ {
+ $macros->{$name}->{Body} .= $_;
+ }
+ die "ERROR: No closing '\@end $tag' found for macro definition of '$name'\n"
+ unless (/\@end $tag/);
+ chomp $macros->{$name}->{Body};
+ }
+ else
+ {
+ warn "$ERROR: Bad macro defintion $_"
+ }
+ next;
+ }
+ elsif ($tag eq 'unmacro')
+ {
+ delete $macros->{$1} if (/^\@unmacro\s*(\w+)/);
+ next;
+ }
+ elsif ($tag eq 'documentlanguage')
+ {
+ SetDocumentLanguage($1) if (!$T2H_LANG && /documentlanguage\s*(\w+)/);
+ }
+ elsif (defined($def_map{$tag})) {
+ if ($def_map{$tag}) {
+ s/^\@$tag\s+//;
+ $tag = $def_map{$tag};
+ $_ = "\@$tag $_";
+ $tag =~ s/\s.*//;
+ }
+ } elsif (defined($user_sub{$tag})) {
+ s/^\@$tag\s+//;
+ $sub = $user_sub{$tag};
+ print "# user $tag = $sub, arg: $_" if $T2H_DEBUG & $DEBUG_USER;
+ if (defined(&$sub)) {
+ chop($_);
+ &$sub($_);
+ } else {
+ warn "$ERROR Bad user sub for $tag: $sub\n";
+ }
+ next;
+ }
+ if (defined($def_map{$tag})) {
+ s/^\@$tag\s+//;
+ if ($tag =~ /x$/) {
+ # extra definition line
+ $tag = $`;
+ $is_extra = 1;
+ } else {
+ $is_extra = 0;
+ }
+ while (/\{([^\{\}]*)\}/) {
+ # this is a {} construct
+ ($before, $contents, $after) = ($`, $1, $');
+ # protect spaces
+ $contents =~ s/\s+/$;9/g;
+ # restore $_ protecting {}
+ $_ = "$before$;7$contents$;8$after";
+ }
+ @args = split(/\s+/, &protect_html($_));
+ foreach (@args) {
+ s/$;9/ /g; # unprotect spaces
+ s/$;7/\{/g; # ... {
+ s/$;8/\}/g; # ... }
+ }
+ $type = shift(@args);
+ $type =~ s/^\{(.*)\}$/$1/;
+ print "# def ($tag): {$type} ", join(', ', @args), "\n"
+ if $T2H_DEBUG & $DEBUG_DEF;
+ $type .= ':'; # it's nicer like this
+ my $name = shift(@args);
+ $name =~ s/^\{(.*)\}$/$1/;
+ if ($is_extra) {
+ $_ = &debug("<DT>", __LINE__);
+ } else {
+ $_ = &debug("<DL>\n<DT>", __LINE__);
+ }
+ if ($tag eq 'deffn' || $tag eq 'defvr' || $tag eq 'deftp') {
+ $_ .= "<U>$type</U> <B>$name</B>";
+ $_ .= " <I>@args</I>" if @args;
+ } elsif ($tag eq 'deftypefn' || $tag eq 'deftypevr'
+ || $tag eq 'defcv' || $tag eq 'defop') {
+ $ftype = $name;
+ $name = shift(@args);
+ $name =~ s/^\{(.*)\}$/$1/;
+ $_ .= "<U>$type</U> $ftype <B>$name</B>";
+ $_ .= " <I>@args</I>" if @args;
+ } else {
+ warn "$ERROR Unknown definition type: $tag\n";
+ $_ .= "<U>$type</U> <B>$name</B>";
+ $_ .= " <I>@args</I>" if @args;
+ }
+ $_ .= &debug("\n<DD>", __LINE__);
+ $name = &unprotect_html($name);
+ if ($tag eq 'deffn' || $tag eq 'deftypefn') {
+ EnterIndexEntry('f', $name, $docu_doc, $section, \@lines);
+# unshift(@input_spool, "\@findex $name\n");
+ } elsif ($tag eq 'defop') {
+ EnterIndexEntry('f', "$name on $ftype", $docu_doc, $section, \@lines);
+# unshift(@input_spool, "\@findex $name on $ftype\n");
+ } elsif ($tag eq 'defvr' || $tag eq 'deftypevr' || $tag eq 'defcv') {
+ EnterIndexEntry('v', $name, $docu_doc, $section, \@lines);
+# unshift(@input_spool, "\@vindex $name\n");
+ } else {
+ EnterIndexEntry('t', $name, $docu_doc, $section, \@lines);
+# unshift(@input_spool, "\@tindex $name\n");
+ }
+ $dont_html = 1;
+ }
+ } elsif ($end_tag) {
+ if ($format_map{$end_tag}) {
+ $in_pre = 0 if $format_map{$end_tag} eq 'PRE';
+ $in_list-- if $format_map{$end_tag} eq 'UL' || $format_map{$end_tag} eq 'OL' ;
+ &html_pop_if('P');
+ &html_pop_if('LI');
+ &html_pop_if();
+ push(@lines, &debug("</$format_map{$end_tag}>\n", __LINE__));
+ push(@lines, &html_debug('', __LINE__));
+ }
+ elsif (exists $complex_format_map->{$end_tag})
+ {
+ my $end = eval $complex_format_map->{$end_tag}->[1];
+ if ($@)
+ {
+ print "$ERROR: eval of complex_format_map->{$end_tag}->[1] $complex_format_map->{$end_tag}->[0]: $@";
+ $end = '</pre>'
+ }
+ $in_pre = 0 if $end =~ m|</pre>|;
+ push(@lines, html_debug($end, __LINE__));
+ } elsif ($end_tag =~ /^(|f|v|multi)table$/) {
+ unless (@tables) {
+ warn "$ERROR \@end $end_tag without \@*table\n";
+ next;
+ }
+ &html_pop_if('P');
+ ($table_type, $in_table) = split($;, shift(@tables));
+ unless ($1 eq $table_type) {
+ warn "$ERROR \@end $end_tag without matching \@$end_tag\n";
+ next;
+ }
+ if ($table_type eq "multi") {
+ push(@lines, "</TR></TABLE>\n");
+ &html_pop_if('TR');
+ } else {
+ push(@lines, "</DL>\n");
+ &html_pop_if('DD');
+ }
+ &html_pop_if();
+ if (@tables) {
+ ($table_type, $in_table) = split($;, $tables[0]);
+ } else {
+ $in_table = 0;
+ }
+ } elsif (defined($def_map{$end_tag})) {
+ push(@lines, &debug("</DL>\n", __LINE__));
+ } elsif ($end_tag eq 'menu') {
+ &html_pop_if();
+ push(@lines, $_); # must keep it for pass 2
+ }
+ next;
+ }
+ #############################################################
+ # anchor insertion
+ while (/\@anchor\s*\{(.*?)\}/)
+ {
+ $_ = $`.$';
+ my $anchor = $1;
+ $anchor = &normalise_node($anchor);
+ push @lines, &html_debug("<A NAME=\"$anchor\"></A>\n");
+ $node2href{$anchor} = "$docu_doc#$anchor";
+ next INPUT_LINE if $_ =~ /^\s*$/;
+ }
+
+ #############################################################
+ # index entry generation, after value substitutions
+ if (/^\@(\w+?)index\s+/)
+ {
+ EnterIndexEntry($1, $', $docu_doc, $section, \@lines);
+ next;
+ }
+ #
+ # protect texi and HTML things
+ &protect_texi;
+ $_ = &protect_html($_) unless $dont_html;
+ $dont_html = 0;
+ # substitution (unsupported things)
+ s/^\@exdent\s+//g;
+ s/\@noindent\s+//g;
+ s/\@refill\s+//g;
+ # other substitutions
+ &simple_substitutions;
+ s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4
+ #
+ # analyze the tag again
+ #
+ if ($tag) {
+ if (defined($sec2level{$tag}) && $sec2level{$tag} > 0) {
+ if (/^\@$tag\s+(.+)$/) {
+ $name = $1;
+ $name = &normalise_node($name);
+ $level = $sec2level{$tag};
+ # check for index
+ $first_index_chapter = $name
+ if ($level == 1 && !$first_index_chapter &&
+ $name =~ /index/i);
+ if ($in_top && /heading/){
+ $T2H_HAS_TOP_HEADING = 1;
+ $_ = &debug("<H$level>$name</H$level>\n", __LINE__);
+ &html_push_if('body');
+ print "# top heading, section $name, level $level\n"
+ if $T2H_DEBUG & $DEBUG_TOC;
+ }
+ else
+ {
+ unless (/^\@\w*heading/)
+ {
+ unless (/^\@unnumbered/)
+ {
+ my $number = &update_sec_num($tag, $level);
+ $name = $number. ' ' . $name if $T2H_NUMBER_SECTIONS;
+ $sec2number{$name} = $number;
+ $number2sec{$number} = $name;
+ }
+ if (defined($toplevel))
+ {
+ push @lines, ($level==$toplevel ? $CHAPTEREND : $SECTIONEND);
+ }
+ else
+ {
+ # first time we see a "section"
+ unless ($level == 1)
+ {
+ warn "$WARN The first section found is not of level 1: $_";
+ }
+ $toplevel = $level;
+ }
+ push(@sections, $name);
+ next_doc() if ($T2H_SPLIT eq 'section' ||
+ $T2H_SPLIT && $level == $toplevel);
+ }
+ $sec_num++;
+ $docid = "SEC$sec_num";
+ $tocid = (/^\@\w*heading/ ? undef : "TOC$sec_num");
+ # check biblio and glossary
+ $in_bibliography = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*bibliography$/i);
+ $in_glossary = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*glossary$/i);
+ # check node
+ if ($node)
+ {
+ warn "$ERROR Duplicate node found: $node\n"
+ if ($node2sec{$node});
+ }
+ else
+ {
+ $name .= ' ' while ($node2sec{$name});
+ $node = $name;
+ }
+ $name .= ' ' while ($sec2node{$name});
+ $section = $name;
+ $node2sec{$node} = $name;
+ $sec2node{$name} = $node;
+ $node2href{$node} = "$docu_doc#$docid";
+ $node2next{$node} = $node_next;
+ $node2prev{$node} = $node_prev;
+ $node2up{$node} = $node_up;
+ print "# node $node, section $name, level $level\n"
+ if $T2H_DEBUG & $DEBUG_TOC;
+
+ $node = '';
+ $node_next = '';
+ $node_prev = '';
+ $node_next = '';
+ if ($tocid)
+ {
+ # update TOC
+ while ($level > $curlevel) {
+ $curlevel++;
+ push(@toc_lines, "<UL>\n");
+ }
+ while ($level < $curlevel) {
+ $curlevel--;
+ push(@toc_lines, "</UL>\n");
+ }
+ $_ = &t2h_anchor($tocid, "$docu_doc#$docid", $name, 1);
+ $_ = &substitute_style($_);
+ push(@stoc_lines, "$_<BR>\n") if ($level == 1);
+ if ($T2H_NUMBER_SECTIONS)
+ {
+ push(@toc_lines, $_ . "<BR>\n")
+ }
+ else
+ {
+ push(@toc_lines, "<LI>" . $_ ."</LI>");
+ }
+ }
+ else
+ {
+ push(@lines, &html_debug("<A NAME=\"$docid\"></A>\n",
+ __LINE__));
+ }
+ # update DOC
+ push(@lines, &html_debug('', __LINE__));
+ &html_reset;
+ $_ = "<H$level> $name </H$level>\n<!--docid::${docid}::-->\n";
+ $_ = &debug($_, __LINE__);
+ push(@lines, &html_debug('', __LINE__));
+ }
+ # update DOC
+ foreach $line (split(/\n+/, $_)) {
+ push(@lines, "$line\n");
+ }
+ next;
+ } else {
+ warn "$ERROR Bad section line: $_";
+ }
+ } else {
+ # track variables
+ $value{$1} = Unprotect_texi($2), next if /^\@set\s+($VARRE)\s+(.*)$/o;
+ delete $value{$1}, next if /^\@clear\s+($VARRE)\s*$/o;
+ # store things
+ $value{'_shorttitle'} = Unprotect_texi($1), next if /^\@shorttitle\s+(.*)$/;
+ $value{'_setfilename'} = Unprotect_texi($1), next if /^\@setfilename\s+(.*)$/;
+ $value{'_settitle'} = Unprotect_texi($1), next if /^\@settitle\s+(.*)$/;
+ $value{'_author'} .= Unprotect_texi($1)."\n", next if /^\@author\s+(.*)$/;
+ $value{'_subtitle'} .= Unprotect_texi($1)."\n", next if /^\@subtitle\s+(.*)$/;
+ $value{'_title'} .= Unprotect_texi($1)."\n", next if /^\@title\s+(.*)$/;
+
+ # list item
+ if (/^\s*\@itemx?\s+/) {
+ $what = $';
+ $what =~ s/\s+$//;
+ if ($in_bibliography && $use_bibliography) {
+ if ($what =~ /^$BIBRE$/o) {
+ $id = 'BIB' . ++$bib_num;
+ $bib2href{$what} = "$docu_doc#$id";
+ print "# found bibliography for '$what' id $id\n"
+ if $T2H_DEBUG & $DEBUG_BIB;
+ $what = &t2h_anchor($id, '', $what);
+ }
+ } elsif ($in_glossary && $T2H_USE_GLOSSARY) {
+ $id = 'GLOSS' . ++$gloss_num;
+ $entry = $what;
+ $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/;
+ $gloss2href{$entry} = "$docu_doc#$id";
+ print "# found glossary for '$entry' id $id\n"
+ if $T2H_DEBUG & $DEBUG_GLOSS;
+ $what = &t2h_anchor($id, '', $what);
+ }
+ elsif ($in_table && ($table_type eq 'f' || $table_type eq 'v'))
+ {
+ EnterIndexEntry($table_type, $what, $docu_doc, $section, \@lines);
+ }
+ &html_pop_if('P');
+ if ($html_element eq 'DL' || $html_element eq 'DD') {
+ if ($things_map{$in_table} && !$what) {
+ # special case to allow @table @bullet for instance
+ push(@lines, &debug("<DT>$things_map{$in_table}\n", __LINE__));
+ } else {
+ push(@lines, &debug("<DT>\@$in_table\{$what\}\n", __LINE__));
+ }
+ push(@lines, "<DD>");
+ &html_push('DD') unless $html_element eq 'DD';
+ if ($table_type) { # add also an index
+ unshift(@input_spool, "\@${table_type}index $what\n");
+ }
+ } elsif ($html_element eq 'TABLE') {
+ push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__));
+ &html_push('TR');
+ } elsif ($html_element eq 'TR') {
+ push(@lines, &debug("</TR>\n", __LINE__));
+ push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__));
+ } else {
+ push(@lines, &debug("<LI>$what\n", __LINE__));
+ &html_push('LI') unless $html_element eq 'LI';
+ }
+ push(@lines, &html_debug('', __LINE__));
+ if ($deferred_ref) {
+ push(@lines, &debug("$deferred_ref\n", __LINE__));
+ $deferred_ref = '';
+ }
+ next;
+ } elsif (/^\@tab\s+(.*)$/) {
+ push(@lines, "<TD>$1</TD>\n");
+ next;
+ }
+ }
+ }
+ # paragraph separator
+ if ($_ eq "\n" && ! $in_pre) {
+ next if $#lines >= 0 && $lines[$#lines] eq "\n";
+ if ($html_element eq 'P') {
+ push (@lines, &debug("</P><P>\n", __LINE__));
+ }
+# else
+# {
+# push(@lines, "<P></P>\n");
+# $_ = &debug("<P></P>\n", __LINE__);
+# }
+ elsif ($html_element eq 'body' || $html_element eq 'BLOCKQUOTE' || $html_element eq 'DD' || $html_element eq 'LI')
+ {
+ &html_push('P');
+ push(@lines, &debug("<P>\n", __LINE__));
+ }
+ }
+ # otherwise
+ push(@lines, $_) unless $in_titlepage;
+ push(@lines, &debug("</center>\n", __LINE__)) if ($tag eq 'center');
+}
+
+# finish TOC
+$level = 0;
+while ($level < $curlevel) {
+ $curlevel--;
+ push(@toc_lines, "</UL>\n");
+}
+
+print "# end of pass 1\n" if $T2H_VERBOSE;
+
+SetDocumentLanguage('en') unless ($T2H_LANG);
+#+++############################################################################
+# #
+# Stuff related to Index generation #
+# #
+#---############################################################################
+
+sub EnterIndexEntry
+{
+ my $prefix = shift;
+ my $key = shift;
+ my $docu_doc = shift;
+ my $section = shift;
+ my $lines = shift;
+ local $_;
+
+ warn "$ERROR Undefined index command: $_", next
+ unless (exists ($index_properties->{$prefix}));
+ $key =~ s/\s+$//;
+ $_ = $key;
+ &protect_texi;
+ $key = $_;
+ $_ = &protect_html($_);
+ my $html_key = substitute_style($_);
+ my $id;
+ $key = remove_style($key);
+ $key = remove_things($key);
+ $_ = $key;
+ &unprotect_texi;
+ $key = $_;
+ while (exists $index->{$prefix}->{$key}) {$key .= ' '};
+ if ($lines->[$#lines] =~ /^<!--docid::(.+)::-->$/)
+ {
+ $id = $1;
+ }
+ else
+ {
+ $id = 'IDX' . ++$idx_num;
+ push(@$lines, &t2h_anchor($id, '', $T2H_INVISIBLE_MARK, !$in_pre));
+ }
+ $index->{$prefix}->{$key}->{html_key} = $html_key;
+ $index->{$prefix}->{$key}->{section} = $section;
+ $index->{$prefix}->{$key}->{href} = "$docu_doc#$id";
+ print "# found ${prefix}index for '$key' with id $id\n"
+ if $T2H_DEBUG & $DEBUG_INDEX;
+}
+
+sub IndexName2Prefix
+{
+ my $name = shift;
+ my $prefix;
+
+ for $prefix (keys %$index_properties)
+ {
+ return $prefix if ($index_properties->{$prefix}->{name} eq $name);
+ }
+ return undef;
+}
+
+sub GetIndexEntries
+{
+ my $normal = shift;
+ my $code = shift;
+ my ($entries, $prefix, $key) = ({});
+
+ for $prefix (keys %$normal)
+ {
+ for $key (keys %{$index->{$prefix}})
+ {
+ $entries->{$key} = {%{$index->{$prefix}->{$key}}};
+ }
+ }
+
+ if (defined($code))
+ {
+ for $prefix (keys %$code)
+ {
+ unless (exists $normal->{$keys})
+ {
+ for $key (keys %{$index->{$prefix}})
+ {
+ $entries->{$key} = {%{$index->{$prefix}->{$key}}};
+ $entries->{$key}->{html_key} = "<CODE>$entries->{$key}->{html_key}</CODE>";
+ }
+ }
+ }
+ }
+ return $entries;
+}
+
+sub byAlpha
+{
+ if ($a =~ /^[A-Za-z]/)
+ {
+ if ($b =~ /^[A-Za-z]/)
+ {
+ return lc($a) cmp lc($b);
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ elsif ($b =~ /^[A-Za-z]/)
+ {
+ return -1;
+ }
+ else
+ {
+ return lc($a) cmp lc($b);
+ }
+}
+
+sub GetIndexPages
+{
+ my $entries = shift;
+ my (@Letters, $key);
+ my ($EntriesByLetter, $Pages, $page) = ({}, [], {});
+ my @keys = sort byAlpha keys %$entries;
+
+ for $key (@keys)
+ {
+ push @{$EntriesByLetter->{uc(substr($key,0, 1))}} , $entries->{$key};
+ }
+ @Letters = sort byAlpha keys %$EntriesByLetter;
+
+ $T2H_SPLIT_INDEX = 0 unless ($T2H_SPLIT);
+
+ unless ($T2H_SPLIT_INDEX)
+ {
+ $page->{First} = $Letters[0];
+ $page->{Last} = $Letters[$#Letters];
+ $page->{Letters} = \@Letters;
+ $page->{EntriesByLetter} = $EntriesByLetter;
+ push @$Pages, $page;
+ return $Pages;
+ }
+
+ if ($T2H_SPLIT_INDEX =~ /^\d+$/)
+ {
+ my $i = 0;
+ my ($prev_letter, $letter);
+ $page->{First} = $Letters[0];
+ for $letter (@Letters)
+ {
+ if ($i > $T2H_SPLIT_INDEX)
+ {
+ $page->{Last} = $prev_letter;
+ push @$Pages, {%$page};
+ $page->{Letters} = [];
+ $page->{EntriesByLetter} = {};
+ $page->{First} = $letter;
+ $i=0;
+ }
+ push @{$page->{Letters}}, $letter;
+ $page->{EntriesByLetter}->{$letter} = [@{$EntriesByLetter->{$letter}}];
+ $i += scalar(@{$EntriesByLetter->{$letter}});
+ $prev_letter = $letter;
+ }
+ $page->{Last} = $Letters[$#Letters];
+ push @$Pages, {%$page};
+ }
+ return $Pages;
+}
+
+sub GetIndexSummary
+{
+ my $first_page = shift;
+ my $Pages = shift;
+ my $name = shift;
+ my ($page, $letter, $summary, $i, $l1, $l2, $l);
+
+ $i = 0;
+ $summary = '<table><tr><th valign=top>Jump to: &nbsp; </th><td>';
+
+ for $page ($first_page, @$Pages)
+ {
+ for $letter (@{$page->{Letters}})
+ {
+ $l = t2h_anchor('', "$page->{href}#${name}_$letter", "<b>$letter</b>",
+ 0, 'style="text-decoration:none"') . "\n &nbsp; \n";
+
+ if ($letter =~ /^[A-Za-z]/)
+ {
+ $l2 .= $l;
+ }
+ else
+ {
+ $l1 .= $l;
+ }
+ }
+ }
+ $summary .= $l1 . "<BR>\n" if ($l1);
+ $summary .= $l2 . '</td></tr></table><br>';
+ return $summary;
+}
+
+sub PrintIndexPage
+{
+ my $lines = shift;
+ my $summary = shift;
+ my $page = shift;
+ my $name = shift;
+
+ push @$lines, $summary;
+
+ push @$lines , <<EOT;
+<P></P>
+<TABLE border=0>
+<TR><TD></TD><TH ALIGN=LEFT>Index Entry</TH><TH ALIGN=LEFT> Section</TH></TR>
+<TR><TD COLSPAN=3> <HR></TD></TR>
+EOT
+
+ for $letter (@{$page->{Letters}})
+ {
+ push @$lines, "<TR><TH><A NAME=\"${name}_$letter\"></A>$letter</TH><TD></TD><TD></TD></TR>\n";
+ for $entry (@{$page->{EntriesByLetter}->{$letter}})
+ {
+ push @$lines,
+ "<TR><TD></TD><TD valign=top>" .
+ t2h_anchor('', $entry->{href}, $entry->{html_key}) .
+ "</TD><TD valign=top>" .
+ t2h_anchor('', sec_href($entry->{section}), clean_name($entry->{section})) .
+ "</TD></TR>\n";
+ }
+ push @$lines, "<TR><TD COLSPAN=3> <HR></TD></TR>\n";
+ }
+ push @$lines, "</TABLE><P></P>";
+ push @$lines, $summary;
+}
+
+sub PrintIndex
+{
+ my $lines = shift;
+ my $name = shift;
+ my $section = shift;
+ $section = 'Top' unless $section;
+ my $prefix = IndexName2Prefix($name);
+
+ warn ("$ERROR printindex: bad index name: $name"), return
+ unless $prefix;
+
+ if ($index_properties->{$prefix}->{code})
+ {
+ $index_properties->{$prefix}->{from_code}->{$prefix} = 1;
+ }
+ else
+ {
+ $index_properties->{$prefix}->{from}->{$prefix}= 1;
+ }
+
+ my $Entries = GetIndexEntries($index_properties->{$prefix}->{from},
+ $index_properties->{$prefix}->{from_code});
+ return unless %$Entries;
+
+ if ($T2H_IDX_SUMMARY)
+ {
+ my $key;
+ open(FHIDX, ">$docu_rdir$docu_name" . "_$name.idx")
+ || die "Can't open > $docu_rdir$docu_name" . "_$name.idx for writing: $!\n";
+ print "# writing $name index summary in $docu_rdir$docu_name" . "_$name.idx...\n" if $T2H_VERBOSE;
+
+ for $key (sort keys %$Entries)
+ {
+ print FHIDX "$key\t$Entries->{$key}->{href}\n";
+ }
+ }
+
+ my $Pages = GetIndexPages($Entries);
+ my $page;
+ my $first_page = shift @$Pages;
+ my $sec_name = $section;
+ # remove section number
+ $sec_name =~ s/.*? // if $sec_name =~ /^([A-Z]|\d+)\./;
+
+ ($first_page->{href} = sec_href($section)) =~ s/\#.*$//;
+ # Update tree structure of document
+ if (@$Pages)
+ {
+ my $sec;
+ my @after;
+
+ while (@sections && $sections[$#sections] ne $section)
+ {
+ unshift @after, pop @sections;
+ }
+
+ for $page (@$Pages)
+ {
+ my $node = ($page->{First} ne $page->{Last} ?
+ "$sec_name: $page->{First} -- $page->{Last}" :
+ "$sec_name: $page->{First}");
+ push @sections, $node;
+ $node2sec{$node} = $node;
+ $sec2node{$node} = $node;
+ $node2up{$node} = $section;
+ $page->{href} = next_doc();
+ $page->{name} = $node;
+ $node2href{$node} = $page->{href};
+ if ($prev_node)
+ {
+ $node2next{$prev_node} = $node;
+ $node2prev{$node} = $prev_node;
+ }
+ $prev_node = $node;
+ }
+ push @sections, @after;
+ }
+
+ my $summary = GetIndexSummary($first_page, $Pages, $name);
+ PrintIndexPage($lines, $summary, $first_page, $name);
+ for $page (@$Pages)
+ {
+ push @$lines, ($T2H_SPLIT eq 'chapter' ? $CHAPTEREND : $SECTIONEND);
+ push @$lines, "<H2 ALIGN=\"Left\">$page->{name}</H2>\n";
+ PrintIndexPage($lines, $summary, $page, $name);
+ }
+}
+
+
+#+++############################################################################
+# #
+# Pass 2/3: handle style, menu, index, cross-reference #
+# #
+#---############################################################################
+
+@lines2 = (); # whole document (2nd pass)
+@lines3 = (); # whole document (3rd pass)
+$in_menu = 0; # am I inside a menu
+
+while (@lines) {
+ $_ = shift(@lines);
+ #
+ # special case (protected sections)
+ #
+ if (/^$PROTECTTAG/o) {
+ push(@lines2, $_);
+ next;
+ }
+ #
+ # menu
+ #
+ if (/^\@menu\b/)
+ {
+ $in_menu = 1;
+ $in_menu_listing = 1;
+ push(@lines2, &debug("<BLOCKQUOTE><TABLE BORDER=0 CELLSPACING=0> \n", __LINE__));
+ next;
+ }
+ if (/^\@end\s+menu\b/)
+ {
+ if ($in_menu_listing)
+ {
+ push(@lines2, &debug("</TABLE></BLOCKQUOTE>\n", __LINE__));
+ }
+ else
+ {
+ push(@lines2, &debug("</BLOCKQUOTE>\n", __LINE__));
+ }
+ $in_menu = 0;
+ $in_menu_listing = 0;
+ next;
+ }
+ if ($in_menu)
+ {
+ my ($node, $name, $descr);
+ if (/^\*\s+($NODERE)::/o)
+ {
+ $node = $1;
+ $descr = $';
+ }
+ elsif (/^\*\s+(.+):\s+([^\t,\.\n]+)[\t,\.\n]/)
+ {
+ $name = $1;
+ $node = $2;
+ $descr = $';
+ }
+ elsif (/^\*/)
+ {
+ warn "$ERROR Bad menu line: $_";
+ }
+ else
+ {
+ if ($in_menu_listing)
+ {
+ $in_menu_listing = 0;
+ push(@lines2, &debug("</TABLE>\n", __LINE__));
+ }
+ # should be like verbatim -- preseve spaces, etc
+ s/ /\&nbsp;/g;
+ $_ .= "<br>\n";
+ push(@lines2, $_);
+ }
+ if ($node)
+ {
+ if (! $in_menu_listing)
+ {
+ $in_menu_listing = 1;
+ push(@lines2, &debug("<TABLE BORDER=0 CELLSPACING=0>\n", __LINE__));
+ }
+ # look for continuation
+ while ($lines[0] =~ /^\s+\w+/)
+ {
+ $descr .= shift(@lines);
+ }
+ &menu_entry($node, $name, $descr);
+ }
+ next;
+ }
+ #
+ # printindex
+ #
+ PrintIndex(\@lines2, $2, $1), next
+ if (/^<!--::(.*)::-->\@printindex\s+(\w+)/);
+ #
+ # simple style substitutions
+ #
+ $_ = &substitute_style($_);
+ #
+ # xref
+ #
+ while (/\@(x|px|info|)ref{([^{}]+)(}?)/) {
+ # note: Texinfo may accept other characters
+ ($type, $nodes, $full) = ($1, $2, $3);
+ ($before, $after) = ($`, $');
+ if (! $full && $after) {
+ warn "$ERROR Bad xref (no ending } on line): $_";
+ $_ = "$before$;0${type}ref\{$nodes$after";
+ next; # while xref
+ }
+ if ($type eq 'x') {
+ $type = "$T2H_WORDS->{$T2H_LANG}->{'See'} ";
+ } elsif ($type eq 'px') {
+ $type = "$T2H_WORDS->{$T2H_LANG}->{'see'} ";
+ } elsif ($type eq 'info') {
+ $type = "$T2H_WORDS->{$T2H_LANG}->{'See'} Info";
+ } else {
+ $type = '';
+ }
+ unless ($full) {
+ $next = shift(@lines);
+ $next = &substitute_style($next);
+ chop($nodes); # remove final newline
+ if ($next =~ /\}/) { # split on 2 lines
+ $nodes .= " $`";
+ $after = $';
+ } else {
+ $nodes .= " $next";
+ $next = shift(@lines);
+ $next = &substitute_style($next);
+ chop($nodes);
+ if ($next =~ /\}/) { # split on 3 lines
+ $nodes .= " $`";
+ $after = $';
+ } else {
+ warn "$ERROR Bad xref (no ending }): $_";
+ $_ = "$before$;0xref\{$nodes$after";
+ unshift(@lines, $next);
+ next; # while xref
+ }
+ }
+ }
+ $nodes =~ s/\s+/ /g; # remove useless spaces
+ @args = split(/\s*,\s*/, $nodes);
+ $node = $args[0]; # the node is always the first arg
+ $node = &normalise_node($node);
+ $sec = $args[2] || $args[1] || $node2sec{$node};
+ $href = $node2href{$node};
+ if (@args == 5) { # reference to another manual
+ $sec = $args[2] || $node;
+ $man = $args[4] || $args[3];
+ $_ = "${before}${type}$T2H_WORDS->{$T2H_LANG}->{'section'} `$sec' in \@cite{$man}$after";
+ } elsif ($type =~ /Info/) { # inforef
+ warn "$ERROR Wrong number of arguments: $_" unless @args == 3;
+ ($nn, $_, $in) = @args;
+ $_ = "${before}${type} file `$in', node `$nn'$after";
+ } elsif ($sec && $href && ! $T2H_SHORT_REF) {
+ $_ = "${before}${type}";
+ $_ .= "$T2H_WORDS->{$T2H_LANG}->{'section'} " if ${type};
+ $_ .= &t2h_anchor('', $href, $sec) . $after;
+ }
+ elsif ($href)
+ {
+ $_ = "${before}${type} " .
+ &t2h_anchor('', $href, $args[2] || $args[1] || $node) .
+ $after;
+ }
+ else {
+ warn "$ERROR Undefined node ($node): $_";
+ $_ = "$before$;0xref{$nodes}$after";
+ }
+ }
+
+ # replace images
+ s[\@image\s*{(.+?)}]
+ {
+ my @args = split (/\s*,\s*/, $1);
+ my $base = $args[0];
+ my $image =
+ LocateIncludeFile("$base.png") ||
+ LocateIncludeFile("$base.jpg") ||
+ LocateIncludeFile("$base.gif");
+ warn "$ERROR no image file for $base: $_" unless ($image && -e $image);
+ "<IMG SRC=\"$image\" ALT=\"$base\">";
+ ($T2H_CENTER_IMAGE ?
+ "<CENTER><IMG SRC=\"$image\" ALT=\"$base\"></CENTER>" :
+ "<IMG SRC=\"$image\" ALT=\"$base\">");
+ }eg;
+
+ #
+ # try to guess bibliography references or glossary terms
+ #
+ unless (/^<H\d><A NAME=\"SEC\d/) {
+ if ($use_bibliography) {
+ $done = '';
+ while (/$BIBRE/o) {
+ ($pre, $what, $post) = ($`, $&, $');
+ $href = $bib2href{$what};
+ if (defined($href) && $post !~ /^[^<]*<\/A>/) {
+ $done .= $pre . &t2h_anchor('', $href, $what);
+ } else {
+ $done .= "$pre$what";
+ }
+ $_ = $post;
+ }
+ $_ = $done . $_;
+ }
+ if ($T2H_USE_GLOSSARY) {
+ $done = '';
+ while (/\b\w+\b/) {
+ ($pre, $what, $post) = ($`, $&, $');
+ $entry = $what;
+ $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/;
+ $href = $gloss2href{$entry};
+ if (defined($href) && $post !~ /^[^<]*<\/A>/) {
+ $done .= $pre . &t2h_anchor('', $href, $what);
+ } else {
+ $done .= "$pre$what";
+ }
+ $_ = $post;
+ }
+ $_ = $done . $_;
+ }
+ }
+ # otherwise
+ push(@lines2, $_);
+}
+print "# end of pass 2\n" if $T2H_VERBOSE;
+
+#
+# split style substitutions
+#
+while (@lines2) {
+ $_ = shift(@lines2);
+ #
+ # special case (protected sections)
+ #
+ if (/^$PROTECTTAG/o) {
+ push(@lines3, $_);
+ next;
+ }
+ #
+ # split style substitutions
+ #
+ $old = '';
+ while ($old ne $_) {
+ $old = $_;
+ if (/\@(\w+)\{/) {
+ ($before, $style, $after) = ($`, $1, $');
+ if (defined($style_map{$style})) {
+ $_ = $after;
+ $text = '';
+ $after = '';
+ $failed = 1;
+ while (@lines2) {
+ if (/\}/) {
+ $text .= $`;
+ $after = $';
+ $failed = 0;
+ last;
+ } else {
+ $text .= $_;
+ $_ = shift(@lines2);
+ }
+ }
+ if ($failed) {
+ die "* Bad syntax (\@$style) after: $before\n";
+ } else {
+ $text = &apply_style($style, $text);
+ $_ = "$before$text$after";
+ }
+ }
+ }
+ }
+ # otherwise
+ push(@lines3, $_);
+}
+print "# end of pass 3\n" if $T2H_VERBOSE;
+
+#+++############################################################################
+# #
+# Pass 4: foot notes, final cleanup #
+# #
+#---############################################################################
+
+@foot_lines = (); # footnotes
+@doc_lines = (); # final document
+$end_of_para = 0; # true if last line is <P>
+
+while (@lines3) {
+ $_ = shift(@lines3);
+ #
+ # special case (protected sections)
+ #
+ if (/^$PROTECTTAG/o) {
+ push(@doc_lines, $_);
+ $end_of_para = 0;
+ next;
+ }
+ #
+ # footnotes
+ #
+ while (/\@footnote([^\{\s]+)\{/) {
+ ($before, $d, $after) = ($`, $1, $');
+ $_ = $after;
+ $text = '';
+ $after = '';
+ $failed = 1;
+ while (@lines3) {
+ if (/\}/) {
+ $text .= $`;
+ $after = $';
+ $failed = 0;
+ last;
+ } else {
+ $text .= $_;
+ $_ = shift(@lines3);
+ }
+ }
+ if ($failed) {
+ die "* Bad syntax (\@footnote) after: $before\n";
+ } else {
+ $foot_num++;
+ $docid = "DOCF$foot_num";
+ $footid = "FOOT$foot_num";
+ $foot = "($foot_num)";
+ push(@foot_lines, "<H3>" . &t2h_anchor($footid, "$d#$docid", $foot) . "</H3>\n");
+ $text = "<P>$text" unless $text =~ /^\s*<P>/;
+ push(@foot_lines, "$text\n");
+ $_ = $before . &t2h_anchor($docid, "$docu_foot#$footid", $foot) . $after;
+ }
+ }
+ #
+ # remove unnecessary <P>
+ #
+ if (/^\s*<P>\s*$/) {
+ next if $end_of_para++;
+ } else {
+ $end_of_para = 0;
+ }
+ # otherwise
+ push(@doc_lines, $_);
+}
+
+print "# end of pass 4\n" if $T2H_VERBOSE;
+
+#+++############################################################################
+# #
+# Pass 5: print things #
+# #
+#---############################################################################
+
+$T2H_L2H = &l2h_FinishToLatex if ($T2H_L2H);
+$T2H_L2H = &l2h_ToHtml if ($T2H_L2H);
+$T2H_L2H = &l2h_InitFromHtml if ($T2H_L2H);
+
+# fix node2up, node2prev, node2next, if desired
+if ($has_top_command)
+{
+ for $section (keys %sec2number)
+ {
+ $node = $sec2node{$section};
+ $node2up{$node} = Sec2UpNode($section) unless $node2up{$node};
+ $node2prev{$node} = Sec2PrevNode($section) unless $node2prev{$node};
+ $node2next{$node} = Sec2NextNode($section) unless $node2next{$node};
+ }
+}
+
+# prepare %T2H_THISDOC
+$T2H_THISDOC{fulltitle} = $value{'_title'} || $value{'_settitle'} || "Untitled Document";
+$T2H_THISDOC{title} = $value{'_settitle'} || $T2H_THISDOC{fulltitle};
+$T2H_THISDOC{author} = $value{'_author'};
+$T2H_THISDOC{subtitle} = $value{'_subtitle'};
+$T2H_THISDOC{shorttitle} = $value{'_shorttitle'};
+for $key (keys %T2H_THISDOC)
+{
+ $_ = &substitute_style($T2H_THISDOC{$key});
+ &unprotect_texi;
+ s/\s*$//;
+ $T2H_THISDOC{$key} = $_;
+}
+
+# if no sections, then simply print document as is
+unless (@sections)
+{
+ print "# Writing content into $docu_top_file \n" if $T2H_VERBOSE;
+ open(FILE, "> $docu_top_file")
+ || die "$ERROR: Can't open $docu_top_file for writing: $!\n";
+
+ &$T2H_print_page_head(\*FILE);
+ $T2H_THIS_SECTION = \@doc_lines;
+ t2h_print_lines(\*FILE);
+ &$T2H_print_foot_navigation(\*FILE);
+ &$T2H_print_page_foot(\*FILE);
+ close(FILE);
+ goto Finish;
+}
+
+# initialize $T2H_HREF, $T2H_NAME
+%T2H_HREF =
+ (
+ 'First' , sec_href($sections[0]),
+ 'Last', sec_href($sections[$#sections]),
+ 'About', $docu_about. '#SEC_About',
+ );
+
+# prepare TOC, OVERVIEW, TOP
+$T2H_TOC = \@toc_lines;
+$T2H_OVERVIEW = \@stoc_lines;
+if ($has_top)
+{
+ while (1)
+ {
+ $_ = shift @doc_lines;
+ last if /$TOPEND/;
+ push @$T2H_TOP, $_;
+ }
+ $T2H_HREF{'Top'} = $docu_top . '#SEC_Top';
+}
+else
+{
+ $T2H_HREF{'Top'} = $T2H_HREF{First};
+}
+
+$node2href{Top} = $T2H_HREF{Top};
+$T2H_HREF{Contents} = $docu_toc.'#SEC_Contents' if @toc_lines;
+$T2H_HREF{Overview} = $docu_stoc.'#SEC_OVERVIEW' if @stoc_lines;
+
+# settle on index
+if ($T2H_INDEX_CHAPTER)
+{
+ $T2H_HREF{Index} = $node2href{normalise_node($T2H_INDEX_CHAPTER)};
+ warn "$ERROR T2H_INDEX_CHAPTER '$T2H_INDEX_CHAPTER' not found\n"
+ unless $T2H_HREF{Index};
+}
+if (! $T2H_HREF{Index} && $first_index_chapter)
+{
+ $T2H_INDEX_CHAPTER = $first_index_chapter;
+ $T2H_HREF{Index} = $node2href{$T2H_INDEX_CHAPTER};
+}
+
+print "# Using '" . clean_name($T2H_INDEX_CHAPTER) . "' as index page\n"
+ if ($T2H_VERBOSE && $T2H_HREF{Index});
+
+%T2H_NAME =
+ (
+ 'First', clean_name($sec2node{$sections[0]}),
+ 'Last', clean_name($sec2node{$sections[$#sections]}),
+ 'About', $T2H_WORDS->{$T2H_LANG}->{'About_Title'},
+ 'Contents', $T2H_WORDS->{$T2H_LANG}->{'ToC_Title'},
+ 'Overview', $T2H_WORDS->{$T2H_LANG}->{'Overview_Title'},
+ 'Index' , clean_name($T2H_INDEX_CHAPTER),
+ 'Top', clean_name($T2H_TOP_HEADING || $T2H_THISDOC{'title'} || $T2H_THISDOC{'shorttitle'}),
+ );
+
+#############################################################################
+# print frame and frame toc file
+#
+if ( $T2H_FRAMES )
+{
+ open(FILE, "> $docu_frame_file")
+ || die "$ERROR: Can't open $docu_frame_file for writing: $!\n";
+ print "# Creating frame in $docu_frame_file ...\n" if $T2H_VERBOSE;
+ &$T2H_print_frame(\*FILE);
+ close(FILE);
+
+ open(FILE, "> $docu_toc_frame_file")
+ || die "$ERROR: Can't open $docu_toc_frame_file for writing: $!\n";
+ print "# Creating toc frame in $docu_frame_file ...\n" if $T2H_VERBOSE;
+ &$T2H_print_toc_frame(\*FILE);
+ close(FILE);
+}
+
+
+#############################################################################
+# print Top
+#
+open(FILE, "> $docu_top_file")
+ || die "$ERROR: Can't open $docu_top_file for writing: $!\n";
+&$T2H_print_page_head(\*FILE) unless ($T2H_SPLIT);
+
+if ($has_top)
+{
+ print "# Creating Top in $docu_top_file ...\n" if $T2H_VERBOSE;
+ $T2H_THIS_SECTION = $T2H_TOP;
+ $T2H_HREF{This} = $T2H_HREF{Top};
+ $T2H_NAME{This} = $T2H_NAME{Top};
+ &$T2H_print_Top(\*FILE);
+}
+
+close(FILE) if $T2H_SPLIT;
+
+#############################################################################
+# Print sections
+#
+$T2H_NODE{Forward} = $sec2node{$sections[0]};
+$T2H_NAME{Forward} = &clean_name($sec2node{$sections[0]});
+$T2H_HREF{Forward} = sec_href($sections[0]);
+$T2H_NODE{This} = 'Top';
+$T2H_NAME{This} = $T2H_NAME{Top};
+$T2H_HREF{This} = $T2H_HREF{Top};
+if ($T2H_SPLIT)
+{
+ print "# writing " . scalar(@sections) .
+ " sections in $docu_rdir$docu_name"."_[1..$doc_num]"
+ if $T2H_VERBOSE;
+ $previous = ($T2H_SPLIT eq 'chapter' ? $CHAPTEREND : $SECTIONEND);
+ undef $FH;
+ $doc_num = 0;
+}
+else
+{
+ print "# writing " . scalar(@sections) . " sections in $docu_top_file ..."
+ if $T2H_VERBOSE;
+ $FH = \*FILE;
+ $previous = '';
+}
+
+$counter = 0;
+# loop through sections
+while ($section = shift(@sections))
+{
+ if ($T2H_SPLIT && ($T2H_SPLIT eq 'section' || $previous eq $CHAPTEREND))
+ {
+ if ($FH)
+ {
+ #close previous page
+ &$T2H_print_chapter_footer($FH) if $T2H_SPLIT eq 'chapter';
+ &$T2H_print_page_foot($FH);
+ close($FH);
+ undef $FH;
+ }
+ }
+ $T2H_NAME{Back} = $T2H_NAME{This};
+ $T2H_HREF{Back} = $T2H_HREF{This};
+ $T2H_NODE{Back} = $T2H_NODE{This};
+ $T2H_NAME{This} = $T2H_NAME{Forward};
+ $T2H_HREF{This} = $T2H_HREF{Forward};
+ $T2H_NODE{This} = $T2H_NODE{Forward};
+ if ($sections[0])
+ {
+ $T2H_NODE{Forward} = $sec2node{$sections[0]};
+ $T2H_NAME{Forward} = &clean_name($T2H_NODE{Forward});
+ $T2H_HREF{Forward} = sec_href($sections[0]);
+ }
+ else
+ {
+ undef $T2H_HREF{Forward}, $T2H_NODE{Forward}, $T2H_NAME{Forward};
+ }
+
+ $node = $node2up{$T2H_NODE{This}};
+ $T2H_HREF{Up} = $node2href{$node};
+ if ($T2H_HREF{Up} eq $T2H_HREF{This} || ! $T2H_HREF{Up})
+ {
+ $T2H_NAME{Up} = $T2H_NAME{Top};
+ $T2H_HREF{Up} = $T2H_HREF{Top};
+ $T2H_NODE{Up} = 'Up';
+ }
+ else
+ {
+ $T2H_NAME{Up} = &clean_name($node);
+ $T2H_NODE{Up} = $node;
+ }
+
+ $node = $T2H_NODE{This};
+ $node = $node2prev{$node};
+ $T2H_NAME{Prev} = &clean_name($node);
+ $T2H_HREF{Prev} = $node2href{$node};
+ $T2H_NODE{Prev} = $node;
+
+ $node = $T2H_NODE{This};
+ if ($node2up{$node} && $node2up{$node} ne 'Top'&&
+ ($node2prev{$node} eq $T2H_NODE{Back} || ! $node2prev{$node}))
+ {
+ $node = $node2up{$node};
+ while ($node && $node ne $node2up{$node} && ! $node2prev{$node})
+ {
+ $node = $node2up{$node};
+ }
+ $node = $node2prev{$node}
+ unless $node2up{$node} eq 'Top' || ! $node2up{$node};
+ }
+ else
+ {
+ $node = $node2prev{$node};
+ }
+ $T2H_NAME{FastBack} = &clean_name($node);
+ $T2H_HREF{FastBack} = $node2href{$node};
+ $T2H_NODE{FastBack} = $node;
+
+ $node = $T2H_NODE{This};
+ $node = $node2next{$node};
+ $T2H_NAME{Next} = &clean_name($node);
+ $T2H_HREF{Next} = $node2href{$node};
+ $T2H_NODE{Next} = $node;
+
+ $node = $T2H_NODE{This};
+ if ($node2up{$node} && $node2up{$node} ne 'Top'&&
+ ($node2next{$node} eq $T2H_NODE{Forward} || ! $node2next{$node}))
+ {
+ $node = $node2up{$node};
+ while ($node && $node ne $node2up{$node} && ! $node2next{$node})
+ {
+ $node = $node2up{$node};
+ }
+ }
+ $node = $node2next{$node};
+ $T2H_NAME{FastForward} = &clean_name($node);
+ $T2H_HREF{FastForward} = $node2href{$node};
+ $T2H_NODE{FastForward} = $node;
+
+ if (! defined($FH))
+ {
+ my $file = $T2H_HREF{This};
+ $file =~ s/\#.*$//;
+ open(FILE, "> $docu_rdir$file") ||
+ die "$ERROR: Can't open $docu_rdir$file for writing: $!\n";
+ $FH = \*FILE;
+ &$T2H_print_page_head($FH);
+ t2h_print_label($FH);
+ &$T2H_print_chapter_header($FH) if $T2H_SPLIT eq 'chapter';
+ }
+ else
+ {
+ t2h_print_label($FH);
+ }
+
+ $T2H_THIS_SECTION = [];
+ while (@doc_lines) {
+ $_ = shift(@doc_lines);
+ last if ($_ eq $SECTIONEND || $_ eq $CHAPTEREND);
+ push(@$T2H_THIS_SECTION, $_);
+ }
+ $previous = $_;
+ &$T2H_print_section($FH);
+
+ if ($T2H_VERBOSE)
+ {
+ $counter++;
+ print "." if $counter =~ /00$/;
+ }
+}
+if ($T2H_SPLIT)
+{
+ &$T2H_print_chapter_footer($FH) if $T2H_SPLIT eq 'chapter';
+ &$T2H_print_page_foot($FH);
+ close($FH);
+}
+print "\n" if $T2H_VERBOSE;
+
+#############################################################################
+# Print ToC, Overview, Footnotes
+#
+undef $T2H_HREF{Prev};
+undef $T2H_HREF{Next};
+undef $T2H_HREF{Back};
+undef $T2H_HREF{Forward};
+undef $T2H_HREF{Up};
+
+if (@foot_lines)
+{
+ print "# writing Footnotes in $docu_foot_file...\n" if $T2H_VERBOSE;
+ open (FILE, "> $docu_foot_file") || die "$ERROR: Can't open $docu_foot_file for writing: $!\n"
+ if $T2H_SPLIT;
+ $T2H_HREF{This} = $docu_foot;
+ $T2H_NAME{This} = $T2H_WORDS->{$T2H_LANG}->{'Footnotes_Title'};
+ $T2H_THIS_SECTION = \@foot_lines;
+ &$T2H_print_Footnotes(\*FILE);
+ close(FILE) if $T2H_SPLIT;
+}
+
+if (@toc_lines)
+{
+ print "# writing Toc in $docu_toc_file...\n" if $T2H_VERBOSE;
+ open (FILE, "> $docu_toc_file") || die "$ERROR: Can't open $docu_toc_file for writing: $!\n"
+ if $T2H_SPLIT;
+ $T2H_HREF{This} = $T2H_HREF{Contents};
+ $T2H_NAME{This} = $T2H_NAME{Contents};
+ $T2H_THIS_SECTION = \@toc_lines;
+ &$T2H_print_Toc(\*FILE);
+ close(FILE) if $T2H_SPLIT;
+}
+
+if (@stoc_lines)
+{
+ print "# writing Overview in $docu_stoc_file...\n" if $T2H_VERBOSE;
+ open (FILE, "> $docu_stoc_file") || die "$ERROR: Can't open $docu_stoc_file for writing: $!\n"
+ if $T2H_SPLIT;
+
+ $T2H_HREF{This} = $T2H_HREF{Overview};
+ $T2H_NAME{This} = $T2H_NAME{Overview};
+ $T2H_THIS_SECTION = \@stoc_lines;
+ unshift @$T2H_THIS_SECTION, "<BLOCKQUOTE>\n";
+ push @$T2H_THIS_SECTION, "\n</BLOCKQUOTE>\n";
+ &$T2H_print_Overview(\*FILE);
+ close(FILE) if $T2H_SPLIT;
+}
+
+if ($about_body = &$T2H_about_body())
+{
+ print "# writing About in $docu_about_file...\n" if $T2H_VERBOSE;
+ open (FILE, "> $docu_about_file") || die "$ERROR: Can't open $docu_about_file for writing: $!\n"
+ if $T2H_SPLIT;
+
+ $T2H_HREF{This} = $T2H_HREF{About};
+ $T2H_NAME{This} = $T2H_NAME{About};
+ $T2H_THIS_SECTION = [$about_body];
+ &$T2H_print_About(\*FILE);
+ close(FILE) if $T2H_SPLIT;
+}
+
+unless ($T2H_SPLIT)
+{
+ &$T2H_print_page_foot(\*FILE);
+ close (FILE);
+}
+
+Finish:
+&l2h_FinishFromHtml if ($T2H_L2H);
+&l2h_Finish if($T2H_L2H);
+print "# that's all folks\n" if $T2H_VERBOSE;
+
+exit(0);
+
+#+++############################################################################
+# #
+# Low level functions #
+# #
+#---############################################################################
+
+sub LocateIncludeFile
+{
+ my $file = shift;
+ my $dir;
+
+ return $file if (-e $file && -r $file);
+ foreach $dir (@T2H_INCLUDE_DIRS)
+ {
+ return "$dir/$file" if (-e "$dir/$file" && -r "$dir/$file");
+ }
+ return undef;
+}
+
+sub clean_name
+{
+ local ($_);
+ $_ = &remove_style($_[0]);
+ &unprotect_texi;
+ return $_;
+}
+
+sub update_sec_num {
+ local($name, $level) = @_;
+ my $ret;
+
+ $level--; # here we start at 0
+ if ($name =~ /^appendix/ || defined(@appendix_sec_num)) {
+ # appendix style
+ if (defined(@appendix_sec_num)) {
+ &incr_sec_num($level, @appendix_sec_num);
+ } else {
+ @appendix_sec_num = ('A', 0, 0, 0);
+ }
+ $ret = join('.', @appendix_sec_num[0..$level]);
+ } else {
+ # normal style
+ if (defined(@normal_sec_num))
+ {
+ &incr_sec_num($level, @normal_sec_num);
+ }
+ else
+ {
+ @normal_sec_num = (1, 0, 0, 0);
+ }
+ $ret = join('.', @normal_sec_num[0..$level]);
+ }
+
+ $ret .= "." if $level == 0;
+ return $ret;
+}
+
+sub incr_sec_num {
+ local($level, $l);
+ $level = shift(@_);
+ $_[$level]++;
+ foreach $l ($level+1 .. 3) {
+ $_[$l] = 0;
+ }
+}
+
+sub Sec2UpNode
+{
+ my $sec = shift;
+ my $num = $sec2number{$sec};
+
+ return '' unless $num;
+ return 'Top' unless $num =~ /\.\d+/;
+ $num =~ s/\.[^\.]*$//;
+ $num = $num . '.' unless $num =~ /\./;
+ return $sec2node{$number2sec{$num}};
+}
+
+sub Sec2PrevNode
+{
+ my $sec = shift;
+ my $num = $sec2number{$sec};
+ my ($i, $post);
+
+ if ($num =~ /(\w+)(\.$|$)/)
+ {
+ $num = $`;
+ $i = $1;
+ $post = $2;
+ if ($i eq 'A')
+ {
+ $i = $normal_sec_num[0];
+ }
+ elsif ($i ne '1')
+ {
+ # unfortunately, -- operator is not magical
+ $i = chr(ord($i) + 1);
+ }
+ else
+ {
+ return '';
+ }
+ return $sec2node{$number2sec{$num . $i . $post}}
+ }
+ return '';
+}
+
+sub Sec2NextNode
+{
+ my $sec = shift;
+ my $num = $sec2number{$sec};
+ my $i;
+
+ if ($num =~ /(\w+)(\.$|$)/)
+ {
+ $num = $`;
+ $i = $1;
+ $post = $2;
+ if ($post eq '.' && $i eq $normal_sec_num[0])
+ {
+ $i = 'A';
+ }
+ else
+ {
+ $i++;
+ }
+ return $sec2node{$number2sec{$num . $i . $post}}
+ }
+ return '';
+}
+
+sub check {
+ local($_, %seen, %context, $before, $match, $after);
+
+ while (<>) {
+ if (/\@(\*|\.|\:|\@|\{|\})/) {
+ $seen{$&}++;
+ $context{$&} .= "> $_" if $T2H_VERBOSE;
+ $_ = "$`XX$'";
+ redo;
+ }
+ if (/\@(\w+)/) {
+ ($before, $match, $after) = ($`, $&, $');
+ if ($before =~ /\b[\w-]+$/ && $after =~ /^[\w-.]*\b/) { # e-mail address
+ $seen{'e-mail address'}++;
+ $context{'e-mail address'} .= "> $_" if $T2H_VERBOSE;
+ } else {
+ $seen{$match}++;
+ $context{$match} .= "> $_" if $T2H_VERBOSE;
+ }
+ $match =~ s/^\@/X/;
+ $_ = "$before$match$after";
+ redo;
+ }
+ }
+
+ foreach (sort(keys(%seen))) {
+ if ($T2H_VERBOSE) {
+ print "$_\n";
+ print $context{$_};
+ } else {
+ print "$_ ($seen{$_})\n";
+ }
+ }
+}
+
+sub open {
+ local($name) = @_;
+
+ ++$fh_name;
+ if (open($fh_name, $name)) {
+ unshift(@fhs, $fh_name);
+ } else {
+ warn "$ERROR Can't read file $name: $!\n";
+ }
+}
+
+sub init_input {
+ @fhs = (); # hold the file handles to read
+ @input_spool = (); # spooled lines to read
+ $fh_name = 'FH000';
+ &open($docu);
+}
+
+sub next_line {
+ local($fh, $line);
+
+ if (@input_spool) {
+ $line = shift(@input_spool);
+ return($line);
+ }
+ while (@fhs) {
+ $fh = $fhs[0];
+ $line = <$fh>;
+ return($line) if $line;
+ close($fh);
+ shift(@fhs);
+ }
+ return(undef);
+}
+
+# used in pass 1, use &next_line
+sub skip_until {
+ local($tag) = @_;
+ local($_);
+
+ while ($_ = &next_line) {
+ return if /^\@end\s+$tag\s*$/;
+ }
+ die "* Failed to find '$tag' after: " . $lines[$#lines];
+}
+
+# used in pass 1 for l2h use &next_line
+sub string_until {
+ local($tag) = @_;
+ local($_, $string);
+
+ while ($_ = &next_line) {
+ return $string if /^\@end\s+$tag\s*$/;
+# $_ =~ s/hbox/mbox/g;
+ $string = $string.$_;
+ }
+ die "* Failed to find '$tag' after: " . $lines[$#lines];
+}
+
+#
+# HTML stacking to have a better HTML output
+#
+
+sub html_reset {
+ @html_stack = ('html');
+ $html_element = 'body';
+}
+
+sub html_push {
+ local($what) = @_;
+ push(@html_stack, $html_element);
+ $html_element = $what;
+}
+
+sub html_push_if {
+ local($what) = @_;
+ push(@html_stack, $html_element)
+ if ($html_element && $html_element ne 'P');
+ $html_element = $what;
+}
+
+sub html_pop {
+ $html_element = pop(@html_stack);
+}
+
+sub html_pop_if {
+ local($elt);
+
+ if (@_) {
+ foreach $elt (@_) {
+ if ($elt eq $html_element) {
+ $html_element = pop(@html_stack) if @html_stack;
+ last;
+ }
+ }
+ } else {
+ $html_element = pop(@html_stack) if @html_stack;
+ }
+}
+
+sub html_debug {
+ local($what, $line) = @_;
+ if ($T2H_DEBUG & $DEBUG_HTML)
+ {
+ $what = "\n" unless $what;
+ return("<!-- $line @html_stack, $html_element -->$what")
+ }
+ return($what);
+}
+
+# to debug the output...
+sub debug {
+ local($what, $line) = @_;
+ return("<!-- $line -->$what")
+ if $T2H_DEBUG & $DEBUG_HTML;
+ return($what);
+}
+
+sub SimpleTexi2Html
+{
+ local $_ = $_[0];
+ &protect_texi;
+ &protect_html;
+ $_ = substitute_style($_);
+ $_[0] = $_;
+}
+
+sub normalise_node {
+ local $_ = $_[0];
+ s/\s+/ /g;
+ s/ $//;
+ s/^ //;
+ &protect_texi;
+ &protect_html;
+ $_ = substitute_style($_);
+ $_[0] = $_;
+}
+
+sub menu_entry
+{
+ my ($node, $name, $descr) = @_;
+ my ($href, $entry);
+
+ &normalise_node($node);
+ $href = $node2href{$node};
+ if ($href)
+ {
+ $descr =~ s/^\s+//;
+ $descr =~ s/\s*$//;
+ $descr = SimpleTexi2Html($descr);
+ if ($T2H_NUMBER_SECTIONS && !$T2H_NODE_NAME_IN_MENU && $node2sec{$node})
+ {
+ $entry = $node2sec{$node};
+ $name = '';
+ }
+ else
+ {
+ &normalise_node($name);
+ $entry = ($name && ($name ne $node || ! $T2H_AVOID_MENU_REDUNDANCY)
+ ? "$name : $node" : $node);
+ }
+
+ if ($T2H_AVOID_MENU_REDUNDANCY && $descr)
+ {
+ my $clean_entry = $entry;
+ $clean_entry =~ s/^.*? // if ($clean_entry =~ /^([A-Z]|\d+)\.[\d\.]* /);
+ $clean_entry =~ s/[^\w]//g;
+ my $clean_descr = $descr;
+ $clean_descr =~ s/[^\w]//g;
+ $descr = '' if ($clean_entry eq $clean_descr)
+ }
+ push(@lines2,&debug('<TR><TD ALIGN="left" VALIGN="TOP">' .
+ &t2h_anchor('', $href, $entry) .
+ '</TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP">' .
+ $descr .
+ "</TD></TR>\n", __LINE__));
+ }
+ elsif ($node =~ /^\(.*\)\w+/)
+ {
+ push(@lines2,&debug('<TR><TD ALIGN="left" VALIGN="TOP">' .
+ $entry .
+ '</TD><TD ALIGN="left" VALIGN="TOP">' . $descr .
+ "</TD></TR>\n", __LINE__))
+ }
+ else
+ {
+ warn "$ERROR Undefined node of menu_entry ($node): $_";
+ }
+}
+
+sub do_ctrl { "^$_[0]" }
+
+sub do_email {
+ local($addr, $text) = split(/,\s*/, $_[0]);
+
+ $text = $addr unless $text;
+ &t2h_anchor('', "mailto:$addr", $text);
+}
+
+sub do_sc
+{
+ # l2h does this much better
+ return &l2h_ToLatex("{\\sc ".&unprotect_html($_[0])."}") if ($T2H_L2H);
+ return "\U$_[0]\E";
+}
+
+sub do_math
+{
+ return &l2h_ToLatex("\$".&unprotect_html($_[0])."\$") if ($T2H_L2H);
+ return "<EM>".$text."</EM>";
+}
+
+sub do_uref {
+ local($url, $text, $only_text) = split(/,\s*/, $_[0]);
+
+ $text = $only_text if $only_text;
+ $text = $url unless $text;
+ &t2h_anchor('', $url, $text);
+}
+
+sub do_url { &t2h_anchor('', $_[0], $_[0]) }
+
+sub do_acronym
+{
+ return '<FONT SIZE="-1">' . $_[0] . '</FONT>';
+}
+
+sub do_accent
+{
+ return "&$_[0]acute;" if $_[1] eq 'H';
+ return "$_[0]." if $_[1] eq 'dotaccent';
+ return "$_[0]*" if $_[1] eq 'ringaccent';
+ return "$_[0]".'[' if $_[1] eq 'tieaccent';
+ return "$_[0]".'(' if $_[1] eq 'u';
+ return "$_[0]_" if $_[1] eq 'ubaraccent';
+ return ".$_[0]" if $_[1] eq 'udotaccent';
+ return "$_[0]&lt;" if $_[1] eq 'v';
+ return "&$_[0]cedil;" if $_[1] eq ',';
+ return "$_[0]" if $_[1] eq 'dotless';
+ return undef;
+}
+
+sub apply_style {
+ local($texi_style, $text) = @_;
+ local($style);
+
+ $style = $style_map{$texi_style};
+ if (defined($style)) { # known style
+ if ($style =~ /^\"/) { # add quotes
+ $style = $';
+ $text = "\`$text\'";
+ }
+ if ($style =~ /^\&/) { # custom
+ $style = $';
+ $text = &$style($text, $texi_style);
+ } elsif ($style) { # good style
+ $text = "<$style>$text</$style>";
+ } else { # no style
+ }
+ } else { # unknown style
+ $text = undef;
+ }
+ return($text);
+}
+
+# remove Texinfo styles
+sub remove_style {
+ local($_) = @_;
+ 1 while(s/\@\w+{([^\{\}]+)}/$1/g);
+ return($_);
+}
+
+sub remove_things
+{
+ local ($_) = @_;
+ s|\@(\w+)\{\}|$1|g;
+ return $_;
+}
+
+sub substitute_style {
+ local($_) = @_;
+ local($changed, $done, $style, $text);
+
+ &simple_substitutions;
+ $changed = 1;
+ while ($changed) {
+ $changed = 0;
+ $done = '';
+ while (/\@(\w+){([^\{\}]+)}/ || /\@(,){([^\{\}]+)}/) {
+ $text = &apply_style($1, $2);
+ if ($text) {
+ $_ = "$`$text$'";
+ $changed = 1;
+ } else {
+ $done .= "$`\@$1";
+ $_ = "{$2}$'";
+ }
+ }
+ $_ = $done . $_;
+ }
+ return($_);
+}
+
+sub t2h_anchor {
+ local($name, $href, $text, $newline, $extra_attribs) = @_;
+ local($result);
+
+ $result = "<A";
+ $result .= " NAME=\"$name\"" if $name;
+ if ($href)
+ {
+ $href =~ s|^$T2H_HREF_DIR_INSTEAD_FILE|./|
+ if ($T2H_HREF_DIR_INSTEAD_FILE);
+ $result .= ($href =~ /\"/ ? " HREF='$href'" : " HREF=\"$href\"");
+ }
+ $result .= " $extra_attribs" if $extra_attribs;
+ $result .= ">$text</A>";
+ $result .= "\n" if $newline;
+ return($result);
+}
+
+sub pretty_date {
+ local(@MoY, $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
+
+ @MoY = ('January', 'February', 'March', 'April', 'May', 'June',
+ 'July', 'August', 'September', 'October', 'November', 'December');
+ ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
+ $year += ($year < 70) ? 2000 : 1900;
+ # obachman: Let's do it as the Americans do
+ return("$MoY[$mon], $mday $year");
+}
+
+sub doc_href {
+ local($num) = @_;
+
+ return("${docu_name}_$num.$docu_ext");
+}
+
+sub sec_href
+{
+ return $node2href{$sec2node{$_[0]}};
+}
+
+sub next_doc {
+ $docu_doc = &doc_href(++$doc_num);
+}
+
+sub t2h_print_lines {
+ my ($fh, $lines) = @_;
+ local($_);
+ $lines = $T2H_THIS_SECTION unless $lines;
+ my $cnt = 0;
+ for (@$lines)
+ {
+ $_ = l2h_FromHtml($_) if ($T2H_L2H);
+ if (/^$PROTECTTAG/o) {
+ $_ = $tag2pro{$_};
+ } else {
+ &unprotect_texi;
+ }
+ print $fh $_;
+ $cnt += split(/\W*\s+\W*/);
+ }
+ return $cnt;
+}
+
+sub protect_texi {
+ # protect @ { } ` '
+ s/\@\@/$;0/go;
+ s/\@\{/$;1/go;
+ s/\@\}/$;2/go;
+ s/\@\`/$;3/go;
+ s/\@\'/$;4/go;
+}
+
+sub protect_html {
+ local($what) = @_;
+ # protect & < >
+ $what =~ s/\&/\&\#38;/g;
+ $what =~ s/\</\&\#60;/g;
+ $what =~ s/\>/\&\#62;/g;
+ # restore anything in quotes
+ # this fixes my problem where I had:
+ # < IMG SRC="leftarrow.gif" ALT="<--" > but what if I wanted &#60; in my ALT text ??
+ # maybe byte stuffing or some other technique should be used.
+ $what =~ s/\"([^\&]+)\&\#60;(.*)\"/"$1<$2"/g;
+ $what =~ s/\"([^\&]+)\&\#62;(.*)\"/"$1>$2"/g;
+ $what =~ s/\"([^\&]+)\&\#38;(.*)\"/"$1&$2"/g;
+ # but recognize some HTML things
+ $what =~ s/\&\#60;\/A\&\#62;/<\/A>/g; # </A>
+ $what =~ s/\&\#60;A ([^\&]+)\&\#62;/<A $1>/g; # <A [^&]+>
+ $what =~ s/\&\#60;IMG ([^\&]+)\&\#62;/<IMG $1>/g; # <IMG [^&]+>
+ return($what);
+}
+
+sub unprotect_texi {
+ s/$;0/\@/go;
+ s/$;1/\{/go;
+ s/$;2/\}/go;
+ s/$;3/\`/go;
+ s/$;4/\'/go;
+}
+
+sub Unprotect_texi
+{
+ local $_ = shift;
+ &unprotect_texi;
+ return($_);
+}
+
+sub unprotect_html {
+ local($what) = @_;
+ $what =~ s/\&\#38;/\&/g;
+ $what =~ s/\&\#60;/\</g;
+ $what =~ s/\&\#62;/\>/g;
+ return($what);
+}
+
+sub t2h_print_label
+{
+ my $fh = shift;
+ my $href = shift || $T2H_HREF{This};
+ $href =~ s/.*#(.*)$/$1/;
+ print $fh qq{<A NAME="$href"></A>\n};
+}
+
+##############################################################################
+
+ # These next few lines are legal in both Perl and nroff.
+
+.00 ; # finish .ig
+
+'di \" finish diversion--previous line must be blank
+.nr nl 0-1 \" fake up transition to first page again
+.nr % 0 \" start at page 1
+'; __END__ ############# From here on it's a standard manual page ############
+.so /usr/local/man/man1/texi2html.1
diff --git a/support/xenix-link.sh b/support/xenix-link.sh
new file mode 100755
index 0000000..ed22a08
--- /dev/null
+++ b/support/xenix-link.sh
@@ -0,0 +1,84 @@
+:
+# link bash for Xenix under SCO Unix
+#
+# For xenix 2.2:
+# CC="cc -xenix -lx" ./configure
+# edit config.h:
+# comment out the define for HAVE_DIRENT_H
+# enable the define for HAVE_SYS_NDIR_H to 1
+# make
+# CC="cc -xenix -lx" ./link.sh
+#
+# For xenix 2.3:
+# CC="cc -x2.3" ./configure
+# make
+# CC="cc -x2.3" ./link.sh
+
+# Copyright (C) 1989-2002 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+set -x
+
+rm -f bash
+
+if [ -z "$CC" ]
+then
+ if [ -f /unix ] && [ ! -f /xenix ]
+ then
+ CC="cc -xenix"
+ else
+ CC=gcc
+ fi
+fi
+
+try_dir=no
+try_23=no
+try_x=yes
+
+case "$CC" in
+*-ldir*) try_dir=yes ;;
+esac
+
+case "$CC" in
+*-lx*) try_23=no ; try_x=yes ;;
+esac
+
+case "$CC" in
+*-x2.3*|*-l2.3*) try_23=yes ; try_dir=yes ;;
+esac
+
+libs=
+try="socket"
+if [ $try_dir = yes ] ; then try="$try dir" ; fi
+if [ $try_23 = yes ] ; then try="$try 2.3" ; fi
+if [ $try_x = yes ] ; then try="$try x" ; fi
+for name in $try
+do
+ if [ -r "/lib/386/Slib${name}.a" ] ; then libs="$libs -l$name" ; fi
+done
+
+$CC -o bash shell.o eval.o y.tab.o \
+general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o \
+copy_cmd.o error.o expr.o flags.o nojobs.o subst.o hashcmd.o hashlib.o \
+mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o \
+version.o alias.o array.o braces.o bracecomp.o bashhist.o bashline.o \
+getcwd.o siglist.o vprint.o oslib.o list.o stringlib.o locale.o \
+xmalloc.o builtins/libbuiltins.a \
+lib/readline/libreadline.a lib/readline/libhistory.a \
+-ltermcap lib/glob/libglob.a lib/tilde/libtilde.a lib/malloc/libmalloc.a \
+$libs
+
+ls -l bash
diff --git a/support/zecho.c b/support/zecho.c
new file mode 100644
index 0000000..cc6ae60
--- /dev/null
+++ b/support/zecho.c
@@ -0,0 +1,42 @@
+/* zecho - bare-bones echo */
+
+/* Copyright (C) 1996-2002 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with Bash; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+
+#include "bashansi.h"
+#include <stdio.h>
+
+int
+main(argc, argv)
+int argc;
+char **argv;
+{
+ argv++;
+
+ while (*argv) {
+ (void)printf("%s", *argv);
+ if (*++argv)
+ putchar(' ');
+ }
+
+ putchar('\n');
+ exit(0);
+}