aboutsummaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1996-12-23 17:02:34 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:49 +0000
commitccc6cda312fea9f0468ee65b8f368e9653e1380b (patch)
treeb059878adcfd876c4acb8030deda1eeb918c7e75 /support
parent726f63884db0132f01745f1fb4465e6621088ccf (diff)
downloadandroid_external_bash-ccc6cda312fea9f0468ee65b8f368e9653e1380b.tar.gz
android_external_bash-ccc6cda312fea9f0468ee65b8f368e9653e1380b.tar.bz2
android_external_bash-ccc6cda312fea9f0468ee65b8f368e9653e1380b.zip
Imported from ../bash-2.0.tar.gz.
Diffstat (limited to 'support')
-rw-r--r--support/PORTING22
-rw-r--r--support/SYMLINKS9
-rw-r--r--support/bashbug.sh88
-rw-r--r--support/cat-s16
-rwxr-xr-xsupport/clone-bash95
-rwxr-xr-xsupport/config.guess904
-rwxr-xr-xsupport/config.sub903
-rwxr-xr-xsupport/cppmagic51
-rwxr-xr-xsupport/fixlinks10
-rw-r--r--support/getcppsyms.c428
-rwxr-xr-xsupport/inpath19
-rwxr-xr-xsupport/mkclone102
-rwxr-xr-xsupport/mkdirs19
-rwxr-xr-xsupport/mklinks41
-rwxr-xr-xsupport/mkmachtype279
-rw-r--r--support/mksignames.c302
-rwxr-xr-xsupport/mksysdefs497
-rw-r--r--support/mkversion.c305
-rw-r--r--support/recho.c1
-rwxr-xr-xsupport/srcdir13
-rwxr-xr-xsupport/texi2dvi208
-rwxr-xr-xsupport/texi2html2021
-rw-r--r--support/zecho.c20
23 files changed, 4752 insertions, 1601 deletions
diff --git a/support/PORTING b/support/PORTING
deleted file mode 100644
index 1869472..0000000
--- a/support/PORTING
+++ /dev/null
@@ -1,22 +0,0 @@
-if _mkfifo cannot be found, add "-DMKFIFO_MISSING" to SYSDEP_CFLAGS in
-your machine's entry in machines.h.
-
-If bash compiles, but hangs when executing a non-builtin, there is a
-problem with the defines in your /usr/include/sys/wait.h. If you
-don't have one, there is a problem in our defines. At any rate,
-perhaps you have a partially POSIX system, instead of a fully
-operational one. Try defining _POSIX_SOURCE just before the inclusion
-of <sys/wait.h> in jobs.h, and then undefining it immediately after
-the inclusion.
-
-Finding out if your system has something (like setpgid, for example)
-You can always do "nm -o /lib/*.a | grep setpgid". If an entry for
-the function appears, you have it, and you might have to link with
-that library by adding "#defined REQUIRED_LIBRARIES -lfoo" to the
-entry in machines.h.
-
-If you seem to be going around in circles, and they are related to
-job control and posixness, try #undef HAVE_UNISTD_H in the entry for
-your machine in machines.h. This can work by keeping unistd.h from
-defining _POSIX_VERSION, which in turn prevents bash from assuming
-full Posix semantics.
diff --git a/support/SYMLINKS b/support/SYMLINKS
index bd36b7e..ec2a5c6 100644
--- a/support/SYMLINKS
+++ b/support/SYMLINKS
@@ -3,19 +3,16 @@
#
# link name link target
#
-lib/readline/doc/texindex.c ../../doc-support/texindex.c
-#
lib/readline/tilde.c ../tilde/tilde.c
lib/readline/tilde.h ../tilde/tilde.h
+lib/readline/posixdir.h ../posixheaders/posixdir.h
lib/readline/posixstat.h ../posixheaders/posixstat.h
lib/readline/ansi_stdlib.h ../posixheaders/ansi_stdlib.h
-lib/readline/memalloc.h ../posixheaders/memalloc.h
lib/readline/xmalloc.c ../malloc/xmalloc.c
#
-lib/tilde/memalloc.h ../posixheaders/memalloc.h
-#
-lib/doc-support/getopt.h ../../builtins/getopt.h
+#lib/tilde/memalloc.h ../posixheaders/memalloc.h
#
+posixdir.h lib/posixheaders/posixdir.h
posixstat.h lib/posixheaders/posixstat.h
ansi_stdlib.h lib/posixheaders/ansi_stdlib.h
stdc.h lib/posixheaders/stdc.h
diff --git a/support/bashbug.sh b/support/bashbug.sh
index fb5600b..6a2a47b 100644
--- a/support/bashbug.sh
+++ b/support/bashbug.sh
@@ -1,26 +1,39 @@
#!/bin/sh -
#
-# bashbug - create a bug report and mail it to bug-bash@prep.ai.mit.edu
+# 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 `alpha' or `beta' mail bug reports to chet@po.cwru.edu.
+# Other versions send mail to bug-bash@prep.ai.mit.edu.
#
# configuration section:
# these variables are filled in by the make target in cpp-Makefile
#
-MACHINE="@MACHINE@"
-OS="@OS@"
-CC="@CC@"
-CFLAGS="@CFLAGS@"
-RELEASE="@RELEASE@"
-PATCHLEVEL="@PATCHLEVEL@"
-
-PATH=/bin:/usr/bin:usr/local/bin:$PATH
+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
TEMP=/tmp/bashbug.$$
-BUGADDR=${1-bug-bash@prep.ai.mit.edu}
+case "$RELSTATUS" in
+alpha*|beta*) BUGBASH=chet@po.cwru.edu ;;
+*) BUGBASH=bug-bash@prep.ai.mit.edu ;;
+esac
+
+BUGADDR=${1-$BUGBASH}
: ${EDITOR=emacs}
+: ${USER=${LOGNAME-`whoami`}}
+
trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
trap 'rm -f $TEMP $TEMP.x' 0
@@ -48,37 +61,60 @@ 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.]
+ [Detailed description of the problem, suggestion, or complaint.]
Repeat-By:
- [Describe the sequence of events that causes the problem
- to occur.]
+ [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.]
+ [Description of how to fix the problem. If you don't know a
+ fix for the problem, don't include this section.]
EOF
chmod u+w $TEMP
cp $TEMP $TEMP.x
-if $EDITOR $TEMP
+# 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
+
+trap '' 2 # ignore interrupts while in editor
+
+until $EDITOR $TEMP; do
+ 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
+done
+
+trap 'rm -f $TEMP $TEMP.x; exit 1' 2 # restore trap on SIGINT
+
+if cmp -s $TEMP $TEMP.x
then
- if cmp -s $TEMP $TEMP.x
- then
- echo "File not changed, no bug report submitted."
- exit
- fi
-
- ${RMAIL} $BUGADDR < $TEMP || {
- cat $TEMP >> $HOME/dead.bashbug
- echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2
- }
+ echo "File not changed, no bug report submitted."
+ exit
fi
+${RMAIL} $BUGADDR < $TEMP || {
+ cat $TEMP >> $HOME/dead.bashbug
+ echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2
+}
+
exit 0
diff --git a/support/cat-s b/support/cat-s
deleted file mode 100644
index 87ba163..0000000
--- a/support/cat-s
+++ /dev/null
@@ -1,16 +0,0 @@
-# This awk script is called from within Makefile to strip multiple blank
-# lines from stdin.
-BEGIN { newlines = 0 }
-{
- if (NF == 0)
- newlines = 1;
- else
- {
- if (newlines)
- {
- printf "\n";
- newlines = 0;
- }
- print $0;
- }
-}
diff --git a/support/clone-bash b/support/clone-bash
deleted file mode 100755
index 89e0752..0000000
--- a/support/clone-bash
+++ /dev/null
@@ -1,95 +0,0 @@
-#! /bin/sh
-#
-#
-src=src
-case "$1" in
--s) shift; src=$1; shift ;;
-esac
-
-if [ ! -d $1 ]; then
- mkdir $1
-fi
-
-prog=`basename $0`
-
-echo "${prog}: creating clone of bash source tree (from $src) in $1"
-
-case $src in
-/*) abs=yes ;;
-esac
-
-d=${PWD-`pwd`}
-
-cd $1 || { echo "$0: cannot cd to $1" ; exit 1; }
-
-d=$d/$1
-
-SUBDIRS="CWRU builtins documentation examples support tests"
-LIBDIRS="malloc termcap glob readline tilde malloclib posixheaders doc-support"
-CWRUDIRS="misc"
-
-mkdir $SUBDIRS
-for i in $SUBDIRS
-do
- cd $i
- case "$abs" in
- yes) ln -s $src/$i/* . ;;
- *) ln -s ../../$src/$i/* . ;;
- esac
- echo -n $i..
- cd ..
-done
-cd $d
-
-cd CWRU
-for i in $CWRUDIRS
-do
- rm -f $i
- mkdir $i
- cd $i
- case "$abs" in
- yes) ln -s $src/CWRU/$i/* . ;;
- *) ln -s ../../../$src/CWRU/$i/* . ;;
- esac
- echo -n "CWRU/$i.."
- cd ..
-done
-cd $d
-
-if [ ! -d lib ] ; then
- mkdir lib
-fi
-
-cd lib
-mkdir $LIBDIRS
-
-for i in $LIBDIRS
-do
- cd $i
- case "$abs" in
- yes) ln -s $src/lib/$i/* . ;;
- *) ln -s ../../../$src/lib/$i/* . ;;
- esac
- echo -n "lib/$i.."
- cd ..
-done
-
-cd $d
-
-case "$abs" in
-yes) ln -s $src/.[a-z]* . ; ln -s $src/* . 2>&1 | grep -v exists ;;
-*) ln -s ../$src/.[a-z]* . ; ln -s ../$src/* . 2>&1 | grep -v exists ;;
-esac
-
-echo -n src..
-
-SPECIAL="parser-built y.tab.h y.tab.c"
-for x in $SPECIAL
-do
- rm -f $x
- cp ../$src/$x .
-done
-
-echo special
-
-exit 0
diff --git a/support/config.guess b/support/config.guess
new file mode 100755
index 0000000..5f8b4bf
--- /dev/null
+++ b/support/config.guess
@@ -0,0 +1,904 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+#
+# 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.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# 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 system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/usr/5bin
+fi
+
+UNAME=`(uname) 2>/dev/null` || UNAME=unknown # SunOS
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown # sun4m
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown # 4.1.2
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown # SunOS
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # 13
+
+RELEASE=`expr "$UNAME_RELEASE" : '[^0-9]*\([0-9]*\)'` # 4
+case "$RELEASE" in
+"") RELEASE=0 ;;
+*) RELEASE=`expr "$RELEASE" + 0` ;;
+esac
+REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
+REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
+# is contrary to all other versions of uname
+if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
+ UNAME=UNIX_SV
+fi
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:V*:*)
+ # After 1.2, OSF1 uses "V1.3" for uname -r.
+ echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ # 1.2 uses "1.2" for uname -r.
+ echo alpha-dec-osf${UNAME_RELEASE}
+ exit 0 ;;
+ i[3456]86:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ alpha:NetBSD:*:*)
+ echo alpha-dec-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sparc:NetBSD:*:*)
+ echo sparc-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ vax:NetBSD:*:*)
+ echo vax-dec-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i[3456]86:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ alpha:OpenBSD:*:*)
+ echo alpha-dec-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sparc:OpenBSD:*:*)
+ echo sparc-sun-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-sun-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-atari-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-apple-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp3[0-9][05]:OpenBSD:*:*)
+ echo m68k-hp-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-cbm-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ vax:OpenBSD:*:*)
+ echo vax-dec-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:machten:*:*)
+ echo mac68k-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.*:*)
+ echo m68k-cbm-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ 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 ;;
+ concurrent*:*:*:*)
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo concurrent-concurrent-sysv3
+ else
+ echo concurrent-concurrent-bsd
+ fi
+ exit 0 ;;
+ ppc*:SunOS:5.*:*)
+ echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-unknown-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 ;;
+ 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 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ sparc:UNIX_SV:4.*:*)
+ echo sparc-unknown-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ mips:UNIX_SV:4.*:*)
+ echo mips-mips-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ mips:OSF*1:*:*)
+ echo mips-mips-osf1
+ exit 0 ;;
+ mips:4.4BSD:*:*)
+ echo mips-mips-bsd4.4
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >dummy.c
+ int main (argc, argv) int argc; char **argv; {
+ #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-cc} dummy.c -o dummy \
+ && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ MIServer-S:SMP_DC.OSx:*:dcosx)
+ echo mips-pyramid-sysv4
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ news*:NEWS*:*:*)
+ echo mips-sony-newsos${UNAME_RELEASE}
+ 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=`uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${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 ;;
+ i?86:NEXTSTEP:*:*)
+ echo i386-next-nextstep${RELEASE}
+ exit 0 ;;
+ *680?0:NEXTSTEP:*:*)
+ echo m68k-next-nextstep${RELEASE}
+ 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 ;;
+ *370:AIX:*:*)
+ echo ibm370-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ 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-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ 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:*:4)
+ if /usr/sbin/lsattr -EHl proc0 | 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`
+ elif grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
+ IBM_REV=4.1
+ elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
+ IBM_REV=4.1.1
+ else
+ IBM_REV=4.${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 NetBSD 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/[3478]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;;
+ 9000/8?? ) HP_ARCH=hppa1.0 ;;
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ 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-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ 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 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ 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*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ 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/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo i386-pc-cygwin32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin32
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us.
+ ld_help_string=`ld --help 2>&1`
+ if echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
+ echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
+ elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
+ echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
+ elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
+ echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
+ elif test "${UNAME_MACHINE}" = "alpha" ; then
+ echo alpha-unknown-linux ; exit 0
+ elif test "${UNAME_MACHINE}" = "sparc" ; then
+ echo sparc-unknown-linux ; exit 0
+ else
+ # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us
+ # useful --help. Gcc wants to distinguish between linuxoldld and linuxaout.
+ test ! -d /usr/lib/ldscripts/. \
+ && echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0
+ # Determine whether the default compiler is a.out or elf
+ cat >dummy.c <<EOF
+main(argc, argv)
+int argc;
+char *argv[];
+{
+#ifdef __ELF__
+ printf ("%s-unknown-linux\n", argv[1]);
+#else
+ printf ("%s-unknown-linuxaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ fi ;;
+# 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.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ echo i386-unknown-osf1
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:* | i[34]86:UNIX_SV:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+ fi
+ 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}-unknown-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-unknown-sysv32
+ fi
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-unknown-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 ;;
+ ksr1:OSF*1:*:*)
+ echo ksr1-ksr-osf1
+ exit 0 ;;
+ esa:OSF*1:*:* | ESA:OSF*:*:*)
+ echo esa-ibm-osf1
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*: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 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-lynx-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:LynxOS:2.*:*)
+ echo i386-lynx-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-lynx-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-lynx-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ *:LynxOS:*:*)
+ echo ${UNAME_MACHINE}-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ DNP*:DNIX:*:*)
+ echo m68k-dnix-sysv
+ 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 ;;
+ *: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 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *3b2*:*:*:*)
+ echo we32k-att-sysv3
+ 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
+
+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\n"); exit (0);
+#endif
+
+#if defined (hp9000) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); 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`;
+ printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3");
+ 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-unknown-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)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+#if defined (tahoe)
+ printf ("tahoe-cci-bsd\n"); exit (0);
+#endif
+
+#if defined (nec_ews)
+# if defined (SYSTYPE_SYSV)
+ printf ("ews4800-nec-sysv4\n"); exit 0;
+# else
+ printf ("ews4800-nec-bsd\n"); exit (0);
+# endif
+#endif
+
+#if defined (sony)
+# if defined (SYSTYPE_SYSV)
+ printf ("mips-sony-sysv4\n"); exit 0;
+# else
+ printf ("mips-sony-bsd\n"); exit (0);
+# endif
+#endif
+
+#if defined (ardent)
+ printf ("titan-ardent-bsd\n"); exit (0);
+#endif
+
+#if defined (stardent)
+ printf ("stardent-stardent-sysv\n"); exit (0);
+#endif
+
+#if defined (ibm032)
+ printf ("ibmrt-ibm-bsd4.3\n"); exit (0);
+#endif
+
+#if defined (sequent) && defined (i386)
+ printf ("i386-sequent-bsd\n"); exit (0);
+#endif
+
+#if defined (qnx) && defined (i386)
+ printf ("i386-unknown-qnx\n"); exit (0);
+#endif
+
+#if defined (gould)
+ printf ("gould-gould-bsd\n"); exit (0);
+#endif
+
+#if defined (unixpc)
+ printf ("unixpc-att-sysv\n"); exit (0);
+#endif
+
+#if defined (att386)
+ printf ("i386-att-sysv3\n"); exit (0);
+#endif
+
+#if defined (__m88k) && defined (__UMAXV__)
+ printf ("m88k-encore-sysv3\n"); exit (0);
+#endif
+
+#if defined (drs6000)
+ printf ("drs6000-icl-sysv4.2\n"); exit (0);
+#endif
+
+#if defined (clipper)
+ printf ("clipper-orion-bsd\n"); exit (0);
+#endif
+
+#if defined (is68k)
+ printf ("m68k-isi-bsd\n"); exit (0);
+#endif
+
+#if defined (luna88k)
+ printf ("luna88k-omron-bsd\n"); exit (0);
+#endif
+
+#if defined (butterfly) && defined (BFLY1)
+ printf ("butterfly-bbn-mach\n"); exit (0);
+#endif
+
+#if defined (tower32)
+ printf ("tower32-ncr-sysv4\n"); exit (0);
+#endif
+
+#if defined (MagicStation)
+ printf ("magicstation-unknown-bsd\n"); exit (0);
+#endif
+
+#if defined (scs)
+ printf ("symmetric-scs-bsd4.2\n"); exit (0);
+#endif
+
+#if defined (tandem)
+ printf ("tandem-tandem-sysv\n"); exit (0);
+#endif
+
+#if defined (cadmus)
+ printf ("cadmus-pcs-sysv\n"); exit (0);
+#endif
+
+#if defined (masscomp)
+ printf ("masscomp-masscomp-sysv3\n"); exit (0);
+#endif
+
+#if defined (hbullx20)
+ printf ("hbullx20-bull-sysv3\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# 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
+
+case "$UNAME" in
+uts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;;
+esac
+
+if [ -d /usr/amiga ]; then
+ echo m68k-cbm-sysv${UNAME_RELEASE}; exit 0;
+fi
+
+if [ -f /bin/fxc.info ]; then
+ echo fxc-alliant-concentrix
+ exit 0
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/support/config.sub b/support/config.sub
new file mode 100755
index 0000000..cd1299a
--- /dev/null
+++ b/support/config.sub
@@ -0,0 +1,903 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+# 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.
+
+# 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
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS (if any).
+basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+if [ $basic_machine != $1 ]
+then os=`echo $1 | sed 's/.*-/-/'`
+else os=; fi
+
+### 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 )
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+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.
+ tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
+ | arme[lb] | pyramid \
+ | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
+ | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
+ | powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
+ | pdp11 | mips64el | mips64orion | mips64orionel \
+ | sparc)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # 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.
+ vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+ | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
+ | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
+ | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+ | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
+ | c90-* | t90-* \
+ | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* | butterfly-bbn* \
+ | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
+ | tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \
+ | concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \
+ | *-convex)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc*)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ 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-cbm
+ ;;
+ amigados)
+ basic_machine=m68k-cbm
+ os=-amigados
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ 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
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ 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
+ ;;
+ hbullx20-bull)
+ basic_machine=m68k-bull
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax | multimax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-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
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ ibm032-*)
+ basic_machine=ibmrt-ibm
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[3456]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ os=-sysv32
+ ;;
+ i[3456]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ os=-sysv4
+ ;;
+ i[3456]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ os=-sysv
+ ;;
+ i[3456]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ luna88k-omron* | m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magicstation*)
+ basic_machine=magicstation-unknown
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ 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
+ ;;
+ 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
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ 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)
+ basic_machine=i586-intel
+ ;;
+ pentiumpro | p6)
+ basic_machine=i686-intel
+ ;;
+ pentium-* | p5-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ k5)
+ # We don't have specific support for AMD's K5 yet, so just call it a Pentium
+ basic_machine=i586-amd
+ ;;
+ nexen)
+ # We don't have specific support for Nexgen yet, so just call it a Pentium
+ basic_machine=i586-nexgen
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-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/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ 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
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ 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.
+ mips)
+ basic_machine=mips-mips
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ 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
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -unixware* | svr4*)
+ os=-sysv4
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux|'`
+ ;;
+ # 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[3456]* \
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
+ | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
+ | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -qnx*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # 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*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -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*-semi)
+ os=-aout
+ ;;
+ 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
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigados
+ ;;
+ *-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
+ ;;
+ *)
+ 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
+ ;;
+ -lynxos*)
+ vendor=lynx
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxworks*)
+ vendor=wrs
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/support/cppmagic b/support/cppmagic
deleted file mode 100755
index b0a951c..0000000
--- a/support/cppmagic
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-# Return a full cpp specification, complete with system dependent flags.
-#
-# Syntax: cppmagic [ program-to-generate-flags [ guessed-cpp ]]
-#
-# If only one arg is present it is the name of a program to invoke
-# which should generate -Dfoo defines.
-#
-# If two args are present the second arg is the name of the C
-# preprocessor to use.
-#
-# Invoked with no args, provides a C preprocessor name and
-# -traditional flag if that is appropriate.
-#
-# ../Makefile calls this file thusly: "cppmagic getcppsyms".
-#
-# Typical output:
-#
-# /lib/cpp -Dunix -Dm68k
-#
-
-Cpp=
-
-if [ "$2" ]; then
- Cpp=$2
-else
- for cpp in /lib/cpp /usr/lib/cpp /usr/ccs/lib/cpp; do
- if [ -f $cpp ]; then
- Cpp=$cpp
- fi
- done
- if [ "$Cpp" = "" ]; then
- Cpp=cpp
- fi
-fi
-
-TRADITIONAL=
-FLAGS=
-
-# First flag might be `-traditional' if this is Gnu Cpp.
-unknown_flag=`$Cpp -traditional /dev/null 2>&1 |
- egrep 'known|recognized|valid|bad|legal'`
-if [ "$unknown_flag" = "" ]; then
- TRADITIONAL=-traditional
-fi
-
-if [ "$1" ]; then
- FLAGS=`$1`
-fi
-
-echo $Cpp $TRADITIONAL $FLAGS
diff --git a/support/fixlinks b/support/fixlinks
index b82ca4d..bc286e5 100755
--- a/support/fixlinks
+++ b/support/fixlinks
@@ -10,8 +10,9 @@ 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 [-u] [-s srcdir] [linkmap]" 1>&2
+ echo "$0: usage: $0 [-hu] [-s srcdir] [linkmap]" 1>&2
exit 1;;
*) break ;;
esac
@@ -35,11 +36,16 @@ if [ ! -f "$linkfile" ]; then
fi
rm -f /tmp/z
-if (ln -s /dev/null /tmp/z) >/dev/null 2>&1; then
+# 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 /tmp/z) >/dev/null 2>&1; then
LN="ln -s"
else
LN=ln
fi
+rm -f /tmp/z
while read name target
do
diff --git a/support/getcppsyms.c b/support/getcppsyms.c
deleted file mode 100644
index eb4c72d..0000000
--- a/support/getcppsyms.c
+++ /dev/null
@@ -1,428 +0,0 @@
-/* getcppsyms.c - Find unique compiler symbols. */
-
-/* Copyright (C) 1993 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Some cpp's do not define any symbols, but instead let /bin/cc do it
- for them. For such machines, running this file may prove useful. It
- outputs the list of symbols which /bin/cc or /lib/cpp define and which
- we had the foresight to guess at. */
-
-#include <stdio.h>
-main ()
-{
-#if defined (__BSD_4_4__)
- printf ("-D__BSD_4_4__");
-#endif /* __BSD_4_4__ */
-#if defined (CMU)
- printf (" -DCMU");
-#endif /* CMU */
-#if defined (_COFF)
- printf (" -D_COFF");
-#endif /* _COFF */
-#if defined (DGUX)
- printf (" -DDGUX");
-#endif /* DGUX */
-#if defined (GOULD_PN)
- printf (" -DGOULD_PN");
-#endif /* GOULD_PN */
-#if defined (MACH)
- printf (" -DMACH");
-#endif /* MACH */
-#if defined (MIPSEB)
- printf (" -DMIPSEB");
-#endif /* MIPSEB */
-#if defined (MIPSEL)
- printf (" -DMIPSEL");
-#endif /* MIPSEL */
-#if defined (MULTIMAX)
- printf (" -DMULTIMAX");
-#endif /* MULTIMAX */
-#if defined (M_UNIX)
- printf (" -DM_UNIX");
-#endif /* M_UNIX */
-#if defined (M_XENIX)
- printf (" -DM_XENIX");
-#endif /* M_XENIX */
-#if defined (_M_XENIX)
- printf (" -D_M_XENIX");
-#endif /* _M_XENIX */
-#if defined (NeXT)
- printf (" -DNeXT");
-#endif /* NeXT */
-#if defined (__PARAGON__)
- printf (" -D__PARAGON__");
-#endif /* __PARAGON__ */
-#if defined (_PGC_)
- printf (" -D_PGC_");
-#endif /* _PGC_ */
-#if defined (__PGC__)
- printf (" -D__PGC__");
-#endif /* __PGC__ */
-#if defined (RES)
- printf (" -DRES");
-#endif /* RES */
-#if defined (RISC6000)
- printf (" -DRISC6000");
-#endif /* RISC6000 */
-#if defined (RT)
- printf (" -DRT");
-#endif /* RT */
-#if defined (SYSTYPE_BSD)
- printf (" -DSYSTYPE_BSD");
-#endif /* SYSTYPE_BSD */
-#if defined (SYSTYPE_SYSV)
- printf (" -DSYSTYPE_SYSV");
-#endif /* SYSTYPE_SYSV */
-#if defined (Sun386i)
- printf (" -DSun386i");
-#endif /* Sun386i */
-#if defined (Tek4132)
- printf (" -DTek4132");
-#endif /* Tek4132 */
-#if defined (Tek4300)
- printf (" -DTek4300");
-#endif /* Tek4300 */
-#if defined (UMAXV)
- printf (" -DUMAXV");
-#endif /* UMAXV */
-#if defined (USGr4)
- printf (" -DUSGr4");
-#endif /* USGr4 */
-#if defined (USGr4_2)
- printf (" -DUSGr4_2");
-#endif /* USGr4_2 */
-#if defined (__SVR4_2__)
- printf (" -D__SVR4_2__");
-#endif /* __SVR4_2__ */
-#if defined (Xenix286)
- printf (" -DXenix286");
-#endif /* Xenix286 */
-#if defined (_AIX)
- printf (" -D_AIX");
-#endif /* _AIX */
-#if defined (_AIX370)
- printf (" -D_AIX370");
-#endif /* _AIX370 */
-#if defined (_IBMESA)
- printf (" -D_IBMESA");
-#endif /* _IBMESA */
-#if defined (__ibmesa)
- printf (" -D__ibmesa");
-#endif /* __ibmesa */
-#if defined (_U370)
- printf (" -D_U370");
-#endif /* _U370 */
-#if defined (_NLS)
- printf (" -D_NLS");
-#endif /* _NLS */
-#if defined (_CX_UX)
- printf (" -D_CX_UX");
-#endif /* _CX_UX */
-#if defined (_IBMR2)
- printf (" -D_IBMR2");
-#endif /* _IBMR2 */
-#if defined (_M88K)
- printf (" -D_M88K");
-#endif /* _M88K */
-#if defined (_M88KBCS_TARGET)
- printf (" -D_M88KBCS_TARGET");
-#endif /* _M88KBCS_TARGET */
-#if defined (__DGUX__)
- printf (" -D__DGUX__");
-#endif /* __DGUX__ */
-#if defined (__UMAXV__)
- printf (" -D__UMAXV__");
-#endif /* __UMAXV__ */
-#if defined (__m88k)
- printf (" -D__m88k");
-#endif /* __m88k */
-#if defined (__uxpm__)
- printf (" -DUSGr4 -Du370 -D__uxpm__");
-#endif /* __uxpm__ */
-#if defined (__uxps__)
- printf (" -D__svr4__ -D__uxps__");
-#endif /* __uxps__ */
-#if defined (alliant)
- printf (" -Dalliant");
-#endif /* alliant */
-#if defined (alpha)
- printf (" -Dalpha");
-#endif /* alpha */
-#if defined (__alpha)
- printf (" -D__alpha");
-#endif /* __alpha */
-#if defined (aix)
- printf (" -Daix");
-#endif /* aix */
-#if defined (aixpc)
- printf (" -Daixpc");
-#endif /* aixpc */
-#if defined (apollo)
- printf (" -Dapollo");
-#endif /* apollo */
-#if defined (ardent)
- printf (" -Dardent");
-#endif /* ardent */
-#if defined (att386)
- printf (" -Datt386");
-#endif /* att386 */
-#if defined (att3b)
- printf (" -Datt3b");
-#endif /* att3b */
-#if defined (bsd4_2)
- printf (" -Dbsd4_2");
-#endif /* bsd4_2 */
-#if defined (bsd4_3)
- printf (" -Dbsd4_3");
-#endif /* bsd4_3 */
-#if defined (__bsdi__)
- printf (" -D__bsdi__");
-#endif /* __bsdi__ */
-#if defined (bsdi)
- printf (" -Dbsdi");
-#endif /* bsdi */
-#if defined (__386BSD__)
- printf (" -D__386BSD__");
-#endif /* __386BSD__ */
-#if defined (cadmus)
- printf (" -Dcadmus");
-#endif /* cadmus */
-#if defined (clipper)
- printf (" -Dclipper");
-#endif /* clipper */
-#if defined (concurrent)
- printf (" -Dconcurrent");
-#endif /* concurrent */
-#if defined (convex) || defined (__convex__) || defined (__convexc__)
-# if !defined (__GNUC__)
- printf (" -pcc");
-# endif /* !__GNUC__ */
- printf (" -Dconvex");
-#endif /* convex */
-#if defined (dmert)
- printf (" -Ddmert");
-#endif /* dmert */
-#if defined (gcos)
- printf (" -Dgcos");
-#endif /* gcos */
-#if defined (gcx)
- printf (" -Dgcx");
-#endif /* gcx */
-#if defined (gould)
- printf (" -Dgould");
-#endif /* gould */
-#if defined (hbullx20)
- printf (" -Dhbullx20");
-#endif /* hbullx20 */
-#if defined (hcx)
- printf (" -Dhcx");
-#endif /* hcx */
-#if defined (host_mips)
- printf (" -Dhost_mips");
-#endif /* host_mips */
-#if defined (hp9000) || defined (__hp9000)
- printf (" -Dhp9000");
-#endif /* hp9000 || __hp9000 */
-#if defined (hp9000s200) || defined (__hp9000s200)
- printf (" -Dhp9000s200");
-#endif /* hp9000s200 || __hp9000s200 */
-#if defined (hp9000s300) || defined (__hp9000s300)
- printf (" -Dhp9000s300");
-#endif /* hp9000s300 || __hp9000s300 */
-#if defined (hp9000s500) || defined (__hp9000s500)
- printf (" -Dhp9000s500");
-#endif /* hp9000s500 || __hp9000s500 */
-#if defined (hp9000s700) || defined (__hp9000s700)
- printf (" -Dhp9000s700");
-#endif /* hp9000s700 || __hp9000s700 */
-#if defined (hp9000s800) || defined (__hp9000s800)
- printf (" -Dhp9000s800");
-#endif /* hp9000s800 || __hp9000s800 */
-#if defined (hppa) || defined (__hppa)
- printf (" -Dhppa");
-#endif /* hppa || __hppa */
-#if defined (hpux) || defined (__hpux)
- printf (" -Dhpux");
-#endif /* hpux */
-#if defined (__hp_osf)
- printf (" -D__hp_osf");
-#endif /* __hp_osf */
-#if defined (i386)
- printf (" -Di386");
-#endif /* i386 */
-#if defined (__i386__)
- printf (" -D__i386__");
-#endif
-#if defined (__i860)
- printf(" -D__i860");
-#endif /* __i860 */
-#if defined (__i860__)
- printf(" -D__i860__");
-#endif /* __i860__ */
-#if defined (ibm)
- printf (" -Dibm");
-#endif /* ibm */
-#if defined (ibm032)
- printf (" -Dibm032");
-#endif /* ibm032 */
-#if defined (ibmrt)
- printf (" -Dibmrt");
-#endif /* ibmrt */
-#if defined (interdata)
- printf (" -Dinterdata");
-#endif /* interdata */
-#if defined (is68k)
- printf (" -Dis68k");
-#endif /* is68k */
-#if defined (ksr1)
- printf (" -Dksr1");
-#endif /* ksr1 */
-#if defined (__ksr1__)
- printf (" -D__ksr1__");
-#endif /* __ksr1__ */
-#if defined (linux)
- printf (" -Dlinux");
-#endif /* linux */
-#if defined (__linux__)
- printf (" -D__linux__");
-#endif /* __linux__ */
-#if defined (luna88k)
- printf (" -Dluna88k");
-#endif /* luna88k */
-#if defined (m68k)
- printf (" -Dm68k");
-#endif /* m68k */
-#if defined (m88k)
- printf (" -Dm88k");
-#endif /* m88k */
-#if defined (mc68010)
- printf (" -Dmc68010");
-#endif /* mc68010 */
-#if defined (mc68020)
- printf (" -Dmc68020");
-#endif /* mc68020 */
-#if defined (mc68030)
- printf (" -Dmc68030");
-#endif /* mc68030 */
-#if defined (mc68040)
- printf (" -Dmc68040");
-#endif /* mc68040 */
-#if defined (mc68k32)
- printf (" -Dmc68k32");
-#endif /* mc68k32 */
-#if defined (mips)
- printf (" -Dmips");
-#endif /* mips */
-#if defined (n16)
- printf (" -Dn16");
-#endif /* n16 */
-#if defined __nonstopux
- printf (" -D__nonstopux");
-#endif
-#if defined (ns32000)
- printf (" -Dns32000");
-#endif /* ns32000 */
-#if defined (os)
- printf (" -Dos");
-#endif /* os */
-#if defined (osf)
- printf (" -Dosf");
-#endif /* osf */
-#if defined (__osf__)
- printf (" -D__osf__");
-#endif /* __osf__ */
-#if defined (__OSF1__)
- printf(" -D__OSF1__");
-#endif /* __OSF1__ */
-#if defined (pdp11)
- printf (" -Dpdp11");
-#endif /* pdp11 */
-#if defined (plexus)
- printf (" -Dplexus")
-#endif /* plexus */
-#if defined (pyr)
- printf (" -Dpyr");
-#endif /* pyr */
-#if defined (scs)
- printf (" -Dscs");
-#endif /* scs */
-#if defined (sequent)
- printf (" -Dsequent");
-#endif /* sequent */
-#if defined (sgi)
- printf (" -Dsgi");
-#endif /* sgi */
-#if defined (sony)
- printf (" -Dsony");
-#endif /* sony */
-#if defined (sparc)
- printf (" -Dsparc");
-#endif /* sparc */
-#if defined (stardent)
- printf (" -Dstardent");
-#endif /* stardent */
-#if defined (sun)
- printf (" -Dsun");
-#endif /* sun */
-#if defined (sun2)
- printf (" -Dsun2");
-#endif /* sun2 */
-#if defined (sun3)
- printf (" -Dsun3");
-#endif /* sun3 */
-#if defined (sun4)
- printf (" -Dsun4");
-#endif /* sun4 */
-#if defined (__svr4__)
- printf (" -D__svr4__");
-#endif /* __svr4__ */
-#if defined (tower32)
- printf (" -Dtower32");
-#endif /* tower32 */
-#if defined (tss)
- printf (" -Dtss");
-#endif /* tss */
-#if defined (u370)
- printf (" -Du370");
-#endif /* u370 */
-#if defined (u3b)
- printf (" -Du3b");
-#endif /* u3b */
-#if defined (u3b2)
- printf (" -Du3b2");
-#endif /* u3b2 */
-#if defined (u3b20d)
- printf (" -Du3b20d");
-#endif /* u3b20d */
-#if defined (u3b5)
- printf (" -Du3b5");
-#endif /* u3b5 */
-#if defined (ultrix)
- printf (" -Dultrix");
-#endif /* ultrix */
-#if defined (unix)
- printf (" -Dunix");
-#endif /* unix */
-#if defined (vax)
- printf (" -Dvax");
-#endif /* vax */
-
- printf ("\n");
- exit (0);
-}
diff --git a/support/inpath b/support/inpath
deleted file mode 100755
index 95f28bc..0000000
--- a/support/inpath
+++ /dev/null
@@ -1,19 +0,0 @@
-#! /bin/sh
-#
-# Search $PATH for a file the same name as $1; return TRUE if found.
-#
-
-command=$1
-[ -n "$command" ] || exit 1
-
-set `echo $PATH | sed 's/^:/.:/
- s/::/:.:/g
- s/:$/:./
- s/:/ /g'`
-
-while [ $# -ne 0 ] ; do
- [ -f $1/$command ] && exit 0 # test -x not universal
- shift
-done
-
-exit 1
diff --git a/support/mkclone b/support/mkclone
new file mode 100755
index 0000000..fce7b6d
--- /dev/null
+++ b/support/mkclone
@@ -0,0 +1,102 @@
+#! /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
+#
+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 -f /tmp/z
+# 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 /tmp/z) >/dev/null 2>&1; then
+ LN="ln -s"
+else
+ LN=ln
+fi
+rm -f /tmp/z
+
+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
+
+$ECHO $LN $SRCDIR/.distribution .
+$ECHO $LN $SRCDIR/.patchlevel .
+
+exit 0
diff --git a/support/mkdirs b/support/mkdirs
index 52228d1..b79d971 100755
--- a/support/mkdirs
+++ b/support/mkdirs
@@ -8,21 +8,24 @@
for dir
do
- [ -d "$dir" ] && continue
+ test -d "$dir" && continue
tomake=$dir
- while [ "$dir" ]; do
+ while test -n "$dir" ; do
# dir=${dir%/*}
- # dir=`expr "$dir" ':' '^\(/.*\)/[^/]*'`
- dir=`expr "$dir" ':' '^\(.*\)/[^/]*'`
- tomake="$dir $tomake"
+ # dir=`expr "$dir" ':' '\(/.*\)/[^/]*'`
+ if dir=`expr "$dir" ':' '\(.*\)/[^/]*'`; then
+ tomake="$dir $tomake"
+ else
+ dir=
+ fi
done
for d in $tomake
do
- [ -d $d ] && continue
- echo mkdir $d
- mkdir $d
+ test -d "$d" && continue
+ echo mkdir "$d"
+ mkdir "$d"
done
done
diff --git a/support/mklinks b/support/mklinks
deleted file mode 100755
index 612aa99..0000000
--- a/support/mklinks
+++ /dev/null
@@ -1,41 +0,0 @@
-
-# Yet another script which requires an already built Bash.
-#
-# This makes links in the current directory to the directory specified as
-# the first argument.
-#
-
-topdir=$1
-
-if [ ! "$topdir" ]; then
- echo "No directory specified. Read the script $0."
- exit 1
-fi
-
-function clone_files ()
-{
- local dir=$1;
- local files;
-
- files=$(cd $dir; echo *);
-
- if [ ! "$files" ]; then
- return 0;
- fi
-
- for filename in $files; do
- if [ -d $dir/$filename ]; then
- # If the file to clone is this directory, then skip it.
- if [ $(cd $dir/$filename; pwd) = $(pwd) ]; then
- continue;
- fi
- mkdir $filename;
- (cd $filename; clone_files ../$dir/$filename)
- else
- ln -s $dir/$filename .;
- fi
- done
- rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp *.o core a.out;
-}
-
-clone_files $topdir
diff --git a/support/mkmachtype b/support/mkmachtype
deleted file mode 100755
index 00b7403..0000000
--- a/support/mkmachtype
+++ /dev/null
@@ -1,279 +0,0 @@
-#!/bin/sh
-# This script attempts to guess a canonical system name.
-# Copyright (C) 1992, 1993 Free Software Foundation, Inc.
-#
-# 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#
-# 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 system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
-
-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
- alpha:OSF1:1.*:*)
- # 1.2 uses "1.2" for uname -r.
- echo alpha-dec-osf${UNAME_RELEASE}
- exit 0 ;;
- alpha:OSF1:V1.*:*)
- # 1.3 uses "V1.3" for uname -r.
- echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
- exit 0 ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
- sun4*:SunOS:5.*:*)
- echo sparc-sun-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:*:*)
- echo sparc-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- mips:*:5*:RISCos)
- echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit 0 ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit 0 ;;
- AViiON:dgux:*:*)
- echo m88k-dg-dgux${UNAME_RELEASE}
- exit 0 ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit 0 ;;
- *:IRIX:*:*)
- echo mips-sgi-irix${UNAME_RELEASE}
- exit 0 ;;
- i[34]86:AIX:*:*)
- echo i386-ibm-aix
- exit 0 ;;
- *:AIX:2:3)
- echo rs6000-ibm-aix3.2
- exit 0 ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit 0 ;;
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit 0 ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit 0 ;;
- 9000/31?:HP-UX:*:*)
- echo m68000-hp-hpux
- exit 0 ;;
- 9000/[34]??:HP-UX:*:*)
- echo m68k-hp-hpux
- 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/7??:HP-UX:*:* | 9000/8?7:HP-UX:*:* )
- echo hppa1.1-hp-hpux
- exit 0 ;;
- 9000/8??:HP-UX:*:*)
- echo hppa1.0-hp-hpux
- exit 0 ;;
- 3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else 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 puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
- echo unknown-hitachi-hiuxwe2
- exit 0 ;;
- 9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit 0 ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit 0 ;;
- C1*:ConvexOS:*:*)
- echo c1-convex-bsd
- exit 0 ;;
- C2*:ConvexOS:*:*)
- echo c2-convex-bsd
- exit 0 ;;
- CRAY*X-MP:UNICOS:*:*)
- echo xmp-cray-unicos
- exit 0 ;;
- CRAY*Y-MP:UNICOS:*:*)
- echo ymp-cray-unicos
- exit 0 ;;
- CRAY-2:UNICOS:*:*)
- echo cray2-cray-unicos
- exit 0 ;;
- hp3[0-9][05]:NetBSD:*:*)
- echo m68k-hp-netbsd${UNAME_RELEASE}
- exit 0 ;;
- i[34]86:NetBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-netbsd${UNAME_RELEASE}
- exit 0 ;;
- i[34]86:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux
- exit 0 ;;
- i[34]86:UNIX_SV:4.*:*)
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
- else
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- i[34]86:*:3.2:*)
- if /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
- echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-unknown-sysv3.2
- fi
- exit 0 ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit 0 ;;
- M680[234]0:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:*)
- uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
- m680[234]0:LynxOS:2.2*:*)
- echo m68k-lynx-lynxos${UNAME_RELEASE}
- exit 0 ;;
- i[34]86:LynxOS:2.2*:*)
- echo i386-lynx-lynxos${UNAME_RELEASE}
- exit 0 ;;
- TSUNAMI:LynxOS:2.2*:*)
- echo sparc-lynx-lynxos${UNAME_RELEASE}
- 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
-
-cat >dummy.c <<EOF
-main()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-#else
- printf("m68k-sony-newsos\n"); 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)
- printf("m68k-next-bsd\n"); 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__) || (defined(__bsdi__) && defined(__i386__))
- printf("i386-unknown-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_)
- printf("i386-sequent-ptx\n"); exit(0);
-#endif
-
- exit (1);
-}
-EOF
-
-${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
-
-#echo '(Unable to guess system type)' 1>&2
-
-exit 1
diff --git a/support/mksignames.c b/support/mksignames.c
new file mode 100644
index 0000000..655485b
--- /dev/null
+++ b/support/mksignames.c
@@ -0,0 +1,302 @@
+/* signames.c -- Create and write `signames.h', which contains an array of
+ signal names. */
+
+/* Copyright (C) 1992 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 1, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#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
+
+char *signal_names[2 * NSIG];
+
+char *progname;
+
+void
+initialize_signames ()
+{
+ register int i;
+
+ for (i = 1; i < sizeof(signal_names)/sizeof(signal_names[0]); 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) SIGEMT to overwrite SIGGRANT. */
+#if defined (SIGGRANT) /* HFT monitor mode granted */
+ signal_names[SIGGRANT] = "SIGGRANT";
+#endif
+
+#if defined (SIGRETRACT) /* HFT monitor mode retracted */
+ signal_names[SIGRETRACT] = "SIGRETRACT";
+#endif
+
+#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 (SIGABRT) /* Cause current process to dump core. */
+ signal_names[SIGABRT] = "SIGABRT";
+#endif
+
+#if defined (SIGIOT) /* IOT instruction */
+ signal_names[SIGIOT] = "SIGIOT";
+#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 (SIGCLD) /* Like SIGCHLD. */
+ signal_names[SIGCLD] = "SIGCLD";
+#endif
+
+#if defined (SIGPWR) /* Magic thing for some machines. */
+ signal_names[SIGPWR] = "SIGPWR";
+#endif
+
+#if defined (SIGPOLL) /* For keyboard input? */
+ signal_names[SIGPOLL] = "SIGPOLL";
+#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
+
+#if defined (SIGLOST) /* resource lost (eg, record-lock lost) */
+ signal_names[SIGLOST] = "SIGLOST";
+#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 (SIGMSG) /* HFT input data pending */
+ signal_names[SIGMSG] = "SIGMSG";
+#endif
+
+#if defined (SIGPWR) /* power failure imminent (save your data) */
+ signal_names[SIGPWR] = "SIGPWR";
+#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 (SIGSOUND) /* HFT sound sequence has completed */
+ signal_names[SIGSOUND] = "SIGSOUND";
+#endif
+
+#if defined (SIGWINDOW)
+ signal_names[SIGWINDOW] = "SIGWINDOW";
+#endif
+
+#if defined (SIGDIL)
+ signal_names[SIGDIL] = "SIGDIL";
+#endif
+
+#if defined (SIGSAK) /* Secure Attention Key */
+ signal_names[SIGSAK] = "SIGSAK";
+#endif
+
+ for (i = 0; i < NSIG; i++)
+ if (signal_names[i] == (char *)NULL)
+ {
+ signal_names[i] = (char *)malloc (18);
+ sprintf (signal_names[i], "SIGJUNK(%d)", i);
+ }
+
+ signal_names[NSIG] = "DEBUG";
+}
+
+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 + 2] = {\n");
+
+ for (i = 0; i <= NSIG; 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/mksysdefs b/support/mksysdefs
deleted file mode 100755
index 37b188e..0000000
--- a/support/mksysdefs
+++ /dev/null
@@ -1,497 +0,0 @@
-#!/bin/sh
-#
-# This file creates a file called "sysdefs.h" which contains CPP defines
-# helping to describe the operating system features. We just take guesses
-# by looking at random files.
-
-# Removes any inherited definitions.
-SYSDEF=
-MAKE_ANSI=
-
-while [ $# -gt 0 ]; do
- case "$1" in
- -s) shift; srcdir=$1; shift ;;
- -i) shift; incdir="$1"; shift ;;
- -A) shift; MAKE_ANSI=true ;;
- *) break ;;
- esac
-done
-
-if [ -n "$1" ]; then
- sysdefs=$1
-else
- sysdefs=./sysdefs.h
-fi
-
-if [ -z "$srcdir" ]; then
- srcdir=.
-fi
-
-rm -f $sysdefs
-
-echo "/* sysdefs.h -- #defines for your system created by $0." >>$sysdefs
-echo " Do NOT EDIT this file, since any changes will disappear." >>$sysdefs
-echo " Instead, edit $0, or config.h, or machines.h. */" >>$sysdefs
-echo "" >>$sysdefs
-echo "#if !defined (_SYSDEFS_H_)" >>$sysdefs
-echo "# define _SYSDEFS_H_" >>$sysdefs
-
-# was if [ -f /usr/bin/uname ] || [ -f /bin/uname ]
-if ( uname >/dev/null 2>&1 ) 2>/dev/null
-then
- UNAME=`uname`
- UNAME_R=`uname -r 2>/dev/null`
- UNAME_M=`uname -m 2>/dev/null`
- UNAME_V=`uname -v 2>/dev/null`
- UNAME_S=`uname -s 2>/dev/null`
- RELEASE=`expr "$UNAME_R" : '[^0-9]*\([0-9]*\)'`
- case "$RELEASE" in
- "") RELEASE=0 ;;
- *) RELEASE=`expr "$RELEASE" + 0` ;;
- esac
- LEVEL=`expr "$UNAME_R" : '[^0-9]*[0-9]*.\([0-9]*\)'`
-fi
-
-# check for versions of SunOS and BSD/OS
-case "${UNAME}${RELEASE}" in
-SunOS4*) SYSDEF=SunOS4 ;;
-SunOS5*) SYSDEF=SunOS5 ;;
-BSD/OS2*) SYSDEF=BSDI2 ;;
-esac
-
-# Test for NeXT
-if [ -d /NextLibrary ]; then
- MAKE_ANSI=true
-fi
-
-# Intel Paragon
-case "$UNAME_M" in
-paragon) MAKE_ANSI=true ;;
-esac
-
-# Test for shared libraries (this is pretty sVr4ish).
-if [ -f /usr/ccs/lib/libc.so ]; then
- SYSDEF=USGr4
-fi
-
-# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
-# is contrary to all other versions of uname
-if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
- UNAME=UNIX_SV
-fi
-
-# (sound of teeth grinding...)
-if [ "$UNAME" = "UNIX_SV" ] && [ "$UNAME_R" != "4.2" ] && [ "$RELEASE"."$LEVEL" = "4.2" ]; then
- UNAME_R="4.2"
-fi
-
-# another check for SVR4 on 386 or 486 machines
-case "${UNAME_M}:${UNAME}:${UNAME_R}" in
-i[34]86:UNIX_SV:4.*) SYSDEF=USGr4 ;;
-esac
-
-# A check for Mips RISCos
-case "$UNAME_V" in
-UMIPS|RISCos) SYSDEF=RISCos_${RELEASE}_${LEVEL} ;;
-esac
-
-# A check for Amdahl UTS
-case "$UNAME" in
-uts) SYSDEF=UTS ;;
-esac
-
-# Look for an error message when trying to exec bison. If we find
-# what we're looking for, then we don't have it. If we get something
-# else (like an error message about no grammar file), then we have
-# it.
-HAVE_BISON=
-if ( cd /tmp ; bison /dev/null 2>&1 >/dev/null | grep 'no input grammar' >/dev/null 2>&1 ) 2>/dev/null
-then
- HAVE_BISON=yes
-fi
-
-# Try to locate ranlib. I think this is a bad idea.
-if sh ${srcdir}/support/inpath ranlib; then
- RANLIB_LOCATION=ranlib
-elif [ -f /usr/bin/ranlib ]; then
- RANLIB_LOCATION=/usr/bin/ranlib;
-elif [ -f /bin/ranlib ]; then
- RANLIB_LOCATION=/bin/ranlib;
-elif [ -f /usr/local/bin/ranlib ]; then
- RANLIB_LOCATION=/usr/local/bin/ranlib;
-elif [ -f /usr/local/gnubin/ranlib ]; then
- RANLIB_LOCATION=/usr/local/gnubin/ranlib;
-else
- RANLIB_LOCATION=: # XXX
-fi
-
-if [ -n "${RANLIB_LOCATION}" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (RANLIB_LOCATION)" >>$sysdefs
- echo "# define RANLIB_LOCATION ${RANLIB_LOCATION}" >>$sysdefs
- echo "#endif /* RANLIB_LOCATION */" >>$sysdefs
-fi
-
-#
-# Is this a Xenix system?
-#
-if [ -f /xenix ]; then
- SYSDEF="Xenix"
- case "`/bin/uname -p`" in
- *286) SYSDEF="Xenix286" ;;
- *386) SYSDEF="Xenix386" ;;
- esac
-
- # make sure that `i386' is defined for machines.h
- if [ "$SYSDEF" = "Xenix386" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (i386)" >>$sysdefs
- echo "# define i386" >>$sysdefs
- echo "#endif /* !i386 */" >>$sysdefs
- fi
-
- # Pass the release number of the OS through to the machine descriptions
- # in machines.h.
- if [ -f /etc/perms/soft ]; then
- rel=`grep rel= /etc/perms/soft`
- case "$rel" in
- *2.2.*) XREL=XENIX_22 ;;
- *2.3.*) XREL=XENIX_23 ;;
- *3.2.*) XREL=XENIX_32 ;;
- *) XREL= ;;
- esac
-
- if [ "$XREL" ]; then
- echo "" >>$sysdefs
- echo "#if !defined ($XREL)" >>$sysdefs
- echo "# define $XREL" >>$sysdefs
- echo "#endif /* !$XREL */" >>$sysdefs
- fi
- fi
-fi
-
-#
-# Is this some kind of Sys Vish system?
-#
-if [ -f /unix ]; then
- if [ -d /generic ]; then # This is an AIX system.
- SYSDEF="aixpc"
- MAKE_ANSI=true
- elif [ -d /etc/conf/kconfig.d ] && [ -f /usr/include/sys/limits.h ]; then
- SYSDEF="isc386" # This is a 386 running ISC?
- ISCREL="ISC_$RELEASE"
- echo "#if !defined ($ISCREL)" >>$sysdefs
- echo "# define $ISCREL" >>$sysdefs
- echo "#endif /* $ISCREL */" >>$sysdefs
- elif [ -f /etc/xlc.cfg ]; then
- if fgrep _IBMR2 /etc/xlc.cfg >/dev/null 2>&1; then
- SYSDEF=RISC6000
- MAKE_ANSI=true
- fi
- elif [ -f /bin/4d -a -f /bin/uname ]; then
- case "$UNAME_R" in
- 3.*) SYSDEF="Irix3" ;;
- 4.*) SYSDEF="Irix4" ;;
- 5.*) SYSDEF="Irix5" ;;
- 6.*) SYSDEF="Irix6" ;;
- *) SYSDEF="Irix3" ;;
- esac
- elif [ -d /usr/amiga ]; then
- SYSDEF="amiga" # An Amiga running V.4.
- elif [ -f /bin/fxc.info ]; then
- SYSDEF="alliant"
- fi
-fi
-
-# Is this a Unicos system?
-if [ -f /unicos ]; then
- MAKE_ANSI=true
- UnicosMachine=
-
- # Test for the variaous flavors of Cray machines.
- if [ -x /bin/cray1 ] && /bin/cray1 2>/dev/null; then
- UnicosMachine=Cray1
- fi
-
- if [ -x /bin/cray2 ] && /bin/cray2 2>/dev/null; then
- UnicosMachine=Cray2
- fi
-
- if [ -x /bin/crayxmp ] && /bin/crayxmp 2>/dev/null; then
- UnicosMachine=CrayXMP
- fi
- if [ -x /bin/crayymp ] && /bin/crayymp 2>/dev/null; then
- UnicosMachine=CrayYMP
- fi
-
- if [ "$UnicosMachine" ]; then
- echo "#if !defined ($UnicosMachine)" >>$sysdefs
- echo "# define $UnicosMachine" >>$sysdefs
- echo "#endif /* !$UnicosMachine */" >>$sysdefs
- fi
-fi
-
-# Is this (and what kind of) a HPUX system?
-if [ -f /hp-ux ]; then
- SYSDEF=HPUX_${RELEASE}
- if [ "$RELEASE" = 6 -a "$LEVEL" -lt 2 ]; then
- SYSDEF=HPUX_USG
- fi
-fi
-
-if [ "$SYSDEF" = "" ]; then
- case "$UNAME_M" in
- ESA) SYSDEF=AIXESA ;;
- XD88*) SYSDEF=XD88 ;;
- M88100) SYSDEF=M88100 ;; # Motorola Delta 88K
- esac
-fi
-
-if [ "$SYSDEF" = "" ]; then
- case "$UNAME_V" in
- V[0-9]*L[0-9]*) SYSDEF=UXP ;; # Fujitsu DS/90
- esac
-fi
-
-# What release of SCO Unix is this?
-if [ "$SYSDEF" = "" -a -f /bin/uname ]; then
- case `/bin/uname -X 2>/dev/null | grep '^Release' 2>/dev/null` in
- *3.2v4.*) SYSDEF=SCOv4 ;;
- *3.2v5.*) SYSDEF=SCOv5 ;;
- *) SYSDEF=SCO ;;
- esac
-fi
-
-#
-# Default to cadmus for unknown SysVish systems
-#
-if [ -f /unix ] && [ "$SYSDEF" = "" ]; then
- SYSDEF="cadmus"
-fi
-
-if [ "$SYSDEF" != "" ]; then
- echo "" >>$sysdefs
- echo "#if !defined ($SYSDEF)" >>$sysdefs
- echo "# define $SYSDEF" >>$sysdefs
- echo "#endif /* $SYSDEF */" >>$sysdefs
-fi
-
-# Now look for certain include files in a list of directories
-# Poor substitute for autoconf
-
-# Add any other directories where include files are found to this list or
-# create another case
-if [ -n "$incdir" ]; then
- dirlist="$incdir"
-else
- case "$SYSDEF" in
- RISCos*) dirlist="/bsd43/usr/include";;
- *) dirlist="/usr/include /usr/include/bsd /usr/include/ansi" ;;
- esac
-fi
-
-# Code fragment to be executed to find a particular include file. Make sure
-# to set `file' to the pathname of the file you want, relative to /usr/include,
-# before calling `eval $findf'.
-findf="
-found='';
-for d in \$dirlist;
-do
- if test -f \$d/\$file;
- then
- found=yes;
- break;
- fi;
-done
-"
-
-found=
-file=sys/stream.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_SYS_STREAM_H)" >>$sysdefs
- echo "# define HAVE_SYS_STREAM_H" >>$sysdefs
- echo "#endif /* HAVE_SYS_STREAM_H */" >>$sysdefs
-fi
-
-found=
-file=sys/ptem.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_SYS_PTEM_H)" >>$sysdefs
- echo "# define HAVE_SYS_PTEM_H" >>$sysdefs
- echo "#endif /* HAVE_SYS_PTEM_H */" >>$sysdefs
-fi
-
-file=sys/pte.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_SYS_PTE_H)" >>$sysdefs
- echo "# define HAVE_SYS_PTE_H" >>$sysdefs
- echo "#endif /* HAVE_SYS_PTE_H */" >>$sysdefs
-fi
-
-file=sys/wait.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_WAIT_H)" >>$sysdefs
- echo "# define HAVE_WAIT_H" >>$sysdefs
- echo "#endif /* HAVE_WAIT_H */" >>$sysdefs
-fi
-
-file=sys/resource.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_RESOURCE)" >>$sysdefs
- echo "# define HAVE_RESOURCE" >>$sysdefs
- echo "#endif /* HAVE_RESOURCE */" >>$sysdefs
-fi
-
-file=sys/param.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_SYS_PARAM)" >>$sysdefs
- echo "# define HAVE_SYS_PARAM" >>$sysdefs
- echo "#endif /* HAVE_SYS_PARAM */" >>$sysdefs
-fi
-
-file=unistd.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_UNISTD_H)" >>$sysdefs
- echo "# define HAVE_UNISTD_H" >>$sysdefs
- echo "#endif /* HAVE_UNISTD_H */" >>$sysdefs
-fi
-
-file=stdlib.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_STDLIB_H)" >>$sysdefs
- echo "# define HAVE_STDLIB_H" >>$sysdefs
- echo "#endif /* HAVE_STDLIB_H */" >>$sysdefs
-fi
-
-file=limits.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_LIMITS_H)" >>$sysdefs
- echo "# define HAVE_LIMITS_H" >>$sysdefs
- echo "#endif /* HAVE_LIMITS_H */" >>$sysdefs
-fi
-
-file=alloca.h
-eval $findf
-if [ -f /usr/include/alloca.h ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_ALLOCA_H)" >>$sysdefs
- echo "# define HAVE_ALLOCA_H" >>$sysdefs
- echo "#endif /* HAVE_ALLOCA_H */" >>$sysdefs
-fi
-
-file=dirent.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_DIRENT_H)" >>$sysdefs
- echo "# define HAVE_DIRENT_H" >>$sysdefs
- echo "#endif /* HAVE_DIRENT_H */" >>$sysdefs
-fi
-
-file=string.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_STRING_H)" >>$sysdefs
- echo "# define HAVE_STRING_H" >>$sysdefs
- echo "#endif /* HAVE_STRING_H */" >>$sysdefs
-fi
-
-file=varargs.h
-eval $findf
-if [ -n "$found" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_VARARGS_H)" >>$sysdefs
- echo "# define HAVE_VARARGS_H" >>$sysdefs
- echo "#endif /* HAVE_VARARGS_H */" >>$sysdefs
-fi
-
-# Does the system have a /dev/fd directory?
-if [ -d /dev/fd ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_DEV_FD)" >>$sysdefs
- echo "# define HAVE_DEV_FD" >>$sysdefs
- echo "#endif /* HAVE_DEV_FD */" >>$sysdefs
-fi
-
-# Is this SVR4.2? It's subtly different from USGr4
-if [ "$UNAME" = "UNIX_SV" ] && [ "$UNAME_R" = "4.2" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (USGr4_2)" >>$sysdefs
- echo "# define USGr4_2" >>$sysdefs
- echo "#endif /* USGr4_2 */" >>$sysdefs
-fi
-
-# Is this AIX PS/2 1.3? Yuck.
-if [ "$UNAME" = "AIX" ] && [ "$UNAME_V" = "1" ] && [ "$RELEASE" = "3" ]; then
- case "$UNAME_M" in
- i386|i486)
- echo "" >>$sysdefs
- echo "#if !defined (AIX_13)" >>$sysdefs
- echo "# define AIX_13" >>$sysdefs
- echo "#endif /* AIX_13 */" >>$sysdefs
- ;;
- esac
-fi
-
-if [ -n "$HAVE_BISON" ]; then
- echo "" >>$sysdefs
- echo "#if !defined (HAVE_BISON)" >>$sysdefs
- echo "# define HAVE_BISON" >>$sysdefs
- echo "#endif /* HAVE_BISON */" >>$sysdefs
-fi
-
-# Functions to test for a la autoconf
-# getwd
-# getcwd
-# strchr
-# strcasecmp
-# getgroups
-# setlinebuf
-# strerror
-# vfprintf
-# bcopy
-# getdtablesize
-# setdtablesize
-# alloca
-# gethostname
-# memmove (missing)
-# mkfifo (missing)
-#
-# Other things to test
-# opendir robustness
-# dup2 working
-# void sighandler
-# sys_siglist[]
-# uid_t, gid_t
-# have_getpw_decls
-# reversed setvbuf args
-# int getgroups
-
-# If this system's cpp might not like `/**/#' in cpp-Makefile, make an
-# alternate ansi-style cpp-Makefile.
-if [ -n "$MAKE_ANSI" ]; then
- grep -v '/\*\*/' ${srcdir}/cpp-Makefile >ansi-Makefile
-fi
-
-# These should be the last 2 lines in this file!
-echo "" >>$sysdefs
-echo "#endif /* _SYSDEFS_H_ */" >>$sysdefs
diff --git a/support/mkversion.c b/support/mkversion.c
new file mode 100644
index 0000000..8164a8f
--- /dev/null
+++ b/support/mkversion.c
@@ -0,0 +1,305 @@
+/* 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. */
+
+/* Copyright (C) 1989 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 1, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "config.h"
+
+#include <sys/types.h>
+#include "posixstat.h"
+#include <stdio.h>
+#include "bashansi.h"
+
+char *progname;
+char *dir;
+char *status;
+
+FILE *must_open ();
+
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ FILE *file;
+ float distver = 0.0;
+ int buildver = 0, patchlevel = 0;
+ int dist = 0, build = 0, patch = 0;
+ int dist_inc = 0, build_inc = 0, patch_inc = 0;
+ int dot_dist_needs_making = 0;
+ int arg_index = 1;
+ struct stat sb;
+
+ progname = argv[0];
+
+ status = dir = (char *)0;
+ while (arg_index < argc && argv[arg_index][0] == '-')
+ {
+ if (strcmp (argv[arg_index], "-dist") == 0)
+ {
+ dist++;
+ dist_inc++;
+ }
+ else if (strcmp (argv[arg_index], "-build") == 0)
+ {
+ build++;
+ build_inc++;
+ }
+ else if (strcmp (argv[arg_index], "-patch") == 0)
+ {
+ patch++;
+ patch_inc++;
+ }
+ else if (strcmp (argv[arg_index], "-dir") == 0)
+ {
+ dir = argv[++arg_index];
+ if (dir == 0)
+ {
+ fprintf (stderr, "%s: `-dir' requires an argument\n", progname);
+ exit (1);
+ }
+ if (stat (dir, &sb) < 0)
+ {
+ fprintf (stderr, "%s: cannot stat %s\n", progname, dir);
+ exit (1);
+ }
+ if ((sb.st_mode & S_IFMT) != S_IFDIR)
+ {
+ fprintf (stderr, "%s: not a directory\n", progname);
+ exit (1);
+ }
+ }
+ else if (strcmp (argv[arg_index], "-status") == 0)
+ {
+ status = argv[++arg_index];
+ if (status == 0)
+ {
+ fprintf (stderr, "%s: `-status' requires an argument\n", progname);
+ exit (1);
+ }
+ }
+ else
+ {
+ fprintf (stderr, "%s: unknown option: %s\n", progname, argv[arg_index]);
+ fprintf (stderr, "usage: %s [-dist|-patch|-build] [-dir directory]\n", progname);
+ exit (1);
+ }
+ arg_index++;
+ }
+
+ if (get_float_from_file (".distribution", &distver, 1) == 0)
+ dot_dist_needs_making++;
+
+ if (get_int_from_file (".patchlevel", &patchlevel, 1) == 0)
+ {
+ patchlevel = 0;
+ patch_inc = 0;
+ }
+
+ if (get_int_from_file (".build", &buildver, 0) == 0)
+ buildver = 0;
+
+ /* Setting distribution version. */
+ if (dist && arg_index < argc)
+ if (sscanf (argv[arg_index], "%f", &distver) != 1)
+ {
+ fprintf (stderr, "%s: Bad input `%s'. Expected float value for -dist.\n",
+ progname, argv[arg_index]);
+ exit (1);
+ }
+ else
+ {
+ arg_index++;
+ dist_inc = 0;
+ }
+
+ /* Setting patchlevel via argument. */
+ if (patch && arg_index < argc)
+ if (sscanf (argv[arg_index], "%d", &patchlevel) != 1)
+ {
+ fprintf (stderr, "%s: Bad input `%s'. Expected int value for -patch.\n",
+ progname, argv[arg_index]);
+ exit (1);
+ }
+ else
+ {
+ arg_index++;
+ patch_inc = 0;
+ }
+
+ if (build && arg_index < argc)
+ if (sscanf (argv[arg_index], "%d", &buildver) != 1)
+ {
+ fprintf (stderr, "%s: Bad input `%s'. Expected int value for -build.\n",
+ progname, argv[arg_index]);
+ exit (1);
+ }
+ else
+ {
+ arg_index++;
+ build_inc = 0;
+ }
+
+ if (dot_dist_needs_making && !distver)
+ {
+ fprintf (stderr, "%s: There is no `.distribution' file to infer from.\n", progname);
+ exit (1);
+ }
+
+ if (dist_inc)
+ distver = distver + 0.01;
+
+ if (patch_inc)
+ patchlevel++;
+
+ if (build_inc)
+ buildver++;
+
+ file = must_open ("newversion.h", "w");
+
+ /* Output the leading comment. */
+ fprintf (file,
+"/* Version control for the shell. This file gets changed when you say\n\
+ `make newversion' to the Makefile. It is created by mkversion. */\n");
+
+ fprintf (file, "\n/* The distribution version number of this shell. */\n");
+ fprintf (file, "#define DISTVERSION \"%.2f\"\n", distver);
+
+ fprintf (file, "\n/* The patch level of this version of the shell. */\n");
+ fprintf (file, "#define PATCHLEVEL %d\n", patchlevel);
+
+ fprintf (file, "\n/* The last built version of this shell. */\n");
+ fprintf (file, "#define BUILDVERSION %d\n", buildver);
+
+ if (status)
+ {
+ fprintf (file, "\n/* The release status of this shell. */\n");
+ fprintf (file, "#define RELSTATUS \"%s\"\n", status);
+ }
+
+ fprintf (file, "\n/* A version string for use by sccs and the what command. */\n\n");
+ if (status)
+ fprintf (file, "#define SCCSVERSION \"@(#)Bash version %.2f.%d(%d) %s GNU\"\n\n",
+ distver, patchlevel, buildver, status);
+ else
+ fprintf (file, "#define SCCSVERSION \"@(#)Bash version %.2f.%d(%d) GNU\"\n\n",
+ distver, patchlevel, buildver);
+
+ fclose (file);
+
+ file = must_open (".build", "w");
+ fprintf (file, "%d\n", buildver);
+ fclose (file);
+
+ /* Making a new distribution. */
+ if (dist)
+ {
+ file = must_open (".distribution", "w");
+ fprintf (file, "%.2f\n", distver);
+ fclose (file);
+ }
+
+ /* Releasing a new patch level. */
+ if (patch)
+ {
+ file = must_open (".patchlevel", "w");
+ fprintf (file, "%d\n", patchlevel);
+ fclose (file);
+ }
+
+ exit (0);
+}
+
+char *
+makename (fn, from_srcdir)
+ char *fn;
+{
+ char *ret;
+ int dlen;
+
+ dlen = (from_srcdir && dir) ? strlen (dir) + 1 : 0;
+ ret = (char *)malloc (dlen + strlen (fn) + 1);
+ if (ret == 0)
+ {
+ fprintf (stderr, "%s: malloc failed\n", progname);
+ exit (1);
+ }
+ if (from_srcdir && dir)
+ sprintf (ret, "%s/%s", dir, fn);
+ else
+ (void)strcpy (ret, fn);
+
+ return ret;
+}
+
+get_float_from_file (filename, var, from_srcdir)
+ char *filename;
+ float *var;
+ int from_srcdir;
+{
+ FILE *stream;
+ int result;
+ char *name;
+
+ name = makename (filename, from_srcdir);
+ stream = fopen (name, "r");
+ free (name);
+ if (stream == (FILE *)NULL)
+ return (0);
+ result = fscanf (stream, "%f\n", var);
+ fclose (stream);
+ return (result == 1);
+}
+
+get_int_from_file (filename, var, from_srcdir)
+ char *filename;
+ int *var, from_srcdir;
+{
+ FILE *stream;
+ int result;
+ char *name;
+
+ name = makename (filename, from_srcdir);
+ stream = fopen (name, "r");
+ free (name);
+ if (stream == (FILE *)NULL)
+ return (0);
+ result = fscanf (stream, "%d\n", var);
+ fclose (stream);
+ return (result == 1);
+}
+
+FILE *
+must_open (name, mode)
+ char *name, *mode;
+{
+ FILE *temp = fopen (name, mode);
+
+ if (!temp)
+ {
+ fprintf (stderr, "%s: Cannot open `%s' for mode `%s'.\n",
+ progname, name, mode);
+ fprintf
+ (stderr,
+ "Perhaps you don't have %s permission to the file or directory.\n",
+ (strcmp (mode, "w") == 0) ? "write" : "read");
+ exit (3);
+ }
+ return (temp);
+}
diff --git a/support/recho.c b/support/recho.c
index b9dc00b..847fa2c 100644
--- a/support/recho.c
+++ b/support/recho.c
@@ -29,4 +29,5 @@ char *str;
} else
putchar(*s);
}
+ return(0);
}
diff --git a/support/srcdir b/support/srcdir
deleted file mode 100755
index 9d8ccd7..0000000
--- a/support/srcdir
+++ /dev/null
@@ -1,13 +0,0 @@
-#! /bin/sh
-#
-# srcdir - print out the absolute pathname of the top of the bash source
-# tree. Used for getting the right value to makes in subdirectories
-#
-
-case "$1" in
-'.'|./) pwd ;;
-./*|..*) echo `pwd`/"$1" ;;
-*) echo "$1" ;;
-esac
-
-exit 0
diff --git a/support/texi2dvi b/support/texi2dvi
index 12281e5..8fb2f90 100755
--- a/support/texi2dvi
+++ b/support/texi2dvi
@@ -1,8 +1,10 @@
-#!/bin/sh
-# texi2dvi -- smartly produce DVI files from texinfo sources
-#
-# Copyright (C) 1992, 1993 Free Software Foundation.
-#
+#! /bin/sh
+# texi2dvi --- smartly produce DVI files from texinfo sources
+
+# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+
+# $Id: texi2dvi,v 0.5 1995/06/20 02:21:36 friedman Exp $
+
# 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)
@@ -15,110 +17,122 @@
#
# 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 author (see below) or write to:
-#
-# Free Software Foundation, Inc.
-# 675 Mass Ave.
-# Cambridge, MA 02139, USA.
-#
+# program's maintainer or write to: The Free Software Foundation,
+# Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
+
+# Commentary:
+
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+
# Please send bug reports, etc. to bug-texinfo@prep.ai.mit.edu
# If possible, please send a copy of the output of the script called with
-# the `--debug' option when making a bug report.
-#
-# Version 0.4
-# Last modified 26-Mar-93
-#
+# the `--debug' option when making a bug report.
-# Please note that in the interest of general portability, some common
-# bourne shell constructs were avoided because they weren't guaranteed to
-# be available in some earlier implementations. I've tried to make this as
-# portable as possible.
+# In the interest of general portability, some common bourne shell
+# constructs were avoided because they weren't guaranteed to be available
+# in some earlier implementations. I've tried to make this program as
+# portable as possible. Welcome to unix, where the lowest common
+# denominator is rapidly diminishing.
#
# Among the more interesting lossages I noticed with some bourne shells
# are:
-# 1) Some don't have an `unset' builtin
-# 2) In some implementations the `shift' builtin can't take a
-# numerical argument.
-
-progname=`basename $0`
+# * No shell functions.
+# * No `unset' builtin.
+# * `shift' cannot take a numeric argument, and signals an error if
+# there are no arguments to shift.
-usage="Usage: ${progname} {-D} {-h} [file1] {file2} {...}
- {--debug} {--help}
+# Code:
- Options in braces are optional. Those in brackets are required.
-"
+# Name by which this script was invoked.
+progname=`echo "$0" | sed -e 's/[^\/]*\///g'`
-if test $# -eq 0 ; then
- echo "${usage}" 1>&2;
- exit 1
-fi
+# This string is expanded by rcs automatically when this file is checked out.
+rcs_revision='$Revision: 0.5 $'
+version=`set - $rcs_revision; echo $2`
-backup_extension=".bak"
-texindex="texindex"
-tex="tex"
-bq="\`" # To prevent hairy quoting and escaping later.
+# To prevent hairy quoting and escaping later.
+bq='`'
eq="'"
-orig_pwd="`pwd`"
-if test "z${TEXINDEX}" != "z" ; then
- texindex="${TEXINDEX}"
-fi
+usage="Usage: $progname {options} [file1] {file2 {...}}
+(version $version)
+
+Options are:
+-D, --debug Turn on shell debugging ($bq${bq}set -x$eq$eq).
+-h, --help You're looking at it.
+-v, --version Print version number.
-if test "z${TEX}" != "z" ; then
- tex="${TEX}"
-fi
+Arguments in brackets are required. Those in braces are optional.
+"
+
+# Initialize variables.
+# Don't use `unset' since old bourne shells don't have this command.
+# Instead, assign them an empty value.
+# Some of these, like TEX and TEXINDEX, may be inherited from the environment
+backup_extension=.bak
+debug=
+orig_pwd="`pwd`"
+verbose=
+texindex="${TEXINDEX-texindex}"
+tex="${TEX-tex}"
# Save this so we can construct a new TEXINPUTS path for each file to be
# processed.
-TEXINPUTS_orig="${TEXINPUTS}"
+TEXINPUTS_orig="$TEXINPUTS"
export TEXINPUTS
-# Parse command line options
-
-# "unset" option variables to make sure they weren't accidentally
-# exported
-debug=""
-
-# If you add new commands be sure to change the wildcards below to make
-# sure they are unambiguous (i.e. only match one possible long option)
-# Be sure to show at least one instance of the full long option name to
-# document what the long option is canonically called.
-while test $# -gt 0 ; do
- case z$1 in
- z-D | z--debug | z--d* )
- debug="t"
- shift
- ;;
- z-h | z--help | z--h* )
- echo "${usage}" 1>&2
- exit 1
- ;;
- z-- )
- shift
- break
- ;;
- z-* )
- echo "${progname}: ${bq}${1}${eq} is not a valid option." 1>&2
- echo "" 1>&2
- echo "${usage}" 1>&2
- exit 1
- ;;
- * )
- break
- ;;
+# Parse command line arguments.
+# Make sure that all wildcarded options are long enough to be unambiguous.
+# It's a good idea to document the full long option name in each case.
+# Long options which take arguments will need a `*' appended to the
+# canonical name to match the value appended after the `=' character.
+while : ; do
+ case $# in 0) break ;; esac
+ case "$1" in
+ -D | --debug | --d* )
+ debug=t
+ shift
+ ;;
+ -h | --help | --h* )
+ echo "$usage" 1>&2
+ exit 0
+ ;;
+ -v | --version | --v* )
+ echo "texi2dvi version $version" 1>&2
+ exit 0
+ ;;
+ -- ) # Stop option processing
+ shift
+ break
+ ;;
+ -* )
+ case "$1" in
+ --*=* ) arg=`echo "$1" | sed -e 's/=.*//'` ;;
+ * ) arg="$1" ;;
+ esac
+ exec 1>&2
+ echo "$progname: unknown or ambiguous option $bq$arg$eq"
+ echo "$progname: Use $bq--help$eq for a list of options."
+ exit 1
+ ;;
+ * )
+ break
+ ;;
esac
done
# See if there are any command line args left (which will be interpreted as
# filename arguments)
-if test $# -eq 0 ; then
- echo "${progname}: at least one file name is required as an argument." 1>&2
- echo "" 1>&2
- echo "${usage}" 1>&2
- exit 1
-fi
+case $# in
+ 0 )
+ exec 1>&2
+ echo "$progname: at least one file name is required as an argument."
+ echo "$progname: Use $bq--help$eq for a description of command syntax."
+ exit 2
+ ;;
+esac
-test "z${debug}" = "zt" && set -x
+case "$debug" in t ) set -x ;; esac
# Texify files
for command_line_filename in ${1+"$@"} ; do
@@ -137,7 +151,7 @@ for command_line_filename in ${1+"$@"} ; do
# Source file might @include additional texinfo sources. Put `.' and
# directory where source file(s) reside in TEXINPUTS before anything
# else. `.' goes first to ensure that any old .aux, .cps, etc. files in
- # ${directory} don't get used in preference to fresher files in `.'.
+ # ${directory} don't get used in preference to fresher files in `.'.
TEXINPUTS=".:${directory}:${TEXINPUTS_orig}"
# "Unset" variables that might have values from previous iterations and
@@ -150,7 +164,7 @@ for command_line_filename in ${1+"$@"} ; do
# able to find the right index files and so forth.
if test ! -r "${command_line_filename}" ; then
echo "${progname}: ${command_line_filename}: No such file or permission denied." 1>&2
- continue;
+ continue;
fi
# Find all files having root filename with a two-letter extension,
@@ -159,7 +173,7 @@ for command_line_filename in ${1+"$@"} ; do
# that too.
possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`"
for this_file in ${possible_index_files} ; do
- # If file is empty, forget it.
+ # If file is empty, forget it.
if test ! -s "${this_file}" ; then
continue;
fi
@@ -177,7 +191,7 @@ for command_line_filename in ${1+"$@"} ; do
s/^[ ]*//;s/[ ]*$//;'`"
# Now save copies of original index files so we have some means of
- # comparison later.
+ # comparison later.
for index_file_to_save in ${orig_index_files} ; do
cp "${index_file_to_save}" "${index_file_to_save}${backup_extension}"
done
@@ -213,20 +227,20 @@ for command_line_filename in ${1+"$@"} ; do
s/^[ ]*//;s/[ ]*$//;'`"
# If old and new list don't at least have the same file list, then one
- # file or another has definitely changed.
+ # file or another has definitely changed.
if test "${orig_index_files}" != "${new_index_files}" ; then
index_files_changed_p=t
else
# File list is the same. We must compare each file until we find a
- # difference.
+ # difference.
index_files_changed_p=""
for this_file in ${new_index_files} ; do
- # cmp -s will return nonzero exit status if files differ.
+ # cmp -s will return nonzero exit status if files differ.
cmp -s "${this_file}" "${this_file}${backup_extension}"
if test $? -ne 0 ; then
# We only need to keep comparing until we find *one* that
# differs, because we'll have to run texindex & tex no
- # matter what.
+ # matter what.
index_files_changed_p=t
break
fi
@@ -238,7 +252,7 @@ for command_line_filename in ${1+"$@"} ; do
if test "${index_files_changed_p}" ; then
retval=0
if test "${new_index_files_sans_aux}" ; then
- ${texindex} ${new_index_files_sans_aux}
+ ${texindex} ${new_index_files_sans_aux}
retval=$?
fi
if test ${retval} -eq 0 ; then
@@ -248,7 +262,7 @@ for command_line_filename in ${1+"$@"} ; do
fi
# Generate list of files to delete, then call rm once with the entire
- # list. This is significantly faster than multiple executions of rm.
+ # list. This is significantly faster than multiple executions of rm.
file_list=""
for file in ${orig_index_files} ; do
file_list="${file_list} ${file}${backup_extension}"
@@ -258,6 +272,4 @@ for command_line_filename in ${1+"$@"} ; do
fi
done
-#
-# eof
-#
+# texi2dvi ends here
diff --git a/support/texi2html b/support/texi2html
new file mode 100755
index 0000000..2c61aa9
--- /dev/null
+++ b/support/texi2html
@@ -0,0 +1,2021 @@
+#!/usr/local/bin/perl
+'di ';
+'ig 00 ';
+#+##############################################################################
+# #
+# File: texi2html #
+# #
+# Description: Program to transform most Texinfo documents to HTML #
+# #
+#-##############################################################################
+
+# @(#)texi2html 1.51 09/10/96 Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch
+
+# The man page for this program is included at the end of this file and can be
+# viewed using the command 'nroff -man texi2html'.
+# Please read the copyright at the end of the man page.
+
+#+++############################################################################
+# #
+# Constants #
+# #
+#---############################################################################
+
+$DEBUG_TOC = 1;
+$DEBUG_INDEX = 2;
+$DEBUG_BIB = 4;
+$DEBUG_GLOSS = 8;
+$DEBUG_DEF = 16;
+$DEBUG_HTML = 32;
+$DEBUG_USER = 64;
+
+$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
+$XREFRE = '[^@{}]+'; # RE for a xref (should use NODERE)
+
+$ERROR = "***"; # prefix for errors and warnings
+$THISPROG = "texi2html 1.51"; # program name and version
+$HOMEPAGE = "http://wwwcn.cern.ch/dci/texi2html/"; # program home page
+$TODAY = &pretty_date; # like "20 September 1993"
+$SPLITTAG = "<!-- SPLIT HERE -->\n"; # tag to know where to split
+$PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections
+$html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//EN">';
+
+#
+# language dependent constants
+#
+#$LDC_SEE = 'see';
+#$LDC_SECTION = 'section';
+#$LDC_IN = 'in';
+#$LDC_TOC = 'Table of Contents';
+#$LDC_GOTO = 'Go to the';
+#$LDC_FOOT = 'Footnotes';
+# TODO: @def* shortcuts
+
+#
+# pre-defined indices
+#
+%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+
+ " ", " ",
+ "\n", "\n",
+ "|", "",
+ # spacing commands
+ ":", "",
+ "!", "!",
+ "?", "?",
+ ".", ".",
+ );
+
+#
+# texinfo "things" (@foo{}) to HTML ones
+#
+%things_map = (
+ 'TeX', 'TeX',
+ 'br', '<P>', # paragraph break
+ 'bullet', '*',
+ 'copyright', '(C)',
+ 'dots', '...',
+ 'equiv', '==',
+ 'error', 'error-->',
+ 'expansion', '==>',
+ 'minus', '-',
+ 'point', '-!-',
+ 'print', '-|',
+ 'result', '=>',
+ 'today', $TODAY,
+ );
+
+#
+# texinfo styles (@foo{bar}) to HTML ones
+#
+%style_map = (
+ 'asis', '',
+ 'b', 'B',
+ 'cite', 'CITE',
+ 'code', 'CODE',
+ 'ctrl', '&do_ctrl', # special case
+ 'dfn', 'STRONG', # DFN tag is illegal in the standard
+ 'dmn', '', # useless
+ 'emph', 'EM',
+ 'file', '"TT', # will put quotes, cf. &apply_style
+ 'i', 'I',
+ 'kbd', 'KBD',
+ 'key', 'KBD',
+ 'r', '', # unsupported
+ 'samp', '"SAMP', # will put quotes, cf. &apply_style
+ 'sc', '&do_sc', # special case
+ 'strong', 'STRONG',
+ 't', 'TT',
+ 'titlefont', '', # useless
+ 'var', 'VAR',
+ 'w', '', # unsupported
+ );
+
+#
+# texinfo format (@foo/@end foo) to HTML ones
+#
+%format_map = (
+ 'display', 'PRE',
+ 'example', 'PRE',
+ 'format', 'PRE',
+ 'lisp', 'PRE',
+ 'quotation', 'BLOCKQUOTE',
+ 'smallexample', 'PRE',
+ 'smalllisp', 'PRE',
+ # lists
+ 'itemize', 'UL',
+ 'enumerate', 'OL',
+ # poorly supported
+ 'flushleft', 'PRE',
+ 'flushright', 'PRE',
+ );
+
+#
+# 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}',
+ 'defmethod', 'defop Method',
+ # 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,
+ # useless
+ '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,
+ 'need', 1,
+ 'page', 1,
+ 'setchapternewpage', 1,
+ 'everyheading', 1,
+ 'everyfooting', 1,
+ 'evenheading', 1,
+ 'evenfooting', 1,
+ 'oddheading', 1,
+ 'oddfooting', 1,
+ 'smallbook', 1,
+ 'vskip', 1,
+ 'filbreak', 1,
+ # unsupported formats
+ 'cartouche', 1,
+ 'end cartouche', 1,
+ 'group', 1,
+ 'end group', 1,
+ );
+
+#+++############################################################################
+# #
+# Argument parsing, initialisation #
+# #
+#---############################################################################
+
+$use_bibliography = 1;
+$use_acc = 0;
+$debug = 0;
+$doctype = '';
+$check = 0;
+$expandinfo = 0;
+$use_glossary = 0;
+$invisible_mark = '';
+$use_iso = 0;
+@include_dirs = ();
+$show_menu = 0;
+$number_sections = 0;
+$split_node = 0;
+$split_chapter = 0;
+$monolithic = 0;
+$verbose = 0;
+$usage = <<EOT;
+This is $THISPROG
+To convert a Texinfo file to HMTL: $0 [options] file
+ where options can be:
+ -expandinfo : use \@ifinfo sections, not \@iftex
+ -glossary : handle a glossary
+ -invisible name: use 'name' as an invisible anchor
+ -I dir : search also for files in 'dir'
+ -menu : handle menus
+ -monolithic : output only one file including ToC
+ -number : number sections
+ -split_chapter : split on main sections
+ -split_node : split on nodes
+ -usage : print usage instructions
+ -verbose : verbose output
+To check converted files: $0 -check [-verbose] files
+EOT
+
+while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) {
+ $_ = shift(@ARGV);
+ if (/^-acc$/) { $use_acc = 1; next; }
+ if (/^-d(ebug)?(\d+)?$/) { $debug = $2 || shift(@ARGV); next; }
+ if (/^-doctype$/) { $doctype = shift(@ARGV); next; }
+ if (/^-c(heck)?$/) { $check = 1; next; }
+ if (/^-e(xpandinfo)?$/) { $expandinfo = 1; next; }
+ if (/^-g(lossary)?$/) { $use_glossary = 1; next; }
+ if (/^-i(nvisible)?$/) { $invisible_mark = shift(@ARGV); next; }
+ if (/^-iso$/) { $use_iso = 1; next; }
+ if (/^-I(.+)?$/) { push(@include_dirs, $1 || shift(@ARGV)); next; }
+ if (/^-m(enu)?$/) { $show_menu = 1; next; }
+ if (/^-mono(lithic)?$/) { $monolithic = 1; next; }
+ if (/^-n(umber)?$/) { $number_sections = 1; next; }
+ if (/^-s(plit)?_?(n(ode)?|c(hapter)?)?$/) {
+ if ($2 =~ /^n/) {
+ $split_node = 1;
+ } else {
+ $split_chapter = 1;
+ }
+ next;
+ }
+ if (/^-v(erbose)?$/) { $verbose = 1; next; }
+ die $usage;
+}
+if ($check) {
+ die $usage unless @ARGV > 0;
+ &check;
+ exit;
+}
+
+if (($split_node || $split_chapter) && $monolithic) {
+ warn "Can't use -monolithic with -split, -monolithic ignored.\n";
+ $monolithic = 0;
+}
+if ($expandinfo) {
+ $to_skip{'ifinfo'}++;
+ $to_skip{'end ifinfo'}++;
+} else {
+ $to_skip{'iftex'}++;
+ $to_skip{'end iftex'}++;
+}
+$invisible_mark = '<IMG SRC="invisible.xbm">' if $invisible_mark eq 'xbm';
+die $usage unless @ARGV == 1;
+$docu = shift(@ARGV);
+if ($docu =~ /.*\//) {
+ chop($docu_dir = $&);
+ $docu_name = $';
+} else {
+ $docu_dir = '.';
+ $docu_name = $docu;
+}
+unshift(@include_dirs, $docu_dir);
+$docu_name =~ s/\.te?x(i|info)?$//; # basename of the document
+
+$docu_doc = "$docu_name.html"; # document's contents
+if ($monolithic) {
+ $docu_toc = $docu_foot = $docu_doc;
+} else {
+ $docu_toc = "${docu_name}_toc.html"; # document's table of contents
+ $docu_foot = "${docu_name}_foot.html"; # document's footnotes
+}
+
+#
+# variables
+#
+%value = (); # hold texinfo variables
+$value{'html'} = 1; # predefine html (the output format)
+$value{'texi2html'} = '1.51'; # predefine texi2html (the translator)
+# _foo: internal to track @foo
+foreach ('_author', '_title', '_subtitle',
+ '_settitle', '_setfilename') {
+ $value{$_} = ''; # prevent -w warnings
+}
+%node2sec = (); # node to section name
+%node2href = (); # node to HREF
+%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 ($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 $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 $verbose;
+ require($extensions);
+ }
+}
+
+print "# reading from $docu\n" if $verbose;
+
+#+++############################################################################
+# #
+# Pass 1: read source, handle command, variable, simple substitution #
+# #
+#---############################################################################
+
+@lines = (); # whole document
+@toc_lines = (); # table of contents
+$toplevel = 0; # top level seen in hierarchy
+$curlevel = 0; # current level in TOC
+$node = ''; # current node name
+$in_table = 0; # am I inside a table
+$table_type = ''; # type of table ('', 'f', 'v')
+@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
+$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
+$split_num = 0; # split index
+$deferred_ref = ''; # deferred reference for indexes
+@html_stack = (); # HTML elements stack
+$html_element = ''; # current HTML element
+&html_reset;
+
+# 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 .= "([aeiou])/&\${1}$accent_map{$_};/gi;\n";
+ }
+}
+eval("sub simple_substitutions { $subst_code }");
+
+&init_input;
+while ($_ = &next_line) {
+ #
+ # remove \input on the first lines only
+ #
+ if ($first_line) {
+ next if /^\\input/;
+ $first_line = 0;
+ }
+ #
+ # parse texinfo tags
+ #
+ $tag = '';
+ $end_tag = '';
+ if (/^\@end\s+(\w+)\b/) {
+ $end_tag = $1;
+ } elsif (/^\@(\w+)\b/) {
+ $tag = $1;
+ }
+ #
+ # handle @ifhtml / @end ifhtml
+ #
+ if ($in_html) {
+ if ($end_tag eq 'ifhtml') {
+ $in_html = 0;
+ } else {
+ $tag2pro{$in_html} .= $_;
+ }
+ next;
+ } elsif ($tag eq 'ifhtml') {
+ $in_html = $PROTECTTAG . ++$html_num;
+ push(@lines, $in_html);
+ next;
+ }
+ #
+ # try to skip the line
+ #
+ if ($end_tag) {
+ next if $to_skip{"end $end_tag"};
+ } elsif ($tag) {
+ next if $to_skip{$tag};
+ last if $tag eq 'bye';
+ }
+ if ($in_top) {
+ # parsing the top node
+ if ($tag eq 'node' || $tag eq 'include' || $sec2level{$tag}) {
+ # no more in top
+ $in_top = 0;
+ } else {
+ # skip it
+ next;
+ }
+ }
+ #
+ # try to remove inlined comments
+ # syntax from tex-mode.el comment-start-skip
+ #
+ s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/;
+ # non-@ substitutions cf. texinfmt.el
+ 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';
+ if ($expandinfo) {
+ &skip_until($tag), next if $tag eq 'iftex';
+ } else {
+ &skip_until($tag), next if $tag eq 'ifinfo';
+ }
+ &skip_until($tag), next if $tag eq 'tex';
+ # handle special tables
+ if ($tag eq 'table') {
+ $table_type = '';
+ } elsif ($tag eq 'ftable') {
+ $tag = 'table';
+ $table_type = 'f';
+ } elsif ($tag eq 'vtable') {
+ $tag = 'table';
+ $table_type = 'v';
+ }
+ # special cases
+ if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*,/i)) {
+ $in_top = 1;
+ @lines = (); # ignore all lines before top (title page garbage)
+ next;
+ } elsif ($tag eq 'node') {
+ $in_top = 0;
+ warn "$ERROR Bad node line: $_" unless $_ =~ /^\@node\s$NODESRE$/o;
+ $_ = &protect_html($_); # if node contains '&' for instance
+ s/^\@node\s+//;
+ ($node) = split(/,/);
+ &normalise_node($node);
+ if ($split_node) {
+ &next_doc;
+ push(@lines, $SPLITTAG) if $split_num++;
+ push(@sections, $node);
+ }
+ next;
+ } elsif ($tag eq 'include') {
+ if (/^\@include\s+($FILERE)\s*$/o) {
+ $file = $1;
+ unless (-e $file) {
+ foreach $dir (@include_dirs) {
+ $file = "$dir/$1";
+ last if -e $file;
+ }
+ }
+ if (-e $file) {
+ &open($file);
+ print "# including $file\n" if $verbose;
+ } else {
+ warn "$ERROR Can't find $file, 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 ($show_menu) {
+ &skip_until($tag);
+ next;
+ }
+ &html_push_if($tag);
+ push(@lines, &html_debug("\n", __LINE__));
+ } elsif ($format_map{$tag}) {
+ $in_pre = 1 if $format_map{$tag} eq 'PRE';
+ &html_push_if($format_map{$tag});
+ push(@lines, &html_debug("\n", __LINE__));
+ $in_list++ if $format_map{$tag} eq 'UL' || $format_map{$tag} eq 'OL' ;
+ push(@lines, &debug("<$format_map{$tag}>\n", __LINE__));
+ next;
+ } elsif ($tag eq 'table') {
+ if (/^\@[fv]?table\s+\@(\w+)\s*$/) {
+ $in_table = $1;
+ unshift(@tables, join($;, $table_type, $in_table));
+ push(@lines, &debug("<DL COMPACT>\n", __LINE__));
+ &html_push_if('DL');
+ push(@lines, &html_debug("\n", __LINE__));
+ } else {
+ warn "$ERROR Bad table line: $_";
+ }
+ next;
+ } elsif ($tag eq 'synindex' || $tag eq 'syncodeindex') {
+ if (/^\@$tag\s+(\w)\w\s+(\w)\w\s*$/) {
+ eval("*${1}index = *${2}index");
+ } else {
+ warn "$ERROR Bad syn*index line: $_";
+ }
+ next;
+ } elsif ($tag eq 'sp') {
+ push(@lines, &debug("<P>\n", __LINE__));
+ next;
+ } 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;
+ $node2href{$setref} = "$docu_doc#$docid";
+ } else {
+ warn "$ERROR Bad setref line: $_";
+ }
+ next;
+ } elsif ($tag eq 'defindex' || $tag eq 'defcodeindex') {
+ if (/^\@$tag\s+(\w\w)\s*$/) {
+ $valid_index{$1} = 1;
+ } else {
+ warn "$ERROR Bad defindex line: $_";
+ }
+ next;
+ } 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 $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 $debug & $DEBUG_DEF;
+ $type .= ':'; # it's nicer like this
+ $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') {
+ unshift(@input_spool, "\@findex $name\n");
+ } elsif ($tag eq 'defop') {
+ unshift(@input_spool, "\@findex $name on $ftype\n");
+ } elsif ($tag eq 'defvr' || $tag eq 'deftypevr' || $tag eq 'defcv') {
+ unshift(@input_spool, "\@vindex $name\n");
+ } else {
+ 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('LI', 'P');
+ &html_pop_if();
+ push(@lines, &debug("</$format_map{$end_tag}>\n", __LINE__));
+ push(@lines, &html_debug("\n", __LINE__));
+ } elsif ($end_tag eq 'table' ||
+ $end_tag eq 'ftable' ||
+ $end_tag eq 'vtable') {
+ shift(@tables);
+ if (@tables) {
+ ($table_type, $in_table) = split($;, $tables[0]);
+ } else {
+ $in_table = 0;
+ }
+ push(@lines, "</DL>\n");
+ &html_pop_if('DD');
+ &html_pop_if();
+ } 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;
+ }
+ #
+ # misc things
+ #
+ # protect texi and HTML things
+ &protect_texi;
+ $_ = &protect_html($_) unless $dont_html;
+ $dont_html = 0;
+ # substitution (unsupported things)
+ s/^\@center\s+//g;
+ s/^\@exdent\s+//g;
+ s/\@noindent\s+//g;
+ s/\@refill\s+//g;
+ # other substitutions
+ &simple_substitutions;
+ s/\@value{($VARRE)}/$value{$1}/eg;
+ 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 =~ s/\s+$//;
+ $level = $sec2level{$tag};
+ $name = &update_sec_num($tag, $level) . " $name"
+ if $number_sections && $tag !~ /^unnumbered/;
+ if ($tag =~ /heading$/) {
+ push(@lines, &html_debug("\n", __LINE__));
+ if ($html_element ne 'body') {
+ # We are in a nice pickle here. We are trying to get a H? heading
+ # even though we are not in the body level. So, we convert it to a
+ # nice, bold, line by itself.
+ $_ = &debug("\n\n<P><STRONG>$name</STRONG></P>\n\n", __LINE__);
+ } else {
+ $_ = &debug("<H$level>$name</H$level>\n", __LINE__);
+ &html_push_if('body');
+ }
+ print "# heading, section $name, level $level\n"
+ if $debug & $DEBUG_TOC;
+ } else {
+ if ($split_chapter) {
+ unless ($toplevel) {
+ # first time we see a "section"
+ unless ($level == 1) {
+ warn "$ERROR The first section found is not of level 1: $_";
+ warn "$ERROR I'll split on sections of level $level...\n";
+ }
+ $toplevel = $level;
+ }
+ if ($level == $toplevel) {
+ &next_doc;
+ push(@lines, $SPLITTAG) if $split_num++;
+ push(@sections, $name);
+ }
+ }
+ $sec_num++;
+ $docid = "SEC$sec_num";
+ $tocid = "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) {
+ if ($node2sec{$node}) {
+ warn "$ERROR Duplicate node found: $node\n";
+ } else {
+ $node2sec{$node} = $name;
+ $node2href{$node} = "$docu_doc#$docid";
+ print "# node $node, section $name, level $level\n"
+ if $debug & $DEBUG_TOC;
+ }
+ $node = '';
+ } else {
+ print "# no node, section $name, level $level\n"
+ if $debug & $DEBUG_TOC;
+ }
+ # update TOC
+ while ($level > $curlevel) {
+ $curlevel++;
+ push(@toc_lines, "<UL>\n");
+ }
+ while ($level < $curlevel) {
+ $curlevel--;
+ push(@toc_lines, "</UL>\n");
+ }
+ $_ = "<LI>" . &anchor($tocid, "$docu_doc#$docid", $name, 1);
+ push(@toc_lines, &substitute_style($_));
+ # update DOC
+ push(@lines, &html_debug("\n", __LINE__));
+ &html_reset;
+ $_ = "<H$level>".&anchor($docid, "$docu_toc#$tocid", $name)."</H$level>\n";
+ $_ = &debug($_, __LINE__);
+ push(@lines, &html_debug("\n", __LINE__));
+ }
+ # update DOC
+ foreach $line (split(/\n+/, $_)) {
+ push(@lines, "$line\n");
+ }
+ next;
+ } else {
+ warn "$ERROR Bad section line: $_";
+ }
+ } else {
+ # track variables
+ $value{$1} = $2, next if /^\@set\s+($VARRE)\s+(.*)$/o;
+ delete $value{$1}, next if /^\@clear\s+($VARRE)\s*$/o;
+ # store things
+ $value{'_setfilename'} = $1, next if /^\@setfilename\s+(.*)$/;
+ $value{'_settitle'} = $1, next if /^\@settitle\s+(.*)$/;
+ $value{'_author'} .= "$1\n", next if /^\@author\s+(.*)$/;
+ $value{'_subtitle'} .= "$1\n", next if /^\@subtitle\s+(.*)$/;
+ $value{'_title'} .= "$1\n", next if /^\@title\s+(.*)$/;
+ # index
+ if (/^\@(..?)index\s+/) {
+ unless ($valid_index{$1}) {
+ warn "$ERROR Undefined index command: $_";
+ next;
+ }
+ $id = 'IDX' . ++$idx_num;
+ $index = $1 . 'index';
+ $what = &substitute_style($');
+ $what =~ s/\s+$//;
+ print "# found $index for '$what' id $id\n"
+ if $debug & $DEBUG_INDEX;
+ eval(<<EOC);
+ if (defined(\$$index\{\$what\})) {
+ \$$index\{\$what\} .= "$;$docu_doc#$id";
+ } else {
+ \$$index\{\$what\} = "$docu_doc#$id";
+ }
+EOC
+ #
+ # dirty hack to see if I can put an invisible anchor...
+ #
+ if ($html_element eq 'P' ||
+ $html_element eq 'LI' ||
+ $html_element eq 'DT' ||
+ $html_element eq 'DD' ||
+ $html_element eq 'ADDRESS' ||
+ $html_element eq 'B' ||
+ $html_element eq 'BLOCKQUOTE' ||
+ $html_element eq 'PRE' ||
+ $html_element eq 'SAMP') {
+ push(@lines, &anchor($id, '', $invisible_mark, !$in_pre));
+ } elsif ($html_element eq 'body') {
+ push(@lines, &debug("<P>\n", __LINE__));
+ push(@lines, &anchor($id, '', $invisible_mark, !$in_pre));
+ &html_push('P');
+ } elsif ($html_element eq 'DL' ||
+ $html_element eq 'UL' ||
+ $html_element eq 'OL' ) {
+ $deferred_ref .= &anchor($id, '', $invisible_mark, !$in_pre) . " ";
+ }
+ next;
+ }
+ # list item
+ if (/^\@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 $debug & $DEBUG_BIB;
+ $what = &anchor($id, '', $what);
+ }
+ } elsif ($in_glossary && $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 $debug & $DEBUG_GLOSS;
+ $what = &anchor($id, '', $what);
+ }
+ &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");
+ }
+ } else {
+ push(@lines, &debug("<LI>$what\n", __LINE__));
+ &html_push('LI') unless $html_element eq 'LI';
+ }
+ push(@lines, &html_debug("\n", __LINE__));
+ if ($deferred_ref) {
+ push(@lines, &debug("$deferred_ref\n", __LINE__));
+ $deferred_ref = '';
+ }
+ next;
+ }
+ }
+ }
+ # paragraph separator
+ if ($_ eq "\n") {
+ next if $#lines >= 0 && $lines[$#lines] eq "\n";
+ if ($html_element eq 'P') {
+ push(@lines, "\n");
+ $_ = &debug("</P>\n", __LINE__);
+ &html_pop;
+ }
+ } elsif ($html_element eq 'body' || $html_element eq 'BLOCKQUOTE') {
+ push(@lines, "<P>\n");
+ &html_push('P');
+ $_ = &debug($_, __LINE__);
+ }
+ # otherwise
+ push(@lines, $_);
+}
+
+# finish TOC
+$level = 0;
+while ($level < $curlevel) {
+ $curlevel--;
+ push(@toc_lines, "</UL>\n");
+}
+
+print "# end of pass 1\n" if $verbose;
+
+#+++############################################################################
+# #
+# 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
+ #
+ $in_menu = 1, push(@lines2, &debug("<UL>\n", __LINE__)), next if /^\@menu\b/;
+ $in_menu = 0, push(@lines2, &debug("</UL>\n", __LINE__)), next if /^\@end\s+menu\b/;
+ if ($in_menu) {
+ if (/^\*\s+($NODERE)::/o) {
+ $descr = $';
+ chop($descr);
+ &menu_entry($1, $1, $descr);
+ } elsif (/^\*\s+(.+):\s+([^\t,\.\n]+)[\t,\.\n]/) {
+ $descr = $';
+ chop($descr);
+ &menu_entry($1, $2, $descr);
+ } elsif (/^\*/) {
+ warn "$ERROR Bad menu line: $_";
+ } else { # description continued?
+ push(@lines2, $_);
+ }
+ next;
+ }
+ #
+ # printindex
+ #
+ if (/^\@printindex\s+(\w\w)\b/) {
+ local($index, *ary, @keys, $key, $letter, $last_letter, @refs);
+ if ($predefined_index{$1}) {
+ $index = $predefined_index{$1} . 'index';
+ } else {
+ $index = $1 . 'index';
+ }
+ eval("*ary = *$index");
+ @keys = keys(%ary);
+ foreach $key (@keys) {
+ $_ = $key;
+ 1 while s/<(\w+)>\`(.*)\'<\/\1>/$2/; # remove HTML tags with quotes
+ 1 while s/<(\w+)>(.*)<\/\1>/$2/; # remove HTML tags
+ $_ = &unprotect_html($_);
+ &unprotect_texi;
+ tr/A-Z/a-z/; # lowercase
+ $key2alpha{$key} = $_;
+ print "# index $key sorted as $_\n"
+ if $key ne $_ && $debug & $DEBUG_INDEX;
+ }
+ $last_letter = undef;
+ foreach $key (sort byalpha @keys) {
+ $letter = substr($key2alpha{$key}, 0, 1);
+ $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;;
+ if (!defined($last_letter) || $letter ne $last_letter) {
+ push(@lines2, "</DIR>\n") if defined($last_letter);
+ push(@lines2, "<H2>" . &protect_html($letter) . "</H2>\n");
+ push(@lines2, "<DIR>\n");
+ $last_letter = $letter;
+ }
+ @refs = ();
+ foreach (split(/$;/, $ary{$key})) {
+ push(@refs, &anchor('', $_, $key, 0));
+ }
+ push(@lines2, "<LI>" . join(", ", @refs) . "\n");
+ }
+ push(@lines2, "</DIR>\n") if defined($last_letter);
+ next;
+ }
+ #
+ # simple style substitutions
+ #
+ $_ = &substitute_style($_);
+ #
+ # xref
+ #
+ while (/\@(x|px|info|)ref{($XREFRE)(}?)/o) {
+ # 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 = 'See ';
+ } elsif ($type eq 'px') {
+ $type = 'see ';
+ } elsif ($type eq 'info') {
+ $type = '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
+ &normalise_node($node);
+ $sec = $node2sec{$node};
+ if (@args == 5) { # reference to another manual
+ $sec = $args[2] || $node;
+ $man = $args[4] || $args[3];
+ $_ = "${before}${type}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 = $node2href{$node};
+ $_ = "${before}${type}section " . &anchor('', $href, $sec) . $after;
+ } else {
+ warn "$ERROR Undefined node ($node): $_";
+ $_ = "$before$;0xref{$nodes}$after";
+ }
+ }
+ #
+ # 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 . &anchor('', $href, $what);
+ } else {
+ $done .= "$pre$what";
+ }
+ $_ = $post;
+ }
+ $_ = $done . $_;
+ }
+ if ($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 . &anchor('', $href, $what);
+ } else {
+ $done .= "$pre$what";
+ }
+ $_ = $post;
+ }
+ $_ = $done . $_;
+ }
+ }
+ # otherwise
+ push(@lines2, $_);
+}
+print "# end of pass 2\n" if $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 $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>" . &anchor($footid, "$d#$docid", $foot) . "</H3>\n");
+ $text = "<P>$text" unless $text =~ /^\s*<P>/;
+ push(@foot_lines, "$text\n");
+ $_ = $before . &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 $verbose;
+
+#+++############################################################################
+# #
+# Pass 5: print things #
+# #
+#---############################################################################
+
+$header = <<EOT;
+<!-- This HTML file has been created by $THISPROG
+ from $docu on $TODAY -->
+EOT
+
+$full_title = $value{'_title'} || $value{'_settitle'} || "Untitled Document";
+$title = $value{'_settitle'} || $full_title;
+$_ = &substitute_style($full_title);
+&unprotect_texi;
+s/\n$//; # rmv last \n (if any)
+$full_title = "<H1>" . join("</H1>\n<H1>", split(/\n/, $_)) . "</H1>\n";
+
+#
+# print ToC
+#
+if (!$monolithic && @toc_lines) {
+ if (open(FILE, "> $docu_toc")) {
+ print "# creating $docu_toc...\n" if $verbose;
+ &print_toplevel_header("$title - Table of Contents");
+ &print_ruler;
+ &print(*toc_lines, FILE);
+ &print_toplevel_footer;
+ close(FILE);
+ } else {
+ warn "$ERROR Can't write to $docu_toc: $!\n";
+ }
+}
+
+#
+# print footnotes
+#
+if (!$monolithic && @foot_lines) {
+ if (open(FILE, "> $docu_foot")) {
+ print "# creating $docu_foot...\n" if $verbose;
+ &print_toplevel_header("$title - Footnotes");
+ &print_ruler;
+ &print(*foot_lines, FILE);
+ &print_toplevel_footer;
+ close(FILE);
+ } else {
+ warn "$ERROR Can't write to $docu_foot: $!\n";
+ }
+}
+
+#
+# print document
+#
+if ($split_chapter || $split_node) { # split
+ $doc_num = 0;
+ $last_num = scalar(@sections);
+ $first_doc = &doc_name(1);
+ $last_doc = &doc_name($last_num);
+ while (@sections) {
+ $section = shift(@sections);
+ &next_doc;
+ if (open(FILE, "> $docu_doc")) {
+ print "# creating $docu_doc...\n" if $verbose;
+ &print_header("$title - $section");
+ $prev_doc = ($doc_num == 1 ? undef : &doc_name($doc_num - 1));
+ $next_doc = ($doc_num == $last_num ? undef : &doc_name($doc_num + 1));
+ $navigation = "Go to the ";
+ $navigation .= ($prev_doc ? &anchor('', $first_doc, "first") : "first");
+ $navigation .= ", ";
+ $navigation .= ($prev_doc ? &anchor('', $prev_doc, "previous") : "previous");
+ $navigation .= ", ";
+ $navigation .= ($next_doc ? &anchor('', $next_doc, "next") : "next");
+ $navigation .= ", ";
+ $navigation .= ($next_doc ? &anchor('', $last_doc, "last") : "last");
+ $navigation .= " section, " . &anchor('', $docu_toc, "table of contents") . ".\n";
+ print FILE $navigation;
+ &print_ruler;
+ # find corresponding lines
+ @tmp_lines = ();
+ while (@doc_lines) {
+ $_ = shift(@doc_lines);
+ last if ($_ eq $SPLITTAG);
+ push(@tmp_lines, $_);
+ }
+ &print(*tmp_lines, FILE);
+ &print_ruler;
+ print FILE $navigation;
+ &print_footer;
+ close(FILE);
+ } else {
+ warn "$ERROR Can't write to $docu_doc: $!\n";
+ }
+ }
+} else { # not split
+ if (open(FILE, "> $docu_doc")) {
+ print "# creating $docu_doc...\n" if $verbose;
+ if ($monolithic || !@toc_lines) {
+ &print_toplevel_header($title);
+ } else {
+ &print_header($title);
+ print FILE $full_title;
+ }
+ if ($monolithic && @toc_lines) {
+ &print_ruler;
+ print FILE "<H1>Table of Contents</H1>\n";
+ &print(*toc_lines, FILE);
+ }
+ &print_ruler;
+ &print(*doc_lines, FILE);
+ if ($monolithic && @foot_lines) {
+ &print_ruler;
+ print FILE "<H1>Footnotes</H1>\n";
+ &print(*foot_lines, FILE);
+ }
+ if ($monolithic || !@toc_lines) {
+ &print_toplevel_footer;
+ } else {
+ &print_footer;
+ }
+ close(FILE);
+ } else {
+ warn "$ERROR Can't write to $docu_doc: $!\n";
+ }
+}
+
+print "# that's all folks\n" if $verbose;
+
+#+++############################################################################
+# #
+# Low level functions #
+# #
+#---############################################################################
+
+sub update_sec_num {
+ local($name, $level) = @_;
+
+ $level--; # here we start at 0
+ if ($name =~ /^appendix/) {
+ # appendix style
+ if (defined(@appendix_sec_num)) {
+ &incr_sec_num($level, @appendix_sec_num);
+ } else {
+ @appendix_sec_num = ('A', 0, 0, 0);
+ }
+ return(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);
+ }
+ return(join('.', @normal_sec_num[0..$level]));
+ }
+}
+
+sub incr_sec_num {
+ local($level, $l);
+ $level = shift(@_);
+ $_[$level]++;
+ foreach $l ($level+1 .. 3) {
+ $_[$l] = 0;
+ }
+}
+
+sub check {
+ local($_, %seen, %context, $before, $match, $after);
+
+ while (<>) {
+ if (/\@(\*|\.|\:|\@|\{|\})/) {
+ $seen{$&}++;
+ $context{$&} .= "> $_" if $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 $verbose;
+ } else {
+ $seen{$match}++;
+ $context{$match} .= "> $_" if $verbose;
+ }
+ $match =~ s/^\@/X/;
+ $_ = "$before$match$after";
+ redo;
+ }
+ }
+
+ foreach (sort(keys(%seen))) {
+ if ($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];
+}
+
+#
+# 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) = @_;
+ return("<!-- $line @html_stack, $html_element -->$what")
+ if $debug & $DEBUG_HTML;
+ return($what);
+}
+
+# to debug the output...
+sub debug {
+ local($what, $line) = @_;
+ return("<!-- $line -->$what")
+ if $debug & $DEBUG_HTML;
+ return($what);
+}
+
+sub normalise_node {
+ $_[0] =~ s/\s+/ /g;
+ $_[0] =~ s/ $//;
+ $_[0] =~ s/^ //;
+}
+
+sub menu_entry {
+ local($entry, $node, $descr) = @_;
+ local($href);
+
+ &normalise_node($node);
+ $href = $node2href{$node};
+ if ($href) {
+ $descr =~ s/^\s+//;
+ $descr = ": $descr" if $descr;
+ push(@lines2, "<LI>" . &anchor('', $href, $entry) . "$descr\n");
+ } else {
+ warn "$ERROR Undefined node ($node): $_";
+ }
+}
+
+sub do_ctrl { "^$_[0]" }
+
+sub do_sc { "\U$_[0]\E" }
+
+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);
+ } 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($_) = @_;
+ s/\@\w+{([^\{\}]+)}/$1/g;
+ return($_);
+}
+
+sub substitute_style {
+ local($_) = @_;
+ local($changed, $done, $style, $text);
+
+ $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 anchor {
+ local($name, $href, $text, $newline) = @_;
+ local($result);
+
+ $result = "<A";
+ $result .= " NAME=\"$name\"" if $name;
+ $result .= " HREF=\"$href\"" if $href;
+ $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', 'Febuary', '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;
+ return("$mday $MoY[$mon] $year");
+}
+
+sub doc_name {
+ local($num) = @_;
+
+ return("${docu_name}_$num.html");
+}
+
+sub next_doc {
+ $docu_doc = &doc_name(++$doc_num);
+}
+
+sub print {
+ local(*lines, $fh) = @_;
+ local($_);
+
+ while (@lines) {
+ $_ = shift(@lines);
+ if (/^$PROTECTTAG/o) {
+ $_ = $tag2pro{$_};
+ } else {
+ &unprotect_texi;
+ }
+ print $fh $_;
+ }
+}
+
+sub print_ruler {
+ print FILE "<P><HR><P>\n";
+}
+
+sub print_header {
+ local($_);
+
+ # clean the title
+ $_ = &remove_style($_[0]);
+ &unprotect_texi;
+ # print the header
+ if ($doctype eq 'html2') {
+ print FILE $html2_doctype;
+ } elsif ($doctype) {
+ print FILE $doctype;
+ }
+ print FILE <<EOT;
+<HTML>
+<HEAD>
+$header
+<TITLE>$_</TITLE>
+</HEAD>
+<BODY>
+EOT
+}
+
+sub print_toplevel_header {
+ local($_);
+
+ &print_header; # pass given arg...
+ print FILE $full_title;
+ if ($value{'_subtitle'}) {
+ $value{'_subtitle'} =~ s/\n+$//;
+ foreach (split(/\n/, $value{'_subtitle'})) {
+ $_ = &substitute_style($_);
+ &unprotect_texi;
+ print FILE "<H2>$_</H2>\n";
+ }
+ }
+ if ($value{'_author'}) {
+ $value{'_author'} =~ s/\n+$//;
+ foreach (split(/\n/, $value{'_author'})) {
+ $_ = &substitute_style($_);
+ &unprotect_texi;
+ s/[\w.-]+\@[\w.-]+/<A HREF="mailto:$&">$&<\/A>/g;
+ print FILE "<ADDRESS>$_</ADDRESS>\n";
+ }
+ }
+ print FILE "<P>\n";
+}
+
+sub print_footer {
+ print FILE <<EOT;
+</BODY>
+</HTML>
+EOT
+}
+
+sub print_toplevel_footer {
+ &print_ruler;
+ print FILE <<EOT;
+This document was generated on $TODAY using the
+<A HREF=\"$HOMEPAGE\">texi2html</A>
+translator version 1.51.</P>
+EOT
+ &print_footer;
+}
+
+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;
+ # 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_html {
+ local($what) = @_;
+ $what =~ s/\&\#38;/\&/g;
+ $what =~ s/\&\#60;/\</g;
+ $what =~ s/\&\#62;/\>/g;
+ return($what);
+}
+
+sub byalpha {
+ $key2alpha{$a} cmp $key2alpha{$b};
+}
+
+##############################################################################
+
+ # 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 ############
+.TH TEXI2HTML 1 "09/10/96"
+.AT 3
+.SH NAME
+texi2html \- a Texinfo to HTML converter
+.SH SYNOPSIS
+.B texi2html [options] file
+.PP
+.B texi2html -check [-verbose] files
+.SH DESCRIPTION
+.I Texi2html
+converts the given Texinfo file to a set of HTML files. It tries to handle
+most of the Texinfo commands. It creates hypertext links for cross-references,
+footnotes...
+.PP
+It also tries to add links from a reference to its corresponding entry in the
+bibliography (if any). It may also handle a glossary (see the
+.B \-glossary
+option).
+.PP
+.I Texi2html
+creates several files depending on the contents of the Texinfo file and on
+the chosen options (see FILES).
+.PP
+The HTML files created by
+.I texi2html
+are closer to TeX than to Info, that's why
+.I texi2html
+converts @iftex sections and not @ifinfo ones by default. You can reverse
+this with the \-expandinfo option.
+.SH OPTIONS
+.TP 12
+.B \-check
+Check the given file and give the list of all things that may be Texinfo commands.
+This may be used to check the output of
+.I texi2html
+to find the Texinfo commands that have been left in the HTML file.
+.TP
+.B \-expandinfo
+Expand @ifinfo sections, not @iftex ones.
+.TP
+.B \-glossary
+Use the section named 'Glossary' to build a list of terms and put links in the HTML
+document from each term toward its definition.
+.TP
+.B \-invisible \fIname\fP
+Use \fIname\fP to create invisible destination anchors for index links. This is a workaround
+for a known bug of many WWW browsers, including xmosaic.
+.TP
+.B \-I \fIdir\fP
+Look also in \fIdir\fP to find included files.
+.TP
+.B \-menu
+Show the Texinfo menus; by default they are ignored.
+.TP
+.B \-monolithic
+Output only one file, including the table of contents and footnotes.
+.TP
+.B \-number
+Number the sections.
+.TP
+.B \-split_chapter
+Split the output into several HTML files (one per main section:
+chapter, appendix...).
+.TP
+.B \-split_node
+Split the output into several HTML files (one per node).
+.TP
+.B \-usage
+Print usage instructions, listing the current available command-line options.
+.TP
+.B \-verbose
+Give a verbose output. Can be used with the
+.B \-check
+option.
+.PP
+.SH FILES
+By default
+.I texi2html
+creates the following files (foo being the name of the Texinfo file):
+.TP 16
+.B foo_toc.html
+The table of contents.
+.TP
+.B foo.html
+The document's contents.
+.TP
+.B foo_foot.html
+The footnotes (if any).
+.PP
+When used with the
+.B \-split
+option, it creates several files (one per chapter or node), named
+.B foo_n.html
+(n being the indice of the chapter or node), instead of the single
+.B foo.html
+file.
+.PP
+When used with the
+.B \-monolithic
+option, it creates only one file:
+.B foo.html
+.SH VARIABLES
+.I texi2html
+predefines the following variables: \fBhtml\fP, \fBtexi2html\fP.
+.SH ADDITIONAL COMMANDS
+.I texi2html
+implements the following non-Texinfo commands:
+.TP 16
+.B @ifhtml
+This indicates the start of an HTML section, this section will passed through
+without any modofication.
+.TP
+.B @end ifhtml
+This indcates the end of an HTML section.
+.SH VERSION
+This is \fItexi2html\fP version 1.51, 09/10/96.
+.PP
+The latest version of \fItexi2html\fP can be found in WWW, cf. URL
+http://wwwcn.cern.ch/dci/texi2html/
+.SH AUTHOR
+The main author is Lionel Cons, CERN CN/DCI/UWS, Lionel.Cons@cern.ch.
+Many other people around the net contributed to this program.
+.SH COPYRIGHT
+This program is the intellectual property of the European
+Laboratory for Particle Physics (known as CERN). No guarantee whatsoever is
+provided by CERN. No liability whatsoever is accepted for any loss or damage
+of any kind resulting from any defect or inaccuracy in this information or
+code.
+.PP
+CERN, 1211 Geneva 23, Switzerland
+.SH "SEE ALSO"
+GNU Texinfo Documentation Format,
+HyperText Markup Language (HTML),
+World Wide Web (WWW).
+.SH BUGS
+This program does not understand all Texinfo commands (yet).
+.PP
+TeX specific commands (normally enclosed in @iftex) will be
+passed unmodified.
+.ex
diff --git a/support/zecho.c b/support/zecho.c
new file mode 100644
index 0000000..151fac3
--- /dev/null
+++ b/support/zecho.c
@@ -0,0 +1,20 @@
+/* zecho - bare-bones echo */
+
+#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);
+}