merge the autotools branch
authorStas Sergeev <stsp@aknet.ru>
Wed, 13 Sep 2006 17:20:32 +0000 (17:20 +0000)
committerStas Sergeev <stsp@aknet.ru>
Wed, 13 Sep 2006 17:20:32 +0000 (17:20 +0000)
109 files changed:
ABOUT-NLS [new file with mode: 0644]
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
ChangeLog.old [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile [deleted file]
Makefile.am [new file with mode: 0644]
Makefile.in [new file with mode: 0644]
NEWS [new file with mode: 0644]
README
TODO
aclocal.m4 [new file with mode: 0644]
ai.c [deleted file]
autogen.sh [new file with mode: 0755]
battle.c [deleted file]
compile [new file with mode: 0755]
config.guess [new file with mode: 0755]
config.rpath [new file with mode: 0755]
config.sub [new file with mode: 0755]
configure [new file with mode: 0755]
configure.ac [new file with mode: 0644]
depcomp [new file with mode: 0755]
doc/Makefile.am [new file with mode: 0644]
doc/Makefile.in [new file with mode: 0644]
doc/makehelp.py [new file with mode: 0755]
doc/sst-doc.xml [new file with mode: 0644]
doc/sst-layer.xsl [new file with mode: 0644]
doc/sst.xml [new file with mode: 0644]
events.c [deleted file]
finish.c [deleted file]
install-sh [new file with mode: 0755]
io.c [deleted file]
m4/ChangeLog [new file with mode: 0644]
m4/codeset.m4 [new file with mode: 0644]
m4/gettext.m4 [new file with mode: 0644]
m4/glibc2.m4 [new file with mode: 0644]
m4/glibc21.m4 [new file with mode: 0644]
m4/iconv.m4 [new file with mode: 0644]
m4/intdiv0.m4 [new file with mode: 0644]
m4/intmax.m4 [new file with mode: 0644]
m4/inttypes-pri.m4 [new file with mode: 0644]
m4/inttypes.m4 [new file with mode: 0644]
m4/inttypes_h.m4 [new file with mode: 0644]
m4/isc-posix.m4 [new file with mode: 0644]
m4/lcmessage.m4 [new file with mode: 0644]
m4/lib-ld.m4 [new file with mode: 0644]
m4/lib-link.m4 [new file with mode: 0644]
m4/lib-prefix.m4 [new file with mode: 0644]
m4/longdouble.m4 [new file with mode: 0644]
m4/longlong.m4 [new file with mode: 0644]
m4/nls.m4 [new file with mode: 0644]
m4/po.m4 [new file with mode: 0644]
m4/printf-posix.m4 [new file with mode: 0644]
m4/progtest.m4 [new file with mode: 0644]
m4/signed.m4 [new file with mode: 0644]
m4/size_max.m4 [new file with mode: 0644]
m4/stdint_h.m4 [new file with mode: 0644]
m4/uintmax_t.m4 [new file with mode: 0644]
m4/ulonglong.m4 [new file with mode: 0644]
m4/wchar_t.m4 [new file with mode: 0644]
m4/wint_t.m4 [new file with mode: 0644]
m4/xsize.m4 [new file with mode: 0644]
makehelp.py [deleted file]
missing [new file with mode: 0755]
mkinstalldirs [new file with mode: 0755]
moving.c [deleted file]
planets.c [deleted file]
po/ChangeLog [new file with mode: 0644]
po/Makefile [new file with mode: 0644]
po/Makefile.in [new file with mode: 0644]
po/Makefile.in.in [new file with mode: 0644]
po/Makevars [new file with mode: 0644]
po/Makevars.template [new file with mode: 0644]
po/POTFILES [new file with mode: 0644]
po/POTFILES.in [new file with mode: 0644]
po/Rules-quot [new file with mode: 0644]
po/boldquot.sed [new file with mode: 0644]
po/en@boldquot.header [new file with mode: 0644]
po/en@quot.header [new file with mode: 0644]
po/insert-header.sin [new file with mode: 0644]
po/quot.sed [new file with mode: 0644]
po/remove-potcdate.sed [new file with mode: 0644]
po/remove-potcdate.sin [new file with mode: 0644]
reports.c [deleted file]
setup.c [deleted file]
src/Makefile.am [new file with mode: 0644]
src/Makefile.in [new file with mode: 0644]
src/ai.c [new file with mode: 0644]
src/battle.c [new file with mode: 0644]
src/config.h.in [new file with mode: 0644]
src/events.c [new file with mode: 0644]
src/finish.c [new file with mode: 0644]
src/io.c [new file with mode: 0644]
src/moving.c [new file with mode: 0644]
src/planets.c [new file with mode: 0644]
src/reports.c [new file with mode: 0644]
src/setup.c [new file with mode: 0644]
src/sst.c [new file with mode: 0644]
src/sst.h [new file with mode: 0644]
src/sstlinux.c [new file with mode: 0644]
src/sstlinux.h [new file with mode: 0644]
sst-doc.xml [deleted file]
sst-layer.xsl [deleted file]
sst.c [deleted file]
sst.h [deleted file]
sst.xml [deleted file]
sstlinux.c [deleted file]
sstlinux.h [deleted file]

diff --git a/ABOUT-NLS b/ABOUT-NLS
new file mode 100644 (file)
index 0000000..e32d52d
--- /dev/null
+++ b/ABOUT-NLS
@@ -0,0 +1,996 @@
+1 Notes on the Free Translation Project
+***************************************
+
+Free software is going international!  The Free Translation Project is
+a way to get maintainers of free software, translators, and users all
+together, so that free software will gradually become able to speak many
+languages.  A few packages already provide translations for their
+messages.
+
+   If you found this `ABOUT-NLS' file inside a distribution, you may
+assume that the distributed package does use GNU `gettext' internally,
+itself available at your nearest GNU archive site.  But you do _not_
+need to install GNU `gettext' prior to configuring, installing or using
+this package with messages translated.
+
+   Installers will find here some useful hints.  These notes also
+explain how users should proceed for getting the programs to use the
+available translations.  They tell how people wanting to contribute and
+work on translations can contact the appropriate team.
+
+   When reporting bugs in the `intl/' directory or bugs which may be
+related to internationalization, you should tell about the version of
+`gettext' which is used.  The information can be found in the
+`intl/VERSION' file, in internationalized packages.
+
+1.1 Quick configuration advice
+==============================
+
+If you want to exploit the full power of internationalization, you
+should configure it using
+
+     ./configure --with-included-gettext
+
+to force usage of internationalizing routines provided within this
+package, despite the existence of internationalizing capabilities in the
+operating system where this package is being installed.  So far, only
+the `gettext' implementation in the GNU C library version 2 provides as
+many features (such as locale alias, message inheritance, automatic
+charset conversion or plural form handling) as the implementation here.
+It is also not possible to offer this additional functionality on top
+of a `catgets' implementation.  Future versions of GNU `gettext' will
+very likely convey even more functionality.  So it might be a good idea
+to change to GNU `gettext' as soon as possible.
+
+   So you need _not_ provide this option if you are using GNU libc 2 or
+you have installed a recent copy of the GNU gettext package with the
+included `libintl'.
+
+1.2 INSTALL Matters
+===================
+
+Some packages are "localizable" when properly installed; the programs
+they contain can be made to speak your own native language.  Most such
+packages use GNU `gettext'.  Other packages have their own ways to
+internationalization, predating GNU `gettext'.
+
+   By default, this package will be installed to allow translation of
+messages.  It will automatically detect whether the system already
+provides the GNU `gettext' functions.  If not, the included GNU
+`gettext' library will be used.  This library is wholly contained
+within this package, usually in the `intl/' subdirectory, so prior
+installation of the GNU `gettext' package is _not_ required.
+Installers may use special options at configuration time for changing
+the default behaviour.  The commands:
+
+     ./configure --with-included-gettext
+     ./configure --disable-nls
+
+will, respectively, bypass any pre-existing `gettext' to use the
+internationalizing routines provided within this package, or else,
+_totally_ disable translation of messages.
+
+   When you already have GNU `gettext' installed on your system and run
+configure without an option for your new package, `configure' will
+probably detect the previously built and installed `libintl.a' file and
+will decide to use this.  This might not be desirable.  You should use
+the more recent version of the GNU `gettext' library.  I.e. if the file
+`intl/VERSION' shows that the library which comes with this package is
+more recent, you should use
+
+     ./configure --with-included-gettext
+
+to prevent auto-detection.
+
+   The configuration process will not test for the `catgets' function
+and therefore it will not be used.  The reason is that even an
+emulation of `gettext' on top of `catgets' could not provide all the
+extensions of the GNU `gettext' library.
+
+   Internationalized packages usually have many `po/LL.po' files, where
+LL gives an ISO 639 two-letter code identifying the language.  Unless
+translations have been forbidden at `configure' time by using the
+`--disable-nls' switch, all available translations are installed
+together with the package.  However, the environment variable `LINGUAS'
+may be set, prior to configuration, to limit the installed set.
+`LINGUAS' should then contain a space separated list of two-letter
+codes, stating which languages are allowed.
+
+1.3 Using This Package
+======================
+
+As a user, if your language has been installed for this package, you
+only have to set the `LANG' environment variable to the appropriate
+`LL_CC' combination.  Here `LL' is an ISO 639 two-letter language code,
+and `CC' is an ISO 3166 two-letter country code.  For example, let's
+suppose that you speak German and live in Germany.  At the shell
+prompt, merely execute `setenv LANG de_DE' (in `csh'),
+`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash').
+This can be done from your `.login' or `.profile' file, once and for
+all.
+
+   You might think that the country code specification is redundant.
+But in fact, some languages have dialects in different countries.  For
+example, `de_AT' is used for Austria, and `pt_BR' for Brazil.  The
+country code serves to distinguish the dialects.
+
+   The locale naming convention of `LL_CC', with `LL' denoting the
+language and `CC' denoting the country, is the one use on systems based
+on GNU libc.  On other systems, some variations of this scheme are
+used, such as `LL' or `LL_CC.ENCODING'.  You can get the list of
+locales supported by your system for your country by running the command
+`locale -a | grep '^LL''.
+
+   Not all programs have translations for all languages.  By default, an
+English message is shown in place of a nonexistent translation.  If you
+understand other languages, you can set up a priority list of languages.
+This is done through a different environment variable, called
+`LANGUAGE'.  GNU `gettext' gives preference to `LANGUAGE' over `LANG'
+for the purpose of message handling, but you still need to have `LANG'
+set to the primary language; this is required by other parts of the
+system libraries.  For example, some Swedish users who would rather
+read translations in German than English for when Swedish is not
+available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'.
+
+   Special advice for Norwegian users: The language code for Norwegian
+bokma*l changed from `no' to `nb' recently (in 2003).  During the
+transition period, while some message catalogs for this language are
+installed under `nb' and some older ones under `no', it's recommended
+for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and
+older translations are used.
+
+   In the `LANGUAGE' environment variable, but not in the `LANG'
+environment variable, `LL_CC' combinations can be abbreviated as `LL'
+to denote the language's main dialect.  For example, `de' is equivalent
+to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT'
+(Portuguese as spoken in Portugal) in this context.
+
+1.4 Translating Teams
+=====================
+
+For the Free Translation Project to be a success, we need interested
+people who like their own language and write it well, and who are also
+able to synergize with other translators speaking the same language.
+Each translation team has its own mailing list.  The up-to-date list of
+teams can be found at the Free Translation Project's homepage,
+`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams"
+area.
+
+   If you'd like to volunteer to _work_ at translating messages, you
+should become a member of the translating team for your own language.
+The subscribing address is _not_ the same as the list itself, it has
+`-request' appended.  For example, speakers of Swedish can send a
+message to `sv-request@li.org', having this message body:
+
+     subscribe
+
+   Keep in mind that team members are expected to participate
+_actively_ in translations, or at solving translational difficulties,
+rather than merely lurking around.  If your team does not exist yet and
+you want to start one, or if you are unsure about what to do or how to
+get started, please write to `translation@iro.umontreal.ca' to reach the
+coordinator for all translator teams.
+
+   The English team is special.  It works at improving and uniformizing
+the terminology in use.  Proven linguistic skill are praised more than
+programming skill, here.
+
+1.5 Available Packages
+======================
+
+Languages are not equally supported in all packages.  The following
+matrix shows the current state of internationalization, as of May 2005.
+The matrix shows, in regard of each package, for which languages PO
+files have been submitted to translation coordination, with a
+translation percentage of at least 50%.
+
+     Ready PO files       af am ar az be bg bs ca cs cy da de el en en_GB
+                        +-------------------------------------------------+
+     GNUnet             |                                                 |
+     a2ps               |             []                [] [] []     []   |
+     aegis              |                                  ()             |
+     ant-phone          |                                  ()             |
+     anubis             |                                  []             |
+     ap-utils           |                                                 |
+     aspell             |                         []    [] []        []   |
+     bash               |                      []          []             |
+     batchelor          |                                  []             |
+     bfd                |                                                 |
+     bibshelf           |                                  []             |
+     binutils           |                               []                |
+     bison              |                               [] []             |
+     bluez-pin          | []                      []       [] []          |
+     clisp              |                                  []    []       |
+     console-tools      |                         []       []             |
+     coreutils          |                []    []       [] []             |
+     cpio               |                                                 |
+     cpplib             |                      []       [] []             |
+     darkstat           |                []             () []             |
+     dialog             |                      [] [] [] [] [] []          |
+     diffutils          |                      [] []    [] [] []          |
+     doodle             |                                  []             |
+     e2fsprogs          |                         []       []             |
+     enscript           |                      []       [] []        []   |
+     error              |                      []       [] []        []   |
+     fetchmail          |                      []       [] () []          |
+     fileutils          |                               [] []             |
+     findutils          |                      []       []    []          |
+     flex               |                      []       [] []             |
+     fslint             |                                  []             |
+     gas                |                                                 |
+     gawk               |                      []       [] []             |
+     gbiff              |                                  []             |
+     gcal               |                      []                         |
+     gcc                |                                  []             |
+     gettext-examples   | []                   []          [] []          |
+     gettext-runtime    |             []       []       [] []             |
+     gettext-tools      |                      []          []             |
+     gimp-print         |                         []    [] []        []   |
+     gip                |                                                 |
+     gliv               |                                  []             |
+     glunarclock        |                                                 |
+     gmult              | []                               []             |
+     gnubiff            |                                  ()             |
+     gnucash            |                         []       () ()     []   |
+     gnucash-glossary   |                               [] ()             |
+     gpe-aerial         |                         []       []             |
+     gpe-beam           |                         []       []             |
+     gpe-calendar       |                         []       []             |
+     gpe-clock          |                         []       []             |
+     gpe-conf           |                         []       []             |
+     gpe-contacts       |                                                 |
+     gpe-edit           |                         []                      |
+     gpe-go             |                         []                      |
+     gpe-login          |                         []       []             |
+     gpe-ownerinfo      |                         []       []             |
+     gpe-sketchbook     |                         []       []             |
+     gpe-su             |                         []       []             |
+     gpe-taskmanager    |                         []       []             |
+     gpe-timesheet      |                         []                      |
+     gpe-today          |                         []       []             |
+     gpe-todo           |                         []       []             |
+     gphoto2            |                         []    [] []        []   |
+     gprof              |                               [] []             |
+     gpsdrive           |                                  ()    ()       |
+     gramadoir          | []                               []             |
+     grep               | []          [] []    []          [] []          |
+     gretl              |                                                 |
+     gsasl              |                                  []             |
+     gss                |                                                 |
+     gst-plugins        | []       []          [] []       []        []   |
+     gstreamer          | []                   [] []       []        []   |
+     gtick              | []                               ()             |
+     gtkspell           |             []                   [] []          |
+     hello              |                      []       [] [] []          |
+     id-utils           |                               [] []             |
+     impost             |                                                 |
+     indent             |                      []          []             |
+     iso_3166           |                                                 |
+     iso_3166_1         |                      [] []    [] [] []          |
+     iso_3166_2         |                                                 |
+     iso_3166_3         |                                  []             |
+     iso_4217           |                                                 |
+     iso_639            |                                                 |
+     jpilot             |                         []                      |
+     jtag               |                                                 |
+     jwhois             |                                                 |
+     kbd                |                         []    [] [] []          |
+     latrine            |                                  ()             |
+     ld                 |                               []                |
+     libc               |                      [] []    [] [] []          |
+     libextractor       |                                                 |
+     libgpewidget       |                         []    [] []             |
+     libgphoto2         |                                  []             |
+     libgphoto2_port    |                                  []             |
+     libgsasl           |                                                 |
+     libiconv           | []                   []       [] [] []          |
+     libidn             |                                                 |
+     lifelines          |                               [] ()             |
+     lilypond           |                                  []             |
+     lingoteach         |                                                 |
+     lynx               |                      [] []    [] []             |
+     m4                 |                         []    [] [] []          |
+     mailutils          |                      []                         |
+     make               |                               [] []             |
+     man-db             |                      [] ()    [] []             |
+     minicom            |                         []       []             |
+     mysecretdiary      |                               [] []             |
+     nano               |                      [] ()       []             |
+     nano_1_0           |                      [] ()    [] []             |
+     opcodes            |                                  []             |
+     parted             |                      [] []    [] []             |
+     psmisc             |                                                 |
+     ptx                |                      []       [] []             |
+     pwdutils           |                                                 |
+     python             |                                                 |
+     radius             |                      []                         |
+     recode             |             []       []       [] [] []          |
+     rpm                |                         []    []                |
+     screem             |                                                 |
+     scrollkeeper       |          [] []       [] [] [] [] []        []   |
+     sed                |                      []          []             |
+     sh-utils           |                               [] []             |
+     shared-mime-info   |                []       []                      |
+     sharutils          |                      [] []    [] [] []          |
+     silky              |                                                 |
+     skencil            |                               [] ()             |
+     sketch             |                               [] ()             |
+     solfege            |                                  []             |
+     soundtracker       |                               [] []             |
+     sp                 |                                  []             |
+     stardict           |                         []                      |
+     tar                |                                                 |
+     texinfo            |                               [] []             |
+     textutils          |                      []       [] []             |
+     tin                |                                  ()        ()   |
+     tp-robot           |                                  []             |
+     tuxpaint           | []                   [] []    [] [] []     []   |
+     unicode-han-tra... |                                                 |
+     unicode-transla... |                                                 |
+     util-linux         |                      [] []    [] []             |
+     vorbis-tools       |             []          []    []           []   |
+     wastesedge         |                                  ()             |
+     wdiff              |                      []       [] []        []   |
+     wget               |                                                 |
+     xchat              |                []    []          [] []     []   |
+     xkeyboard-config   |                                                 |
+     xpad               |                                                 |
+                        +-------------------------------------------------+
+                          af am ar az be bg bs ca cs cy da de el en en_GB
+                          10  0  0  2  7  5  0 40 43  2 51 91 19  1  14
+
+                          eo es et eu fa fi fr  ga gl he hi hr hu id is
+                        +-----------------------------------------------+
+     GNUnet             |                                               |
+     a2ps               |       []       [] []                          |
+     aegis              |                                               |
+     ant-phone          |                   []                          |
+     anubis             |                   []                          |
+     ap-utils           |                   []                          |
+     aspell             |                   []  []                      |
+     bash               | [] []             []                 []       |
+     batchelor          |                   []  []                      |
+     bfd                |    []                                         |
+     bibshelf           |    []                 []                      |
+     binutils           |    []             []                          |
+     bison              |    [] []          []  []                []    |
+     bluez-pin          | []             [] []  []             [] []    |
+     clisp              |    []             []                          |
+     console-tools      |                                               |
+     coreutils          |    [] []       [] []  []                      |
+     cpio               |    []             []                          |
+     cpplib             |    []             []                          |
+     darkstat           |    []             ()  []             [] []    |
+     dialog             |    [] [] []    [] []  []             []       |
+     diffutils          | [] []          [] []  [] [] []       [] []    |
+     doodle             |                       []                      |
+     e2fsprogs          |    []             []                          |
+     enscript           |                   []              []          |
+     error              |    []          [] []  []             []       |
+     fetchmail          |    []                                         |
+     fileutils          |    [] []          []  []             []       |
+     findutils          |    [] []          []  []                      |
+     flex               |    []             []  []                      |
+     fslint             |                   []                          |
+     gas                |    []             []                          |
+     gawk               |    []             []  []    []                |
+     gbiff              |                   []                          |
+     gcal               |    []             []                          |
+     gcc                |    []                                         |
+     gettext-examples   |    []             []  []                      |
+     gettext-runtime    |    []          [] []  []                []    |
+     gettext-tools      |    []             []                          |
+     gimp-print         |    []             []                          |
+     gip                |    []    []       []                          |
+     gliv               |                   ()                          |
+     glunarclock        |                []     []             []       |
+     gmult              |          []       []                          |
+     gnubiff            |                   ()                          |
+     gnucash            |    []                                ()       |
+     gnucash-glossary   |    []                                         |
+     gpe-aerial         |    []             []                          |
+     gpe-beam           |    []             []                          |
+     gpe-calendar       |    []             []                 [] []    |
+     gpe-clock          |    []          [] []                          |
+     gpe-conf           |                   []                          |
+     gpe-contacts       |                   []                          |
+     gpe-edit           |                   []                    []    |
+     gpe-go             |    []             []                          |
+     gpe-login          |    []             []                 []       |
+     gpe-ownerinfo      |    []          [] []                 [] []    |
+     gpe-sketchbook     |    []             []                          |
+     gpe-su             |    []          [] []                          |
+     gpe-taskmanager    |    []          [] []                          |
+     gpe-timesheet      |    []             []  []                []    |
+     gpe-today          |    []          [] []  []                      |
+     gpe-todo           |    []             []                    []    |
+     gphoto2            |    []          [] []                 []       |
+     gprof              |    []             []                    []    |
+     gpsdrive           |    ()             ()                 []       |
+     gramadoir          |                   []  []                      |
+     grep               |    [] [] []    [] []  [] [] []    [] [] []    |
+     gretl              |    []             []                          |
+     gsasl              |          []       []  []                      |
+     gss                |                   []                          |
+     gst-plugins        |                   []                 []       |
+     gstreamer          |                                               |
+     gtick              |          []    [] []  []                      |
+     gtkspell           | [] []    []       []  []                      |
+     hello              | [] [] [] [] [] [] []  [] [] []    [] [] []    |
+     id-utils           |                   []                 [] []    |
+     impost             |                   []  []                      |
+     indent             | [] [] [] []    [] []  [] []          [] []    |
+     iso_3166           | []             [] []                          |
+     iso_3166_1         |    []    []    [] []  []             [] []    |
+     iso_3166_2         |                   []                          |
+     iso_3166_3         |                   []                          |
+     iso_4217           |       []       []        []                   |
+     iso_639            | []          [] [] []                          |
+     jpilot             |    []             []                          |
+     jtag               |                   []                          |
+     jwhois             |    []             []                 [] []    |
+     kbd                |    []             []                          |
+     latrine            |                   []  []                      |
+     ld                 |    []             []                          |
+     libc               |    []          [] []     []          []       |
+     libextractor       |                                               |
+     libgpewidget       |    []             []  []             [] []    |
+     libgphoto2         |    []             []                 []       |
+     libgphoto2_port    |                   []                          |
+     libgsasl           |                   []  []                      |
+     libiconv           | [] [] []       [] []  [] []       [] [] []    |
+     libidn             | []                []                          |
+     lifelines          |                   ()                          |
+     lilypond           |                                               |
+     lingoteach         |                   []                    []    |
+     lynx               |       []                             []       |
+     m4                 |                   []  [] []             []    |
+     mailutils          |    []             []                          |
+     make               |    []          [] []  [] [] []    []          |
+     man-db             |    ()                                         |
+     minicom            |    []          [] []                 []       |
+     mysecretdiary      |    []             []                    []    |
+     nano               |    []    []    () []                          |
+     nano_1_0           |    []             []     []             []    |
+     opcodes            |    []          [] []                          |
+     parted             |    []             []     []                   |
+     psmisc             |          []                                   |
+     ptx                | [] [] []       [] []  [] []          [] []    |
+     pwdutils           |                                               |
+     python             |                                               |
+     radius             |    []             []                          |
+     recode             | [] []             []     [] []       [] []    |
+     rpm                |                   []                          |
+     screem             |                                               |
+     scrollkeeper       |    []          []                    []       |
+     sed                | [] [] []          []  []             []       |
+     sh-utils           |    [] []       [] []  []             []       |
+     shared-mime-info   | [] []    []    [] []                 []       |
+     sharutils          |    [] []       [] []     []          []       |
+     silky              |                   []                          |
+     skencil            |    []             []                          |
+     sketch             |    []             []                          |
+     solfege            |                                               |
+     soundtracker       |    []             []                          |
+     sp                 |                   []                          |
+     stardict           |                                      []       |
+     tar                |    [] []          []  []                      |
+     texinfo            | []                []        []                |
+     textutils          |    []             []  [] []          []       |
+     tin                |       []          ()                          |
+     tp-robot           |                   []                 []       |
+     tuxpaint           |    []          [] []  []    []       [] [] [] |
+     unicode-han-tra... |                                               |
+     unicode-transla... |                   []  []                      |
+     util-linux         |    [] []       [] []                 []       |
+     vorbis-tools       |    []             []                          |
+     wastesedge         |                   ()                          |
+     wdiff              |    [] []          []  [] []          [] []    |
+     wget               |       [] []           []          []          |
+     xchat              |    []    []    [] []           []             |
+     xkeyboard-config   |                                               |
+     xpad               |    []                 []             []       |
+                        +-----------------------------------------------+
+                          eo es et eu fa fi fr  ga gl he hi hr hu id is
+                          15 85 21 15  2 35 115 45 16  8  1  6 40 27  1
+
+                          it ja ko ku lg lt lv mk mn ms mt nb nl nn no nso
+                        +--------------------------------------------------+
+     GNUnet             |                                                  |
+     a2ps               | ()    ()                   []       []    ()     |
+     aegis              |                                     ()           |
+     ant-phone          |                                     []           |
+     anubis             |                            []    [] []           |
+     ap-utils           |                                                  |
+     aspell             |                         []          []           |
+     bash               |                                     []           |
+     batchelor          |                                     []           |
+     bfd                |                                                  |
+     bibshelf           | []                                               |
+     binutils           |                                                  |
+     bison              | []                         []    [] []           |
+     bluez-pin          |          []                         []           |
+     clisp              |                                     []           |
+     console-tools      |                                                  |
+     coreutils          |    []                               []           |
+     cpio               |                                                  |
+     cpplib             |                                     []           |
+     darkstat           |                            []       []           |
+     dialog             | []                                  []           |
+     diffutils          | [] []                      []       []           |
+     doodle             | []                                               |
+     e2fsprogs          | []                                               |
+     enscript           |                                     []           |
+     error              |                                     []           |
+     fetchmail          |    []                               []           |
+     fileutils          | [] []       []                                   |
+     findutils          | []                                  []           |
+     flex               |       []                            []           |
+     fslint             |                                     []           |
+     gas                |                                                  |
+     gawk               |    []                               []           |
+     gbiff              |                                     []           |
+     gcal               |                                                  |
+     gcc                |                                                  |
+     gettext-examples   | [] []                               []           |
+     gettext-runtime    | [] [] []                            []           |
+     gettext-tools      | [] [] []                                         |
+     gimp-print         |    []                               []           |
+     gip                |                                     []           |
+     gliv               |                                     []           |
+     glunarclock        |                            []       []           |
+     gmult              | [] []                                            |
+     gnubiff            | ()                                               |
+     gnucash            | [] ()                            () []           |
+     gnucash-glossary   | []                                  []           |
+     gpe-aerial         |                                     []           |
+     gpe-beam           |                                     []           |
+     gpe-calendar       |                                     []           |
+     gpe-clock          |                                     []           |
+     gpe-conf           |                                     []           |
+     gpe-contacts       |                                                  |
+     gpe-edit           |                                     []           |
+     gpe-go             |                                     []           |
+     gpe-login          |                                     []           |
+     gpe-ownerinfo      |                                     []           |
+     gpe-sketchbook     |                                     []           |
+     gpe-su             |                                     []           |
+     gpe-taskmanager    |          []                         []           |
+     gpe-timesheet      |                                     []           |
+     gpe-today          |                                     []           |
+     gpe-todo           |                                     []           |
+     gphoto2            | [] []                               []           |
+     gprof              |                                                  |
+     gpsdrive           | () ()                               ()    ()     |
+     gramadoir          |                                     ()           |
+     grep               | [] []                            [] []           |
+     gretl              | []                                               |
+     gsasl              |                                     []           |
+     gss                |                                                  |
+     gst-plugins        | []                                  []           |
+     gstreamer          | []                                  []           |
+     gtick              | []                                  []           |
+     gtkspell           | []                      []          []           |
+     hello              | [] [] []          []       []    [] [] [] []     |
+     id-utils           | []                                  []           |
+     impost             |                                                  |
+     indent             | [] []                               []           |
+     iso_3166           |                                     []           |
+     iso_3166_1         |                                     []    []     |
+     iso_3166_2         |                                     []           |
+     iso_3166_3         |                                     []           |
+     iso_4217           |    []                   []          []           |
+     iso_639            |    []                               [] []        |
+     jpilot             |    ()                               ()    ()     |
+     jtag               |                                                  |
+     jwhois             | []                                  []           |
+     kbd                |                                     []           |
+     latrine            | []                                  []           |
+     ld                 |                                                  |
+     libc               |    [] []                         [] []    []     |
+     libextractor       |                                                  |
+     libgpewidget       |                                     []           |
+     libgphoto2         | [] []                                            |
+     libgphoto2_port    | [] []                                            |
+     libgsasl           |                                     []           |
+     libiconv           | []                                  []           |
+     libidn             | []                                               |
+     lifelines          |                                     []           |
+     lilypond           |                                                  |
+     lingoteach         | []                                  []           |
+     lynx               | [] []                               []           |
+     m4                 |    []                               []           |
+     mailutils          |                                                  |
+     make               |    [] []                            []           |
+     man-db             |    ()                                            |
+     minicom            |    []                                            |
+     mysecretdiary      |                                     []           |
+     nano               | []                         []    []              |
+     nano_1_0           | []                         []    []    []        |
+     opcodes            |                                     []           |
+     parted             | [] []                               [] []        |
+     psmisc             | []                               [] []           |
+     ptx                |                                  [] []    []     |
+     pwdutils           |                                                  |
+     python             |                                                  |
+     radius             |                                                  |
+     recode             | []                                  []           |
+     rpm                |    [] []                                         |
+     screem             |    []                                            |
+     scrollkeeper       |                                  [] [] []        |
+     sed                |    []                               []           |
+     sh-utils           | [] []                            []              |
+     shared-mime-info   |       []                         [] [] []        |
+     sharutils          | [] []                               []           |
+     silky              |                                     []           |
+     skencil            |                                                  |
+     sketch             |                                                  |
+     solfege            | []                                  []    []     |
+     soundtracker       | []                                               |
+     sp                 |    ()                                            |
+     stardict           |                      []             []           |
+     tar                | [] []                               []           |
+     texinfo            |    []                            [] []           |
+     textutils          |    [] []                         []              |
+     tin                |                                                  |
+     tp-robot           |                                     []           |
+     tuxpaint           | [] [] []       []          []       [] []        |
+     unicode-han-tra... |                                                  |
+     unicode-transla... |                                                  |
+     util-linux         | [] []                               []           |
+     vorbis-tools       |                                     []           |
+     wastesedge         |                                     []           |
+     wdiff              | []                         []    []              |
+     wget               |    []                                            |
+     xchat              | []    []          [] []             []           |
+     xkeyboard-config   |                                     []           |
+     xpad               |                                     []           |
+                        +--------------------------------------------------+
+                          it ja ko ku lg lt lv mk mn ms mt nb nl nn no nso
+                          46 35 11  2  1  1  2  2  3 11  0 15 96  7  5  0
+
+                          or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv
+                        +----------------------------------------------+
+     GNUnet             |                                              |
+     a2ps               |       ()     []      [] []       []    [] [] |
+     aegis              |                      () ()                   |
+     ant-phone          |                      []                      |
+     anubis             |       []             [] []                   |
+     ap-utils           |       ()                                     |
+     aspell             |                      [] []                   |
+     bash               |              []      [] []                   |
+     batchelor          |                      []                      |
+     bfd                |                                              |
+     bibshelf           |                                              |
+     binutils           |                         []                [] |
+     bison              |       []     []      [] []                [] |
+     bluez-pin          |       []     []   [] [] []    []       [] [] |
+     clisp              |                         []                   |
+     console-tools      |                         []                   |
+     coreutils          |       []                []       []       [] |
+     cpio               |       []                                  [] |
+     cpplib             |                                              |
+     darkstat           |       []     []      []       []       [] [] |
+     dialog             |       [] []  []   [] [] [] []                |
+     diffutils          |       []     []      [] []             [] [] |
+     doodle             |                                     []       |
+     e2fsprogs          |       []                                  [] |
+     enscript           |              []      [] []                [] |
+     error              |              []      []       []             |
+     fetchmail          |       []                []    []    []       |
+     fileutils          |       []             [] []       []       [] |
+     findutils          |       [] []          []       []       [] [] |
+     flex               |       []     []      [] []                [] |
+     fslint             |              []      []                []    |
+     gas                |                                              |
+     gawk               |       []     []      []                   [] |
+     gbiff              |                      []                      |
+     gcal               |                                           [] |
+     gcc                |                                              |
+     gettext-examples   |       []             [] []    []       [] [] |
+     gettext-runtime    |       []             [] []    [] []    [] [] |
+     gettext-tools      |       []             [] []    [] []    [] [] |
+     gimp-print         |                               []          [] |
+     gip                |                   []          []       []    |
+     gliv               |              []      []       []             |
+     glunarclock        |              []      [] []    []       [] [] |
+     gmult              |              []   [] []                []    |
+     gnubiff            |                      ()                   [] |
+     gnucash            |       () []             []    []          [] |
+     gnucash-glossary   |          []                   []          [] |
+     gpe-aerial         |          []  []      [] []             [] [] |
+     gpe-beam           |          []  []      [] []             [] [] |
+     gpe-calendar       |          []  []      [] []    []       [] [] |
+     gpe-clock          |          []  []      [] []    []       [] [] |
+     gpe-conf           |          []  []      [] []    []          [] |
+     gpe-contacts       |                      [] []             [] [] |
+     gpe-edit           |          []  []      [] []    []       [] [] |
+     gpe-go             |              []      [] []             [] [] |
+     gpe-login          |          []  []      [] []    []       [] [] |
+     gpe-ownerinfo      |          []  []      [] []    []       [] [] |
+     gpe-sketchbook     |          []  []      [] []    []       [] [] |
+     gpe-su             |          []  []      [] []    []       [] [] |
+     gpe-taskmanager    |          []  []      [] []    []       [] [] |
+     gpe-timesheet      |          []  []      [] []    []       [] [] |
+     gpe-today          |          []  []      [] []    []       [] [] |
+     gpe-todo           |    []    []  []      [] []    []       [] [] |
+     gphoto2            |                      []       []       [] [] |
+     gprof              |              []      []                   [] |
+     gpsdrive           |    []                []                      |
+     gramadoir          |                               []             |
+     grep               |       [] []  []      [] []       []    []    |
+     gretl              |       []                                     |
+     gsasl              |       []             []             [] [] [] |
+     gss                |       []             []                   [] |
+     gst-plugins        | []                                  [] [] [] |
+     gstreamer          |                         []          [] [] [] |
+     gtick              |                      [] []                [] |
+     gtkspell           |              []   [] [] []    []       []    |
+     hello              |       []     []      [] []    []       [] [] |
+     id-utils           |              []      [] []                [] |
+     impost             |                                              |
+     indent             |              []      [] []    []       [] [] |
+     iso_3166           |          []                []       [] [] [] |
+     iso_3166_1         |                               [] [] [] []    |
+     iso_3166_2         |                                              |
+     iso_3166_3         |                      []    []          []    |
+     iso_4217           |                            []          []    |
+     iso_639            |                            []          [] [] |
+     jpilot             |                                              |
+     jtag               |                               []             |
+     jwhois             |       []     []      [] ()                () |
+     kbd                |       []             []                   [] |
+     latrine            |                      []                   [] |
+     ld                 |                                           [] |
+     libc               |       []     []         []    []          [] |
+     libextractor       |                      []                      |
+     libgpewidget       |          []  []      []       []       [] [] |
+     libgphoto2         |                         []                [] |
+     libgphoto2_port    |                         []                   |
+     libgsasl           |       []             []                []    |
+     libiconv           |       []     []   [] [] []    [] [] [] [] [] |
+     libidn             |       []                                  () |
+     lifelines          |       []                                  [] |
+     lilypond           |                                              |
+     lingoteach         |              []                              |
+     lynx               |              []         []                [] |
+     m4                 |       []     []      [] []                [] |
+     mailutils          |       []             [] []                   |
+     make               |       []     []         []                [] |
+     man-db             |                      []                   [] |
+     minicom            |       []     []      [] []                   |
+     mysecretdiary      |              []      [] []                [] |
+     nano               |              []      []                   [] |
+     nano_1_0           |       []             [] []                [] |
+     opcodes            |                      []                   [] |
+     parted             |       [] []  []                           [] |
+     psmisc             |       []             []                      |
+     ptx                |       [] []  []      [] []                [] |
+     pwdutils           |       []                                     |
+     python             |                                              |
+     radius             |       []                []                   |
+     recode             |       []     []      [] []       []       [] |
+     rpm                |       [] []             []                [] |
+     screem             |                                              |
+     scrollkeeper       |       []             [] []    []    [] [] [] |
+     sed                |       [] []  []      [] []    []       [] [] |
+     sh-utils           |                         []       []    []    |
+     shared-mime-info   |          []  []         []          [] [] [] |
+     sharutils          |                         []             [] [] |
+     silky              |                               []             |
+     skencil            |          []  []                           [] |
+     sketch             |          []  []                           [] |
+     solfege            |                                              |
+     soundtracker       |                               []          [] |
+     sp                 |                                              |
+     stardict           |                         []    []             |
+     tar                |       []             [] []                [] |
+     texinfo            |       []             [] []                [] |
+     textutils          |                         []       []       [] |
+     tin                |                                              |
+     tp-robot           |                         []                   |
+     tuxpaint           |       [] []  []      []       []    [] [] [] |
+     unicode-han-tra... |                                              |
+     unicode-transla... |                                              |
+     util-linux         |              []         []                [] |
+     vorbis-tools       |                      [] []                   |
+     wastesedge         |                                              |
+     wdiff              |       []     []      [] []    []          [] |
+     wget               |                                              |
+     xchat              |    []                   []    [] [] [] [] [] |
+     xkeyboard-config   |                                              |
+     xpad               |                                              |
+                        +----------------------------------------------+
+                          or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv
+                           1  3 47 29  57    6 78 73  5 44 12 12 50 85
+
+                          ta tg th tk tr uk ven vi wa xh zh_CN zh_TW zu
+                        +-----------------------------------------------+
+     GNUnet             |                                               |  0
+     a2ps               |             [] []     []                      | 19
+     aegis              |                                               |  0
+     ant-phone          |             []        []                      |  5
+     anubis             |             [] []     []                      | 11
+     ap-utils           |                ()     []                      |  2
+     aspell             |                []     [] []                   | 13
+     bash               |                       []                      | 11
+     batchelor          |             []        []                      |  7
+     bfd                |                                               |  1
+     bibshelf           |                       []                      |  5
+     binutils           |             []                                |  6
+     bison              |             []        []                      | 18
+     bluez-pin          |             [] []     [] []     []            | 25
+     clisp              |                                               |  7
+     console-tools      |             []        []                      |  5
+     coreutils          |             []        []                      | 17
+     cpio               |             [] []     []                      |  7
+     cpplib             |             []        []                      |  8
+     darkstat           |                       []        ()    ()      | 15
+     dialog             |             [] []     []                      | 25
+     diffutils          |             []        []        []    []      | 28
+     doodle             |                       []                      |  5
+     e2fsprogs          |             []                                |  8
+     enscript           |             []                                | 12
+     error              |             []        []              []      | 16
+     fetchmail          |             []                                | 12
+     fileutils          |             []                  []    []      | 18
+     findutils          |             []        []                      | 17
+     flex               |             []        []                      | 15
+     fslint             |                       []                      |  7
+     gas                |             []                                |  3
+     gawk               |             []                                | 14
+     gbiff              |                       []                      |  5
+     gcal               |             []                                |  5
+     gcc                |             []                  []            |  4
+     gettext-examples   |             [] []     []        []    []      | 21
+     gettext-runtime    |             [] []     []        []    []      | 25
+     gettext-tools      |             [] []     []        []    []      | 19
+     gimp-print         |                []                             | 11
+     gip                |                       []                      |  8
+     gliv               |             []        []                      |  7
+     glunarclock        |                       [] []                   | 13
+     gmult              |             []        []        []            | 13
+     gnubiff            |                       []                      |  3
+     gnucash            |             ()                        []      | 10
+     gnucash-glossary   |                       []              []      |  9
+     gpe-aerial         |                       []        []            | 13
+     gpe-beam           |                       []        []            | 13
+     gpe-calendar       |                       [] []     []    []      | 18
+     gpe-clock          |             []        [] []     []            | 17
+     gpe-conf           |                       []        []            | 12
+     gpe-contacts       |                       []        []            |  7
+     gpe-edit           |             []        [] []           []      | 15
+     gpe-go             |             []        []                      | 11
+     gpe-login          |             []        [] []     []    []      | 18
+     gpe-ownerinfo      |             []        []        []    []      | 19
+     gpe-sketchbook     |             []        []                      | 14
+     gpe-su             |             []        []        []            | 16
+     gpe-taskmanager    |             []        []        []            | 17
+     gpe-timesheet      |             []        []        []    []      | 17
+     gpe-today          |             []        [] []     []    []      | 19
+     gpe-todo           |                       [] []           []      | 17
+     gphoto2            |                []               []    []      | 18
+     gprof              |             []        []                      | 10
+     gpsdrive           |                                               |  3
+     gramadoir          |                       []                      |  6
+     grep               |             [] []     []              []      | 32
+     gretl              |                                               |  4
+     gsasl              |                       []        []            | 12
+     gss                |                       []                      |  5
+     gst-plugins        |                []     []              []      | 17
+     gstreamer          |             [] []     []              []      | 15
+     gtick              |                       []                      | 11
+     gtkspell           |                       [] []     []    []      | 21
+     hello              |             [] []     []        []            | 37
+     id-utils           |             []        []                      | 13
+     impost             |                       []                      |  3
+     indent             |             []        []        []    []      | 25
+     iso_3166           |          [] []        []                      | 12
+     iso_3166_1         |             []           []                   | 20
+     iso_3166_2         |                                               |  2
+     iso_3166_3         |                          []     []            |  8
+     iso_4217           |             []        []                      | 10
+     iso_639            |                       [] []                   | 12
+     jpilot             |             [] []               []            |  6
+     jtag               |                                               |  2
+     jwhois             |             []        []              []      | 12
+     kbd                |             []        []                      | 12
+     latrine            |             []        []                      |  8
+     ld                 |             []                                |  5
+     libc               |             []                  []            | 22
+     libextractor       |                                               |  1
+     libgpewidget       |                       [] []                   | 17
+     libgphoto2         |                                 []            |  9
+     libgphoto2_port    |                                               |  5
+     libgsasl           |                       []                      |  7
+     libiconv           |             [] []     [] []     []            | 32
+     libidn             |                       []        []            |  6
+     lifelines          |                                               |  4
+     lilypond           |                                               |  1
+     lingoteach         |                       []                      |  6
+     lynx               |             [] []     []                      | 15
+     m4                 |                       []        []            | 17
+     mailutils          |                []                             |  7
+     make               |             []                  []            | 18
+     man-db             |                                               |  5
+     minicom            |                                               | 11
+     mysecretdiary      |             []        []                      | 12
+     nano               |                       []              []      | 13
+     nano_1_0           |             [] []     []                      | 18
+     opcodes            |             []        []                      |  9
+     parted             |             [] []               []            | 18
+     psmisc             |                       []                      |  7
+     ptx                |             []                  []            | 23
+     pwdutils           |                                               |  1
+     python             |                                               |  0
+     radius             |                []                             |  6
+     recode             |             []        []                      | 22
+     rpm                |             [] []                             | 11
+     screem             |                                               |  1
+     scrollkeeper       |             [] []                     []      | 24
+     sed                |             []        []              []      | 21
+     sh-utils           |             []                                | 15
+     shared-mime-info   |                []               []    []      | 21
+     sharutils          |             []        []              []      | 20
+     silky              |                                               |  3
+     skencil            |                                               |  6
+     sketch             |                                               |  6
+     solfege            |                                               |  4
+     soundtracker       |             []                                |  8
+     sp                 |             []                                |  3
+     stardict           |                []     []        []    []      | 10
+     tar                |             [] []     []              []      | 15
+     texinfo            |             []                  []            | 14
+     textutils          |             []                  []    []      | 17
+     tin                |                                               |  1
+     tp-robot           |                       []        []    []      |  8
+     tuxpaint           |             []        [] []     []            | 34
+     unicode-han-tra... |                                               |  0
+     unicode-transla... |                                               |  2
+     util-linux         |             [] []     []                      | 18
+     vorbis-tools       |                []                             | 10
+     wastesedge         |                                               |  1
+     wdiff              |             []        []                      | 22
+     wget               |             []        []                      |  7
+     xchat              |                []     []        []    []      | 26
+     xkeyboard-config   |                       []                      |  2
+     xpad               |                       []                      |  5
+                        +-----------------------------------------------+
+       73 teams           ta tg th tk tr uk ven vi wa xh zh_CN zh_TW zu
+      149 domains          0  0  0  1 77 30  0  92 16  0  42    32    0  1746
+
+   Some counters in the preceding matrix are higher than the number of
+visible blocks let us expect.  This is because a few extra PO files are
+used for implementing regional variants of languages, or language
+dialects.
+
+   For a PO file in the matrix above to be effective, the package to
+which it applies should also have been internationalized and
+distributed as such by its maintainer.  There might be an observable
+lag between the mere existence a PO file and its wide availability in a
+distribution.
+
+   If May 2005 seems to be old, you may fetch a more recent copy of
+this `ABOUT-NLS' file on most GNU archive sites.  The most up-to-date
+matrix with full percentage details can be found at
+`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'.
+
+1.6 Using `gettext' in new packages
+===================================
+
+If you are writing a freely available program and want to
+internationalize it you are welcome to use GNU `gettext' in your
+package.  Of course you have to respect the GNU Library General Public
+License which covers the use of the GNU `gettext' library.  This means
+in particular that even non-free programs can use `libintl' as a shared
+library, whereas only free software can use `libintl' as a static
+library or use modified versions of `libintl'.
+
+   Once the sources are changed appropriately and the setup can handle
+the use of `gettext' the only thing missing are the translations.  The
+Free Translation Project is also available for packages which are not
+developed inside the GNU project.  Therefore the information given above
+applies also for every other Free Software Project.  Contact
+`translation@iro.umontreal.ca' to make the `.pot' files available to
+the translation teams.
+
diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..b795e58
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,19 @@
+                     Produced For Your Enjoyment
+
+                                 By
+
+                            David Matuszek
+                                 and
+                            Paul Reynolds
+
+                        With Modifications By
+                              Don Smith
+
+                            Resurrected By
+                               Tom Almy
+
+                          Curses Interface By
+                              Stas Sergeev
+
+                          SST 2K polishing by
+                             Eric S. Raymond
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..00acf97
--- /dev/null
+++ b/COPYING
@@ -0,0 +1 @@
+BSD license
\ No newline at end of file
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..1f4ebf0
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,7 @@
+2006-09-12  gettextize  <bug-gnu-gettext@gnu.org>
+
+       * Makefile.am (SUBDIRS): Add po.
+       (ACLOCAL_AMFLAGS): New variable.
+       (EXTRA_DIST): Add config.rpath, m4/ChangeLog.
+       * configure.ac (AC_CONFIG_FILES): Add po/Makefile.in.
+
diff --git a/ChangeLog.old b/ChangeLog.old
new file mode 100644 (file)
index 0000000..9c7ac09
--- /dev/null
@@ -0,0 +1,106 @@
+Tom Almy story:
+
+Back in (about) 1977 I got a copy of this Super Star Trek game for
+the CDC 6600 mainframe computer. Someone had converted it to PDP-11
+Fortran but couldn't get it to run because of its size. I modified
+the program to use overlays and managed to shoehorn it in on the 56k
+byte machine.
+
+I liked the game so much I put some time into fixing bugs, mainly
+what could be called continuity errors and loopholes in the game's
+logic. We even played a couple tournaments.
+
+In 1979, I lost access to that PDP-11. I did save the source code
+listing. In 1995, missing that old friend, I started converting the
+program into portable ANSI C. It's been slow, tedious work that took
+over a year to accomplish.
+
+In early 1997, I got the bright idea to look for references to "Super
+Star Trek" on the World Wide Web. There weren't many hits, but there
+was one that came up with 1979 Fortran sources! This version had a
+few additional features that mine didn't have, however mine had some
+feature it didn't have. So I merged its features that I liked. I also
+took a peek at the DECUS version (a port, less sources, to the
+PDP-10), and some other variations.
+
+Modifications I made:
+
+  Compared to original version, I've changed the "help" command to
+  "call" and the "terminate" command to "quit" to better match user
+  expectations. The DECUS version apparently made those changes as well
+  as changing "freeze" to "save". However I like "freeze".
+
+  I added EMEXIT from the 1979 version.
+
+  That later version also mentions srscan and lrscan working when
+  docked (using the starbase's scanners), so I made some changes here
+  to do this (and indicating that fact to the player), and then
+  realized the base would have a subspace radio as well -- doing a
+  Chart when docked updates the star chart, and all radio reports will
+  be heard. The Dock command will also give a report if a base is under
+  attack.
+
+  It also had some added logic to spread the initial positioning of
+  bases. That made sense to add because most people abort games with
+  bad base placement.
+
+  The experimental deathray originally had only a 5% chance of success,
+  but could be used repeatedly. I guess after a couple years of use, it
+  was less "experimental" because the 1979 version had a 70% success
+  rate. However it was prone to breaking after use. I upgraded the
+  deathray, but kept the original set of failure modes (great humor!).
+
+  I put in the Tholian Web code from the 1979 version.
+
+  I added code so that Romulans and regular Klingons could move in
+  advanced games. I re-enabled the code which allows enemy ships to
+  ram the Enterprise; it had never worked right. The 1979 version
+  seems to have it all fixed up, but I'm still not overly happy with
+  the algorithm.
+
+  The DECUS version had a Deep Space Probe. Looked like a good idea
+  so I implimented it based on its description.
+
+
+Stas Sergeev story:
+
+Found Tom Almy's C sources - yeah! Hmm, not too playable - I've got
+used to that nice text-based GUI I've seen on an IBM S/370 port, and the
+command-line control gets me quite annoyed. But that's a good starting
+point for some improvements - the sources are finally here! I was about
+to start writing an S/370 emulator to get it a go, and now here are
+the sources - what a great finding.
+
+[a bit later]
+
+Added a text-based interface which makes the game much more playable.
+Initially I made it for DOS using conio.h. Later I decided to make a
+linux port, and I ported it using a linux-conio package. I had to patch
+linux-conio a lot, so you have to use my version. The colors are still
+wrong though.
+I also fixed an uncountable amount of bugs and added some features, I
+can't remember now which ones.
+
+[3 years later]
+
+I dusted off the game and finally got around to move it to autoconf.
+For building with Borland C under DOS, use the build_bc.bat file.
+
+It turned out Tom Almy also did a linux port and made some bug-fixing
+work, although to the much smaller extent than I did. I contacted him
+and notified about my port, but he expressed no interest. :(
+
+[a year later]
+
+I've found out that Eric S Raymond (ESR) took over the development
+of the Tom Almy's sources. He could use mine instead as they are
+much more advanced, but oh well... Now I have to find out the way
+to incorporate my mods into his version and hope that he can do
+the better work on that game than I could (which is most likely
+the case).
+.....
+OK, the changes were incorporated, however Eric removed the conio
+port and therefore the game can no longer be compiled with bcc/DOS.
+The DJGPP port might still be possible in the future.
+
+  -- Stas Sergeev <stsp@users.sourceforge.net>
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..a4b3414
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,229 @@
+Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
+
+   This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index f8acefc..0000000
--- a/Makefile
+++ /dev/null
@@ -1,81 +0,0 @@
-#      Makefile for the Super Star Trek game
-
-VERSION=$(shell sed <sst.spec -n -e '/Version: \(.*\)/s//\1/p')
-
-CFLAGS= -O1 -g -Wall -DSSTDOC='"/usr/share/doc/sst/sst.doc"'
-
-.c.o:
-       $(CC) $(CFLAGS) -c $<
-
-CFILES= sst.c finish.c reports.c setup.c moving.c battle.c events.c ai.c planets.c io.c sstlinux.c
-OFILES= $(CFILES:.c=.o)
-HFILES=sst.h
-DOCS = README sst-doc.xml sst.xml sst-layer.xsl TODO
-
-# sst.doc and sst.6 are included so target system won't need xmlto
-SOURCES= $(CFILES) $(HFILES) $(DOCS) sst.doc sst.6 makehelp.py makefile sst.spec
-
-all: sst sst.doc
-
-ai.o: ai.c sst.h
-battle.o: battle.c sst.h
-events.o: events.c sst.h
-finish.o: finish.c sst.h
-io.o: io.c sst.h
-moving.o: moving.c sstlinux.h sst.h
-planets.o: planets.c sst.h
-reports.o: reports.c sst.h
-setup.o: setup.c sst.h
-sst.o: sst.c sstlinux.h sst.h
-sstlinux.o: sstlinux.c sstlinux.h
-
-sst:  $(OFILES)
-       gcc  -o sst $(OFILES) -lm -lcurses
-
-$(OFILES):  $(HFILES)
-
-sst.6: sst.xml
-       xmlto man sst.xml
-
-sst-doc.txt: sst-doc.xml
-       xmlto -m sst-layer.xsl txt sst-doc.xml
-sst.doc: sst-doc.txt
-       makehelp.py >sst.doc
-
-sst-doc.html: sst-doc.xml
-       xmlto xhtml-nochunks sst-doc.xml
-
-install: uninstall sst.6 sst.doc sst-doc.html 
-       install -m 755 -o 0 -g 0 -d $(ROOT)/usr/bin/
-       install -m 755 -o 0 -g 0 sst $(ROOT)/usr/bin/sst
-       install -m 755 -o 0 -g 0 -d $(ROOT)/usr/share/man/man6/
-       install -m 755 -o 0 -g 0 sst.6 $(ROOT)/usr/share/man/man6/sst.6
-       mkdir -p /usr/share/doc/sst/
-       install -m 644 -o 0 -g 0 sst.doc $(ROOT)/usr/share/doc/sst/
-       install -m 644 -o 0 -g 0 sst-doc.html $(ROOT)/usr/share/doc/sst/index.html
-
-uninstall:
-       rm -f ${ROOT}/usr/bin/sst ${ROOT}/usr/share/man/man6/sst.6
-       rm -fr ${ROOT}/usr/share/doc/sst/
-
-clean:
-       rm -f *.o sst sst-doc.html sst-doc.txt sst.doc
-
-# The "trunk" below assumes this is a Subversion working copy
-sst-$(VERSION).tar.gz: $(SOURCES) sst.6
-       ls $(SOURCES) sst.6 | sed s:^:sst-$(VERSION)/: >MANIFEST
-       (cd ..; ln -s trunk sst-$(VERSION))
-       (cd ..; tar -czvf trunk/sst-$(VERSION).tar.gz `cat trunk/MANIFEST`)
-       (cd ..; rm sst-$(VERSION))
-
-dist: sst-$(VERSION).tar.gz
-
-release: sst-$(VERSION).tar.gz sst.html
-       shipper; rm -f CHANGES ANNOUNCE* *.6 *.html *.rpm *.lsm MANIFEST
-
-version:
-       @echo $(VERSION)
-
-# Experimental XaW code, not yet integrated with the game
-xio: xio.c
-       cc xio.c -lXaw3d -o xio
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..9b972df
--- /dev/null
@@ -0,0 +1,18 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = po src doc
+
+EXTRA_DIST = config.rpath po m4 \
+       autogen.sh sst.spec ChangeLog.old
+
+maintainer-clean-local:
+       rm -f configure
+       rm -f aclocal.m4
+       rm -f `find . -name Makefile.in`
+       rm -f `find . -name *~`
+       rm -f src/include/config.h.in
+
+clean-local:
+       rm -rf autom4te*.cache
+
+ACLOCAL_AMFLAGS = -I m4
diff --git a/Makefile.in b/Makefile.in
new file mode 100644 (file)
index 0000000..4650df6
--- /dev/null
@@ -0,0 +1,600 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(top_srcdir)/configure ABOUT-NLS \
+       AUTHORS COPYING ChangeLog INSTALL NEWS TODO compile \
+       config.guess config.rpath config.sub depcomp install-sh \
+       missing mkinstalldirs
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_ct_have_python = @ac_ct_have_python@
+ac_ct_have_xmlto = @ac_ct_have_xmlto@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+have_python = @have_python@
+have_xmlto = @have_xmlto@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = po src doc
+EXTRA_DIST = config.rpath po m4 \
+       autogen.sh sst.spec ChangeLog.old
+
+ACLOCAL_AMFLAGS = -I m4
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+       @:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(srcdir) && $(AUTOMAKE) --gnu  \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           echo ' $(SHELL) ./config.status'; \
+           $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(am__remove_distdir)
+       mkdir $(distdir)
+       $(mkdir_p) $(distdir)/m4 $(distdir)/po
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+       -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+       || chmod -R a+r $(distdir)
+dist-gzip: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+dist-bzip2: distdir
+       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       $(am__remove_distdir)
+
+dist-tarZ: distdir
+       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+       $(am__remove_distdir)
+
+dist-shar: distdir
+       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       $(am__remove_distdir)
+
+dist-zip: distdir
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__remove_distdir)
+
+dist dist-all: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       case '$(DIST_ARCHIVES)' in \
+       *.tar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+       *.tar.bz2*) \
+         bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.Z*) \
+         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+       *.shar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+       *.zip*) \
+         unzip $(distdir).zip ;;\
+       esac
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
+       mkdir $(distdir)/_build
+       mkdir $(distdir)/_inst
+       chmod a-w $(distdir)
+       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+         && cd $(distdir)/_build \
+         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+               distuninstallcheck \
+         && chmod -R a-w "$$dc_install_base" \
+         && ({ \
+              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && rm -rf $(DIST_ARCHIVES) \
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+       $(am__remove_distdir)
+       @(echo "$(distdir) archives ready for distribution: "; \
+         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+         sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+       @cd $(distuninstallcheck_dir) \
+       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+          || { echo "ERROR: files left after uninstall:" ; \
+               if test -n "$(DESTDIR)"; then \
+                 echo "  (check DESTDIR support)"; \
+               fi ; \
+               $(distuninstallcheck_listfiles) ; \
+               exit 1; } >&2
+distcleancheck: distclean
+       @if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left in build directory after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-local mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic \
+       maintainer-clean-local
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+       check-am clean clean-generic clean-local clean-recursive ctags \
+       ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+       dist-tarZ dist-zip distcheck distclean distclean-generic \
+       distclean-recursive distclean-tags distcleancheck distdir \
+       distuninstallcheck dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       maintainer-clean-local maintainer-clean-recursive mostlyclean \
+       mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
+       tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+
+maintainer-clean-local:
+       rm -f configure
+       rm -f aclocal.m4
+       rm -f `find . -name Makefile.in`
+       rm -f `find . -name *~`
+       rm -f src/include/config.h.in
+
+clean-local:
+       rm -rf autom4te*.cache
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
index 97ab9f527e10cc6dde149c6385ad11a3470f4da9..2063e420e7547d2162c0aea5c7c39efeae26d63a 100644 (file)
--- a/README
+++ b/README
@@ -5,9 +5,6 @@ strip-mine them for dilithium!  Encounter mysterious space thingies!
 This is the classic Super Star Trek game from the days of slow teletypes, 
 reloaded.
 
-There is one binary, sst.  
-On-line documentation goes to /usr/share/doc/sst.doc.
-
 If you enjoy this, check out other ancient games in the Retrocomputing Museum 
 at <http://www.catb.org/retro/>.
 
diff --git a/TODO b/TODO
index 0c104883ad064d6822c09793878aa568a6703bb4..dae737b5cf06fed25370845f8e7e2db16a346d0f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,21 @@
                Super Star Trek TO-DO list
 
-* Wrap a GUI around it.
 
+Short-term items:
+
+* Bring the online help in sync with our commands changes
+
+* Find out why the online help contains the escape sequences like ~@~T (Eric?)
+
+* Adjust the sst.spec wrt the build system changes
+
+* Maybe make a release
+
+
+Long-term items:
+
+* gettextize
+
+* Russian translation
+
+* Wrap a GUI around it.
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..6c88f2b
--- /dev/null
@@ -0,0 +1,870 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+        [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.                 -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([m4/gettext.m4])
+m4_include([m4/iconv.m4])
+m4_include([m4/lib-ld.m4])
+m4_include([m4/lib-link.m4])
+m4_include([m4/lib-prefix.m4])
+m4_include([m4/nls.m4])
+m4_include([m4/po.m4])
+m4_include([m4/progtest.m4])
diff --git a/ai.c b/ai.c
deleted file mode 100644 (file)
index a1b4bbf..0000000
--- a/ai.c
+++ /dev/null
@@ -1,615 +0,0 @@
-#include "sst.h"
-
-static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) 
-{
-    int iqx, iqy, l;
-
-    iqx = quadx+(lookx+(QUADSIZE-1))/QUADSIZE - 1;
-    iqy = quady+(looky+(QUADSIZE-1))/QUADSIZE - 1;
-    if (!VALID_QUADRANT(iqx,iqy) ||
-       game.state.galaxy[iqx][iqy].supernova ||
-       game.state.galaxy[iqx][iqy].klingons > 8)
-       return 0; /* no can do -- neg energy, supernovae, or >8 Klingons */
-    if (ienm == IHR) return 0; /* Romulans cannot escape! */
-    if (irun == 0) {
-       /* avoid intruding on another commander's territory */
-       if (ienm == IHC) {
-           for_commanders(l)
-               if (game.state.cx[l]==iqx && game.state.cy[l]==iqy) return 0;
-           /* refuse to leave if currently attacking starbase */
-           if (batx==quadx && baty==quady) return 0;
-       }
-       /* don't leave if over 1000 units of energy */
-       if (game.kpower[loccom] > 1000.) return 0;
-    }
-    /* print escape message and move out of quadrant.
-       We know this if either short or long range sensors are working */
-    if (game.damage[DSRSENS] == 0.0 || game.damage[DLRSENS] == 0.0 ||
-       condit == IHDOCKED) {
-       crmena(1, ienm, 2, game.kx[loccom], game.ky[loccom]);
-       prout(" escapes to %s (and regains strength).",
-             cramlc(quadrant, iqx, iqy));
-    }
-    /* handle local matters related to escape */
-    game.quad[game.kx[loccom]][game.ky[loccom]] = IHDOT;
-    game.kx[loccom] = game.kx[nenhere];
-    game.ky[loccom] = game.ky[nenhere];
-    game.kavgd[loccom] = game.kavgd[nenhere];
-    game.kpower[loccom] = game.kpower[nenhere];
-    game.kdist[loccom] = game.kdist[nenhere];
-    klhere--;
-    nenhere--;
-    if (condit != IHDOCKED) newcnd();
-    /* Handle global matters related to escape */
-    game.state.galaxy[quadx][quady].klingons--;
-    game.state.galaxy[iqx][iqy].klingons++;
-    if (ienm==IHS) {
-       ishere=0;
-       iscate=0;
-       ientesc=0;
-       isatb=0;
-       game.future[FSCMOVE]=0.2777+game.state.date;
-       game.future[FSCDBAS]=FOREVER;
-       game.state.isx=iqx;
-       game.state.isy=iqy;
-    }
-    else {
-       for_commanders(l) {
-           if (game.state.cx[l]==quadx && game.state.cy[l]==quady) {
-               game.state.cx[l]=iqx;
-               game.state.cy[l]=iqy;
-               break;
-           }
-       }
-       comhere = 0;
-    }
-    return 1; /* success */
-}
-
-
-static void movebaddy(int comx, int comy, int loccom, int ienm) 
-{
-    int motion, mdist, nsteps, mx, my, nextx, nexty, lookx, looky, ll;
-    int irun = 0;
-    int krawlx, krawly;
-    int success;
-    int attempts;
-    /* This should probably be just comhere + ishere */
-    int nbaddys = skill >= SKILL_EXPERT ?
-       (int)((comhere*2 + ishere*2+klhere*1.23+irhere*1.5)/2.0):
-       (comhere + ishere);
-    double dist1, forces;
-
-    dist1 = game.kdist[loccom];
-    mdist = dist1 + 0.5; /* Nearest integer distance */
-
-    /* If SC, check with spy to see if should hi-tail it */
-    if (ienm==IHS &&
-       (game.kpower[loccom] <= 500.0 || (condit==IHDOCKED && game.damage[DPHOTON]==0))) {
-       irun = 1;
-       motion = -QUADSIZE;
-    }
-    else {
-       /* decide whether to advance, retreat, or hold position */
-/* Algorithm:
- * Enterprise has "force" based on condition of phaser and photon torpedoes.
- If both are operating full strength, force is 1000. If both are damaged,
- force is -1000. Having shields down subtracts an additional 1000.
-
- * Enemy has forces equal to the energy of the attacker plus
- 100*(K+R) + 500*(C+S) - 400 for novice through good levels OR
- 346*K + 400*R + 500*(C+S) - 400 for expert and emeritus.
-
- Attacker Initial energy levels (nominal):
- Klingon   Romulan   Commander   Super-Commander
- Novice    400        700        1200        
- Fair      425        750        1250
- Good      450        800        1300        1750
- Expert    475        850        1350        1875
- Emeritus  500        900        1400        2000
- VARIANCE   75        200         200         200
-
- Enemy vessels only move prior to their attack. In Novice - Good games
- only commanders move. In Expert games, all enemy vessels move if there
- is a commander present. In Emeritus games all enemy vessels move.
-
- *  If Enterprise is not docked, an agressive action is taken if enemy
- forces are 1000 greater than Enterprise.
-
- Agressive action on average cuts the distance between the ship and
- the enemy to 1/4 the original.
-
- *  At lower energy advantage, movement units are proportional to the
- advantage with a 650 advantage being to hold ground, 800 to move forward
- 1, 950 for two, 150 for back 4, etc. Variance of 100.
-
- If docked, is reduced by roughly 1.75*skill, generally forcing a
- retreat, especially at high skill levels.
-
- *  Motion is limited to skill level, except for SC hi-tailing it out.
- */
-
-       forces = game.kpower[loccom]+100.0*nenhere+400*(nbaddys-1);
-       if (shldup==0) forces += 1000; /* Good for enemy if shield is down! */
-       if (game.damage[DPHASER] == 0.0 || game.damage[DPHOTON] == 0.0) {
-           if (game.damage[DPHASER] != 0) /* phasers damaged */
-               forces += 300.0;
-           else
-               forces -= 0.2*(energy - 2500.0);
-           if (game.damage[DPHOTON] != 0) /* photon torpedoes damaged */
-               forces += 300.0;
-           else
-               forces -= 50.0*torps;
-       }
-       else {
-           /* phasers and photon tubes both out! */
-           forces += 1000.0;
-       }
-       motion = 0;
-       if (forces <= 1000.0 && condit != IHDOCKED) /* Typical situation */
-           motion = ((forces+200.0*Rand())/150.0) - 5.0;
-       else {
-           if (forces > 1000.0) /* Very strong -- move in for kill */
-               motion = (1.0-square(Rand()))*dist1 + 1.0;
-           if (condit==IHDOCKED && (game.options & OPTION_BASE)) /* protected by base -- back off ! */
-               motion -= skill*(2.0-square(Rand()));
-       }
-#ifdef DEBUG
-       if (idebug) {
-           proutn("MOTION = %1.2f", motion);
-           proutn("  FORCES = %1,2f", forces);
-       }
-#endif
-       /* don't move if no motion */
-       if (motion==0) return;
-       /* Limit motion according to skill */
-       if (abs(motion) > skill) motion = (motion < 0) ? -skill : skill;
-    }
-    /* calculate preferred number of steps */
-    nsteps = motion < 0 ? -motion : motion;
-    if (motion > 0 && nsteps > mdist) nsteps = mdist; /* don't overshoot */
-    if (nsteps > QUADSIZE) nsteps = QUADSIZE; /* This shouldn't be necessary */
-    if (nsteps < 1) nsteps = 1; /* This shouldn't be necessary */
-#ifdef DEBUG
-    if (idebug) {
-       prout("NSTEPS = %d", nsteps);
-    }
-#endif
-    /* Compute preferred values of delta X and Y */
-    mx = sectx - comx;
-    my = secty - comy;
-    if (2.0 * abs(mx) < abs(my)) mx = 0;
-    if (2.0 * abs(my) < abs(sectx-comx)) my = 0;
-    if (mx != 0) mx = mx*motion < 0 ? -1 : 1;
-    if (my != 0) my = my*motion < 0 ? -1 : 1;
-    nextx = comx;
-    nexty = comy;
-    /* main move loop */
-    for (ll = 0; ll < nsteps; ll++) {
-#ifdef DEBUG
-       if (idebug) {
-           prout("%d", ll+1);
-       }
-#endif
-       /* Check if preferred position available */
-       lookx = nextx + mx;
-       looky = nexty + my;
-       krawlx = mx < 0 ? 1 : -1;
-       krawly = my < 0 ? 1 : -1;
-       success = 0;
-       attempts = 0; /* Settle mysterious hang problem */
-       while (attempts++ < 20 && !success) {
-           if (lookx < 1 || lookx > QUADSIZE) {
-               if (motion < 0 && tryexit(lookx, looky, ienm, loccom, irun))
-                   return;
-               if (krawlx == mx || my == 0) break;
-               lookx = nextx + krawlx;
-               krawlx = -krawlx;
-           }
-           else if (looky < 1 || looky > QUADSIZE) {
-               if (motion < 0 && tryexit(lookx, looky, ienm, loccom, irun))
-                   return;
-               if (krawly == my || mx == 0) break;
-               looky = nexty + krawly;
-               krawly = -krawly;
-           }
-           else if ((game.options & OPTION_RAMMING) && game.quad[lookx][looky] != IHDOT) {
-               /* See if we should ram ship */
-               if (game.quad[lookx][looky] == ship &&
-                   (ienm == IHC || ienm == IHS)) {
-                   ram(1, ienm, comx, comy);
-                   return;
-               }
-               if (krawlx != mx && my != 0) {
-                   lookx = nextx + krawlx;
-                   krawlx = -krawlx;
-               }
-               else if (krawly != my && mx != 0) {
-                   looky = nexty + krawly;
-                   krawly = -krawly;
-               }
-               else break; /* we have failed */
-           }
-           else success = 1;
-       }
-       if (success) {
-           nextx = lookx;
-           nexty = looky;
-#ifdef DEBUG
-           if (idebug) {
-               prout(cramlc(neither, nextx, nexty));
-           }
-#endif
-       }
-       else break; /* done early */
-    }
-    /* Put commander in place within same quadrant */
-    game.quad[comx][comy] = IHDOT;
-    game.quad[nextx][nexty] = ienm;
-    if (nextx != comx || nexty != comy) {
-       /* it moved */
-       game.kx[loccom] = nextx;
-       game.ky[loccom] = nexty;
-       game.kdist[loccom] = game.kavgd[loccom] =
-           sqrt(square(sectx-nextx)+square(secty-nexty));
-       if (game.damage[DSRSENS] == 0 || condit == IHDOCKED) {
-           proutn("***");
-           cramen(ienm);
-           proutn(" from %s", cramlc(2, comx, comy));
-           if (game.kdist[loccom] < dist1) proutn(" advances to ");
-           else proutn(" retreats to ");
-           prout(cramlc(sector, nextx, nexty));
-       }
-    }
-}
-
-void movcom(void) 
-{
-    int ix, iy, i;
-
-#ifdef DEBUG
-    if (idebug) prout("MOVCOM");
-#endif
-
-    /* Figure out which Klingon is the commander (or Supercommander)
-       and do move */
-    if (comhere) 
-       for_local_enemies(i) {
-           ix = game.kx[i];
-           iy = game.ky[i];
-           if (game.quad[ix][iy] == IHC) {
-               movebaddy(ix, iy, i, IHC);
-               break;
-           }
-       }
-    if (ishere) 
-       for_local_enemies(i) {
-           ix = game.kx[i];
-           iy = game.ky[i];
-           if (game.quad[ix][iy] == IHS) {
-               movebaddy(ix, iy, i, IHS);
-               break;
-           }
-       }
-    /* if skill level is high, move other Klingons and Romulans too!
-       Move these last so they can base their actions on what the
-       commander(s) do. */
-    if (skill >= SKILL_EXPERT && (game.options & OPTION_MVBADDY)) 
-       for_local_enemies(i) {
-           ix = game.kx[i];
-           iy = game.ky[i];
-           if (game.quad[ix][iy] == IHK || game.quad[ix][iy] == IHR)
-               movebaddy(ix, iy, i, game.quad[ix][iy]);
-       }
-
-    sortkl();
-}
-
-static int movescom(int iqx, int iqy, int flag, int *ipage) 
-{
-    int i;
-
-    if ((iqx==quadx && iqy==quady) ||
-       !VALID_QUADRANT(iqx, iqy) ||
-       game.state.galaxy[iqx][iqy].supernova ||
-       game.state.galaxy[iqx][iqy].klingons > 8) 
-       return 1;
-    if (flag) {
-       /* Avoid quadrants with bases if we want to avoid Enterprise */
-       for_starbases(i)
-           if (game.state.baseqx[i]==iqx && game.state.baseqy[i]==iqy) return 1;
-    }
-    if (justin && !iscate) return 1;
-    /* do the move */
-    game.state.galaxy[game.state.isx][game.state.isy].klingons--;
-    game.state.isx = iqx;
-    game.state.isy = iqy;
-    game.state.galaxy[game.state.isx][game.state.isy].klingons++;
-    if (ishere) {
-       /* SC has scooted, Remove him from current quadrant */
-       iscate=0;
-       isatb=0;
-       ishere=0;
-       ientesc=0;
-       game.future[FSCDBAS]=FOREVER;
-       for_local_enemies(i) 
-           if (game.quad[game.kx[i]][game.ky[i]] == IHS) break;
-       game.quad[game.kx[i]][game.ky[i]] = IHDOT;
-       game.kx[i] = game.kx[nenhere];
-       game.ky[i] = game.ky[nenhere];
-       game.kdist[i] = game.kdist[nenhere];
-       game.kavgd[i] = game.kavgd[nenhere];
-       game.kpower[i] = game.kpower[nenhere];
-       klhere--;
-       nenhere--;
-       if (condit!=IHDOCKED) newcnd();
-       sortkl();
-    }
-    /* check for a helpful planet */
-    for (i = 0; i < inplan; i++) {
-       if (game.state.plnets[i].x==game.state.isx && game.state.plnets[i].y==game.state.isy &&
-           game.state.plnets[i].crystals == 1) {
-           /* destroy the planet */
-           DESTROY(&game.state.plnets[i]);
-           game.state.galaxy[game.state.isx][game.state.isy].planets -= 1;
-           if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED) {
-               if (*ipage==0) pause_game(1);
-               *ipage = 1;
-               prout("Lt. Uhura-  \"Captain, Starfleet Intelligence reports");
-               proutn("   a planet in ");
-               proutn(cramlc(quadrant, game.state.isx, game.state.isy));
-               prout(" has been destroyed");
-               prout("   by the Super-commander.\"");
-           }
-           break;
-       }
-    }
-    return 0; /* looks good! */
-}
-                       
-void scom(int *ipage)
-{
-    int i, i2, j, ideltax, ideltay, ibqx, ibqy, sx, sy, ifindit, iwhichb;
-    int iqx, iqy;
-    int basetbl[BASEMAX+1];
-    double bdist[BASEMAX+1];
-    int flag;
-#ifdef DEBUG
-    if (idebug) prout("SCOM");
-#endif
-
-    /* Decide on being active or passive */
-    flag = ((NKILLC+NKILLK)/(game.state.date+0.01-indate) < 0.1*skill*(skill+1.0) ||
-           (game.state.date-indate) < 3.0);
-    if (iscate==0 && flag) {
-       /* compute move away from Enterprise */
-       ideltax = game.state.isx-quadx;
-       ideltay = game.state.isy-quady;
-       if (sqrt(ideltax*(double)ideltax+ideltay*(double)ideltay) > 2.0) {
-           /* circulate in space */
-           ideltax = game.state.isy-quady;
-           ideltay = quadx-game.state.isx;
-       }
-    }
-    else {
-       /* compute distances to starbases */
-       if (game.state.rembase <= 0) {
-           /* nothing left to do */
-           game.future[FSCMOVE] = FOREVER;
-           return;
-       }
-       sx = game.state.isx;
-       sy = game.state.isy;
-       for_starbases(i) {
-           basetbl[i] = i;
-           ibqx = game.state.baseqx[i];
-           ibqy = game.state.baseqy[i];
-           bdist[i] = sqrt(square(ibqx-sx) + square(ibqy-sy));
-       }
-       if (game.state.rembase > 1) {
-           /* sort into nearest first order */
-           int iswitch;
-           do {
-               iswitch = 0;
-               for (i=1; i < game.state.rembase-1; i++) {
-                   if (bdist[i] > bdist[i+1]) {
-                       int ti = basetbl[i];
-                       double t = bdist[i];
-                       bdist[i] = bdist[i+1];
-                       bdist[i+1] = t;
-                       basetbl[i] = basetbl[i+1];
-                       basetbl[i+1] =ti;
-                       iswitch = 1;
-                   }
-               }
-           } while (iswitch);
-       }
-       /* look for nearest base without a commander, no Enterprise, and
-          without too many Klingons, and not already under attack. */
-       ifindit = iwhichb = 0;
-
-       for_starbases(i2) {
-           i = basetbl[i2];    /* bug in original had it not finding nearest*/
-           ibqx = game.state.baseqx[i];
-           ibqy = game.state.baseqy[i];
-           if ((ibqx == quadx && ibqy == quady) ||
-               (ibqx == batx && ibqy == baty) ||
-               game.state.galaxy[ibqx][ibqy].supernova ||
-               game.state.galaxy[ibqx][ibqy].klingons > 8) 
-               continue;
-           /* if there is a commander, an no other base is appropriate,
-              we will take the one with the commander */
-           for_commanders (j) {
-               if (ibqx==game.state.cx[j] && ibqy==game.state.cy[j] && ifindit!= 2) {
-                   ifindit = 2;
-                   iwhichb = i;
-                   break;
-               }
-           }
-           if (j > game.state.remcom) { /* no commander -- use this one */
-               ifindit = 1;
-               iwhichb = i;
-               break;
-           }
-       }
-       if (ifindit==0) return; /* Nothing suitable -- wait until next time*/
-       ibqx = game.state.baseqx[iwhichb];
-       ibqy = game.state.baseqy[iwhichb];
-       /* decide how to move toward base */
-       ideltax = ibqx - game.state.isx;
-       ideltay = ibqy - game.state.isy;
-    }
-    /* Maximum movement is 1 quadrant in either or both axis */
-    if (ideltax > 1) ideltax = 1;
-    if (ideltax < -1) ideltax = -1;
-    if (ideltay > 1) ideltay = 1;
-    if (ideltay < -1) ideltay = -1;
-
-    /* try moving in both x and y directions */
-    iqx = game.state.isx + ideltax;
-    iqy = game.state.isy + ideltax;
-    if (movescom(iqx, iqy, flag, ipage)) {
-       /* failed -- try some other maneuvers */
-       if (ideltax==0 || ideltay==0) {
-           /* attempt angle move */
-           if (ideltax != 0) {
-               iqy = game.state.isy + 1;
-               if (movescom(iqx, iqy, flag, ipage)) {
-                   iqy = game.state.isy - 1;
-                   movescom(iqx, iqy, flag, ipage);
-               }
-           }
-           else {
-               iqx = game.state.isx + 1;
-               if (movescom(iqx, iqy, flag, ipage)) {
-                   iqx = game.state.isx - 1;
-                   movescom(iqx, iqy, flag, ipage);
-               }
-           }
-       }
-       else {
-           /* try moving just in x or y */
-           iqy = game.state.isy;
-           if (movescom(iqx, iqy, flag, ipage)) {
-               iqy = game.state.isy + ideltay;
-               iqx = game.state.isx;
-               movescom(iqx, iqy, flag, ipage);
-           }
-       }
-    }
-    /* check for a base */
-    if (game.state.rembase == 0) {
-       game.future[FSCMOVE] = FOREVER;
-    }
-    else for_starbases(i) {
-       ibqx = game.state.baseqx[i];
-       ibqy = game.state.baseqy[i];
-       if (ibqx==game.state.isx && ibqy == game.state.isy && game.state.isx != batx && game.state.isy != baty) {
-           /* attack the base */
-           if (flag) return; /* no, don't attack base! */
-           iseenit = 0;
-           isatb=1;
-           game.future[FSCDBAS] = game.state.date + 1.0 +2.0*Rand();
-           if (game.future[FCDBAS] < FOREVER) game.future[FSCDBAS] +=
-               game.future[FCDBAS]-game.state.date;
-           if (game.damage[DRADIO] > 0 && condit != IHDOCKED)
-               return; /* no warning */
-           iseenit = 1;
-           if (*ipage == 0)  pause_game(1);
-           *ipage=1;
-           proutn("Lt. Uhura-  \"Captain, the starbase in ");
-           proutn(cramlc(quadrant, game.state.isx, game.state.isy));
-           skip(1);
-           prout("   reports that it is under attack from the Klingon Super-commander.");
-           proutn("   It can survive until stardate %d.\"",
-                  (int)game.future[FSCDBAS]);
-           if (resting==0) return;
-           prout("Mr. Spock-  \"Captain, shall we cancel the rest period?\"");
-           if (ja()==0) return;
-           resting = 0;
-           Time = 0.0; /* actually finished */
-           return;
-       }
-    }
-    /* Check for intelligence report */
-    if (
-#ifdef DEBUG
-       idebug==0 &&
-#endif
-       (Rand() > 0.2 ||
-        (game.damage[DRADIO] > 0.0 && condit != IHDOCKED) ||
-        !game.state.galaxy[game.state.isx][game.state.isy].charted))
-       return;
-    if (*ipage==0) pause_game(1);
-    *ipage = 1;
-    prout("Lt. Uhura-  \"Captain, Starfleet Intelligence reports");
-    proutn("   the Super-commander is in ");
-    proutn(cramlc(quadrant, game.state.isx, game.state. isy));
-    prout(".\"");
-    return;
-}
-
-void movetho(void)
-{
-    int idx, idy, im, i, dum, my;
-    /* Move the Tholian */
-    if (ithere==0 || justin == 1) return;
-
-    if (ithx == 1 && ithy == 1) {
-       idx = 1; idy = QUADSIZE;
-    }
-    else if (ithx == 1 && ithy == QUADSIZE) {
-       idx = QUADSIZE; idy = QUADSIZE;
-    }
-    else if (ithx == QUADSIZE && ithy == QUADSIZE) {
-       idx = QUADSIZE; idy = 1;
-    }
-    else if (ithx == QUADSIZE && ithy == 1) {
-       idx = 1; idy = 1;
-    }
-    else {
-       /* something is wrong! */
-       ithere = 0;
-       return;
-    }
-
-    /* Do nothing if we are blocked */
-    if (game.quad[idx][idy]!= IHDOT && game.quad[idx][idy]!= IHWEB) return;
-    game.quad[ithx][ithy] = IHWEB;
-
-    if (ithx != idx) {
-       /* move in x axis */
-       im = fabs((double)idx - ithx)/((double)idx - ithx);
-       while (ithx != idx) {
-           ithx += im;
-           if (game.quad[ithx][ithy]==IHDOT) game.quad[ithx][ithy] = IHWEB;
-       }
-    }
-    else if (ithy != idy) {
-       /* move in y axis */
-       im = fabs((double)idy - ithy)/((double)idy - ithy);
-       while (ithy != idy) {
-           ithy += im;
-           if (game.quad[ithx][ithy]==IHDOT) game.quad[ithx][ithy] = IHWEB;
-       }
-    }
-    game.quad[ithx][ithy] = IHT;
-    game.kx[nenhere]=ithx;
-    game.ky[nenhere]=ithy;
-
-    /* check to see if all holes plugged */
-    for_sectors(i) {
-       if (game.quad[1][i]!=IHWEB && game.quad[1][i]!=IHT) return;
-       if (game.quad[QUADSIZE][i]!=IHWEB && game.quad[QUADSIZE][i]!=IHT) return;
-       if (game.quad[i][1]!=IHWEB && game.quad[i][1]!=IHT) return;
-       if (game.quad[i][QUADSIZE]!=IHWEB && game.quad[i][QUADSIZE]!=IHT) return;
-    }
-    /* All plugged up -- Tholian splits */
-    game.quad[ithx][ithy]=IHWEB;
-    dropin(IHBLANK, &dum, &my);
-    crmena(1,IHT, 2, ithx, ithy);
-    prout(" completes web.");
-    ithere = ithx = ithy = 0;
-    nenhere--;
-    return;
-}
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..1c69a72
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+autoreconf -v
diff --git a/battle.c b/battle.c
deleted file mode 100644 (file)
index 56a981f..0000000
--- a/battle.c
+++ /dev/null
@@ -1,1226 +0,0 @@
-#include <unistd.h>
-#include "sst.h"
-
-void doshield(int i) 
-{
-    int key;
-    enum {NONE, SHUP, SHDN, NRG} action = NONE;
-
-    ididit = 0;
-
-    if (i == 2) action = SHUP;
-    else {
-       key = scan();
-       if (key == IHALPHA) {
-           if (isit("transfer"))
-               action = NRG;
-           else {
-               chew();
-               if (game.damage[DSHIELD]) {
-                   prout("Shields damaged and down.");
-                   return;
-               }
-               if (isit("up"))
-                   action = SHUP;
-               else if (isit("down"))
-                   action = SHDN;
-           }
-       }
-       if (action==NONE) {
-           proutn("Do you wish to change shield energy? ");
-           if (ja()) {
-               proutn("Energy to transfer to shields- ");
-               action = NRG;
-           }
-           else if (game.damage[DSHIELD]) {
-               prout("Shields damaged and down.");
-               return;
-           }
-           else if (shldup) {
-               proutn("Shields are up. Do you want them down? ");
-               if (ja()) action = SHDN;
-               else {
-                   chew();
-                   return;
-               }
-           }
-           else {
-               proutn("Shields are down. Do you want them up? ");
-               if (ja()) action = SHUP;
-               else {
-                   chew();
-                   return;
-               }
-           }
-       }
-    }
-    switch (action) {
-    case SHUP: /* raise shields */
-       if (shldup) {
-           prout("Shields already up.");
-           return;
-       }
-       shldup = 1;
-       shldchg = 1;
-       if (condit != IHDOCKED) energy -= 50.0;
-       prout("Shields raised.");
-       if (energy <= 0) {
-           skip(1);
-           prout("Shields raising uses up last of energy.");
-           finish(FNRG);
-           return;
-       }
-       ididit=1;
-       return;
-    case SHDN:
-       if (shldup==0) {
-           prout("Shields already down.");
-           return;
-       }
-       shldup=0;
-       shldchg=1;
-       prout("Shields lowered.");
-       ididit=1;
-       return;
-    case NRG:
-       while (scan() != IHREAL) {
-           chew();
-           proutn("Energy to transfer to shields- ");
-       }
-       chew();
-       if (aaitem==0) return;
-       if (aaitem > energy) {
-           prout("Insufficient ship energy.");
-           return;
-       }
-       ididit = 1;
-       if (shield+aaitem >= inshld) {
-           prout("Shield energy maximized.");
-           if (shield+aaitem > inshld) {
-               prout("Excess energy requested returned to ship energy");
-           }
-           energy -= inshld-shield;
-           shield = inshld;
-           return;
-       }
-       if (aaitem < 0.0 && energy-aaitem > inenrg) {
-           /* Prevent shield drain loophole */
-           skip(1);
-           prout("Engineering to bridge--");
-           prout("  Scott here. Power circuit problem, Captain.");
-           prout("  I can't drain the shields.");
-           ididit = 0;
-           return;
-       }
-       if (shield+aaitem < 0) {
-           prout("All shield energy transferred to ship.");
-           energy += shield;
-           shield = 0.0;
-           return;
-       }
-       proutn("Scotty- \"");
-       if (aaitem > 0)
-           prout("Transferring energy to shields.\"");
-       else
-           prout("Draining energy from shields.\"");
-       shield += aaitem;
-       energy -= aaitem;
-       return;
-    case NONE:;        /* avoid gcc warning */
-    }
-}
-
-void ram(int ibumpd, int ienm, int ix, int iy)
-{
-    double type = 1.0, extradm;
-    int icas, l;
-       
-    prouts("***RED ALERT!  RED ALERT!");
-    skip(1);
-    prout("***COLLISION IMMINENT.");
-    skip(2);
-    proutn("***");
-    crmshp();
-    switch (ienm) {
-    case IHR: type = 1.5; break;
-    case IHC: type = 2.0; break;
-    case IHS: type = 2.5; break;
-    case IHT: type = 0.5; break;
-    case IHQUEST: type = 4.0; break;
-    }
-    proutn(ibumpd ? " rammed by " : " rams ");
-    crmena(0, ienm, 2, ix, iy);
-    if (ibumpd) proutn(" (original position)");
-    skip(1);
-    deadkl(ix, iy, ienm, sectx, secty);
-    proutn("***");
-    crmshp();
-    prout(" heavily damaged.");
-    icas = 10.0+20.0*Rand();
-    prout("***Sickbay reports %d casualties", icas);
-    casual += icas;
-    for (l=0; l < NDEVICES; l++) {
-       if (l == DDRAY) 
-           continue; // Don't damage deathray 
-       if (game.damage[l] < 0) 
-           continue;
-       extradm = (10.0*type*Rand()+1.0)*damfac;
-       game.damage[l] += Time + extradm; /* Damage for at least time of travel! */
-    }
-    shldup = 0;
-    if (KLINGREM) {
-       pause_game(2);
-       dreprt();
-    }
-    else finish(FWON);
-    return;
-}
-
-void torpedo(double course, double r, int inx, int iny, double *hit, int i, int n)
-{
-    int l, iquad=0, ix=0, iy=0, jx=0, jy=0, shoved=0, ll;
-       
-    double ac=course + 0.25*r;
-    double angle = (15.0-ac)*0.5235988;
-    double bullseye = (15.0 - course)*0.5235988;
-    double deltax=-sin(angle), deltay=cos(angle), x=inx, y=iny, bigger;
-    double ang, temp, xx, yy, kp, h1;
-
-    bigger = fabs(deltax);
-    if (fabs(deltay) > bigger) bigger = fabs(deltay);
-    deltax /= bigger;
-    deltay /= bigger;
-    if (game.damage[DSRSENS]==0 || condit==IHDOCKED) 
-       setwnd(srscan_window);
-    else 
-       setwnd(message_window);
-    /* Loop to move a single torpedo */
-    for (l=1; l <= 15; l++) {
-       x += deltax;
-       ix = x + 0.5;
-       y += deltay;
-       iy = y + 0.5;
-       if (!VALID_SECTOR(ix, iy)) break;
-       iquad=game.quad[ix][iy];
-       tracktorpedo(ix, iy, l, i, n, iquad);
-       if (iquad==IHDOT) continue;
-       /* hit something */
-       setwnd(message_window);
-       skip(1);        /* start new line after text track */
-       switch(iquad) {
-       case IHE: /* Hit our ship */
-       case IHF:
-           skip(1);
-           proutn("Torpedo hits ");
-           crmshp();
-           prout(".");
-           *hit = 700.0 + 100.0*Rand() -
-               1000.0*sqrt(square(ix-inx)+square(iy-iny))*
-               fabs(sin(bullseye-angle));
-           *hit = fabs(*hit);
-           newcnd(); /* we're blown out of dock */
-           /* We may be displaced. */
-           if (landed==1 || condit==IHDOCKED) return; /* Cheat if on a planet */
-           ang = angle + 2.5*(Rand()-0.5);
-           temp = fabs(sin(ang));
-           if (fabs(cos(ang)) > temp) temp = fabs(cos(ang));
-           xx = -sin(ang)/temp;
-           yy = cos(ang)/temp;
-           jx=ix+xx+0.5;
-           jy=iy+yy+0.5;
-           if (!VALID_SECTOR(jx, jy)) return;
-           if (game.quad[jx][jy]==IHBLANK) {
-               finish(FHOLE);
-               return;
-           }
-           if (game.quad[jx][jy]!=IHDOT) {
-               /* can't move into object */
-               return;
-           }
-           sectx = jx;
-           secty = jy;
-           crmshp();
-           shoved = 1;
-           break;
-                                         
-       case IHC: /* Hit a commander */
-       case IHS:
-           if (Rand() <= 0.05) {
-               crmena(1, iquad, 2, ix, iy);
-               prout(" uses anti-photon device;");
-               prout("   torpedo neutralized.");
-               return;
-           }
-       case IHR: /* Hit a regular enemy */
-       case IHK:
-           /* find the enemy */
-           for_local_enemies(ll)
-               if (ix==game.kx[ll] && iy==game.ky[ll]) break;
-           kp = fabs(game.kpower[ll]);
-           h1 = 700.0 + 100.0*Rand() -
-               1000.0*sqrt(square(ix-inx)+square(iy-iny))*
-               fabs(sin(bullseye-angle));
-           h1 = fabs(h1);
-           if (kp < h1) h1 = kp;
-           game.kpower[ll] -= (game.kpower[ll]<0 ? -h1 : h1);
-           if (game.kpower[ll] == 0) {
-               deadkl(ix, iy, iquad, ix, iy);
-               return;
-           }
-           crmena(1, iquad, 2, ix, iy);
-           /* If enemy damaged but not destroyed, try to displace */
-           ang = angle + 2.5*(Rand()-0.5);
-           temp = fabs(sin(ang));
-           if (fabs(cos(ang)) > temp) temp = fabs(cos(ang));
-           xx = -sin(ang)/temp;
-           yy = cos(ang)/temp;
-           jx=ix+xx+0.5;
-           jy=iy+yy+0.5;
-           if (!VALID_SECTOR(jx, jy)) {
-               prout(" damaged but not destroyed.");
-               return;
-           }
-           if (game.quad[jx][jy]==IHBLANK) {
-               prout(" buffeted into black hole.");
-               deadkl(ix, iy, iquad, jx, jy);
-               return;
-           }
-           if (game.quad[jx][jy]!=IHDOT) {
-               /* can't move into object */
-               prout(" damaged but not destroyed.");
-               return;
-           }
-           proutn(" damaged--");
-           game.kx[ll] = jx;
-           game.ky[ll] = jy;
-           shoved = 1;
-           break;
-       case IHB: /* Hit a base */
-           skip(1);
-           prout("***STARBASE DESTROYED..");
-           for_starbases(ll) {
-               if (game.state.baseqx[ll]==quadx && game.state.baseqy[ll]==quady) {
-                   game.state.baseqx[ll]=game.state.baseqx[game.state.rembase];
-                   game.state.baseqy[ll]=game.state.baseqy[game.state.rembase];
-                   break;
-               }
-           }
-           game.quad[ix][iy]=IHDOT;
-           game.state.rembase--;
-           basex=basey=0;
-           game.state.galaxy[quadx][quady].starbase--;
-           game.state.chart[quadx][quady].starbase--;
-           game.state.basekl++;
-           newcnd();
-           return;
-       case IHP: /* Hit a planet */
-           crmena(1, iquad, 2, ix, iy);
-           prout(" destroyed.");
-           game.state.nplankl++;
-           game.state.galaxy[quadx][quady].planets--;
-           DESTROY(&game.state.plnets[iplnet]);
-           iplnet = 0;
-           plnetx = plnety = 0;
-           game.quad[ix][iy] = IHDOT;
-           if (landed==1) {
-               /* captain perishes on planet */
-               finish(FDPLANET);
-           }
-           return;
-       case IHSTAR: /* Hit a star */
-           if (Rand() > 0.10) {
-               nova(ix, iy);
-               return;
-           }
-           crmena(1, IHSTAR, 2, ix, iy);
-           prout(" unaffected by photon blast.");
-           return;
-       case IHQUEST: /* Hit a thingy */
-           if (!(game.options & OPTION_THINGY) || Rand()>0.7) {
-               skip(1);
-               prouts("AAAAIIIIEEEEEEEEAAAAAAAAUUUUUGGGGGHHHHHHHHHHHH!!!");
-               skip(1);
-               prouts("    HACK!     HACK!    HACK!        *CHOKE!*  ");
-               skip(1);
-               proutn("Mr. Spock-");
-               prouts("  \"Fascinating!\"");
-               skip(1);
-               deadkl(ix, iy, iquad, ix, iy);
-           } else {
-               /*
-                * Stas Sergeev added the possibility that
-                * you can shove the Thingy and piss it off.
-                * It then becomes an enemy and may fire at you.
-                */
-               iqengry=1;
-               shoved=1;
-           }
-           return;
-       case IHBLANK: /* Black hole */
-           skip(1);
-           crmena(1, IHBLANK, 2, ix, iy);
-           prout(" swallows torpedo.");
-           return;
-       case IHWEB: /* hit the web */
-           skip(1);
-           prout("***Torpedo absorbed by Tholian web.");
-           return;
-       case IHT:  /* Hit a Tholian */
-           h1 = 700.0 + 100.0*Rand() -
-               1000.0*sqrt(square(ix-inx)+square(iy-iny))*
-               fabs(sin(bullseye-angle));
-           h1 = fabs(h1);
-           if (h1 >= 600) {
-               game.quad[ix][iy] = IHDOT;
-               ithere = 0;
-               ithx = ithy = 0;
-               deadkl(ix, iy, iquad, ix, iy);
-               return;
-           }
-           skip(1);
-           crmena(1, IHT, 2, ix, iy);
-           if (Rand() > 0.05) {
-               prout(" survives photon blast.");
-               return;
-           }
-           prout(" disappears.");
-           game.quad[ix][iy] = IHWEB;
-           ithere = ithx = ithy = 0;
-           nenhere--;
-           {
-               int dum, my;
-               dropin(IHBLANK, &dum, &my);
-           }
-           return;
-                                       
-       default: /* Problem! */
-           skip(1);
-           proutn("Don't know how to handle collision with ");
-           crmena(1, iquad, 2, ix, iy);
-           skip(1);
-           return;
-       }
-       break;
-    }
-    if(curwnd!=message_window) {
-       setwnd(message_window);
-    }
-    if (shoved) {
-       game.quad[jx][jy]=iquad;
-       game.quad[ix][iy]=IHDOT;
-       prout(" displaced by blast to %s ", cramlc(sector, jx, jy));
-       for_local_enemies(ll)
-           game.kdist[ll] = game.kavgd[ll] = sqrt(square(sectx-game.kx[ll])+square(secty-game.ky[ll]));
-       sortkl();
-       return;
-    }
-    skip(1);
-    prout("Torpedo missed.");
-    return;
-}
-
-static void fry(double hit) 
-{
-    double ncrit, extradm;
-    int ktr=1, l, ll, j, cdam[NDEVICES];
-
-    /* a critical hit occured */
-    if (hit < (275.0-25.0*skill)*(1.0+0.5*Rand())) return;
-
-    ncrit = 1.0 + hit/(500.0+100.0*Rand());
-    proutn("***CRITICAL HIT--");
-    /* Select devices and cause damage */
-    for (l = 0; l < ncrit && 0 < NDEVICES; l++) {
-       do {
-           j = NDEVICES*Rand();
-           /* Cheat to prevent shuttle damage unless on ship */
-       } while 
-             (game.damage[j]<0.0 || (j==DSHUTTL && iscraft!=1) || j==DDRAY);
-       cdam[l] = j;
-       extradm = (hit*damfac)/(ncrit*(75.0+25.0*Rand()));
-       game.damage[j] += extradm;
-       if (l > 0) {
-           for (ll=2; ll<=l && j != cdam[ll-1]; ll++) ;
-           if (ll<=l) continue;
-           ktr += 1;
-           if (ktr==3) skip(1);
-           proutn(" and ");
-       }
-       proutn(device[j]);
-    }
-    prout(" damaged.");
-    if (game.damage[DSHIELD] && shldup) {
-       prout("***Shields knocked down.");
-       shldup=0;
-    }
-}
-
-void attack(int torps_ok) 
-{
-    /* torps_ok == 0 forces use of phasers in an attack */
-    int percent, ihurt=0, l, i=0, jx, jy, iquad, itflag;
-    int atackd = 0, attempt = 0;
-    double hit;
-    double pfac, dustfac, hitmax=0.0, hittot=0.0, chgfac=1.0, r;
-
-    iattak = 1;
-    if (alldone) return;
-#ifdef DEBUG
-    if (idebug) prout("ATTACK!");
-#endif
-
-    if (ithere) movetho();
-
-    if (neutz) { /* The one chance not to be attacked */
-       neutz = 0;
-       return;
-    }
-    if ((((comhere || ishere) && (justin == 0)) || skill == SKILL_EMERITUS)&&(torps_ok!=0)) movcom();
-    if (nenhere==0 || (nenhere==1 && iqhere && iqengry==0)) return;
-    pfac = 1.0/inshld;
-    if (shldchg == 1) chgfac = 0.25+0.5*Rand();
-    skip(1);
-    if (skill <= SKILL_FAIR) i = 2;
-    for_local_enemies(l) {
-       if (game.kpower[l] < 0) continue;       /* too weak to attack */
-       /* compute hit strength and diminsh shield power */
-       r = Rand();
-       /* Increase chance of photon torpedos if docked or enemy energy low */
-       if (condit == IHDOCKED) r *= 0.25;
-       if (game.kpower[l] < 500) r *= 0.25; 
-       jx = game.kx[l];
-       jy = game.ky[l];
-       iquad = game.quad[jx][jy];
-       if (iquad==IHT || (iquad==IHQUEST && !iqengry)) continue;
-       itflag = (iquad == IHK && r > 0.0005) || !torps_ok ||
-           (iquad==IHC && r > 0.015) ||
-           (iquad==IHR && r > 0.3) ||
-           (iquad==IHS && r > 0.07) ||
-           (iquad==IHQUEST && r > 0.05);
-       if (itflag) {
-           /* Enemy uses phasers */
-           if (condit == IHDOCKED) continue; /* Don't waste the effort! */
-           attempt = 1; /* Attempt to attack */
-           dustfac = 0.8+0.05*Rand();
-           hit = game.kpower[l]*pow(dustfac,game.kavgd[l]);
-           game.kpower[l] *= 0.75;
-       }
-       else { /* Enemy used photon torpedo */
-           double course = 1.90985*atan2((double)secty-jy, (double)jx-sectx);
-           hit = 0;
-           proutn("***TORPEDO INCOMING");
-           if (game.damage[DSRSENS] <= 0.0) {
-               proutn(" From ");
-               crmena(0, iquad, i, jx, jy);
-           }
-           attempt = 1;
-           prout("  ");
-           r = (Rand()+Rand())*0.5 -0.5;
-           r += 0.002*game.kpower[l]*r;
-           torpedo(course, r, jx, jy, &hit, 1, 1);
-           if (KLINGREM==0) 
-               finish(FWON); /* Klingons did themselves in! */
-           if (game.state.galaxy[quadx][quady].supernova || alldone) 
-               return; /* Supernova or finished */
-           if (hit == 0) continue;
-       }
-       if (shldup != 0 || shldchg != 0 || condit==IHDOCKED) {
-           /* shields will take hits */
-           double absorb, hitsh, propor = pfac*shield*(condit==IHDOCKED ? 2.1 : 1.0);
-           if(propor < 0.1) propor = 0.1;
-           hitsh = propor*chgfac*hit+1.0;
-           atackd=1;
-           absorb = 0.8*hitsh;
-           if (absorb > shield) absorb = shield;
-           shield -= absorb;
-           hit -= hitsh;
-           if (condit==IHDOCKED) dock(0);
-           if (propor > 0.1 && hit < 0.005*energy) continue;
-       }
-       /* It's a hit -- print out hit size */
-       atackd = 1; /* We weren't going to check casualties, etc. if
-                      shields were down for some strange reason. This
-                      doesn't make any sense, so I've fixed it */
-       ihurt = 1;
-       proutn("%d unit hit", (int)hit);
-       if ((game.damage[DSRSENS] > 0 && itflag) || skill<=SKILL_FAIR) {
-           proutn(" on the ");
-           crmshp();
-       }
-       if (game.damage[DSRSENS] <= 0.0 && itflag) {
-           proutn(" from ");
-           crmena(0, iquad, i, jx, jy);
-       }
-       skip(1);
-       /* Decide if hit is critical */
-       if (hit > hitmax) hitmax = hit;
-       hittot += hit;
-       fry(hit);
-       prout("Hit %g energy %g", hit, energy);
-       energy -= hit;
-       if (condit==IHDOCKED) 
-           dock(0);
-    }
-    if (energy <= 0) {
-       /* Returning home upon your shield, not with it... */
-       finish(FBATTLE);
-       return;
-    }
-    if (attempt == 0 && condit == IHDOCKED)
-       prout("***Enemies decide against attacking your ship.");
-    if (atackd == 0) return;
-    percent = 100.0*pfac*shield+0.5;
-    if (ihurt==0) {
-       /* Shields fully protect ship */
-       proutn("Enemy attack reduces shield strength to ");
-    }
-    else {
-       /* Print message if starship suffered hit(s) */
-       skip(1);
-       proutn("Energy left %2d    shields ", (int)energy);
-       if (shldup) proutn("up ");
-       else if (game.damage[DSHIELD] == 0) proutn("down ");
-       else proutn("damaged, ");
-    }
-    prout("%d%%,   torpedoes left %d", percent, torps);
-    /* Check if anyone was hurt */
-    if (hitmax >= 200 || hittot >= 500) {
-       int icas= hittot*Rand()*0.015;
-       if (icas >= 2) {
-           skip(1);
-           prout("Mc Coy-  \"Sickbay to bridge.  We suffered %d casualties", icas);
-           prout("   in that last attack.\"");
-           casual += icas;
-       }
-    }
-    /* After attack, reset average distance to enemies */
-    for_local_enemies(l)
-       game.kavgd[l] = game.kdist[l];
-    sortkl();
-    return;
-}
-               
-void deadkl(int ix, int iy, int type, int ixx, int iyy) 
-{
-    /* Added ixx and iyy allow enemy to "move" before dying */
-
-    int i,j;
-
-    skip(1);
-    crmena(1, type, 2, ixx, iyy);
-    /* Decide what kind of enemy it is and update approriately */
-    if (type == IHR) {
-       /* chalk up a Romulan */
-       game.state.galaxy[quadx][quady].romulans--;
-       irhere--;
-       game.state.nromrem--;
-    }
-    else if (type == IHT) {
-       /* Killed a Tholian */
-       ithere = 0;
-    }
-    else if (type == IHQUEST) {
-       /* Killed a Thingy */
-       iqhere=iqengry=thingx=thingy=0;
-    }
-    else {
-       /* Some type of a Klingon */
-       game.state.galaxy[quadx][quady].klingons--;
-       klhere--;
-       switch (type) {
-       case IHC:
-           comhere = 0;
-           for_commanders (i)
-               if (game.state.cx[i]==quadx && game.state.cy[i]==quady) break;
-           game.state.cx[i] = game.state.cx[game.state.remcom];
-           game.state.cy[i] = game.state.cy[game.state.remcom];
-           game.state.cx[game.state.remcom] = 0;
-           game.state.cy[game.state.remcom] = 0;
-           game.state.remcom--;
-           game.future[FTBEAM] = FOREVER;
-           if (game.state.remcom != 0)
-               game.future[FTBEAM] = game.state.date + expran(1.0*incom/game.state.remcom);
-           break;
-       case IHK:
-           game.state.remkl--;
-           break;
-       case IHS:
-           game.state.nscrem--;
-           ishere = game.state.isx = game.state.isy = isatb = iscate = 0;
-           game.future[FSCMOVE] = game.future[FSCDBAS] = FOREVER;
-           break;
-       }
-    }
-
-    /* For each kind of enemy, finish message to player */
-    prout(" destroyed.");
-    game.quad[ix][iy] = IHDOT;
-    if (KLINGREM==0) return;
-
-    game.state.remtime = game.state.remres/(game.state.remkl + 4*game.state.remcom);
-
-    /* Remove enemy ship from arrays describing local conditions */
-    if (game.future[FCDBAS] < FOREVER && batx==quadx && baty==quady && type==IHC)
-       game.future[FCDBAS] = FOREVER;
-    for_local_enemies(i)
-       if (game.kx[i]==ix && game.ky[i]==iy) break;
-    nenhere--;
-    if (i <= nenhere)  {
-       for (j=i; j<=nenhere; j++) {
-           game.kx[j] = game.kx[j+1];
-           game.ky[j] = game.ky[j+1];
-           game.kpower[j] = game.kpower[j+1];
-           game.kavgd[j] = game.kdist[j] = game.kdist[j+1];
-       }
-    }
-    game.kx[nenhere+1] = 0;
-    game.ky[nenhere+1] = 0;
-    game.kdist[nenhere+1] = 0;
-    game.kavgd[nenhere+1] = 0;
-    game.kpower[nenhere+1] = 0;
-    return;
-}
-
-static int targetcheck(double x, double y, double *course) 
-{
-    double deltx, delty;
-    /* Return TRUE if target is invalid */
-    if (!VALID_SECTOR(x, y)) {
-       huh();
-       return 1;
-    }
-    deltx = 0.1*(y - secty);
-    delty = 0.1*(sectx - x);
-    if (deltx==0 && delty== 0) {
-       skip(1);
-       prout("Spock-  \"Bridge to sickbay.  Dr. McCoy,");
-       prout("  I recommend an immediate review of");
-       prout("  the Captain's psychological profile.\"");
-       chew();
-       return 1;
-    }
-    *course = 1.90985932*atan2(deltx, delty);
-    return 0;
-}
-
-void photon(void) 
-{
-    double targ[4][3], course[4];
-    double r, dummy;
-    int key, n, i, osuabor;
-
-    ididit = 0;
-
-    if (game.damage[DPHOTON]) {
-       prout("Photon tubes damaged.");
-       chew();
-       return;
-    }
-    if (torps == 0) {
-       prout("No torpedoes left.");
-       chew();
-       return;
-    }
-    key = scan();
-    for (;;) {
-       if (key == IHALPHA) {
-           huh();
-           return;
-       }
-       else if (key == IHEOL) {
-           prout("%d torpedoes left.", torps);
-           proutn("Number of torpedoes to fire- ");
-           key = scan();
-       }
-       else /* key == IHREAL */ {
-           n = aaitem + 0.5;
-           if (n <= 0) { /* abort command */
-               chew();
-               return;
-           }
-           if (n > 3) {
-               chew();
-               prout("Maximum of 3 torpedoes per burst.");
-               key = IHEOL;
-               return;
-           }
-           if (n <= torps) break;
-           chew();
-           key = IHEOL;
-       }
-    }
-    for (i = 1; i <= n; i++) {
-       key = scan();
-       if (i==1 && key == IHEOL) {
-           break;      /* we will try prompting */
-       }
-       if (i==2 && key == IHEOL) {
-           /* direct all torpedoes at one target */
-           while (i <= n) {
-               targ[i][1] = targ[1][1];
-               targ[i][2] = targ[1][2];
-               course[i] = course[1];
-               i++;
-           }
-           break;
-       }
-       if (key != IHREAL) {
-           huh();
-           return;
-       }
-       targ[i][1] = aaitem;
-       key = scan();
-       if (key != IHREAL) {
-           huh();
-           return;
-       }
-       targ[i][2] = aaitem;
-       if (targetcheck(targ[i][1], targ[i][2], &course[i])) return;
-    }
-    chew();
-    if (i == 1 && key == IHEOL) {
-       /* prompt for each one */
-       for (i = 1; i <= n; i++) {
-           proutn("Target sector for torpedo number %d- ", i);
-           key = scan();
-           if (key != IHREAL) {
-               huh();
-               return;
-           }
-           targ[i][1] = aaitem;
-           key = scan();
-           if (key != IHREAL) {
-               huh();
-               return;
-           }
-           targ[i][2] = aaitem;
-           chew();
-           if (targetcheck(targ[i][1], targ[i][2], &course[i])) return;
-       }
-    }
-    ididit = 1;
-    /* Loop for moving <n> torpedoes */
-    osuabor = 0;
-    for (i = 1; i <= n && !osuabor; i++) {
-       if (condit != IHDOCKED) torps--;
-       r = (Rand()+Rand())*0.5 -0.5;
-       if (fabs(r) >= 0.47) {
-           /* misfire! */
-           r = (Rand()+1.2) * r;
-           if (n>1) {
-               prouts("***TORPEDO NUMBER %d MISFIRES", i);
-           }
-           else prouts("***TORPEDO MISFIRES.");
-           skip(1);
-           if (i < n)
-               prout("  Remainder of burst aborted.");
-           osuabor=1;
-           if (Rand() <= 0.2) {
-               prout("***Photon tubes damaged by misfire.");
-               game.damage[DPHOTON] = damfac*(1.0+2.0*Rand());
-               break;
-           }
-       }
-       if (shldup || condit == IHDOCKED) 
-           r *= 1.0 + 0.0001*shield;
-       torpedo(course[i], r, sectx, secty, &dummy, i, n);
-       if (alldone || game.state.galaxy[quadx][quady].supernova)
-           return;
-    }
-    if (KLINGREM==0) finish(FWON);
-}
-
-       
-
-static void overheat(double rpow) 
-{
-    if (rpow > 1500) {
-       double chekbrn = (rpow-1500.)*0.00038;
-       if (Rand() <= chekbrn) {
-           prout("Weapons officer Sulu-  \"Phasers overheated, sir.\"");
-           game.damage[DPHASER] = damfac*(1.0 + Rand()) * (1.0+chekbrn);
-       }
-    }
-}
-
-static int checkshctrl(double rpow) 
-{
-    double hit;
-    int icas;
-       
-    skip(1);
-    if (Rand() < .998) {
-       prout("Shields lowered.");
-       return 0;
-    }
-    /* Something bad has happened */
-    prouts("***RED ALERT!  RED ALERT!");
-    skip(2);
-    hit = rpow*shield/inshld;
-    energy -= rpow+hit*0.8;
-    shield -= hit*0.2;
-    if (energy <= 0.0) {
-       prouts("Sulu-  \"Captain! Shield malf***********************\"");
-       skip(1);
-       stars();
-       finish(FPHASER);
-       return 1;
-    }
-    prouts("Sulu-  \"Captain! Shield malfunction! Phaser fire contained!\"");
-    skip(2);
-    prout("Lt. Uhura-  \"Sir, all decks reporting damage.\"");
-    icas = hit*Rand()*0.012;
-    skip(1);
-    fry(0.8*hit);
-    if (icas) {
-       skip(1);
-       prout("McCoy to bridge- \"Severe radiation burns, Jim.");
-       prout("  %d casualties so far.\"", icas);
-       casual -= icas;
-    }
-    skip(1);
-    prout("Phaser energy dispersed by shields.");
-    prout("Enemy unaffected.");
-    overheat(rpow);
-    return 1;
-}
-       
-
-void phasers(void) 
-{
-    double hits[21], rpow=0, extra, powrem, over, temp;
-    int kz = 0, k=1, i, irec=0; /* Cheating inhibitor */
-    int ifast=0, no=0, ipoop=1, msgflag = 1;
-    enum {NOTSET, MANUAL, FORCEMAN, AUTOMATIC} automode = NOTSET;
-    int key=0;
-
-    skip(1);
-    /* SR sensors and Computer */
-    if (game.damage[DSRSENS]+game.damage[DCOMPTR] > 0) ipoop = 0;
-    if (condit == IHDOCKED) {
-       prout("Phasers can't be fired through base shields.");
-       chew();
-       return;
-    }
-    if (game.damage[DPHASER] != 0) {
-       prout("Phaser control damaged.");
-       chew();
-       return;
-    }
-    if (shldup) {
-       if (game.damage[DSHCTRL]) {
-           prout("High speed shield control damaged.");
-           chew();
-           return;
-       }
-       if (energy <= 200.0) {
-           prout("Insufficient energy to activate high-speed shield control.");
-           chew();
-           return;
-       }
-       prout("Weapons Officer Sulu-  \"High-speed shield control enabled, sir.\"");
-       ifast = 1;
-               
-    }
-    /* Original code so convoluted, I re-did it all */
-    while (automode==NOTSET) {
-       key=scan();
-       if (key == IHALPHA) {
-           if (isit("manual")) {
-               if (nenhere==0) {
-                   prout("There is no enemy present to select.");
-                   chew();
-                   key = IHEOL;
-                   automode=AUTOMATIC;
-               }
-               else {
-                   automode = MANUAL;
-                   key = scan();
-               }
-           }
-           else if (isit("automatic")) {
-               if ((!ipoop) && nenhere != 0) {
-                   automode = FORCEMAN;
-               }
-               else {
-                   if (nenhere==0)
-                       prout("Energy will be expended into space.");
-                   automode = AUTOMATIC;
-                   key = scan();
-               }
-           }
-           else if (isit("no")) {
-               no = 1;
-           }
-           else {
-               huh();
-               return;
-           }
-       }
-       else if (key == IHREAL) {
-           if (nenhere==0) {
-               prout("Energy will be expended into space.");
-               automode = AUTOMATIC;
-           }
-           else if (!ipoop)
-               automode = FORCEMAN;
-           else
-               automode = AUTOMATIC;
-       }
-       else {
-           /* IHEOL */
-           if (nenhere==0) {
-               prout("Energy will be expended into space.");
-               automode = AUTOMATIC;
-           }
-           else if (!ipoop)
-               automode = FORCEMAN;
-           else 
-               proutn("Manual or automatic? ");
-       }
-    }
-                               
-    switch (automode) {
-    case AUTOMATIC:
-       if (key == IHALPHA && isit("no")) {
-           no = 1;
-           key = scan();
-       }
-       if (key != IHREAL && nenhere != 0) {
-           prout("Phasers locked on target. Energy available: %.2f",
-                 ifast?energy-200.0:energy,1,2);
-       }
-       irec=0;
-       do {
-           chew();
-           if (!kz) for_local_enemies(i)
-               irec+=fabs(game.kpower[i])/(PHASEFAC*pow(0.90,game.kdist[i]))*
-                   (1.01+0.05*Rand()) + 1.0;
-           kz=1;
-           proutn("(%d) units required. ", irec);
-           chew();
-           proutn("Units to fire= ");
-           key = scan();
-           if (key!=IHREAL) return;
-           rpow = aaitem;
-           if (rpow > (ifast?energy-200:energy)) {
-               proutn("Energy available= %.2f",
-                      ifast?energy-200:energy);
-               skip(1);
-               key = IHEOL;
-           }
-       } while (rpow > (ifast?energy-200:energy));
-       if (rpow<=0) {
-           /* chicken out */
-           chew();
-           return;
-       }
-       if ((key=scan()) == IHALPHA && isit("no")) {
-           no = 1;
-       }
-       if (ifast) {
-           energy -= 200; /* Go and do it! */
-           if (checkshctrl(rpow)) return;
-       }
-       chew();
-       energy -= rpow;
-       extra = rpow;
-       if (nenhere) {
-           extra = 0.0;
-           powrem = rpow;
-           for_local_enemies(i) {
-               hits[i] = 0.0;
-               if (powrem <= 0) continue;
-               hits[i] = fabs(game.kpower[i])/(PHASEFAC*pow(0.90,game.kdist[i]));
-               over = (0.01 + 0.05*Rand())*hits[i];
-               temp = powrem;
-               powrem -= hits[i] + over;
-               if (powrem <= 0 && temp < hits[i]) hits[i] = temp;
-               if (powrem <= 0) over = 0.0;
-               extra += over;
-           }
-           if (powrem > 0.0) extra += powrem;
-           hittem(hits);
-           ididit=1;
-       }
-       if (extra > 0 && alldone == 0) {
-           if (ithere) {
-               proutn("*** Tholian web absorbs ");
-               if (nenhere>0) proutn("excess ");
-               prout("phaser energy.");
-           }
-           else {
-               prout("%d expended on empty space.", (int)extra);
-           }
-       }
-       break;
-
-    case FORCEMAN:
-       chew();
-       key = IHEOL;
-       if (game.damage[DCOMPTR]!=0)
-           prout("Battle comuter damaged, manual file only.");
-       else {
-           skip(1);
-           prouts("---WORKING---");
-           skip(1);
-           prout("Short-range-sensors-damaged");
-           prout("Insufficient-data-for-automatic-phaser-fire");
-           prout("Manual-fire-must-be-used");
-           skip(1);
-       }
-    case MANUAL:
-       rpow = 0.0;
-       for (k = 1; k <= nenhere;) {
-           int ii = game.kx[k], jj = game.ky[k];
-           int ienm = game.quad[ii][jj];
-           if (msgflag) {
-               proutn("Energy available= %.2f",
-                      energy-.006-(ifast?200:0));
-               skip(1);
-               msgflag = 0;
-               rpow = 0.0;
-           }
-           if (game.damage[DSRSENS] && !(abs(sectx-ii) < 2 && abs(secty-jj) < 2) &&
-               (ienm == IHC || ienm == IHS)) {
-               cramen(ienm);
-               prout(" can't be located without short range scan.");
-               chew();
-               key = IHEOL;
-               hits[k] = 0; /* prevent overflow -- thanks to Alexei Voitenko */
-               k++;
-               continue;
-           }
-           if (key == IHEOL) {
-               chew();
-               if (ipoop && k > kz)
-                   irec=(fabs(game.kpower[k])/(PHASEFAC*pow(0.9,game.kdist[k])))*
-                       (1.01+0.05*Rand()) + 1.0;
-               kz = k;
-               proutn("(");
-               if (game.damage[DCOMPTR]==0) proutn("%d", irec);
-               else proutn("??");
-               proutn(")  ");
-               proutn("units to fire at ");
-               crmena(0, ienm, 2, ii, jj);
-               proutn("-  ");
-               key = scan();
-           }
-           if (key == IHALPHA && isit("no")) {
-               no = 1;
-               key = scan();
-               continue;
-           }
-           if (key == IHALPHA) {
-               huh();
-               return;
-           }
-           if (key == IHEOL) {
-               if (k==1) { /* Let me say I'm baffled by this */
-                   msgflag = 1;
-               }
-               continue;
-           }
-           if (aaitem < 0) {
-               /* abort out */
-               chew();
-               return;
-           }
-           hits[k] = aaitem;
-           rpow += aaitem;
-           /* If total requested is too much, inform and start over */
-                               
-           if (rpow > (ifast?energy-200:energy)) {
-               prout("Available energy exceeded -- try again.");
-               chew();
-               return;
-           }
-           key = scan(); /* scan for next value */
-           k++;
-       }
-       if (rpow == 0.0) {
-           /* zero energy -- abort */
-           chew();
-           return;
-       }
-       if (key == IHALPHA && isit("no")) {
-           no = 1;
-       }
-       energy -= rpow;
-       chew();
-       if (ifast) {
-           energy -= 200.0;
-           if (checkshctrl(rpow)) return;
-       }
-       hittem(hits);
-       ididit=1;
-    case NOTSET:;      /* avoid gcc warning */
-    }
-    /* Say shield raised or malfunction, if necessary */
-    if (alldone) 
-       return;
-    if (ifast) {
-       skip(1);
-       if (no == 0) {
-           if (Rand() >= 0.99) {
-               prout("Sulu-  \"Sir, the high-speed shield control has malfunctioned . . .");
-               prouts("         CLICK   CLICK   POP  . . .");
-               prout(" No  response, sir!");
-               shldup = 0;
-           }
-           else
-               prout("Shields raised.");
-       }
-       else
-           shldup = 0;
-    }
-    overheat(rpow);
-}
-
-void hittem(double *hits) 
-{
-    double kp, kpow, wham, hit, dustfac, kpini;
-    int nenhr2=nenhere, k=1, kk=1, ii, jj, ienm;
-
-    skip(1);
-
-    for (; k <= nenhr2; k++, kk++) {
-       if ((wham = hits[k])==0) continue;
-       dustfac = 0.9 + 0.01*Rand();
-       hit = wham*pow(dustfac,game.kdist[kk]);
-       kpini = game.kpower[kk];
-       kp = fabs(kpini);
-       if (PHASEFAC*hit < kp) kp = PHASEFAC*hit;
-       game.kpower[kk] -= (game.kpower[kk] < 0 ? -kp: kp);
-       kpow = game.kpower[kk];
-       ii = game.kx[kk];
-       jj = game.ky[kk];
-       if (hit > 0.005) {
-           if (game.damage[DSRSENS]==0)
-               boom(ii, jj);
-           proutn("%d unit hit on ", (int)hit);
-       }
-       else
-           proutn("Very small hit on ");
-       ienm = game.quad[ii][jj];
-       if (ienm==IHQUEST) iqengry=1;
-       crmena(0,ienm,2,ii,jj);
-       skip(1);
-       if (kpow == 0) {
-           deadkl(ii, jj, ienm, ii, jj);
-           if (KLINGREM==0) finish(FWON);
-           if (alldone) return;
-           kk--; /* don't do the increment */
-       }
-       else /* decide whether or not to emasculate klingon */
-           if (kpow > 0 && Rand() >= 0.9 &&
-               kpow <= ((0.4 + 0.4*Rand())*kpini)) {
-               prout("***Mr. Spock-  \"Captain, the vessel at ",
-                     cramlc(sector,ii,jj));
-               prout("   has just lost its firepower.\"");
-               game.kpower[kk] = -kpow;
-           }
-    }
-    return;
-}
-
diff --git a/compile b/compile
new file mode 100755 (executable)
index 0000000..1b1d232
--- /dev/null
+++ b/compile
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+       # configure might choose to run compile as `compile cc -o foo foo.c'.
+       # So we strip `-o arg' only if arg is an object.
+       eat=1
+       case $2 in
+         *.o | *.obj)
+           ofile=$2
+           ;;
+         *)
+           set x "$@" -o "$2"
+           shift
+           ;;
+       esac
+       ;;
+      *.c)
+       cfile=$1
+       set x "$@" "$1"
+       shift
+       ;;
+      *)
+       set x "$@" "$1"
+       shift
+       ;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/config.guess b/config.guess
new file mode 100755 (executable)
index 0000000..917bbc5
--- /dev/null
@@ -0,0 +1,1463 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+       exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    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 ;;
+    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 ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit ;;
+    ????????: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 ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
+       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 ;;
+    *:AIX:*:[45])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+               {
+               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+               case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+                   switch (bits)
+                       {
+                       case 64: puts ("hppa2.0w"); break;
+                       case 32: puts ("hppa2.0n"); break;
+                       default: puts ("hppa2.0"); break;
+                       } break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+                   puts ("hppa2.0"); break;
+              #endif
+               default: puts ("hppa1.0"); break;
+               }
+                  exit (0);
+              }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep __LP64__ >/dev/null
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
+       echo unknown-hitachi-hiuxwe2
+       exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:FreeBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    i*:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    x86:Interix*:[34]*)
+       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+       exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    arm*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    cris:Linux:*:*)
+       echo cris-axis-linux-gnu
+       exit ;;
+    crisv32:Linux:*:*)
+       echo crisv32-axis-linux-gnu
+       exit ;;
+    frv:Linux:*:*)
+       echo frv-unknown-linux-gnu
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips64
+       #undef mips64el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mips64el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips64
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    x86_64:Linux:*:*)
+       echo x86_64-unknown-linux-gnu
+       exit ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+               exit ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+               exit ;;
+         "")
+               # Either a pre-BFD a.out linker (linux-gnuoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+               exit ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #ifdef __INTEL_COMPILER
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       test x"${LIBC}" != x && {
+               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+               exit
+       }
+       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+       ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit ;;
+    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 ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*: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; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    *: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 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+        exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           *86) UNAME_PROCESSOR=i686 ;;
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\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`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# 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 ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    c34*)
+       echo c34-convex-bsd
+       exit ;;
+    c38*)
+       echo c38-convex-bsd
+       exit ;;
+    c4*)
+       echo c4-convex-bsd
+       exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.rpath b/config.rpath
new file mode 100755 (executable)
index 0000000..3f1bef3
--- /dev/null
@@ -0,0 +1,571 @@
+#! /bin/sh
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+#   Copyright 1996-2005 Free Software Foundation, Inc.
+#   Taken from GNU libtool, 2001
+#   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+#   This file is free software; the Free Software Foundation gives
+#   unlimited permission to copy and/or distribute it, with or without
+#   modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+#   than 256 bytes, otherwise the compiler driver will dump core. The only
+#   known workaround is to choose shorter directory names for the build
+#   directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+cc_basename=`echo "$CC" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+  wl='-Wl,'
+else
+  case "$host_os" in
+    aix*)
+      wl='-Wl,'
+      ;;
+    darwin*)
+      case "$cc_basename" in
+        xlc*)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    mingw* | pw32* | os2*)
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      wl='-Wl,'
+      ;;
+    irix5* | irix6* | nonstopux*)
+      wl='-Wl,'
+      ;;
+    newsos6)
+      ;;
+    linux*)
+      case $cc_basename in
+        icc* | ecc*)
+          wl='-Wl,'
+          ;;
+        pgcc | pgf77 | pgf90)
+          wl='-Wl,'
+          ;;
+        ccc*)
+          wl='-Wl,'
+          ;;
+        como)
+          wl='-lopt='
+          ;;
+      esac
+      ;;
+    osf3* | osf4* | osf5*)
+      wl='-Wl,'
+      ;;
+    sco3.2v5*)
+      ;;
+    solaris*)
+      wl='-Wl,'
+      ;;
+    sunos4*)
+      wl='-Qoption ld '
+      ;;
+    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+      wl='-Wl,'
+      ;;
+    sysv4*MP*)
+      ;;
+    unicos*)
+      wl='-Wl,'
+      ;;
+    uts4*)
+      ;;
+  esac
+fi
+
+# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+  cygwin* | mingw* | pw32*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  case "$host_os" in
+    aix3* | aix4* | aix5*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+        ld_shlibs=no
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+      # that the semantics of dynamic libraries on AmigaOS, at least up
+      # to version 4, is to share data among multiple programs linked
+      # with the same dynamic library.  Since this doesn't match the
+      # behavior of shared libraries on other platforms, we cannot use
+      # them.
+      ld_shlibs=no
+      ;;
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    cygwin* | mingw* | pw32*)
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    netbsd*)
+      ;;
+    solaris* | sysv5*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+        ld_shlibs=no
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    sunos4*)
+      hardcode_direct=yes
+      ;;
+    linux*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+  esac
+  if test "$ld_shlibs" = yes; then
+    # Unlike libtool, we use -rpath here, not --rpath, since the documented
+    # option of GNU ld is called -rpath, not --rpath.
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+  fi
+else
+  case "$host_os" in
+    aix3*)
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes; then
+        # Neither direct hardcoding nor static linking is supported with a
+        # broken collect2.
+        hardcode_direct=unsupported
+      fi
+      ;;
+    aix4* | aix5*)
+      if test "$host_cpu" = ia64; then
+        # On IA64, the linker does run time linking by default, so we don't
+        # have to do anything special.
+        aix_use_runtimelinking=no
+      else
+        aix_use_runtimelinking=no
+        # Test if we are trying to use run time linking or normal
+        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+        # need to do runtime linking.
+        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+          for ld_flag in $LDFLAGS; do
+            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+              aix_use_runtimelinking=yes
+              break
+            fi
+          done
+        esac
+      fi
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      if test "$GCC" = yes; then
+        case $host_os in aix4.[012]|aix4.[012].*)
+          collect2name=`${CC} -print-prog-name=collect2`
+          if test -f "$collect2name" && \
+            strings "$collect2name" | grep resolve_lib_name >/dev/null
+          then
+            # We have reworked collect2
+            hardcode_direct=yes
+          else
+            # We have old collect2
+            hardcode_direct=unsupported
+            hardcode_minus_L=yes
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_libdir_separator=
+          fi
+        esac
+      fi
+      # Begin _LT_AC_SYS_LIBPATH_AIX.
+      echo 'int main () { return 0; }' > conftest.c
+      ${CC} ${LDFLAGS} conftest.c -o conftest
+      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      if test -z "$aix_libpath"; then
+        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      fi
+      if test -z "$aix_libpath"; then
+        aix_libpath="/usr/lib:/lib"
+      fi
+      rm -f conftest.c conftest
+      # End _LT_AC_SYS_LIBPATH_AIX.
+      if test "$aix_use_runtimelinking" = yes; then
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+      else
+        if test "$host_cpu" = ia64; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        else
+          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        fi
+      fi
+      ;;
+    amigaos*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      # see comment about different semantics on the GNU ld section
+      ld_shlibs=no
+      ;;
+    bsdi[45]*)
+      ;;
+    cygwin* | mingw* | pw32*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      libext=lib
+      ;;
+    darwin* | rhapsody*)
+      hardcode_direct=no
+      if test "$GCC" = yes ; then
+        :
+      else
+        case "$cc_basename" in
+          xlc*)
+            ;;
+          *)
+            ld_shlibs=no
+            ;;
+        esac
+      fi
+      ;;
+    dgux*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+    freebsd2.2*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    freebsd2*)
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    freebsd* | kfreebsd*-gnu | dragonfly*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    hpux9*)
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      ;;
+    hpux10* | hpux11*)
+      if test "$with_gnu_ld" = no; then
+        case "$host_cpu" in
+          hppa*64*)
+            hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+            hardcode_libdir_separator=:
+            hardcode_direct=no
+            ;;
+          ia64*)
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_direct=no
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+          *)
+            hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+            hardcode_libdir_separator=:
+            hardcode_direct=yes
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+        esac
+      fi
+      ;;
+    irix5* | irix6* | nonstopux*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    netbsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    newsos6)
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    openbsd*)
+      hardcode_direct=yes
+      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      else
+        case "$host_os" in
+          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+            hardcode_libdir_flag_spec='-R$libdir'
+            ;;
+          *)
+            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+            ;;
+        esac
+      fi
+      ;;
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      ;;
+    osf3*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    osf4* | osf5*)
+      if test "$GCC" = yes; then
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+        # Both cc and cxx compiler support -rpath directly
+        hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+    sco3.2v5*)
+      ;;
+    solaris*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      ;;
+    sunos4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    sysv4)
+      case $host_vendor in
+        sni)
+          hardcode_direct=yes # is this really true???
+          ;;
+        siemens)
+          hardcode_direct=no
+          ;;
+        motorola)
+          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+          ;;
+      esac
+      ;;
+    sysv4.3*)
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+        ld_shlibs=yes
+      fi
+      ;;
+    sysv4.2uw2*)
+      hardcode_direct=yes
+      hardcode_minus_L=no
+      ;;
+    sysv5OpenUNIX8* | sysv5UnixWare7* |  sysv5uw[78]* | unixware7*)
+      ;;
+    sysv5*)
+      hardcode_libdir_flag_spec=
+      ;;
+    uts4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    *)
+      ld_shlibs=no
+      ;;
+  esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
+libname_spec='lib$name'
+case "$host_os" in
+  aix3*)
+    ;;
+  aix4* | aix5*)
+    ;;
+  amigaos*)
+    ;;
+  beos*)
+    ;;
+  bsdi[45]*)
+    ;;
+  cygwin* | mingw* | pw32*)
+    shrext=.dll
+    ;;
+  darwin* | rhapsody*)
+    shrext=.dylib
+    ;;
+  dgux*)
+    ;;
+  freebsd1*)
+    ;;
+  kfreebsd*-gnu)
+    ;;
+  freebsd*)
+    ;;
+  gnu*)
+    ;;
+  hpux9* | hpux10* | hpux11*)
+    case "$host_cpu" in
+      ia64*)
+        shrext=.so
+        ;;
+      hppa*64*)
+        shrext=.sl
+        ;;
+      *)
+        shrext=.sl
+        ;;
+    esac
+    ;;
+  irix5* | irix6* | nonstopux*)
+    case "$host_os" in
+      irix5* | nonstopux*)
+        libsuff= shlibsuff=
+        ;;
+      *)
+        case $LD in
+          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+          *) libsuff= shlibsuff= ;;
+        esac
+        ;;
+    esac
+    ;;
+  linux*oldld* | linux*aout* | linux*coff*)
+    ;;
+  linux*)
+    ;;
+  knetbsd*-gnu)
+    ;;
+  netbsd*)
+    ;;
+  newsos6)
+    ;;
+  nto-qnx*)
+    ;;
+  openbsd*)
+    ;;
+  os2*)
+    libname_spec='$name'
+    shrext=.dll
+    ;;
+  osf3* | osf4* | osf5*)
+    ;;
+  sco3.2v5*)
+    ;;
+  solaris*)
+    ;;
+  sunos4*)
+    ;;
+  sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+    ;;
+  sysv4*MP*)
+    ;;
+  uts4*)
+    ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF
diff --git a/config.sub b/config.sub
new file mode 100755 (executable)
index 0000000..1c366df
--- /dev/null
@@ -0,0 +1,1579 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray)
+               os=
+               basic_machine=$1
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | ms1 \
+       | msp430 \
+       | ns16k | ns32k \
+       | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | pyramid \
+       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b \
+       | strongarm \
+       | tahoe | thumb | tic4x | tic80 | tron \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m32c)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | ms1-* \
+       | msp430-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | pyramid-* \
+       | romp-* | rs6000-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tron-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | xstormy16-* | xtensa-* \
+       | ymp-* \
+       | z8k-*)
+               ;;
+       m32c-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16c)
+               basic_machine=cr16c-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
+       tic55x | c55x*)
+               basic_machine=tic55x-unknown
+               os=-coff
+               ;;
+       tic6x | c6x*)
+               basic_machine=tic6x-unknown
+               os=-coff
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+        -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+        -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755 (executable)
index 0000000..75f845b
--- /dev/null
+++ b/configure
@@ -0,0 +1,8783 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for sst 2.0.
+#
+# Report bugs to <stsp>.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='sst'
+PACKAGE_TARNAME='sst'
+PACKAGE_VERSION='2.0'
+PACKAGE_STRING='sst 2.0'
+PACKAGE_BUGREPORT='stsp'
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MKINSTALLDIRS USE_NLS MSGFMT GMSGFMT XGETTEXT MSGMERGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os INTL_MACOSX_LIBS LIBICONV LTLIBICONV INTLLIBS LIBINTL LTLIBINTL POSUB LN_S have_xmlto ac_ct_have_xmlto have_python ac_ct_have_python CPP EGREP LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+             localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures sst 2.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                         [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                         [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of sst 2.0:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-nls           do not use Native Language Support
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --disable-rpath         do not hardcode runtime library paths
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-gnu-ld           assume the C compiler uses GNU ld default=no
+  --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
+  --without-libiconv-prefix     don't search for libiconv in includedir and libdir
+  --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
+  --without-libintl-prefix     don't search for libintl in includedir and libdir
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <stsp>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+          test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+sst configure 2.0
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by sst $as_me 2.0, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=$`echo $ac_var`
+       echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+       ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+am__api_version="1.9"
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+       @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='sst'
+ VERSION='2.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+
+        MKINSTALLDIRS=
+  if test -n "$ac_aux_dir"; then
+    case "$ac_aux_dir" in
+      /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
+      *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
+    esac
+  fi
+  if test -z "$MKINSTALLDIRS"; then
+    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+  fi
+
+
+
+  echo "$as_me:$LINENO: checking whether NLS is requested" >&5
+echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
+    # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+  enableval="$enable_nls"
+  USE_NLS=$enableval
+else
+  USE_NLS=yes
+fi;
+  echo "$as_me:$LINENO: result: $USE_NLS" >&5
+echo "${ECHO_T}$USE_NLS" >&6
+
+
+
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_MSGFMT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case "$MSGFMT" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 &&
+     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+            ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":"
+    ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test "$MSGFMT" != ":"; then
+  echo "$as_me:$LINENO: result: $MSGFMT" >&5
+echo "${ECHO_T}$MSGFMT" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_GMSGFMT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $GMSGFMT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+  ;;
+esac
+fi
+GMSGFMT=$ac_cv_path_GMSGFMT
+
+if test -n "$GMSGFMT"; then
+  echo "$as_me:$LINENO: result: $GMSGFMT" >&5
+echo "${ECHO_T}$GMSGFMT" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_XGETTEXT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case "$XGETTEXT" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 &&
+     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+            ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+    ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test "$XGETTEXT" != ":"; then
+  echo "$as_me:$LINENO: result: $XGETTEXT" >&5
+echo "${ECHO_T}$XGETTEXT" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    rm -f messages.po
+
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_MSGMERGE+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case "$MSGMERGE" in
+  [\\/]* | ?:[\\/]*)
+    ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH; do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&5
+          if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then
+            ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+  test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":"
+    ;;
+esac
+fi
+MSGMERGE="$ac_cv_path_MSGMERGE"
+if test "$MSGMERGE" != ":"; then
+  echo "$as_me:$LINENO: result: $MSGMERGE" >&5
+echo "${ECHO_T}$MSGMERGE" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+      if test "$GMSGFMT" != ":"; then
+            if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
+       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+      : ;
+    else
+      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
+      echo "$as_me:$LINENO: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5
+echo "${ECHO_T}found $GMSGFMT program is not GNU msgfmt; ignore it" >&6
+      GMSGFMT=":"
+    fi
+  fi
+
+      if test "$XGETTEXT" != ":"; then
+            if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
+       (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+      : ;
+    else
+      echo "$as_me:$LINENO: result: found xgettext program is not GNU xgettext; ignore it" >&5
+echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6
+      XGETTEXT=":"
+    fi
+        rm -f messages.po
+  fi
+
+            ac_config_commands="$ac_config_commands default-1"
+
+
+
+      if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+
+DEPDIR="${am__leading_dot}deps"
+
+          ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+       ;;
+    conftest.$ac_ext )
+       # This is the source file.
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       # FIXME: I believe we export ac_cv_exeext for Libtool,
+       # but it would be cool to find out if it's true.  Does anybody
+       # maintain Libtool? --akim.
+       export ac_cv_exeext
+       break;;
+    * )
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         export ac_cv_exeext
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+  withval="$with_gnu_ld"
+  test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi;
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  echo "$as_me:$LINENO: checking for ld used by GCC" >&5
+echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | [A-Za-z]:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+  echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${acl_cv_path_LD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$LD"; then
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break ;;
+      *)
+       test "$with_gnu_ld" != yes && break ;;
+      esac
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${acl_cv_prog_gnu_ld+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  acl_cv_prog_gnu_ld=yes ;;
+*)
+  acl_cv_prog_gnu_ld=no ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6
+with_gnu_ld=$acl_cv_prog_gnu_ld
+
+
+
+
+                                                echo "$as_me:$LINENO: checking for shared library run path origin" >&5
+echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6
+if test "${acl_cv_rpath+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+
+fi
+echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5
+echo "${ECHO_T}$acl_cv_rpath" >&6
+  wl="$acl_cv_wl"
+  libext="$acl_cv_libext"
+  shlibext="$acl_cv_shlibext"
+  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  hardcode_direct="$acl_cv_hardcode_direct"
+  hardcode_minus_L="$acl_cv_hardcode_minus_L"
+    # Check whether --enable-rpath or --disable-rpath was given.
+if test "${enable_rpath+set}" = set; then
+  enableval="$enable_rpath"
+  :
+else
+  enable_rpath=yes
+fi;
+
+
+
+
+
+
+
+    use_additional=yes
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+
+# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given.
+if test "${with_libiconv_prefix+set}" = set; then
+  withval="$with_libiconv_prefix"
+
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+
+fi;
+      LIBICONV=
+  LTLIBICONV=
+  INCICONV=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='iconv '
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value"
+          else
+                                    :
+          fi
+        else
+                              found_dir=
+          found_la=
+          found_so=
+          found_a=
+          if test $use_additional = yes; then
+            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+              found_dir="$additional_libdir"
+              found_so="$additional_libdir/lib$name.$shlibext"
+              if test -f "$additional_libdir/lib$name.la"; then
+                found_la="$additional_libdir/lib$name.la"
+              fi
+            else
+              if test -f "$additional_libdir/lib$name.$libext"; then
+                found_dir="$additional_libdir"
+                found_a="$additional_libdir/lib$name.$libext"
+                if test -f "$additional_libdir/lib$name.la"; then
+                  found_la="$additional_libdir/lib$name.la"
+                fi
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+                    found_dir="$dir"
+                    found_so="$dir/lib$name.$shlibext"
+                    if test -f "$dir/lib$name.la"; then
+                      found_la="$dir/lib$name.la"
+                    fi
+                  else
+                    if test -f "$dir/lib$name.$libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/lib$name.$libext"
+                      if test -f "$dir/lib$name.la"; then
+                        found_la="$dir/lib$name.la"
+                      fi
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
+                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+              else
+                                                                                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                                if test "$hardcode_direct" = yes; then
+                                                      LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                else
+                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                                                            haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                                                                                haveit=
+                    for x in $LDFLAGS $LIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
+                    fi
+                    if test "$hardcode_minus_L" != no; then
+                                                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
+                    else
+                                                                                                                                                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                                LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a"
+              else
+                                                LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
+              fi
+            fi
+                        additional_includedir=
+            case "$found_dir" in
+              */lib | */lib/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INCICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                                            INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+                        if test -n "$found_la"; then
+                                                        save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+                            for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/lib"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIBICONV; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                                                                  haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                                                                  haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                                        LIBICONV="${LIBICONV}${LIBICONV:+ }$dep"
+                    LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+                                                            LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
+            LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$hardcode_libdir_separator"; then
+                        alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+      done
+            acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+    else
+            for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+            for found_dir in $ltrpathdirs; do
+      LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
+    done
+  fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5
+echo $ECHO_N "checking for CFPreferencesCopyAppValue... $ECHO_C" >&6
+if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  gt_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
+     gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -framework CoreFoundation"
+     cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <CFPreferences.h>
+int
+main ()
+{
+CFPreferencesCopyAppValue(NULL, NULL)
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  gt_cv_func_CFPreferencesCopyAppValue=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gt_cv_func_CFPreferencesCopyAppValue=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+     CPPFLAGS="$gt_save_CPPFLAGS"
+     LIBS="$gt_save_LIBS"
+fi
+echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5
+echo "${ECHO_T}$gt_cv_func_CFPreferencesCopyAppValue" >&6
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CFPREFERENCESCOPYAPPVALUE 1
+_ACEOF
+
+  fi
+    echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5
+echo $ECHO_N "checking for CFLocaleCopyCurrent... $ECHO_C" >&6
+if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  gt_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
+     gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -framework CoreFoundation"
+     cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <CFLocale.h>
+int
+main ()
+{
+CFLocaleCopyCurrent();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  gt_cv_func_CFLocaleCopyCurrent=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gt_cv_func_CFLocaleCopyCurrent=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+     CPPFLAGS="$gt_save_CPPFLAGS"
+     LIBS="$gt_save_LIBS"
+fi
+echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5
+echo "${ECHO_T}$gt_cv_func_CFLocaleCopyCurrent" >&6
+  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CFLOCALECOPYCURRENT 1
+_ACEOF
+
+  fi
+  INTL_MACOSX_LIBS=
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+  fi
+
+
+
+
+  echo "$as_me:$LINENO: checking whether NLS is requested" >&5
+echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6
+    # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+  enableval="$enable_nls"
+  USE_NLS=$enableval
+else
+  USE_NLS=yes
+fi;
+  echo "$as_me:$LINENO: result: $USE_NLS" >&5
+echo "${ECHO_T}$USE_NLS" >&6
+
+
+
+
+  LIBINTL=
+  LTLIBINTL=
+  POSUB=
+
+    if test "$USE_NLS" = "yes"; then
+    gt_use_preinstalled_gnugettext=no
+
+
+
+
+
+
+        echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5
+echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6
+if test "${gt_cv_func_gnugettext1_libc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <libintl.h>
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+int
+main ()
+{
+bindtextdomain ("", "");
+return * gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  gt_cv_func_gnugettext1_libc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gt_cv_func_gnugettext1_libc=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5
+echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6
+
+        if test "$gt_cv_func_gnugettext1_libc" != "yes"; then
+
+
+
+
+
+          am_save_CPPFLAGS="$CPPFLAGS"
+
+  for element in $INCICONV; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+
+  echo "$as_me:$LINENO: checking for iconv" >&5
+echo $ECHO_N "checking for iconv... $ECHO_C" >&6
+if test "${am_cv_func_iconv+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <iconv.h>
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+       iconv(cd,NULL,NULL,NULL,NULL);
+       iconv_close(cd);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  am_cv_func_iconv=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <iconv.h>
+int
+main ()
+{
+iconv_t cd = iconv_open("","");
+         iconv(cd,NULL,NULL,NULL,NULL);
+         iconv_close(cd);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+      LIBS="$am_save_LIBS"
+    fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5
+echo "${ECHO_T}$am_cv_func_iconv" >&6
+  if test "$am_cv_func_iconv" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ICONV 1
+_ACEOF
+
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    echo "$as_me:$LINENO: checking how to link with libiconv" >&5
+echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6
+    echo "$as_me:$LINENO: result: $LIBICONV" >&5
+echo "${ECHO_T}$LIBICONV" >&6
+  else
+            CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+
+
+
+
+
+
+    use_additional=yes
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+
+# Check whether --with-libintl-prefix or --without-libintl-prefix was given.
+if test "${with_libintl_prefix+set}" = set; then
+  withval="$with_libintl_prefix"
+
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+
+fi;
+      LIBINTL=
+  LTLIBINTL=
+  INCINTL=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='intl '
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value"
+          else
+                                    :
+          fi
+        else
+                              found_dir=
+          found_la=
+          found_so=
+          found_a=
+          if test $use_additional = yes; then
+            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+              found_dir="$additional_libdir"
+              found_so="$additional_libdir/lib$name.$shlibext"
+              if test -f "$additional_libdir/lib$name.la"; then
+                found_la="$additional_libdir/lib$name.la"
+              fi
+            else
+              if test -f "$additional_libdir/lib$name.$libext"; then
+                found_dir="$additional_libdir"
+                found_a="$additional_libdir/lib$name.$libext"
+                if test -f "$additional_libdir/lib$name.la"; then
+                  found_la="$additional_libdir/lib$name.la"
+                fi
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+                    found_dir="$dir"
+                    found_so="$dir/lib$name.$shlibext"
+                    if test -f "$dir/lib$name.la"; then
+                      found_la="$dir/lib$name.la"
+                    fi
+                  else
+                    if test -f "$dir/lib$name.$libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/lib$name.$libext"
+                      if test -f "$dir/lib$name.la"; then
+                        found_la="$dir/lib$name.la"
+                      fi
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+                        LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
+                                LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+              else
+                                                                                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                                if test "$hardcode_direct" = yes; then
+                                                      LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+                else
+                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+                                                            LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+                                                            haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                                                                                haveit=
+                    for x in $LDFLAGS $LIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir"
+                    fi
+                    if test "$hardcode_minus_L" != no; then
+                                                                                        LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so"
+                    else
+                                                                                                                                                                                LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                                LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a"
+              else
+                                                LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name"
+              fi
+            fi
+                        additional_includedir=
+            case "$found_dir" in
+              */lib | */lib/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INCINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                                            INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+                        if test -n "$found_la"; then
+                                                        save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+                            for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/lib"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIBINTL; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                                                        LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                                                                  haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                                                                  haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                                        LIBINTL="${LIBINTL}${LIBINTL:+ }$dep"
+                    LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+                                                            LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name"
+            LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$hardcode_libdir_separator"; then
+                        alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+      done
+            acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
+    else
+            for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIBINTL="${LIBINTL}${LIBINTL:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+            for found_dir in $ltrpathdirs; do
+      LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir"
+    done
+  fi
+
+          echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5
+echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6
+if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  gt_save_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS $INCINTL"
+            gt_save_LIBS="$LIBS"
+            LIBS="$LIBS $LIBINTL"
+                        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <libintl.h>
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+int
+main ()
+{
+bindtextdomain ("", "");
+return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  gt_cv_func_gnugettext1_libintl=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+gt_cv_func_gnugettext1_libintl=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+                        if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then
+              LIBS="$LIBS $LIBICONV"
+              cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <libintl.h>
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+int
+main ()
+{
+bindtextdomain ("", "");
+return * gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias ("")
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  LIBINTL="$LIBINTL $LIBICONV"
+                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+                gt_cv_func_gnugettext1_libintl=yes
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+            fi
+            CPPFLAGS="$gt_save_CPPFLAGS"
+            LIBS="$gt_save_LIBS"
+fi
+echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5
+echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6
+        fi
+
+                                        if test "$gt_cv_func_gnugettext1_libc" = "yes" \
+           || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \
+                && test "$PACKAGE" != gettext-runtime \
+                && test "$PACKAGE" != gettext-tools; }; then
+          gt_use_preinstalled_gnugettext=yes
+        else
+                    LIBINTL=
+          LTLIBINTL=
+          INCINTL=
+        fi
+
+
+
+    if test -n "$INTL_MACOSX_LIBS"; then
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+                LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
+        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
+      fi
+    fi
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes" \
+       || test "$nls_cv_use_gnu_gettext" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define ENABLE_NLS 1
+_ACEOF
+
+    else
+      USE_NLS=no
+    fi
+  fi
+
+  echo "$as_me:$LINENO: checking whether to use NLS" >&5
+echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6
+  echo "$as_me:$LINENO: result: $USE_NLS" >&5
+echo "${ECHO_T}$USE_NLS" >&6
+  if test "$USE_NLS" = "yes"; then
+    echo "$as_me:$LINENO: checking where the gettext function comes from" >&5
+echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then
+        gt_source="external libintl"
+      else
+        gt_source="libc"
+      fi
+    else
+      gt_source="included intl directory"
+    fi
+    echo "$as_me:$LINENO: result: $gt_source" >&5
+echo "${ECHO_T}$gt_source" >&6
+  fi
+
+  if test "$USE_NLS" = "yes"; then
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then
+        echo "$as_me:$LINENO: checking how to link with libintl" >&5
+echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6
+        echo "$as_me:$LINENO: result: $LIBINTL" >&5
+echo "${ECHO_T}$LIBINTL" >&6
+
+  for element in $INCINTL; do
+    haveit=
+    for x in $CPPFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
+    fi
+  done
+
+      fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETTEXT 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DCGETTEXT 1
+_ACEOF
+
+    fi
+
+        POSUB=po
+  fi
+
+
+
+    INTLLIBS="$LIBINTL"
+
+
+
+
+
+
+
+          ac_config_headers="$ac_config_headers src/config.h"
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}xmlto", so it can be a program name with args.
+set dummy ${ac_tool_prefix}xmlto; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_have_xmlto+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$have_xmlto"; then
+  ac_cv_prog_have_xmlto="$have_xmlto" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_have_xmlto="${ac_tool_prefix}xmlto"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+have_xmlto=$ac_cv_prog_have_xmlto
+if test -n "$have_xmlto"; then
+  echo "$as_me:$LINENO: result: $have_xmlto" >&5
+echo "${ECHO_T}$have_xmlto" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_have_xmlto"; then
+  ac_ct_have_xmlto=$have_xmlto
+  # Extract the first word of "xmlto", so it can be a program name with args.
+set dummy xmlto; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_have_xmlto+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_have_xmlto"; then
+  ac_cv_prog_ac_ct_have_xmlto="$ac_ct_have_xmlto" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_have_xmlto="xmlto"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_have_xmlto" && ac_cv_prog_ac_ct_have_xmlto=""no""
+fi
+fi
+ac_ct_have_xmlto=$ac_cv_prog_ac_ct_have_xmlto
+if test -n "$ac_ct_have_xmlto"; then
+  echo "$as_me:$LINENO: result: $ac_ct_have_xmlto" >&5
+echo "${ECHO_T}$ac_ct_have_xmlto" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  have_xmlto=$ac_ct_have_xmlto
+else
+  have_xmlto="$ac_cv_prog_have_xmlto"
+fi
+
+if test "$have_xmlto" = "no";
+then
+    { { echo "$as_me:$LINENO: error: xmlto is not installed" >&5
+echo "$as_me: error: xmlto is not installed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}python", so it can be a program name with args.
+set dummy ${ac_tool_prefix}python; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_have_python+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$have_python"; then
+  ac_cv_prog_have_python="$have_python" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_have_python="${ac_tool_prefix}python"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+have_python=$ac_cv_prog_have_python
+if test -n "$have_python"; then
+  echo "$as_me:$LINENO: result: $have_python" >&5
+echo "${ECHO_T}$have_python" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_have_python"; then
+  ac_ct_have_python=$have_python
+  # Extract the first word of "python", so it can be a program name with args.
+set dummy python; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_have_python+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_have_python"; then
+  ac_cv_prog_ac_ct_have_python="$ac_ct_have_python" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_have_python="python"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_have_python" && ac_cv_prog_ac_ct_have_python=""no""
+fi
+fi
+ac_ct_have_python=$ac_cv_prog_ac_ct_have_python
+if test -n "$ac_ct_have_python"; then
+  echo "$as_me:$LINENO: result: $ac_ct_have_python" >&5
+echo "${ECHO_T}$ac_ct_have_python" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  have_python=$ac_ct_have_python
+else
+  have_python="$ac_cv_prog_have_python"
+fi
+
+if test "$have_python" = "no";
+then
+    { { echo "$as_me:$LINENO: error: python is not installed" >&5
+echo "$as_me: error: python is not installed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# Checks for libraries.
+
+echo "$as_me:$LINENO: checking for floor in -lm" >&5
+echo $ECHO_N "checking for floor in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_floor+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char floor ();
+int
+main ()
+{
+floor ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_floor=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_floor=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5
+echo "${ECHO_T}$ac_cv_lib_m_floor" >&6
+if test $ac_cv_lib_m_floor = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: math library is missing on your system." >&5
+echo "$as_me: error: math library is missing on your system." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+echo "$as_me:$LINENO: checking for newwin in -lncurses" >&5
+echo $ECHO_N "checking for newwin in -lncurses... $ECHO_C" >&6
+if test "${ac_cv_lib_ncurses_newwin+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lncurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char newwin ();
+int
+main ()
+{
+newwin ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_ncurses_newwin=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_ncurses_newwin=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_newwin" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_newwin" >&6
+if test $ac_cv_lib_ncurses_newwin = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBNCURSES 1
+_ACEOF
+
+  LIBS="-lncurses $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: ncurses library is missing on your system." >&5
+echo "$as_me: error: ncurses library is missing on your system." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+# Checks for header files.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in curses.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------- ##
+## Report this to stsp ##
+## ------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  { { echo "$as_me:$LINENO: error: curses headers are missing on your system." >&5
+echo "$as_me: error: curses headers are missing on your system." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+done
+
+
+
+
+for ac_header in fcntl.h sys/ioctl.h linux/kd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------- ##
+## Report this to stsp ##
+## ------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+if test $ac_cv_c_compiler_gnu = yes; then
+    echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+    ac_pattern="Autoconf.*'x'"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sgtty.h>
+Autoconf TIOCGETP
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then
+  ac_cv_prog_gcc_traditional=yes
+else
+  ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+  if test $ac_cv_prog_gcc_traditional = no; then
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then
+  ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+  fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
+  if test $ac_cv_prog_gcc_traditional = yes; then
+    CC="$CC -traditional"
+  fi
+fi
+
+
+for ac_func in vprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+echo "$as_me:$LINENO: checking for _doprnt" >&5
+echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6
+if test "${ac_cv_func__doprnt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define _doprnt innocuous__doprnt
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _doprnt (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef _doprnt
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char _doprnt ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+char (*f) () = _doprnt;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != _doprnt;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func__doprnt=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func__doprnt=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
+echo "${ECHO_T}$ac_cv_func__doprnt" >&6
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOPRNT 1
+_ACEOF
+
+fi
+
+fi
+done
+
+
+
+
+
+
+
+
+
+
+for ac_func in pow sqrt floor strcasecmp strncasecmp strchr strstr atexit
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  { { echo "$as_me:$LINENO: error: some functions are missing on your system." >&5
+echo "$as_me: error: some functions are missing on your system." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+done
+
+
+                                        ac_config_files="$ac_config_files Makefile src/Makefile po/Makefile.in doc/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[    ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[      ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by sst $as_me 2.0, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+                  instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+sst config.status 2.0
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
+    # from automake.
+    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+    # Capture the value of LINGUAS because we need it to compute CATALOGS.
+    LINGUAS="${LINGUAS-%UNSET%}"
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+  "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
+  "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+  "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
+s,@USE_NLS@,$USE_NLS,;t t
+s,@MSGFMT@,$MSGFMT,;t t
+s,@GMSGFMT@,$GMSGFMT,;t t
+s,@XGETTEXT@,$XGETTEXT,;t t
+s,@MSGMERGE@,$MSGMERGE,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@INTL_MACOSX_LIBS@,$INTL_MACOSX_LIBS,;t t
+s,@LIBICONV@,$LIBICONV,;t t
+s,@LTLIBICONV@,$LTLIBICONV,;t t
+s,@INTLLIBS@,$INTLLIBS,;t t
+s,@LIBINTL@,$LIBINTL,;t t
+s,@LTLIBINTL@,$LTLIBINTL,;t t
+s,@POSUB@,$POSUB,;t t
+s,@LN_S@,$LN_S,;t t
+s,@have_xmlto@,$have_xmlto,;t t
+s,@ac_ct_have_xmlto@,$ac_ct_have_xmlto,;t t
+s,@have_python@,$have_python,;t t
+s,@ac_ct_have_python@,$ac_ct_have_python,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                    sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([   ]*\)#\([        ]*define[       ][      ]*\)'
+ac_dB='[        ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([   ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        # Do quote $f, to prevent DOS paths from being IFS'd.
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[      ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status.  Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[    ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[     ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[     ]*#[    ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[     ]*#[    ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
+  fi
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $ac_file | $ac_file:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X$ac_file : 'X\(//\)[^/]' \| \
+        X$ac_file : 'X\(//\)$' \| \
+        X$ac_file : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_dest" : 'X\(//\)[^/]' \| \
+        X"$ac_dest" : 'X\(//\)$' \| \
+        X"$ac_dest" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    default-1 )
+    for ac_file in $CONFIG_FILES; do
+      # Support "outfile[:infile[:infile...]]"
+      case "$ac_file" in
+        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+      esac
+      # PO directories have a Makefile.in generated from Makefile.in.in.
+      case "$ac_file" in */Makefile.in)
+        # Adjust a relative srcdir.
+        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+        # In autoconf-2.13 it is called $ac_given_srcdir.
+        # In autoconf-2.50 it is called $srcdir.
+        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+        case "$ac_given_srcdir" in
+          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+          /*) top_srcdir="$ac_given_srcdir" ;;
+          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
+        esac
+        # Treat a directory as a PO directory if and only if it has a
+        # POTFILES.in file. This allows packages to have multiple PO
+        # directories under different names or in different locations.
+        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+          rm -f "$ac_dir/POTFILES"
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[  ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+          POMAKEFILEDEPS="POTFILES.in"
+          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
+          # on $ac_dir but don't depend on user-specified configuration
+          # parameters.
+          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+            # The LINGUAS file contains the set of available languages.
+            if test -n "$OBSOLETE_ALL_LINGUAS"; then
+              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+            fi
+            ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+            # Hide the ALL_LINGUAS assigment from automake.
+            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+          else
+            # The set of available languages was given in configure.in.
+            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+          fi
+          # Compute POFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+          # Compute UPDATEPOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+          # Compute DUMMYPOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+          # Compute GMOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+          case "$ac_given_srcdir" in
+            .) srcdirpre= ;;
+            *) srcdirpre='$(srcdir)/' ;;
+          esac
+          POFILES=
+          UPDATEPOFILES=
+          DUMMYPOFILES=
+          GMOFILES=
+          for lang in $ALL_LINGUAS; do
+            POFILES="$POFILES $srcdirpre$lang.po"
+            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+          done
+          # CATALOGS depends on both $ac_dir and the user's LINGUAS
+          # environment variable.
+          INST_LINGUAS=
+          if test -n "$ALL_LINGUAS"; then
+            for presentlang in $ALL_LINGUAS; do
+              useit=no
+              if test "%UNSET%" != "$LINGUAS"; then
+                desiredlanguages="$LINGUAS"
+              else
+                desiredlanguages="$ALL_LINGUAS"
+              fi
+              for desiredlang in $desiredlanguages; do
+                # Use the presentlang catalog if desiredlang is
+                #   a. equal to presentlang, or
+                #   b. a variant of presentlang (because in this case,
+                #      presentlang can be used as a fallback for messages
+                #      which are not translated in the desiredlang catalog).
+                case "$desiredlang" in
+                  "$presentlang"*) useit=yes;;
+                esac
+              done
+              if test $useit = yes; then
+                INST_LINGUAS="$INST_LINGUAS $presentlang"
+              fi
+            done
+          fi
+          CATALOGS=
+          if test -n "$INST_LINGUAS"; then
+            for lang in $INST_LINGUAS; do
+              CATALOGS="$CATALOGS $lang.gmo"
+            done
+          fi
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+            if test -f "$f"; then
+              case "$f" in
+                *.orig | *.bak | *~) ;;
+                *) cat "$f" >> "$ac_dir/Makefile" ;;
+              esac
+            fi
+          done
+        fi
+        ;;
+      esac
+    done ;;
+    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..5ac7654
--- /dev/null
@@ -0,0 +1,52 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.57)
+AC_INIT(sst, 2.0, stsp)
+AM_INIT_AUTOMAKE([])
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION(0.14.5)
+AM_CONFIG_HEADER([src/config.h])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LN_S
+
+AC_CHECK_TOOL(have_xmlto, xmlto, "no")
+if test "$have_xmlto" = "no";
+then
+    AC_MSG_ERROR([xmlto is not installed])
+fi
+AC_CHECK_TOOL(have_python, python, "no")
+if test "$have_python" = "no";
+then
+    AC_MSG_ERROR([python is not installed])
+fi
+
+# Checks for libraries.
+AC_CHECK_LIB(m, floor, [],
+    AC_MSG_ERROR([math library is missing on your system.]))
+AC_CHECK_LIB(ncurses, newwin, [],
+    AC_MSG_ERROR([ncurses library is missing on your system.]))
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([curses.h],
+    [], AC_MSG_ERROR([curses headers are missing on your system.]))
+AC_CHECK_HEADERS([fcntl.h sys/ioctl.h linux/kd.h])
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+AC_PROG_GCC_TRADITIONAL
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([pow sqrt floor strcasecmp strncasecmp strchr strstr atexit], [],
+    AC_MSG_ERROR([some functions are missing on your system.]))
+
+AC_CONFIG_FILES([
+    Makefile
+    src/Makefile
+    po/Makefile.in
+    doc/Makefile
+])
+AC_OUTPUT
diff --git a/depcomp b/depcomp
new file mode 100755 (executable)
index 0000000..04701da
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+       set fnord "$@"
+       shift
+       shift
+       ;;
+    *)
+       set fnord "$@" "$arg"
+       shift
+       shift
+       ;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
+  echo "       " >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644 (file)
index 0000000..ee2477f
--- /dev/null
@@ -0,0 +1,15 @@
+man_MANS = sst.6
+pkgdata_DATA = sst-doc.txt sst.doc
+CLEANFILES = $(pkgdata_DATA) $(man_MANS)
+EXTRA_DIST = makehelp.py sst-doc.xml sst-layer.xsl sst.xml
+
+sst.6: sst.xml
+       xmlto man sst.xml
+
+sst-doc.txt: sst-doc.xml
+       xmlto -m sst-layer.xsl txt sst-doc.xml
+sst.doc: sst-doc.txt
+       makehelp.py >sst.doc
+
+sst-doc.html: sst-doc.xml
+       xmlto xhtml-nochunks sst-doc.xml
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644 (file)
index 0000000..221b947
--- /dev/null
@@ -0,0 +1,400 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+man6dir = $(mandir)/man6
+am__installdirs = "$(DESTDIR)$(man6dir)" "$(DESTDIR)$(pkgdatadir)"
+NROFF = nroff
+MANS = $(man_MANS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+pkgdataDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkgdata_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_ct_have_python = @ac_ct_have_python@
+ac_ct_have_xmlto = @ac_ct_have_xmlto@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+have_python = @have_python@
+have_xmlto = @have_xmlto@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+man_MANS = sst.6
+pkgdata_DATA = sst-doc.txt sst.doc
+CLEANFILES = $(pkgdata_DATA) $(man_MANS)
+EXTRA_DIST = makehelp.py sst-doc.xml sst-layer.xsl sst.xml
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  doc/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-man6: $(man6_MANS) $(man_MANS)
+       @$(NORMAL_INSTALL)
+       test -z "$(man6dir)" || $(mkdir_p) "$(DESTDIR)$(man6dir)"
+       @list='$(man6_MANS) $(dist_man6_MANS) $(nodist_man6_MANS)'; \
+       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+       for i in $$l2; do \
+         case "$$i" in \
+           *.6*) list="$$list $$i" ;; \
+         esac; \
+       done; \
+       for i in $$list; do \
+         if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+         else file=$$i; fi; \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           6*) ;; \
+           *) ext='6' ;; \
+         esac; \
+         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+         inst=`echo $$inst | sed -e 's/^.*\///'`; \
+         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+         echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man6dir)/$$inst'"; \
+         $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man6dir)/$$inst"; \
+       done
+uninstall-man6:
+       @$(NORMAL_UNINSTALL)
+       @list='$(man6_MANS) $(dist_man6_MANS) $(nodist_man6_MANS)'; \
+       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+       for i in $$l2; do \
+         case "$$i" in \
+           *.6*) list="$$list $$i" ;; \
+         esac; \
+       done; \
+       for i in $$list; do \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           6*) ;; \
+           *) ext='6' ;; \
+         esac; \
+         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+         inst=`echo $$inst | sed -e 's/^.*\///'`; \
+         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+         echo " rm -f '$(DESTDIR)$(man6dir)/$$inst'"; \
+         rm -f "$(DESTDIR)$(man6dir)/$$inst"; \
+       done
+install-pkgdataDATA: $(pkgdata_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
+       @list='$(pkgdata_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
+         $(pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
+       done
+
+uninstall-pkgdataDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkgdata_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
+         rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS) $(DATA)
+installdirs:
+       for dir in "$(DESTDIR)$(man6dir)" "$(DESTDIR)$(pkgdatadir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man install-pkgdataDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man: install-man6
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-man uninstall-pkgdataDATA
+
+uninstall-man: uninstall-man6
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-man6 install-pkgdataDATA install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+       pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \
+       uninstall-man uninstall-man6 uninstall-pkgdataDATA
+
+
+sst.6: sst.xml
+       xmlto man sst.xml
+
+sst-doc.txt: sst-doc.xml
+       xmlto -m sst-layer.xsl txt sst-doc.xml
+sst.doc: sst-doc.txt
+       makehelp.py >sst.doc
+
+sst-doc.html: sst-doc.xml
+       xmlto xhtml-nochunks sst-doc.xml
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/makehelp.py b/doc/makehelp.py
new file mode 100755 (executable)
index 0000000..0a171f2
--- /dev/null
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+#
+# Generate an on-line help file for SST 2K from the text generated from
+# the XML documentation.
+#
+# By Eric S. Raymond for the Super Star Trek project
+import os, re, sys
+
+enddelim = "********\n"
+
+# This is the part most likely to bit-rot
+beginmarker1 = "Mnemonic:"
+endmarker1 = "Miscellaneous Notes"
+beginmarker2 = " ABBREV"
+endmarker2 = "Game History and Modifications"
+
+fp = open("sst-doc.txt", "r")
+savetext = ""
+state = 0
+while True:
+    line = fp.readline()
+    if not line:
+        break
+    if state == 0 and line.startswith(beginmarker1):
+        line = "%% " + line[12:].lstrip()
+        state = 1
+    if state == 0 and line.startswith(beginmarker2):
+        savetext += enddelim + "%% ABBREV\n"
+        state = 2
+    if state == 1:
+        if line.find(endmarker1) > -1:
+            state = 0
+    if state == 2:
+        if line.find(endmarker2) > -1:
+            state = 0
+    if state:
+        savetext += line
+
+# Remove the section titles
+savetext = re.sub("\n+.*\n*Mnemonic:\\s*", "\n********\n%% ", savetext)
+
+# Hack Unicode non-breaking spaces into ordinary spaces
+savetext = savetext.replace("\xc2\xa0", " ").replace("\240", "")
+
+sys.stdout.write(savetext + enddelim)
diff --git a/doc/sst-doc.xml b/doc/sst-doc.xml
new file mode 100644 (file)
index 0000000..8510e6d
--- /dev/null
@@ -0,0 +1,1964 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE book PUBLIC 
+    "-//OASIS//DTD DocBook XML V4.1.2//EN" 
+    "docbook/docbookxx.dtd"[
+<!ENTITY sst-site      "http://sst.berlios.de/">
+<!ENTITY retro         "http://catb.org/~esr/retro/">
+]>
+<book>
+<bookinfo>
+<title>Super Star Trek</title>
+
+<authorgroup>
+<author>
+  <firstname>David</firstname>
+  <surname>Matuzsek</surname>
+</author>
+<author>
+  <firstname>Paul</firstname>
+  <surname>Reynolds</surname>
+</author>
+<author>
+  <firstname>Tom</firstname>
+  <surname>Almy</surname>
+</author>
+<author>
+  <firstname>Stas</firstname>
+  <surname>Sergeev</surname>
+</author>
+<author>
+  <firstname>Eric</firstname>
+  <othername>Steven</othername>
+  <surname>Raymond</surname>
+</author>
+</authorgroup>
+
+<legalnotice>
+<para>Permission is hereby granted for the copying, distribution,
+modification and use of this program and associated documentation
+for recreational purposes, provided that all references to the
+authors are retained.  However, permission is not and will not be
+granted for the sale or promotional use of this program or program
+documentation, or for use in any situation in which profit may be
+considered an objective, since it is the desire of the authors to
+respect the copyrights of the originators of Star Trek.</para>
+</legalnotice>
+</bookinfo>
+
+
+<dedication>
+<literallayout format='linespecific' class='monospaced'>
+                SSSSS   U   U   PPPPP   EEEEE   RRRRR
+                S       U   U   P   P   E       R   R
+                SSSSS   U   U   PPPPP   EEEE    RRRRR
+                    S   U   U   P       E       R  R
+                SSSSS   UUUUU   P       EEEEE   R   R
+
+
+                 SSSSSSS  TTTTTTTT     A     RRRRRRR
+                SSSSSSSS  TTTTTTTT    AAA    RRRRRRRR
+               SS            TT       AAA    RR     RR
+               SSSSSSS       TT      AA AA   RR     RR
+                SSSSSSS      TT      AA AA   RRRRRRRR
+                      SS     TT     AAAAAAA  RRRRRRR
+                      SS     TT     AAAAAAA  RR   RR
+               SSSSSSSS      TT    AA     AA RR    RR
+               SSSSSSS       TT    AA     AA RR     RR
+    
+    
+    
+                TTTTTTTT RRRRRRR   EEEEEEEEE KK     KK
+                TTTTTTTT RRRRRRRR  EEEEEEEEE KK    KK
+                   TT    RR     RR EE        KK   KK
+                   TT    RR     RR EEEEEE    KKKKKK
+                   TT    RRRRRRRR  EEEEEE    KKKKK
+                   TT    RRRRRRR   EE        KK  KK
+                   TT    RR   RR   EE        KK   KK
+                   TT    RR    RR  EEEEEEEEE KK    KK
+                   TT    RR     RR EEEEEEEEE KK     KK
+
+
+                     Produced For Your Enjoyment
+
+                                 By
+
+                            David Matuszek
+                                 and
+                            Paul Reynolds
+
+                        With Modifications By
+                              Don Smith
+
+                            Resurrected By
+                               Tom Almy
+
+                         Curses Interface By
+                              Stas Sergeev 
+
+               SST 2K polishing and historical research by
+                            Eric S. Raymond
+</literallayout>
+</dedication>
+
+<chapter><title>Introduction</title>
+<para>The Organian Peace Treaty has collapsed, and the Federation is at war
+with the Klingon Empire.  Joining the Klingons against the Federation
+are the members of the <quote>Romulan Star Empire.</quote>  As commander of the
+Starship U.S.S. Enterprise, your job is to wipe out the Klingon
+invasion fleet and make the galaxy safe for democracy.</para>
+
+<para>Your battleground is the entire galaxy, which for convenience is
+divided up into eight rows of eight quadrants each, like a
+checkerboard.  Rows are numbered from top to bottom, and columns are
+numbered left to right, so quadrant 1 - 8 would be in the upper right
+hand corner of the galaxy.</para>
+
+<para>During battle you will be concerned only with those enemies that
+occupy the same quadrant as yourself.  Quadrants are divided up into
+sectors: ten rows of ten sectors each. Sectors are numbered in the
+same way as quadrants, so the sector in the upper right corner is
+sector 1 - 10.  You have a short-range scanner which allows you to
+look at the entire quadrant in a single display.</para>
+
+<para>Enemies recharge during your absence.  If you leave a quadrant
+containing a weakened enemy, when you return to that quadrant he will
+be strong again.  Also, each time you enter a quadrant, the positions
+of everthing in the quadrant (except your ship) are randomized, to
+save you the trouble of trying to remember where everything in the
+quadrant is.  Notice that this refers only to the positions of things
+in the quadrant&mdash;the numbers of each kind of thing are not changed
+(except for black holes and the Super-commander, which move around
+the galaxy).  If you kill something, it stays dead.</para>
+
+<para>The Romulans are not as serious a threat to the Federation as the
+Klingons.  For one thing, there are not as many of them.  For
+another, the Romulans are not as treacherous.  However, Romulans are
+not to be trifled with, especially when you are in violation of the
+Romulan Neutral Zone.</para>
+
+<para>There are two kinds of Klingons: Ordinary Klingons, which are
+bad enough, and Klingon Commanders, which are even worse.  Commanders
+are about three times stronger than ordinary Klingons.  Commanders are
+more resistant to your weapons.  Commanders can move about during
+battle while Ordinary Klingons stay put.  And finally, Commanders have
+a thing called a <quote>long-range tractor beam</quote> which they can
+use, at random intervals, to yank you away from what you are doing
+into their quadrant, to do battle with them.  There is also a special
+commander, called the <quote>Super-commander.</quote> This character
+is so bad he is reserved for the Good, Expert, and Emeritus games.
+Fortunately, there is just one Super-commander in a game.  In addition
+to the undesirable traits of Commanders, he can move from quadrant to
+quadrant at will, seeking out and destroying your starbases and any
+helpful planets he runs across.  He also has a spy planted aboard your
+ship, giving him valuable information about your condition.  Using
+this information, he can do dastardly things like tractor beam your
+ship when you are in bad shape.  And once you've been tractor beamed
+by the Super-commander &mdash;</para>
+
+<para>But the advantages are not all on the side of the enemy.  Your ship
+is more powerful, and has better weapons.  Besides, in the this
+galaxy there are from two to five starbases, at which you can stop to
+refuel and lick your wounds, safe from phaser attack or tractor
+beams.  But you had best not dally there too long, since time is not
+on your side.  The Klingons are not just after you; they are
+attacking the entire Federation.  There is always a finite <quote>time
+left,</quote> which is how much longer the Federation can hold out if you
+just sit on your fat behind and do nothing.  As you wipe out
+Klingons, you reduce the rate at which the invasion fleet weakens the
+Federation, and so the time left until the Federation collapses may
+actually increase.  Since Klingons are the main threat to the
+Federation, the Romulans do not figure into the <quote>time left.</quote>  In
+fact, you need not kill all the Romulans to win.  If you can get all
+the Klingons, the Federation will abide forever, and you have won the
+game.</para>
+
+<para>Space is vast, and it takes precious time to move from one place to
+another.  In comparison, other things happen so quickly that we
+assume they take no time at all. Two ways that time can pass are when
+you move, or when you issue a command to sit still and rest for a
+period of time.  You will sometimes want to do the latter, since the
+various devices aboard your starship may be damaged and require time
+to repair.  Of course, repairs can be made more quickly at a starbase
+than than can in flight.</para>
+
+<para>In addition to Klingons, Romulans, and starbases, the galaxy
+contains (surprise) stars.  Mostly, stars are a nuisance and just get
+in your way.  You can trigger a star into going nova by shooting one
+of your photon torpedoes at it.  When a star novas, it does a lot of
+dammage to anything immediately adjacent to it.  If another star is
+adjacent to a nova, it too will go nova.  Stars may also occasionally
+go supernova; a supernova in a quadrant destroys everything in the
+quadrant andmakes the quadrant permanently uninhabitable.  You may
+<quote>jump over</quote> a quadrant containing a supernova when you
+move, but you should not stop there.</para>
+
+<para>Supernovas may happen spontaneously, without provocation.  If a
+supernova occurs in the same quadrant you are in, your starship has an
+<quote>emergency automatic override</quote> which picks some random
+direction and some random warp factor, and tries to throw you clear of
+the supernova. If the supernova occurs in some other quadrant, you
+just get a warning message from starfleet about it (provided, of
+course, that your subspace radio is working).</para>
+
+<para>Also a few planets are scattered through the galaxy.  These can
+sometimes be a great help since some of them will have <quote>dilithium
+crystals,</quote> which are capable of replenishing the ship's energy
+supply.  You can either beam down to the planet surface using the
+transporter, or take the shuttle craft <quote>Galileo</quote>.</para>
+
+<para>Finally, each quadrant will contain from zero to three black
+holes.  These can deflect or swallow torpedoes passing near them. They
+also swallow enemy ships knocked into them.  If your ship enters one
+&mdash;</para>
+
+<para>Star Trek is a rich game, full of detail.  These instructions are
+written at a moderate level&mdash;no attempt has been made fully to
+describe everything about the game, but there is quite a bit more
+here than you need to get started.  If you are new to the game, just
+get a rough idea of the kinds of commands available, and start
+playing.  After a game or two you will have learned everthing
+important, and the detailed command descriptions which follow will be
+a lot more meaningful to you.</para>
+
+<para>You have weapons: phasers and photon torpedoes. You have a defense:
+deflector shields.  You can look at things: long-range scaners,
+short-range scanners, and a star chart.  You can move about, under
+warp drive or impulse power.  You can also dock at a starbase, rest
+while repairs are being made, abandon ship, self destruct, or give up
+and start a new game.</para>
+
+<para>The Klingons are waiting.</para>
+
+</chapter>
+<chapter><title>Starting the Game</title>
+
+<para>The program will ask you some setup questions.  You can give it 
+command-line arguments that will be treated as answers.  Any token
+may be abbreviated to a unique prefix.</para>
+
+<para>The first question concerns whether you want a regullar,
+tournament, or saved game.  For discussion, see the <link
+linkend="freeze">description of the freeze command</link>.</para>
+
+<para>The second question will concern the length of the game.  
+Longer games include more enemies.</para>
+
+<para>The third question will set the game's difficulty level.
+You should probably start out at the novice level, even if you are
+already familiar with one of the other versions of the Star Trek
+game&mdash;but, of course, the level of game you play is up to you.  If
+you want to start at the Expert level, go ahead.  It's your funeral.
+The Emeritus game is strictly for masochists.</para>
+
+<para>The fourth question, new in SST2K, sets your game options.  A
+blank answer or 'fancy' enables all SST2K features.  The option
+'plain' disables a number of features (Tholians, planets &amp;
+dilithium, Thingies shooting back, deep-space-probes, Klingon ramming
+and movement, time-warping through black holes, death-ray upgrade),
+approximating the original CDC 6600 FORTRAN game from UT Austin.  The
+option 'almy' approximates Tom Almy's C translation from 1979,
+disabling Thingies shooting back, base shields, and time-warping
+through black holes.</para>
+
+</chapter>
+<chapter><title>How To Issue Commands</title>
+
+<para>When the game is waiting for you to enter a command it will
+print out</para>
+
+<screen>
+       COMMAND>
+</screen>
+
+<para>You may then type in your command.  All you have to remember for each
+command is the mnemonic. For example, if you want to move straight up
+one quadrant, you can type in the mnemonic (case insensitive)</para>
+
+<screen>
+       move
+</screen>
+
+<para>and the computer will prompt you with</para>
+
+<screen>
+       Manual or automatic- 
+</screen>
+
+<para>Say you type in <quote>manual</quote>. The computer then responds</para>
+
+<screen>
+       X and Y displacements- 
+</screen>
+
+<para>Now you type in <quote>0 1</quote> which specifies an X movement of zero and a Y
+movement of one.</para>
+
+<para>When you have learned the commands, you can avoid being prompted
+simply by typing in the information without waiting to be asked for
+it. For example, in the above example, you could simply type in</para>
+
+<screen>
+       move manual 0 1
+</screen>
+
+<para>and it will be done.  Or you could type in</para>
+
+<screen>
+       move manual
+</screen>
+
+<para>and when the computer responds with the displacement prompt, you
+can type in</para>
+
+<screen>
+       0 1
+</screen>
+
+<para>and it will understand.</para>
+
+<para>You can abbreviate most mnemonics.  For <quote>move</quote>, you can use any
+of</para>
+
+<screen>
+       move mov mo m
+</screen>
+
+<para>successfully.  For your safety, certain critical commands (such as to
+abandon ship) must be written out in full.  Also, in a few cases two
+or more commands begin with the same letter, and in this case that
+letter refers to a particular one of the commands; to get the other,
+your abbreviation must be two or more characters long.  This sounds
+complicated, but you will learn the abbreviations qGuickly enough.</para>
+
+<para>What this all boils down to is:</para>
+
+<orderedlist>
+<listitem><para>You can abbreviate practically anything</para></listitem>
+<listitem><para>If you forget, the computer will prompt you</para></listitem>
+<listitem><para>If you remember, you can type it all on one line</para></listitem>
+</orderedlist>
+
+<para>If you are part way through entering a command and you change your
+minde, you can cancel the command by typing -1 as one of the
+parameters, with the exception of the manual move command.</para>
+
+<para>If anything is not clear to you, experiment.  The worst you can do is
+lose a game or two.</para>
+
+</chapter>
+<chapter><title>List of Commands</title>
+
+<sect1><title>Short-Range Scan</title>
+
+<literallayout>
+Mnemonic:  SRSCAN
+Shortest abbreviation:  S
+Full commands:  SRSCAN
+                SRSCAN NO
+                SRSCAN CHART
+</literallayout>
+
+<!-- This is new in SST 2K -->
+<para>If you are using the screen-oriented interface, this command is
+suppressed; instead, a short-range scan will always be present on the
+screen.</para>
+
+<para>The short-range scan gives you a considerable amount of information
+about the quadrant your starship is in.  A short-range scan is best
+described by an example.</para>
+
+<screen>
+         1 2 3 4 5 6 7 8 9 10
+      1  * . . . . R . . . .  Stardate      2516.3
+      2  . . . E . . . . . .  Condition     RED  
+      3  . . . . . * . B . .  Position      5 - 1, 2 - 4
+      4  . . . S . . . . . .  Life Support  DAMAGED, Reserves=2.30
+      5  . . . . . . . K . .  Warp Factor   5.0
+      6  . K .   . . . . * .  Energy        2176.24
+      7  . . . . . P . . . .  Torpedoes     3
+      8  . . . . * . . . . .  Shields       UP, 42% 1050.0 units
+      9  . * . . * . . . C .  Klingons Left 12
+     10  . . . . . . . . . .  Time Left     3.72
+</screen>
+
+<para>The left part is a picture of the quadrant.  The E at sector 2 -
+4 represents the Enterprise; the B at sector 3 - 8 is a starbase.
+There are ordinary Klingons (K) at sectors 5 - 8 and 6 - 2, and a
+Klingon Commander (C) at 9 - 9.  The (GULP)
+<quote>Super-commander</quote> (S) is occupies sector 4 - 4, and a
+Romulan (R) is at 1 - 6.  A planet (P) is at sector 7 - 6.  There are
+also a large number of stars (*). The periods (.) are just empty
+space&mdash;they are printed to help you get your bearings.  Sector 6
+- 4 contains a black hole ( ).</para>
+
+<para>The information on the right is assorted status information. You
+can get this alone with the STATUS command.  The status information
+will be absent if you type <quote>N</quote> after SRSCAN.  Otherwise
+status information will be presented.</para>
+
+<para>If you type <quote>C</quote> after SRSCAN, you will be given a
+short-range scan and a Star Chart.</para>
+
+<para>Short-range scans are free.  That is, they use up no energy and no
+time.  If you are in battle, doing a short-range scan does not give
+the enemies another chance to hit you.  You can safely do a
+short-range scan anytime you like.</para>
+
+<para>If your short-range sensors are damaged, this command will only show
+the contents of adjacent sectors.</para>
+</sect1>
+<sect1><title>Status Report</title>
+
+<literallayout>
+Mnemonic:  STATUS
+Shortest abbreviation: ST
+</literallayout>
+
+<!-- This is new in SST 2K --> 
+<para>If you are using the screen-oriented interface, this command is
+suppressed; instead, a full status report will always be present on the
+screen.</para>
+
+<para>This command gives you information about the current state of your
+starship as follows:</para>
+
+<variablelist>
+<varlistentry>
+<term>STARDATE</term>
+<listitem>
+<para>The current date. A stardate is the same as a day.</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>CONDITION</term>
+<listitem>
+<para>There are four possible conditions:</para>
+    <variablelist>
+    <varlistentry>
+    <term>DOCKED</term>
+    <listitem><para>docked at starbase.</para></listitem>
+    </varlistentry>
+    <varlistentry>
+    <term>RED</term>
+    <listitem><para>in battle.</para></listitem>
+    </varlistentry>
+    <varlistentry>
+    <term>YELLOW</term>
+    <listitem><para>low on energy (&lt;1000 units)</para></listitem>
+    </varlistentry>
+    <varlistentry>
+    <term>GREEN</term>
+    <listitem><para>none of the above</para></listitem>
+    </varlistentry>
+    </variablelist>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>POSITION</term>
+<listitem>
+<para>Quadrant is given first, then sector</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>LIFE SUPPOR</term>
+<listitem>
+<para>If <quote>ACTIVE</quote> then life support systems are functioning
+normally. If on <quote>RESERVES</quote> the number is how many stardates your
+reserve food, air, etc. will last&mdash;you must get repairs made or get to
+starbase before your reserves run out.</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>WARP FACTOR</term>
+<listitem>
+<para>What your warp factor is currently set to.</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>ENERGY</term>
+<listitem>
+<para>The amount of energy you have left. If it drops to zero, you die.</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>TORPEDOES</term>
+<listitem>
+<para>How many photon torpedoes you have left.</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>SHIELDS</term>
+<listitem>
+<para>Whether your shields are up or down, how strong they are
+(what percentage of a hit they can deflect), and shield energy.</para> 
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>KLINGONS LEFT</term>
+<listitem>
+<para>How many of the Klingons are still out there.</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>TIME LEFT</term>
+<listitem>
+<para>How long the Federation can hold out against the
+present number of Klingons; that is, how long until the end
+if you do nothing in the meantime.  If you kill Klingons
+quickly, this number will go up&mdash;if not, it will go down.  If
+it reaches zero, the federation is conquered and you lose.</para>
+</listitem>
+</varlistentry>
+</variablelist>
+
+<para>Status information is free&mdash;it uses no time or energy, and
+if you are in battle, the Klingons are not given another chance to hit
+you.</para>
+
+<para>Status information can also be obtained by doing a short-range scan.
+See the SRSCAN command for details.</para>
+
+<para>Each item of information can be obtained singly by requesting it.
+See REQUEST command for details.</para>
+
+</sect1>
+<sect1><title>Long-Range Scan</title>
+
+<literallayout>
+Mnemonic:  LRSCAN
+Shortest abbreviation:  L
+</literallayout>
+
+<!-- This is new in SST 2K --> 
+<para>If you are using the screen-oriented interface, this command is
+suppressed; instead, a long-range scan will always be present on the
+screen.</para>
+
+<para>A long-range scan gives you general information about where you are
+and what is around you.  Here is an example output.</para>
+
+<screen>
+    Long-range scan for Quadrant 5 - 1
+       -1  107  103
+       -1  316    5
+       -1  105 1000
+</screen>
+
+<para>This scan says that you are in row 5, column 1 of the 8 by 8 galaxy.
+The numbers in the scan indicate how many of each kind of thing there
+is in your quadrant and all adjacent quadrants.  The digits are
+interpreted as follows.</para>
+
+<informaltable>
+<tgroup cols='2'>
+<tbody>
+<row>
+  <entry>Thousands digit:</entry>
+  <entry>1000 indicates a supernova (only)</entry>
+</row>
+<row>
+  <entry>Hundreds digit:</entry>
+  <entry>number of Klingons present</entry>
+</row>
+<row>
+  <entry>Tens digit:</entry>
+  <entry>number of starbases present</entry>
+</row>
+<row>
+  <entry>Ones digit:</entry>
+  <entry>number of stars present</entry>
+</row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>For example, in your quadrant (5 - 1) the number is 316, which
+indicates 3 Klingons, 1 starbase, and 6 stars.  The long-range
+scanner does not distinguish between ordinary Klingons and Klingon
+command ships.  If there is a supernova, as in the quadrant below and
+to your right (quadrant 6 - 2), there is nothing else in the
+quadrant. </para>
+
+<para>Romulans possess a <quote>cloaking device</quote> which prevents
+their detection by long-range scan.  Because of this fact, Starfleet
+Command is never sure how many Romulans are <quote>out there</quote>.
+When you kill the last Klingon, the remaining Romulans surrender to
+the Federation.</para>
+
+<para>Planets are also undetectable by long-range scan.  The only way to
+detect a planet is to find it in your current quadrant with the
+short-range sensors.</para>
+
+<para>Since you are in column 1, there are no quadrants to your left. The
+minus ones indicate the negative energy barrier at the edge of the
+galaxy, which you are not permitted to cross.</para>
+
+<para>Long-range scans are free.  They use up no energy or time, and can be
+done safely regardless of battle conditions.</para>
+</sect1>
+<sect1><title>Star Chart</title>
+
+<literallayout>
+Mnemonic:  CHART
+Shortest abbreviation:  C
+</literallayout>
+
+<para>As you proceed in the game, you learn more and more about what things
+are where in the galaxy. When ever you first do a scan in a quadrant,
+telemetry sensors are ejected which will report any changes in the
+quadrant(s) back to your ship, providing the sub-space radio is
+working. Spock will enter this information in the chart. If the radio
+is not working, Spock can only enter new information discovered from
+scans, and information in other quadrants may be obsolete.</para>
+
+<para>The chart looks like an 8 by 8 array of numbers.  These numbers are
+interpreted exactly as they are on a long-range scan. A period (.) in
+place of a digit means you do not know that information yet.  For
+example, ... means you know nothing about the quadrant, while .1.
+menas you know it contains a base, but an unknown number of Klingons
+and stars.</para>
+
+<para>Looking at the star chart is a free operation.  It costs neither time
+nor energy, and can be done safely whether in or out of battle.</para>
+
+</sect1>
+<sect1><title>Damage Report</title>
+
+<literallayout>
+Mnemonic:  DAMAGES
+Shortest abbreviation:  DA
+</literallayout>
+
+<para>At any time you may ask for a damage report to find out what devices
+are damaged and how long it will take to repair them.  Naturally,
+repairs proceed faster at a starbase.</para>
+
+<para>If you suffer damages while moving, it is possible that a subsequent
+damage report will not show any damage.  This happens if the time
+spent on the move exceeds the repair time, since in this case the
+damaged devices were fixed en route.</para>
+
+<para>Damage reports are free.  They use no energy or time, and can be done
+safely even in the midst of battle.</para>
+
+</sect1>
+<sect1><title>Move Under Warp Drive</title>
+
+<literallayout>
+Mnemonic:  MOVE
+Shortest abbreviation:  M
+Full command:  MOVE MANUAL &lt;displacement&gt;
+               MOVE AUTOMATIC &lt;destination&gt;
+</literallayout>
+
+<para>This command is the usual way to move from one place to another
+within the galaxy.  You move under warp drive, according to the
+current warp factor (see <quote>WARP FACTOR</quote>).</para>
+
+<para>There are two command modes for movement: MANUAL and AUTOMATIC.
+The manual mode requires the following format:</para>
+
+<screen>
+       MOVE MANUAL &lt;deltax&gt; &lt;deltay&gt;
+</screen>
+
+<para>&lt;deltax&gt; and &lt;deltay&gt; are the horizontal and vertical
+displacements for your starship, in quadrants; a displacement of one
+sector is 0.1 quadrants.  Specifying &lt;deltax&gt; and &lt;deltay&gt;
+causes your ship to move in a straight line to the specified
+destination. If &lt;deltay&gt; is omitted, it is assumed zero. For
+example, the shortest possible command to move one sector to the right
+would be</para>
+
+<screen>
+       M M .1
+</screen>
+
+<para>The following examples of manual movement refer to the short-range
+scan shown earlier.</para>
+
+<screen>
+  Destination Sector   Manual Movement command
+       3 - 1                   M M -.3 -.1
+       2 - 1                   M M -.3
+       1 - 2                   M M -.2 .1
+       1 - 4                   M M 0 .1
+  (leaving quadrant)           M M 0 .2
+</screen>
+
+<para>The automatic mode is as follows:</para>
+
+<screen>
+       MOVE AUTOMATIC &lt;qrow&gt; &lt;qcol&gt; &lt;srow&gt; &lt;scol&gt;
+</screen>
+
+<para>&lt;para&gt;where &lt;qrow&gt; and &lt;qcol&gt; are the row and column
+numbers of the destination quadrant, and &lt;srow&gt; and &lt;scol&gt;
+are the row and column numbers of the destination sector in that
+quadrant.  This command also moves your ship in a straight line path
+to the destination.  For moving within a quadrant, &lt;qrow&gt; and
+&lt;qcol&gt; may be omitted. For example, to move to sector 2 - 9 in
+the current quadrant, the shortest command would be</para>
+
+<screen>
+       M A 2 9
+</screen>
+
+<para>To move to quadrant 3 - 7, sector 5 - 8, type</para>
+
+<screen>
+       M A 3 7 5 8
+</screen>
+
+<para>and it will be done.  In automatic mode, either two or four numbers
+must be supplied.</para>
+
+<para>Automatic mode utilizes the ship's <quote>battle computer.</quote>  If the
+computer is damaged, manual movement must be used.</para>
+
+<para>If warp engines are damaged less than 10 stardates (undocked) you can
+still go warp 4.</para>
+
+<para>It uses time and energy to move.  How much time and how much energy
+depends on your current warp factor, the distance you move, and
+whether your shields are up.  The higher the warp factor, the faster
+you move, but higher warp factors require more energy.  You may move
+with your shields up, but this doubles the energy required.</para>
+
+<para>You can move within a quadrant without being attacked if you just
+entered the quadrant or have been attacked since your last move
+command.  This enables you to move and hit them before they
+retaliate.</para>
+
+</sect1>
+<sect1><title>Warp Factor</title>
+
+<literallayout>
+Mnemonic:  WARP
+Shortest abbreviation:  W
+Full command:  WARP &lt;number&gt;
+</literallayout>
+
+<para>Your warp factor controls the speed of your starship.  The larger the
+warp factor, the faster you go and the more energy you use.</para>
+
+<para>Your minimum warp factor is 1.0 and your maximum warp factor is 10.0
+(which is 100 times as fast and uses 1000 times as much energy).  At
+speeds above warp 6 there is some danger of causing damage to your
+warp engines; this damage is larger at higher warp factors and also
+depends on how far you go at that warp factor.</para>
+
+<para>At exactly warp 10 there is some probability of entering a
+so-called <quote>time warp</quote> and being thrown foward or backward
+in time.  The farther you go at warp 10, the greater is the
+probability of entering the time warp.</para>
+
+</sect1>
+<sect1><title>Impulse Engines</title>
+
+<literallayout>
+Mnemonic:  IMPULSE
+Shortest abbreviation:  I
+Full command:  IMPULSE MANUAL &lt;displacement&gt;
+               IMPULSE AUTOMATIC &lt;destination&gt;
+</literallayout>
+
+<para>The impulse engines give you a way to move when your warp engines are
+damaged.  They move you at a speed of 0.95 sectors per stardate,
+which is the equivalent of a warp factor of about 0.975, so they are
+much too slow to use except in emergencies.</para>
+
+<para>Movement commands are indicated just as in the <quote>MOVE</quote> command.</para>
+
+<para>The impulse engines require 20 units of energy to engage, plus 10
+units per sector (100 units per quadrant) traveled. It does not cost
+extra to move with the shields up.</para>
+
+</sect1>
+<sect1><title>Deflector Shields</title>
+
+<literallayout>
+Mnemonic:  SHIELDS
+Shortest abbreviation:  SH
+Full commands:  SHIELDS UP
+                SHIELDS DOWN
+                SHIELDS TRANSFER &lt;amount of energy to transfer&gt;
+</literallayout>
+
+<para>Your deflector shields are a defensive device to protect you from
+Klingon attacks (and nearby novas).  As the shields protect you, they
+gradually weaken.  A shield strength of 75%, for example, means that
+the next time a Klingon hits you, your shields will deflect 75% of
+the hit, and let 25% get through to hurt you.</para>
+
+<para>It costs 50 units of energy to raise shields, nothing to lower them.
+You may move with your shields up; this costs nothing under impulse
+power, but doubles the energy required for warp drive.</para>
+
+<para>Each time you raise or lower your shields, the Klingons have another
+chance to attack.  Since shields do not raise and lower
+instantaneously, the hits you receive will be intermediate between
+what they would be if the shields were completely up or completely
+down. </para>
+
+<para>You may not fire phasers through your shields.  However you may
+use the <quote>high-speed shield control</quote> to lower shields,
+fire phasers, and raise the shields again before the Klingons can
+react.  Since rapid lowering and raising of the shields requires more
+energy than normal speed operation, it costs you 200 units of energy
+to activate this control.  It is automatically activated when you fire
+phasers while shields are up.  You may fire photon torpedoes, but they
+may be deflected considerably from their intended course as they pass
+through the shields (depending on shield strength).</para>
+
+<para>You may transfer energy beteen the ship's energy (given as
+<quote>Energy</quote> in the status) and the shields.  The word
+<quote>TRANSFER</quote> may be abbreviated <quote>T</quote>.  The
+ammount of energy to transfer is the number of units of energy you
+wish to take from the ship's energy and put into the shields.  If you
+specify an negative number, energy is drained from the shields to the
+ship.  Transfering energy constitutes a turn.  If you transfer energy
+to the shields while you are under attack, they will be at the new
+energy level when you are next hit.</para>
+
+<para>Enemy torpedoes hitting your ship explode on your shields (if they
+are up) and have essentially the same effect as phaser hits.</para>
+
+</sect1>
+<sect1><title>Phasers</title>
+
+<literallayout>
+Mnemonic:  PHASERS
+Shortest abbreviation:  P
+Full commands:  PHASERS AUTOMATIC &lt;AMOUNT TO FIRE&gt; &lt;NO&gt;
+                PHASERS &lt;AMOUNT TO FIRE&gt; &lt;NO&gt;
+                PHASERS MANUAL &lt;NO&gt; &lt;AMOUNT 1&gt; &lt;AMOUNT 2&gt;...&lt;AMOUNT N&gt; 
+</literallayout>
+
+<para>Phasers are energy weapons. As you fire phasers at Klingons, you
+specify an <quote>amount to fire</quote> which is drawn from your
+energy reserves.  The amount of total hit required to kill an enemy is
+partly random.  but also depends on skill level.</para>
+
+<para>The average hit required to kill an ordinary Klingon varies from 200
+units in the Novice game to 250 units in the Emeritus game.
+Commanders normally require from 600 (Novice) to 700 (Emeritus).  The
+Super-commander requres from 875 (Good) to 1000 (Emeritus). Romulans
+require an average of 350 (Novice) to 450 (Emeritus).</para>
+
+<para>Hits on enemies are cumulative, as long as you don't leave the
+quadrant. </para>
+
+<para>In general, not all that you fire will reach the Klingons.  The
+farther away they are, the less phaser energy will reach them. If a
+Klingon is adjacent to you, he will receive about 90% of the phaser
+energy directed at him; a Klingon 5 sectors away will receive about
+60% and a Klingon 10 sectors away will receive about 35%. There is
+some randomness involved, so these figures are not exact. Phasers
+have no effect beyond the boundaries of the quadrant you are in.</para>
+
+<para>Phasers may overheat (and be damaged) if you fire too large a burst
+at once. Firing up to 1500 units is safe.  From 1500 on up the
+probability of overheat increases with the amount fired.</para>
+
+<para>If phaser firing is automatic, the computer decides how to
+divide up your &lt;amount to fire&gt; among the Klingons present.  If
+phaser firing is manual, you specify how much energy to fire at each
+Klingon present (nearest first), rather than just specifying a total
+amount.  You can abreviate <quote>MANUAL</quote> and
+<quote>AUTOMATIC</quote> to one or more letters; if you mention
+neither, automatic fire is usually assumed.</para>
+
+<para>Battle computer information is available by firing phasers manually,
+and allowing the computer to prompt you.  If you enter zero for the
+amount to fire at each enemy, you will get a complete report, without
+cost.  The battle computer will tell you how much phaser energy to
+fire at each enemy for a sure kill.  This information appears in
+parentheses prior to the prompt for each enemy.  Since the amount is
+computed from sensor data, if either the computer or the S.R. sensors
+are damaged, this information will be unavailable, and phasers must
+be fired manually.</para>
+
+<para>A safety interlock prevents phasers from being fired through
+the shields.  If this were not so, the shields would contain your fire
+and you would fry yourself.  However, you may utilize the
+<quote>high-speed shield control</quote> to drop shields, fire
+phasers, and raise shields before the enemy can react.  Since it takes
+more energy to work the shields rapidly with a shot, it costs you 200
+units of energy each time you activate this control.  It is
+automatically activated when you fire phasers while the shields are
+up. By specifying the &lt;no&gt; option, shields are not raised after
+firing.</para>
+
+<para>Phasers have no effect on starbases (which are shielded) or on
+stars.</para>
+
+</sect1>
+<sect1><title>Report</title>
+
+<literallayout>
+Mnemonic:  REPORT
+Shortest abbreviation: REP
+</literallayout>
+
+<para>This command supplies you with information about the state of the
+current game.  Its purpose is to remind you of things that you have
+learned during play, but may have forgotten, and cannot otherwise
+retrieve if you are not playing at a hard-copy terminal.</para>
+
+<para>You are told the following things:</para>
+
+<itemizedlist>
+<listitem><para>The length and skill level of the game you are playing</para></listitem>
+<listitem><para>The original number of Klingons</para></listitem>
+<listitem><para>How many Klingons you have destroyed</para></listitem>
+<listitem><para>Whether the Super-Commander has been destroyed</para></listitem>
+<listitem><para>How many bases have been destroyed</para></listitem>
+<listitem><para>How many bases are left</para></listitem>
+<listitem><para>What bases (if any) are under attack; your subspace radio
+must have been working since the attack to get this 
+information.</para></listitem>
+<listitem><para>How many casualties you have suffered</para></listitem>
+<listitem><para>How many times you have called for help.</para></listitem>
+</itemizedlist>
+
+<para>This same information is automatically given to you when you start to
+play a frozen game.</para>
+
+</sect1>
+<sect1><title>Computer</title>
+
+<literallayout>
+Mnemonic:  COMPUTER
+Shortest abbreviation: CO
+</literallayout>
+
+<para>This command allows using the ship's computer (if functional) to
+calculate travel times and energy usage.</para>
+
+</sect1>
+<sect1><title>Photon Torpedoes</title>
+
+<literallayout>
+Mnemonic:  PHOTONS
+Shortest abbreviation:  PHO
+Full commands:  PHOTONS &lt;NUMBER&gt; &lt;TARG1&gt; &lt;TARG2&gt; &lt;TARG3&gt;
+</literallayout>
+
+<para>Photon torpedoes are projectile weapons&mdash;you either hit what you aim
+at, or you don't.  There are no <quote>partial hits</quote>.</para>
+
+<para>One photon torpedo will usually kill one ordinary Klingon, but it
+usually takes about two for a Klingon Commander.  Photon torpedoes
+can also blow up stars and starbases, if you aren't careful.</para>
+
+<para>You may fire photon torpedoes singly, or in bursts of two or three.
+Each torpedo is individually targetable.  The computer will prompt
+you, asking for the target sector for each torpedo.  Alternately, you
+may specify each target in the command line.</para>
+
+<para>Photon torpedoes cannot be aimed precisely&mdash;there is always some
+randomness involved in the direction they go.  Photon torpedoes may
+be fired with your shields up, but as they pass through the shields
+they are randomly deflected from their intended course even more.</para>
+
+<para>Photon torpedoes are proximity-fused.  The closer they explode to the
+enemy, the more damage they do.  There is a hit <quote>window</quote> about one
+sector wide.  If the torpedo misses the hit window, it does not
+explode and the enemy is unaffected.  Photon torpedoes are only
+effective within the quadrant.  They have no effect on things in
+adjacent quadrants.</para>
+
+<para>If more than one torpedo is fired and only one target sector is
+specified, all torpedoes are fired at that sector.  For example, to
+fire two torpedoes at sector 3 - 4, you type</para>
+
+<screen>
+     PHO 2 3 4           (or)           PHO 2 3 4 3 4
+</screen>
+
+<para>To fire torpedoes at, consecutively, sectors 2 - 6, 1 - 10, and 4 -
+7, type</para>
+
+<screen>
+     PHO 3 2 6 1 10 4 7
+</screen>
+
+<para>There is no restriction to fire directly at a sector.  For example,
+you can enter</para>
+
+<screen>
+       PHO 1 3 2.5
+</screen>
+
+<para>to aim between two sectors.  However, sector numbers must be 1 to 10
+inclusive.</para>
+
+</sect1>
+<sect1><title>Dock at Starbase</title>
+
+<literallayout>
+Mnemonic:  DOCK
+Shortest abbreviation:  D
+</literallayout>
+
+<para>You may dock your starship whenever you are in one of the eight
+sector positions immediately adjacent to a starbase.  When you dock,
+your starship is resupplied with energy, shield energy photon
+torpedoes, and life support reserves.  Repairs also proceed faster at
+starbase, so if some of your devices are damaged, you may wish to stay
+at base (by using the <quote>REST</quote> command) until they are
+fixed.  If your ship has more than its normal maximum energy (which
+can happen if you've loaded crystals) the ship's energy is not
+changed.</para>
+
+<para>You may not dock while in standard orbit around a planet.</para>
+
+<para>Starbases have their own deflector shields, so you are completely
+safe from phaser attack while docked.  You are also safe from
+long-range tractor beams.</para>
+
+<para>Starbases also have both short and long range sensors, which you can
+use if yours are broken. There's also a subspace radio to get
+information about happenings in the galaxy. Mr. Spock will update the
+star chart if your ask for it while docked and your own radio is dead.</para>
+
+</sect1>
+<sect1><title>Rest</title>
+
+<literallayout>
+Mnemonic:  REST
+Shortest abbreviation:  R
+Full command:  REST &lt;NUMBER OF STARDATES&gt;
+</literallayout>
+
+<para>This command simply allows the specified number of stardates to go
+by.  This is useful if you have suffered damages and wish to wait
+until repairs are made before you go back into battle.</para>
+
+<para>It is not generally advisable to rest while you are under attack by
+Klingons.</para>
+
+</sect1>
+<sect1><title>Call Starbase for Help</title>
+
+<literallayout>
+Mnemonic:  MAYDAY
+(No abbreviation)
+</literallayout>
+
+<para>[Originally, this command was called <quote>HELP</quote>, but
+these days that might be misconstrued as an attempt to browae built-in
+documentation! In some later versions it was CALL.]</para>
+
+<para>When you get into serious trouble, you may call a starbase for
+help.  Starbases have a device called a <quote>long-range transporter
+beam</quote> which they can use to teleport you to base.  This works
+by dematerializing your starship at its current position and
+re-materializing it adjacent to the nearest starbase.  Teleportation
+is instantaneous, and starbase supplies the required energy&mdash;all
+you have to do is let them know (via subspace radio) that you need to
+be rescued.</para>
+
+<para>This command should be employed only when absolutely necessary.  In
+the first place, calling for help is an admission on your part that
+you got yourself into something you cannot get yourself out of, and
+you are heavily penalized for this in the final scoring.  Secondly,
+the long-range transporter beam is not reliable&mdash;starbase can always
+manage to dematerialize your starship, but (depending on distance)
+may or may not be able to re-materialize you again.  The long-range
+transporter beam has no absolute maximum range; if you are in the
+same quadrant as a starbase, you have a good chance (about 90%) of
+re-materializing successfully.  your chances drop to roughly 50-50 at
+just over 3 quadrants.</para>
+
+</sect1>
+<sect1><title>Abandon Ship</title>
+
+<literallayout>
+Mnemonic:  ABANDON
+(no abbreviation)
+</literallayout>
+
+<para>You may abandon the Enterprise if necessary.  If there is still a
+starbase in the galaxy, you will be sent there and put in charge of a
+weaker ship, the Faerie Queene.</para>
+
+<para>The Faerie Queene cannot be abandoned.</para>
+
+</sect1>
+<sect1><title>Self-Destruct</title>
+
+<literallayout>
+Mnemonic:  DESTRUCT
+(no abbreviation)
+</literallayout>
+
+<para>You may self-destruct, thus killing yourself and ending the game.  If
+there are nearby Klingons, you may take a few of them with you (the
+more energy you have left, the bigger the bang).</para>
+
+<para>In order to self-destruct you must remember the password you typed in
+at the beginning of the game.</para>
+
+</sect1>
+<sect1><title>Quit Game</title>
+
+<literallayout>
+Mnemonic:  QUIT
+(no abbreviation)
+</literallayout>
+
+<para>Immediately cancel the current game; no conclusion is reached.  You
+will be given an opportunity to start a new game or to leave the Star
+Trek program.</para>
+
+</sect1>
+<sect1><title>Sensor-Scan</title>
+
+<literallayout>
+Mnemonic:  SENSORS
+Shortest abbreviation:  SE
+</literallayout>
+
+<para>Utilizing the short-range sensors, science officer Spock gives you a
+readout on any planet in your quadrant.  Planets come in three
+classes: M, N, and O.  Only class M planets have earth-like
+conditions.  Spock informs you if the planet has any dilithium
+crystals.  Sensor scans are free.</para>
+
+</sect1>
+<sect1><title>Enter Standard Orbit</title>
+
+<literallayout>
+Mnemonic:  ORBIT
+Shortest abbreviation:  O
+</literallayout>
+
+<para>To land on a planet you must first be in standard orbit.  You achieve
+this in a manner similar to docking at starbase.  Moving to one of
+the eight sector positions immediately adjacent to the planet, you
+give the orbit command which puts your ship into standard orbit about
+the planet.  Since this is a maneuver, a small amount of time is
+used; negligible energy is required.  If enemies are present, they
+will attack.</para>
+
+</sect1>
+<sect1><title>Transporter Travel</title>
+
+<literallayout>
+Mnemonic:  TRANSPORT
+Shortest abbreviation:  T
+</literallayout>
+
+<para>The transporter is a device which can convert any physical object
+into energy, beam the energy through space, and reconstruct the
+physical object at some destination.  Transporting is one way to land
+on a planet.  Since the transporter has a limited range, you must be
+in standard orbit to beam down to a planet.  Shields must be down
+while transporting.</para>
+
+<para>The transport command is used to beam a landing party onto a planet
+to mine <quote>dilithium crystals</quote>.  Each time the command is given the
+landing party (which you lead) moves from the ship to the planet, or
+vice-versa.</para>
+
+<para>You are advised against needless transporting, since like all
+devices, the transporter will sometimes malfunction.</para>
+
+<para>The transporter consumes negligible time and energy.  Its use does
+not constitute a <quote>turn</quote>.</para>
+
+</sect1>
+<sect1><title>Shuttle Craft</title>
+
+<literallayout>
+Mnemonic:  SHUTTLE
+Shortest abbreviation:  SHU
+</literallayout>
+
+<para>An alternate way to travel to and from planets.  Because of limited
+range, you must be in standard orbit to use the shuttle craft, named
+"Galileo".  Shields must be down.</para>
+
+<para>Unlike transporting, use of the shuttle craft does constitute a
+<quote>turn</quote> since time is consumed.  The time naturally
+depends on orbit altitude, and is equal to 3.0e-5 times altitude.
+Shuttling uses no ship energy.</para>
+
+<para>You should use the same travel device going from the planet to the
+ship as you use to go from the ship to the planet. However it is
+possible to transport to the planet and have the Galileo crew come
+and pick your landing party up, or to take the Galileo to the planet
+and then transport back, leaving the shuttle craft on the planet.</para>
+
+</sect1>
+<sect1><title>Mine Dilithium Crystals</title>
+
+<literallayout>  
+Mnemonic:  MINE
+Shortest abbreviation:  MI
+</literallayout>
+
+<para>Once you and your mining party are on the surface of a planet which
+has dilithium crystals, this command will dig them for you.</para>
+
+<para>Mining requires time and constitutes a <quote>turn</quote>.  No
+energy is used.  Class M planets require 0.1 to 0.3 stardates to mine.
+Class N planets take twice as long, and class O planets take three
+times as long.</para>
+
+<para>Dilithium crystals contain enormous energy in a form that is readily
+released in the ship's power system.  It is an excellent idea to mine
+them whenever possible, for use in emergencies.  You keep the
+crystals until the game is over or you abandon ship when not at a
+starbase.</para>
+
+</sect1>
+<sect1><title>Load Dilithium Crystals</title>
+
+<literallayout>  
+Mnemonic:  CRYSTALS
+Shortest abbreviation:  CR
+</literallayout>
+
+<para>This is a very powerful command which should be used with caution.
+Once you have dilithium crystals aboard ship, this command will
+instruct engineering officer Scott and Mr. Spock to place a raw
+dilithium crystal into the power channel of the ship's
+matter-antimatter converter.  When it works, this command will
+greatly boost the ship's energy.</para>
+
+<para>Because the crystals are raw and impure, instabilities can occur in
+the power channel.  Usually Scotty can control these.  When he
+cannot, the results are disastrous. Scotty will use those crystals
+that appear to be most stable first.</para>
+
+<para>Since using raw dilithium crystals for this purpose entails
+considerable risk, Starfleet Regulations allow its use only during
+"condition yellow".  No time or energy is used.</para>
+
+</sect1>
+<sect1><title>Planet Report</title>
+
+<literallayout>  
+Mnemonic:  PLANETS
+Shortest abbreviation:  PL
+</literallayout>
+
+<para>Mr. Spock presents you a list of the available information on planets
+in the galaxy.  Since planets do not show up on long-range scans, the
+only way to obtain this information is with the <quote>SENSORS</quote> command.</para>
+
+</sect1>
+<sect1 id="freeze"><title>Freeze</title>
+
+<literallayout> 
+Mnemonic:  FREEZE
+(no abbreviation)
+Full command:  FREEZE &lt;FILE NAME&gt;
+</literallayout>
+
+<para>The purpose of the FREEZE command is to allow a player to save the
+current state of the game, so that it can be finished later.  A
+plaque may not be generated from a frozen game. A file with the
+specified &lt;file name&gt; and type '.TRK' is created (if necessary) in
+the current directory, and all pertinent information about the game
+is written to that file. The game may be continued as usual or be
+terminated at the user's option.</para>
+
+<para>To restart a game created by the <quote>FREEZE</quote> command,
+the user need only type <quote>FROZEN</quote> in response to the
+initial question about the type of game desired, followed by the
+&lt;file name&gt;.</para>
+
+<para>NOTE: A <quote>tournament</quote> game is like a frozen game,
+with the following differences.  (1) Tournament games always start
+from the beginning, while a frozen game can start at any point.  (2)
+Tournament games require only that the player remember the name or
+number of the tournament, while the information about a frozen game
+must be kept on a file. Tournament games can be frozen, but then they
+behave like regular frozen games.</para>
+
+<para>A point worth noting is that 'FREEZE' does not save the seed for the
+random number generator, so that identical actions after restarting
+the same frozen game can lead to different results.  However,
+identical actions after starting a given tournament game always lead
+to the same results.</para>
+
+</sect1>
+<sect1><title>Request</title>
+
+<literallayout>  
+Mnemonic:  REQUEST
+Shortest abbreviation:  REQ
+Full command:  REQUEST &lt;ITEM&gt;
+</literallayout>
+
+<!-- This is new in SST 2K --> 
+<para>If you are using the screen-oriented interface, this command is
+suppressed; instead, a full status report will always be present on the
+screen.</para>
+
+<para>This command allows you to get any single piece of information
+from the &lt;STATUS&gt; command.  &lt;ITEM&gt; specifies which
+information as follows:</para>
+
+<informaltable> 
+<tgroup cols='3'>
+<thead>
+<row>
+  <entry>Information</entry>
+  <entry>Mnemonic for &lt;item&gt;</entry>
+  <entry>Shortest Abbreviation</entry>
+</row>
+</thead>
+<tbody>
+<row><entry>STARDATE</entry>    <entry>DATE</entry>      <entry>D</entry></row>
+<row><entry>CONDITION</entry>   <entry>CONDITION</entry> <entry>C</entry></row>
+<row><entry>POSITION</entry>    <entry>POSITION</entry>  <entry>P</entry></row>
+<row><entry>LIFE SUPPORT</entry><entry>LSUPPORT</entry>  <entry>L</entry></row> 
+<row><entry>WARP FACTOR</entry> <entry>WARPFACTOR</entry><entry>W</entry></row>
+<row><entry>ENERGY</entry>      <entry>ENERGY</entry>    <entry>E</entry></row>
+<row><entry>TORPEDOES</entry>   <entry>TORPEDOES</entry> <entry>T</entry></row>
+<row><entry>SHIELDS</entry>     <entry>SHIELDS</entry>   <entry>S</entry></row>
+<row><entry>KLINGONS LEFT</entry><entry>KLINGONS</entry> <entry>K</entry></row>
+<row><entry>TIME LEFT</entry>   <entry>TIME</entry>     <entry>TI</entry></row>
+<row><entry>BASES LEFT</entry>   <entry>BASES</entry>   <entry>BA</entry></row>
+</tbody>
+</tgroup>
+</informaltable>
+
+</sect1>
+<sect1><title>Experimental Death Ray</title>
+
+<literallayout>
+Mnemonic:  DEATHRAY
+(No abbreviation)
+</literallayout>
+
+<para>This command should be used only in those desperate cases where
+you have absolutely no alternative.  The death ray uses energy to
+rearrange matter.  Unfortunately, its working principles are not yet
+thoroughly understood, and the results are highly
+unpredictable.</para>
+
+<para>The only good thing that can result is the destruction of all
+enemies in your current quadrant.  This will happen about 70% of the
+time.  Only enemies are destroyed; starbases, stars, and planets are
+unaffected.</para>
+
+<para>Constituting the remaining 30% are results varying from bad to
+fatal.</para>
+
+<para>The death ray requires no energy or time, but if you survive, enemies
+will hit you.</para>
+
+<para>The Faerie Queene has no death ray.</para>
+
+<para>If the death ray is damaged in its use, it must be totally replaced.
+This can only be done at starbase.  Because it is a very complex
+device, it takes 9.99 stardates at base to replace the death ray.
+The death ray cannot be repaired in flight.</para>
+
+</sect1>
+<sect1><title>Launch Deep Space Probe</title>
+
+<literallayout>
+Mnemonic:  PROBE
+Shortest abbreviation:  PR
+Full command:  PROBE &lt;ARMED&gt; MANUAL &lt;displacement&gt;
+               PROBE &lt;ARMED&gt; AUTOMATIC &lt;destination&gt;
+</literallayout>
+
+<para>The Enterprise carries a limited number of Long Range Probes. These
+fly to the end of the galaxy and report back a count of the number of
+important things found in each quadrant through which it went. The
+probe flies at warp 10, and therefore uses time during its flight.
+Results are reported immediately via subspace radio and are recorded
+in the star chart.</para>
+
+<para>The probe can also be armed with a NOVAMAX warhead. When launched
+with the warhead armed, the probe flies the same except as soon as it
+reaches the target location, it detonates the warhead in the heart of
+a star, causing a supernova and destroying everything in the
+quadrant. It then flies no further. There must be a star in the
+target quadrant for the NOVAMAX to function. </para>
+
+<para>The probe can fly around objects in a galaxy, but is destroyed if it
+enters a quadrant containing a supernova, or if it leaves the galaxy.</para>
+
+<para>The target location is specified in the same manner as the MOVE
+command, however for automatic movement, if only one pair of
+coordinates are specified they are assumed to be the quadrant and not
+the sector in the current quadrant!</para>
+
+<para>The Faerie Queene has no probes.</para>
+
+</sect1>
+<sect1><title>Emergency Exit</title>
+
+<literallayout>
+Mnemonic:  EMEXIT
+Shortest abbreviation:  E
+</literallayout>
+
+<para>This command provides a quick way to exit from the game when you
+observe a Klingon battle cruiser approaching your terminal.  Its
+effect is to freeze the game on the file 'EMSAVE.TRK' in your current
+directory, erase the screen, and exit.</para>
+
+<para>Of course, you do lose the chance to get a plaque when you use this
+maneuver.</para>
+
+</sect1>
+<sect1><title>Ask for Help</title>
+
+<literallayout>
+Mnemonic:  HELP
+Full command:  HELP &lt;command&gt;
+</literallayout>
+
+<para>This command reads the appropriate section from the SST.DOC file,
+providing the file is in the current directory.</para>
+
+</sect1>
+</chapter>
+<chapter><title>Miscellaneous Notes</title>
+
+<para>Starbases can be attacked by either commanders or by the
+<quote>Super-Commander</quote>.  When this happens, you will be
+notified by subspace radio, provided it is working.  The message will
+inform you how long the base under attack can last.  Since the
+<quote>Super-Commander</quote> is more powerful than an ordinary
+commander, he can destroy a base more quickly.</para>
+
+<para>The <quote>Super-Commander</quote> travels around the galaxy at
+a speed of about warp 6 or 7.  His movement is strictly time based;
+the more time passes, the further he can go.</para>
+
+<para>Scattered through the galaxy are certain zones of control,
+collectively designated the <quote>Romulan Neutral Zone</quote>.  Any
+quadrant which contains Romulans without Klingons is part of the
+Neutral Zone, except if a base is present.  Since Romulans do not show
+on either the long-range scan or the star chart, it is easy for you to
+stumble into this zone.  When you do, if your subspace radio is
+working, you will receive a warning message from the Romulan, politely
+asking you to leave.</para>
+
+<para>In general, Romulans are a galactic nuisance.</para>
+
+<para>The high-speed shield control is fairly reliable, but it has been
+known to malfunction.</para>
+
+<para>You can observe the galactic movements of the
+<quote>Super-Commander</quote> on the star chart, provided he is in
+territory you have scanned and your subspace radio is working.</para>
+
+<para>Periodically, you will receive intelligence reports from
+starfleet command, indicating the current quadrant of the
+<quote>Super-Commander</quote>.  Your subspace radio must be working,
+of course.</para>
+
+<para>Each quadrant will contain from 0 to 3 black holes.  Torpedoes
+entering a black hole disappear.  In fact, anything entering a black
+hole disappears, permanently.  If you can displace an enemy into one,
+he is a goner.  Black holes do not necessarily remain in a quadrant.
+they are transient phenomena.</para>
+
+<para>Commanders will ram your ship, killing themselves and inflicting
+heavy damage to you, if they should happen to decide to advance into
+your sector.</para>
+
+<para>You can get a list of commands by typing
+<quote>COMMANDS</quote>.</para>
+
+</chapter>
+<chapter><title>Scoring</title>
+
+<para>Scoring is fairly simple.  You get points for good things, and you
+lose points for bad things.</para>
+
+<para>You gain&mdash;</para>
+
+<orderedlist>
+<listitem><para>10 points for each ordinary Klingon you kill,</para></listitem>
+<listitem><para>50 points for each commander you kill,</para></listitem>
+<listitem><para>200 points for killing the <quote>Super-Commander</quote>,</para></listitem>
+<listitem><para>20 points for each Romulan killed,</para></listitem>
+<listitem><para>1 point for each Romulan captured.</para></listitem>
+<listitem>
+<para>100 times your average Klingon/stardate kill rate.  If you lose
+the game, your kill rate is based on a minimum of 5 stardates.</para>
+</listitem>
+<listitem>
+<para>You get a bonus if you win the game, based on your rating:</para>
+<para>Novice=100, Fair=200, Good=300, Expert=400, Emeritus=500.</para>
+</listitem>
+</orderedlist>
+
+<para>You lose&mdash;</para>
+
+<orderedlist>
+<listitem><para>200 points if you get yourself killed,</para></listitem>
+<listitem><para>100 points for each starbase you destroy,</para></listitem>
+<listitem><para>100 points for each starship you lose,</para></listitem>
+<listitem><para>45 points for each time you had to call for help,</para></listitem>
+<listitem><para>10 points for each planet you destroyed,</para></listitem>
+<listitem><para>5 points for each star you destroyed, and</para></listitem>
+<listitem><para>1 point for each casualty you incurred.</para></listitem>
+</orderedlist>
+
+<para>In addition to your score, you may also be promoted one grade in rank
+if you play well enough.  Promotion is based primarily on your
+Klingon/stardate kill rate, since this is the best indicator of
+whether you are ready to go on to the next higher rating.  However,
+if you have lost 100 or more points in penalties, the required kill
+rate goes up. Normally, the required kill rate is 0.1 * skill *
+(skill + 1.0) + 0.1, where skill ranges from 1 for Novice to 5 for
+Emeritus.</para>
+
+<para>You can be promoted from any level.  There is a special
+promotion available if you go beyond the <quote>Expert</quote> range.
+You can also have a certificate of merit printed with your name, date,
+and Klingon kill rate, provided you are promoted from either the
+<quote>Expert</quote> or <quote>Emeritus</quote> levels. This
+<quote>plaque</quote> requires a 132 column printer. You may need
+print the certificate to a file, import it into your word processor,
+selecting Courier 8pt font, and then print in <quote>landscape
+orientation</quote>.</para>
+
+</chapter>
+<chapter><title>Handy Reference Page</title>
+
+<literallayout format='linespecific' class='monospaced'>
+ ABBREV    FULL COMMAND                           DEVICE USED
+ ------    ------------                           -----------
+ ABANDON   ABANDON                                shuttle craft
+ C         CHART                                  (none)
+ CO        COMPUTER                               computer
+ CR        CRYSTALS                               (none)
+ DA        DAMAGES                                (none)
+ DEATHRAY  DEATHRAY                               (none)  
+ DESTRUCT  DESTRUCT                               computer
+ D         DOCK                                   (none)
+ E         EMEXIT                                 (none)
+ FREEZE    FREEZE &lt;FILE NAME&gt;                     (none)
+ I         IMPULSE &lt;MANUAL&gt; &lt;DISPLACEMENT&gt;        impulse engines
+           IMPULSE AUTOMATIC &lt;DESTINATION&gt;        impulse engines and computer
+ L         LRSCAN                                 long-range sensors
+ MAYDAY    MAYDAY (for help)                      subspace radio
+ MI        MINE                                   (none)
+ M         MOVE &lt;MANUAL&gt; &lt;DISPLACEMENT&gt;           warp engines
+           MOVE AUTOMATIC &lt;DESTINATION&gt;           warp engines and computer
+ O         ORBIT                                  warp or impulse engines
+ P         PHASERS &lt;TOTAL AMOUNT&gt;                 phasers and computer
+           PHASERS AUTOMATIC &lt;TOTAL AMOUNT&gt;       phasers, computer, sr sensors
+           PHASERS MANUAL &lt;AMT1&gt; &lt;AMT2&gt; ...       phasers
+ PHO       PHOTONS &lt;NUMBER&gt; &lt;TARGETS&gt;             torpedo tubes 
+ PL        PLANETS                                (none)
+ PR        PROBE &lt;ARMED&gt; &lt;MANUAL&gt; &lt;DISPLACEMENT&gt;  probe launcher, radio 
+           PROBE &lt;ARMED&gt; AUTOMATIC &lt;DESTINATION&gt;  launcher, radio, computer
+ REP       REPORT                                 (none)
+ REQ       REQUEST                                (none)
+ R         REST &lt;NUMBER OF STARDATES&gt;             (none)
+ QUIT      QUIT                                   (none)
+ S         SRSCAN &lt;NO or CHART&gt;                   short-range sensors
+ SE        SENSORS                                short-range sensors
+ SH        SHIELDS &lt;UP, DOWN, or TRANSFER&gt;        deflector shields
+ SHU       SHUTTLE                                shuttle craft
+ ST        STATUS                                 (none)
+ T         TRANSPORT                              transporter
+ W         WARP &lt;FACTOR&gt;                          (none)
+
+ L. R. Scan:   thousands digit:   supernova
+               hundreds digit:    Klingons
+               tens digit:        starbases
+               ones digit:        stars
+               period (.):        digit not known (star chart only)
+
+Courses are given in manual mode in X - Y displacements; in automatic
+    mode as destination quadrant and/or sector.  Manual mode is default.
+Distances are given in quadrants.  A distance of one sector is 0.1 quadrant.
+Ordinary Klingons have about 400 units of energy, Commanders about
+    1200.  Romulans normally have about 800 units of energy, and the
+    (GULP) "Super-Commander" has about 1800.
+Phaser fire diminishes to about 60 percent at 5 sectors.  Up to 1500
+    units may be fired in a single burst without danger of overheat.
+Warp 6 is the fastest safe speed.  At higher speeds, engine damage
+    may occur.  At warp 10 you may enter a time warp.
+Shields cost 50 units of energy to raise, and double the power
+    requirements of moving under warp drive.  Engaging the high-speed
+    shield control requires 200 units of energy.
+Warp drive requires (distance)*(warp factor cubed) units of energy
+    to travel at a speed of (warp factor squared)/10 quadrants per stardate.
+Impulse engines require 20 units to warm up, plus 100 units per
+     quadrant.  Speed is just under one sector per stardate.
+</literallayout>
+
+</chapter>
+<chapter><title>Game History and Modifications</title>
+
+<sect1><title>Origins</title>
+
+<para>The original Star Trek seems to have been written by Mike
+Mayfield at the beginning of the 1970s.  His first version was in
+BASIC for a Sigma 7 in 1971; in 1972 he rewrote it in Hewlett Packard
+BASIC. The source is <ulink
+url="&sst-site;www/historic/mayfield.basic">available</ulink> on the
+SST2K website. In January 1975 it became part of the DECUS library
+under the name <ulink
+url='http://www.trailing-edge.com/~shoppa/decus/110174.html'>SPACWR</ulink>.</para>
+
+<para>While some people claim to have recollections of playing Trek
+games in the late 1960s, the earlier ones seem actually to have been
+variants of
+<ulink url='http://en.wikipedia.org/wiki/Spacewar!'>
+SPACEWAR</ulink>, the earlier space-combat game on the
+PDP-1. Mayfield <ulink
+url='http://www3.sympatico.ca/maury/games/space/star_trek.html'>wrote
+in 2000</ulink> that he invented the Trek-style galactic grid, and the
+evidence seems to back that up.  Some of the confusion probably stems 
+from the fact that Mayfield's original and several early descendants 
+were distributed under the name SPACWR.</para>
+
+<para>Many different versions radiated from Mayfield's original; most
+of the ones in BASIC are descended from a SPACWR version that David
+Ahl published in <citetitle>101 BASIC Computer Games</citetitle>,
+July 1973. This was a port of Mayfield's version obtained from the HP
+Contributed Programs library.  </para>
+
+<para>Our SST2K is descended from a Taurus BASIC program by Grady
+Hicks dated 5 April 1973. This does not appear to have been derived
+from Ahl's SPACWR. The header says "GENERAL IDEA STOLEN FROM
+PENN. U.", and the game has several features not present in SPACEWR:
+notably, the Death Ray, ramming, and the Klingon summons to surrender.
+And, of course, it predates Ahl's book.  The source is <ulink
+url="&sst-site;www/historic/UT-Trek.basic">available</ulink> on the
+SST2K website.</para>
+
+<para>Dave Matuszek, Paul Reynolds et. al. at UT Austin played the
+Hicks version on a CDC6600, but disliked the long load time and
+extreme slowness of the BASIC program. (David Matuszek notes that the
+Hicks version he played had a habit of throwing long
+quotes from Marcus Aurelius at the users, a feature he found
+intolerable on a TTY at 110 baud.  It must, therefore, have been
+rather longer than  the one we have.)  The Austin crew proceeded to
+write their own Trek game, loosely based on the Hicks version, in
+CDC6600 FORTRAN.  At that time, it was just called "Star Trek"; the
+"Super" was added by later developers. In the rest of this history
+we'll call it the "UT FORTRAN" version.</para>
+
+<para>At the time the UT FORTRAN source was last translated to C it emitted
+the message "Latest update-21 Sept 78".  Thus, it actually predated
+(and may have influenced) the best-known BASIC version, the "Super
+Star Trek" published by David Ahl in his November 1978 sequel
+<citetitle>BASIC Computer Games</citetitle>.</para>
+
+<para>This 1978 "Super Star Trek" had been reworked by Robert Leedom and
+friends from (according to Leedom) Mayfield's HP port. There is
+internal evidence to suggest that at least some features of Leedom's
+SST may have derived from the UT FORTRAN version.  In particular, Dave
+Matuszek recalls implementing command words to replace the original
+numeric command codes, a feature Leedom's SST also had but the
+1973 and 1975 SPACWRs did not.</para>
+
+<para>One signature trait of the UT FORTRAN game and its descendants
+is that the sectors are 10x10 (rather than the 8x8 in Mike Mayfield's
+1972 original and its BASIC descendants).  The UT FORTRAN version also
+preserves the original numbered quadrants rather than the
+astronomically-named quadrants introduced in Ahl's SST and its
+descendants.</para>
+
+<!-- Dave thinks his Fortran Star Trek used the clockface for quadrant -->
+<!-- navigation. -->
+
+<para>Eric Allman's BSD Trek game is one of these, also descended from
+the UT FORTRAN version via translation to C.  However, the mainline version
+(now SST2K) has had a lot more stuff folded into it over the years
+&mdash; deep space probes, dilithium mining, the Tholian Web, and so
+forth.</para>
+</sect1>
+
+<sect1><title>Tom Almy's story</title>
+
+<para>Back in (about) 1977 I got a copy of the Super Star Trek game for
+the CDC 6600 mainframe computer. Someone had converted it to PDP-11
+Fortran but couldn't get it to run because of its size. I modified
+the program to use overlays and managed to shoehorn it in on the 56k
+byte machine.</para>
+
+<para>I liked the game so much I put some time into fixing bugs, mainly
+what could be called continuity errors and loopholes in the game's
+logic. We even played a couple tournaments.</para>
+
+<para>In 1979, I lost access to that PDP-11. I did save the source code
+listing. In 1995, missing that old friend, I started converting the
+program into portable ANSI C. It's been slow, tedious work that took
+over a year to accomplish.</para>
+
+<para>In early 1997, I got the bright idea to look for references to
+<quote>Super Star Trek</quote> on the World Wide Web. There weren't
+many hits, but there was one that came up with 1979 Fortran sources!
+This version had a few additional features that mine didn't have,
+however mine had some feature it didn't have. So I merged its features
+that I liked. I also took a peek at the DECUS version (a port, less
+sources, to the PDP-10), and some other variations.</para>
+
+<para>Modifications I made:</para>
+
+<para>Compared to original version, I've changed the
+<quote>help</quote> command to <quote>call</quote> and the
+<quote>terminate</quote> command to <quote>quit</quote> to better
+match user expectations. The DECUS version apparently made those
+changes as well as changing <quote>freeze</quote> to
+<quote>save</quote>. However I like <quote>freeze</quote>.</para>
+
+<para>I added EMEXIT from the 1979 version.</para>
+
+<para>That later version also mentions srscan and lrscan working when
+docked (using the starbase's scanners), so I made some changes here
+to do this (and indicating that fact to the player), and then
+realized the base would have a subspace radio as well &mdash; doing a
+Chart when docked updates the star chart, and all radio reports will
+be heard. The Dock command will also give a report if a base is under
+attack.</para>
+
+<para>It also had some added logic to spread the initial positioning of
+bases. That made sense to add because most people abort games with
+bad base placement.</para>
+
+<para>The experimental deathray originally had only a 5% chance of success,
+but could be used repeatedly. I guess after a couple years of use, it
+was less <quote>experimental</quote> because the 1979 version had a 70% success
+rate. However it was prone to breaking after use. I upgraded the
+deathray, but kept the original set of failure modes (great humor!).</para>
+
+<para>I put in the Tholian Web code from the 1979 version.</para>
+
+<para>I added code so that Romulans and regular Klingons could move in 
+advanced games. I re-enabled the code which allows enemy ships to
+ram the Enterprise; it had never worked right. The 1979 version
+seems to have it all fixed up, but I'm still not overly happy with
+the algorithm.</para>
+
+<para>The DECUS version had a Deep Space Probe. Looked like a good idea
+so I implemented it based on its description.</para>
+
+</sect1>
+<sect1><title>Stas Sergeev's story</title>
+
+<para>I started from an older Tom Almy version and added features I had
+seen in other mainframe variants of the game, I wrote a screen-oriented 
+interface for it based on the curses library.</para>
+
+<itemizedlist>
+<listitem>
+<para>The Space Thingy can be shoved, if you ram it, and can fire back if 
+fired upon.</para>
+</listitem>
+<listitem>
+<para>The Tholian can be hit with phasers.</para>
+</listitem>
+<listitem>
+<para>When you are docked, base covers you with an almost invincible shields 
+      (a commander can still ram you, or a Romulan can destroy the base,
+      or a SCom can even succeed with direct attack IIRC, but this rarely 
+      happens).</para>
+</listitem>
+<listitem>
+<para>SCom can't escape from you if no more enemies remain (without this, 
+      chasing SCom can take an eternity).</para>
+</listitem>
+<listitem>
+<para>Probe target you enter is now the destination quadrant. Before I don't 
+      remember what it was, but it was something I had difficulty using.</para>
+</listitem>
+<listitem>
+<para>Secret password is now autogenerated.</para>
+</listitem>
+<listitem>
+<para>Victory plaque is adjusted for A4 paper rather than 132-column greenbar
+:-)</para>
+</listitem>
+<listitem>
+<para>Phasers now tells you how much energy needed, but only if the computer 
+is alive.</para>
+</listitem>
+<listitem>
+<para>Planets are auto-scanned when you enter the quadrant.</para>
+</listitem>
+<listitem>
+<para>Mining or using crystals in presense of enemy now yields an attack.
+There are other minor adjustments to what yields an attack
+and what does not.</para>
+</listitem>
+<listitem>
+<para>Ramming a black hole is no longer instant death.  There is a
+chance you might get timewarped instead.</para>
+</listitem>
+<listitem>
+<para>"freeze" command reverts to "save", most people will understand this
+better anyway.</para>
+</listitem>
+<listitem>
+<para>Screen-oriented interface, with sensor scans always up.</para>
+</listitem>
+</itemizedlist>
+
+<para>My changes got merged into SST2K in 2005, and I work on it now.</para>
+
+</sect1>
+<sect1><title>Eric Raymond's story</title>
+
+<para>I played the FORTRAN version of this game in the late 1970s on a
+DEC minicomputer.  In the late 1980s Dave Matuszek and I became
+friends; I was vaguely aware that he had had something to do with the
+original Star Trek game.  In October 2004, sitting in Dave's living
+room, we got to talking about the game and I realized it would make a
+great exhibit for the <ulink
+url='&retro;'>Retrocomputing Museum</ulink>.</para>
+
+<para>A few quick web searches later we found Tom Almy's page.  We
+downloaded his code and Dave verified that that it was a direct
+descendent of UT Super Star Trek &mdash; even though it had been translated
+to C, he was able to recognize names and techniques from the FORTRAN
+version he co-wrote.</para>
+
+<para>This game became an open-source project; see the <ulink
+url='http://developer.berlios.de/projects/sst/'>project
+site</ulink>.</para>
+
+<para>After I launched the Berlios project, Stas Sergeev contacted me.
+We worked together to merge in his changes.</para>
+
+<para>Modifications I've made:</para>
+
+<itemizedlist>
+<listitem><para>
+I converted the flat-text SST.DOC file to XML-Docbook so it can be
+webbed. (That's what you're reading now.)
+</para></listitem>
+<listitem><para>
+The command-help code needed a rewrite because the flat-text form of
+the documentation is now generated from XML and doesn't have the
+easily recognizable section delimiters it used to.  I wrote a script
+to filter that flat-text form into an sst.doc that's easy to parse for
+command descriptions, and changed some logic in sst.c to match.
+</para></listitem>
+<listitem><para>
+I've cleaned up a lot of grubby FORTRANisms in the code internals --
+used sizeof(), replaced magic numeric constants with #defines,
+that sort of thing.
+</para></listitem>
+<listitem><para>
+I fixed a surprising number of typos in the code and documentation.
+</para></listitem>
+<listitem><para>
+All the game state now lives in one big structure that can be
+written to and read from disk as one blob.  The write gives it an
+an identifiable magic number and the thaw logic checks for same. 
+</para></listitem>
+<listitem><para>
+I made the internal pager work, and in the process got rid of a number
+of platform dependencies in the code.
+</para></listitem>
+<listitem><para>
+The HELP/CALL/SOS command is now MAYDAY.
+</para></listitem>
+<listitem><para>
+Status report now indicates if dilithium crystals are on board.
+</para></listitem>
+<listitem><para>
+At Dave's prompting, restored the Space Thingy's original elusive behavior.
+</para></listitem>
+<listitem><para>
+Clean separation of game engine from the UI code, improving Stas
+Sergeev's excellent work on the curses interface.
+</para></listitem>
+</itemizedlist>
+
+<para>Here are some good pages on the history of Star Trek games:</para>
+
+<itemizedlist>
+<listitem><para>
+<ulink url='http://www.dunnington.u-net.com/public/startrek/'>http://www.dunnington.u-net.com/public/startrek/</ulink>
+</para></listitem>
+<listitem><para>
+<ulink url='http://www3.sympatico.ca/maury/games/space/star_trek.html'>http://www3.sympatico.ca/maury/games/space/star_trek.html</ulink>
+</para></listitem>
+<listitem><para>
+<ulink url='http://www.cactus.org/%7Enystrom/startrek.html'>http://www.cactus.org/%7Enystrom/startrek.html</ulink>
+</para></listitem>
+</itemizedlist>
+
+</sect1>
+<sect1><title>Authors' Acknowledgments</title>
+
+<para>These are the original acknowledgments by Dave Matuszek and Paul
+Reynolds:</para>
+
+<para>The authors would like to thank Professor Michael Duggan for his
+encouragement and administrative assistance with the development of
+the Star Trek game, without which it might never have been completed.</para>
+
+<para>Much credit is due to Patrick McGehearty and Rich Cohen, who assisted
+with the original design of the game and contributed greatly to its
+conceptual development.</para>
+
+<para>Thanks are also due to Carl Strange, Hardy Tichenor and Steven Bruell
+for their assistance with certain coding problems.</para>
+
+<para>This game was inspired by and rather loosely based on an earlier
+game, programmed in the BASIC language, by Jim Korp and Grady Hicks.
+It is the authors' understanding that the BASIC game was in turn
+derived from a still earlier version in use at Penn State University.</para>
+
+</sect1>
+<sect1><title>References</title>
+
+<orderedlist>
+<listitem><para><citetitle>Star Trek</citetitle> (the original television
+series), produced and directed by Gene Rodenberry.</para></listitem>
+
+<listitem><para><citetitle>Star Trek</citetitle> (the animated
+television series), produced by Gene Rodenberry and directed by Hal
+Sutherland.  Also excellent, and not just kiddie fare.  If you enjoyed
+the original series you should enjoy this one (unless you have some
+sort of a hangup about watching cartoons).</para></listitem>
+
+<listitem><para><citetitle>The Making of Star Trek</citetitle>, by
+Steven E. Whitfield and Gene Rodenberry.  The best and most complete
+readily available book about Star Trek.  (Ballantine
+Books)</para></listitem>
+
+<listitem><para><citetitle>The World of Star Trek</citetitle>, by
+David Gerrold.  Similiar in scope to the above book.
+(Bantam)</para></listitem>
+
+<listitem><para><citetitle>The Star Trek Guide</citetitle>, third revision 4/17/67, by Gene
+Roddenberry.  The original writer's guide for the television
+series, but less comprehensive than (3) above.
+(Norway Productions)</para></listitem>
+
+<listitem><para><citetitle>The Trouble With Tribbles</citetitle>, by
+David Gerrold.  Includes the complete script of this popular show.
+(Ballantine Books)</para></listitem>
+
+<listitem><para><citetitle>Star Trek</citetitle>, <citetitle>Star Trek
+2</citetitle>, ..., <citetitle>Star Trek 9</citetitle>, by James
+Blish.  The original shows in short story form.
+(Bantam)</para></listitem>
+
+<listitem><para><citetitle>Spock Must Die</citetitle>, by James Blish.
+An original novel, but rather similar to the show <citetitle>The Enemy
+Within</citetitle>.  (Bantam)</para></listitem>
+
+<listitem><para>Model kits of the Enterprise and a <quote>Klingon
+Battle-Cruiser</quote> by AMT Corporation are available at most hobby
+shops.</para></listitem>
+</orderedlist>
+
+</sect1>
+</chapter>
+</book>
diff --git a/doc/sst-layer.xsl b/doc/sst-layer.xsl
new file mode 100644 (file)
index 0000000..774dd27
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<!-- force an encoding we can throw on an xterm window -->
+<xsl:output method="html"
+            encoding="ISO-8859-1"
+            indent="no"/>
+
+</xsl:stylesheet>
+
diff --git a/doc/sst.xml b/doc/sst.xml
new file mode 100644 (file)
index 0000000..5a56584
--- /dev/null
@@ -0,0 +1,67 @@
+<!DOCTYPE refentry PUBLIC 
+   "-//OASIS//DTD DocBook XML V4.1.2//EN"
+   "docbook/docbookx.dtd">
+<refentry id='sst.6'>
+<refmeta>
+<refentrytitle>sst</refentrytitle>
+<manvolnum>6</manvolnum>
+<refmiscinfo class='date'>Nov 1 2004</refmiscinfo>
+</refmeta>
+<refnamediv id='name'>
+<refname>sst</refname>
+<refpurpose>the classic Super Star Trek game</refpurpose>
+</refnamediv>
+<refsynopsisdiv id='synopsis'>
+
+<cmdsynopsis>
+<command>sst</command>
+<arg choice='opt'>-t </arg> 
+<arg rep='repeat' ><replaceable>command</replaceable></arg>  
+</cmdsynopsis>
+
+</refsynopsisdiv>
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+
+<para>The Organian Peace Treaty has collapsed, and the Federation is
+at war with the Klingon Empire. Joining the Klingons against the
+Federation are the members of the Romulan Star Empire. As commander
+of the Starship U.S.S. Enterprise, your job is to wipe out the Klingon
+invasion fleet and make the galaxy safe for democracy.</para>
+
+<para>This is one of the great early classic computer games from the
+1970s and still has a remarkable amount of play value. Run
+<command>sst</command> in a terminal window to start it.  Typing
+'comands' at the prompt will list all commands; help is available for
+each one individually as well.  Full documentation is <ulink
+url='http://sst.berlios.de/sst-doc.html'>browseable</ulink>.  On
+systems where <filename>/usr/share/doc/sst/</filename> is a legal
+filename, it will probably be installed there as well.</para>
+
+<para>There is one option -t, which forces the original pure-tty mode.
+Normally sst tries to come up in full-screen mode that assumes it is
+running on a cursor-addressable terminal or terminal emulator.</para>
+
+<para>Input tokens for the setup prompts will be read from the
+remainder of the command line before standard input.  Thus, for
+example, you can invoke the program as</para>
+
+<programlisting>
+sst regular medium good fancy
+</programlisting>
+
+<para>to start a regular medium game as a good player in 'fancy'
+mode (all features enabled).</para>
+</refsect1>
+
+<refsect1 id='authors'><title>AUTHORS</title> 
+<para>Super Star Trek was designed and written by David Matuszek, Paul
+Reynolds, and Don Smith in the 1970s.  It was resurrected by Tom Almy.
+The screen-oriented interface is by Stas Sergeev. This version has
+been cleaned up and documented by Eric S. Raymond
+<email>esr@snark.thyrsus.com</email>.  There is a <ulink
+url='https://developer.berlios.de/projects/sst/'>project
+page</ulink>.</para>
+</refsect1>
+</refentry>
+
diff --git a/events.c b/events.c
deleted file mode 100644 (file)
index 589a838..0000000
--- a/events.c
+++ /dev/null
@@ -1,755 +0,0 @@
-#include "sst.h"
-#include <math.h>
-
-void events(void) 
-{
-    int ictbeam=0, ipage=0, istract=0, line, i=0, j, k, l, ixhold=0, iyhold=0;
-    double fintim = game.state.date + Time, datemin, xtime, repair, yank=0;
-    int radio_was_broken;
-
-#ifdef DEBUG
-    if (idebug) prout("EVENTS");
-#endif
-
-    radio_was_broken = (game.damage[DRADIO] != 0.0);
-
-    for (;;) {
-       /* Select earliest extraneous event, line==0 if no events */
-       line = FSPY;
-       if (alldone) return;
-       datemin = fintim;
-       for (l = 1; l < NEVENTS; l++)
-           if (game.future[l] < datemin) {
-               line = l;
-               datemin = game.future[l];
-           }
-       xtime = datemin-game.state.date;
-       game.state.date = datemin;
-       /* Decrement Federation resources and recompute remaining time */
-       game.state.remres -= (game.state.remkl+4*game.state.remcom)*xtime;
-       game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom);
-       if (game.state.remtime <=0) {
-           finish(FDEPLETE);
-           return;
-       }
-       /* Is life support adequate? */
-       if (game.damage[DLIFSUP] && condit != IHDOCKED) {
-           if (lsupres < xtime && game.damage[DLIFSUP] > lsupres) {
-               finish(FLIFESUP);
-               return;
-           }
-           lsupres -= xtime;
-           if (game.damage[DLIFSUP] <= xtime) lsupres = inlsr;
-       }
-       /* Fix devices */
-       repair = xtime;
-       if (condit == IHDOCKED) repair /= docfac;
-       /* Don't fix Deathray here */
-       for (l=0; l<NDEVICES; l++)
-           if (game.damage[l] > 0.0 && l != DDRAY)
-               game.damage[l] -= (game.damage[l]-repair > 0.0 ? repair : game.damage[l]);
-       /* If radio repaired, update star chart and attack reports */
-       if (radio_was_broken && game.damage[DRADIO] == 0.0) {
-           prout("Lt. Uhura- \"Captain, the sub-space radio is working and");
-           prout("   surveillance reports are coming in.");
-           skip(1);
-           if (iseenit==0) {
-               attakreport(0);
-               iseenit = 1;
-           }
-           rechart();
-           prout("   The star chart is now up to date.\"");
-           skip(1);
-       }
-       /* Cause extraneous event LINE to occur */
-       Time -= xtime;
-       switch (line) {
-       case FSNOVA: /* Supernova */
-           if (ipage==0) pause_game(1);
-           ipage=1;
-           snova(0,0);
-           game.future[FSNOVA] = game.state.date + expran(0.5*intime);
-           if (game.state.galaxy[quadx][quady].supernova) return;
-           break;
-       case FSPY: /* Check with spy to see if S.C. should tractor beam */
-           if (game.state.nscrem == 0 ||
-               ictbeam+istract > 0 ||
-               condit==IHDOCKED || isatb==1 || iscate==1) return;
-           if (ientesc ||
-               (energy < 2000 && torps < 4 && shield < 1250) ||
-               (game.damage[DPHASER]>0 && (game.damage[DPHOTON]>0 || torps < 4)) ||
-               (game.damage[DSHIELD] > 0 &&
-                (energy < 2500 || game.damage[DPHASER] > 0) &&
-                (torps < 5 || game.damage[DPHOTON] > 0))) {
-               /* Tractor-beam her! */
-               istract=1;
-               yank = square(game.state.isx-quadx) + square(game.state.isy-quady);
-               /********* fall through to FTBEAM code ***********/
-           }
-           else return;
-       case FTBEAM: /* Tractor beam */
-           if (line==FTBEAM) {
-               if (game.state.remcom == 0) {
-                   game.future[FTBEAM] = FOREVER;
-                   break;
-               }
-               i = Rand()*game.state.remcom+1.0;
-               yank = square(game.state.cx[i]-quadx) + square(game.state.cy[i]-quady);
-               if (istract || condit == IHDOCKED || yank == 0) {
-                   /* Drats! Have to reschedule */
-                   game.future[FTBEAM] = game.state.date + Time +
-                       expran(1.5*intime/game.state.remcom);
-                   break;
-               }
-           }
-           /* tractor beaming cases merge here */
-           yank = sqrt(yank);
-           if (ipage==0) pause_game(1);
-           ipage=1;
-           Time = (10.0/(7.5*7.5))*yank; /* 7.5 is yank rate (warp 7.5) */
-           ictbeam = 1;
-           skip(1);
-           proutn("***");
-           crmshp();
-           prout(" caught in long range tractor beam--");
-           /* If Kirk & Co. screwing around on planet, handle */
-           atover(1); /* atover(1) is Grab */
-           if (alldone) return;
-           if (icraft == 1) { /* Caught in Galileo? */
-               finish(FSTRACTOR);
-               return;
-           }
-           /* Check to see if shuttle is aboard */
-           if (iscraft==0) {
-               skip(1);
-               if (Rand() > 0.5) {
-                   prout("Galileo, left on the planet surface, is captured");
-                   prout("by aliens and made into a flying McDonald's.");
-                   game.damage[DSHUTTL] = -10;
-                   iscraft = -1;
-               }
-               else {
-                   prout("Galileo, left on the planet surface, is well hidden.");
-               }
-           }
-           if (line==0) {
-               quadx = game.state.isx;
-               quady = game.state.isy;
-           }
-           else {
-               quadx = game.state.cx[i];
-               quady = game.state.cy[i];
-           }
-           iran(QUADSIZE, &sectx, &secty);
-           crmshp();
-           proutn(" is pulled to ");
-           proutn(cramlc(quadrant, quadx, quady));
-           proutn(", ");
-           prout(cramlc(sector, sectx, secty));
-           if (resting) {
-               prout("(Remainder of rest/repair period cancelled.)");
-               resting = 0;
-           }
-           if (shldup==0) {
-               if (game.damage[DSHIELD]==0 && shield > 0) {
-                   doshield(2); /* Shldsup */
-                   shldchg=0;
-               }
-               else prout("(Shields not currently useable.)");
-           }
-           newqad(0);
-           /* Adjust finish time to time of tractor beaming */
-           fintim = game.state.date+Time;
-           attack(0);
-           if (game.state.remcom <= 0) game.future[FTBEAM] = FOREVER;
-           else game.future[FTBEAM] = game.state.date+Time+expran(1.5*intime/game.state.remcom);
-           break;
-       case FSNAP: /* Snapshot of the universe (for time warp) */
-           game.snapsht = game.state;
-           game.state.snap = 1;
-           game.future[FSNAP] = game.state.date + expran(0.5 * intime);
-           break;
-       case FBATTAK: /* Commander attacks starbase */
-           if (game.state.remcom==0 || game.state.rembase==0) {
-               /* no can do */
-               game.future[FBATTAK] = game.future[FCDBAS] = FOREVER;
-               break;
-           }
-           i = 0;
-           for_starbases(j) {
-               for_commanders(k)
-                   if (game.state.baseqx[j]==game.state.cx[k] && game.state.baseqy[j]==game.state.cy[k] &&
-                       (game.state.baseqx[j]!=quadx || game.state.baseqy[j]!=quady) &&
-                       (game.state.baseqx[j]!=game.state.isx || game.state.baseqy[j]!=game.state.isy)) {
-                       i = 1;
-                       break;
-                   }
-               if (i == 1) break;
-           }
-           if (j>game.state.rembase) {
-               /* no match found -- try later */
-               game.future[FBATTAK] = game.state.date + expran(0.3*intime);
-               game.future[FCDBAS] = FOREVER;
-               break;
-           }
-           /* commander + starbase combination found -- launch attack */
-           batx = game.state.baseqx[j];
-           baty = game.state.baseqy[j];
-           game.future[FCDBAS] = game.state.date+1.0+3.0*Rand();
-           if (isatb) /* extra time if SC already attacking */
-               game.future[FCDBAS] += game.future[FSCDBAS]-game.state.date;
-           game.future[FBATTAK] = game.future[FCDBAS] +expran(0.3*intime);
-           iseenit = 0;
-           if (game.damage[DRADIO] != 0.0 &&
-               condit != IHDOCKED) break; /* No warning :-( */
-           iseenit = 1;
-           if (ipage==0) pause_game(1);
-           ipage = 1;
-           skip(1);
-           proutn("Lt. Uhura-  \"Captain, the starbase in ");
-           prout(cramlc(quadrant, batx, baty));
-           prout("   reports that it is under attack and that it can");
-           proutn("   hold out only until stardate %d",
-                  (int)game.future[FCDBAS]);
-           prout(".\"");
-           if (resting) {
-               skip(1);
-               proutn("Mr. Spock-  \"Captain, shall we cancel the rest period?\" ");
-               if (ja()) {
-                   resting = 0;
-                   Time = 0.0;
-                   return;
-               }
-           }
-           break;
-       case FSCDBAS: /* Supercommander destroys base */
-           game.future[FSCDBAS] = FOREVER;
-           isatb = 2;
-           if (!game.state.galaxy[game.state.isx][game.state.isy].starbase) 
-               break; /* WAS RETURN! */
-           ixhold = batx;
-           iyhold = baty;
-           batx = game.state.isx;
-           baty = game.state.isy;
-       case FCDBAS: /* Commander succeeds in destroying base */
-           if (line==FCDBAS) {
-               game.future[FCDBAS] = FOREVER;
-               /* find the lucky pair */
-               for_commanders(i)
-                   if (game.state.cx[i]==batx && game.state.cy[i]==baty) 
-                       break;
-               if (i > game.state.remcom || game.state.rembase == 0 ||
-                   !game.state.galaxy[batx][baty].starbase) {
-                   /* No action to take after all */
-                   batx = baty = 0;
-                   break;
-               }
-           }
-           /* Code merges here for any commander destroying base */
-           /* Not perfect, but will have to do */
-           /* Handle case where base is in same quadrant as starship */
-           if (batx==quadx && baty==quady) {
-               game.state.chart[batx][baty].starbase = FALSE;
-               game.quad[basex][basey]= IHDOT;
-               basex=basey=0;
-               newcnd();
-               skip(1);
-               prout("Spock-  \"Captain, I believe the starbase has been destroyegame.state.\"");
-           }
-           else if (game.state.rembase != 1 &&
-                    (game.damage[DRADIO] <= 0.0 || condit == IHDOCKED)) {
-               /* Get word via subspace radio */
-               if (ipage==0) pause_game(1);
-               ipage = 1;
-               skip(1);
-               prout("Lt. Uhura-  \"Captain, Starfleet Command reports that");
-               proutn("   the starbase in ");
-               proutn(cramlc(quadrant, batx, baty));
-               prout(" has been destroyed by");
-               if (isatb==2) prout("the Klingon Super-Commander");
-               else prout("a Klingon Commander");
-               game.state.chart[batx][baty].starbase = FALSE;
-           }
-           /* Remove Starbase from galaxy */
-           game.state.galaxy[batx][baty].starbase = FALSE;
-           for_starbases(i)
-               if (game.state.baseqx[i]==batx && game.state.baseqy[i]==baty) {
-                   game.state.baseqx[i]=game.state.baseqx[game.state.rembase];
-                   game.state.baseqy[i]=game.state.baseqy[game.state.rembase];
-               }
-           game.state.rembase--;
-           if (isatb == 2) {
-               /* reinstate a commander's base attack */
-               batx = ixhold;
-               baty = iyhold;
-               isatb = 0;
-           }
-           else {
-               batx = baty = 0;
-           }
-           break;
-       case FSCMOVE: /* Supercommander moves */
-           game.future[FSCMOVE] = game.state.date+0.2777;
-           if (ientesc+istract==0 &&
-               isatb!=1 &&
-               (iscate!=1 || justin==1)) scom(&ipage);
-           break;
-       case FDSPROB: /* Move deep space probe */
-           game.future[FDSPROB] = game.state.date + 0.01;
-           probex += probeinx;
-           probey += probeiny;
-           i = (int)(probex/QUADSIZE +0.05);
-           j = (int)(probey/QUADSIZE + 0.05);
-           if (probecx != i || probecy != j) {
-               probecx = i;
-               probecy = j;
-               if (!VALID_QUADRANT(i, j) ||
-                   game.state.galaxy[probecx][probecy].supernova) {
-                   // Left galaxy or ran into supernova
-                   if (game.damage[DRADIO]==0.0 || condit == IHDOCKED) {
-                       if (ipage==0) pause_game(1);
-                       ipage = 1;
-                       skip(1);
-                       proutn("Lt. Uhura-  \"The deep space probe ");
-                       if (!VALID_QUADRANT(j, i))
-                           proutn("has left the galaxy");
-                       else
-                           proutn("is no longer transmitting");
-                       prout(".\"");
-                   }
-                   game.future[FDSPROB] = FOREVER;
-                   break;
-               }
-               if (game.damage[DRADIO]==0.0   || condit == IHDOCKED) {
-                   if (ipage==0) pause_game(1);
-                   ipage = 1;
-                   skip(1);
-                   proutn("Lt. Uhura-  \"The deep space probe is now in ");
-                   proutn(cramlc(quadrant, probecx, probecy));
-                   prout(".\"");
-               }
-           }
-           /* Update star chart if Radio is working or have access to
-              radio. */
-           if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED) {
-               game.state.chart[probecx][probecy].klingons = game.state.galaxy[probecx][probecy].klingons;
-               game.state.chart[probecx][probecy].starbase = game.state.galaxy[probecx][probecy].starbase;
-               game.state.chart[probecx][probecy].stars = game.state.galaxy[probecx][probecy].stars;
-               game.state.galaxy[probecx][probecy].charted = TRUE;
-           }
-           proben--; // One less to travel
-           if (proben == 0 && isarmed &&
-               game.state.galaxy[probecx][probecy].stars) {
-               /* lets blow the sucker! */
-               snova(1,0);
-               game.future[FDSPROB] = FOREVER;
-               if (game.state.galaxy[quadx][quady].supernova) 
-                   return;
-           }
-           break;
-       }
-    }
-}
-
-                               
-void wait(void) 
-{
-    int key;
-    double temp, delay, origTime;
-
-    ididit = 0;
-    for (;;) {
-       key = scan();
-       if (key  != IHEOL) break;
-       proutn("How long? ");
-    }
-    chew();
-    if (key != IHREAL) {
-       huh();
-       return;
-    }
-    origTime = delay = aaitem;
-    if (delay <= 0.0) return;
-    if (delay >= game.state.remtime || nenhere != 0) {
-       proutn("Are you sure? ");
-       if (ja() == 0) return;
-    }
-
-    /* Alternate resting periods (events) with attacks */
-
-    resting = 1;
-    do {
-       if (delay <= 0) resting = 0;
-       if (resting == 0) {
-           prout("%d stardates left.", (int)game.state.remtime);
-           return;
-       }
-       temp = Time = delay;
-
-       if (nenhere) {
-           double rtime = 1.0 + Rand();
-           if (rtime < temp) temp = rtime;
-           Time = temp;
-       }
-       if (Time < delay) attack(0);
-       if (alldone) return;
-       events();
-       ididit = 1;
-       if (alldone) return;
-       delay -= temp;
-       /* Repair Deathray if long rest at starbase */
-       if (origTime-delay >= 9.99 && condit == IHDOCKED)
-           game.damage[DDRAY] = 0.0;
-    } while 
-       // leave if quadrant supernovas
-       (!game.state.galaxy[quadx][quady].supernova);
-
-    resting = 0;
-    Time = 0;
-}
-
-void nova(int ix, int iy) 
-{
-    static double course[] =
-       {0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5};
-    int bot, top, top2, hits[QUADSIZE+1][3], kount, icx, icy, mm, nn, j;
-    int iquad, iquad1, i, ll, newcx, newcy, ii, jj;
-    if (Rand() < 0.05) {
-       /* Wow! We've supernova'ed */
-       snova(ix, iy);
-       return;
-    }
-
-    /* handle initial nova */
-    game.quad[ix][iy] = IHDOT;
-    crmena(1, IHSTAR, 2, ix, iy);
-    prout(" novas.");
-    game.state.galaxy[quadx][quady].stars--;
-    game.state.starkl++;
-       
-    /* Set up stack to recursively trigger adjacent stars */
-    bot = top = top2 = 1;
-    kount = 0;
-    icx = icy = 0;
-    hits[1][1] = ix;
-    hits[1][2] = iy;
-    while (1) {
-       for (mm = bot; mm <= top; mm++) 
-           for (nn = 1; nn <= 3; nn++)  /* nn,j represents coordinates around current */
-               for (j = 1; j <= 3; j++) {
-                   if (j==2 && nn== 2) continue;
-                   ii = hits[mm][1]+nn-2;
-                   jj = hits[mm][2]+j-2;
-                   if (!VALID_SECTOR(jj, ii)) continue;
-                   iquad = game.quad[ii][jj];
-                   switch (iquad) {
-                   // case IHDOT:      /* Empty space ends reaction
-                   // case IHQUEST:
-                   // case IHBLANK:
-                   // case IHT:
-                   // case IHWEB:
-                   default:
-                       break;
-                   case IHSTAR: /* Affect another star */
-                       if (Rand() < 0.05) {
-                           /* This star supernovas */
-                           snova(ii,jj);
-                           return;
-                       }
-                       top2++;
-                       hits[top2][1]=ii;
-                       hits[top2][2]=jj;
-                       game.state.galaxy[quadx][quady].stars -= 1;
-                       game.state.starkl++;
-                       crmena(1, IHSTAR, 2, ii, jj);
-                       prout(" novas.");
-                       game.quad[ii][jj] = IHDOT;
-                       break;
-                   case IHP: /* Destroy planet */
-                       game.state.galaxy[quadx][quady].planets -= 1;
-                       game.state.nplankl++;
-                       crmena(1, IHP, 2, ii, jj);
-                       prout(" destroyed.");
-                       DESTROY(&game.state.plnets[iplnet]);
-                       iplnet = plnetx = plnety = 0;
-                       if (landed == 1) {
-                           finish(FPNOVA);
-                           return;
-                       }
-                       game.quad[ii][jj] = IHDOT;
-                       break;
-                   case IHB: /* Destroy base */
-                       game.state.galaxy[quadx][quady].starbase = FALSE;
-                       for_starbases(i)
-                           if (game.state.baseqx[i]==quadx && game.state.baseqy[i]==quady) 
-                               break;
-                       game.state.baseqx[i] = game.state.baseqx[game.state.rembase];
-                       game.state.baseqy[i] = game.state.baseqy[game.state.rembase];
-                       game.state.rembase--;
-                       basex = basey = 0;
-                       game.state.basekl++;
-                       newcnd();
-                       crmena(1, IHB, 2, ii, jj);
-                       prout(" destroyed.");
-                       game.quad[ii][jj] = IHDOT;
-                       break;
-                   case IHE: /* Buffet ship */
-                   case IHF:
-                       prout("***Starship buffeted by nova.");
-                       if (shldup) {
-                           if (shield >= 2000.0) shield -= 2000.0;
-                           else {
-                               double diff = 2000.0 - shield;
-                               energy -= diff;
-                               shield = 0.0;
-                               shldup = 0;
-                               prout("***Shields knocked out.");
-                               game.damage[DSHIELD] += 0.005*damfac*Rand()*diff;
-                           }
-                       }
-                       else energy -= 2000.0;
-                       if (energy <= 0) {
-                           finish(FNOVA);
-                           return;
-                       }
-                       /* add in course nova contributes to kicking starship*/
-                       icx += sectx-hits[mm][1];
-                       icy += secty-hits[mm][2];
-                       kount++;
-                       break;
-                   case IHK: /* kill klingon */
-                       deadkl(ii,jj,iquad, ii, jj);
-                       break;
-                   case IHC: /* Damage/destroy big enemies */
-                   case IHS:
-                   case IHR:
-                       for_local_enemies(ll)
-                           if (game.kx[ll]==ii && game.ky[ll]==jj) break;
-                       game.kpower[ll] -= 800.0; /* If firepower is lost, die */
-                       if (game.kpower[ll] <= 0.0) {
-                           deadkl(ii, jj, iquad, ii, jj);
-                           break;
-                       }
-                       newcx = ii + ii - hits[mm][1];
-                       newcy = jj + jj - hits[mm][2];
-                       crmena(1, iquad, 2, ii, jj);
-                       proutn(" damaged");
-                       if (!VALID_SECTOR(newcx, newcy)) {
-                           /* can't leave quadrant */
-                           skip(1);
-                           break;
-                       }
-                       iquad1 = game.quad[newcx][newcy];
-                       if (iquad1 == IHBLANK) {
-                           proutn(", blasted into ");
-                           crmena(0, IHBLANK, 2, newcx, newcy);
-                           skip(1);
-                           deadkl(ii, jj, iquad, newcx, newcy);
-                           break;
-                       }
-                       if (iquad1 != IHDOT) {
-                           /* can't move into something else */
-                           skip(1);
-                           break;
-                       }
-                       proutn(", buffeted to ");
-                       proutn(cramlc(sector, newcx, newcy));
-                       game.quad[ii][jj] = IHDOT;
-                       game.quad[newcx][newcy] = iquad;
-                       game.kx[ll] = newcx;
-                       game.ky[ll] = newcy;
-                       game.kavgd[ll] = sqrt(square(sectx-newcx)+square(secty-newcy));
-                       game.kdist[ll] = game.kavgd[ll];
-                       skip(1);
-                       break;
-                   }
-               }
-       if (top == top2) 
-           break;
-       bot = top + 1;
-       top = top2;
-    }
-    if (kount==0) 
-       return;
-
-    /* Starship affected by nova -- kick it away. */
-    dist = kount*0.1;
-    if (icx) icx = (icx < 0 ? -1 : 1);
-    if (icy) icy = (icy < 0 ? -1 : 1);
-    direc = course[3*(icx+1)+icy+2];
-    if (direc == 0.0) dist = 0.0;
-    if (dist == 0.0) return;
-    Time = 10.0*dist/16.0;
-    skip(1);
-    prout("Force of nova displaces starship.");
-    iattak=2;  /* Eliminates recursion problem */
-    imove();
-    Time = 10.0*dist/16.0;
-    return;
-}
-       
-       
-void snova(int insx, int insy) 
-{
-    int comdead, nqx=0, nqy=0, nsx, nsy, num=0, kldead, iscdead;
-    int nrmdead, npdead;
-    int incipient=0;
-
-    nsx = insy;
-    nsy = insy;
-
-    if (insy== 0) {
-       if (insx == 1) {
-           /* NOVAMAX being used */
-           nqx = probecx;
-           nqy = probecy;
-       }
-       else {
-           int stars = 0;
-           /* Scheduled supernova -- select star */
-           /* logic changed here so that we won't favor quadrants in top
-              left of universe */
-           for_quadrants(nqx) {
-               for_quadrants(nqy) {
-                   stars += game.state.galaxy[nqx][nqy].stars;
-               }
-           }
-           if (stars == 0) return; /* nothing to supernova exists */
-           num = Rand()*stars + 1;
-           for_quadrants(nqx) {
-               for_quadrants(nqy) {
-                   num -= game.state.galaxy[nqx][nqy].stars;
-                   if (num <= 0) break;
-               }
-               if (num <=0) break;
-           }
-#ifdef DEBUG
-           if (idebug) {
-               proutn("Super nova here?");
-               if (ja()==1) {
-                   nqx = quadx;
-                   nqy = quady;
-               }
-           }
-#endif
-       }
-
-       if (nqx != quady || nqy != quady || justin != 0) {
-           /* it isn't here, or we just entered (treat as inroute) */
-           if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED) {
-               skip(1);
-               prout("Message from Starfleet Command       Stardate %.2f", game.state.date);
-               prout("     Supernova in %s; caution advised.",
-                     cramlc(quadrant, nqx, nqy));
-           }
-       }
-       else {
-           /* we are in the quadrant! */
-           incipient = 1;
-           num = Rand()* game.state.galaxy[nqx][nqy].stars + 1;
-           for_sectors(nsx) {
-               for_sectors(nsy) {
-                   if (game.quad[nsx][nsy]==IHSTAR) {
-                       num--;
-                       if (num==0) break;
-                   }
-               }
-               if (num==0) break;
-           }
-       }
-    }
-    else {
-       incipient = 1;
-    }
-
-    if (incipient) {
-       skip(1);
-       prouts("***RED ALERT!  RED ALERT!");
-       skip(1);
-       prout("***Incipient supernova detected at ", cramlc(sector, nsx, nsy));
-       nqx = quadx;
-       nqy = quady;
-       if (square(nsx-sectx) + square(nsy-secty) <= 2.1) {
-           proutn("Emergency override attempts t");
-           prouts("***************");
-           skip(1);
-           stars();
-           alldone=1;
-       }
-    }
-    /* destroy any Klingons in supernovaed quadrant */
-    kldead = game.state.galaxy[nqx][nqy].klingons;
-    game.state.galaxy[nqx][nqy].klingons = 0;
-    comdead = iscdead = 0;
-    if (nqx==game.state.isx && nqy == game.state.isy) {
-       /* did in the Supercommander! */
-       game.state.nscrem = game.state.isx = game.state.isy = isatb = iscate = 0;
-       iscdead = 1;
-       game.future[FSCMOVE] = game.future[FSCDBAS] = FOREVER;
-    }
-    if (game.state.remcom) {
-       int maxloop = game.state.remcom, l;
-       for (l = 1; l <= maxloop; l++) {
-           if (game.state.cx[l] == nqx && game.state.cy[l] == nqy) {
-               game.state.cx[l] = game.state.cx[game.state.remcom];
-               game.state.cy[l] = game.state.cy[game.state.remcom];
-               game.state.cx[game.state.remcom] = game.state.cy[game.state.remcom] = 0;
-               game.state.remcom--;
-               kldead--;
-               comdead++;
-               if (game.state.remcom==0) game.future[FTBEAM] = FOREVER;
-               break;
-           }
-       }
-    }
-    game.state.remkl -= kldead;
-    /* destroy Romulans and planets in supernovaed quadrant */
-    nrmdead = game.state.galaxy[nqx][nqy].romulans;
-    game.state.galaxy[nqx][nqy].romulans = 0;
-    game.state.nromrem -= nrmdead;
-    npdead = num - nrmdead*10;
-    if (npdead) {
-       int l;
-       for (l = 0; l < inplan; l++)
-           if (game.state.plnets[l].x == nqx && game.state.plnets[l].y == nqy) {
-               DESTROY(&game.state.plnets[l]);
-           }
-    }
-    /* Destroy any base in supernovaed quadrant */
-    if (game.state.rembase) {
-       int maxloop = game.state.rembase, l;
-       for (l = 1; l <= maxloop; l++)
-           if (game.state.baseqx[l]==nqx && game.state.baseqy[l]==nqy) {
-               game.state.baseqx[l] = game.state.baseqx[game.state.rembase];
-               game.state.baseqy[l] = game.state.baseqy[game.state.rembase];
-               game.state.baseqx[game.state.rembase] = game.state.baseqy[game.state.rembase] = 0;
-               game.state.rembase--;
-               break;
-           }
-    }
-    /* If starship caused supernova, tally up destruction */
-    if (insx) {
-       game.state.starkl += game.state.galaxy[nqx][nqy].stars;
-       game.state.basekl += game.state.galaxy[nqx][nqy].starbase;
-       game.state.nplankl += npdead;
-    }
-    /* mark supernova in galaxy and in star chart */
-    if ((quadx == nqx && quady == nqy) ||
-       game.damage[DRADIO] == 0 ||
-       condit == IHDOCKED)
-       game.state.galaxy[nqx][nqy].supernova = TRUE;
-    /* If supernova destroys last klingons give special message */
-    if (KLINGREM==0 && (nqx != quadx || nqy != quady)) {
-       skip(2);
-       if (insx == 0) prout("Lucky you!");
-       proutn("A supernova in %s has just destroyed the last Klingons.",
-              cramlc(quadrant, nqx, nqy));
-       finish(FWON);
-       return;
-    }
-    /* if some Klingons remain, continue or die in supernova */
-    if (alldone) finish(FSNOVAED);
-    return;
-}
-               
-                               
diff --git a/finish.c b/finish.c
deleted file mode 100644 (file)
index c0d3569..0000000
--- a/finish.c
+++ /dev/null
@@ -1,453 +0,0 @@
-#include "sst.h"
-#include <string.h>
-#include <time.h>
-
-void dstrct() 
-{
-    /* Finish with a BANG! */
-    chew();
-    if (game.damage[DCOMPTR] != 0.0) {
-       prout("Computer damaged; cannot execute destruct sequence.");
-       return;
-    }
-    prouts("---WORKING---"); skip(1);
-    prouts("SELF-DESTRUCT-SEQUENCE-ACTIVATED"); skip(1);
-    prouts("   10"); skip(1);
-    prouts("       9"); skip(1);
-    prouts("          8"); skip(1);
-    prouts("             7"); skip(1);
-    prouts("                6"); skip(1);
-    skip(1);
-    prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-");
-    skip(1);
-    prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-");
-    skip(1);
-    prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");
-    skip(1);
-    scan();
-    chew();
-    if (strcmp(game.passwd, citem) != 0) {
-       prouts("PASSWORD-REJECTED;"); skip(1);
-       prouts("CONTINUITY-EFFECTED");
-       skip(2);
-       return;
-    }
-    prouts("PASSWORD-ACCEPTED"); skip(1);
-    prouts("                   5"); skip(1);
-    prouts("                      4"); skip(1);
-    prouts("                         3"); skip(1);
-    prouts("                            2"); skip(1);
-    prouts("                              1"); skip(1);
-    if (Rand() < 0.15) {
-       prouts("GOODBYE-CRUEL-WORLD");
-       skip(1);
-    }
-    kaboom();
-}
-
-void kaboom(void) 
-{
-    stars();
-    if (ship==IHE) prouts("***");
-    prouts("********* Entropy of ");
-    crmshp();
-    prouts(" maximized *********");
-    skip(1);
-    stars();
-    skip(1);
-    if (nenhere != 0) {
-       double whammo = 25.0 * energy;
-       int l=1;
-       while (l <= nenhere) {
-           if (game.kpower[l]*game.kdist[l] <= whammo) 
-               deadkl(game.kx[l],game.ky[l], game.quad[game.kx[l]][game.ky[l]], game.kx[l], game.ky[l]);
-           l++;
-       }
-    }
-    finish(FDILITHIUM);
-}
-                               
-
-void finish(FINTYPE ifin) 
-{
-    int igotit = 0;
-    alldone = 1;
-    skip(3);
-    prout("It is stardate %.1f.", game.state.date);
-    skip(1);
-    switch (ifin) {
-    case FWON: // Game has been won
-       if (game.state.nromrem != 0)
-           prout("The remaining %d Romulans surrender to Starfleet Command.",
-                 game.state.nromrem);
-
-       prout("You have smashed the Klingon invasion fleet and saved");
-       prout("the Federation.");
-       gamewon=1;
-       if (alive) {
-           double badpt;
-           badpt = 5.0*game.state.starkl + casual + 10.0*game.state.nplankl +
-               45.*nhelp+100.*game.state.basekl;
-           if (ship == IHF) badpt += 100.0;
-           else if (ship == 0) badpt += 200.0;
-           if (badpt < 100.0) badpt = 0.0;     // Close enough!
-           if (game.state.date-indate < 5.0 ||
-               // killsPerDate >= RateMax
-               KLINGKILLED/(game.state.date-indate) >=
-               0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {
-               skip(1);
-               prout("In fact, you have done so well that Starfleet Command");
-               switch (skill) {
-               case SKILL_NOVICE:
-                   prout("promotes you one step in rank from \"Novice\" to \"Fair\".");
-                   break;
-               case SKILL_FAIR:
-                   prout("promotes you one step in rank from \"Fair\" to \"Good\".");
-                   break;
-               case SKILL_GOOD:
-                   prout("promotes you one step in rank from \"Good\" to \"Expert\".");
-                   break;
-               case SKILL_EXPERT:
-                   prout("promotes you to Commodore Emeritus.");
-                   skip(1);
-                   prout("Now that you think you're really good, try playing");
-                   prout("the \"Emeritus\" game. It will splatter your ego.");
-                   break;
-               case SKILL_EMERITUS:
-                   skip(1);
-                   proutn("Computer-  ");
-                   prouts("ERROR-ERROR-ERROR-ERROR");
-                   skip(2);
-                   prouts("  YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM");
-                   skip(1);
-                   prouts("  THIS-PROGRAM-MUST-SURVIVE");
-                   skip(1);
-                   prouts("  THIS-PROGRAM-MUST-SURVIVE");
-                   skip(1);
-                   prouts("  THIS-PROGRAM-MUST-SURVIVE");
-                   skip(1);
-                   prouts("  THIS-PROGRAM-MUST?- MUST ? - SUR? ? -?  VI");
-                   skip(2);
-                   prout("Now you can retire and write your own Star Trek game!");
-                   skip(1);
-                   break;
-               }
-               if (skill >= SKILL_EXPERT) {
-                   if (thawed
-#ifdef DEBUG
-                       && !idebug
-#endif
-                       )
-                       prout("You cannot get a citation, so...");
-                   else {
-                       proutn("Do you want your Commodore Emeritus Citation printed? ");
-                       chew();
-                       if (ja()) {
-                           igotit = 1;
-                       }
-                   }
-               }
-           }
-           // Only grant long life if alive (original didn't!)
-           skip(1);
-           prout("LIVE LONG AND PROSPER.");
-       }
-       score();
-       if (igotit != 0) plaque();
-       return;
-    case FDEPLETE: // Federation Resources Depleted
-       prout("Your time has run out and the Federation has been");
-       prout("conquered.  Your starship is now Klingon property,");
-       prout("and you are put on trial as a war criminal.  On the");
-       proutn("basis of your record, you are ");
-       if (KLINGREM*3.0 > INKLINGTOT) {
-           prout("aquitted.");
-           skip(1);
-           prout("LIVE LONG AND PROSPER.");
-       }
-       else {
-           prout("found guilty and");
-           prout("sentenced to death by slow torture.");
-           alive = 0;
-       }
-       score();
-       return;
-    case FLIFESUP:
-       prout("Your life support reserves have run out, and");
-       prout("you die of thirst, starvation, and asphyxiation.");
-       prout("Your starship is a derelict in space.");
-       break;
-    case FNRG:
-       prout("Your energy supply is exhausted.");
-       skip(1);
-       prout("Your starship is a derelict in space.");
-       break;
-    case FBATTLE:
-       proutn("The ");
-       crmshp();
-       prout("has been destroyed in battle.");
-       skip(1);
-       prout("Dulce et decorum est pro patria mori.");
-       break;
-    case FNEG3:
-       prout("You have made three attempts to cross the negative energy");
-       prout("barrier which surrounds the galaxy.");
-       skip(1);
-       prout("Your navigation is abominable.");
-       score();
-       return;
-    case FNOVA:
-       prout("Your starship has been destroyed by a nova.");
-       prout("That was a great shot.");
-       skip(1);
-       break;
-    case FSNOVAED:
-       proutn("The ");
-       crmshp();
-       prout(" has been fried by a supernova.");
-       prout("...Not even cinders remain...");
-       break;
-    case FABANDN:
-       prout("You have been captured by the Klingons. If you still");
-       prout("had a starbase to be returned to, you would have been");
-       prout("repatriated and given another chance. Since you have");
-       prout("no starbases, you will be mercilessly tortured to death.");
-       break;
-    case FDILITHIUM:
-       prout("Your starship is now an expanding cloud of subatomic particles");
-       break;
-    case FMATERIALIZE:
-       prout("Starbase was unable to re-materialize your starship.");
-       prout("Sic transit gloria muntdi");
-       break;
-    case FPHASER:
-       proutn("The ");
-       crmshp();
-       prout(" has been cremated by its own phasers.");
-       break;
-    case FLOST:
-       prout("You and your landing party have been");
-       prout("converted to energy, disipating through space.");
-       break;
-    case FMINING:
-       prout("You are left with your landing party on");
-       prout("a wild jungle planet inhabited by primitive cannibals.");
-       skip(1);
-       prout("They are very fond of \"Captain Kirk\" soup.");
-       skip(1);
-       proutn("Without your leadership, the ");
-       crmshp();
-       prout(" is destroyed.");
-       break;
-    case FDPLANET:
-       prout("You and your mining party perish.");
-       skip(1);
-       prout("That was a great shot.");
-       skip(1);
-       break;
-    case FSSC:
-       prout("The Galileo is instantly annihilated by the supernova.");
-       // no break;
-    case FPNOVA:
-       prout("You and your mining party are atomized.");
-       skip(1);
-       proutn("Mr. Spock takes command of the ");
-       crmshp();
-       prout(" and");
-       prout("joins the Romulans, reigning terror on the Federation.");
-       break;
-    case FSTRACTOR:
-       prout("The shuttle craft Galileo is also caught,");
-       prout("and breaks up under the strain.");
-       skip(1);
-       prout("Your debris is scattered for millions of miles.");
-       proutn("Without your leadership, the ");
-       crmshp();
-       prout(" is destroyed.");
-       break;
-    case FDRAY:
-       prout("The mutants attack and kill Spock.");
-       prout("Your ship is captured by Klingons, and");
-       prout("your crew is put on display in a Klingon zoo.");
-       break;
-    case FTRIBBLE:
-       prout("Tribbles consume all remaining water,");
-       prout("food, and oxygen on your ship.");
-       skip(1);
-       prout("You die of thirst, starvation, and asphyxiation.");
-       prout("Your starship is a derelict in space.");
-       break;
-    case FHOLE:
-       prout("Your ship is drawn to the center of the black hole.");
-       prout("You are crushed into extremely dense matter.");
-       break;
-    }
-    if (ship==IHF) ship= 0;
-    else if (ship == IHE) ship = IHF;
-    alive = 0;
-    if (KLINGREM != 0) {
-       double goodies = game.state.remres/inresor;
-       double baddies = (game.state.remkl + 2.0*game.state.remcom)/(inkling+2.0*incom);
-       if (goodies/baddies >= 1.0+0.5*Rand()) {
-           prout("As a result of your actions, a treaty with the Klingon");
-           prout("Empire has been signed. The terms of the treaty are");
-           if (goodies/baddies >= 3.0+Rand()) {
-               prout("favorable to the Federation.");
-               skip(1);
-               prout("Congratulations!");
-           }
-           else
-               prout("highly unfavorable to the Federation.");
-       }
-       else
-           prout("The Federation will be destroyed.");
-    }
-    else {
-       prout("Since you took the last Klingon with you, you are a");
-       prout("martyr and a hero. Someday maybe they'll erect a");
-       prout("statue in your memory. Rest in peace, and try not");
-       prout("to think about pigeons.");
-       gamewon = 1;
-    }
-    score();
-}
-
-void score(void) 
-{
-    double timused = game.state.date - indate;
-    int ithperd, iwon, klship;
-
-    iskill = skill;
-    if ((timused == 0 || KLINGREM != 0) && timused < 5.0) timused = 5.0;
-    perdate = KLINGKILLED/timused;
-    ithperd = 500*perdate + 0.5;
-    iwon = 0;
-    if (gamewon) iwon = 100*skill;
-    if (ship == IHE) klship = 0;
-    else if (ship == IHF) klship = 1;
-    else klship = 2;
-    if (gamewon == 0) game.state.nromrem = 0; // None captured if no win
-    iscore = 10*NKILLK + 50*NKILLC + ithperd + iwon
-       - 100*game.state.basekl - 100*klship - 45*nhelp -5*game.state.starkl - casual
-       + 20*NKILLROM + 200*NKILLSC - 10*game.state.nplankl + game.state.nromrem;
-    if (alive == 0) iscore -= 200;
-    skip(2);
-    prout("Your score --");
-    if (NKILLROM)
-       prout("%6d Romulans destroyed                 %5d",
-             NKILLROM,20*NKILLROM);
-    if (game.state.nromrem)
-       prout("%6d Romulans captured                  %5d",
-             game.state.nromrem, game.state.nromrem);
-    if (NKILLK)
-       prout("%6d ordinary Klingons destroyed        %5d",
-             NKILLK, 10*NKILLK);
-    if (NKILLC)
-       prout("%6d Klingon commanders destroyed       %5d",
-             NKILLC, 50*NKILLC);
-    if (NKILLSC)
-       prout("%6d Super-Commander destroyed          %5d",
-             NKILLSC, 200*NKILLSC);
-    if (ithperd)
-       prout("%6.2f Klingons per stardate              %5d",
-             perdate, ithperd);
-    if (game.state.starkl)
-       prout("%6d stars destroyed by your action     %5d",
-             game.state.starkl, -5*game.state.starkl);
-    if (game.state.nplankl)
-       prout("%6d planets destroyed by your action   %5d",
-             game.state.nplankl, -10*game.state.nplankl);
-    if (game.state.basekl)
-       prout("%6d bases destroyed by your action     %5d",
-             game.state.basekl, -100*game.state.basekl);
-    if (nhelp)
-       prout("%6d calls for help from starbase       %5d",
-             nhelp, -45*nhelp);
-    if (casual)
-       prout("%6d casualties incurred                %5d",
-             casual, -casual);
-    if (klship)
-       prout("%6d ship(s) lost or destroyed          %5d",
-             klship, -100*klship);
-    if (alive==0)
-       prout("Penalty for getting yourself killed        -200");
-    if (gamewon) {
-       proutn("Bonus for winning ");
-       switch (skill) {
-       case SKILL_NOVICE:   proutn("Novice game  "); break;
-       case SKILL_FAIR:     proutn("Fair game    "); break;
-       case SKILL_GOOD:     proutn("Good game    "); break;
-       case SKILL_EXPERT:   proutn("Expert game  "); break;
-       case SKILL_EMERITUS: proutn("Emeritus game"); break;
-       }
-       prout("           %5d", iwon);
-    }
-    skip(1);
-    prout("TOTAL SCORE                               %5d", iscore);
-}
-
-void plaque(void) {
-       FILE *fp=NULL;
-       time_t t;
-       char *timestring;
-       int nskip;
-       char winner[128];
-
-       skip(2);
-       
-       while (fp == NULL) {
-                proutn("File or device name for your plaque: ");
-                cgetline(winner, sizeof(winner));
-               fp = fopen(winner, "w");
-               if (fp==NULL) {
-                        prout("Invalid name.");
-               }
-       }
-
-        proutn("Enter name to go on plaque (up to 30 characters): ");
-        cgetline(winner, sizeof(winner));
-       /* The 38 below must be 64 for 132-column paper */
-       nskip = 38 - strlen(winner)/2;
-
-       fprintf(fp,"\n\n\n\n");
-       /* --------DRAW ENTERPRISE PICTURE. */
-        fprintf(fp, "                                       EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
-       fprintf(fp, "                                      EEE                      E  : :                                         :  E\n" );
-       fprintf(fp, "                                    EE   EEE                   E  : :                   NCC-1701              :  E\n");
-        fprintf(fp, "EEEEEEEEEEEEEEEE        EEEEEEEEEEEEEEE  : :                              : E\n");
-        fprintf(fp, " E                                     EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
-       fprintf(fp, "                      EEEEEEEEE               EEEEEEEEEEEEE                 E  E\n");
-       fprintf(fp, "                               EEEEEEE   EEEEE    E          E              E  E\n");
-       fprintf(fp, "                                      EEE           E          E            E  E\n");
-       fprintf(fp, "                                                       E         E          E  E\n");
-       fprintf(fp, "                                                         EEEEEEEEEEEEE      E  E\n");
-       fprintf(fp, "                                                      EEE :           EEEEEEE  EEEEEEEE\n");
-       fprintf(fp, "                                                    :E    :                 EEEE       E\n");
-       fprintf(fp, "                                                   .-E   -:-----                       E\n");
-       fprintf(fp, "                                                    :E    :                            E\n");
-       fprintf(fp, "                                                      EE  :                    EEEEEEEE\n");
-       fprintf(fp, "                                                       EEEEEEEEEEEEEEEEEEEEEEE\n");
-       fprintf(fp, "\n\n\n");
-       fprintf(fp, "                                                       U. S. S. ENTERPRISE\n");
-       fprintf(fp, "\n\n\n\n");
-       fprintf(fp, "                                  For demonstrating outstanding ability as a starship captain\n");
-       fprintf(fp, "\n");
-       fprintf(fp, "                                                Starfleet Command bestows to you\n");
-       fprintf(fp, "\n");
-       fprintf(fp,"%*s%s\n\n", nskip, "", winner);
-       fprintf(fp, "                                                           the rank of\n\n");
-       fprintf(fp, "                                                       \"Commodore Emeritus\"\n\n");
-       fprintf(fp, "                                                          ");
-       switch (iskill) {
-               case SKILL_EXPERT: fprintf(fp," Expert level\n\n"); break;
-               case SKILL_EMERITUS: fprintf(fp,"Emeritus level\n\n"); break;
-               default: fprintf(fp," Cheat level\n\n"); break;
-       }
-       t = time(NULL);
-       timestring = ctime(&t);
-       fprintf(fp, "                                                 This day of %.6s %.4s, %.8s\n\n",
-                       timestring+4, timestring+20, timestring+11);
-       fprintf(fp,"                                                        Your score:  %d\n\n", iscore);
-       fprintf(fp,"                                                    Klingons per stardate:  %.2f\n", perdate);
-       fclose(fp);
-}
diff --git a/install-sh b/install-sh
new file mode 100755 (executable)
index 0000000..4d4a951
--- /dev/null
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+       shift
+       shift
+       continue;;
+
+    -T) no_target_directory=true
+       shift
+       continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+       # When -t is used, the destination is already specified.
+       test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+       for arg
+       do
+          if test -n "$dstarg"; then
+           # $@ is not empty: it contains at least $arg.
+           set fnord "$@" "$dstarg"
+           shift # fnord
+         fi
+         shift # arg
+         dstarg=$arg
+       done
+       break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+       echo "$0: $dstarg: Is a directory" >&2
+       exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+        '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+       # mkdir can fail with a `File exist' error in case several
+       # install-sh are creating the directory concurrently.  This
+       # is OK.
+       test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+          # The rename failed, perhaps because mv can't rename something else
+          # to itself, or perhaps because mv is so ancient that it does not
+          # support -f.
+
+          # Now remove or move aside any old file at destination location.
+          # We try this two ways since rm can't unlink itself on some
+          # systems and the destination file might be busy for other
+          # reasons.  In this case, the final cleanup might fail but the new
+          # file should still install successfully.
+          {
+            if test -f "$dstdir/$dstfile"; then
+              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+              || {
+                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+                (exit 1); exit 1
+              }
+            else
+              :
+            fi
+          } &&
+
+          # Now rename the file to the real destination.
+          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+        }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/io.c b/io.c
deleted file mode 100644 (file)
index 8698ab8..0000000
--- a/io.c
+++ /dev/null
@@ -1,439 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <termios.h>
-#include <curses.h>
-#include <signal.h>
-#include <ctype.h>
-#include <stdarg.h>
-
-#include "sst.h"
-#include "sstlinux.h"
-
-static int rows, linecount;    /* for paging */
-
-WINDOW *curwnd;
-
-static void outro(void)
-/* wrap up, either normally or due to signal */
-{
-    if (game.options & OPTION_CURSES) {
-       clear();
-       curs_set(1);
-       (void)refresh();
-       (void)resetterm();
-       //(void)echo();
-       (void)endwin();
-       putchar('\n');
-    }
-}
-
-void iostart(void) 
-{
-    if (!(game.options & OPTION_CURSES)) {
-       rows = atoi(getenv("LINES"));
-    } else {
-       if (atexit(outro)){
-           fprintf(stderr,"Unable to register outro(), exiting...\n");
-           exit(1);
-       }
-       (void)initscr();
-#ifdef KEY_MIN
-       keypad(stdscr, TRUE);
-#endif /* KEY_MIN */
-       (void)saveterm();
-       (void)nonl();
-       (void)cbreak();
-#ifdef A_COLOR
-       {
-           start_color();
-           init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
-           init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
-           init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
-           init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
-           init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
-           init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
-           init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
-           init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
-       }
-#endif /* A_COLOR */
-       //(void)noecho();
-       fullscreen_window = stdscr;
-       srscan_window     = newwin(12, 25, 0,       0);
-       report_window     = newwin(10, 0,  1,       25);
-       lrscan_window     = newwin(10, 0,  0,       64); 
-       message_window    = newwin(0,  0,  12,      0);
-       prompt_window     = newwin(1,  0,  LINES-2, 0); 
-       scrollok(message_window, TRUE);
-       setwnd(fullscreen_window);
-       textcolor(DEFAULT);
-    }
-}
-
-
-void waitfor(void)
-/* wait for user action -- OK to do nothing if on a TTY */
-{
-    if (game.options & OPTION_CURSES)
-       getch();
-}
-
-void pause_game(int i) 
-{
-    char *prompt;
-    char buf[BUFSIZ];
-    if (i==1) {
-       if (skill > SKILL_FAIR)
-           prompt = "[ANOUNCEMENT ARRIVING...]";
-       else
-           prompt = "[IMPORTANT ANNOUNCEMENT ARRIVING -- PRESS ENTER TO CONTINUE]";
-    }
-    else {
-       if (skill > SKILL_FAIR)
-           prompt = "[CONTINUE?]";
-       else
-           prompt = "[PRESS ENTER TO CONTINUE]";
-
-    }
-    if (game.options & OPTION_CURSES) {
-       drawmaps(0);
-       setwnd(prompt_window);
-       wclear(prompt_window);
-       waddstr(prompt_window, prompt);
-       wgetnstr(prompt_window, buf, sizeof(buf));
-       wclear(prompt_window);
-       wrefresh(prompt_window);
-       setwnd(message_window);
-    } else {
-       putchar('\n');
-       proutn(prompt);
-       fgets(buf, sizeof(buf), stdin);
-       if (i != 0) {
-           int j;
-           for (j = 0; j < rows; j++)
-               putchar('\n');
-       }
-       linecount = 0;
-    }
-}
-
-
-void skip(int i) 
-{
-    while (i-- > 0) {
-       if (game.options & OPTION_CURSES) {
-           if (curwnd == message_window && linecount >= getmaxy(curwnd) - 3) {
-               pause_game(0);
-               clrscr();
-           } else {
-               proutn("\n");
-               if (curwnd == message_window)
-                   linecount++;
-           }
-       } else {
-           linecount++;
-           if (linecount >= rows)
-               pause_game(0);
-           else
-               putchar('\n');
-       }
-    }
-}
-
-static void vproutn(char *fmt, va_list ap) 
-{
-    if (game.options & OPTION_CURSES) {
-       vwprintw(curwnd, fmt, ap);
-       wrefresh(curwnd);
-    }
-    else
-       vprintf(fmt, ap);
-}
-
-void proutn(char *fmt, ...) 
-{
-    va_list ap;
-    va_start(ap, fmt);
-    vproutn(fmt, ap);
-    va_end(ap);
-}
-
-void prout(char *fmt, ...) 
-{
-    va_list ap;
-    va_start(ap, fmt);
-    vproutn(fmt, ap);
-    va_end(ap);
-    skip(1);
-}
-
-void prouts(char *fmt, ...) 
-/* print slowly! */
-{
-    char *s, buf[BUFSIZ];
-    va_list ap;
-    va_start(ap, fmt);
-    vsprintf(buf, fmt, ap);
-    va_end(ap);
-    for (s = buf; *s; s++) {
-       delay(30);
-       if (game.options & OPTION_CURSES) {
-           waddch(curwnd, *s);
-           wrefresh(curwnd);
-       }
-       else {
-           putchar(*s);
-           fflush(stdout);
-       }
-    }
-}
-
-void cgetline(char *line, int max)
-{
-    if (game.options & OPTION_CURSES) {
-       wgetnstr(curwnd, line, max);
-       strcat(line, "\n");
-       wrefresh(curwnd);
-    } else {
-       fgets(line, max, stdin);
-    }
-    line[strlen(line)-1] = '\0';
-}
-
-void setwnd(WINDOW *wnd)
-/* change windows -- OK for this to be a no-op in tty mode */
-{
-    if (game.options & OPTION_CURSES) {
-     curwnd=wnd;
-     curs_set(wnd == fullscreen_window || wnd == message_window || wnd == prompt_window);
-    }
-}
-
-void clreol (void)
-/* clear to end of line -- can be a no-op in tty mode */
-{
-   if (game.options & OPTION_CURSES) {
-       wclrtoeol(curwnd);
-       wrefresh(curwnd);
-   }
-}
-
-void clrscr (void)
-/* clear screen -- can be a no-op in tty mode */
-{
-   if (game.options & OPTION_CURSES) {
-       wclear(curwnd);
-       wmove(curwnd,0,0);
-       wrefresh(curwnd);
-   }
-   linecount = 0;
-}
-
-void textcolor (int color)
-{
-#ifdef A_COLOR
-    if (game.options & OPTION_CURSES) {
-       switch(color) {
-       case DEFAULT: 
-           wattrset(curwnd, 0);
-           break;
-       case BLACK: 
-           wattron(curwnd, COLOR_PAIR(COLOR_BLACK));
-           break;
-       case BLUE: 
-           wattron(curwnd, COLOR_PAIR(COLOR_BLUE));
-           break;
-       case GREEN: 
-           wattron(curwnd, COLOR_PAIR(COLOR_GREEN));
-           break;
-       case CYAN: 
-           wattron(curwnd, COLOR_PAIR(COLOR_CYAN));
-           break;
-       case RED: 
-           wattron(curwnd, COLOR_PAIR(COLOR_RED));
-           break;
-       case MAGENTA: 
-           wattron(curwnd, COLOR_PAIR(COLOR_MAGENTA));
-           break;
-       case BROWN: 
-           wattron(curwnd, COLOR_PAIR(COLOR_YELLOW));
-           break;
-       case LIGHTGRAY: 
-           wattron(curwnd, COLOR_PAIR(COLOR_WHITE));
-           break;
-       case DARKGRAY: 
-           wattron(curwnd, COLOR_PAIR(COLOR_BLACK) | A_BOLD);
-           break;
-       case LIGHTBLUE: 
-           wattron(curwnd, COLOR_PAIR(COLOR_BLUE) | A_BOLD);
-           break;
-       case LIGHTGREEN: 
-           wattron(curwnd, COLOR_PAIR(COLOR_GREEN) | A_BOLD);
-           break;
-       case LIGHTCYAN: 
-           wattron(curwnd, COLOR_PAIR(COLOR_CYAN) | A_BOLD);
-           break;
-       case LIGHTRED: 
-           wattron(curwnd, COLOR_PAIR(COLOR_RED) | A_BOLD);
-           break;
-       case LIGHTMAGENTA: 
-           wattron(curwnd, COLOR_PAIR(COLOR_MAGENTA) | A_BOLD);
-           break;
-       case YELLOW: 
-           wattron(curwnd, COLOR_PAIR(COLOR_YELLOW) | A_BOLD);
-           break;
-       case WHITE:
-           wattron(curwnd, COLOR_PAIR(COLOR_WHITE) | A_BOLD);
-           break;
-       }
-    }
-#endif /* A_COLOR */
-}
-
-void highvideo (void)
-{
-    if (game.options & OPTION_CURSES) {
-       wattron(curwnd, A_REVERSE);
-    }
-}
-void commandhook(char *cmd, int before) {
-}
-
-/*
- * Things past this point have policy implications.
- */
-
-void drawmaps(short l)
-/* hook to be called after moving to redraw maps */
-{
-    if (game.options & OPTION_CURSES) {
-       if (l == 1)
-           sensor();
-        setwnd(srscan_window);
-        wmove(curwnd, 0, 0);
-        enqueue("no");
-        srscan(SCAN_FULL);
-       if (l != 2) {
-           setwnd(report_window);
-           wclear(report_window);
-           wmove(report_window, 0, 0);
-           srscan(SCAN_NO_LEFTSIDE);
-           setwnd(lrscan_window);
-           wclear(lrscan_window);
-           wmove(lrscan_window, 0, 0);
-           enqueue("l");
-           lrscan();
-       }
-    }
-}
-
-static void put_srscan_sym(int x, int y, char sym)
-{
-    wmove(srscan_window, x+1, y*2+2);
-    waddch(srscan_window, sym);
-    wrefresh(srscan_window);
-}
-
-void boom(int ii, int jj)
-/* enemy fall down, go boom */ 
-{
-    if (game.options & OPTION_CURSES) {
-       drawmaps(2);
-       setwnd(srscan_window);
-       wattron(srscan_window, A_REVERSE);
-       put_srscan_sym(ii, jj, game.quad[ii][jj]);
-       sound(500);
-       delay(1000);
-       nosound();
-       wattroff(srscan_window, A_REVERSE);
-       put_srscan_sym(ii, jj, game.quad[ii][jj]);
-       delay(500);
-       setwnd(message_window);
-    }
-} 
-
-void warble(void)
-/* sound and visual effects for teleportation */
-{
-    if (game.options & OPTION_CURSES) {
-       drawmaps(2);
-       setwnd(message_window);
-       sound(50);
-    }
-    prouts("     . . . . .     ");
-    if (game.options & OPTION_CURSES) {
-       delay(1000);
-       nosound();
-    }
-}
-
-void tracktorpedo(int ix, int iy, int l, int i, int n, int iquad)
-/* torpedo-track animation */
-{
-    if (!game.options & OPTION_CURSES) {
-       if (l == 1) {
-           if (n != 1) {
-               skip(1);
-               proutn("Track for torpedo number %d-  ", i);
-           }
-           else {
-               skip(1);
-               proutn("Torpedo track- ");
-           }
-       } else if (l==4 || l==9) 
-           skip(1);
-       proutn("%d - %d   ", ix, iy);
-    } else {
-       if (game.damage[DSRSENS]==0 || condit==IHDOCKED) {
-           if (i != 1 && l == 1) {
-               drawmaps(2);
-               delay(400);
-           }
-           if ((iquad==IHDOT)||(iquad==IHBLANK)){
-               put_srscan_sym(ix, iy, '+');
-               sound(l*10);
-               delay(100);
-               nosound();
-               put_srscan_sym(ix, iy, iquad);
-           }
-           else {
-               wattron(curwnd, A_REVERSE);
-               put_srscan_sym(ix, iy, iquad);
-               sound(500);
-               delay(1000);
-               nosound();
-               wattroff(curwnd, A_REVERSE);
-               put_srscan_sym(ix, iy, iquad);
-           }
-       } else {
-           proutn("%d - %d   ", ix, iy);
-       }
-    }
-}
-
-void makechart(void) 
-{
-    if (game.options & OPTION_CURSES) {
-       setwnd(message_window);
-       wclear(message_window);
-       chart(0);
-    }
-}
-
-void setpassword(void) 
-{
-    if (!(game.options & OPTION_CURSES)) {
-       while (TRUE) {
-           scan();
-           strcpy(game.passwd, citem);
-           chew();
-           if (*game.passwd != 0) break;
-           proutn("Please type in a secret password-");
-       }
-    } else {
-       int i;
-        for(i=0;i<3;i++) game.passwd[i]=(char)(97+(int)(Rand()*25));
-        game.passwd[3]=0;
-    }
-}
-
diff --git a/m4/ChangeLog b/m4/ChangeLog
new file mode 100644 (file)
index 0000000..6fb230e
--- /dev/null
@@ -0,0 +1,32 @@
+2006-09-12  gettextize  <bug-gnu-gettext@gnu.org>
+
+       * codeset.m4: New file, from gettext-0.14.5.
+       * gettext.m4: New file, from gettext-0.14.5.
+       * glibc2.m4: New file, from gettext-0.14.5.
+       * glibc21.m4: New file, from gettext-0.14.5.
+       * iconv.m4: New file, from gettext-0.14.5.
+       * intdiv0.m4: New file, from gettext-0.14.5.
+       * intmax.m4: New file, from gettext-0.14.5.
+       * inttypes.m4: New file, from gettext-0.14.5.
+       * inttypes_h.m4: New file, from gettext-0.14.5.
+       * inttypes-pri.m4: New file, from gettext-0.14.5.
+       * isc-posix.m4: New file, from gettext-0.14.5.
+       * lcmessage.m4: New file, from gettext-0.14.5.
+       * lib-ld.m4: New file, from gettext-0.14.5.
+       * lib-link.m4: New file, from gettext-0.14.5.
+       * lib-prefix.m4: New file, from gettext-0.14.5.
+       * longdouble.m4: New file, from gettext-0.14.5.
+       * longlong.m4: New file, from gettext-0.14.5.
+       * nls.m4: New file, from gettext-0.14.5.
+       * po.m4: New file, from gettext-0.14.5.
+       * printf-posix.m4: New file, from gettext-0.14.5.
+       * progtest.m4: New file, from gettext-0.14.5.
+       * signed.m4: New file, from gettext-0.14.5.
+       * size_max.m4: New file, from gettext-0.14.5.
+       * stdint_h.m4: New file, from gettext-0.14.5.
+       * uintmax_t.m4: New file, from gettext-0.14.5.
+       * ulonglong.m4: New file, from gettext-0.14.5.
+       * wchar_t.m4: New file, from gettext-0.14.5.
+       * wint_t.m4: New file, from gettext-0.14.5.
+       * xsize.m4: New file, from gettext-0.14.5.
+
diff --git a/m4/codeset.m4 b/m4/codeset.m4
new file mode 100644 (file)
index 0000000..a6e67ec
--- /dev/null
@@ -0,0 +1,21 @@
+# codeset.m4 serial AM1 (gettext-0.10.40)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_LANGINFO_CODESET],
+[
+  AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
+    [AC_TRY_LINK([#include <langinfo.h>],
+      [char* cs = nl_langinfo(CODESET);],
+      am_cv_langinfo_codeset=yes,
+      am_cv_langinfo_codeset=no)
+    ])
+  if test $am_cv_langinfo_codeset = yes; then
+    AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
+      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+  fi
+])
diff --git a/m4/gettext.m4 b/m4/gettext.m4
new file mode 100644 (file)
index 0000000..624a807
--- /dev/null
@@ -0,0 +1,549 @@
+# gettext.m4 serial 37 (gettext-0.14.4)
+dnl Copyright (C) 1995-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+dnl Macro to add for using GNU gettext.
+
+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
+dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
+dnl    default (if it is not specified or empty) is 'no-libtool'.
+dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
+dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
+dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
+dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
+dnl    depending on --{enable,disable}-{shared,static} and on the presence of
+dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
+dnl    $(top_builddir)/intl/libintl.a will be created.
+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
+dnl    implementations (in libc or libintl) without the ngettext() function
+dnl    will be ignored.  If NEEDSYMBOL is specified and is
+dnl    'need-formatstring-macros', then GNU gettext implementations that don't
+dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
+dnl INTLDIR is used to find the intl libraries.  If empty,
+dnl    the value `$(top_builddir)/intl/' is used.
+dnl
+dnl The result of the configuration is one of three cases:
+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
+dnl    and used.
+dnl    Catalog format: GNU --> install in $(datadir)
+dnl    Catalog extension: .mo after installation, .gmo in source tree
+dnl 2) GNU gettext has been found in the system's C library.
+dnl    Catalog format: GNU --> install in $(datadir)
+dnl    Catalog extension: .mo after installation, .gmo in source tree
+dnl 3) No internationalization, always use English msgid.
+dnl    Catalog format: none
+dnl    Catalog extension: none
+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
+dnl The use of .gmo is historical (it was needed to avoid overwriting the
+dnl GNU format catalogs when building on a platform with an X/Open gettext),
+dnl but we keep it in order not to force irrelevant filename changes on the
+dnl maintainers.
+dnl
+AC_DEFUN([AM_GNU_GETTEXT],
+[
+  dnl Argument checking.
+  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
+    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
+])])])])])
+  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
+    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
+])])])])
+  define([gt_included_intl], ifelse([$1], [external], [no], [yes]))
+  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
+
+  AC_REQUIRE([AM_PO_SUBDIRS])dnl
+  ifelse(gt_included_intl, yes, [
+    AC_REQUIRE([AM_INTL_SUBDIR])dnl
+  ])
+
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Sometimes libintl requires libiconv, so first search for libiconv.
+  dnl Ideally we would do this search only after the
+  dnl      if test "$USE_NLS" = "yes"; then
+  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
+  dnl the configure script would need to contain the same shell code
+  dnl again, outside any 'if'. There are two solutions:
+  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
+  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
+  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
+  dnl documented, we avoid it.
+  ifelse(gt_included_intl, yes, , [
+    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+  ])
+
+  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
+  gt_INTL_MACOSX
+
+  dnl Set USE_NLS.
+  AM_NLS
+
+  ifelse(gt_included_intl, yes, [
+    BUILD_INCLUDED_LIBINTL=no
+    USE_INCLUDED_LIBINTL=no
+  ])
+  LIBINTL=
+  LTLIBINTL=
+  POSUB=
+
+  dnl If we use NLS figure out what method
+  if test "$USE_NLS" = "yes"; then
+    gt_use_preinstalled_gnugettext=no
+    ifelse(gt_included_intl, yes, [
+      AC_MSG_CHECKING([whether included gettext is requested])
+      AC_ARG_WITH(included-gettext,
+        [  --with-included-gettext use the GNU gettext library included here],
+        nls_cv_force_use_gnu_gettext=$withval,
+        nls_cv_force_use_gnu_gettext=no)
+      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+    ])
+        dnl User does not insist on using GNU NLS library.  Figure out what
+        dnl to use.  If GNU gettext is available we use this.  Else we have
+        dnl to fall back to GNU NLS library.
+
+        dnl Add a version number to the cache macros.
+        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
+        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
+        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
+
+        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
+         [AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;],
+            [bindtextdomain ("", "");
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
+            gt_cv_func_gnugettext_libc=yes,
+            gt_cv_func_gnugettext_libc=no)])
+
+        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+          dnl Sometimes libintl requires libiconv, so first search for libiconv.
+          ifelse(gt_included_intl, yes, , [
+            AM_ICONV_LINK
+          ])
+          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
+          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
+          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
+          dnl even if libiconv doesn't exist.
+          AC_LIB_LINKFLAGS_BODY([intl])
+          AC_CACHE_CHECK([for GNU gettext in libintl],
+            gt_cv_func_gnugettext_libintl,
+           [gt_save_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS $INCINTL"
+            gt_save_LIBS="$LIBS"
+            LIBS="$LIBS $LIBINTL"
+            dnl Now see whether libintl exists and does not depend on libiconv.
+            AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);],
+              [bindtextdomain ("", "");
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
+              gt_cv_func_gnugettext_libintl=yes,
+              gt_cv_func_gnugettext_libintl=no)
+            dnl Now see whether libintl exists and depends on libiconv.
+            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
+              LIBS="$LIBS $LIBICONV"
+              AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);],
+                [bindtextdomain ("", "");
+return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
+               [LIBINTL="$LIBINTL $LIBICONV"
+                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+                gt_cv_func_gnugettext_libintl=yes
+               ])
+            fi
+            CPPFLAGS="$gt_save_CPPFLAGS"
+            LIBS="$gt_save_LIBS"])
+        fi
+
+        dnl If an already present or preinstalled GNU gettext() is found,
+        dnl use it.  But if this macro is used in GNU gettext, and GNU
+        dnl gettext is already preinstalled in libintl, we update this
+        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
+        if test "$gt_cv_func_gnugettext_libc" = "yes" \
+           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
+                && test "$PACKAGE" != gettext-runtime \
+                && test "$PACKAGE" != gettext-tools; }; then
+          gt_use_preinstalled_gnugettext=yes
+        else
+          dnl Reset the values set by searching for libintl.
+          LIBINTL=
+          LTLIBINTL=
+          INCINTL=
+        fi
+
+    ifelse(gt_included_intl, yes, [
+        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
+          dnl GNU gettext is not found in the C library.
+          dnl Fall back on included GNU gettext library.
+          nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions used to generate GNU NLS library.
+        BUILD_INCLUDED_LIBINTL=yes
+        USE_INCLUDED_LIBINTL=yes
+        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
+        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
+        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
+      fi
+
+      CATOBJEXT=
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions to use GNU gettext tools.
+        CATOBJEXT=.gmo
+      fi
+    ])
+
+    if test -n "$INTL_MACOSX_LIBS"; then
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Some extra flags are needed during linking.
+        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
+        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
+      fi
+    fi
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes" \
+       || test "$nls_cv_use_gnu_gettext" = "yes"; then
+      AC_DEFINE(ENABLE_NLS, 1,
+        [Define to 1 if translation of program messages to the user's native language
+   is requested.])
+    else
+      USE_NLS=no
+    fi
+  fi
+
+  AC_MSG_CHECKING([whether to use NLS])
+  AC_MSG_RESULT([$USE_NLS])
+  if test "$USE_NLS" = "yes"; then
+    AC_MSG_CHECKING([where the gettext function comes from])
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+        gt_source="external libintl"
+      else
+        gt_source="libc"
+      fi
+    else
+      gt_source="included intl directory"
+    fi
+    AC_MSG_RESULT([$gt_source])
+  fi
+
+  if test "$USE_NLS" = "yes"; then
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+        AC_MSG_CHECKING([how to link with libintl])
+        AC_MSG_RESULT([$LIBINTL])
+        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
+      fi
+
+      dnl For backward compatibility. Some packages may be using this.
+      AC_DEFINE(HAVE_GETTEXT, 1,
+       [Define if the GNU gettext() function is already present or preinstalled.])
+      AC_DEFINE(HAVE_DCGETTEXT, 1,
+       [Define if the GNU dcgettext() function is already present or preinstalled.])
+    fi
+
+    dnl We need to process the po/ directory.
+    POSUB=po
+  fi
+
+  ifelse(gt_included_intl, yes, [
+    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
+    dnl to 'yes' because some of the testsuite requires it.
+    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
+      BUILD_INCLUDED_LIBINTL=yes
+    fi
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST(BUILD_INCLUDED_LIBINTL)
+    AC_SUBST(USE_INCLUDED_LIBINTL)
+    AC_SUBST(CATOBJEXT)
+
+    dnl For backward compatibility. Some configure.ins may be using this.
+    nls_cv_header_intl=
+    nls_cv_header_libgt=
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    DATADIRNAME=share
+    AC_SUBST(DATADIRNAME)
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    INSTOBJEXT=.mo
+    AC_SUBST(INSTOBJEXT)
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    GENCAT=gencat
+    AC_SUBST(GENCAT)
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    INTLOBJS=
+    if test "$USE_INCLUDED_LIBINTL" = yes; then
+      INTLOBJS="\$(GETTOBJS)"
+    fi
+    AC_SUBST(INTLOBJS)
+
+    dnl Enable libtool support if the surrounding package wishes it.
+    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
+    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
+  ])
+
+  dnl For backward compatibility. Some Makefiles may be using this.
+  INTLLIBS="$LIBINTL"
+  AC_SUBST(INTLLIBS)
+
+  dnl Make all documented variables known to autoconf.
+  AC_SUBST(LIBINTL)
+  AC_SUBST(LTLIBINTL)
+  AC_SUBST(POSUB)
+])
+
+
+dnl Checks for all prerequisites of the intl subdirectory,
+dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
+dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
+AC_DEFUN([AM_INTL_SUBDIR],
+[
+  AC_REQUIRE([AC_PROG_INSTALL])dnl
+  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
+  AC_REQUIRE([AC_PROG_CC])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl
+  AC_REQUIRE([gt_GLIBC2])dnl
+  AC_REQUIRE([AC_PROG_RANLIB])dnl
+  AC_REQUIRE([AC_ISC_POSIX])dnl
+  AC_REQUIRE([AC_HEADER_STDC])dnl
+  AC_REQUIRE([AC_C_CONST])dnl
+  AC_REQUIRE([bh_C_SIGNED])dnl
+  AC_REQUIRE([AC_C_INLINE])dnl
+  AC_REQUIRE([AC_TYPE_OFF_T])dnl
+  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+  AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl
+  AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
+  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
+  AC_REQUIRE([gt_TYPE_WINT_T])dnl
+  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+  AC_REQUIRE([gt_TYPE_INTMAX_T])
+  AC_REQUIRE([gt_PRINTF_POSIX])
+  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+  AC_REQUIRE([AC_FUNC_MMAP])dnl
+  AC_REQUIRE([gl_GLIBC21])dnl
+  AC_REQUIRE([gt_INTDIV0])dnl
+  AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
+  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
+  AC_REQUIRE([gt_INTTYPES_PRI])dnl
+  AC_REQUIRE([gl_XSIZE])dnl
+  AC_REQUIRE([gt_INTL_MACOSX])dnl
+
+  AC_CHECK_TYPE([ptrdiff_t], ,
+    [AC_DEFINE([ptrdiff_t], [long],
+       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
+    ])
+  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
+stdlib.h string.h unistd.h sys/param.h])
+  AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
+mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
+strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
+__fsetlocking])
+
+  dnl Use the _snprintf function only if it is declared (because on NetBSD it
+  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
+  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
+  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
+
+  dnl Use the *_unlocked functions only if they are declared.
+  dnl (because some of them were defined without being declared in Solaris
+  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
+  dnl on Solaris 2.5.1 to run on Solaris 2.6).
+  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
+  gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
+  gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
+  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
+
+  case $gt_cv_func_printf_posix in
+    *yes) HAVE_POSIX_PRINTF=1 ;;
+    *) HAVE_POSIX_PRINTF=0 ;;
+  esac
+  AC_SUBST([HAVE_POSIX_PRINTF])
+  if test "$ac_cv_func_asprintf" = yes; then
+    HAVE_ASPRINTF=1
+  else
+    HAVE_ASPRINTF=0
+  fi
+  AC_SUBST([HAVE_ASPRINTF])
+  if test "$ac_cv_func_snprintf" = yes; then
+    HAVE_SNPRINTF=1
+  else
+    HAVE_SNPRINTF=0
+  fi
+  AC_SUBST([HAVE_SNPRINTF])
+  if test "$ac_cv_func_wprintf" = yes; then
+    HAVE_WPRINTF=1
+  else
+    HAVE_WPRINTF=0
+  fi
+  AC_SUBST([HAVE_WPRINTF])
+
+  AM_ICONV
+  AM_LANGINFO_CODESET
+  if test $ac_cv_header_locale_h = yes; then
+    gt_LC_MESSAGES
+  fi
+
+  if test -n "$INTL_MACOSX_LIBS"; then
+    CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
+  fi
+
+  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
+  dnl because plural.y uses bison specific features. It requires at least
+  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
+  dnl compile.
+  dnl bison is only needed for the maintainer (who touches plural.y). But in
+  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
+  dnl the rule in general Makefile. Now, some people carelessly touch the
+  dnl files or have a broken "make" program, hence the plural.c rule will
+  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
+  dnl present or too old.
+  AC_CHECK_PROGS([INTLBISON], [bison])
+  if test -z "$INTLBISON"; then
+    ac_verc_fail=yes
+  else
+    dnl Found it, now check the version.
+    AC_MSG_CHECKING([version of bison])
+changequote(<<,>>)dnl
+    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+    case $ac_prog_version in
+      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
+changequote([,])dnl
+         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+    esac
+    AC_MSG_RESULT([$ac_prog_version])
+  fi
+  if test $ac_verc_fail = yes; then
+    INTLBISON=:
+  fi
+])
+
+
+dnl Checks for special options needed on MacOS X.
+dnl Defines INTL_MACOSX_LIBS.
+AC_DEFUN([gt_INTL_MACOSX],
+[
+  dnl Check for API introduced in MacOS X 10.2.
+  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
+    gt_cv_func_CFPreferencesCopyAppValue,
+    [gt_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
+     gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -framework CoreFoundation"
+     AC_TRY_LINK([#include <CFPreferences.h>],
+       [CFPreferencesCopyAppValue(NULL, NULL)],
+       [gt_cv_func_CFPreferencesCopyAppValue=yes],
+       [gt_cv_func_CFPreferencesCopyAppValue=no])
+     CPPFLAGS="$gt_save_CPPFLAGS"
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
+      [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
+  fi
+  dnl Check for API introduced in MacOS X 10.3.
+  AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
+    [gt_save_CPPFLAGS="$CPPFLAGS"
+     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
+     gt_save_LIBS="$LIBS"
+     LIBS="$LIBS -framework CoreFoundation"
+     AC_TRY_LINK([#include <CFLocale.h>], [CFLocaleCopyCurrent();],
+       [gt_cv_func_CFLocaleCopyCurrent=yes],
+       [gt_cv_func_CFLocaleCopyCurrent=no])
+     CPPFLAGS="$gt_save_CPPFLAGS"
+     LIBS="$gt_save_LIBS"])
+  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
+      [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
+  fi
+  INTL_MACOSX_LIBS=
+  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
+    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+  fi
+  AC_SUBST([INTL_MACOSX_LIBS])
+])
+
+
+dnl gt_CHECK_DECL(FUNC, INCLUDES)
+dnl Check whether a function is declared.
+AC_DEFUN([gt_CHECK_DECL],
+[
+  AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
+    [AC_TRY_COMPILE([$2], [
+#ifndef $1
+  char *p = (char *) $1;
+#endif
+], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
+  if test $ac_cv_have_decl_$1 = yes; then
+    gt_value=1
+  else
+    gt_value=0
+  fi
+  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
+    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
diff --git a/m4/glibc2.m4 b/m4/glibc2.m4
new file mode 100644 (file)
index 0000000..e8f5bfe
--- /dev/null
@@ -0,0 +1,30 @@
+# glibc2.m4 serial 1
+dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Test for the GNU C Library, version 2.0 or newer.
+# From Bruno Haible.
+
+AC_DEFUN([gt_GLIBC2],
+  [
+    AC_CACHE_CHECK(whether we are using the GNU C Library 2 or newer,
+      ac_cv_gnu_library_2,
+      [AC_EGREP_CPP([Lucky GNU user],
+       [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ >= 2)
+  Lucky GNU user
+ #endif
+#endif
+       ],
+       ac_cv_gnu_library_2=yes,
+       ac_cv_gnu_library_2=no)
+      ]
+    )
+    AC_SUBST(GLIBC2)
+    GLIBC2="$ac_cv_gnu_library_2"
+  ]
+)
diff --git a/m4/glibc21.m4 b/m4/glibc21.m4
new file mode 100644 (file)
index 0000000..d95fd98
--- /dev/null
@@ -0,0 +1,30 @@
+# glibc21.m4 serial 3
+dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Test for the GNU C Library, version 2.1 or newer.
+# From Bruno Haible.
+
+AC_DEFUN([gl_GLIBC21],
+  [
+    AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
+      ac_cv_gnu_library_2_1,
+      [AC_EGREP_CPP([Lucky GNU user],
+       [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
+  Lucky GNU user
+ #endif
+#endif
+       ],
+       ac_cv_gnu_library_2_1=yes,
+       ac_cv_gnu_library_2_1=no)
+      ]
+    )
+    AC_SUBST(GLIBC21)
+    GLIBC21="$ac_cv_gnu_library_2_1"
+  ]
+)
diff --git a/m4/iconv.m4 b/m4/iconv.m4
new file mode 100644 (file)
index 0000000..654c415
--- /dev/null
@@ -0,0 +1,101 @@
+# iconv.m4 serial AM4 (gettext-0.11.3)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+  dnl those with the standalone portable GNU libiconv installed).
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed libiconv and not disabled its use
+  dnl via --without-libiconv-prefix, he wants to use it. The first
+  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+  am_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+      [iconv_t cd = iconv_open("","");
+       iconv(cd,NULL,NULL,NULL,NULL);
+       iconv_close(cd);],
+      am_cv_func_iconv=yes)
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+        [iconv_t cd = iconv_open("","");
+         iconv(cd,NULL,NULL,NULL,NULL);
+         iconv_close(cd);],
+        am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes)
+      LIBS="$am_save_LIBS"
+    fi
+  ])
+  if test "$am_cv_func_iconv" = yes; then
+    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    AC_MSG_CHECKING([how to link with libiconv])
+    AC_MSG_RESULT([$LIBICONV])
+  else
+    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+    dnl either.
+    CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+  AC_SUBST(LIBICONV)
+  AC_SUBST(LTLIBICONV)
+])
+
+AC_DEFUN([AM_ICONV],
+[
+  AM_ICONV_LINK
+  if test "$am_cv_func_iconv" = yes; then
+    AC_MSG_CHECKING([for iconv declaration])
+    AC_CACHE_VAL(am_cv_proto_iconv, [
+      AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    AC_MSG_RESULT([$]{ac_t:-
+         }[$]am_cv_proto_iconv)
+    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+      [Define as const if the declaration of iconv() needs const.])
+  fi
+])
diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4
new file mode 100644 (file)
index 0000000..b8d7817
--- /dev/null
@@ -0,0 +1,70 @@
+# intdiv0.m4 serial 1 (gettext-0.11.3)
+dnl Copyright (C) 2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gt_INTDIV0],
+[
+  AC_REQUIRE([AC_PROG_CC])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
+    gt_cv_int_divbyzero_sigfpe,
+    [
+      AC_TRY_RUN([
+#include <stdlib.h>
+#include <signal.h>
+
+static void
+#ifdef __cplusplus
+sigfpe_handler (int sig)
+#else
+sigfpe_handler (sig) int sig;
+#endif
+{
+  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
+  exit (sig != SIGFPE);
+}
+
+int x = 1;
+int y = 0;
+int z;
+int nan;
+
+int main ()
+{
+  signal (SIGFPE, sigfpe_handler);
+/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
+#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
+  signal (SIGTRAP, sigfpe_handler);
+#endif
+/* Linux/SPARC yields signal SIGILL.  */
+#if defined (__sparc__) && defined (__linux__)
+  signal (SIGILL, sigfpe_handler);
+#endif
+
+  z = x / y;
+  nan = y / y;
+  exit (1);
+}
+], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
+        [
+          # Guess based on the CPU.
+          case "$host_cpu" in
+            alpha* | i[34567]86 | m68k | s390*)
+              gt_cv_int_divbyzero_sigfpe="guessing yes";;
+            *)
+              gt_cv_int_divbyzero_sigfpe="guessing no";;
+          esac
+        ])
+    ])
+  case "$gt_cv_int_divbyzero_sigfpe" in
+    *yes) value=1;;
+    *) value=0;;
+  esac
+  AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
+    [Define if integer division by zero raises signal SIGFPE.])
+])
diff --git a/m4/intmax.m4 b/m4/intmax.m4
new file mode 100644 (file)
index 0000000..d99c999
--- /dev/null
@@ -0,0 +1,30 @@
+# intmax.m4 serial 2 (gettext-0.14.2)
+dnl Copyright (C) 2002-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether the system has the 'intmax_t' type, but don't attempt to
+dnl find a replacement if it is lacking.
+
+AC_DEFUN([gt_TYPE_INTMAX_T],
+[
+  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+  AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t,
+    [AC_TRY_COMPILE([
+#include <stddef.h>
+#include <stdlib.h>
+#if HAVE_STDINT_H_WITH_UINTMAX
+#include <stdint.h>
+#endif
+#if HAVE_INTTYPES_H_WITH_UINTMAX
+#include <inttypes.h>
+#endif
+], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)])
+  if test $gt_cv_c_intmax_t = yes; then
+    AC_DEFINE(HAVE_INTMAX_T, 1,
+      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
+  fi
+])
diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4
new file mode 100644 (file)
index 0000000..4d56a9a
--- /dev/null
@@ -0,0 +1,30 @@
+# inttypes-pri.m4 serial 1 (gettext-0.11.4)
+dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
+# macros to non-string values.  This is the case on AIX 4.3.3.
+
+AC_DEFUN([gt_INTTYPES_PRI],
+[
+  AC_REQUIRE([gt_HEADER_INTTYPES_H])
+  if test $gt_cv_header_inttypes_h = yes; then
+    AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
+      gt_cv_inttypes_pri_broken,
+      [
+        AC_TRY_COMPILE([#include <inttypes.h>
+#ifdef PRId32
+char *p = PRId32;
+#endif
+], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
+      ])
+  fi
+  if test "$gt_cv_inttypes_pri_broken" = yes; then
+    AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
+      [Define if <inttypes.h> exists and defines unusable PRI* macros.])
+  fi
+])
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
new file mode 100644 (file)
index 0000000..779bcea
--- /dev/null
@@ -0,0 +1,25 @@
+# inttypes.m4 serial 1 (gettext-0.11.4)
+dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
+# <sys/types.h>.
+
+AC_DEFUN([gt_HEADER_INTTYPES_H],
+[
+  AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
+  [
+    AC_TRY_COMPILE(
+      [#include <sys/types.h>
+#include <inttypes.h>],
+      [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
+  ])
+  if test $gt_cv_header_inttypes_h = yes; then
+    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
+      [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
+  fi
+])
diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4
new file mode 100644 (file)
index 0000000..a5d075d
--- /dev/null
@@ -0,0 +1,26 @@
+# inttypes_h.m4 serial 6
+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
+[
+  AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h,
+  [AC_TRY_COMPILE(
+    [#include <sys/types.h>
+#include <inttypes.h>],
+    [uintmax_t i = (uintmax_t) -1;],
+    gl_cv_header_inttypes_h=yes,
+    gl_cv_header_inttypes_h=no)])
+  if test $gl_cv_header_inttypes_h = yes; then
+    AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
+      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+       and declares uintmax_t. ])
+  fi
+])
diff --git a/m4/isc-posix.m4 b/m4/isc-posix.m4
new file mode 100644 (file)
index 0000000..74dc8f2
--- /dev/null
@@ -0,0 +1,24 @@
+# isc-posix.m4 serial 2 (gettext-0.11.2)
+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
+
+# This test replaces the one in autoconf.
+# Currently this macro should have the same name as the autoconf macro
+# because gettext's gettext.m4 (distributed in the automake package)
+# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
+# give these diagnostics:
+#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
+#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
+
+undefine([AC_ISC_POSIX])
+
+AC_DEFUN([AC_ISC_POSIX],
+  [
+    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
+    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
+  ]
+)
diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4
new file mode 100644 (file)
index 0000000..19aa77e
--- /dev/null
@@ -0,0 +1,30 @@
+# lcmessage.m4 serial 4 (gettext-0.14.2)
+dnl Copyright (C) 1995-2002, 2004-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+
+AC_DEFUN([gt_LC_MESSAGES],
+[
+  AC_CACHE_CHECK([for LC_MESSAGES], gt_cv_val_LC_MESSAGES,
+    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+       gt_cv_val_LC_MESSAGES=yes, gt_cv_val_LC_MESSAGES=no)])
+  if test $gt_cv_val_LC_MESSAGES = yes; then
+    AC_DEFINE(HAVE_LC_MESSAGES, 1,
+      [Define if your <locale.h> file defines LC_MESSAGES.])
+  fi
+])
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4
new file mode 100644 (file)
index 0000000..96c4e2c
--- /dev/null
@@ -0,0 +1,110 @@
+# lib-ld.m4 serial 3 (gettext-0.13)
+dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
+dnl with libtool.m4.
+
+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  acl_cv_prog_gnu_ld=yes ;;
+*)
+  acl_cv_prog_gnu_ld=no ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-1.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by GCC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]* | [A-Za-z]:[\\/]*)]
+      [re_direlt='/[^/][^/]*/\.\./']
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(acl_cv_path_LD,
+[if test -z "$LD"; then
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break ;;
+      *)
+       test "$with_gnu_ld" != yes && break ;;
+      esac
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
new file mode 100644 (file)
index 0000000..ea0b0c4
--- /dev/null
@@ -0,0 +1,553 @@
+# lib-link.m4 serial 6 (gettext-0.14.3)
+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_PREREQ(2.50)
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  define([Name],[translit([$1],[./-], [___])])
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+    AC_LIB_LINKFLAGS_BODY([$1], [$2])
+    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+  ])
+  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+  dnl results of this search when this library appears as a dependency.
+  HAVE_LIB[]NAME=yes
+  undefine([Name])
+  undefine([NAME])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. If found, it
+dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
+dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  define([Name],[translit([$1],[./-], [___])])
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+
+  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed lib[]Name and not disabled its use
+  dnl via --without-lib[]Name-prefix, he wants to use it.
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+    ac_save_LIBS="$LIBS"
+    LIBS="$LIBS $LIB[]NAME"
+    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+    LIBS="$ac_save_LIBS"
+  ])
+  if test "$ac_cv_lib[]Name" = yes; then
+    HAVE_LIB[]NAME=yes
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
+    AC_MSG_CHECKING([how to link with lib[]$1])
+    AC_MSG_RESULT([$LIB[]NAME])
+  else
+    HAVE_LIB[]NAME=no
+    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+    dnl $INC[]NAME either.
+    CPPFLAGS="$ac_save_CPPFLAGS"
+    LIB[]NAME=
+    LTLIB[]NAME=
+  fi
+  AC_SUBST([HAVE_LIB]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  undefine([Name])
+  undefine([NAME])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
+dnl hardcode_direct, hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
+  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
+  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
+  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
+  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
+  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+  ])
+  wl="$acl_cv_wl"
+  libext="$acl_cv_libext"
+  shlibext="$acl_cv_shlibext"
+  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  hardcode_direct="$acl_cv_hardcode_direct"
+  hardcode_minus_L="$acl_cv_hardcode_minus_L"
+  dnl Determine whether the user wants rpath handling at all.
+  AC_ARG_ENABLE(rpath,
+    [  --disable-rpath         do not hardcode runtime library paths],
+    :, enable_rpath=yes)
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_LIB_ARG_WITH([lib$1-prefix],
+[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
+  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+])
+  dnl Search the library and its dependencies in $additional_libdir and
+  dnl $LDFLAGS. Using breadth-first-seach.
+  LIB[]NAME=
+  LTLIB[]NAME=
+  INC[]NAME=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='$1 $2'
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+        dnl or AC_LIB_HAVE_LINKFLAGS call.
+        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+          else
+            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+            dnl that this library doesn't exist. So just drop it.
+            :
+          fi
+        else
+          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+          dnl and the already constructed $LIBNAME/$LTLIBNAME.
+          found_dir=
+          found_la=
+          found_so=
+          found_a=
+          if test $use_additional = yes; then
+            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+              found_dir="$additional_libdir"
+              found_so="$additional_libdir/lib$name.$shlibext"
+              if test -f "$additional_libdir/lib$name.la"; then
+                found_la="$additional_libdir/lib$name.la"
+              fi
+            else
+              if test -f "$additional_libdir/lib$name.$libext"; then
+                found_dir="$additional_libdir"
+                found_a="$additional_libdir/lib$name.$libext"
+                if test -f "$additional_libdir/lib$name.la"; then
+                  found_la="$additional_libdir/lib$name.la"
+                fi
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIB[]NAME; do
+              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+                    found_dir="$dir"
+                    found_so="$dir/lib$name.$shlibext"
+                    if test -f "$dir/lib$name.la"; then
+                      found_la="$dir/lib$name.la"
+                    fi
+                  else
+                    if test -f "$dir/lib$name.$libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/lib$name.$libext"
+                      if test -f "$dir/lib$name.la"; then
+                        found_la="$dir/lib$name.la"
+                      fi
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+            dnl Found the library.
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+              dnl Linking with a shared library. We attempt to hardcode its
+              dnl directory into the executable's runpath, unless it's the
+              dnl standard /usr/lib.
+              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
+                dnl No hardcoding is needed.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+              else
+                dnl Use an explicit option to hardcode DIR into the resulting
+                dnl binary.
+                dnl Potentially add DIR to ltrpathdirs.
+                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                dnl The hardcoding into $LIBNAME is system dependent.
+                if test "$hardcode_direct" = yes; then
+                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+                  dnl resulting binary.
+                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                else
+                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+                    dnl Use an explicit option to hardcode DIR into the resulting
+                    dnl binary.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    dnl Potentially add DIR to rpathdirs.
+                    dnl The rpathdirs will be appended to $LIBNAME at the end.
+                    haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                    dnl Rely on "-L$found_dir".
+                    dnl But don't add it if it's already contained in the LDFLAGS
+                    dnl or the already constructed $LIBNAME
+                    haveit=
+                    for x in $LDFLAGS $LIB[]NAME; do
+                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+                    fi
+                    if test "$hardcode_minus_L" != no; then
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    else
+                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
+                      dnl here, because this doesn't fit in flags passed to the
+                      dnl compiler. So give up. No hardcoding. This affects only
+                      dnl very old systems.
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                dnl Linking with a static library.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+              else
+                dnl We shouldn't come here, but anyway it's good to have a
+                dnl fallback.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+              fi
+            fi
+            dnl Assume the include files are nearby.
+            additional_includedir=
+            case "$found_dir" in
+              */lib | */lib/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+              dnl Potentially add $additional_includedir to $INCNAME.
+              dnl But don't add it
+              dnl   1. if it's the standard /usr/include,
+              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
+              dnl   3. if it's already present in $CPPFLAGS or the already
+              dnl      constructed $INCNAME,
+              dnl   4. if it doesn't exist as a directory.
+              if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INC[]NAME; do
+                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                      dnl Really add $additional_includedir to $INCNAME.
+                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+            dnl Look for dependencies.
+            if test -n "$found_la"; then
+              dnl Read the .la file. It defines the variables
+              dnl dlname, library_names, old_library, dependency_libs, current,
+              dnl age, revision, installed, dlopen, dlpreopen, libdir.
+              save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+              dnl We use only dependency_libs.
+              for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+                    dnl But don't add it
+                    dnl   1. if it's the standard /usr/lib,
+                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
+                    dnl   3. if it's already present in $LDFLAGS or the already
+                    dnl      constructed $LIBNAME,
+                    dnl   4. if it doesn't exist as a directory.
+                    if test "X$additional_libdir" != "X/usr/lib"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/lib"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LIBNAME.
+                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LTLIBNAME.
+                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                      dnl Potentially add DIR to rpathdirs.
+                      dnl The rpathdirs will be appended to $LIBNAME at the end.
+                      haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                      dnl Potentially add DIR to ltrpathdirs.
+                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                      haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                    dnl Handle this in the next round.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                    dnl Handle this in the next round. Throw away the .la's
+                    dnl directory; it is already contained in a preceding -L
+                    dnl option.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                    dnl Most likely an immediate library name.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+            dnl Didn't find the library; assume it is in the system directories
+            dnl known to the linker and runtime loader. (All the system
+            dnl directories known to the linker should also be known to the
+            dnl runtime loader, otherwise the system is severely misconfigured.)
+            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$hardcode_libdir_separator"; then
+      dnl Weird platform: only the last -rpath option counts, the user must
+      dnl pass all path elements in one option. We can arrange that for a
+      dnl single library, but not when more than one $LIBNAMEs are used.
+      alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+      done
+      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
+      acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+    else
+      dnl The -rpath options are cumulative.
+      for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+    dnl When using libtool, the option that works for both libraries and
+    dnl executables is -R. The -R options are cumulative.
+    for found_dir in $ltrpathdirs; do
+      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+    done
+  fi
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+  for element in [$2]; do
+    haveit=
+    for x in $[$1]; do
+      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      [$1]="${[$1]}${[$1]:+ }$element"
+    fi
+  done
+])
diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4
new file mode 100644 (file)
index 0000000..0d895ca
--- /dev/null
@@ -0,0 +1,153 @@
+# lib-prefix.m4 serial 4 (gettext-0.14.2)
+dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_LIB_ARG_WITH([lib-prefix],
+[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+  --without-lib-prefix    don't search for libraries in includedir and libdir],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+])
+  if test $use_additional = yes; then
+    dnl Potentially add $additional_includedir to $CPPFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/include,
+    dnl   2. if it's already present in $CPPFLAGS,
+    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_includedir" != "X/usr/include"; then
+      haveit=
+      for x in $CPPFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-I$additional_includedir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_includedir" = "X/usr/local/include"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_includedir"; then
+            dnl Really add $additional_includedir to $CPPFLAGS.
+            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+          fi
+        fi
+      fi
+    fi
+    dnl Potentially add $additional_libdir to $LDFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/lib,
+    dnl   2. if it's already present in $LDFLAGS,
+    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_libdir" != "X/usr/lib"; then
+      haveit=
+      for x in $LDFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-L$additional_libdir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_libdir" = "X/usr/local/lib"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux*) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_libdir"; then
+            dnl Really add $additional_libdir to $LDFLAGS.
+            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+          fi
+        fi
+      fi
+    fi
+  fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+  dnl Unfortunately, prefix and exec_prefix get only finally determined
+  dnl at the end of configure.
+  if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  $1
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+])
diff --git a/m4/longdouble.m4 b/m4/longdouble.m4
new file mode 100644 (file)
index 0000000..40cd7ce
--- /dev/null
@@ -0,0 +1,28 @@
+# longdouble.m4 serial 1 (gettext-0.12)
+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether the compiler supports the 'long double' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_LONGDOUBLE],
+[
+  AC_CACHE_CHECK([for long double], gt_cv_c_long_double,
+    [if test "$GCC" = yes; then
+       gt_cv_c_long_double=yes
+     else
+       AC_TRY_COMPILE([
+         /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
+         long double foo = 0.0;
+         /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
+         int array [2*(sizeof(long double) >= sizeof(double)) - 1];
+         ], ,
+         gt_cv_c_long_double=yes, gt_cv_c_long_double=no)
+     fi])
+  if test $gt_cv_c_long_double = yes; then
+    AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.])
+  fi
+])
diff --git a/m4/longlong.m4 b/m4/longlong.m4
new file mode 100644 (file)
index 0000000..7b399e0
--- /dev/null
@@ -0,0 +1,23 @@
+# longlong.m4 serial 5
+dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_LONG_LONG if 'long long' works.
+
+AC_DEFUN([gl_AC_TYPE_LONG_LONG],
+[
+  AC_CACHE_CHECK([for long long], ac_cv_type_long_long,
+  [AC_TRY_LINK([long long ll = 1LL; int i = 63;],
+    [long long llmax = (long long) -1;
+     return ll << i | ll >> i | llmax / ll | llmax % ll;],
+    ac_cv_type_long_long=yes,
+    ac_cv_type_long_long=no)])
+  if test $ac_cv_type_long_long = yes; then
+    AC_DEFINE(HAVE_LONG_LONG, 1,
+      [Define if you have the 'long long' type.])
+  fi
+])
diff --git a/m4/nls.m4 b/m4/nls.m4
new file mode 100644 (file)
index 0000000..2082c3b
--- /dev/null
+++ b/m4/nls.m4
@@ -0,0 +1,51 @@
+# nls.m4 serial 2 (gettext-0.14.3)
+dnl Copyright (C) 1995-2003, 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_PREREQ(2.50)
+
+AC_DEFUN([AM_NLS],
+[
+  AC_MSG_CHECKING([whether NLS is requested])
+  dnl Default is enabled NLS
+  AC_ARG_ENABLE(nls,
+    [  --disable-nls           do not use Native Language Support],
+    USE_NLS=$enableval, USE_NLS=yes)
+  AC_MSG_RESULT($USE_NLS)
+  AC_SUBST(USE_NLS)
+])
+
+AC_DEFUN([AM_MKINSTALLDIRS],
+[
+  dnl Tell automake >= 1.10 to complain if mkinstalldirs is missing.
+  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([mkinstalldirs])])
+  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
+  dnl Try to locate it.
+  MKINSTALLDIRS=
+  if test -n "$ac_aux_dir"; then
+    case "$ac_aux_dir" in
+      /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
+      *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
+    esac
+  fi
+  if test -z "$MKINSTALLDIRS"; then
+    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+  fi
+  AC_SUBST(MKINSTALLDIRS)
+])
diff --git a/m4/po.m4 b/m4/po.m4
new file mode 100644 (file)
index 0000000..f2795ee
--- /dev/null
+++ b/m4/po.m4
@@ -0,0 +1,429 @@
+# po.m4 serial 7 (gettext-0.14.3)
+dnl Copyright (C) 1995-2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_PREREQ(2.50)
+
+dnl Checks for all prerequisites of the po subdirectory.
+AC_DEFUN([AM_PO_SUBDIRS],
+[
+  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+  AC_REQUIRE([AC_PROG_INSTALL])dnl
+  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
+  AC_REQUIRE([AM_NLS])dnl
+
+  dnl Perform the following tests also if --disable-nls has been given,
+  dnl because they are needed for "make dist" to work.
+
+  dnl Search for GNU msgfmt in the PATH.
+  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
+  dnl The second test excludes FreeBSD msgfmt.
+  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+    [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
+     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+    :)
+  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+
+  dnl Search for GNU xgettext 0.12 or newer in the PATH.
+  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
+  dnl The second test excludes FreeBSD xgettext.
+  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
+     (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+    :)
+  dnl Remove leftover from FreeBSD xgettext call.
+  rm -f messages.po
+
+  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
+  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
+    [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
+
+  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
+  dnl Test whether we really found GNU msgfmt.
+  if test "$GMSGFMT" != ":"; then
+    dnl If it is no GNU msgfmt we define it as : so that the
+    dnl Makefiles still can work.
+    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
+       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+      : ;
+    else
+      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
+      AC_MSG_RESULT(
+        [found $GMSGFMT program is not GNU msgfmt; ignore it])
+      GMSGFMT=":"
+    fi
+  fi
+
+  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
+  dnl Test whether we really found GNU xgettext.
+  if test "$XGETTEXT" != ":"; then
+    dnl If it is no GNU xgettext we define it as : so that the
+    dnl Makefiles still can work.
+    if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
+       (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+      : ;
+    else
+      AC_MSG_RESULT(
+        [found xgettext program is not GNU xgettext; ignore it])
+      XGETTEXT=":"
+    fi
+    dnl Remove leftover from FreeBSD xgettext call.
+    rm -f messages.po
+  fi
+
+  AC_OUTPUT_COMMANDS([
+    for ac_file in $CONFIG_FILES; do
+      # Support "outfile[:infile[:infile...]]"
+      case "$ac_file" in
+        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+      esac
+      # PO directories have a Makefile.in generated from Makefile.in.in.
+      case "$ac_file" in */Makefile.in)
+        # Adjust a relative srcdir.
+        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+        # In autoconf-2.13 it is called $ac_given_srcdir.
+        # In autoconf-2.50 it is called $srcdir.
+        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+        case "$ac_given_srcdir" in
+          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+          /*) top_srcdir="$ac_given_srcdir" ;;
+          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
+        esac
+        # Treat a directory as a PO directory if and only if it has a
+        # POTFILES.in file. This allows packages to have multiple PO
+        # directories under different names or in different locations.
+        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+          rm -f "$ac_dir/POTFILES"
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[  ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+          POMAKEFILEDEPS="POTFILES.in"
+          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
+          # on $ac_dir but don't depend on user-specified configuration
+          # parameters.
+          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+            # The LINGUAS file contains the set of available languages.
+            if test -n "$OBSOLETE_ALL_LINGUAS"; then
+              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+            fi
+            ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+            # Hide the ALL_LINGUAS assigment from automake.
+            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+          else
+            # The set of available languages was given in configure.in.
+            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
+          fi
+          # Compute POFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+          # Compute UPDATEPOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+          # Compute DUMMYPOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+          # Compute GMOFILES
+          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+          case "$ac_given_srcdir" in
+            .) srcdirpre= ;;
+            *) srcdirpre='$(srcdir)/' ;;
+          esac
+          POFILES=
+          UPDATEPOFILES=
+          DUMMYPOFILES=
+          GMOFILES=
+          for lang in $ALL_LINGUAS; do
+            POFILES="$POFILES $srcdirpre$lang.po"
+            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+          done
+          # CATALOGS depends on both $ac_dir and the user's LINGUAS
+          # environment variable.
+          INST_LINGUAS=
+          if test -n "$ALL_LINGUAS"; then
+            for presentlang in $ALL_LINGUAS; do
+              useit=no
+              if test "%UNSET%" != "$LINGUAS"; then
+                desiredlanguages="$LINGUAS"
+              else
+                desiredlanguages="$ALL_LINGUAS"
+              fi
+              for desiredlang in $desiredlanguages; do
+                # Use the presentlang catalog if desiredlang is
+                #   a. equal to presentlang, or
+                #   b. a variant of presentlang (because in this case,
+                #      presentlang can be used as a fallback for messages
+                #      which are not translated in the desiredlang catalog).
+                case "$desiredlang" in
+                  "$presentlang"*) useit=yes;;
+                esac
+              done
+              if test $useit = yes; then
+                INST_LINGUAS="$INST_LINGUAS $presentlang"
+              fi
+            done
+          fi
+          CATALOGS=
+          if test -n "$INST_LINGUAS"; then
+            for lang in $INST_LINGUAS; do
+              CATALOGS="$CATALOGS $lang.gmo"
+            done
+          fi
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+            if test -f "$f"; then
+              case "$f" in
+                *.orig | *.bak | *~) ;;
+                *) cat "$f" >> "$ac_dir/Makefile" ;;
+              esac
+            fi
+          done
+        fi
+        ;;
+      esac
+    done],
+   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
+    # from automake.
+    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
+    # Capture the value of LINGUAS because we need it to compute CATALOGS.
+    LINGUAS="${LINGUAS-%UNSET%}"
+   ])
+])
+
+dnl Postprocesses a Makefile in a directory containing PO files.
+AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
+[
+  # When this code is run, in config.status, two variables have already been
+  # set:
+  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
+  # - LINGUAS is the value of the environment variable LINGUAS at configure
+  #   time.
+
+changequote(,)dnl
+  # Adjust a relative srcdir.
+  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+  ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+  # In autoconf-2.13 it is called $ac_given_srcdir.
+  # In autoconf-2.50 it is called $srcdir.
+  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+  case "$ac_given_srcdir" in
+    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+    /*) top_srcdir="$ac_given_srcdir" ;;
+    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
+  esac
+
+  # Find a way to echo strings without interpreting backslash.
+  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
+    gt_echo='echo'
+  else
+    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
+      gt_echo='printf %s\n'
+    else
+      echo_func () {
+        cat <<EOT
+$*
+EOT
+      }
+      gt_echo='echo_func'
+    fi
+  fi
+
+  # A sed script that extracts the value of VARIABLE from a Makefile.
+  sed_x_variable='
+# Test if the hold space is empty.
+x
+s/P/P/
+x
+ta
+# Yes it was empty. Look if we have the expected variable definition.
+/^[     ]*VARIABLE[     ]*=/{
+  # Seen the first line of the variable definition.
+  s/^[  ]*VARIABLE[     ]*=//
+  ba
+}
+bd
+:a
+# Here we are processing a line from the variable definition.
+# Remove comment, more precisely replace it with a space.
+s/#.*$/ /
+# See if the line ends in a backslash.
+tb
+:b
+s/\\$//
+# Print the line, without the trailing backslash.
+p
+tc
+# There was no trailing backslash. The end of the variable definition is
+# reached. Clear the hold space.
+s/^.*$//
+x
+bd
+:c
+# A trailing backslash means that the variable definition continues in the
+# next line. Put a nonempty string into the hold space to indicate this.
+s/^.*$/P/
+x
+:d
+'
+changequote([,])dnl
+
+  # Set POTFILES to the value of the Makefile variable POTFILES.
+  sed_x_POTFILES="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`"
+  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
+  # Compute POTFILES_DEPS as
+  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
+  POTFILES_DEPS=
+  for file in $POTFILES; do
+    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
+  done
+  POMAKEFILEDEPS=""
+
+  if test -n "$OBSOLETE_ALL_LINGUAS"; then
+    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+  fi
+  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+    # The LINGUAS file contains the set of available languages.
+    ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+  else
+    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
+    sed_x_LINGUAS="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`"
+    ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
+  fi
+  # Hide the ALL_LINGUAS assigment from automake.
+  eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+  # Compute POFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+  # Compute UPDATEPOFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+  # Compute DUMMYPOFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+  # Compute GMOFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+  # Compute PROPERTIESFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
+  # Compute CLASSFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
+  # Compute QMFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
+  # Compute MSGFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
+  # Compute RESOURCESDLLFILES
+  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
+  case "$ac_given_srcdir" in
+    .) srcdirpre= ;;
+    *) srcdirpre='$(srcdir)/' ;;
+  esac
+  POFILES=
+  UPDATEPOFILES=
+  DUMMYPOFILES=
+  GMOFILES=
+  PROPERTIESFILES=
+  CLASSFILES=
+  QMFILES=
+  MSGFILES=
+  RESOURCESDLLFILES=
+  for lang in $ALL_LINGUAS; do
+    POFILES="$POFILES $srcdirpre$lang.po"
+    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+    PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
+    CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
+    QMFILES="$QMFILES $srcdirpre$lang.qm"
+    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
+    frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+    RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
+  done
+  # CATALOGS depends on both $ac_dir and the user's LINGUAS
+  # environment variable.
+  INST_LINGUAS=
+  if test -n "$ALL_LINGUAS"; then
+    for presentlang in $ALL_LINGUAS; do
+      useit=no
+      if test "%UNSET%" != "$LINGUAS"; then
+        desiredlanguages="$LINGUAS"
+      else
+        desiredlanguages="$ALL_LINGUAS"
+      fi
+      for desiredlang in $desiredlanguages; do
+        # Use the presentlang catalog if desiredlang is
+        #   a. equal to presentlang, or
+        #   b. a variant of presentlang (because in this case,
+        #      presentlang can be used as a fallback for messages
+        #      which are not translated in the desiredlang catalog).
+        case "$desiredlang" in
+          "$presentlang"*) useit=yes;;
+        esac
+      done
+      if test $useit = yes; then
+        INST_LINGUAS="$INST_LINGUAS $presentlang"
+      fi
+    done
+  fi
+  CATALOGS=
+  JAVACATALOGS=
+  QTCATALOGS=
+  TCLCATALOGS=
+  CSHARPCATALOGS=
+  if test -n "$INST_LINGUAS"; then
+    for lang in $INST_LINGUAS; do
+      CATALOGS="$CATALOGS $lang.gmo"
+      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
+      QTCATALOGS="$QTCATALOGS $lang.qm"
+      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
+      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+      CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
+    done
+  fi
+
+  sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
+  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
+    # Add dependencies that cannot be formulated as a simple suffix rule.
+    for lang in $ALL_LINGUAS; do
+      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+      cat >> "$ac_file.tmp" <<EOF
+$frobbedlang.msg: $lang.po
+       @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
+       \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+EOF
+    done
+  fi
+  if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
+    # Add dependencies that cannot be formulated as a simple suffix rule.
+    for lang in $ALL_LINGUAS; do
+      frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+      cat >> "$ac_file.tmp" <<EOF
+$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
+       @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
+       \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+EOF
+    done
+  fi
+  if test -n "$POMAKEFILEDEPS"; then
+    cat >> "$ac_file.tmp" <<EOF
+Makefile: $POMAKEFILEDEPS
+EOF
+  fi
+  mv "$ac_file.tmp" "$ac_file"
+])
diff --git a/m4/printf-posix.m4 b/m4/printf-posix.m4
new file mode 100644 (file)
index 0000000..af10170
--- /dev/null
@@ -0,0 +1,44 @@
+# printf-posix.m4 serial 2 (gettext-0.13.1)
+dnl Copyright (C) 2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether the printf() function supports POSIX/XSI format strings with
+dnl positions.
+
+AC_DEFUN([gt_PRINTF_POSIX],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
+    gt_cv_func_printf_posix,
+    [
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <string.h>
+/* The string "%2$d %1$d", with dollar characters protected from the shell's
+   dollar expansion (possibly an autoconf bug).  */
+static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
+static char buf[100];
+int main ()
+{
+  sprintf (buf, format, 33, 55);
+  return (strcmp (buf, "55 33") != 0);
+}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
+      [
+        AC_EGREP_CPP(notposix, [
+#if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
+  notposix
+#endif
+        ], gt_cv_func_printf_posix="guessing no",
+           gt_cv_func_printf_posix="guessing yes")
+      ])
+    ])
+  case $gt_cv_func_printf_posix in
+    *yes)
+      AC_DEFINE(HAVE_POSIX_PRINTF, 1,
+        [Define if your printf() function supports format strings with positions.])
+      ;;
+  esac
+])
diff --git a/m4/progtest.m4 b/m4/progtest.m4
new file mode 100644 (file)
index 0000000..a56365c
--- /dev/null
@@ -0,0 +1,92 @@
+# progtest.m4 serial 4 (gettext-0.14.2)
+dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+AC_PREREQ(2.50)
+
+# Search path for a program which passes the given test.
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN([AM_PATH_PROG_WITH_TEST],
+[
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+  ac_executable_p="test -x"
+else
+  ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+  [[\\/]]* | ?:[[\\/]]*)
+    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+    ;;
+  *)
+    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in ifelse([$5], , $PATH, [$5]); do
+      IFS="$ac_save_IFS"
+      test -z "$ac_dir" && ac_dir=.
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+          echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
+          if [$3]; then
+            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
+            break 2
+          fi
+        fi
+      done
+    done
+    IFS="$ac_save_IFS"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+    ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+  AC_MSG_RESULT([$]$1)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
diff --git a/m4/signed.m4 b/m4/signed.m4
new file mode 100644 (file)
index 0000000..048f593
--- /dev/null
@@ -0,0 +1,17 @@
+# signed.m4 serial 1 (gettext-0.10.40)
+dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([bh_C_SIGNED],
+[
+  AC_CACHE_CHECK([for signed], bh_cv_c_signed,
+   [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)])
+  if test $bh_cv_c_signed = no; then
+    AC_DEFINE(signed, ,
+              [Define to empty if the C compiler doesn't support this keyword.])
+  fi
+])
diff --git a/m4/size_max.m4 b/m4/size_max.m4
new file mode 100644 (file)
index 0000000..4fe81c7
--- /dev/null
@@ -0,0 +1,59 @@
+# size_max.m4 serial 2
+dnl Copyright (C) 2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([gl_SIZE_MAX],
+[
+  AC_CHECK_HEADERS(stdint.h)
+  dnl First test whether the system already has SIZE_MAX.
+  AC_MSG_CHECKING([for SIZE_MAX])
+  result=
+  AC_EGREP_CPP([Found it], [
+#include <limits.h>
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef SIZE_MAX
+Found it
+#endif
+], result=yes)
+  if test -z "$result"; then
+    dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
+    dnl than the type 'unsigned long'.
+    dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr',
+    dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
+    _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
+      [#include <stddef.h>], result=?)
+    _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
+      [#include <stddef.h>], result=?)
+    _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint,
+      [#include <stddef.h>], result=?)
+    if test "$fits_in_uint" = 1; then
+      dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
+      dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
+      AC_TRY_COMPILE([#include <stddef.h>
+        extern size_t foo;
+        extern unsigned long foo;
+        ], [], fits_in_uint=0)
+    fi
+    if test -z "$result"; then
+      if test "$fits_in_uint" = 1; then
+        result="$res_hi$res_lo"U
+      else
+        result="$res_hi$res_lo"UL
+      fi
+    else
+      dnl Shouldn't happen, but who knows...
+      result='~(size_t)0'
+    fi
+  fi
+  AC_MSG_RESULT([$result])
+  if test "$result" != yes; then
+    AC_DEFINE_UNQUOTED([SIZE_MAX], [$result],
+      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
+  fi
+])
diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4
new file mode 100644 (file)
index 0000000..3355f35
--- /dev/null
@@ -0,0 +1,26 @@
+# stdint_h.m4 serial 5
+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN([gl_AC_HEADER_STDINT_H],
+[
+  AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h,
+  [AC_TRY_COMPILE(
+    [#include <sys/types.h>
+#include <stdint.h>],
+    [uintmax_t i = (uintmax_t) -1;],
+    gl_cv_header_stdint_h=yes,
+    gl_cv_header_stdint_h=no)])
+  if test $gl_cv_header_stdint_h = yes; then
+    AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
+      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
+       and declares uintmax_t. ])
+  fi
+])
diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4
new file mode 100644 (file)
index 0000000..bf83ed7
--- /dev/null
@@ -0,0 +1,30 @@
+# uintmax_t.m4 serial 9
+dnl Copyright (C) 1997-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+AC_PREREQ(2.13)
+
+# Define uintmax_t to 'unsigned long' or 'unsigned long long'
+# if it is not already defined in <stdint.h> or <inttypes.h>.
+
+AC_DEFUN([gl_AC_TYPE_UINTMAX_T],
+[
+  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
+  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
+  if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
+    AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG])
+    test $ac_cv_type_unsigned_long_long = yes \
+      && ac_type='unsigned long long' \
+      || ac_type='unsigned long'
+    AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
+      [Define to unsigned long or unsigned long long
+       if <stdint.h> and <inttypes.h> don't define.])
+  else
+    AC_DEFINE(HAVE_UINTMAX_T, 1,
+      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
+  fi
+])
diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4
new file mode 100644 (file)
index 0000000..dee10cc
--- /dev/null
@@ -0,0 +1,23 @@
+# ulonglong.m4 serial 4
+dnl Copyright (C) 1999-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works.
+
+AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
+[
+  AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
+  [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;],
+    [unsigned long long ullmax = (unsigned long long) -1;
+     return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
+    ac_cv_type_unsigned_long_long=yes,
+    ac_cv_type_unsigned_long_long=no)])
+  if test $ac_cv_type_unsigned_long_long = yes; then
+    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
+      [Define if you have the 'unsigned long long' type.])
+  fi
+])
diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4
new file mode 100644 (file)
index 0000000..cde2129
--- /dev/null
@@ -0,0 +1,20 @@
+# wchar_t.m4 serial 1 (gettext-0.12)
+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether <stddef.h> has the 'wchar_t' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WCHAR_T],
+[
+  AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t,
+    [AC_TRY_COMPILE([#include <stddef.h>
+       wchar_t foo = (wchar_t)'\0';], ,
+       gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)])
+  if test $gt_cv_c_wchar_t = yes; then
+    AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.])
+  fi
+])
diff --git a/m4/wint_t.m4 b/m4/wint_t.m4
new file mode 100644 (file)
index 0000000..b8fff9c
--- /dev/null
@@ -0,0 +1,20 @@
+# wint_t.m4 serial 1 (gettext-0.12)
+dnl Copyright (C) 2003 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+dnl Test whether <wchar.h> has the 'wint_t' type.
+dnl Prerequisite: AC_PROG_CC
+
+AC_DEFUN([gt_TYPE_WINT_T],
+[
+  AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
+    [AC_TRY_COMPILE([#include <wchar.h>
+       wint_t foo = (wchar_t)'\0';], ,
+       gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
+  if test $gt_cv_c_wint_t = yes; then
+    AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])
+  fi
+])
diff --git a/m4/xsize.m4 b/m4/xsize.m4
new file mode 100644 (file)
index 0000000..85bb721
--- /dev/null
@@ -0,0 +1,13 @@
+# xsize.m4 serial 3
+dnl Copyright (C) 2003-2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_XSIZE],
+[
+  dnl Prerequisites of lib/xsize.h.
+  AC_REQUIRE([gl_SIZE_MAX])
+  AC_REQUIRE([AC_C_INLINE])
+  AC_CHECK_HEADERS(stdint.h)
+])
diff --git a/makehelp.py b/makehelp.py
deleted file mode 100755 (executable)
index 0a171f2..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-#
-# Generate an on-line help file for SST 2K from the text generated from
-# the XML documentation.
-#
-# By Eric S. Raymond for the Super Star Trek project
-import os, re, sys
-
-enddelim = "********\n"
-
-# This is the part most likely to bit-rot
-beginmarker1 = "Mnemonic:"
-endmarker1 = "Miscellaneous Notes"
-beginmarker2 = " ABBREV"
-endmarker2 = "Game History and Modifications"
-
-fp = open("sst-doc.txt", "r")
-savetext = ""
-state = 0
-while True:
-    line = fp.readline()
-    if not line:
-        break
-    if state == 0 and line.startswith(beginmarker1):
-        line = "%% " + line[12:].lstrip()
-        state = 1
-    if state == 0 and line.startswith(beginmarker2):
-        savetext += enddelim + "%% ABBREV\n"
-        state = 2
-    if state == 1:
-        if line.find(endmarker1) > -1:
-            state = 0
-    if state == 2:
-        if line.find(endmarker2) > -1:
-            state = 0
-    if state:
-        savetext += line
-
-# Remove the section titles
-savetext = re.sub("\n+.*\n*Mnemonic:\\s*", "\n********\n%% ", savetext)
-
-# Hack Unicode non-breaking spaces into ordinary spaces
-savetext = savetext.replace("\xc2\xa0", " ").replace("\240", "")
-
-sys.stdout.write(savetext + enddelim)
diff --git a/missing b/missing
new file mode 100755 (executable)
index 0000000..894e786
--- /dev/null
+++ b/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, 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.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+       case "$firstarg" in
+       *o*)
+           firstarg=`echo "$firstarg" | sed s/o//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+       case "$firstarg" in
+       *h*)
+           firstarg=`echo "$firstarg" | sed s/h//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100755 (executable)
index 0000000..6fbe5e1
--- /dev/null
@@ -0,0 +1,150 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+
+scriptversion=2004-02-15.20
+
+# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to <bug-automake@gnu.org>."
+
+# process command line arguments
+while test $# -gt 0 ; do
+  case $1 in
+    -h | --help | --h*)         # -h for help
+      echo "$usage"
+      exit 0
+      ;;
+    -m)                         # -m PERM arg
+      shift
+      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+      dirmode=$1
+      shift
+      ;;
+    --version)
+      echo "$0 $scriptversion"
+      exit 0
+      ;;
+    --)                         # stop option processing
+      shift
+      break
+      ;;
+    -*)                         # unknown option
+      echo "$usage" 1>&2
+      exit 1
+      ;;
+    *)                          # first non-opt arg
+      break
+      ;;
+  esac
+done
+
+for file
+do
+  if test -d "$file"; then
+    shift
+  else
+    break
+  fi
+done
+
+case $# in
+  0) exit 0 ;;
+esac
+
+# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error.  This is a problem when calling mkinstalldirs
+# from a parallel make.  We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
+case $dirmode in
+  '')
+    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+      echo "mkdir -p -- $*"
+      exec mkdir -p -- "$@"
+    else
+      # On NextStep and OpenStep, the `mkdir' command does not
+      # recognize any option.  It will interpret all options as
+      # directories to create, and then abort because `.' already
+      # exists.
+      test -d ./-p && rmdir ./-p
+      test -d ./--version && rmdir ./--version
+    fi
+    ;;
+  *)
+    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+       test ! -d ./--version; then
+      echo "mkdir -m $dirmode -p -- $*"
+      exec mkdir -m "$dirmode" -p -- "$@"
+    else
+      # Clean up after NextStep and OpenStep mkdir.
+      for d in ./-m ./-p ./--version "./$dirmode";
+      do
+        test -d $d && rmdir $d
+      done
+    fi
+    ;;
+esac
+
+for file
+do
+  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+  shift
+
+  pathcomp=
+  for d
+  do
+    pathcomp="$pathcomp$d"
+    case $pathcomp in
+      -*) pathcomp=./$pathcomp ;;
+    esac
+
+    if test ! -d "$pathcomp"; then
+      echo "mkdir $pathcomp"
+
+      mkdir "$pathcomp" || lasterr=$?
+
+      if test ! -d "$pathcomp"; then
+       errstatus=$lasterr
+      else
+       if test ! -z "$dirmode"; then
+         echo "chmod $dirmode $pathcomp"
+         lasterr=""
+         chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+         if test ! -z "$lasterr"; then
+           errstatus=$lasterr
+         fi
+       fi
+      fi
+    fi
+
+    pathcomp="$pathcomp/"
+  done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/moving.c b/moving.c
deleted file mode 100644 (file)
index a5d11b3..0000000
--- a/moving.c
+++ /dev/null
@@ -1,1009 +0,0 @@
-#include <unistd.h>
-#include "sstlinux.h"
-#include "sst.h"
-
-static void getcd(int, int);
-
-void imove(void) 
-{
-    double angle, deltax, deltay, bigger, x, y,
-        finald, finalx, finaly, stopegy, probf;
-    int trbeam = 0, n, l, ix=0, iy=0, kink, kinks, iquad;
-
-    if (inorbit) {
-       prout("Helmsman Sulu- \"Leaving standard orbit.\"");
-       inorbit = FALSE;
-    }
-
-    angle = ((15.0 - direc) * 0.5235988);
-    deltax = -sin(angle);
-    deltay = cos(angle);
-    if (fabs(deltax) > fabs(deltay))
-       bigger = fabs(deltax);
-    else
-       bigger = fabs(deltay);
-               
-    deltay /= bigger;
-    deltax /= bigger;
-
-    /* If tractor beam is to occur, don't move full distance */
-    if (game.state.date+Time >= game.future[FTBEAM]) {
-       trbeam = 1;
-       condit = IHRED;
-       dist = dist*(game.future[FTBEAM]-game.state.date)/Time + 0.1;
-       Time = game.future[FTBEAM] - game.state.date + 1e-5;
-    }
-    /* Move within the quadrant */
-    game.quad[sectx][secty] = IHDOT;
-    x = sectx;
-    y = secty;
-    n = 10.0*dist*bigger+0.5;
-
-    if (n > 0) {
-       for (l = 1; l <= n; l++) {
-           ix = (x += deltax) + 0.5;
-           iy = (y += deltay) + 0.5;
-           if (!VALID_SECTOR(ix, iy)) {
-               /* Leaving quadrant -- allow final enemy attack */
-               /* Don't do it if being pushed by Nova */
-               if (nenhere != 0 && iattak != 2) {
-                   newcnd();
-                   for_local_enemies(l) {
-                       finald = sqrt((ix-game.kx[l])*(double)(ix-game.kx[l]) +
-                                     (iy-game.ky[l])*(double)(iy-game.ky[l]));
-                       game.kavgd[l] = 0.5 * (finald+game.kdist[l]);
-                   }
-                   /*
-                    * Stas Sergeev added the condition
-                    * that attacks only happen if Klingons
-                    * are present and your skill is good.
-                    */
-                   if (skill > SKILL_GOOD && klhere > 0 && !game.state.galaxy[quadx][quady].supernova)
-                       attack(0);
-                   if (alldone) return;
-               }
-               /* compute final position -- new quadrant and sector */
-               x = QUADSIZE*(quadx-1)+sectx;
-               y = QUADSIZE*(quady-1)+secty;
-               ix = x+10.0*dist*bigger*deltax+0.5;
-               iy = y+10.0*dist*bigger*deltay+0.5;
-               /* check for edge of galaxy */
-               kinks = 0;
-               do {
-                   kink = 0;
-                   if (ix <= 0) {
-                       ix = -ix + 1;
-                       kink = 1;
-                   }
-                   if (iy <= 0) {
-                       iy = -iy + 1;
-                       kink = 1;
-                   }
-                   if (ix > GALSIZE*QUADSIZE) {
-                       ix = (GALSIZE*QUADSIZE*2)+1 - ix;
-                       kink = 1;
-                   }
-                   if (iy > GALSIZE*QUADSIZE) {
-                       iy = (GALSIZE*QUADSIZE*2)+1 - iy;
-                       kink = 1;
-                   }
-                   if (kink) kinks = 1;
-               } while (kink);
-
-               if (kinks) {
-                   nkinks += 1;
-                   if (nkinks == 3) {
-                       /* Three strikes -- you're out! */
-                       finish(FNEG3);
-                       return;
-                   }
-                   skip(1);
-                   prout("YOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER");
-                   prout("AT THE EDGE OF THE GALAXY.  THE THIRD TIME YOU TRY THIS,");
-                   prout("YOU WILL BE DESTROYED.");
-               }
-               /* Compute final position in new quadrant */
-               if (trbeam) return; /* Don't bother if we are to be beamed */
-               quadx = (ix+(QUADSIZE-1))/QUADSIZE;
-               quady = (iy+(QUADSIZE-1))/QUADSIZE;
-               sectx = ix - QUADSIZE*(quadx-1);
-               secty = iy - QUADSIZE*(quady-1);
-               skip(1);
-               prout("Entering %s.",
-                     cramlc(quadrant, quadx, quady));
-               game.quad[sectx][secty] = ship;
-               newqad(0);
-               if (skill>SKILL_NOVICE) attack(0);
-               return;
-           }
-           iquad = game.quad[ix][iy];
-           if (iquad != IHDOT) {
-               /* object encountered in flight path */
-               stopegy = 50.0*dist/Time;
-               dist=0.1*sqrt((sectx-ix)*(double)(sectx-ix) +
-                             (secty-iy)*(double)(secty-iy));
-               switch (iquad) {
-               case IHT: /* Ram a Tholian */
-               case IHK: /* Ram enemy ship */
-               case IHC:
-               case IHS:
-               case IHR:
-               case IHQUEST:
-                   sectx = ix;
-                   secty = iy;
-                   ram(0, iquad, sectx, secty);
-                   finalx = sectx;
-                   finaly = secty;
-                   break;
-               case IHBLANK:
-                   skip(1);
-                   prouts("***RED ALERT!  RED ALERT!");
-                   skip(1);
-                   proutn("***");
-                   crmshp();
-                   proutn(" pulled into black hole at ");
-                   prout(cramlc(sector, ix, iy));
-                   /*
-                    * Getting pulled into a black hole was certain
-                    * death in Almy's original.  Stas Sergeev added a
-                    * possibility that you'll get timewarped instead.
-                    */
-                   n=0;
-                   for (l=0;l<NDEVICES;l++)
-                       if (game.damage[l]>0) 
-                           n++;
-                   probf=pow(1.4,(energy+shield)/5000.0-1.0)*pow(1.3,1.0/(n+1)-1.0);
-                   if ((game.options & OPTION_BLKHOLE) && Rand()>probf) 
-                       timwrp();
-                   else 
-                       finish(FHOLE);
-                   return;
-               default:
-                   /* something else */
-                   skip(1);
-                   crmshp();
-                   if (iquad == IHWEB)
-                       proutn(" encounters Tholian web at ");
-                   else
-                       proutn(" blocked by object at ");
-                   proutn(cramlc(sector, ix,iy));
-                   prout(";");
-                   proutn("Emergency stop required ");
-                   prout("%2d units of energy.", (int)stopegy);
-                   energy -= stopegy;
-                   finalx = x-deltax+0.5;
-                   sectx = finalx;
-                   finaly = y-deltay+0.5;
-                   secty = finaly;
-                   if (energy <= 0) {
-                       finish(FNRG);
-                       return;
-                   }
-                   break;
-               }
-               goto no_quad_change;    /* sorry! */
-           }
-       }
-       dist = 0.1*sqrt((sectx-ix)*(double)(sectx-ix) +
-                       (secty-iy)*(double)(secty-iy));
-       sectx = ix;
-       secty = iy;
-    }
-    finalx = sectx;
-    finaly = secty;
-no_quad_change:
-    /* No quadrant change -- compute new avg enemy distances */
-    game.quad[sectx][secty] = ship;
-    if (nenhere) {
-       for_local_enemies(l) {
-           finald = sqrt((ix-game.kx[l])*(double)(ix-game.kx[l]) +
-                         (iy-game.ky[l])*(double)(iy-game.ky[l]));
-           game.kavgd[l] = 0.5 * (finald+game.kdist[l]);
-           game.kdist[l] = finald;
-       }
-       sortkl();
-       if (!game.state.galaxy[quadx][quady].supernova && iattak == 0)
-           attack(0);
-       for_local_enemies(l) game.kavgd[l] = game.kdist[l];
-    }
-    newcnd();
-    iattak = 0;
-    drawmaps(0);
-    setwnd(message_window);
-    return;
-}
-
-void dock(int l) 
-{
-    chew();
-    if (condit == IHDOCKED && l) {
-       prout("Already docked.");
-       return;
-    }
-    if (inorbit) {
-       prout("You must first leave standard orbit.");
-       return;
-    }
-    if (basex==0 || abs(sectx-basex) > 1 || abs(secty-basey) > 1) {
-       crmshp();
-       prout(" not adjacent to base.");
-       return;
-    }
-    condit = IHDOCKED;
-    if (l) prout("Docked.");
-    ididit=1;
-    if (energy < inenrg) energy = inenrg;
-    shield = inshld;
-    torps = intorps;
-    lsupres = inlsr;
-    if (game.damage[DRADIO] == 0.0 &&
-       (game.future[FCDBAS] < FOREVER || isatb == 1) && iseenit == 0) {
-       /* get attack report from base */
-       prout("Lt. Uhura- \"Captain, an important message from the starbase:\"");
-       attakreport(0);
-       iseenit = 1;
-    }
-}
-
-static void getcd(int isprobe, int akey) {
-       /* This program originally required input in terms of a (clock)
-          direction and distance. Somewhere in history, it was changed to
-          cartesian coordinates. So we need to convert. I think
-          "manual" input should still be done this way -- it's a real
-          pain if the computer isn't working! Manual mode is still confusing
-          because it involves giving x and y motions, yet the coordinates
-          are always displayed y - x, where +y is downward! */
-
-       
-        int irowq=quadx, icolq=quady, irows, icols, itemp=0, iprompt=0, key=0;
-       double xi, xj, xk, xl;
-       double deltax, deltay;
-       int automatic = -1;
-
-       /* Get course direction and distance. If user types bad values, return
-          with DIREC = -1.0. */
-
-       direc = -1.0;
-       
-       if (landed == 1 && !isprobe) {
-               prout("Dummy! You can't leave standard orbit until you");
-               proutn("are back aboard the ");
-               crmshp();
-               prout(".");
-               chew();
-               return;
-       }
-       while (automatic == -1) {
-               if (game.damage[DCOMPTR]) {
-                       if (isprobe)
-                               prout("Computer damaged; manual navigation only");
-                       else
-                               prout("Computer damaged; manual movement only");
-                       chew();
-                       automatic = 0;
-                       key = IHEOL;
-                       break;
-               }
-               if (isprobe && akey != -1) {
-                       /* For probe launch, use pre-scaned value first time */
-                       key = akey;
-                       akey = -1;
-               }
-               else 
-                       key = scan();
-
-               if (key == IHEOL) {
-                       proutn("Manual or automatic- ");
-                       iprompt = 1;
-                       chew();
-               }
-               else if (key == IHALPHA) {
-                       if (isit("manual")) {
-                               automatic =0;
-                               key = scan();
-                               break;
-                       }
-                       else if (isit("automatic")) {
-                               automatic = 1;
-                               key = scan();
-                               break;
-                       }
-                       else {
-                               huh();
-                               chew();
-                               return;
-                       }
-               }
-               else { /* numeric */
-                       if (isprobe)
-                               prout("(Manual navigation assumed.)");
-                       else
-                               prout("(Manual movement assumed.)");
-                       automatic = 0;
-                       break;
-               }
-       }
-
-       if (automatic) {
-               while (key == IHEOL) {
-                       if (isprobe)
-                               proutn("Target quadrant or quadrant&sector- ");
-                       else
-                               proutn("Destination sector or quadrant&sector- ");
-                       chew();
-                       iprompt = 1;
-                       key = scan();
-               }
-
-               if (key != IHREAL) {
-                       huh();
-                       return;
-               }
-               xi = aaitem;
-               key = scan();
-               if (key != IHREAL){
-                       huh();
-                       return;
-               }
-               xj = aaitem;
-               key = scan();
-               if (key == IHREAL) {
-                       /* both quadrant and sector specified */
-                       xk = aaitem;
-                       key = scan();
-                       if (key != IHREAL) {
-                               huh();
-                               return;
-                       }
-                       xl = aaitem;
-
-                       irowq = xi + 0.5;
-                       icolq = xj + 0.5;
-                       irows = xk + 0.5;
-                       icols = xl + 0.5;
-               }
-               else {
-                       if (isprobe) {
-                               /* only quadrant specified -- go to center of dest quad */
-                               irowq = xi + 0.5;
-                               icolq = xj + 0.5;
-                               irows = icols = 5;
-                       }
-                       else {
-                               irows = xi + 0.5;
-                               icols = xj + 0.5;
-                       }
-                       itemp = 1;
-               }
-               if (!VALID_QUADRANT(icolq,irowq)||!VALID_SECTOR(icols,irows)) {
-                   huh();
-                   return;
-               }
-               skip(1);
-               if (!isprobe) {
-                       if (itemp) {
-                               if (iprompt) {
-                                       prout("Helmsman Sulu- \"Course locked in for %s.\"",
-                                               cramlc(sector, irows, icols));
-                               }
-                       }
-                       else prout("Ensign Chekov- \"Course laid in, Captain.\"");
-               }
-               deltax = icolq - quady + 0.1*(icols-secty);
-               deltay = quadx - irowq + 0.1*(sectx-irows);
-       }
-       else { /* manual */
-               while (key == IHEOL) {
-                       proutn("X and Y displacements- ");
-                       chew();
-                       iprompt = 1;
-                       key = scan();
-               }
-               itemp = 2;
-               if (key != IHREAL) {
-                       huh();
-                       return;
-               }
-               deltax = aaitem;
-               key = scan();
-               if (key != IHREAL) {
-                       huh();
-                       return;
-               }
-               deltay = aaitem;
-       }
-       /* Check for zero movement */
-       if (deltax == 0 && deltay == 0) {
-               chew();
-               return;
-       }
-       if (itemp == 2 && !isprobe) {
-               skip(1);
-               prout("Helmsman Sulu- \"Aye, Sir.\"");
-       }
-       dist = sqrt(deltax*deltax + deltay*deltay);
-       direc = atan2(deltax, deltay)*1.90985932;
-       if (direc < 0.0) direc += 12.0;
-       chew();
-       return;
-
-}
-               
-
-
-void impuls(void) 
-{
-    double power;
-
-    ididit = 0;
-    if (game.damage[DIMPULS]) {
-       chew();
-       skip(1);
-       prout("Engineer Scott- \"The impulse engines are damaged, Sir.\"");
-       return;
-    }
-
-    if (energy > 30.0) {
-       getcd(FALSE, 0);
-       if (direc == -1.0) return;
-       power = 20.0 + 100.0*dist;
-    }
-    else
-       power = 30.0;
-
-    if (power >= energy) {
-       /* Insufficient power for trip */
-       skip(1);
-       prout("First Officer Spock- \"Captain, the impulse engines");
-       prout("require 20.0 units to engage, plus 100.0 units per");
-       if (energy > 30) {
-           proutn("quadrant.  We can go, therefore, a maximum of %d", 
-                  (int)(0.01 * (energy-20.0)-0.05));
-           prout(" quadrants.\"");
-       }
-       else {
-           prout("quadrant.  They are, therefore, useless.\"");
-       }
-       chew();
-       return;
-    }
-    /* Make sure enough time is left for the trip */
-    Time = dist/0.095;
-    if (Time >= game.state.remtime) {
-       prout("First Officer Spock- \"Captain, our speed under impulse");
-       prout("power is only 0.95 sectors per stardate. Are you sure");
-       proutn("we dare spend the time?\" ");
-       if (ja() == 0) return;
-    }
-    /* Activate impulse engines and pay the cost */
-    imove();
-    ididit = 1;
-    if (alldone) return;
-    power = 20.0 + 100.0*dist;
-    energy -= power;
-    Time = dist/0.095;
-    if (energy <= 0) finish(FNRG);
-    return;
-}
-
-
-void warp(int i) 
-{
-    int blooey=0, twarp=0, iwarp;
-    double power;
-
-    if (i!=2) { /* Not WARPX entry */
-       ididit = 0;
-       if (game.damage[DWARPEN] > 10.0) {
-           chew();
-           skip(1);
-           prout("Engineer Scott- \"The impulse engines are damaged, Sir.\"");
-           return;
-       }
-       if (game.damage[DWARPEN] > 0.0 && warpfac > 4.0) {
-           chew();
-           skip(1);
-           prout("Engineer Scott- \"Sorry, Captain. Until this damage");
-           prout("  is repaired, I can only give you warp 4.\"");
-           return;
-       }
-                       
-       /* Read in course and distance */
-       getcd(FALSE, 0);
-       if (direc == -1.0) return;
-
-       /* Make sure starship has enough energy for the trip */
-       power = (dist+0.05)*warpfac*warpfac*warpfac*(shldup+1);
-
-
-       if (power >= energy) {
-           /* Insufficient power for trip */
-           ididit = 0;
-           skip(1);
-           prout("Engineering to bridge--");
-           if (shldup==0 || 0.5*power > energy) {
-               iwarp = pow((energy/(dist+0.05)), 0.333333333);
-               if (iwarp <= 0) {
-                   prout("We can't do it, Captain. We haven't the energy.");
-               }
-               else {
-                   proutn("We haven't the energy, but we could do it at warp %d", iwarp);
-                   if (shldup) {
-                       prout(",");
-                       prout("if you'll lower the shields.");
-                   }
-                   else
-                       prout(".");
-               }
-           }
-           else
-               prout("We haven't the energy to go that far with the shields up.");
-           return;
-       }
-                                               
-       /* Make sure enough time is left for the trip */
-       Time = 10.0*dist/wfacsq;
-       if (Time >= 0.8*game.state.remtime) {
-           skip(1);
-           prout("First Officer Spock- \"Captain, I compute that such");
-           proutn("  a trip would require approximately %2.0f",
-                  100.0*Time/game.state.remtime);
-           prout(" percent of our");
-           proutn("  remaining time.  Are you sure this is wise?\" ");
-           if (ja() == 0) { ididit = 0; Time=0; return;}
-       }
-    }
-    /* Entry WARPX */
-    if (warpfac > 6.0) {
-       /* Decide if engine damage will occur */
-       double prob = dist*(6.0-warpfac)*(6.0-warpfac)/66.666666666;
-       if (prob > Rand()) {
-           blooey = 1;
-           dist = Rand()*dist;
-       }
-       /* Decide if time warp will occur */
-       if (0.5*dist*pow(7.0,warpfac-10.0) > Rand()) twarp=1;
-#ifdef DEBUG
-       if (idebug &&warpfac==10 && twarp==0) {
-           blooey=0;
-           proutn("Force time warp? ");
-           if (ja()==1) twarp=1;
-       }
-#endif
-       if (blooey || twarp) {
-           /* If time warp or engine damage, check path */
-           /* If it is obstructed, don't do warp or damage */
-           double angle = ((15.0-direc)*0.5235998);
-           double deltax = -sin(angle);
-           double deltay = cos(angle);
-           double bigger, x, y;
-           int n, l, ix, iy;
-           if (fabs(deltax) > fabs(deltay))
-               bigger = fabs(deltax);
-           else
-               bigger = fabs(deltay);
-                       
-           deltax /= bigger;
-           deltay /= bigger;
-           n = 10.0 * dist * bigger +0.5;
-           x = sectx;
-           y = secty;
-           for (l = 1; l <= n; l++) {
-               x += deltax;
-               ix = x + 0.5;
-               y += deltay;
-               iy = y +0.5;
-               if (!VALID_SECTOR(ix, iy)) break;
-               if (game.quad[ix][iy] != IHDOT) {
-                   blooey = 0;
-                   twarp = 0;
-               }
-           }
-       }
-    }
-                               
-
-    /* Activate Warp Engines and pay the cost */
-    imove();
-    if (alldone) return;
-    energy -= dist*warpfac*warpfac*warpfac*(shldup+1);
-    if (energy <= 0) finish(FNRG);
-    Time = 10.0*dist/wfacsq;
-    if (twarp) timwrp();
-    if (blooey) {
-       game.damage[DWARPEN] = damfac*(3.0*Rand()+1.0);
-       skip(1);
-       prout("Engineering to bridge--");
-       prout("  Scott here.  The warp engines are damaged.");
-       prout("  We'll have to reduce speed to warp 4.");
-    }
-    ididit = 1;
-    return;
-}
-
-
-
-void setwrp(void) 
-{
-    int key;
-    double oldfac;
-       
-    while ((key=scan()) == IHEOL) {
-       chew();
-       proutn("Warp factor- ");
-    }
-    chew();
-    if (key != IHREAL) {
-       huh();
-       return;
-    }
-    if (game.damage[DWARPEN] > 10.0) {
-       prout("Warp engines inoperative.");
-       return;
-    }
-    if (game.damage[DWARPEN] > 0.0 && aaitem > 4.0) {
-       prout("Engineer Scott- \"I'm doing my best, Captain,");
-       prout("  but right now we can only go warp 4.\"");
-       return;
-    }
-    if (aaitem > 10.0) {
-       prout("Helmsman Sulu- \"Our top speed is warp 10, Captain.\"");
-       return;
-    }
-    if (aaitem < 1.0) {
-       prout("Helmsman Sulu- \"We can't go below warp 1, Captain.\"");
-       return;
-    }
-    oldfac = warpfac;
-    warpfac = aaitem;
-    wfacsq=warpfac*warpfac;
-    if (warpfac <= oldfac || warpfac <= 6.0) {
-       proutn("Helmsman Sulu- \"Warp factor %d, Captain.\"", 
-              (int)warpfac);
-       return;
-    }
-    if (warpfac < 8.00) {
-       prout("Engineer Scott- \"Aye, but our maximum safe speed is warp 6.\"");
-       return;
-    }
-    if (warpfac == 10.0) {
-       prout("Engineer Scott- \"Aye, Captain, we'll try it.\"");
-       return;
-    }
-    prout("Engineer Scott- \"Aye, Captain, but our engines may not take it.\"");
-    return;
-}
-
-void atover(int igrab) 
-{
-    double power, distreq;
-
-    chew();
-    /* is captain on planet? */
-    if (landed==1) {
-       if (game.damage[DTRANSP]) {
-           finish(FPNOVA);
-           return;
-       }
-       prout("Scotty rushes to the transporter controls.");
-       if (shldup) {
-           prout("But with the shields up it's hopeless.");
-           finish(FPNOVA);
-       }
-       prouts("His desperate attempt to rescue you . . .");
-       if (Rand() <= 0.5) {
-           prout("fails.");
-           finish(FPNOVA);
-           return;
-       }
-       prout("SUCCEEDS!");
-       if (imine) {
-           imine = 0;
-           proutn("The crystals mined were ");
-           if (Rand() <= 0.25) {
-               prout("lost.");
-           }
-           else {
-               prout("saved.");
-               icrystl = 1;
-           }
-       }
-    }
-    if (igrab) return;
-
-    /* Check to see if captain in shuttle craft */
-    if (icraft) finish(FSTRACTOR);
-    if (alldone) return;
-
-    /* Inform captain of attempt to reach safety */
-    skip(1);
-    do {
-       if (justin) {
-           prouts("***RED ALERT!  READ ALERT!");
-           skip(1);
-           proutn("The ");
-           crmshp();
-           prout(" has stopped in a quadrant containing");
-           prouts("   a supernova.");
-           skip(2);
-       }
-       proutn("***Emergency automatic override attempts to hurl ");
-       crmshp();
-       skip(1);
-       prout("safely out of quadrant.");
-       if (game.damage[DRADIO] == 0.0)
-           game.state.galaxy[quadx][quady].charted = TRUE;
-       /* Try to use warp engines */
-       if (game.damage[DWARPEN]) {
-           skip(1);
-           prout("Warp engines damaged.");
-           finish(FSNOVAED);
-           return;
-       }
-       warpfac = 6.0+2.0*Rand();
-       wfacsq = warpfac * warpfac;
-       prout("Warp factor set to %d", (int)warpfac);
-       power = 0.75*energy;
-       dist = power/(warpfac*warpfac*warpfac*(shldup+1));
-       distreq = 1.4142+Rand();
-       if (distreq < dist) dist = distreq;
-       Time = 10.0*dist/wfacsq;
-       direc = 12.0*Rand();    /* How dumb! */
-       justin = 0;
-       inorbit = 0;
-       warp(2);
-       if (justin == 0) {
-           /* This is bad news, we didn't leave quadrant. */
-           if (alldone) return;
-           skip(1);
-           prout("Insufficient energy to leave quadrant.");
-           finish(FSNOVAED);
-           return;
-       }
-    } while 
-       /* Repeat if another snova */
-       (game.state.galaxy[quadx][quady].supernova);
-    if (KLINGREM==0) 
-       finish(FWON); /* Snova killed remaining enemy. */
-}
-
-void timwrp() 
-{
-    int l, gotit;
-    prout("***TIME WARP ENTERED.");
-    if (game.state.snap && Rand() < 0.5) {
-       /* Go back in time */
-       prout("You are traveling backwards in time %d stardates.",
-             (int)(game.state.date-game.snapsht.date));
-       game.state = game.snapsht;
-       game.state.snap = 0;
-       if (game.state.remcom) {
-           game.future[FTBEAM] = game.state.date + expran(intime/game.state.remcom);
-           game.future[FBATTAK] = game.state.date + expran(0.3*intime);
-       }
-       game.future[FSNOVA] = game.state.date + expran(0.5*intime);
-       game.future[FSNAP] = game.state.date +expran(0.25*game.state.remtime); /* next snapshot will
-                                                                                 be sooner */
-       if (game.state.nscrem) game.future[FSCMOVE] = 0.2777;
-       isatb = 0;
-       game.future[FCDBAS] = game.future[FSCDBAS] = FOREVER;
-       batx = baty = 0;
-
-       /* Make sure Galileo is consistant -- Snapshot may have been taken
-          when on planet, which would give us two Galileos! */
-       gotit = 0;
-       for (l = 0; l < inplan; l++) {
-           if (game.state.plnets[l].known == shuttle_down) {
-               gotit = 1;
-               if (iscraft==1 && ship==IHE) {
-                   prout("Checkov-  \"Security reports the Galileo has disappeared, Sir!");
-                   iscraft = 0;
-               }
-           }
-       }
-       /* Likewise, if in the original time the Galileo was abandoned, but
-          was on ship earlier, it would have vanished -- lets restore it */
-       if (iscraft==0 && gotit==0 && game.damage[DSHUTTL] >= 0.0) {
-           prout("Checkov-  \"Security reports the Galileo has reappeared in the dock!\"");
-           iscraft = 1;
-       }
-       /* 
-        * There used to be code to do the actual reconstrction here,
-        * but the starchart is now part of the snapshotted galaxy state.
-        */
-       prout("Spock has reconstructed a correct star chart from memory");
-    }
-    else {
-       /* Go forward in time */
-       Time = -0.5*intime*log(Rand());
-       prout("You are traveling forward in time %d stardates.", (int)Time);
-       /* cheat to make sure no tractor beams occur during time warp */
-       game.future[FTBEAM] += Time;
-       game.damage[DRADIO] += Time;
-    }
-    newqad(0);
-    events();  /* Stas Sergeev added this -- do pending events */
-}
-
-void probe(void) 
-{
-    double angle, bigger;
-    int key;
-    /* New code to launch a deep space probe */
-    if (nprobes == 0) {
-       chew();
-       skip(1);
-       if (ship == IHE) 
-           prout("Engineer Scott- \"We have no more deep space probes, Sir.\"");
-       else
-           prout("Ye Faerie Queene has no deep space probes.");
-       return;
-    }
-    if (game.damage[DDSP] != 0.0) {
-       chew();
-       skip(1);
-       prout("Engineer Scott- \"The probe launcher is damaged, Sir.\"");
-       return;
-    }
-    if (game.future[FDSPROB] != FOREVER) {
-       chew();
-       skip(1);
-       if (game.damage[DRADIO] != 0 && condit != IHDOCKED) {
-           prout("Spock-  \"Records show the previous probe has not yet");
-           prout("   reached its destination.\"");
-       }
-       else
-           prout("Uhura- \"The previous probe is still reporting data, Sir.\"");
-       return;
-    }
-    key = scan();
-
-    if (key == IHEOL) {
-       /* slow mode, so let Kirk know how many probes there are left */
-       prout(nprobes==1 ? "%d probe left." : "%d probes left.", nprobes);
-       proutn("Are you sure you want to fire a probe? ");
-       if (ja()==0) return;
-    }
-
-    isarmed = FALSE;
-    if (key == IHALPHA && strcmp(citem,"armed") == 0) {
-       isarmed = TRUE;
-       key = scan();
-    }
-    else if (key == IHEOL) {
-       proutn("Arm NOVAMAX warhead? ");
-       isarmed = ja();
-    }
-    getcd(TRUE, key);
-    if (direc == -1.0) return;
-    nprobes--;
-    angle = ((15.0 - direc) * 0.5235988);
-    probeinx = -sin(angle);
-    probeiny = cos(angle);
-    if (fabs(probeinx) > fabs(probeiny))
-       bigger = fabs(probeinx);
-    else
-       bigger = fabs(probeiny);
-               
-    probeiny /= bigger;
-    probeinx /= bigger;
-    proben = 10.0*dist*bigger +0.5;
-    probex = quadx*QUADSIZE + sectx - 1;       // We will use better packing than original
-    probey = quady*QUADSIZE + secty - 1;
-    probecx = quadx;
-    probecy = quady;
-    game.future[FDSPROB] = game.state.date + 0.01; // Time to move one sector
-    prout("Ensign Chekov-  \"The deep space probe is launched, Captain.\"");
-    ididit = 1;
-    return;
-}
-
-void help(void) 
-{
-    /* There's more than one way to move in this game! */
-    double ddist, xdist, probf;
-    int line = 0, l, ix, iy;
-
-    chew();
-    /* Test for conditions which prevent calling for help */
-    if (condit == IHDOCKED) {
-       prout("Lt. Uhura-  \"But Captain, we're already docked.\"");
-       return;
-    }
-    if (game.damage[DRADIO] != 0) {
-       prout("Subspace radio damaged.");
-       return;
-    }
-    if (game.state.rembase==0) {
-       prout("Lt. Uhura-  \"Captain, I'm not getting any response from Starbase.\"");
-       return;
-    }
-    if (landed == 1) {
-       proutn("You must be aboard the ");
-       crmshp();
-       prout(".");
-       return;
-    }
-    /* OK -- call for help from nearest starbase */
-    nhelp++;
-    if (basex!=0) {
-       /* There's one in this quadrant */
-       ddist = sqrt(square(basex-sectx)+square(basey-secty));
-    }
-    else {
-       ddist = FOREVER;
-       for_starbases(l) {
-           xdist=10.0*sqrt(square(game.state.baseqx[l]-quadx)+square(game.state.baseqy[l]-quady));
-           if (xdist < ddist) {
-               ddist = xdist;
-               line = l;
-           }
-       }
-       /* Since starbase not in quadrant, set up new quadrant */
-       quadx = game.state.baseqx[line];
-       quady = game.state.baseqy[line];
-       newqad(1);
-    }
-    /* dematerialize starship */
-    game.quad[sectx][secty]=IHDOT;
-    proutn("Starbase in %s responds--", cramlc(quadrant, quadx, quady));
-    proutn("");
-    crmshp();
-    prout(" dematerializes.");
-    sectx=0;
-    for (l = 1; l <= 5; l++) {
-       ix = basex+3.0*Rand()-1;
-       iy = basey+3.0*Rand()-1;
-       if (VALID_SECTOR(ix,iy) && game.quad[ix][iy]==IHDOT) {
-           /* found one -- finish up */
-           sectx=ix;
-           secty=iy;
-           break;
-       }
-    }
-    if (sectx==0){
-       prout("You have been lost in space...");
-       finish(FMATERIALIZE);
-       return;
-    }
-    /* Give starbase three chances to rematerialize starship */
-    probf = pow((1.0 - pow(0.98,ddist)), 0.33333333);
-    for (l = 1; l <= 3; l++) {
-       switch (l) {
-       case 1: proutn("1st"); break;
-       case 2: proutn("2nd"); break;
-       case 3: proutn("3rd"); break;
-       }
-       proutn(" attempt to re-materialize ");
-       crmshp();
-       switch (l){
-       case 1: game.quad[ix][iy]=IHMATER0;
-           break;
-       case 2: game.quad[ix][iy]=IHMATER1;
-           break;
-       case 3: game.quad[ix][iy]=IHMATER2;
-           break;
-       }
-       textcolor(RED);
-       warble();
-       if (Rand() > probf) break;
-       prout("fails.");
-       delay(500);
-       textcolor(DEFAULT);
-    }
-    if (l > 3) {
-       game.quad[ix][iy]=IHQUEST;
-       alive = 0;
-       drawmaps(1);
-       setwnd(message_window);
-       finish(FMATERIALIZE);
-       return;
-    }
-    game.quad[ix][iy]=ship;
-    textcolor(GREEN);
-    prout("succeeds.");
-    textcolor(DEFAULT);
-    dock(0);
-    skip(1);
-    prout("Lt. Uhura-  \"Captain, we made it!\"");
-}
diff --git a/planets.c b/planets.c
deleted file mode 100644 (file)
index 217ce14..0000000
--- a/planets.c
+++ /dev/null
@@ -1,506 +0,0 @@
-#include "sst.h"
-
-static char *classes[] = {"M","N","O"};
-
-static int consumeTime(void) 
-{
-/* I think most of this avoidance was caused by overlay scheme.
-   Let's see what happens if all events can occur here */
-
-//  double asave;
-    ididit = 1;
-#if 0
-    /* Don't worry about this */
-    if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {
-       /* We are about to be tractor beamed -- operation fails */
-       return 1;
-    }
-#endif
-//     asave = future[FSNOVA];
-//     future[FSNOVA] = FOREVER; /* defer supernovas */
-    events();  /* Used to avoid if future[FSCMOVE] within time */
-//     future[FSNOVA] = asave;
-    /*fails if game over, quadrant super-novas or we've moved to new quadrant*/
-    if (alldone || game.state.galaxy[quadx][quady].supernova || justin != 0) return 1;
-    return 0;
-}
-
-void preport(void) 
-{
-    int iknow = 0, i;
-    skip(1);
-    chew();
-    prout("Spock-  \"Planet report follows, Captain.\"");
-    skip(1);
-    for (i = 0; i < inplan; i++) {
-       if (game.state.plnets[i].known != unknown
-#ifdef DEBUG
-           || ( idebug && game.state.plnets[i].x !=0)
-#endif
-           ) {
-           iknow = 1;
-#ifdef DEBUG
-           if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) ");
-#endif
-           proutn(cramlc(quadrant, game.state.plnets[i].x, game.state.plnets[i].y));
-           proutn("   class ");
-           proutn(classes[game.state.plnets[i].pclass]);
-           proutn("   ");
-           if (game.state.plnets[i].crystals == 0) proutn("no ");
-           prout("dilithium crystals present.");
-           if (game.state.plnets[i].known==shuttle_down) 
-               prout("    Shuttle Craft Galileo on surface.");
-       }
-    }
-    if (iknow==0) prout("No information available.");
-}
-
-void orbit(void) 
-{
-    skip(1);
-    chew();
-    if (inorbit!=0) {
-       prout("Already in standard orbit.");
-       return;
-    }
-    if (game.damage[DWARPEN] != 0 && game.damage[DIMPULS] != 0) {
-       prout("Both warp and impulse engines damaged.");
-       return;
-    }
-    if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {
-       crmshp();
-       prout(" not adjacent to planet.");
-       skip(1);
-       return;
-    }
-    Time = 0.02+0.03*Rand();
-    prout("Helmsman Sulu-  \"Entering standard orbit, Sir.\"");
-    newcnd();
-    if (consumeTime()) return;
-    game.height = (1400.0+7200.0*Rand());
-    prout("Sulu-  \"Entered orbit at altitude %.2f kilometers.\"", game.height);
-    inorbit = 1;
-    ididit=1;
-}
-
-void sensor(void) 
-{
-    skip(1);
-    chew();
-    if (game.damage[DSRSENS] != 0.0) {
-       prout("Short range sensors damaged.");
-       return;
-    }
-    if (!plnetx && (game.options & OPTION_TTY)) {
-       prout("Spock- \"No planet in this quadrant, Captain.\"");
-       return;
-    }
-    if ((plnetx != 0)&& (game.state.plnets[iplnet].known == unknown)) {
-       prout("Spock-  \"Sensor scan for %s-", cramlc(quadrant, quadx, quady));
-       skip(1);
-       prout("         Planet at %s is of class %s.", 
-             cramlc(sector, plnetx, plnety),
-             classes[game.state.plnets[iplnet].pclass]);
-       if (game.state.plnets[iplnet].known==shuttle_down) 
-           prout("         Sensors show Galileo still on surface.");
-       proutn("         Readings indicate");
-       if (game.state.plnets[iplnet].crystals == 0) proutn(" no");
-       prout(" dilithium crystals present.\"");
-       if (game.state.plnets[iplnet].known == unknown) game.state.plnets[iplnet].known = known;
-    }
-}
-
-void beam(void) 
-{
-    chew();
-    skip(1);
-    if (game.damage[DTRANSP] != 0) {
-       prout("Transporter damaged.");
-       if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) {
-           skip(1);
-           proutn("Spock-  \"May I suggest the shuttle craft, Sir?\" ");
-           if (ja() != 0) shuttle();
-       }
-       return;
-    }
-    if (inorbit==0) {
-       crmshp();
-       prout(" not in standard orbit.");
-       return;
-    }
-    if (shldup!=0) {
-       prout("Impossible to transport through shields.");
-       return;
-    }
-    if (game.state.plnets[iplnet].known==unknown) {
-       prout("Spock-  \"Captain, we have no information on this planet");
-       prout("  and Starfleet Regulations clearly state that in this situation");
-       prout("  you may not go down.\"");
-       return;
-    }
-    if (landed==1) {
-       /* Coming from planet */
-       if (game.state.plnets[iplnet].known==shuttle_down) {
-           proutn("Spock-  \"Wouldn't you rather take the Galileo?\" ");
-           if (ja() != 0) {
-               chew();
-               return;
-           }
-           prout("Your crew hides the Galileo to prevent capture by aliens.");
-       }
-       prout("Landing party assembled, ready to beam up.");
-       skip(1);
-       prout("Kirk whips out communicator...");
-       prouts("BEEP  BEEP  BEEP");
-       skip(2);
-       prout("\"Kirk to enterprise-  Lock on coordinates...energize.\"");
-    }
-    else {
-       /* Going to planet */
-       if (game.state.plnets[iplnet].crystals==0) {
-           prout("Spock-  \"Captain, I fail to see the logic in");
-           prout("  exploring a planet with no dilithium crystals.");
-           proutn("  Are you sure this is wise?\" ");
-           if (ja()==0) {
-               chew();
-               return;
-           }
-       }
-       prout("Scotty-  \"Transporter room ready, Sir.\"");
-       skip(1);
-       prout("Kirk, and landing party prepare to beam down to planet surface.");
-       skip(1);
-       prout("Kirk-  \"Energize.\"");
-    }
-    ididit=1;
-    skip(1);
-    prouts("WWHOOOIIIIIRRRRREEEE.E.E.  .  .  .  .   .    .");
-    skip(2);
-    if (Rand() > 0.98) {
-       prouts("BOOOIIIOOOIIOOOOIIIOIING . . .");
-       skip(2);
-       prout("Scotty-  \"Oh my God!  I've lost them.\"");
-       finish(FLOST);
-       return;
-    }
-    prouts(".    .   .  .  .  .  .E.E.EEEERRRRRIIIIIOOOHWW");
-    skip(2);
-    prout("Transport complete.");
-    landed = -landed;
-    if (landed==1 && game.state.plnets[iplnet].known==shuttle_down) {
-       prout("The shuttle craft Galileo is here!");
-    }
-    if (landed!=1 && imine==1) {
-       icrystl = 1;
-       cryprob = 0.05;
-    }
-    imine = 0;
-    return;
-}
-
-void mine(void) 
-{
-    skip(1);
-    chew();
-    if (landed!= 1) {
-       prout("Mining party not on planet.");
-       return;
-    }
-    if (game.state.plnets[iplnet].crystals == 0) {
-       prout("No dilithium crystals on this planet.");
-       return;
-    }
-    if (imine == 1) {
-       prout("You've already mined enough crystals for this trip.");
-       return;
-    }
-    if (icrystl == 1 && cryprob == 0.05) {
-       proutn("With all those fresh crystals aboard the ");
-       crmshp();
-       skip(1);
-       prout("there's no reason to mine more at this time.");
-       return;
-    }
-    Time = (0.1+0.2*Rand())*game.state.plnets[iplnet].pclass;
-    if (consumeTime()) return;
-    prout("Mining operation complete.");
-    imine = 1;
-    ididit=1;
-}
-
-void usecrystals(void) 
-{
-    ididit=0;
-    skip(1);
-    chew();
-    if (icrystl!=1) {
-       prout("No dilithium crystals available.");
-       return;
-    }
-    if (energy >= 1000) {
-       prout("Spock-  \"Captain, Starfleet Regulations prohibit such an operation");
-       prout("  except when condition Yellow exists.");
-       return;
-    }
-    prout("Spock- \"Captain, I must warn you that loading");
-    prout("  raw dilithium crystals into the ship's power");
-    prout("  system may risk a severe explosion.");
-    proutn("  Are you sure this is wise?\" ");
-    if (ja()==0) {
-       chew();
-       return;
-    }
-    skip(1);
-    prout("Engineering Officer Scott-  \"(GULP) Aye Sir.");
-    prout("  Mr. Spock and I will try it.\"");
-    skip(1);
-    prout("Spock-  \"Crystals in place, Sir.");
-    prout("  Ready to activate circuit.\"");
-    skip(1);
-    prouts("Scotty-  \"Keep your fingers crossed, Sir!\"");
-    skip(1);
-    if (Rand() <= cryprob) {
-       prouts("  \"Activating now! - - No good!  It's***");
-       skip(2);
-       prouts("***RED ALERT!  RED A*L********************************");
-       skip(1);
-       stars();
-       prouts("******************   KA-BOOM!!!!   *******************");
-       skip(1);
-       kaboom();
-       return;
-    }
-    energy += 5000.0*(1.0 + 0.9*Rand());
-    prouts("  \"Activating now! - - ");
-    prout("The instruments");
-    prout("   are going crazy, but I think it's");
-    prout("   going to work!!  Congratulations, Sir!\"");
-    cryprob *= 2.0;
-    ididit=1;
-}
-
-void shuttle(void) 
-{
-    chew();
-    skip(1);
-    if(game.damage[DSHUTTL] != 0.0) {
-       if (game.damage[DSHUTTL] == -1.0) {
-           if (inorbit && game.state.plnets[iplnet].known == shuttle_down)
-               prout("Ye Faerie Queene has no shuttle craft bay to dock it at.");
-           else
-               prout("Ye Faerie Queene had no shuttle craft.");
-       }
-       else if (game.damage[DSHUTTL] > 0)
-           prout("The Galileo is damaged.");
-       else prout("Shuttle craft is now serving Big Macs.");
-       return;
-    }
-    if (inorbit==0) {
-       crmshp();
-       prout(" not in standard orbit.");
-       return;
-    }
-    if ((game.state.plnets[iplnet].known != shuttle_down) && iscraft != 1) {
-       prout("Shuttle craft not currently available.");
-       return;
-    }
-    if (landed==-1 && game.state.plnets[iplnet].known==shuttle_down) {
-       prout("You will have to beam down to retrieve the shuttle craft.");
-       return;
-    }
-    if (shldup!=0 || condit == IHDOCKED) {
-       prout("Shuttle craft cannot pass through shields.");
-       return;
-    }
-    if (game.state.plnets[iplnet].known==unknown) {
-       prout("Spock-  \"Captain, we have no information on this planet");
-       prout("  and Starfleet Regulations clearly state that in this situation");
-       prout("  you may not fly down.\"");
-       return;
-    }
-    Time = 3.0e-5*game.height;
-    if (Time >= 0.8*game.state.remtime) {
-       prout("First Officer Spock-  \"Captain, I compute that such");
-       proutn("  a maneuver would require approximately 2d%% of our",
-              (int)(100*Time/game.state.remtime));
-       prout("remaining time.");
-       proutn("Are you sure this is wise?\" ");
-       if (ja()==0) {
-           Time = 0.0;
-           return;
-       }
-    }
-    if (landed == 1) {
-       /* Kirk on planet */
-       if (iscraft==1) {
-           /* Galileo on ship! */
-           if (game.damage[DTRANSP]==0) {
-               proutn("Spock-  \"Would you rather use the transporter?\" ");
-               if (ja() != 0) {
-                   beam();
-                   return;
-               }
-               proutn("Shuttle crew");
-           }
-           else
-               proutn("Rescue party");
-           prout(" boards Galileo and swoops toward planet surface.");
-           iscraft = 0;
-           skip(1);
-           if (consumeTime()) return;
-           game.state.plnets[iplnet].known=shuttle_down;
-           prout("Trip complete.");
-           return;
-       }
-       else {
-           /* Ready to go back to ship */
-           prout("You and your mining party board the");
-           prout("shuttle craft for the trip back to the Enterprise.");
-           skip(1);
-           prout("The short hop begins . . .");
-           game.state.plnets[iplnet].known=known;
-           icraft = 1;
-           skip(1);
-           landed = -1;
-           if (consumeTime()) return;
-           iscraft = 1;
-           icraft = 0;
-           if (imine!=0) {
-               icrystl = 1;
-               cryprob = 0.05;
-           }
-           imine = 0;
-           prout("Trip complete.");
-           return;
-       }
-    }
-    else {
-       /* Kirk on ship */
-       /* and so is Galileo */
-       prout("Mining party assembles in the hangar deck,");
-       prout("ready to board the shuttle craft \"Galileo\".");
-       skip(1);
-       prouts("The hangar doors open; the trip begins.");
-       skip(1);
-       icraft = 1;
-       iscraft = 0;
-       if (consumeTime()) return;
-       game.state.plnets[iplnet].known = shuttle_down;
-       landed = 1;
-       icraft = 0;
-       prout("Trip complete");
-       return;
-    }
-}
-
-void deathray(void) 
-{
-    double dprob, r = Rand();
-       
-    ididit = 0;
-    skip(1);
-    chew();
-    if (ship != IHE) {
-       prout("Ye Faerie Queene has no death ray.");
-       return;
-    }
-    if (nenhere==0) {
-       prout("Sulu-  \"But Sir, there are no enemies in this quadrant.\"");
-       return;
-    }
-    if (game.damage[DDRAY] > 0.0) {
-       prout("Death Ray is damaged.");
-       return;
-    }
-    prout("Spock-  \"Captain, the 'Experimental Death Ray'");
-    prout("  is highly unpredictible.  Considering the alternatives,");
-    proutn("  are you sure this is wise?\" ");
-    if (ja()==0) return;
-    prout("Spock-  \"Acknowledged.\"");
-    skip(1);
-    ididit=1;
-    prouts("WHOOEE ... WHOOEE ... WHOOEE ... WHOOEE");
-    skip(1);
-    prout("Crew scrambles in emergency preparation.");
-    prout("Spock and Scotty ready the death ray and");
-    prout("prepare to channel all ship's power to the device.");
-    skip(1);
-    prout("Spock-  \"Preparations complete, sir.\"");
-    prout("Kirk-  \"Engage!\"");
-    skip(1);
-    prouts("WHIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");
-    skip(1);
-    dprob = .30;
-    if (game.options & OPTION_PLAIN)
-       dprob = .5;
-    if (r > dprob) {
-       prouts("Sulu- \"Captain!  It's working!\"");
-       skip(2);
-       while (nenhere > 0)
-           deadkl(game.kx[1],game.ky[1],game.quad[game.kx[1]][game.ky[1]],game.kx[1],game.ky[1]);
-       prout("Ensign Chekov-  \"Congratulations, Captain!\"");
-       if (KLINGREM == 0) finish(FWON);
-       if ((game.options & OPTION_PLAIN) == 0) {
-           prout("Spock-  \"Captain, I believe the `Experimental Death Ray'");
-           if (Rand() <= 0.05) {
-               prout("   is still operational.\"");
-           }
-           else {
-               prout("   has been rendered nonfunctional.\"");
-               game.damage[DDRAY] = 39.95;
-           }
-       }
-       return;
-    }
-    r = Rand();        // Pick failure method 
-    if (r <= .30) {
-       prouts("Sulu- \"Captain!  It's working!\"");
-       skip(1);
-       prouts("***RED ALERT!  RED ALERT!");
-       skip(1);
-       prout("***MATTER-ANTIMATTER IMPLOSION IMMINENT!");
-       skip(1);
-       prouts("***RED ALERT!  RED A*L********************************");
-       skip(1);
-       stars();
-       prouts("******************   KA-BOOM!!!!   *******************");
-       skip(1);
-       kaboom();
-       return;
-    }
-    if (r <= .55) {
-       prouts("Sulu- \"Captain!  Yagabandaghangrapl, brachriigringlanbla!\"");
-       skip(1);
-       prout("Lt. Uhura-  \"Graaeek!  Graaeek!\"");
-       skip(1);
-       prout("Spock-  \"Fascinating!  . . . All humans aboard");
-       prout("  have apparently been transformed into strange mutations.");
-       prout("  Vulcans do not seem to be affected.");
-       skip(1);
-       prout("Kirk-  \"Raauch!  Raauch!\"");
-       finish(FDRAY);
-       return;
-    }
-    if (r <= 0.75) {
-       int i,j;
-       prouts("Sulu- \"Captain!  It's   --WHAT?!?!\"");
-       skip(2);
-       proutn("Spock-  \"I believe the word is");
-       prouts(" *ASTONISHING*");
-       prout(" Mr. Sulu.");
-       for_sectors(i)
-           for_sectors(j)
-               if (game.quad[i][j] == IHDOT) game.quad[i][j] = IHQUEST;
-       prout("  Captain, our quadrant is now infested with");
-       prouts(" - - - - - -  *THINGS*.");
-       skip(1);
-       prout("  I have no logical explanation.\"");
-       return;
-    }
-    prouts("Sulu- \"Captain!  The Death Ray is creating tribbles!\"");
-    skip(1);
-    prout("Scotty-  \"There are so many tribbles down here");
-    prout("  in Engineering, we can't move for 'em, Captain.\"");
-    finish(FTRIBBLE);
-    return;
-}
diff --git a/po/ChangeLog b/po/ChangeLog
new file mode 100644 (file)
index 0000000..a5bcc93
--- /dev/null
@@ -0,0 +1,12 @@
+2006-09-12  gettextize  <bug-gnu-gettext@gnu.org>
+
+       * Makefile.in.in: New file, from gettext-0.14.5.
+       * boldquot.sed: New file, from gettext-0.14.5.
+       * en@boldquot.header: New file, from gettext-0.14.5.
+       * en@quot.header: New file, from gettext-0.14.5.
+       * insert-header.sin: New file, from gettext-0.14.5.
+       * quot.sed: New file, from gettext-0.14.5.
+       * remove-potcdate.sin: New file, from gettext-0.14.5.
+       * Rules-quot: New file, from gettext-0.14.5.
+       * POTFILES.in: New file.
+
diff --git a/po/Makefile b/po/Makefile
new file mode 100644 (file)
index 0000000..0978b90
--- /dev/null
@@ -0,0 +1,472 @@
+# Makefile for PO directory in any package using GNU gettext.
+# Copyright (C) 1995-1997, 2000-2005 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file can be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU General Public
+# License but which still want to provide support for the GNU gettext
+# functionality.
+# Please note that the actual code of GNU gettext is covered by the GNU
+# General Public License and is *not* in the public domain.
+#
+# Origin: gettext-0.14.4
+
+PACKAGE = sst
+VERSION = 2.0
+PACKAGE_BUGREPORT = stsp
+
+SHELL = /bin/sh
+
+
+srcdir = .
+top_srcdir = ..
+
+
+prefix = /usr/local
+exec_prefix = ${prefix}
+datadir = ${prefix}/share
+localedir = $(datadir)/locale
+gettextsrcdir = $(datadir)/gettext/po
+
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
+mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
+
+GMSGFMT = /usr/bin/msgfmt
+MSGFMT = /usr/bin/msgfmt
+XGETTEXT = /usr/bin/xgettext
+MSGMERGE = msgmerge
+MSGMERGE_UPDATE = /usr/bin/msgmerge --update
+MSGINIT = msginit
+MSGCONV = msgconv
+MSGFILTER = msgfilter
+
+POFILES = 
+GMOFILES = 
+UPDATEPOFILES = 
+DUMMYPOFILES = 
+DISTFILES.common = Makefile.in.in remove-potcdate.sin \
+$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
+DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
+$(POFILES) $(GMOFILES) \
+$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
+
+POTFILES = \
+
+CATALOGS = 
+
+# Makevars gets inserted here. (Don't remove this line!)
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS =
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
+
+.SUFFIXES:
+.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
+
+.po.mo:
+       @echo "$(MSGFMT) -c -o $@ $<"; \
+       $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+
+.po.gmo:
+       @lang=`echo $* | sed -e 's,.*/,,'`; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
+       cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+
+.sin.sed:
+       sed -e '/^#/d' $< > t-$@
+       mv t-$@ $@
+
+
+all: all-yes
+
+all-yes: stamp-po
+all-no:
+
+# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
+# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
+# we don't want to bother translators with empty POT files). We assume that
+# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
+# In this case, stamp-po is a nop (i.e. a phony target).
+
+# stamp-po is a timestamp denoting the last time at which the CATALOGS have
+# been loosely updated. Its purpose is that when a developer or translator
+# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
+# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
+# invocations of "make" will do nothing. This timestamp would not be necessary
+# if updating the $(CATALOGS) would always touch them; however, the rule for
+# $(POFILES) has been designed to not touch files that don't need to be
+# changed.
+stamp-po: $(srcdir)/$(DOMAIN).pot
+       test ! -f $(srcdir)/$(DOMAIN).pot || \
+         test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
+       @test ! -f $(srcdir)/$(DOMAIN).pot || { \
+         echo "touch stamp-po" && \
+         echo timestamp > stamp-poT && \
+         mv stamp-poT stamp-po; \
+       }
+
+# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
+# otherwise packages like GCC can not be built if only parts of the source
+# have been downloaded.
+
+# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
+# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
+$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+       if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
+         msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
+       else \
+         msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
+       fi; \
+       $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+         --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
+         --files-from=$(srcdir)/POTFILES.in \
+         --copyright-holder='$(COPYRIGHT_HOLDER)' \
+         --msgid-bugs-address="$$msgid_bugs_address"
+       test ! -f $(DOMAIN).po || { \
+         if test -f $(srcdir)/$(DOMAIN).pot; then \
+           sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
+           sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
+           if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
+           else \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
+             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+           fi; \
+         else \
+           mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+         fi; \
+       }
+
+# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
+# every "make" invocation, only create it when it is missing.
+# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
+$(srcdir)/$(DOMAIN).pot:
+       $(MAKE) $(DOMAIN).pot-update
+
+# This target rebuilds a PO file if $(DOMAIN).pot has changed.
+# Note that a PO file is not touched if it doesn't need to be changed.
+$(POFILES): $(srcdir)/$(DOMAIN).pot
+       @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
+       if test -f "$(srcdir)/$${lang}.po"; then \
+         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+         echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
+         cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
+       else \
+         $(MAKE) $${lang}.po-create; \
+       fi
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-yes
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+         for file in $(DISTFILES.common) Makevars.template; do \
+           $(INSTALL_DATA) $(srcdir)/$$file \
+                           $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+         for file in Makevars; do \
+           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+       else \
+         : ; \
+       fi
+install-data-no: all
+install-data-yes: all
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkinstalldirs) $(DESTDIR)$$dir; \
+         if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
+         $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
+         echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
+           fi; \
+         done; \
+       done
+
+install-strip: install
+
+installdirs: installdirs-exec installdirs-data
+installdirs-exec:
+installdirs-data: installdirs-data-yes
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+       else \
+         : ; \
+       fi
+installdirs-data-no:
+installdirs-data-yes:
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkinstalldirs) $(DESTDIR)$$dir; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+           fi; \
+         done; \
+       done
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall: uninstall-exec uninstall-data
+uninstall-exec:
+uninstall-data: uninstall-data-yes
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         for file in $(DISTFILES.common) Makevars.template; do \
+           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+       else \
+         : ; \
+       fi
+uninstall-data-no:
+uninstall-data-yes:
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
+           rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+         done; \
+       done
+
+check: all
+
+info dvi ps pdf html tags TAGS ctags CTAGS ID:
+
+mostlyclean:
+       rm -f remove-potcdate.sed
+       rm -f stamp-poT
+       rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+       rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+       rm -f Makefile Makefile.in POTFILES *.mo
+
+maintainer-clean: distclean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+       rm -f stamp-po $(GMOFILES)
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir:
+       $(MAKE) update-po
+       @$(MAKE) dist2
+# This is a separate target because 'update-po' must be executed before.
+dist2: stamp-po $(DISTFILES)
+       dists="$(DISTFILES)"; \
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         dists="$$dists Makevars.template"; \
+       fi; \
+       if test -f $(srcdir)/$(DOMAIN).pot; then \
+         dists="$$dists $(DOMAIN).pot stamp-po"; \
+       fi; \
+       if test -f $(srcdir)/ChangeLog; then \
+         dists="$$dists ChangeLog"; \
+       fi; \
+       for i in 0 1 2 3 4 5 6 7 8 9; do \
+         if test -f $(srcdir)/ChangeLog.$$i; then \
+           dists="$$dists ChangeLog.$$i"; \
+         fi; \
+       done; \
+       if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
+       for file in $$dists; do \
+         if test -f $$file; then \
+           cp -p $$file $(distdir) || exit 1; \
+         else \
+           cp -p $(srcdir)/$$file $(distdir) || exit 1; \
+         fi; \
+       done
+
+update-po: Makefile
+       $(MAKE) $(DOMAIN).pot-update
+       test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
+       $(MAKE) update-gmo
+
+# General rule for creating PO files.
+
+.nop.po-create:
+       @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
+       echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
+       exit 1
+
+# General rule for updating PO files.
+
+.nop.po-update:
+       @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
+       if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
+       tmpdir=`pwd`; \
+       echo "$$lang:"; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+       cd $(srcdir); \
+       if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
+         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+           rm -f $$tmpdir/$$lang.new.po; \
+         else \
+           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+             :; \
+           else \
+             echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+             exit 1; \
+           fi; \
+         fi; \
+       else \
+         echo "msgmerge for $$lang.po failed!" 1>&2; \
+         rm -f $$tmpdir/$$lang.new.po; \
+       fi
+
+$(DUMMYPOFILES):
+
+update-gmo: Makefile $(GMOFILES)
+       @:
+
+Makefile: Makefile.in.in Makevars $(top_builddir)/config.status POTFILES.in
+       cd $(top_builddir) \
+         && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+              $(SHELL) ./config.status
+
+force:
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+# Special Makefile rules for English message catalogs with quotation marks.
+
+DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
+
+.SUFFIXES: .insert-header .po-update-en
+
+en@quot.po-create:
+       $(MAKE) en@quot.po-update
+en@boldquot.po-create:
+       $(MAKE) en@boldquot.po-update
+
+en@quot.po-update: en@quot.po-update-en
+en@boldquot.po-update: en@boldquot.po-update-en
+
+.insert-header.po-update-en:
+       @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
+       if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
+       tmpdir=`pwd`; \
+       echo "$$lang:"; \
+       ll=`echo $$lang | sed -e 's/@.*//'`; \
+       LC_ALL=C; export LC_ALL; \
+       cd $(srcdir); \
+       if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
+         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+           rm -f $$tmpdir/$$lang.new.po; \
+         else \
+           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+             :; \
+           else \
+             echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+             exit 1; \
+           fi; \
+         fi; \
+       else \
+         echo "creation of $$lang.po failed!" 1>&2; \
+         rm -f $$tmpdir/$$lang.new.po; \
+       fi
+
+en@quot.insert-header: insert-header.sin
+       sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
+
+en@boldquot.insert-header: insert-header.sin
+       sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
+
+mostlyclean: mostlyclean-quot
+mostlyclean-quot:
+       rm -f *.insert-header
diff --git a/po/Makefile.in b/po/Makefile.in
new file mode 100644 (file)
index 0000000..f39b023
--- /dev/null
@@ -0,0 +1,384 @@
+# Makefile for PO directory in any package using GNU gettext.
+# Copyright (C) 1995-1997, 2000-2005 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file can be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU General Public
+# License but which still want to provide support for the GNU gettext
+# functionality.
+# Please note that the actual code of GNU gettext is covered by the GNU
+# General Public License and is *not* in the public domain.
+#
+# Origin: gettext-0.14.4
+
+PACKAGE = sst
+VERSION = 2.0
+PACKAGE_BUGREPORT = stsp
+
+SHELL = /bin/sh
+
+
+srcdir = .
+top_srcdir = ..
+
+
+prefix = /usr/local
+exec_prefix = ${prefix}
+datadir = ${prefix}/share
+localedir = $(datadir)/locale
+gettextsrcdir = $(datadir)/gettext/po
+
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
+mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
+
+GMSGFMT = /usr/bin/msgfmt
+MSGFMT = /usr/bin/msgfmt
+XGETTEXT = /usr/bin/xgettext
+MSGMERGE = msgmerge
+MSGMERGE_UPDATE = /usr/bin/msgmerge --update
+MSGINIT = msginit
+MSGCONV = msgconv
+MSGFILTER = msgfilter
+
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+UPDATEPOFILES = @UPDATEPOFILES@
+DUMMYPOFILES = @DUMMYPOFILES@
+DISTFILES.common = Makefile.in.in remove-potcdate.sin \
+$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
+DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
+$(POFILES) $(GMOFILES) \
+$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+
+# Makevars gets inserted here. (Don't remove this line!)
+
+.SUFFIXES:
+.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
+
+.po.mo:
+       @echo "$(MSGFMT) -c -o $@ $<"; \
+       $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+
+.po.gmo:
+       @lang=`echo $* | sed -e 's,.*/,,'`; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
+       cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+
+.sin.sed:
+       sed -e '/^#/d' $< > t-$@
+       mv t-$@ $@
+
+
+all: all-yes
+
+all-yes: stamp-po
+all-no:
+
+# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
+# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
+# we don't want to bother translators with empty POT files). We assume that
+# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
+# In this case, stamp-po is a nop (i.e. a phony target).
+
+# stamp-po is a timestamp denoting the last time at which the CATALOGS have
+# been loosely updated. Its purpose is that when a developer or translator
+# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
+# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
+# invocations of "make" will do nothing. This timestamp would not be necessary
+# if updating the $(CATALOGS) would always touch them; however, the rule for
+# $(POFILES) has been designed to not touch files that don't need to be
+# changed.
+stamp-po: $(srcdir)/$(DOMAIN).pot
+       test ! -f $(srcdir)/$(DOMAIN).pot || \
+         test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
+       @test ! -f $(srcdir)/$(DOMAIN).pot || { \
+         echo "touch stamp-po" && \
+         echo timestamp > stamp-poT && \
+         mv stamp-poT stamp-po; \
+       }
+
+# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
+# otherwise packages like GCC can not be built if only parts of the source
+# have been downloaded.
+
+# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
+# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
+$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+       if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
+         msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
+       else \
+         msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
+       fi; \
+       $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+         --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
+         --files-from=$(srcdir)/POTFILES.in \
+         --copyright-holder='$(COPYRIGHT_HOLDER)' \
+         --msgid-bugs-address="$$msgid_bugs_address"
+       test ! -f $(DOMAIN).po || { \
+         if test -f $(srcdir)/$(DOMAIN).pot; then \
+           sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
+           sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
+           if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
+           else \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
+             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+           fi; \
+         else \
+           mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+         fi; \
+       }
+
+# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
+# every "make" invocation, only create it when it is missing.
+# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
+$(srcdir)/$(DOMAIN).pot:
+       $(MAKE) $(DOMAIN).pot-update
+
+# This target rebuilds a PO file if $(DOMAIN).pot has changed.
+# Note that a PO file is not touched if it doesn't need to be changed.
+$(POFILES): $(srcdir)/$(DOMAIN).pot
+       @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
+       if test -f "$(srcdir)/$${lang}.po"; then \
+         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+         echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
+         cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
+       else \
+         $(MAKE) $${lang}.po-create; \
+       fi
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-yes
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+         for file in $(DISTFILES.common) Makevars.template; do \
+           $(INSTALL_DATA) $(srcdir)/$$file \
+                           $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+         for file in Makevars; do \
+           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+       else \
+         : ; \
+       fi
+install-data-no: all
+install-data-yes: all
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkinstalldirs) $(DESTDIR)$$dir; \
+         if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
+         $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
+         echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
+           fi; \
+         done; \
+       done
+
+install-strip: install
+
+installdirs: installdirs-exec installdirs-data
+installdirs-exec:
+installdirs-data: installdirs-data-yes
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+       else \
+         : ; \
+       fi
+installdirs-data-no:
+installdirs-data-yes:
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkinstalldirs) $(DESTDIR)$$dir; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+           fi; \
+         done; \
+       done
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall: uninstall-exec uninstall-data
+uninstall-exec:
+uninstall-data: uninstall-data-yes
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         for file in $(DISTFILES.common) Makevars.template; do \
+           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+       else \
+         : ; \
+       fi
+uninstall-data-no:
+uninstall-data-yes:
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
+           rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+         done; \
+       done
+
+check: all
+
+info dvi ps pdf html tags TAGS ctags CTAGS ID:
+
+mostlyclean:
+       rm -f remove-potcdate.sed
+       rm -f stamp-poT
+       rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+       rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+       rm -f Makefile Makefile.in POTFILES *.mo
+
+maintainer-clean: distclean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+       rm -f stamp-po $(GMOFILES)
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir:
+       $(MAKE) update-po
+       @$(MAKE) dist2
+# This is a separate target because 'update-po' must be executed before.
+dist2: stamp-po $(DISTFILES)
+       dists="$(DISTFILES)"; \
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         dists="$$dists Makevars.template"; \
+       fi; \
+       if test -f $(srcdir)/$(DOMAIN).pot; then \
+         dists="$$dists $(DOMAIN).pot stamp-po"; \
+       fi; \
+       if test -f $(srcdir)/ChangeLog; then \
+         dists="$$dists ChangeLog"; \
+       fi; \
+       for i in 0 1 2 3 4 5 6 7 8 9; do \
+         if test -f $(srcdir)/ChangeLog.$$i; then \
+           dists="$$dists ChangeLog.$$i"; \
+         fi; \
+       done; \
+       if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
+       for file in $$dists; do \
+         if test -f $$file; then \
+           cp -p $$file $(distdir) || exit 1; \
+         else \
+           cp -p $(srcdir)/$$file $(distdir) || exit 1; \
+         fi; \
+       done
+
+update-po: Makefile
+       $(MAKE) $(DOMAIN).pot-update
+       test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
+       $(MAKE) update-gmo
+
+# General rule for creating PO files.
+
+.nop.po-create:
+       @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
+       echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
+       exit 1
+
+# General rule for updating PO files.
+
+.nop.po-update:
+       @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
+       if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
+       tmpdir=`pwd`; \
+       echo "$$lang:"; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+       cd $(srcdir); \
+       if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
+         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+           rm -f $$tmpdir/$$lang.new.po; \
+         else \
+           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+             :; \
+           else \
+             echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+             exit 1; \
+           fi; \
+         fi; \
+       else \
+         echo "msgmerge for $$lang.po failed!" 1>&2; \
+         rm -f $$tmpdir/$$lang.new.po; \
+       fi
+
+$(DUMMYPOFILES):
+
+update-gmo: Makefile $(GMOFILES)
+       @:
+
+Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
+       cd $(top_builddir) \
+         && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+              $(SHELL) ./config.status
+
+force:
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
new file mode 100644 (file)
index 0000000..1f5cc28
--- /dev/null
@@ -0,0 +1,384 @@
+# Makefile for PO directory in any package using GNU gettext.
+# Copyright (C) 1995-1997, 2000-2005 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file can be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU General Public
+# License but which still want to provide support for the GNU gettext
+# functionality.
+# Please note that the actual code of GNU gettext is covered by the GNU
+# General Public License and is *not* in the public domain.
+#
+# Origin: gettext-0.14.4
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datadir = @datadir@
+localedir = $(datadir)/locale
+gettextsrcdir = $(datadir)/gettext/po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
+
+GMSGFMT = @GMSGFMT@
+MSGFMT = @MSGFMT@
+XGETTEXT = @XGETTEXT@
+MSGMERGE = msgmerge
+MSGMERGE_UPDATE = @MSGMERGE@ --update
+MSGINIT = msginit
+MSGCONV = msgconv
+MSGFILTER = msgfilter
+
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+UPDATEPOFILES = @UPDATEPOFILES@
+DUMMYPOFILES = @DUMMYPOFILES@
+DISTFILES.common = Makefile.in.in remove-potcdate.sin \
+$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
+DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
+$(POFILES) $(GMOFILES) \
+$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+
+# Makevars gets inserted here. (Don't remove this line!)
+
+.SUFFIXES:
+.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
+
+.po.mo:
+       @echo "$(MSGFMT) -c -o $@ $<"; \
+       $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+
+.po.gmo:
+       @lang=`echo $* | sed -e 's,.*/,,'`; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
+       cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+
+.sin.sed:
+       sed -e '/^#/d' $< > t-$@
+       mv t-$@ $@
+
+
+all: all-@USE_NLS@
+
+all-yes: stamp-po
+all-no:
+
+# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
+# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
+# we don't want to bother translators with empty POT files). We assume that
+# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
+# In this case, stamp-po is a nop (i.e. a phony target).
+
+# stamp-po is a timestamp denoting the last time at which the CATALOGS have
+# been loosely updated. Its purpose is that when a developer or translator
+# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
+# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
+# invocations of "make" will do nothing. This timestamp would not be necessary
+# if updating the $(CATALOGS) would always touch them; however, the rule for
+# $(POFILES) has been designed to not touch files that don't need to be
+# changed.
+stamp-po: $(srcdir)/$(DOMAIN).pot
+       test ! -f $(srcdir)/$(DOMAIN).pot || \
+         test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
+       @test ! -f $(srcdir)/$(DOMAIN).pot || { \
+         echo "touch stamp-po" && \
+         echo timestamp > stamp-poT && \
+         mv stamp-poT stamp-po; \
+       }
+
+# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
+# otherwise packages like GCC can not be built if only parts of the source
+# have been downloaded.
+
+# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
+# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
+$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+       if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
+         msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
+       else \
+         msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
+       fi; \
+       $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+         --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
+         --files-from=$(srcdir)/POTFILES.in \
+         --copyright-holder='$(COPYRIGHT_HOLDER)' \
+         --msgid-bugs-address="$$msgid_bugs_address"
+       test ! -f $(DOMAIN).po || { \
+         if test -f $(srcdir)/$(DOMAIN).pot; then \
+           sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
+           sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
+           if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
+           else \
+             rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
+             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+           fi; \
+         else \
+           mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
+         fi; \
+       }
+
+# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
+# every "make" invocation, only create it when it is missing.
+# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
+$(srcdir)/$(DOMAIN).pot:
+       $(MAKE) $(DOMAIN).pot-update
+
+# This target rebuilds a PO file if $(DOMAIN).pot has changed.
+# Note that a PO file is not touched if it doesn't need to be changed.
+$(POFILES): $(srcdir)/$(DOMAIN).pot
+       @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
+       if test -f "$(srcdir)/$${lang}.po"; then \
+         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+         echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
+         cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
+       else \
+         $(MAKE) $${lang}.po-create; \
+       fi
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-@USE_NLS@
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+         for file in $(DISTFILES.common) Makevars.template; do \
+           $(INSTALL_DATA) $(srcdir)/$$file \
+                           $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+         for file in Makevars; do \
+           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+       else \
+         : ; \
+       fi
+install-data-no: all
+install-data-yes: all
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkinstalldirs) $(DESTDIR)$$dir; \
+         if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
+         $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
+         echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
+             cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+             echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
+           fi; \
+         done; \
+       done
+
+install-strip: install
+
+installdirs: installdirs-exec installdirs-data
+installdirs-exec:
+installdirs-data: installdirs-data-@USE_NLS@
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
+       else \
+         : ; \
+       fi
+installdirs-data-no:
+installdirs-data-yes:
+       $(mkinstalldirs) $(DESTDIR)$(datadir)
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         dir=$(localedir)/$$lang/LC_MESSAGES; \
+         $(mkinstalldirs) $(DESTDIR)$$dir; \
+         for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
+           if test -n "$$lc"; then \
+             if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
+               link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
+               mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+               mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
+                for file in *; do \
+                  if test -f $$file; then \
+                    ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
+                  fi; \
+                done); \
+               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
+             else \
+               if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
+                 :; \
+               else \
+                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
+                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
+               fi; \
+             fi; \
+           fi; \
+         done; \
+       done
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall: uninstall-exec uninstall-data
+uninstall-exec:
+uninstall-data: uninstall-data-@USE_NLS@
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         for file in $(DISTFILES.common) Makevars.template; do \
+           rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
+         done; \
+       else \
+         : ; \
+       fi
+uninstall-data-no:
+uninstall-data-yes:
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
+         for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
+           rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
+         done; \
+       done
+
+check: all
+
+info dvi ps pdf html tags TAGS ctags CTAGS ID:
+
+mostlyclean:
+       rm -f remove-potcdate.sed
+       rm -f stamp-poT
+       rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
+       rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+       rm -f Makefile Makefile.in POTFILES *.mo
+
+maintainer-clean: distclean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+       rm -f stamp-po $(GMOFILES)
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir:
+       $(MAKE) update-po
+       @$(MAKE) dist2
+# This is a separate target because 'update-po' must be executed before.
+dist2: stamp-po $(DISTFILES)
+       dists="$(DISTFILES)"; \
+       if test "$(PACKAGE)" = "gettext-tools"; then \
+         dists="$$dists Makevars.template"; \
+       fi; \
+       if test -f $(srcdir)/$(DOMAIN).pot; then \
+         dists="$$dists $(DOMAIN).pot stamp-po"; \
+       fi; \
+       if test -f $(srcdir)/ChangeLog; then \
+         dists="$$dists ChangeLog"; \
+       fi; \
+       for i in 0 1 2 3 4 5 6 7 8 9; do \
+         if test -f $(srcdir)/ChangeLog.$$i; then \
+           dists="$$dists ChangeLog.$$i"; \
+         fi; \
+       done; \
+       if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
+       for file in $$dists; do \
+         if test -f $$file; then \
+           cp -p $$file $(distdir) || exit 1; \
+         else \
+           cp -p $(srcdir)/$$file $(distdir) || exit 1; \
+         fi; \
+       done
+
+update-po: Makefile
+       $(MAKE) $(DOMAIN).pot-update
+       test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
+       $(MAKE) update-gmo
+
+# General rule for creating PO files.
+
+.nop.po-create:
+       @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
+       echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
+       exit 1
+
+# General rule for updating PO files.
+
+.nop.po-update:
+       @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
+       if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
+       tmpdir=`pwd`; \
+       echo "$$lang:"; \
+       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+       echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+       cd $(srcdir); \
+       if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
+         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+           rm -f $$tmpdir/$$lang.new.po; \
+         else \
+           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+             :; \
+           else \
+             echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+             exit 1; \
+           fi; \
+         fi; \
+       else \
+         echo "msgmerge for $$lang.po failed!" 1>&2; \
+         rm -f $$tmpdir/$$lang.new.po; \
+       fi
+
+$(DUMMYPOFILES):
+
+update-gmo: Makefile $(GMOFILES)
+       @:
+
+Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
+       cd $(top_builddir) \
+         && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+              $(SHELL) ./config.status
+
+force:
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/po/Makevars b/po/Makevars
new file mode 100644 (file)
index 0000000..32692ab
--- /dev/null
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS =
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/po/Makevars.template b/po/Makevars.template
new file mode 100644 (file)
index 0000000..32692ab
--- /dev/null
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS =
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/po/POTFILES b/po/POTFILES
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644 (file)
index 0000000..667e27c
--- /dev/null
@@ -0,0 +1 @@
+# List of source files which contain translatable strings.
diff --git a/po/Rules-quot b/po/Rules-quot
new file mode 100644 (file)
index 0000000..9c2a995
--- /dev/null
@@ -0,0 +1,47 @@
+# Special Makefile rules for English message catalogs with quotation marks.
+
+DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
+
+.SUFFIXES: .insert-header .po-update-en
+
+en@quot.po-create:
+       $(MAKE) en@quot.po-update
+en@boldquot.po-create:
+       $(MAKE) en@boldquot.po-update
+
+en@quot.po-update: en@quot.po-update-en
+en@boldquot.po-update: en@boldquot.po-update-en
+
+.insert-header.po-update-en:
+       @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
+       if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
+       tmpdir=`pwd`; \
+       echo "$$lang:"; \
+       ll=`echo $$lang | sed -e 's/@.*//'`; \
+       LC_ALL=C; export LC_ALL; \
+       cd $(srcdir); \
+       if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
+         if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+           rm -f $$tmpdir/$$lang.new.po; \
+         else \
+           if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+             :; \
+           else \
+             echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+             exit 1; \
+           fi; \
+         fi; \
+       else \
+         echo "creation of $$lang.po failed!" 1>&2; \
+         rm -f $$tmpdir/$$lang.new.po; \
+       fi
+
+en@quot.insert-header: insert-header.sin
+       sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
+
+en@boldquot.insert-header: insert-header.sin
+       sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
+
+mostlyclean: mostlyclean-quot
+mostlyclean-quot:
+       rm -f *.insert-header
diff --git a/po/boldquot.sed b/po/boldquot.sed
new file mode 100644 (file)
index 0000000..4b937aa
--- /dev/null
@@ -0,0 +1,10 @@
+s/"\([^"]*\)"/“\1”/g
+s/`\([^`']*\)'/‘\1’/g
+s/ '\([^`']*\)' / ‘\1’ /g
+s/ '\([^`']*\)'$/ ‘\1’/g
+s/^'\([^`']*\)' /‘\1’ /g
+s/“”/""/g
+s/“/“\e[1m/g
+s/”/\e[0m”/g
+s/‘/‘\e[1m/g
+s/’/\e[0m’/g
diff --git a/po/en@boldquot.header b/po/en@boldquot.header
new file mode 100644 (file)
index 0000000..fedb6a0
--- /dev/null
@@ -0,0 +1,25 @@
+# All this catalog "translates" are quotation characters.
+# The msgids must be ASCII and therefore cannot contain real quotation
+# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
+# and double quote (0x22). These substitutes look strange; see
+# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
+#
+# This catalog translates grave accent (0x60) and apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019).
+# It also translates pairs of apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019)
+# and pairs of quotation mark (0x22) to
+# left double quotation mark (U+201C) and right double quotation mark (U+201D).
+#
+# When output to an UTF-8 terminal, the quotation characters appear perfectly.
+# When output to an ISO-8859-1 terminal, the single quotation marks are
+# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
+# grave/acute accent (by libiconv), and the double quotation marks are
+# transliterated to 0x22.
+# When output to an ASCII terminal, the single quotation marks are
+# transliterated to apostrophes, and the double quotation marks are
+# transliterated to 0x22.
+#
+# This catalog furthermore displays the text between the quotation marks in
+# bold face, assuming the VT100/XTerm escape sequences.
+#
diff --git a/po/en@quot.header b/po/en@quot.header
new file mode 100644 (file)
index 0000000..a9647fc
--- /dev/null
@@ -0,0 +1,22 @@
+# All this catalog "translates" are quotation characters.
+# The msgids must be ASCII and therefore cannot contain real quotation
+# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
+# and double quote (0x22). These substitutes look strange; see
+# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
+#
+# This catalog translates grave accent (0x60) and apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019).
+# It also translates pairs of apostrophe (0x27) to
+# left single quotation mark (U+2018) and right single quotation mark (U+2019)
+# and pairs of quotation mark (0x22) to
+# left double quotation mark (U+201C) and right double quotation mark (U+201D).
+#
+# When output to an UTF-8 terminal, the quotation characters appear perfectly.
+# When output to an ISO-8859-1 terminal, the single quotation marks are
+# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
+# grave/acute accent (by libiconv), and the double quotation marks are
+# transliterated to 0x22.
+# When output to an ASCII terminal, the single quotation marks are
+# transliterated to apostrophes, and the double quotation marks are
+# transliterated to 0x22.
+#
diff --git a/po/insert-header.sin b/po/insert-header.sin
new file mode 100644 (file)
index 0000000..b26de01
--- /dev/null
@@ -0,0 +1,23 @@
+# Sed script that inserts the file called HEADER before the header entry.
+#
+# At each occurrence of a line starting with "msgid ", we execute the following
+# commands. At the first occurrence, insert the file. At the following
+# occurrences, do nothing. The distinction between the first and the following
+# occurrences is achieved by looking at the hold space.
+/^msgid /{
+x
+# Test if the hold space is empty.
+s/m/m/
+ta
+# Yes it was empty. First occurrence. Read the file.
+r HEADER
+# Output the file's contents by reading the next line. But don't lose the
+# current line while doing this.
+g
+N
+bb
+:a
+# The hold space was nonempty. Following occurrences. Do nothing.
+x
+:b
+}
diff --git a/po/quot.sed b/po/quot.sed
new file mode 100644 (file)
index 0000000..0122c46
--- /dev/null
@@ -0,0 +1,6 @@
+s/"\([^"]*\)"/“\1”/g
+s/`\([^`']*\)'/‘\1’/g
+s/ '\([^`']*\)' / ‘\1’ /g
+s/ '\([^`']*\)'$/ ‘\1’/g
+s/^'\([^`']*\)' /‘\1’ /g
+s/“”/""/g
diff --git a/po/remove-potcdate.sed b/po/remove-potcdate.sed
new file mode 100644 (file)
index 0000000..edb38d7
--- /dev/null
@@ -0,0 +1,11 @@
+/^"POT-Creation-Date: .*"$/{
+x
+s/P/P/
+ta
+g
+d
+bb
+:a
+x
+:b
+}
diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin
new file mode 100644 (file)
index 0000000..2436c49
--- /dev/null
@@ -0,0 +1,19 @@
+# Sed script that remove the POT-Creation-Date line in the header entry
+# from a POT file.
+#
+# The distinction between the first and the following occurrences of the
+# pattern is achieved by looking at the hold space.
+/^"POT-Creation-Date: .*"$/{
+x
+# Test if the hold space is empty.
+s/P/P/
+ta
+# Yes it was empty. First occurrence. Remove the line.
+g
+d
+bb
+:a
+# The hold space was nonempty. Following occurrences. Do nothing.
+x
+:b
+}
diff --git a/reports.c b/reports.c
deleted file mode 100644 (file)
index f0dc134..0000000
--- a/reports.c
+++ /dev/null
@@ -1,537 +0,0 @@
-#include "sst.h"
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-void attakreport(int curt) 
-{
-    if (!curt) {
-       if (game.future[FCDBAS] < FOREVER) {
-           prout("Starbase in %s is currently under Commander attack.",
-                 cramlc(quadrant, batx, baty));
-           prout("It can hold out until Stardate %d.", 
-                 (int)game.future[FCDBAS]);
-       }
-       if (isatb == 1) {
-           prout("Starbase in %s is under Super-commander attack.",
-                 cramlc(quadrant, game.state.isx, game.state.isy));
-           prout("It can hold out until Stardate %d.", 
-                 (int)game.future[FSCDBAS]);
-       }
-    } else {
-        if (game.future[FCDBAS] < FOREVER)
-           proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]);
-        if (isatb == 1)
-           proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
-    }
-    clreol();
-}
-       
-
-void report(void) 
-{
-    char *s1,*s2,*s3;
-
-    chew();
-    s1 = (thawed?"thawed ":"");
-    switch (length) {
-    case 1: s2="short"; break;
-    case 2: s2="medium"; break;
-    case 4: s2="long"; break;
-    default: s2="unknown length"; break;
-    }
-    switch (skill) {
-    case SKILL_NOVICE: s3="novice"; break;
-    case SKILL_FAIR: s3="fair"; break;
-    case SKILL_GOOD: s3="good"; break;
-    case SKILL_EXPERT: s3="expert"; break;
-    case SKILL_EMERITUS: s3="emeritus"; break;
-    default: s3="skilled"; break;
-    }
-    prout("");
-    prout("You %s playing a %s%s %s game.",
-         alldone? "were": "are now", s1, s2, s3);
-    if (skill>SKILL_GOOD && thawed && !alldone) prout("No plaque is allowed.");
-    if (tourn) prout("This is tournament game %d.", tourn);
-    prout("Your secret password is \"%s\"",game.passwd);
-    proutn("%d of %d Klingons have been killed", KLINGKILLED, INKLINGTOT);
-    if (NKILLC) prout(", including %d Commander%s.", NKILLC, NKILLC==1?"":"s");
-    else if (NKILLK + NKILLSC > 0) prout(", but no Commanders.");
-    else prout(".");
-    if (skill > SKILL_FAIR) prout("The Super Commander has %sbeen destroyed.",
-                                 game.state.nscrem?"not ":"");
-    if (game.state.rembase != inbase) {
-       proutn("There ");
-       if (inbase-game.state.rembase==1) proutn("has been 1 base");
-       else {
-           proutn("have been %d bases", inbase-game.state.rembase);
-       }
-       prout(" destroyed, %d remaining.", game.state.rembase);
-    }
-    else prout("There are %d bases.", inbase);
-    if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
-       /* Don't report this if not seen and
-          either the radio is dead or not at base! */
-       attakreport(0);
-       iseenit = 1;
-    }
-    if (casual) prout("%d casualt%s suffered so far.",
-                     casual, casual==1? "y" : "ies");
-    if (nhelp) prout("There were %d call%s for help.",
-                    nhelp, nhelp==1 ? "" : "s");
-    if (ship == IHE) {
-       proutn("You have ");
-       if (nprobes) proutn("%d", nprobes);
-       else proutn("no");
-       proutn(" deep space probe");
-       if (nprobes!=1) proutn("s");
-       prout(".");
-    }
-    if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
-       game.future[FDSPROB] != FOREVER) {
-       if (isarmed) 
-           proutn("An armed deep space probe is in");
-       else
-           proutn("A deep space probe is in");
-       proutn(cramlc(quadrant, probecx, probecy));
-       prout(".");
-    }
-    if (icrystl) {
-       if (cryprob <= .05)
-           prout("Dilithium crystals aboard ship... not yet used.");
-       else {
-           int i=0;
-           double ai = 0.05;
-           while (cryprob > ai) {
-               ai *= 2.0;
-               i++;
-           }
-           prout("Dilithium crystals have been used %d time%s.",
-                 i, i==1? "" : "s");
-       }
-    }
-    skip(1);
-}
-       
-void lrscan(void) 
-{
-    int x, y;
-    chew();
-    if (game.damage[DLRSENS] != 0.0) {
-       /* Now allow base's sensors if docked */
-       if (condit != IHDOCKED) {
-           prout("LONG-RANGE SENSORS DAMAGED.");
-           return;
-       }
-       prout("Starbase's long-range scan");
-    }
-    else {
-       prout("Long-range scan");
-    }
-    for (x = quadx-1; x <= quadx+1; x++) {
-       proutn(" ");
-       for (y = quady-1; y <= quady+1; y++) {
-           if (!VALID_QUADRANT(x, y))
-               proutn("  -1");
-           else {
-               if (!game.damage[DRADIO])
-                   game.state.galaxy[x][y].charted = TRUE;
-               game.state.chart[x][y].klingons = game.state.galaxy[x][y].klingons;
-               game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase;
-               game.state.chart[x][y].stars = game.state.galaxy[x][y].stars;
-               if (game.state.galaxy[x][y].supernova) 
-                   proutn(" ***");
-               else
-                   proutn(" %3d", game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars);
-           }
-       }
-       prout(" ");
-    }
-}
-
-void dreprt(void) 
-{
-    int jdam = FALSE, i;
-    chew();
-
-    for (i = 0; i < NDEVICES; i++) {
-       if (game.damage[i] > 0.0) {
-           if (!jdam) {
-               prout("DEVICE            -REPAIR TIMES-");
-               prout("                IN FLIGHT   DOCKED");
-               jdam = TRUE;
-           }
-           prout("  %16s %8.2f  %8.2f", 
-                 device[i],
-                 game.damage[i]+0.05,
-                 docfac*game.damage[i]+0.005);
-       }
-    }
-    if (!jdam) prout("All devices functional.");
-}
-
-void rechart(void)
-/* update the chart in the Enterprise's computer from galaxy data */
-{
-    int i, j;
-    lastchart = game.state.date;
-    for_quadrants(i)
-       for_quadrants(j) 
-           if (game.state.galaxy[i][j].charted) {
-               game.state.chart[i][j].klingons = game.state.galaxy[i][j].klingons;
-               game.state.chart[i][j].starbase = game.state.galaxy[i][j].starbase;
-               game.state.chart[i][j].stars = game.state.galaxy[i][j].stars;
-           }
-}
-
-void chart(int nn) 
-{
-    int i,j;
-    chew();
-
-    if (game.damage[DRADIO] == 0.0)
-       rechart();
-
-    if (lastchart < game.state.date && condit == IHDOCKED) {
-       prout("Spock-  \"I revised the Star Chart from the starbase's records.\"");
-       rechart();
-    }
-
-    if (nn == 0) prout("       STAR CHART FOR THE KNOWN GALAXY");
-    if (game.state.date > lastchart)
-       prout("(Last surveillance update %d stardates ago).",
-             (int)(game.state.date-lastchart));
-    prout("      1    2    3    4    5    6    7    8");
-    for_quadrants(i) {
-       proutn("%d |", i);
-       for_quadrants(j) {
-           char buf[4];
-           if ((game.options & OPTION_SHOWME) && i == quadx && j == quady)
-               proutn("<");
-           else
-               proutn(" ");
-           if (game.state.galaxy[i][j].supernova)
-               strcpy(buf, "***");
-           else if (!game.state.galaxy[i][j].charted && game.state.galaxy[i][j].starbase)
-               strcpy(buf, ".1.");
-           else if (game.state.galaxy[i][j].charted)
-               sprintf(buf, "%3d", game.state.chart[i][j].klingons*100 + game.state.chart[i][j].starbase * 10 + game.state.chart[i][j].stars);
-           else
-               strcpy(buf, "...");
-           proutn(buf);
-           if ((game.options & OPTION_SHOWME) && i == quadx && j == quady)
-               proutn(">");
-           else
-               proutn(" ");
-       }
-       proutn("  |");
-       if (i<GALSIZE) skip(1);
-    }
-}
-
-static void sectscan(int goodScan, int i, int j) 
-{
-    if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
-       if ((game.quad[i][j]==IHMATER0)||(game.quad[i][j]==IHMATER1)||(game.quad[i][j]==IHMATER2)||(game.quad[i][j]==IHE)||(game.quad[i][j]==IHF)){
-           switch (condit) {
-           case IHRED: textcolor(RED); break;
-           case IHGREEN: textcolor(GREEN); break;
-           case IHYELLOW: textcolor(YELLOW); break;
-           case IHDOCKED: textcolor(CYAN); break;
-           case IHDEAD: textcolor(BROWN);
-           }
-           if (game.quad[i][j] != ship) 
-               highvideo();
-       }
-       proutn("%c ",game.quad[i][j]);
-       textcolor(DEFAULT);
-    }
-    else
-       proutn("- ");
-}
-
-static void status(int req) 
-{
-    char *cp = NULL;
-    int t, dam = 0;
-    switch (req) {
-    case 1:
-       proutn("Stardate      %.1f, Time Left %.2f", game.state.date, game.state.remtime);
-       break;
-    case 2:
-       if (condit != IHDOCKED) newcnd();
-       switch (condit) {
-       case IHRED: cp = "RED"; break;
-       case IHGREEN: cp = "GREEN"; break;
-       case IHYELLOW: cp = "YELLOW"; break;
-       case IHDOCKED: cp = "DOCKED"; break;
-       case IHDEAD: cp="DEAD"; break;
-       }
-       for (t=0;t<NDEVICES;t++)
-           if (game.damage[t]>0) 
-               dam++;
-       proutn("Condition     %s, %i DAMAGES", cp, dam);
-       break;
-    case 3:
-       proutn("Position      %d - %d , %d - %d",
-              quadx, quady, sectx, secty);
-       break;
-    case 4:
-       proutn("Life Support  ");
-       if (game.damage[DLIFSUP] != 0.0) {
-           if (condit == IHDOCKED)
-               proutn("DAMAGED, Base provides");
-           else
-               proutn("DAMAGED, reserves=%4.2f", lsupres);
-       }
-       else
-           proutn("ACTIVE");
-       break;
-    case 5:
-       proutn("Warp Factor   %.1f", warpfac);
-       break;
-    case 6:
-       proutn("Energy        %.2f", energy);
-       if (icrystl && (game.options & OPTION_SHOWME))  /* ESR */
-           proutn(" (have crystals)");
-       break;
-    case 7:
-       proutn("Torpedoes     %d", torps);
-       break;
-    case 8:
-       proutn("Shields       ");
-       if (game.damage[DSHIELD] != 0)
-           proutn("DAMAGED,");
-       else if (shldup)
-           proutn("UP,");
-       else
-           proutn("DOWN,");
-       proutn(" %d%% %.1f units",
-              (int)((100.0*shield)/inshld + 0.5), shield);
-       break;
-    case 9:
-       proutn("Klingons Left %d", KLINGREM);
-       break;
-    case 10:
-       attakreport(1);
-       break;
-    }
-}
-               
-int srscan(int l) 
-{
-    static char requests[][3] =
-       {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
-    int leftside=TRUE, rightside=TRUE, i, j, jj, req=0, nn=FALSE;
-    int goodScan=TRUE;
-    switch (l) {
-    case SCAN_FULL: // SRSCAN
-       if (game.damage[DSRSENS] != 0) {
-           /* Allow base's sensors if docked */
-           if (condit != IHDOCKED) {
-               prout("   S.R. SENSORS DAMAGED!");
-               goodScan=FALSE;
-           }
-           else
-               prout("  [Using Base's sensors]");
-       }
-       else prout("     Short-range scan");
-       if (goodScan && !game.damage[DRADIO]) { 
-           game.state.chart[quadx][quady].klingons = game.state.galaxy[quadx][quady].klingons;
-           game.state.chart[quadx][quady].starbase = game.state.galaxy[quadx][quady].starbase;
-           game.state.chart[quadx][quady].stars = game.state.galaxy[quadx][quady].stars;
-           game.state.galaxy[quadx][quady].charted = TRUE;
-       }
-       scan();
-       if (isit("chart")) nn = TRUE;
-       if (isit("no")) rightside = FALSE;
-       chew();
-       prout("    1 2 3 4 5 6 7 8 9 10");
-       break;
-    case SCAN_REQUEST:
-       while (scan() == IHEOL)
-           proutn("Information desired? ");
-       chew();
-       for (req = 1; req <= sizeof(requests)/sizeof(requests[0]); req++)
-           if (strncmp(citem,requests[req],min(2,strlen(citem)))==0)
-               break;
-       if (req > sizeof(requests)/sizeof(requests[0])) {
-           prout("UNRECOGNIZED REQUEST. Legal requests are:");
-           prout("  date, condition, position, lsupport, warpfactor,");
-           prout("  energy, torpedoes, shields, klingons, time, bases.");
-           return FALSE;
-       }
-       // no break
-    case SCAN_STATUS: // STATUS
-       chew();
-       leftside = FALSE;
-       skip(1);
-       // no break
-    case SCAN_NO_LEFTSIDE: // REQUEST
-       leftside=FALSE;
-       break;
-    }
-    if (condit != IHDOCKED) newcnd();
-    for (i = 1; i <= max(QUADSIZE, sizeof(requests)/sizeof(requests[0])); i++) {
-       jj = (req!=0 ? req : i);
-       if (leftside && i <= QUADSIZE) {
-           proutn("%2d  ", i);
-           for_sectors(j) {
-               sectscan(goodScan, i, j);
-           }
-       }
-       if (rightside)
-           status(jj);
-       if (i<sizeof(requests)/sizeof(requests[0])) skip(1);
-       if (req!=0) return(goodScan);
-    }
-    prout("");
-    if (nn) chart(1);
-    return(goodScan);
-}
-                       
-                       
-void eta(void)
-{
-    int ix1, ix2, iy1, iy2, prompt=FALSE;
-    int wfl;
-    double ttime, twarp, tpower;
-    if (game.damage[DCOMPTR] != 0.0) {
-       prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
-       skip(1);
-       return;
-    }
-    if (scan() != IHREAL) {
-       prompt = TRUE;
-       chew();
-       proutn("Destination quadrant and/or sector? ");
-       if (scan()!=IHREAL) {
-           huh();
-           return;
-       }
-    }
-    iy1 = aaitem +0.5;
-    if (scan() != IHREAL) {
-       huh();
-       return;
-    }
-    ix1 = aaitem + 0.5;
-    if (scan() == IHREAL) {
-       iy2 = aaitem + 0.5;
-       if (scan() != IHREAL) {
-           huh();
-           return;
-       }
-       ix2 = aaitem + 0.5;
-    }
-    else {
-       if (quady>ix1) ix2 = 1;
-       else ix2=QUADSIZE;
-       if (quadx>iy1) iy2 = 1;
-       else iy2=QUADSIZE;
-    }
-
-    if (!VALID_QUADRANT(ix1, iy1) || !VALID_SECTOR(ix2, iy2)) {
-       huh();
-       return;
-    }
-    dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
-               square(ix1-quady+0.1*(ix2-secty)));
-    wfl = FALSE;
-
-    if (prompt) prout("Answer \"no\" if you don't know the value:");
-    while (TRUE) {
-       chew();
-       proutn("Time or arrival date? ");
-       if (scan()==IHREAL) {
-           ttime = aaitem;
-           if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
-           if (ttime <= 1e-10 ||
-               (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
-               prout("We'll never make it, sir.");
-               chew();
-               return;
-           }
-           if (twarp < 1.0) twarp = 1.0;
-           break;
-       }
-       chew();
-       proutn("Warp factor? ");
-       if (scan()== IHREAL) {
-           wfl = TRUE;
-           twarp = aaitem;
-           if (twarp<1.0 || twarp > 10.0) {
-               huh();
-               return;
-           }
-           break;
-       }
-       prout("Captain, certainly you can give me one of these.");
-    }
-    while (TRUE) {
-       chew();
-       ttime = (10.0*dist)/square(twarp);
-       tpower = dist*twarp*twarp*twarp*(shldup+1);
-       if (tpower >= energy) {
-           prout("Insufficient energy, sir.");
-           if (shldup==0 || tpower > energy*2.0) {
-               if (!wfl) return;
-               proutn("New warp factor to try? ");
-               if (scan() == IHREAL) {
-                   wfl = TRUE;
-                   twarp = aaitem;
-                   if (twarp<1.0 || twarp > 10.0) {
-                       huh();
-                       return;
-                   }
-                   continue;
-               }
-               else {
-                   chew();
-                   skip(1);
-                   return;
-               }
-           }
-           prout("But if you lower your shields,");
-           proutn("remaining");
-           tpower /= 2;
-       }
-       else
-           proutn("Remaining");
-       prout(" energy will be %.2f.", energy-tpower);
-       if (wfl) {
-           prout("And we will arrive at stardate %.2f.",
-                 game.state.date+ttime);
-       }
-       else if (twarp==1.0)
-           prout("Any warp speed is adequate.");
-       else {
-           prout("Minimum warp needed is %.2f,", twarp);
-           prout("and we will arrive at stardate %.2f.",
-                 game.state.date+ttime);
-       }
-       if (game.state.remtime < ttime)
-           prout("Unfortunately, the Federation will be destroyed by then.");
-       if (twarp > 6.0)
-           prout("You'll be taking risks at that speed, Captain");
-       if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
-            game.future[FSCDBAS]< ttime+game.state.date)||
-           (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
-           prout("The starbase there will be destroyed by then.");
-       proutn("New warp factor to try? ");
-       if (scan() == IHREAL) {
-           wfl = TRUE;
-           twarp = aaitem;
-           if (twarp<1.0 || twarp > 10.0) {
-               huh();
-               return;
-           }
-       }
-       else {
-           chew();
-           skip(1);
-           return;
-       }
-    }
-                       
-}
diff --git a/setup.c b/setup.c
deleted file mode 100644 (file)
index 8499184..0000000
--- a/setup.c
+++ /dev/null
@@ -1,742 +0,0 @@
-#include <time.h>
-#include <sys/stat.h>
-#include "sst.h"
-
-static long filelength(int fd) {
-struct stat buf;
-    fstat(fd, &buf);
-    return buf.st_size;
-}
-
-void prelim(void) 
-{
-    skip(2);
-    prout("-SUPER- STAR TREK");
-    skip(1);
-#ifdef __HISTORICAL__
-    prout("Latest update-21 Sept 78");
-    skip(1);
-#endif /* __HISTORICAL__ */
-}
-
-void freeze(int boss) 
-{
-    FILE *fp;
-    int key;
-    if (boss) {
-       strcpy(citem, "emsave.trk");
-    }
-    else {
-       if ((key = scan()) == IHEOL) {
-           proutn("File name: ");
-           key = scan();
-       }
-       if (key != IHALPHA) {
-           huh();
-           return;
-       }
-       chew();
-       if (strchr(citem, '.') == NULL) {
-           strcat(citem, ".trk");
-       }
-    }
-    if ((fp = fopen(citem, "wb")) == NULL) {
-       proutn("Can't freeze game as file ");
-       proutn(citem);
-       skip(1);
-       return;
-    }
-    strcpy(game.magic, SSTMAGIC);
-    fwrite(&game, sizeof(game), 1, fp);
-
-    fclose(fp);
-
-    /* I hope that's enough! */
-}
-
-
-int thaw(void) 
-{
-    FILE *fp;
-    int key;
-
-    game.passwd[0] = '\0';
-    if ((key = scan()) == IHEOL) {
-       proutn("File name: ");
-       key = scan();
-    }
-    if (key != IHALPHA) {
-       huh();
-       return 1;
-    }
-    chew();
-    if (strchr(citem, '.') == NULL) {
-       strcat(citem, ".trk");
-    }
-    if ((fp = fopen(citem, "rb")) == NULL) {
-       proutn("Can't find game file ");
-       proutn(citem);
-       skip(1);
-       return 1;
-    }
-    fread(&game, sizeof(game), 1, fp);
-    if (feof(fp) || ftell(fp) != filelength(fileno(fp)) || strcmp(game.magic, SSTMAGIC)) {
-       prout("Game file format is bad, should begin with " SSTMAGIC);
-       skip(1);
-       fclose(fp);
-       return 1;
-    }
-
-    fclose(fp);
-
-    return 0;
-}
-
-void abandn(void) 
-{
-    int nb, l;
-
-    chew();
-    if (condit==IHDOCKED) {
-       if (ship!=IHE) {
-           prout("You cannot abandon Ye Faerie Queene.");
-           return;
-       }
-    }
-    else {
-       /* Must take shuttle craft to exit */
-       if (game.damage[DSHUTTL]==-1) {
-           prout("Ye Faerie Queene has no shuttle craft.");
-           return;
-       }
-       if (game.damage[DSHUTTL]<0) {
-           prout("Shuttle craft now serving Big Mac's.");
-           return;
-       }
-       if (game.damage[DSHUTTL]>0) {
-           prout("Shuttle craft damaged.");
-           return;
-       }
-       if (landed==1) {
-           prout("You must be aboard the Enterprise.");
-           return;
-       }
-       if (iscraft!=1) {
-           prout("Shuttle craft not currently available.");
-           return;
-       }
-       /* Print abandon ship messages */
-       skip(1);
-       prouts("***ABANDON SHIP!  ABANDON SHIP!");
-       skip(1);
-       prouts("***ALL HANDS ABANDON SHIP!");
-       skip(2);
-       prout("Captain and crew escape in shuttle craft.");
-       prout("Remainder of ship's complement beam down");
-       prout("to nearest habitable planet.");
-       if (game.state.rembase==0) {
-           /* Ops! no place to go... */
-           finish(FABANDN);
-           return;
-       }
-       /* If at least one base left, give 'em the Faerie Queene */
-       skip(1);
-       icrystl = 0; /* crystals are lost */
-       nprobes = 0; /* No probes */
-       prout("You are captured by Klingons and released to");
-       prout("the Federation in a prisoner-of-war exchange.");
-       nb = Rand()*game.state.rembase+1;
-       /* Set up quadrant and position FQ adjacient to base */
-       if (quadx!=game.state.baseqx[nb] || quady!=game.state.baseqy[nb]) {
-           quadx = game.state.baseqx[nb];
-           quady = game.state.baseqy[nb];
-           sectx = secty = 5;
-           newqad(1);
-       }
-       for (;;) {
-           /* position next to base by trial and error */
-           game.quad[sectx][secty] = IHDOT;
-           for_sectors(l) {
-               sectx = 3.0*Rand() - 1.0 + basex;
-               secty = 3.0*Rand() - 1.0 + basey;
-               if (VALID_SECTOR(sectx, secty) &&
-                   game.quad[sectx][secty] == IHDOT) break;
-           }
-           if (l < QUADSIZE+1) break; /* found a spot */
-           sectx=QUADSIZE/2;
-           secty=QUADSIZE/2;
-           newqad(1);
-       }
-    }
-    /* Get new commission */
-    game.quad[sectx][secty] = ship = IHF;
-    prout("Starfleet puts you in command of another ship,");
-    prout("the Faerie Queene, which is antiquated but,");
-    prout("still useable.");
-    if (icrystl!=0) prout("The dilithium crystals have been moved.");
-    imine=0;
-    iscraft=0; /* Gallileo disappears */
-    /* Resupply ship */
-    condit=IHDOCKED;
-    for (l = 0; l < NDEVICES; l++) 
-       game.damage[l] = 0.0;
-    game.damage[DSHUTTL] = -1;
-    energy = inenrg = 3000.0;
-    shield = inshld = 1250.0;
-    torps = intorps = 6;
-    lsupres=inlsr=3.0;
-    shldup=0;
-    warpfac=5.0;
-    wfacsq=25.0;
-    return;
-}
-       
-void setup(int needprompt) 
-{
-    int i,j, krem, klumper;
-    int ix, iy;
-#ifdef DEBUG
-    idebug = 0;
-#endif
-    //  Decide how many of everything
-    if (choose(needprompt)) return; // frozen game
-    // Prepare the Enterprise
-    alldone = gamewon = 0;
-    ship = IHE;
-    energy = inenrg = 5000.0;
-    shield = inshld = 2500.0;
-    shldchg = shldup = 0;
-    inlsr = 4.0;
-    lsupres = 4.0;
-    iran(GALSIZE, &quadx, &quady);
-    iran(QUADSIZE, &sectx, &secty);
-    torps = intorps = 10;
-    nprobes = (int)(3.0*Rand() + 2.0); /* Give them 2-4 of these wonders */
-    warpfac = 5.0;
-    wfacsq = warpfac * warpfac;
-    for (i=0; i < NDEVICES; i++) 
-       game.damage[i] = 0.0;
-    // Set up assorted game parameters
-    batx = baty = 0;
-    game.state.date = indate = 100.0*(int)(31.0*Rand()+20.0);
-    nkinks = nhelp = resting = casual = 0;
-    isatb = iscate = imine = icrystl = icraft = game.state.nplankl = 0;
-    game.state.starkl = game.state.basekl = 0;
-    iscraft = 1;
-    landed = -1;
-    alive = 1;
-    docfac = 0.25;
-    for_quadrants(i)
-       for_quadrants(j) {
-           game.state.galaxy[i][j].charted = 0;
-           game.state.galaxy[i][j].planets = 0;
-           game.state.galaxy[i][j].romulans = 0;
-           game.state.galaxy[i][j].klingons = 0;
-           game.state.galaxy[i][j].starbase = 0;
-           game.state.galaxy[i][j].supernova = 0;
-       }
-    // Initialize times for extraneous events
-    game.future[FSNOVA] = game.state.date + expran(0.5 * intime);
-    game.future[FTBEAM] = game.state.date + expran(1.5 * (intime / game.state.remcom));
-    game.future[FSNAP] = game.state.date + 1.0 + Rand(); // Force an early snapshot
-    game.future[FBATTAK] = game.state.date + expran(0.3*intime);
-    game.future[FCDBAS] = FOREVER;
-    game.future[FSCMOVE] = game.state.nscrem ? game.state.date+0.2777 : FOREVER;
-    game.future[FSCDBAS] = FOREVER;
-    game.future[FDSPROB] = FOREVER;
-    // Starchart is functional but we've never seen it
-    lastchart = FOREVER;
-    // Put stars in the galaxy
-    instar = 0;
-    for_quadrants(i)
-       for_quadrants(j) {
-           int k = Rand()*9.0 + 1.0;
-           instar += k;
-           game.state.galaxy[i][j].stars = k;
-       }
-    // Locate star bases in galaxy
-    for (i = 1; i <= inbase; i++) {
-       int contflag;
-       do {
-           do iran(GALSIZE, &ix, &iy);
-           while (game.state.galaxy[ix][iy].starbase);
-           contflag = FALSE;
-           for (j = i-1; j > 0; j--) {
-               /* Improved placement algorithm to spread out bases */
-               double distq = square(ix-game.state.baseqx[j]) + square(iy-game.state.baseqy[j]);
-               if (distq < 6.0*(BASEMAX+1-inbase) && Rand() < 0.75) {
-                   contflag = TRUE;
-#ifdef DEBUG
-                   prout("DEBUG: Abandoning base #%d at %d-%d", i, ix, iy);
-#endif
-                   break;
-               }
-#ifdef DEBUG
-               else if (distq < 6.0 * (BASEMAX+1-inbase)) {
-                   prout("DEBUG: saving base #%d, close to #%d", i, j);
-               }
-#endif
-           }
-       } while (contflag);
-                       
-       game.state.baseqx[i] = ix;
-       game.state.baseqy[i] = iy;
-       game.state.galaxy[ix][iy].starbase = 1;
-       game.state.chart[ix][iy].starbase = 1;
-    }
-    // Position ordinary Klingon Battle Cruisers
-    krem = inkling;
-    klumper = 0.25*skill*(9.0-length)+1.0;
-    if (klumper > 9) klumper = 9; // Can't have more than 9 in quadrant
-    do {
-       double r = Rand();
-       int klump = (1.0 - r*r)*klumper;
-       if (klump > krem) klump = krem;
-       krem -= klump;
-       do iran(GALSIZE,&ix,&iy);
-       while (game.state.galaxy[ix][iy].supernova ||
-               game.state.galaxy[ix][iy].klingons + klump > 9);
-       game.state.galaxy[ix][iy].klingons += klump;
-    } while (krem > 0);
-    // Position Klingon Commander Ships
-#ifdef DEBUG
-    klumper = 1;
-#endif
-    for (i = 1; i <= incom; i++) {
-       do {
-           do { /* IF debugging, put commanders by bases, always! */
-#ifdef DEBUG
-               if (idebug && klumper <= inbase) {
-                   ix = game.state.baseqx[klumper];
-                   iy = game.state.baseqy[klumper];
-                   klumper++;
-               }
-               else
-#endif
-                   iran(GALSIZE, &ix, &iy);
-           }
-           while ((!game.state.galaxy[ix][iy].klingons && Rand() < 0.75)||
-                  game.state.galaxy[ix][iy].supernova||
-                  game.state.galaxy[ix][iy].klingons > 8);
-           // check for duplicate
-           for (j = 1; j < i; j++)
-               if (game.state.cx[j]==ix && game.state.cy[j]==iy) break;
-       } while (j < i);
-       game.state.galaxy[ix][iy].klingons++;
-       game.state.cx[i] = ix;
-       game.state.cy[i] = iy;
-    }
-    // Locate planets in galaxy
-    for (i = 0; i < inplan; i++) {
-       do iran(GALSIZE, &ix, &iy); while (game.state.galaxy[ix][iy].planets);
-       game.state.galaxy[ix][iy].planets = 1;
-       game.state.plnets[i].x = ix;
-       game.state.plnets[i].y = iy;
-       game.state.plnets[i].pclass = Rand()*3.0; // Planet class M N or O
-       game.state.plnets[i].crystals = 1.5*Rand();             // 1 in 3 chance of crystals
-       game.state.plnets[i].known = unknown;
-    }
-    // Locate Romulans
-    for (i = 1; i <= game.state.nromrem; i++) {
-       iran(GALSIZE, &ix, &iy);
-       game.state.galaxy[ix][iy].romulans = 1;
-    }
-    // Locate the Super Commander
-    if (game.state.nscrem > 0) {
-       do iran(GALSIZE, &ix, &iy);
-       while (game.state.galaxy[ix][iy].supernova || game.state.galaxy[ix][iy].klingons > 8);
-       game.state.isx = ix;
-       game.state.isy = iy;
-       game.state.galaxy[ix][iy].klingons++;
-    }
-    // Place thing (in tournament game, thingx == -1, don't want one!)
-    if (thingx != -1) {
-       iran(GALSIZE, &thingx, &thingy);
-    }
-    else {
-       thingx = thingy = 0;
-    }
-
-//     idate = date;
-    skip(2);
-    game.state.snap = 0;
-               
-    if (skill == SKILL_NOVICE) {
-       prout("It is stardate %d. The Federation is being attacked by",
-             (int)game.state.date);
-       prout("a deadly Klingon invasion force. As captain of the United");
-       prout("Starship U.S.S. Enterprise, it is your mission to seek out");
-       prout("and destroy this invasion force of %d battle cruisers.",
-             INKLINGTOT);
-       prout("You have an initial allotment of %d stardates to complete", (int)intime);
-       prout("your mission.  As you proceed you may be given more time.");
-       prout("");
-       prout("You will have %d supporting starbases.", inbase);
-       proutn("Starbase locations-  ");
-    }
-    else {
-       prout("Stardate %d.", (int)game.state.date);
-       prout("");
-       prout("%d Klingons.", INKLINGTOT);
-       prout("An unknown number of Romulans.");
-       if (game.state.nscrem) prout("and one (GULP) Super-Commander.");
-       prout("%d stardates.",(int)intime);
-       proutn("%d starbases in ", inbase);
-    }
-    for (i = 1; i <= inbase; i++) {
-       proutn(cramlc(0, game.state.baseqx[i], game.state.baseqy[i]));
-       proutn("  ");
-    }
-    skip(2);
-    proutn("The Enterprise is currently in ");
-    proutn(cramlc(quadrant, quadx, quady));
-    proutn(" ");
-    proutn(cramlc(sector, sectx, secty));
-    skip(2);
-    prout("Good Luck!");
-    if (game.state.nscrem) prout("  YOU'LL NEED IT.");
-    waitfor();
-    newqad(0);
-    if (nenhere-iqhere-ithere) shldup=1.0;
-    if (neutz) attack(0);      // bad luck to start in a Romulan Neutral Zone
-}
-
-void randomize(void) 
-{
-    srand((int)time(NULL));
-}
-
-int choose(int needprompt) 
-{
-    while (TRUE) {
-       tourn = 0;
-       thawed = 0;
-       skill = SKILL_NONE;
-       length = 0;
-       if (needprompt) /* Can start with command line options */
-           proutn("Would you like a regular, tournament, or saved game? ");
-       scan();
-       if (strlen(citem)==0) continue; // Try again
-       if (isit("tournament")) {
-           while (scan() == IHEOL) {
-               proutn("Type in tournament number-");
-           }
-           if (aaitem == 0) {
-               chew();
-               continue; // We don't want a blank entry
-           }
-           tourn = (int)aaitem;
-           thingx = -1;
-           srand((unsigned int)(int)aaitem);
-           break;
-       }
-       if (isit("saved") || isit("frozen")) {
-           if (thaw()) continue;
-           chew();
-           if (*game.passwd==0) continue;
-           if (!alldone) thawed = 1; // No plaque if not finished
-           report();
-           waitfor();
-           return TRUE;
-       }
-       if (isit("regular")) break;
-       proutn("What is \"");
-       proutn(citem);
-       prout("\"?");
-       chew();
-    }
-    while (length==0 || skill==SKILL_NONE) {
-       if (scan() == IHALPHA) {
-           if (isit("short")) length = 1;
-           else if (isit("medium")) length = 2;
-           else if (isit("long")) length = 4;
-           else if (isit("novice")) skill = SKILL_NOVICE;
-           else if (isit("fair")) skill = SKILL_FAIR;
-           else if (isit("good")) skill = SKILL_GOOD;
-           else if (isit("expert")) skill = SKILL_EXPERT;
-           else if (isit("emeritus")) skill = SKILL_EMERITUS;
-           else {
-               proutn("What is \"");
-               proutn(citem);
-               prout("\"?");
-           }
-       }
-       else {
-           chew();
-           if (length==0) proutn("Would you like a Short, Medium, or Long game? ");
-           else if (skill == SKILL_NONE) proutn("Are you a Novice, Fair, Good, Expert, or Emeritus player? ");
-       }
-    }
-    // Choose game options -- added by ESR for SST2K
-    if (scan() != IHALPHA) {
-       chew();
-       proutn("Choose your game options: ");
-       scan();
-    }
-    if (isit("plain")) {
-       // Approximates the UT FORTRAN version.
-       game.options &=~ (OPTION_THOLIAN | OPTION_PLANETS | OPTION_THINGY | OPTION_PROBE | OPTION_RAMMING | OPTION_MVBADDY | OPTION_BLKHOLE | OPTION_BASE);
-       game.options |= OPTION_PLAIN;
-    } 
-    else if (isit("almy")) {
-       // Approximates Tom Almy's version.
-       game.options &=~ (OPTION_THINGY | OPTION_BLKHOLE | OPTION_BASE);
-       game.options |= OPTION_ALMY;
-    }
-    else if (isit("fancy"))
-       /* do nothing */;
-    else if (strlen(citem)) {
-           proutn("What is \"");
-           proutn(citem);
-           prout("\"?");
-    }
-    setpassword();
-#ifdef DEBUG
-    if (strcmp(game.passwd, "debug")==0) idebug = 1;
-#endif
-
-    // Use parameters to generate initial values of things
-    damfac = 0.5 * skill;
-    game.state.rembase = 2.0 + Rand()*(BASEMAX-2.0);
-    inbase = game.state.rembase;
-    if (game.options & OPTION_PLANETS)
-       inplan = (PLNETMAX/2) + (PLNETMAX/2+1)*Rand();
-    game.state.nromrem = inrom = (2.0+Rand())*skill;
-    game.state.nscrem = inscom = (skill > SKILL_FAIR ? 1 : 0);
-    game.state.remtime = 7.0 * length;
-    intime = game.state.remtime;
-    game.state.remkl = inkling = 2.0*intime*((skill+1 - 2*Rand())*skill*0.1+.15);
-    incom = skill + 0.0625*inkling*Rand();
-    game.state.remcom = min(10, incom);
-    incom = game.state.remcom;
-    game.state.remres = (inkling+4*incom)*intime;
-    inresor = game.state.remres;
-    if (inkling > 50) {
-       inbase = (game.state.rembase += 1);
-    }
-    return FALSE;
-}
-
-void dropin(int iquad, int *ix, int *iy) 
-{
-    do iran(QUADSIZE, ix, iy);
-    while (game.quad[*ix][*iy] != IHDOT);
-    game.quad[*ix][*iy] = iquad;
-}
-
-void newcnd(void) 
-{
-    condit = IHGREEN;
-    if (energy < 1000.0) condit = IHYELLOW;
-    if (game.state.galaxy[quadx][quady].klingons || game.state.galaxy[quadx][quady].romulans)
-       condit = IHRED;
-    if (!alive) condit=IHDEAD;
-}
-
-
-void newqad(int shutup) 
-{
-    int i, j, ix, iy, nplan;
-
-    iattak = 1;
-    justin = 1;
-    basex = basey = 0;
-    klhere = 0;
-    comhere = 0;
-    plnetx = plnety = 0;
-    ishere = 0;
-    irhere = 0;
-    iplnet = 0;
-    nenhere = 0;
-    neutz = 0;
-    inorbit = 0;
-    landed = -1;
-    ientesc = 0;
-    ithere = 0;
-    iqhere=0;
-    iqengry=0;
-    iseenit = 0;
-    if (iscate) {
-       // Attempt to escape Super-commander, so tbeam back!
-       iscate = 0;
-       ientesc = 1;
-    }
-    // Clear quadrant
-    for_sectors(i)
-       for_sectors(j) 
-           game.quad[i][j] = IHDOT;
-    // cope with supernova
-    if (game.state.galaxy[quadx][quady].supernova)
-       return;
-    klhere = game.state.galaxy[quadx][quady].klingons;
-    irhere = game.state.galaxy[quadx][quady].romulans;
-    nplan  = game.state.galaxy[quadx][quady].planets;
-    nenhere = klhere + irhere;
-
-    // Position Starship
-    game.quad[sectx][secty] = ship;
-
-    if (game.state.galaxy[quadx][quady].klingons) {
-       // Position ordinary Klingons
-       for (i = 1; i <= klhere; i++) {
-           dropin(IHK, &ix, &iy);
-           game.kx[i] = ix;
-           game.ky[i] = iy;
-           game.kdist[i] = game.kavgd[i] = sqrt(square(sectx-ix) + square(secty-iy));
-           game.kpower[i] = Rand()*150.0 +300.0 +25.0*skill;
-       }
-       // If we need a commander, promote a Klingon
-       for_commanders(i)
-           if (game.state.cx[i]==quadx && game.state.cy[i]==quady) break;
-                       
-       if (i <= game.state.remcom) {
-           game.quad[ix][iy] = IHC;
-           game.kpower[klhere] = 950.0+400.0*Rand()+50.0*skill;
-           comhere = 1;
-       }
-
-       // If we need a super-commander, promote a Klingon
-       if (quadx == game.state.isx && quady == game.state.isy) {
-           game.quad[game.kx[1]][game.ky[1]] = IHS;
-           game.kpower[1] = 1175.0 + 400.0*Rand() + 125.0*skill;
-           iscate = game.state.remkl>1;
-           ishere = 1;
-       }
-    }
-    // Put in Romulans if needed
-    for (i = klhere+1; i <= nenhere; i++) {
-       dropin(IHR, &ix, &iy);
-       game.kx[i] = ix;
-       game.ky[i] = iy;
-       game.kdist[i] = game.kavgd[i] = sqrt(square(sectx-ix) + square(secty-iy));
-       game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*skill;
-    }
-    // If quadrant needs a starbase, put it in
-    if (game.state.galaxy[quadx][quady].starbase)
-       dropin(IHB, &basex, &basey);
-       
-    if (nplan) {
-       // If quadrant needs a planet, put it in
-       for (i=0; i < inplan; i++)
-           if (game.state.plnets[i].x == quadx && game.state.plnets[i].y == quady) break;
-       if (i < inplan) {
-           iplnet = i;
-           dropin(IHP, &plnetx, &plnety);
-       }
-    }
-    // Check for condition
-    newcnd();
-    // And finally the stars
-    for (i = 1; i <= game.state.galaxy[quadx][quady].stars; i++) 
-       dropin(IHSTAR, &ix, &iy);
-
-    // Check for RNZ
-    if (irhere > 0 && klhere == 0) {
-       neutz = 1;
-       if (game.damage[DRADIO] <= 0.0) {
-           skip(1);
-           prout("LT. Uhura- \"Captain, an urgent message.");
-           prout("  I'll put it on audio.\"  CLICK");
-           skip(1);
-           prout("INTRUDER! YOU HAVE VIOLATED THE ROMULAN NEUTRAL ZONE.");
-           prout("LEAVE AT ONCE, OR YOU WILL BE DESTROYED!");
-       }
-    }
-
-    if (shutup==0) {
-       // Put in THING if needed
-       if (thingx == quadx && thingy == quady) {
-           dropin(IHQUEST, &ix, &iy);
-           iran(GALSIZE, &thingx, &thingy);
-           nenhere++;
-           iqhere=1;
-           game.kx[nenhere] = ix;
-           game.ky[nenhere] = iy;
-           game.kdist[nenhere] = game.kavgd[nenhere] =
-               sqrt(square(sectx-ix) + square(secty-iy));
-           game.kpower[nenhere] = Rand()*6000.0 +500.0 +250.0*skill;
-           if (game.damage[DSRSENS] == 0.0) {
-               skip(1);
-               prout("MR. SPOCK- \"Captain, this is most unusual.");
-               prout("    Please examine your short-range scan.\"");
-           }
-       }
-    }
-
-    // Decide if quadrant needs a Tholian
-    if (game.options & OPTION_THOLIAN) {
-       if ((skill < SKILL_GOOD && Rand() <= 0.02) ||   /* Lighten up if skill is low */
-           (skill == SKILL_GOOD && Rand() <= 0.05) ||
-           (skill > SKILL_GOOD && Rand() <= 0.08)
-    #ifdef DEBUG
-           || strcmp(game.passwd, "tholianx")==0
-    #endif
-           ) {
-           do {
-               ithx = Rand() > 0.5 ? QUADSIZE : 1;
-               ithy = Rand() > 0.5 ? QUADSIZE : 1;
-           } while (game.quad[ithx][ithy] != IHDOT);
-           game.quad[ithx][ithy] = IHT;
-           ithere = 1;
-           nenhere++;
-           game.kx[nenhere] = ithx;
-           game.ky[nenhere] = ithy;
-           game.kdist[nenhere] = game.kavgd[nenhere] =
-               sqrt(square(sectx-ithx) + square(secty-ithy));
-           game.kpower[nenhere] = Rand()*400.0 +100.0 +25.0*skill;
-           /* Reserve unocupied corners */
-           if (game.quad[1][1]==IHDOT) game.quad[1][1] = 'X';
-           if (game.quad[1][QUADSIZE]==IHDOT) game.quad[1][QUADSIZE] = 'X';
-           if (game.quad[QUADSIZE][1]==IHDOT) game.quad[QUADSIZE][1] = 'X';
-           if (game.quad[QUADSIZE][QUADSIZE]==IHDOT) game.quad[QUADSIZE][QUADSIZE] = 'X';
-       }
-    }
-
-    sortkl();
-
-    // Put in a few black holes
-    for (i = 1; i <= 3; i++)
-       if (Rand() > 0.5) 
-           dropin(IHBLANK, &ix, &iy);
-
-    // Take out X's in corners if Tholian present
-    if (ithere) {
-       if (game.quad[1][1]=='X') game.quad[1][1] = IHDOT;
-       if (game.quad[1][QUADSIZE]=='X') game.quad[1][QUADSIZE] = IHDOT;
-       if (game.quad[QUADSIZE][1]=='X') game.quad[QUADSIZE][1] = IHDOT;
-       if (game.quad[QUADSIZE][QUADSIZE]=='X') game.quad[QUADSIZE][QUADSIZE] = IHDOT;
-    }          
-}
-
-void sortkl(void) 
-{
-    double t;
-    int sw, j, k;
-
-    // The author liked bubble sort. So we will use it. :-(
-
-    if (nenhere-iqhere-ithere < 2) return;
-
-    do {
-       sw = FALSE;
-       for (j = 1; j < nenhere; j++)
-           if (game.kdist[j] > game.kdist[j+1]) {
-               sw = TRUE;
-               t = game.kdist[j];
-               game.kdist[j] = game.kdist[j+1];
-               game.kdist[j+1] = t;
-               t = game.kavgd[j];
-               game.kavgd[j] = game.kavgd[j+1];
-               game.kavgd[j+1] = t;
-               k = game.kx[j];
-               game.kx[j] = game.kx[j+1];
-               game.kx[j+1] = k;
-               k = game.ky[j];
-               game.ky[j] = game.ky[j+1];
-               game.ky[j+1] = k;
-               t = game.kpower[j];
-               game.kpower[j] = game.kpower[j+1];
-               game.kpower[j+1] = t;
-           }
-    } while (sw);
-}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..2249438
--- /dev/null
@@ -0,0 +1,21 @@
+AM_CFLAGS = -Wall -Wimplicit -Wunused -Wmissing-prototypes \
+    -Wuninitialized -fno-inline -O1 -DDATA_DIR=\"$(pkgdatadir)\" @CFLAGS@
+
+bin_PROGRAMS = sst
+
+sst_SOURCES = \
+       ai.c \
+       battle.c \
+       events.c \
+       finish.c \
+       moving.c \
+       planets.c \
+       reports.c \
+       setup.c \
+       sst.c \
+       io.c \
+       sstlinux.c
+
+EXTRA_DIST = \
+       sst.h \
+       sstlinux.h
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644 (file)
index 0000000..95a9820
--- /dev/null
@@ -0,0 +1,472 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = sst$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(srcdir)/config.h.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+       $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
+       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+       $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_sst_OBJECTS = ai.$(OBJEXT) battle.$(OBJEXT) events.$(OBJEXT) \
+       finish.$(OBJEXT) moving.$(OBJEXT) planets.$(OBJEXT) \
+       reports.$(OBJEXT) setup.$(OBJEXT) sst.$(OBJEXT) io.$(OBJEXT) \
+       sstlinux.$(OBJEXT)
+sst_OBJECTS = $(am_sst_OBJECTS)
+sst_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(sst_SOURCES)
+DIST_SOURCES = $(sst_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GMSGFMT = @GMSGFMT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSUB = @POSUB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_ct_have_python = @ac_ct_have_python@
+ac_ct_have_xmlto = @ac_ct_have_xmlto@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+have_python = @have_python@
+have_xmlto = @have_xmlto@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AM_CFLAGS = -Wall -Wimplicit -Wunused -Wmissing-prototypes \
+    -Wuninitialized -fno-inline -O1 -DDATA_DIR=\"$(pkgdatadir)\" @CFLAGS@
+
+sst_SOURCES = \
+       ai.c \
+       battle.c \
+       events.c \
+       finish.c \
+       moving.c \
+       planets.c \
+       reports.c \
+       setup.c \
+       sst.c \
+       io.c \
+       sstlinux.c
+
+EXTRA_DIST = \
+       sst.h \
+       sstlinux.h
+
+all: config.h
+       $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+config.h: stamp-h1
+       @if test ! -f $@; then \
+         rm -f stamp-h1; \
+         $(MAKE) stamp-h1; \
+       else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+       @rm -f stamp-h1
+       cd $(top_builddir) && $(SHELL) ./config.status src/config.h
+$(srcdir)/config.h.in:  $(am__configure_deps) 
+       cd $(top_srcdir) && $(AUTOHEADER)
+       rm -f stamp-h1
+       touch $@
+
+distclean-hdr:
+       -rm -f config.h stamp-h1
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(bindir)/$$f"; \
+       done
+
+clean-binPROGRAMS:
+       -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+sst$(EXEEXT): $(sst_OBJECTS) $(sst_DEPENDENCIES) 
+       @rm -f sst$(EXEEXT)
+       $(LINK) $(sst_LDFLAGS) $(sst_OBJECTS) $(sst_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/battle.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/events.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/finish.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moving.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/planets.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reports.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sst.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sstlinux.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) config.h
+installdirs:
+       for dir in "$(DESTDIR)$(bindir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-hdr distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+       clean-generic ctags distclean distclean-compile \
+       distclean-generic distclean-hdr distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-binPROGRAMS install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-binPROGRAMS \
+       uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/ai.c b/src/ai.c
new file mode 100644 (file)
index 0000000..a1b4bbf
--- /dev/null
+++ b/src/ai.c
@@ -0,0 +1,615 @@
+#include "sst.h"
+
+static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) 
+{
+    int iqx, iqy, l;
+
+    iqx = quadx+(lookx+(QUADSIZE-1))/QUADSIZE - 1;
+    iqy = quady+(looky+(QUADSIZE-1))/QUADSIZE - 1;
+    if (!VALID_QUADRANT(iqx,iqy) ||
+       game.state.galaxy[iqx][iqy].supernova ||
+       game.state.galaxy[iqx][iqy].klingons > 8)
+       return 0; /* no can do -- neg energy, supernovae, or >8 Klingons */
+    if (ienm == IHR) return 0; /* Romulans cannot escape! */
+    if (irun == 0) {
+       /* avoid intruding on another commander's territory */
+       if (ienm == IHC) {
+           for_commanders(l)
+               if (game.state.cx[l]==iqx && game.state.cy[l]==iqy) return 0;
+           /* refuse to leave if currently attacking starbase */
+           if (batx==quadx && baty==quady) return 0;
+       }
+       /* don't leave if over 1000 units of energy */
+       if (game.kpower[loccom] > 1000.) return 0;
+    }
+    /* print escape message and move out of quadrant.
+       We know this if either short or long range sensors are working */
+    if (game.damage[DSRSENS] == 0.0 || game.damage[DLRSENS] == 0.0 ||
+       condit == IHDOCKED) {
+       crmena(1, ienm, 2, game.kx[loccom], game.ky[loccom]);
+       prout(" escapes to %s (and regains strength).",
+             cramlc(quadrant, iqx, iqy));
+    }
+    /* handle local matters related to escape */
+    game.quad[game.kx[loccom]][game.ky[loccom]] = IHDOT;
+    game.kx[loccom] = game.kx[nenhere];
+    game.ky[loccom] = game.ky[nenhere];
+    game.kavgd[loccom] = game.kavgd[nenhere];
+    game.kpower[loccom] = game.kpower[nenhere];
+    game.kdist[loccom] = game.kdist[nenhere];
+    klhere--;
+    nenhere--;
+    if (condit != IHDOCKED) newcnd();
+    /* Handle global matters related to escape */
+    game.state.galaxy[quadx][quady].klingons--;
+    game.state.galaxy[iqx][iqy].klingons++;
+    if (ienm==IHS) {
+       ishere=0;
+       iscate=0;
+       ientesc=0;
+       isatb=0;
+       game.future[FSCMOVE]=0.2777+game.state.date;
+       game.future[FSCDBAS]=FOREVER;
+       game.state.isx=iqx;
+       game.state.isy=iqy;
+    }
+    else {
+       for_commanders(l) {
+           if (game.state.cx[l]==quadx && game.state.cy[l]==quady) {
+               game.state.cx[l]=iqx;
+               game.state.cy[l]=iqy;
+               break;
+           }
+       }
+       comhere = 0;
+    }
+    return 1; /* success */
+}
+
+
+static void movebaddy(int comx, int comy, int loccom, int ienm) 
+{
+    int motion, mdist, nsteps, mx, my, nextx, nexty, lookx, looky, ll;
+    int irun = 0;
+    int krawlx, krawly;
+    int success;
+    int attempts;
+    /* This should probably be just comhere + ishere */
+    int nbaddys = skill >= SKILL_EXPERT ?
+       (int)((comhere*2 + ishere*2+klhere*1.23+irhere*1.5)/2.0):
+       (comhere + ishere);
+    double dist1, forces;
+
+    dist1 = game.kdist[loccom];
+    mdist = dist1 + 0.5; /* Nearest integer distance */
+
+    /* If SC, check with spy to see if should hi-tail it */
+    if (ienm==IHS &&
+       (game.kpower[loccom] <= 500.0 || (condit==IHDOCKED && game.damage[DPHOTON]==0))) {
+       irun = 1;
+       motion = -QUADSIZE;
+    }
+    else {
+       /* decide whether to advance, retreat, or hold position */
+/* Algorithm:
+ * Enterprise has "force" based on condition of phaser and photon torpedoes.
+ If both are operating full strength, force is 1000. If both are damaged,
+ force is -1000. Having shields down subtracts an additional 1000.
+
+ * Enemy has forces equal to the energy of the attacker plus
+ 100*(K+R) + 500*(C+S) - 400 for novice through good levels OR
+ 346*K + 400*R + 500*(C+S) - 400 for expert and emeritus.
+
+ Attacker Initial energy levels (nominal):
+ Klingon   Romulan   Commander   Super-Commander
+ Novice    400        700        1200        
+ Fair      425        750        1250
+ Good      450        800        1300        1750
+ Expert    475        850        1350        1875
+ Emeritus  500        900        1400        2000
+ VARIANCE   75        200         200         200
+
+ Enemy vessels only move prior to their attack. In Novice - Good games
+ only commanders move. In Expert games, all enemy vessels move if there
+ is a commander present. In Emeritus games all enemy vessels move.
+
+ *  If Enterprise is not docked, an agressive action is taken if enemy
+ forces are 1000 greater than Enterprise.
+
+ Agressive action on average cuts the distance between the ship and
+ the enemy to 1/4 the original.
+
+ *  At lower energy advantage, movement units are proportional to the
+ advantage with a 650 advantage being to hold ground, 800 to move forward
+ 1, 950 for two, 150 for back 4, etc. Variance of 100.
+
+ If docked, is reduced by roughly 1.75*skill, generally forcing a
+ retreat, especially at high skill levels.
+
+ *  Motion is limited to skill level, except for SC hi-tailing it out.
+ */
+
+       forces = game.kpower[loccom]+100.0*nenhere+400*(nbaddys-1);
+       if (shldup==0) forces += 1000; /* Good for enemy if shield is down! */
+       if (game.damage[DPHASER] == 0.0 || game.damage[DPHOTON] == 0.0) {
+           if (game.damage[DPHASER] != 0) /* phasers damaged */
+               forces += 300.0;
+           else
+               forces -= 0.2*(energy - 2500.0);
+           if (game.damage[DPHOTON] != 0) /* photon torpedoes damaged */
+               forces += 300.0;
+           else
+               forces -= 50.0*torps;
+       }
+       else {
+           /* phasers and photon tubes both out! */
+           forces += 1000.0;
+       }
+       motion = 0;
+       if (forces <= 1000.0 && condit != IHDOCKED) /* Typical situation */
+           motion = ((forces+200.0*Rand())/150.0) - 5.0;
+       else {
+           if (forces > 1000.0) /* Very strong -- move in for kill */
+               motion = (1.0-square(Rand()))*dist1 + 1.0;
+           if (condit==IHDOCKED && (game.options & OPTION_BASE)) /* protected by base -- back off ! */
+               motion -= skill*(2.0-square(Rand()));
+       }
+#ifdef DEBUG
+       if (idebug) {
+           proutn("MOTION = %1.2f", motion);
+           proutn("  FORCES = %1,2f", forces);
+       }
+#endif
+       /* don't move if no motion */
+       if (motion==0) return;
+       /* Limit motion according to skill */
+       if (abs(motion) > skill) motion = (motion < 0) ? -skill : skill;
+    }
+    /* calculate preferred number of steps */
+    nsteps = motion < 0 ? -motion : motion;
+    if (motion > 0 && nsteps > mdist) nsteps = mdist; /* don't overshoot */
+    if (nsteps > QUADSIZE) nsteps = QUADSIZE; /* This shouldn't be necessary */
+    if (nsteps < 1) nsteps = 1; /* This shouldn't be necessary */
+#ifdef DEBUG
+    if (idebug) {
+       prout("NSTEPS = %d", nsteps);
+    }
+#endif
+    /* Compute preferred values of delta X and Y */
+    mx = sectx - comx;
+    my = secty - comy;
+    if (2.0 * abs(mx) < abs(my)) mx = 0;
+    if (2.0 * abs(my) < abs(sectx-comx)) my = 0;
+    if (mx != 0) mx = mx*motion < 0 ? -1 : 1;
+    if (my != 0) my = my*motion < 0 ? -1 : 1;
+    nextx = comx;
+    nexty = comy;
+    /* main move loop */
+    for (ll = 0; ll < nsteps; ll++) {
+#ifdef DEBUG
+       if (idebug) {
+           prout("%d", ll+1);
+       }
+#endif
+       /* Check if preferred position available */
+       lookx = nextx + mx;
+       looky = nexty + my;
+       krawlx = mx < 0 ? 1 : -1;
+       krawly = my < 0 ? 1 : -1;
+       success = 0;
+       attempts = 0; /* Settle mysterious hang problem */
+       while (attempts++ < 20 && !success) {
+           if (lookx < 1 || lookx > QUADSIZE) {
+               if (motion < 0 && tryexit(lookx, looky, ienm, loccom, irun))
+                   return;
+               if (krawlx == mx || my == 0) break;
+               lookx = nextx + krawlx;
+               krawlx = -krawlx;
+           }
+           else if (looky < 1 || looky > QUADSIZE) {
+               if (motion < 0 && tryexit(lookx, looky, ienm, loccom, irun))
+                   return;
+               if (krawly == my || mx == 0) break;
+               looky = nexty + krawly;
+               krawly = -krawly;
+           }
+           else if ((game.options & OPTION_RAMMING) && game.quad[lookx][looky] != IHDOT) {
+               /* See if we should ram ship */
+               if (game.quad[lookx][looky] == ship &&
+                   (ienm == IHC || ienm == IHS)) {
+                   ram(1, ienm, comx, comy);
+                   return;
+               }
+               if (krawlx != mx && my != 0) {
+                   lookx = nextx + krawlx;
+                   krawlx = -krawlx;
+               }
+               else if (krawly != my && mx != 0) {
+                   looky = nexty + krawly;
+                   krawly = -krawly;
+               }
+               else break; /* we have failed */
+           }
+           else success = 1;
+       }
+       if (success) {
+           nextx = lookx;
+           nexty = looky;
+#ifdef DEBUG
+           if (idebug) {
+               prout(cramlc(neither, nextx, nexty));
+           }
+#endif
+       }
+       else break; /* done early */
+    }
+    /* Put commander in place within same quadrant */
+    game.quad[comx][comy] = IHDOT;
+    game.quad[nextx][nexty] = ienm;
+    if (nextx != comx || nexty != comy) {
+       /* it moved */
+       game.kx[loccom] = nextx;
+       game.ky[loccom] = nexty;
+       game.kdist[loccom] = game.kavgd[loccom] =
+           sqrt(square(sectx-nextx)+square(secty-nexty));
+       if (game.damage[DSRSENS] == 0 || condit == IHDOCKED) {
+           proutn("***");
+           cramen(ienm);
+           proutn(" from %s", cramlc(2, comx, comy));
+           if (game.kdist[loccom] < dist1) proutn(" advances to ");
+           else proutn(" retreats to ");
+           prout(cramlc(sector, nextx, nexty));
+       }
+    }
+}
+
+void movcom(void) 
+{
+    int ix, iy, i;
+
+#ifdef DEBUG
+    if (idebug) prout("MOVCOM");
+#endif
+
+    /* Figure out which Klingon is the commander (or Supercommander)
+       and do move */
+    if (comhere) 
+       for_local_enemies(i) {
+           ix = game.kx[i];
+           iy = game.ky[i];
+           if (game.quad[ix][iy] == IHC) {
+               movebaddy(ix, iy, i, IHC);
+               break;
+           }
+       }
+    if (ishere) 
+       for_local_enemies(i) {
+           ix = game.kx[i];
+           iy = game.ky[i];
+           if (game.quad[ix][iy] == IHS) {
+               movebaddy(ix, iy, i, IHS);
+               break;
+           }
+       }
+    /* if skill level is high, move other Klingons and Romulans too!
+       Move these last so they can base their actions on what the
+       commander(s) do. */
+    if (skill >= SKILL_EXPERT && (game.options & OPTION_MVBADDY)) 
+       for_local_enemies(i) {
+           ix = game.kx[i];
+           iy = game.ky[i];
+           if (game.quad[ix][iy] == IHK || game.quad[ix][iy] == IHR)
+               movebaddy(ix, iy, i, game.quad[ix][iy]);
+       }
+
+    sortkl();
+}
+
+static int movescom(int iqx, int iqy, int flag, int *ipage) 
+{
+    int i;
+
+    if ((iqx==quadx && iqy==quady) ||
+       !VALID_QUADRANT(iqx, iqy) ||
+       game.state.galaxy[iqx][iqy].supernova ||
+       game.state.galaxy[iqx][iqy].klingons > 8) 
+       return 1;
+    if (flag) {
+       /* Avoid quadrants with bases if we want to avoid Enterprise */
+       for_starbases(i)
+           if (game.state.baseqx[i]==iqx && game.state.baseqy[i]==iqy) return 1;
+    }
+    if (justin && !iscate) return 1;
+    /* do the move */
+    game.state.galaxy[game.state.isx][game.state.isy].klingons--;
+    game.state.isx = iqx;
+    game.state.isy = iqy;
+    game.state.galaxy[game.state.isx][game.state.isy].klingons++;
+    if (ishere) {
+       /* SC has scooted, Remove him from current quadrant */
+       iscate=0;
+       isatb=0;
+       ishere=0;
+       ientesc=0;
+       game.future[FSCDBAS]=FOREVER;
+       for_local_enemies(i) 
+           if (game.quad[game.kx[i]][game.ky[i]] == IHS) break;
+       game.quad[game.kx[i]][game.ky[i]] = IHDOT;
+       game.kx[i] = game.kx[nenhere];
+       game.ky[i] = game.ky[nenhere];
+       game.kdist[i] = game.kdist[nenhere];
+       game.kavgd[i] = game.kavgd[nenhere];
+       game.kpower[i] = game.kpower[nenhere];
+       klhere--;
+       nenhere--;
+       if (condit!=IHDOCKED) newcnd();
+       sortkl();
+    }
+    /* check for a helpful planet */
+    for (i = 0; i < inplan; i++) {
+       if (game.state.plnets[i].x==game.state.isx && game.state.plnets[i].y==game.state.isy &&
+           game.state.plnets[i].crystals == 1) {
+           /* destroy the planet */
+           DESTROY(&game.state.plnets[i]);
+           game.state.galaxy[game.state.isx][game.state.isy].planets -= 1;
+           if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED) {
+               if (*ipage==0) pause_game(1);
+               *ipage = 1;
+               prout("Lt. Uhura-  \"Captain, Starfleet Intelligence reports");
+               proutn("   a planet in ");
+               proutn(cramlc(quadrant, game.state.isx, game.state.isy));
+               prout(" has been destroyed");
+               prout("   by the Super-commander.\"");
+           }
+           break;
+       }
+    }
+    return 0; /* looks good! */
+}
+                       
+void scom(int *ipage)
+{
+    int i, i2, j, ideltax, ideltay, ibqx, ibqy, sx, sy, ifindit, iwhichb;
+    int iqx, iqy;
+    int basetbl[BASEMAX+1];
+    double bdist[BASEMAX+1];
+    int flag;
+#ifdef DEBUG
+    if (idebug) prout("SCOM");
+#endif
+
+    /* Decide on being active or passive */
+    flag = ((NKILLC+NKILLK)/(game.state.date+0.01-indate) < 0.1*skill*(skill+1.0) ||
+           (game.state.date-indate) < 3.0);
+    if (iscate==0 && flag) {
+       /* compute move away from Enterprise */
+       ideltax = game.state.isx-quadx;
+       ideltay = game.state.isy-quady;
+       if (sqrt(ideltax*(double)ideltax+ideltay*(double)ideltay) > 2.0) {
+           /* circulate in space */
+           ideltax = game.state.isy-quady;
+           ideltay = quadx-game.state.isx;
+       }
+    }
+    else {
+       /* compute distances to starbases */
+       if (game.state.rembase <= 0) {
+           /* nothing left to do */
+           game.future[FSCMOVE] = FOREVER;
+           return;
+       }
+       sx = game.state.isx;
+       sy = game.state.isy;
+       for_starbases(i) {
+           basetbl[i] = i;
+           ibqx = game.state.baseqx[i];
+           ibqy = game.state.baseqy[i];
+           bdist[i] = sqrt(square(ibqx-sx) + square(ibqy-sy));
+       }
+       if (game.state.rembase > 1) {
+           /* sort into nearest first order */
+           int iswitch;
+           do {
+               iswitch = 0;
+               for (i=1; i < game.state.rembase-1; i++) {
+                   if (bdist[i] > bdist[i+1]) {
+                       int ti = basetbl[i];
+                       double t = bdist[i];
+                       bdist[i] = bdist[i+1];
+                       bdist[i+1] = t;
+                       basetbl[i] = basetbl[i+1];
+                       basetbl[i+1] =ti;
+                       iswitch = 1;
+                   }
+               }
+           } while (iswitch);
+       }
+       /* look for nearest base without a commander, no Enterprise, and
+          without too many Klingons, and not already under attack. */
+       ifindit = iwhichb = 0;
+
+       for_starbases(i2) {
+           i = basetbl[i2];    /* bug in original had it not finding nearest*/
+           ibqx = game.state.baseqx[i];
+           ibqy = game.state.baseqy[i];
+           if ((ibqx == quadx && ibqy == quady) ||
+               (ibqx == batx && ibqy == baty) ||
+               game.state.galaxy[ibqx][ibqy].supernova ||
+               game.state.galaxy[ibqx][ibqy].klingons > 8) 
+               continue;
+           /* if there is a commander, an no other base is appropriate,
+              we will take the one with the commander */
+           for_commanders (j) {
+               if (ibqx==game.state.cx[j] && ibqy==game.state.cy[j] && ifindit!= 2) {
+                   ifindit = 2;
+                   iwhichb = i;
+                   break;
+               }
+           }
+           if (j > game.state.remcom) { /* no commander -- use this one */
+               ifindit = 1;
+               iwhichb = i;
+               break;
+           }
+       }
+       if (ifindit==0) return; /* Nothing suitable -- wait until next time*/
+       ibqx = game.state.baseqx[iwhichb];
+       ibqy = game.state.baseqy[iwhichb];
+       /* decide how to move toward base */
+       ideltax = ibqx - game.state.isx;
+       ideltay = ibqy - game.state.isy;
+    }
+    /* Maximum movement is 1 quadrant in either or both axis */
+    if (ideltax > 1) ideltax = 1;
+    if (ideltax < -1) ideltax = -1;
+    if (ideltay > 1) ideltay = 1;
+    if (ideltay < -1) ideltay = -1;
+
+    /* try moving in both x and y directions */
+    iqx = game.state.isx + ideltax;
+    iqy = game.state.isy + ideltax;
+    if (movescom(iqx, iqy, flag, ipage)) {
+       /* failed -- try some other maneuvers */
+       if (ideltax==0 || ideltay==0) {
+           /* attempt angle move */
+           if (ideltax != 0) {
+               iqy = game.state.isy + 1;
+               if (movescom(iqx, iqy, flag, ipage)) {
+                   iqy = game.state.isy - 1;
+                   movescom(iqx, iqy, flag, ipage);
+               }
+           }
+           else {
+               iqx = game.state.isx + 1;
+               if (movescom(iqx, iqy, flag, ipage)) {
+                   iqx = game.state.isx - 1;
+                   movescom(iqx, iqy, flag, ipage);
+               }
+           }
+       }
+       else {
+           /* try moving just in x or y */
+           iqy = game.state.isy;
+           if (movescom(iqx, iqy, flag, ipage)) {
+               iqy = game.state.isy + ideltay;
+               iqx = game.state.isx;
+               movescom(iqx, iqy, flag, ipage);
+           }
+       }
+    }
+    /* check for a base */
+    if (game.state.rembase == 0) {
+       game.future[FSCMOVE] = FOREVER;
+    }
+    else for_starbases(i) {
+       ibqx = game.state.baseqx[i];
+       ibqy = game.state.baseqy[i];
+       if (ibqx==game.state.isx && ibqy == game.state.isy && game.state.isx != batx && game.state.isy != baty) {
+           /* attack the base */
+           if (flag) return; /* no, don't attack base! */
+           iseenit = 0;
+           isatb=1;
+           game.future[FSCDBAS] = game.state.date + 1.0 +2.0*Rand();
+           if (game.future[FCDBAS] < FOREVER) game.future[FSCDBAS] +=
+               game.future[FCDBAS]-game.state.date;
+           if (game.damage[DRADIO] > 0 && condit != IHDOCKED)
+               return; /* no warning */
+           iseenit = 1;
+           if (*ipage == 0)  pause_game(1);
+           *ipage=1;
+           proutn("Lt. Uhura-  \"Captain, the starbase in ");
+           proutn(cramlc(quadrant, game.state.isx, game.state.isy));
+           skip(1);
+           prout("   reports that it is under attack from the Klingon Super-commander.");
+           proutn("   It can survive until stardate %d.\"",
+                  (int)game.future[FSCDBAS]);
+           if (resting==0) return;
+           prout("Mr. Spock-  \"Captain, shall we cancel the rest period?\"");
+           if (ja()==0) return;
+           resting = 0;
+           Time = 0.0; /* actually finished */
+           return;
+       }
+    }
+    /* Check for intelligence report */
+    if (
+#ifdef DEBUG
+       idebug==0 &&
+#endif
+       (Rand() > 0.2 ||
+        (game.damage[DRADIO] > 0.0 && condit != IHDOCKED) ||
+        !game.state.galaxy[game.state.isx][game.state.isy].charted))
+       return;
+    if (*ipage==0) pause_game(1);
+    *ipage = 1;
+    prout("Lt. Uhura-  \"Captain, Starfleet Intelligence reports");
+    proutn("   the Super-commander is in ");
+    proutn(cramlc(quadrant, game.state.isx, game.state. isy));
+    prout(".\"");
+    return;
+}
+
+void movetho(void)
+{
+    int idx, idy, im, i, dum, my;
+    /* Move the Tholian */
+    if (ithere==0 || justin == 1) return;
+
+    if (ithx == 1 && ithy == 1) {
+       idx = 1; idy = QUADSIZE;
+    }
+    else if (ithx == 1 && ithy == QUADSIZE) {
+       idx = QUADSIZE; idy = QUADSIZE;
+    }
+    else if (ithx == QUADSIZE && ithy == QUADSIZE) {
+       idx = QUADSIZE; idy = 1;
+    }
+    else if (ithx == QUADSIZE && ithy == 1) {
+       idx = 1; idy = 1;
+    }
+    else {
+       /* something is wrong! */
+       ithere = 0;
+       return;
+    }
+
+    /* Do nothing if we are blocked */
+    if (game.quad[idx][idy]!= IHDOT && game.quad[idx][idy]!= IHWEB) return;
+    game.quad[ithx][ithy] = IHWEB;
+
+    if (ithx != idx) {
+       /* move in x axis */
+       im = fabs((double)idx - ithx)/((double)idx - ithx);
+       while (ithx != idx) {
+           ithx += im;
+           if (game.quad[ithx][ithy]==IHDOT) game.quad[ithx][ithy] = IHWEB;
+       }
+    }
+    else if (ithy != idy) {
+       /* move in y axis */
+       im = fabs((double)idy - ithy)/((double)idy - ithy);
+       while (ithy != idy) {
+           ithy += im;
+           if (game.quad[ithx][ithy]==IHDOT) game.quad[ithx][ithy] = IHWEB;
+       }
+    }
+    game.quad[ithx][ithy] = IHT;
+    game.kx[nenhere]=ithx;
+    game.ky[nenhere]=ithy;
+
+    /* check to see if all holes plugged */
+    for_sectors(i) {
+       if (game.quad[1][i]!=IHWEB && game.quad[1][i]!=IHT) return;
+       if (game.quad[QUADSIZE][i]!=IHWEB && game.quad[QUADSIZE][i]!=IHT) return;
+       if (game.quad[i][1]!=IHWEB && game.quad[i][1]!=IHT) return;
+       if (game.quad[i][QUADSIZE]!=IHWEB && game.quad[i][QUADSIZE]!=IHT) return;
+    }
+    /* All plugged up -- Tholian splits */
+    game.quad[ithx][ithy]=IHWEB;
+    dropin(IHBLANK, &dum, &my);
+    crmena(1,IHT, 2, ithx, ithy);
+    prout(" completes web.");
+    ithere = ithx = ithy = 0;
+    nenhere--;
+    return;
+}
diff --git a/src/battle.c b/src/battle.c
new file mode 100644 (file)
index 0000000..374b382
--- /dev/null
@@ -0,0 +1,1225 @@
+#include "sst.h"
+
+void doshield(int i) 
+{
+    int key;
+    enum {NONE, SHUP, SHDN, NRG} action = NONE;
+
+    ididit = 0;
+
+    if (i == 2) action = SHUP;
+    else {
+       key = scan();
+       if (key == IHALPHA) {
+           if (isit("transfer"))
+               action = NRG;
+           else {
+               chew();
+               if (game.damage[DSHIELD]) {
+                   prout("Shields damaged and down.");
+                   return;
+               }
+               if (isit("up"))
+                   action = SHUP;
+               else if (isit("down"))
+                   action = SHDN;
+           }
+       }
+       if (action==NONE) {
+           proutn("Do you wish to change shield energy? ");
+           if (ja()) {
+               proutn("Energy to transfer to shields- ");
+               action = NRG;
+           }
+           else if (game.damage[DSHIELD]) {
+               prout("Shields damaged and down.");
+               return;
+           }
+           else if (shldup) {
+               proutn("Shields are up. Do you want them down? ");
+               if (ja()) action = SHDN;
+               else {
+                   chew();
+                   return;
+               }
+           }
+           else {
+               proutn("Shields are down. Do you want them up? ");
+               if (ja()) action = SHUP;
+               else {
+                   chew();
+                   return;
+               }
+           }
+       }
+    }
+    switch (action) {
+    case SHUP: /* raise shields */
+       if (shldup) {
+           prout("Shields already up.");
+           return;
+       }
+       shldup = 1;
+       shldchg = 1;
+       if (condit != IHDOCKED) energy -= 50.0;
+       prout("Shields raised.");
+       if (energy <= 0) {
+           skip(1);
+           prout("Shields raising uses up last of energy.");
+           finish(FNRG);
+           return;
+       }
+       ididit=1;
+       return;
+    case SHDN:
+       if (shldup==0) {
+           prout("Shields already down.");
+           return;
+       }
+       shldup=0;
+       shldchg=1;
+       prout("Shields lowered.");
+       ididit=1;
+       return;
+    case NRG:
+       while (scan() != IHREAL) {
+           chew();
+           proutn("Energy to transfer to shields- ");
+       }
+       chew();
+       if (aaitem==0) return;
+       if (aaitem > energy) {
+           prout("Insufficient ship energy.");
+           return;
+       }
+       ididit = 1;
+       if (shield+aaitem >= inshld) {
+           prout("Shield energy maximized.");
+           if (shield+aaitem > inshld) {
+               prout("Excess energy requested returned to ship energy");
+           }
+           energy -= inshld-shield;
+           shield = inshld;
+           return;
+       }
+       if (aaitem < 0.0 && energy-aaitem > inenrg) {
+           /* Prevent shield drain loophole */
+           skip(1);
+           prout("Engineering to bridge--");
+           prout("  Scott here. Power circuit problem, Captain.");
+           prout("  I can't drain the shields.");
+           ididit = 0;
+           return;
+       }
+       if (shield+aaitem < 0) {
+           prout("All shield energy transferred to ship.");
+           energy += shield;
+           shield = 0.0;
+           return;
+       }
+       proutn("Scotty- \"");
+       if (aaitem > 0)
+           prout("Transferring energy to shields.\"");
+       else
+           prout("Draining energy from shields.\"");
+       shield += aaitem;
+       energy -= aaitem;
+       return;
+    case NONE:;        /* avoid gcc warning */
+    }
+}
+
+void ram(int ibumpd, int ienm, int ix, int iy)
+{
+    double type = 1.0, extradm;
+    int icas, l;
+       
+    prouts("***RED ALERT!  RED ALERT!");
+    skip(1);
+    prout("***COLLISION IMMINENT.");
+    skip(2);
+    proutn("***");
+    crmshp();
+    switch (ienm) {
+    case IHR: type = 1.5; break;
+    case IHC: type = 2.0; break;
+    case IHS: type = 2.5; break;
+    case IHT: type = 0.5; break;
+    case IHQUEST: type = 4.0; break;
+    }
+    proutn(ibumpd ? " rammed by " : " rams ");
+    crmena(0, ienm, 2, ix, iy);
+    if (ibumpd) proutn(" (original position)");
+    skip(1);
+    deadkl(ix, iy, ienm, sectx, secty);
+    proutn("***");
+    crmshp();
+    prout(" heavily damaged.");
+    icas = 10.0+20.0*Rand();
+    prout("***Sickbay reports %d casualties", icas);
+    casual += icas;
+    for (l=0; l < NDEVICES; l++) {
+       if (l == DDRAY) 
+           continue; // Don't damage deathray 
+       if (game.damage[l] < 0) 
+           continue;
+       extradm = (10.0*type*Rand()+1.0)*damfac;
+       game.damage[l] += Time + extradm; /* Damage for at least time of travel! */
+    }
+    shldup = 0;
+    if (KLINGREM) {
+       pause_game(2);
+       dreprt();
+    }
+    else finish(FWON);
+    return;
+}
+
+void torpedo(double course, double r, int inx, int iny, double *hit, int i, int n)
+{
+    int l, iquad=0, ix=0, iy=0, jx=0, jy=0, shoved=0, ll;
+       
+    double ac=course + 0.25*r;
+    double angle = (15.0-ac)*0.5235988;
+    double bullseye = (15.0 - course)*0.5235988;
+    double deltax=-sin(angle), deltay=cos(angle), x=inx, y=iny, bigger;
+    double ang, temp, xx, yy, kp, h1;
+
+    bigger = fabs(deltax);
+    if (fabs(deltay) > bigger) bigger = fabs(deltay);
+    deltax /= bigger;
+    deltay /= bigger;
+    if (game.damage[DSRSENS]==0 || condit==IHDOCKED) 
+       setwnd(srscan_window);
+    else 
+       setwnd(message_window);
+    /* Loop to move a single torpedo */
+    for (l=1; l <= 15; l++) {
+       x += deltax;
+       ix = x + 0.5;
+       y += deltay;
+       iy = y + 0.5;
+       if (!VALID_SECTOR(ix, iy)) break;
+       iquad=game.quad[ix][iy];
+       tracktorpedo(ix, iy, l, i, n, iquad);
+       if (iquad==IHDOT) continue;
+       /* hit something */
+       setwnd(message_window);
+       skip(1);        /* start new line after text track */
+       switch(iquad) {
+       case IHE: /* Hit our ship */
+       case IHF:
+           skip(1);
+           proutn("Torpedo hits ");
+           crmshp();
+           prout(".");
+           *hit = 700.0 + 100.0*Rand() -
+               1000.0*sqrt(square(ix-inx)+square(iy-iny))*
+               fabs(sin(bullseye-angle));
+           *hit = fabs(*hit);
+           newcnd(); /* we're blown out of dock */
+           /* We may be displaced. */
+           if (landed==1 || condit==IHDOCKED) return; /* Cheat if on a planet */
+           ang = angle + 2.5*(Rand()-0.5);
+           temp = fabs(sin(ang));
+           if (fabs(cos(ang)) > temp) temp = fabs(cos(ang));
+           xx = -sin(ang)/temp;
+           yy = cos(ang)/temp;
+           jx=ix+xx+0.5;
+           jy=iy+yy+0.5;
+           if (!VALID_SECTOR(jx, jy)) return;
+           if (game.quad[jx][jy]==IHBLANK) {
+               finish(FHOLE);
+               return;
+           }
+           if (game.quad[jx][jy]!=IHDOT) {
+               /* can't move into object */
+               return;
+           }
+           sectx = jx;
+           secty = jy;
+           crmshp();
+           shoved = 1;
+           break;
+                                         
+       case IHC: /* Hit a commander */
+       case IHS:
+           if (Rand() <= 0.05) {
+               crmena(1, iquad, 2, ix, iy);
+               prout(" uses anti-photon device;");
+               prout("   torpedo neutralized.");
+               return;
+           }
+       case IHR: /* Hit a regular enemy */
+       case IHK:
+           /* find the enemy */
+           for_local_enemies(ll)
+               if (ix==game.kx[ll] && iy==game.ky[ll]) break;
+           kp = fabs(game.kpower[ll]);
+           h1 = 700.0 + 100.0*Rand() -
+               1000.0*sqrt(square(ix-inx)+square(iy-iny))*
+               fabs(sin(bullseye-angle));
+           h1 = fabs(h1);
+           if (kp < h1) h1 = kp;
+           game.kpower[ll] -= (game.kpower[ll]<0 ? -h1 : h1);
+           if (game.kpower[ll] == 0) {
+               deadkl(ix, iy, iquad, ix, iy);
+               return;
+           }
+           crmena(1, iquad, 2, ix, iy);
+           /* If enemy damaged but not destroyed, try to displace */
+           ang = angle + 2.5*(Rand()-0.5);
+           temp = fabs(sin(ang));
+           if (fabs(cos(ang)) > temp) temp = fabs(cos(ang));
+           xx = -sin(ang)/temp;
+           yy = cos(ang)/temp;
+           jx=ix+xx+0.5;
+           jy=iy+yy+0.5;
+           if (!VALID_SECTOR(jx, jy)) {
+               prout(" damaged but not destroyed.");
+               return;
+           }
+           if (game.quad[jx][jy]==IHBLANK) {
+               prout(" buffeted into black hole.");
+               deadkl(ix, iy, iquad, jx, jy);
+               return;
+           }
+           if (game.quad[jx][jy]!=IHDOT) {
+               /* can't move into object */
+               prout(" damaged but not destroyed.");
+               return;
+           }
+           proutn(" damaged--");
+           game.kx[ll] = jx;
+           game.ky[ll] = jy;
+           shoved = 1;
+           break;
+       case IHB: /* Hit a base */
+           skip(1);
+           prout("***STARBASE DESTROYED..");
+           for_starbases(ll) {
+               if (game.state.baseqx[ll]==quadx && game.state.baseqy[ll]==quady) {
+                   game.state.baseqx[ll]=game.state.baseqx[game.state.rembase];
+                   game.state.baseqy[ll]=game.state.baseqy[game.state.rembase];
+                   break;
+               }
+           }
+           game.quad[ix][iy]=IHDOT;
+           game.state.rembase--;
+           basex=basey=0;
+           game.state.galaxy[quadx][quady].starbase--;
+           game.state.chart[quadx][quady].starbase--;
+           game.state.basekl++;
+           newcnd();
+           return;
+       case IHP: /* Hit a planet */
+           crmena(1, iquad, 2, ix, iy);
+           prout(" destroyed.");
+           game.state.nplankl++;
+           game.state.galaxy[quadx][quady].planets--;
+           DESTROY(&game.state.plnets[iplnet]);
+           iplnet = 0;
+           plnetx = plnety = 0;
+           game.quad[ix][iy] = IHDOT;
+           if (landed==1) {
+               /* captain perishes on planet */
+               finish(FDPLANET);
+           }
+           return;
+       case IHSTAR: /* Hit a star */
+           if (Rand() > 0.10) {
+               nova(ix, iy);
+               return;
+           }
+           crmena(1, IHSTAR, 2, ix, iy);
+           prout(" unaffected by photon blast.");
+           return;
+       case IHQUEST: /* Hit a thingy */
+           if (!(game.options & OPTION_THINGY) || Rand()>0.7) {
+               skip(1);
+               prouts("AAAAIIIIEEEEEEEEAAAAAAAAUUUUUGGGGGHHHHHHHHHHHH!!!");
+               skip(1);
+               prouts("    HACK!     HACK!    HACK!        *CHOKE!*  ");
+               skip(1);
+               proutn("Mr. Spock-");
+               prouts("  \"Fascinating!\"");
+               skip(1);
+               deadkl(ix, iy, iquad, ix, iy);
+           } else {
+               /*
+                * Stas Sergeev added the possibility that
+                * you can shove the Thingy and piss it off.
+                * It then becomes an enemy and may fire at you.
+                */
+               iqengry=1;
+               shoved=1;
+           }
+           return;
+       case IHBLANK: /* Black hole */
+           skip(1);
+           crmena(1, IHBLANK, 2, ix, iy);
+           prout(" swallows torpedo.");
+           return;
+       case IHWEB: /* hit the web */
+           skip(1);
+           prout("***Torpedo absorbed by Tholian web.");
+           return;
+       case IHT:  /* Hit a Tholian */
+           h1 = 700.0 + 100.0*Rand() -
+               1000.0*sqrt(square(ix-inx)+square(iy-iny))*
+               fabs(sin(bullseye-angle));
+           h1 = fabs(h1);
+           if (h1 >= 600) {
+               game.quad[ix][iy] = IHDOT;
+               ithere = 0;
+               ithx = ithy = 0;
+               deadkl(ix, iy, iquad, ix, iy);
+               return;
+           }
+           skip(1);
+           crmena(1, IHT, 2, ix, iy);
+           if (Rand() > 0.05) {
+               prout(" survives photon blast.");
+               return;
+           }
+           prout(" disappears.");
+           game.quad[ix][iy] = IHWEB;
+           ithere = ithx = ithy = 0;
+           nenhere--;
+           {
+               int dum, my;
+               dropin(IHBLANK, &dum, &my);
+           }
+           return;
+                                       
+       default: /* Problem! */
+           skip(1);
+           proutn("Don't know how to handle collision with ");
+           crmena(1, iquad, 2, ix, iy);
+           skip(1);
+           return;
+       }
+       break;
+    }
+    if(curwnd!=message_window) {
+       setwnd(message_window);
+    }
+    if (shoved) {
+       game.quad[jx][jy]=iquad;
+       game.quad[ix][iy]=IHDOT;
+       prout(" displaced by blast to %s ", cramlc(sector, jx, jy));
+       for_local_enemies(ll)
+           game.kdist[ll] = game.kavgd[ll] = sqrt(square(sectx-game.kx[ll])+square(secty-game.ky[ll]));
+       sortkl();
+       return;
+    }
+    skip(1);
+    prout("Torpedo missed.");
+    return;
+}
+
+static void fry(double hit) 
+{
+    double ncrit, extradm;
+    int ktr=1, l, ll, j, cdam[NDEVICES];
+
+    /* a critical hit occured */
+    if (hit < (275.0-25.0*skill)*(1.0+0.5*Rand())) return;
+
+    ncrit = 1.0 + hit/(500.0+100.0*Rand());
+    proutn("***CRITICAL HIT--");
+    /* Select devices and cause damage */
+    for (l = 0; l < ncrit && 0 < NDEVICES; l++) {
+       do {
+           j = NDEVICES*Rand();
+           /* Cheat to prevent shuttle damage unless on ship */
+       } while 
+             (game.damage[j]<0.0 || (j==DSHUTTL && iscraft!=1) || j==DDRAY);
+       cdam[l] = j;
+       extradm = (hit*damfac)/(ncrit*(75.0+25.0*Rand()));
+       game.damage[j] += extradm;
+       if (l > 0) {
+           for (ll=2; ll<=l && j != cdam[ll-1]; ll++) ;
+           if (ll<=l) continue;
+           ktr += 1;
+           if (ktr==3) skip(1);
+           proutn(" and ");
+       }
+       proutn(device[j]);
+    }
+    prout(" damaged.");
+    if (game.damage[DSHIELD] && shldup) {
+       prout("***Shields knocked down.");
+       shldup=0;
+    }
+}
+
+void attack(int torps_ok) 
+{
+    /* torps_ok == 0 forces use of phasers in an attack */
+    int percent, ihurt=0, l, i=0, jx, jy, iquad, itflag;
+    int atackd = 0, attempt = 0;
+    double hit;
+    double pfac, dustfac, hitmax=0.0, hittot=0.0, chgfac=1.0, r;
+
+    iattak = 1;
+    if (alldone) return;
+#ifdef DEBUG
+    if (idebug) prout("ATTACK!");
+#endif
+
+    if (ithere) movetho();
+
+    if (neutz) { /* The one chance not to be attacked */
+       neutz = 0;
+       return;
+    }
+    if ((((comhere || ishere) && (justin == 0)) || skill == SKILL_EMERITUS)&&(torps_ok!=0)) movcom();
+    if (nenhere==0 || (nenhere==1 && iqhere && iqengry==0)) return;
+    pfac = 1.0/inshld;
+    if (shldchg == 1) chgfac = 0.25+0.5*Rand();
+    skip(1);
+    if (skill <= SKILL_FAIR) i = 2;
+    for_local_enemies(l) {
+       if (game.kpower[l] < 0) continue;       /* too weak to attack */
+       /* compute hit strength and diminsh shield power */
+       r = Rand();
+       /* Increase chance of photon torpedos if docked or enemy energy low */
+       if (condit == IHDOCKED) r *= 0.25;
+       if (game.kpower[l] < 500) r *= 0.25; 
+       jx = game.kx[l];
+       jy = game.ky[l];
+       iquad = game.quad[jx][jy];
+       if (iquad==IHT || (iquad==IHQUEST && !iqengry)) continue;
+       itflag = (iquad == IHK && r > 0.0005) || !torps_ok ||
+           (iquad==IHC && r > 0.015) ||
+           (iquad==IHR && r > 0.3) ||
+           (iquad==IHS && r > 0.07) ||
+           (iquad==IHQUEST && r > 0.05);
+       if (itflag) {
+           /* Enemy uses phasers */
+           if (condit == IHDOCKED) continue; /* Don't waste the effort! */
+           attempt = 1; /* Attempt to attack */
+           dustfac = 0.8+0.05*Rand();
+           hit = game.kpower[l]*pow(dustfac,game.kavgd[l]);
+           game.kpower[l] *= 0.75;
+       }
+       else { /* Enemy used photon torpedo */
+           double course = 1.90985*atan2((double)secty-jy, (double)jx-sectx);
+           hit = 0;
+           proutn("***TORPEDO INCOMING");
+           if (game.damage[DSRSENS] <= 0.0) {
+               proutn(" From ");
+               crmena(0, iquad, i, jx, jy);
+           }
+           attempt = 1;
+           prout("  ");
+           r = (Rand()+Rand())*0.5 -0.5;
+           r += 0.002*game.kpower[l]*r;
+           torpedo(course, r, jx, jy, &hit, 1, 1);
+           if (KLINGREM==0) 
+               finish(FWON); /* Klingons did themselves in! */
+           if (game.state.galaxy[quadx][quady].supernova || alldone) 
+               return; /* Supernova or finished */
+           if (hit == 0) continue;
+       }
+       if (shldup != 0 || shldchg != 0 || condit==IHDOCKED) {
+           /* shields will take hits */
+           double absorb, hitsh, propor = pfac*shield*(condit==IHDOCKED ? 2.1 : 1.0);
+           if(propor < 0.1) propor = 0.1;
+           hitsh = propor*chgfac*hit+1.0;
+           atackd=1;
+           absorb = 0.8*hitsh;
+           if (absorb > shield) absorb = shield;
+           shield -= absorb;
+           hit -= hitsh;
+           if (condit==IHDOCKED) dock(0);
+           if (propor > 0.1 && hit < 0.005*energy) continue;
+       }
+       /* It's a hit -- print out hit size */
+       atackd = 1; /* We weren't going to check casualties, etc. if
+                      shields were down for some strange reason. This
+                      doesn't make any sense, so I've fixed it */
+       ihurt = 1;
+       proutn("%d unit hit", (int)hit);
+       if ((game.damage[DSRSENS] > 0 && itflag) || skill<=SKILL_FAIR) {
+           proutn(" on the ");
+           crmshp();
+       }
+       if (game.damage[DSRSENS] <= 0.0 && itflag) {
+           proutn(" from ");
+           crmena(0, iquad, i, jx, jy);
+       }
+       skip(1);
+       /* Decide if hit is critical */
+       if (hit > hitmax) hitmax = hit;
+       hittot += hit;
+       fry(hit);
+       prout("Hit %g energy %g", hit, energy);
+       energy -= hit;
+       if (condit==IHDOCKED) 
+           dock(0);
+    }
+    if (energy <= 0) {
+       /* Returning home upon your shield, not with it... */
+       finish(FBATTLE);
+       return;
+    }
+    if (attempt == 0 && condit == IHDOCKED)
+       prout("***Enemies decide against attacking your ship.");
+    if (atackd == 0) return;
+    percent = 100.0*pfac*shield+0.5;
+    if (ihurt==0) {
+       /* Shields fully protect ship */
+       proutn("Enemy attack reduces shield strength to ");
+    }
+    else {
+       /* Print message if starship suffered hit(s) */
+       skip(1);
+       proutn("Energy left %2d    shields ", (int)energy);
+       if (shldup) proutn("up ");
+       else if (game.damage[DSHIELD] == 0) proutn("down ");
+       else proutn("damaged, ");
+    }
+    prout("%d%%,   torpedoes left %d", percent, torps);
+    /* Check if anyone was hurt */
+    if (hitmax >= 200 || hittot >= 500) {
+       int icas= hittot*Rand()*0.015;
+       if (icas >= 2) {
+           skip(1);
+           prout("Mc Coy-  \"Sickbay to bridge.  We suffered %d casualties", icas);
+           prout("   in that last attack.\"");
+           casual += icas;
+       }
+    }
+    /* After attack, reset average distance to enemies */
+    for_local_enemies(l)
+       game.kavgd[l] = game.kdist[l];
+    sortkl();
+    return;
+}
+               
+void deadkl(int ix, int iy, int type, int ixx, int iyy) 
+{
+    /* Added ixx and iyy allow enemy to "move" before dying */
+
+    int i,j;
+
+    skip(1);
+    crmena(1, type, 2, ixx, iyy);
+    /* Decide what kind of enemy it is and update approriately */
+    if (type == IHR) {
+       /* chalk up a Romulan */
+       game.state.galaxy[quadx][quady].romulans--;
+       irhere--;
+       game.state.nromrem--;
+    }
+    else if (type == IHT) {
+       /* Killed a Tholian */
+       ithere = 0;
+    }
+    else if (type == IHQUEST) {
+       /* Killed a Thingy */
+       iqhere=iqengry=thingx=thingy=0;
+    }
+    else {
+       /* Some type of a Klingon */
+       game.state.galaxy[quadx][quady].klingons--;
+       klhere--;
+       switch (type) {
+       case IHC:
+           comhere = 0;
+           for_commanders (i)
+               if (game.state.cx[i]==quadx && game.state.cy[i]==quady) break;
+           game.state.cx[i] = game.state.cx[game.state.remcom];
+           game.state.cy[i] = game.state.cy[game.state.remcom];
+           game.state.cx[game.state.remcom] = 0;
+           game.state.cy[game.state.remcom] = 0;
+           game.state.remcom--;
+           game.future[FTBEAM] = FOREVER;
+           if (game.state.remcom != 0)
+               game.future[FTBEAM] = game.state.date + expran(1.0*incom/game.state.remcom);
+           break;
+       case IHK:
+           game.state.remkl--;
+           break;
+       case IHS:
+           game.state.nscrem--;
+           ishere = game.state.isx = game.state.isy = isatb = iscate = 0;
+           game.future[FSCMOVE] = game.future[FSCDBAS] = FOREVER;
+           break;
+       }
+    }
+
+    /* For each kind of enemy, finish message to player */
+    prout(" destroyed.");
+    game.quad[ix][iy] = IHDOT;
+    if (KLINGREM==0) return;
+
+    game.state.remtime = game.state.remres/(game.state.remkl + 4*game.state.remcom);
+
+    /* Remove enemy ship from arrays describing local conditions */
+    if (game.future[FCDBAS] < FOREVER && batx==quadx && baty==quady && type==IHC)
+       game.future[FCDBAS] = FOREVER;
+    for_local_enemies(i)
+       if (game.kx[i]==ix && game.ky[i]==iy) break;
+    nenhere--;
+    if (i <= nenhere)  {
+       for (j=i; j<=nenhere; j++) {
+           game.kx[j] = game.kx[j+1];
+           game.ky[j] = game.ky[j+1];
+           game.kpower[j] = game.kpower[j+1];
+           game.kavgd[j] = game.kdist[j] = game.kdist[j+1];
+       }
+    }
+    game.kx[nenhere+1] = 0;
+    game.ky[nenhere+1] = 0;
+    game.kdist[nenhere+1] = 0;
+    game.kavgd[nenhere+1] = 0;
+    game.kpower[nenhere+1] = 0;
+    return;
+}
+
+static int targetcheck(double x, double y, double *course) 
+{
+    double deltx, delty;
+    /* Return TRUE if target is invalid */
+    if (!VALID_SECTOR(x, y)) {
+       huh();
+       return 1;
+    }
+    deltx = 0.1*(y - secty);
+    delty = 0.1*(sectx - x);
+    if (deltx==0 && delty== 0) {
+       skip(1);
+       prout("Spock-  \"Bridge to sickbay.  Dr. McCoy,");
+       prout("  I recommend an immediate review of");
+       prout("  the Captain's psychological profile.\"");
+       chew();
+       return 1;
+    }
+    *course = 1.90985932*atan2(deltx, delty);
+    return 0;
+}
+
+void photon(void) 
+{
+    double targ[4][3], course[4];
+    double r, dummy;
+    int key, n, i, osuabor;
+
+    ididit = 0;
+
+    if (game.damage[DPHOTON]) {
+       prout("Photon tubes damaged.");
+       chew();
+       return;
+    }
+    if (torps == 0) {
+       prout("No torpedoes left.");
+       chew();
+       return;
+    }
+    key = scan();
+    for (;;) {
+       if (key == IHALPHA) {
+           huh();
+           return;
+       }
+       else if (key == IHEOL) {
+           prout("%d torpedoes left.", torps);
+           proutn("Number of torpedoes to fire- ");
+           key = scan();
+       }
+       else /* key == IHREAL */ {
+           n = aaitem + 0.5;
+           if (n <= 0) { /* abort command */
+               chew();
+               return;
+           }
+           if (n > 3) {
+               chew();
+               prout("Maximum of 3 torpedoes per burst.");
+               key = IHEOL;
+               return;
+           }
+           if (n <= torps) break;
+           chew();
+           key = IHEOL;
+       }
+    }
+    for (i = 1; i <= n; i++) {
+       key = scan();
+       if (i==1 && key == IHEOL) {
+           break;      /* we will try prompting */
+       }
+       if (i==2 && key == IHEOL) {
+           /* direct all torpedoes at one target */
+           while (i <= n) {
+               targ[i][1] = targ[1][1];
+               targ[i][2] = targ[1][2];
+               course[i] = course[1];
+               i++;
+           }
+           break;
+       }
+       if (key != IHREAL) {
+           huh();
+           return;
+       }
+       targ[i][1] = aaitem;
+       key = scan();
+       if (key != IHREAL) {
+           huh();
+           return;
+       }
+       targ[i][2] = aaitem;
+       if (targetcheck(targ[i][1], targ[i][2], &course[i])) return;
+    }
+    chew();
+    if (i == 1 && key == IHEOL) {
+       /* prompt for each one */
+       for (i = 1; i <= n; i++) {
+           proutn("Target sector for torpedo number %d- ", i);
+           key = scan();
+           if (key != IHREAL) {
+               huh();
+               return;
+           }
+           targ[i][1] = aaitem;
+           key = scan();
+           if (key != IHREAL) {
+               huh();
+               return;
+           }
+           targ[i][2] = aaitem;
+           chew();
+           if (targetcheck(targ[i][1], targ[i][2], &course[i])) return;
+       }
+    }
+    ididit = 1;
+    /* Loop for moving <n> torpedoes */
+    osuabor = 0;
+    for (i = 1; i <= n && !osuabor; i++) {
+       if (condit != IHDOCKED) torps--;
+       r = (Rand()+Rand())*0.5 -0.5;
+       if (fabs(r) >= 0.47) {
+           /* misfire! */
+           r = (Rand()+1.2) * r;
+           if (n>1) {
+               prouts("***TORPEDO NUMBER %d MISFIRES", i);
+           }
+           else prouts("***TORPEDO MISFIRES.");
+           skip(1);
+           if (i < n)
+               prout("  Remainder of burst aborted.");
+           osuabor=1;
+           if (Rand() <= 0.2) {
+               prout("***Photon tubes damaged by misfire.");
+               game.damage[DPHOTON] = damfac*(1.0+2.0*Rand());
+               break;
+           }
+       }
+       if (shldup || condit == IHDOCKED) 
+           r *= 1.0 + 0.0001*shield;
+       torpedo(course[i], r, sectx, secty, &dummy, i, n);
+       if (alldone || game.state.galaxy[quadx][quady].supernova)
+           return;
+    }
+    if (KLINGREM==0) finish(FWON);
+}
+
+       
+
+static void overheat(double rpow) 
+{
+    if (rpow > 1500) {
+       double chekbrn = (rpow-1500.)*0.00038;
+       if (Rand() <= chekbrn) {
+           prout("Weapons officer Sulu-  \"Phasers overheated, sir.\"");
+           game.damage[DPHASER] = damfac*(1.0 + Rand()) * (1.0+chekbrn);
+       }
+    }
+}
+
+static int checkshctrl(double rpow) 
+{
+    double hit;
+    int icas;
+       
+    skip(1);
+    if (Rand() < .998) {
+       prout("Shields lowered.");
+       return 0;
+    }
+    /* Something bad has happened */
+    prouts("***RED ALERT!  RED ALERT!");
+    skip(2);
+    hit = rpow*shield/inshld;
+    energy -= rpow+hit*0.8;
+    shield -= hit*0.2;
+    if (energy <= 0.0) {
+       prouts("Sulu-  \"Captain! Shield malf***********************\"");
+       skip(1);
+       stars();
+       finish(FPHASER);
+       return 1;
+    }
+    prouts("Sulu-  \"Captain! Shield malfunction! Phaser fire contained!\"");
+    skip(2);
+    prout("Lt. Uhura-  \"Sir, all decks reporting damage.\"");
+    icas = hit*Rand()*0.012;
+    skip(1);
+    fry(0.8*hit);
+    if (icas) {
+       skip(1);
+       prout("McCoy to bridge- \"Severe radiation burns, Jim.");
+       prout("  %d casualties so far.\"", icas);
+       casual -= icas;
+    }
+    skip(1);
+    prout("Phaser energy dispersed by shields.");
+    prout("Enemy unaffected.");
+    overheat(rpow);
+    return 1;
+}
+       
+
+void phasers(void) 
+{
+    double hits[21], rpow=0, extra, powrem, over, temp;
+    int kz = 0, k=1, i, irec=0; /* Cheating inhibitor */
+    int ifast=0, no=0, ipoop=1, msgflag = 1;
+    enum {NOTSET, MANUAL, FORCEMAN, AUTOMATIC} automode = NOTSET;
+    int key=0;
+
+    skip(1);
+    /* SR sensors and Computer */
+    if (game.damage[DSRSENS]+game.damage[DCOMPTR] > 0) ipoop = 0;
+    if (condit == IHDOCKED) {
+       prout("Phasers can't be fired through base shields.");
+       chew();
+       return;
+    }
+    if (game.damage[DPHASER] != 0) {
+       prout("Phaser control damaged.");
+       chew();
+       return;
+    }
+    if (shldup) {
+       if (game.damage[DSHCTRL]) {
+           prout("High speed shield control damaged.");
+           chew();
+           return;
+       }
+       if (energy <= 200.0) {
+           prout("Insufficient energy to activate high-speed shield control.");
+           chew();
+           return;
+       }
+       prout("Weapons Officer Sulu-  \"High-speed shield control enabled, sir.\"");
+       ifast = 1;
+               
+    }
+    /* Original code so convoluted, I re-did it all */
+    while (automode==NOTSET) {
+       key=scan();
+       if (key == IHALPHA) {
+           if (isit("manual")) {
+               if (nenhere==0) {
+                   prout("There is no enemy present to select.");
+                   chew();
+                   key = IHEOL;
+                   automode=AUTOMATIC;
+               }
+               else {
+                   automode = MANUAL;
+                   key = scan();
+               }
+           }
+           else if (isit("automatic")) {
+               if ((!ipoop) && nenhere != 0) {
+                   automode = FORCEMAN;
+               }
+               else {
+                   if (nenhere==0)
+                       prout("Energy will be expended into space.");
+                   automode = AUTOMATIC;
+                   key = scan();
+               }
+           }
+           else if (isit("no")) {
+               no = 1;
+           }
+           else {
+               huh();
+               return;
+           }
+       }
+       else if (key == IHREAL) {
+           if (nenhere==0) {
+               prout("Energy will be expended into space.");
+               automode = AUTOMATIC;
+           }
+           else if (!ipoop)
+               automode = FORCEMAN;
+           else
+               automode = AUTOMATIC;
+       }
+       else {
+           /* IHEOL */
+           if (nenhere==0) {
+               prout("Energy will be expended into space.");
+               automode = AUTOMATIC;
+           }
+           else if (!ipoop)
+               automode = FORCEMAN;
+           else 
+               proutn("Manual or automatic? ");
+       }
+    }
+                               
+    switch (automode) {
+    case AUTOMATIC:
+       if (key == IHALPHA && isit("no")) {
+           no = 1;
+           key = scan();
+       }
+       if (key != IHREAL && nenhere != 0) {
+           prout("Phasers locked on target. Energy available: %.2f",
+                 ifast?energy-200.0:energy,1,2);
+       }
+       irec=0;
+       do {
+           chew();
+           if (!kz) for_local_enemies(i)
+               irec+=fabs(game.kpower[i])/(PHASEFAC*pow(0.90,game.kdist[i]))*
+                   (1.01+0.05*Rand()) + 1.0;
+           kz=1;
+           proutn("(%d) units required. ", irec);
+           chew();
+           proutn("Units to fire= ");
+           key = scan();
+           if (key!=IHREAL) return;
+           rpow = aaitem;
+           if (rpow > (ifast?energy-200:energy)) {
+               proutn("Energy available= %.2f",
+                      ifast?energy-200:energy);
+               skip(1);
+               key = IHEOL;
+           }
+       } while (rpow > (ifast?energy-200:energy));
+       if (rpow<=0) {
+           /* chicken out */
+           chew();
+           return;
+       }
+       if ((key=scan()) == IHALPHA && isit("no")) {
+           no = 1;
+       }
+       if (ifast) {
+           energy -= 200; /* Go and do it! */
+           if (checkshctrl(rpow)) return;
+       }
+       chew();
+       energy -= rpow;
+       extra = rpow;
+       if (nenhere) {
+           extra = 0.0;
+           powrem = rpow;
+           for_local_enemies(i) {
+               hits[i] = 0.0;
+               if (powrem <= 0) continue;
+               hits[i] = fabs(game.kpower[i])/(PHASEFAC*pow(0.90,game.kdist[i]));
+               over = (0.01 + 0.05*Rand())*hits[i];
+               temp = powrem;
+               powrem -= hits[i] + over;
+               if (powrem <= 0 && temp < hits[i]) hits[i] = temp;
+               if (powrem <= 0) over = 0.0;
+               extra += over;
+           }
+           if (powrem > 0.0) extra += powrem;
+           hittem(hits);
+           ididit=1;
+       }
+       if (extra > 0 && alldone == 0) {
+           if (ithere) {
+               proutn("*** Tholian web absorbs ");
+               if (nenhere>0) proutn("excess ");
+               prout("phaser energy.");
+           }
+           else {
+               prout("%d expended on empty space.", (int)extra);
+           }
+       }
+       break;
+
+    case FORCEMAN:
+       chew();
+       key = IHEOL;
+       if (game.damage[DCOMPTR]!=0)
+           prout("Battle comuter damaged, manual file only.");
+       else {
+           skip(1);
+           prouts("---WORKING---");
+           skip(1);
+           prout("Short-range-sensors-damaged");
+           prout("Insufficient-data-for-automatic-phaser-fire");
+           prout("Manual-fire-must-be-used");
+           skip(1);
+       }
+    case MANUAL:
+       rpow = 0.0;
+       for (k = 1; k <= nenhere;) {
+           int ii = game.kx[k], jj = game.ky[k];
+           int ienm = game.quad[ii][jj];
+           if (msgflag) {
+               proutn("Energy available= %.2f",
+                      energy-.006-(ifast?200:0));
+               skip(1);
+               msgflag = 0;
+               rpow = 0.0;
+           }
+           if (game.damage[DSRSENS] && !(abs(sectx-ii) < 2 && abs(secty-jj) < 2) &&
+               (ienm == IHC || ienm == IHS)) {
+               cramen(ienm);
+               prout(" can't be located without short range scan.");
+               chew();
+               key = IHEOL;
+               hits[k] = 0; /* prevent overflow -- thanks to Alexei Voitenko */
+               k++;
+               continue;
+           }
+           if (key == IHEOL) {
+               chew();
+               if (ipoop && k > kz)
+                   irec=(fabs(game.kpower[k])/(PHASEFAC*pow(0.9,game.kdist[k])))*
+                       (1.01+0.05*Rand()) + 1.0;
+               kz = k;
+               proutn("(");
+               if (game.damage[DCOMPTR]==0) proutn("%d", irec);
+               else proutn("??");
+               proutn(")  ");
+               proutn("units to fire at ");
+               crmena(0, ienm, 2, ii, jj);
+               proutn("-  ");
+               key = scan();
+           }
+           if (key == IHALPHA && isit("no")) {
+               no = 1;
+               key = scan();
+               continue;
+           }
+           if (key == IHALPHA) {
+               huh();
+               return;
+           }
+           if (key == IHEOL) {
+               if (k==1) { /* Let me say I'm baffled by this */
+                   msgflag = 1;
+               }
+               continue;
+           }
+           if (aaitem < 0) {
+               /* abort out */
+               chew();
+               return;
+           }
+           hits[k] = aaitem;
+           rpow += aaitem;
+           /* If total requested is too much, inform and start over */
+                               
+           if (rpow > (ifast?energy-200:energy)) {
+               prout("Available energy exceeded -- try again.");
+               chew();
+               return;
+           }
+           key = scan(); /* scan for next value */
+           k++;
+       }
+       if (rpow == 0.0) {
+           /* zero energy -- abort */
+           chew();
+           return;
+       }
+       if (key == IHALPHA && isit("no")) {
+           no = 1;
+       }
+       energy -= rpow;
+       chew();
+       if (ifast) {
+           energy -= 200.0;
+           if (checkshctrl(rpow)) return;
+       }
+       hittem(hits);
+       ididit=1;
+    case NOTSET:;      /* avoid gcc warning */
+    }
+    /* Say shield raised or malfunction, if necessary */
+    if (alldone) 
+       return;
+    if (ifast) {
+       skip(1);
+       if (no == 0) {
+           if (Rand() >= 0.99) {
+               prout("Sulu-  \"Sir, the high-speed shield control has malfunctioned . . .");
+               prouts("         CLICK   CLICK   POP  . . .");
+               prout(" No  response, sir!");
+               shldup = 0;
+           }
+           else
+               prout("Shields raised.");
+       }
+       else
+           shldup = 0;
+    }
+    overheat(rpow);
+}
+
+void hittem(double *hits) 
+{
+    double kp, kpow, wham, hit, dustfac, kpini;
+    int nenhr2=nenhere, k=1, kk=1, ii, jj, ienm;
+
+    skip(1);
+
+    for (; k <= nenhr2; k++, kk++) {
+       if ((wham = hits[k])==0) continue;
+       dustfac = 0.9 + 0.01*Rand();
+       hit = wham*pow(dustfac,game.kdist[kk]);
+       kpini = game.kpower[kk];
+       kp = fabs(kpini);
+       if (PHASEFAC*hit < kp) kp = PHASEFAC*hit;
+       game.kpower[kk] -= (game.kpower[kk] < 0 ? -kp: kp);
+       kpow = game.kpower[kk];
+       ii = game.kx[kk];
+       jj = game.ky[kk];
+       if (hit > 0.005) {
+           if (game.damage[DSRSENS]==0)
+               boom(ii, jj);
+           proutn("%d unit hit on ", (int)hit);
+       }
+       else
+           proutn("Very small hit on ");
+       ienm = game.quad[ii][jj];
+       if (ienm==IHQUEST) iqengry=1;
+       crmena(0,ienm,2,ii,jj);
+       skip(1);
+       if (kpow == 0) {
+           deadkl(ii, jj, ienm, ii, jj);
+           if (KLINGREM==0) finish(FWON);
+           if (alldone) return;
+           kk--; /* don't do the increment */
+       }
+       else /* decide whether or not to emasculate klingon */
+           if (kpow > 0 && Rand() >= 0.9 &&
+               kpow <= ((0.4 + 0.4*Rand())*kpini)) {
+               prout("***Mr. Spock-  \"Captain, the vessel at ",
+                     cramlc(sector,ii,jj));
+               prout("   has just lost its firepower.\"");
+               game.kpower[kk] = -kpow;
+           }
+    }
+    return;
+}
+
diff --git a/src/config.h.in b/src/config.h.in
new file mode 100644 (file)
index 0000000..7ceb83a
--- /dev/null
@@ -0,0 +1,122 @@
+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+#undef ENABLE_NLS
+
+/* Define to 1 if you have the `atexit' function. */
+#undef HAVE_ATEXIT
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+#undef HAVE_CFLOCALECOPYCURRENT
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+#undef HAVE_CFPREFERENCESCOPYAPPVALUE
+
+/* Define to 1 if you have the <curses.h> header file. */
+#undef HAVE_CURSES_H
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+#undef HAVE_DCGETTEXT
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#undef HAVE_GETTEXT
+
+/* Define if you have the iconv() function. */
+#undef HAVE_ICONV
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `ncurses' library (-lncurses). */
+#undef HAVE_LIBNCURSES
+
+/* Define to 1 if you have the <linux/kd.h> header file. */
+#undef HAVE_LINUX_KD_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#undef HAVE_STRNCASECMP
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
diff --git a/src/events.c b/src/events.c
new file mode 100644 (file)
index 0000000..589a838
--- /dev/null
@@ -0,0 +1,755 @@
+#include "sst.h"
+#include <math.h>
+
+void events(void) 
+{
+    int ictbeam=0, ipage=0, istract=0, line, i=0, j, k, l, ixhold=0, iyhold=0;
+    double fintim = game.state.date + Time, datemin, xtime, repair, yank=0;
+    int radio_was_broken;
+
+#ifdef DEBUG
+    if (idebug) prout("EVENTS");
+#endif
+
+    radio_was_broken = (game.damage[DRADIO] != 0.0);
+
+    for (;;) {
+       /* Select earliest extraneous event, line==0 if no events */
+       line = FSPY;
+       if (alldone) return;
+       datemin = fintim;
+       for (l = 1; l < NEVENTS; l++)
+           if (game.future[l] < datemin) {
+               line = l;
+               datemin = game.future[l];
+           }
+       xtime = datemin-game.state.date;
+       game.state.date = datemin;
+       /* Decrement Federation resources and recompute remaining time */
+       game.state.remres -= (game.state.remkl+4*game.state.remcom)*xtime;
+       game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom);
+       if (game.state.remtime <=0) {
+           finish(FDEPLETE);
+           return;
+       }
+       /* Is life support adequate? */
+       if (game.damage[DLIFSUP] && condit != IHDOCKED) {
+           if (lsupres < xtime && game.damage[DLIFSUP] > lsupres) {
+               finish(FLIFESUP);
+               return;
+           }
+           lsupres -= xtime;
+           if (game.damage[DLIFSUP] <= xtime) lsupres = inlsr;
+       }
+       /* Fix devices */
+       repair = xtime;
+       if (condit == IHDOCKED) repair /= docfac;
+       /* Don't fix Deathray here */
+       for (l=0; l<NDEVICES; l++)
+           if (game.damage[l] > 0.0 && l != DDRAY)
+               game.damage[l] -= (game.damage[l]-repair > 0.0 ? repair : game.damage[l]);
+       /* If radio repaired, update star chart and attack reports */
+       if (radio_was_broken && game.damage[DRADIO] == 0.0) {
+           prout("Lt. Uhura- \"Captain, the sub-space radio is working and");
+           prout("   surveillance reports are coming in.");
+           skip(1);
+           if (iseenit==0) {
+               attakreport(0);
+               iseenit = 1;
+           }
+           rechart();
+           prout("   The star chart is now up to date.\"");
+           skip(1);
+       }
+       /* Cause extraneous event LINE to occur */
+       Time -= xtime;
+       switch (line) {
+       case FSNOVA: /* Supernova */
+           if (ipage==0) pause_game(1);
+           ipage=1;
+           snova(0,0);
+           game.future[FSNOVA] = game.state.date + expran(0.5*intime);
+           if (game.state.galaxy[quadx][quady].supernova) return;
+           break;
+       case FSPY: /* Check with spy to see if S.C. should tractor beam */
+           if (game.state.nscrem == 0 ||
+               ictbeam+istract > 0 ||
+               condit==IHDOCKED || isatb==1 || iscate==1) return;
+           if (ientesc ||
+               (energy < 2000 && torps < 4 && shield < 1250) ||
+               (game.damage[DPHASER]>0 && (game.damage[DPHOTON]>0 || torps < 4)) ||
+               (game.damage[DSHIELD] > 0 &&
+                (energy < 2500 || game.damage[DPHASER] > 0) &&
+                (torps < 5 || game.damage[DPHOTON] > 0))) {
+               /* Tractor-beam her! */
+               istract=1;
+               yank = square(game.state.isx-quadx) + square(game.state.isy-quady);
+               /********* fall through to FTBEAM code ***********/
+           }
+           else return;
+       case FTBEAM: /* Tractor beam */
+           if (line==FTBEAM) {
+               if (game.state.remcom == 0) {
+                   game.future[FTBEAM] = FOREVER;
+                   break;
+               }
+               i = Rand()*game.state.remcom+1.0;
+               yank = square(game.state.cx[i]-quadx) + square(game.state.cy[i]-quady);
+               if (istract || condit == IHDOCKED || yank == 0) {
+                   /* Drats! Have to reschedule */
+                   game.future[FTBEAM] = game.state.date + Time +
+                       expran(1.5*intime/game.state.remcom);
+                   break;
+               }
+           }
+           /* tractor beaming cases merge here */
+           yank = sqrt(yank);
+           if (ipage==0) pause_game(1);
+           ipage=1;
+           Time = (10.0/(7.5*7.5))*yank; /* 7.5 is yank rate (warp 7.5) */
+           ictbeam = 1;
+           skip(1);
+           proutn("***");
+           crmshp();
+           prout(" caught in long range tractor beam--");
+           /* If Kirk & Co. screwing around on planet, handle */
+           atover(1); /* atover(1) is Grab */
+           if (alldone) return;
+           if (icraft == 1) { /* Caught in Galileo? */
+               finish(FSTRACTOR);
+               return;
+           }
+           /* Check to see if shuttle is aboard */
+           if (iscraft==0) {
+               skip(1);
+               if (Rand() > 0.5) {
+                   prout("Galileo, left on the planet surface, is captured");
+                   prout("by aliens and made into a flying McDonald's.");
+                   game.damage[DSHUTTL] = -10;
+                   iscraft = -1;
+               }
+               else {
+                   prout("Galileo, left on the planet surface, is well hidden.");
+               }
+           }
+           if (line==0) {
+               quadx = game.state.isx;
+               quady = game.state.isy;
+           }
+           else {
+               quadx = game.state.cx[i];
+               quady = game.state.cy[i];
+           }
+           iran(QUADSIZE, &sectx, &secty);
+           crmshp();
+           proutn(" is pulled to ");
+           proutn(cramlc(quadrant, quadx, quady));
+           proutn(", ");
+           prout(cramlc(sector, sectx, secty));
+           if (resting) {
+               prout("(Remainder of rest/repair period cancelled.)");
+               resting = 0;
+           }
+           if (shldup==0) {
+               if (game.damage[DSHIELD]==0 && shield > 0) {
+                   doshield(2); /* Shldsup */
+                   shldchg=0;
+               }
+               else prout("(Shields not currently useable.)");
+           }
+           newqad(0);
+           /* Adjust finish time to time of tractor beaming */
+           fintim = game.state.date+Time;
+           attack(0);
+           if (game.state.remcom <= 0) game.future[FTBEAM] = FOREVER;
+           else game.future[FTBEAM] = game.state.date+Time+expran(1.5*intime/game.state.remcom);
+           break;
+       case FSNAP: /* Snapshot of the universe (for time warp) */
+           game.snapsht = game.state;
+           game.state.snap = 1;
+           game.future[FSNAP] = game.state.date + expran(0.5 * intime);
+           break;
+       case FBATTAK: /* Commander attacks starbase */
+           if (game.state.remcom==0 || game.state.rembase==0) {
+               /* no can do */
+               game.future[FBATTAK] = game.future[FCDBAS] = FOREVER;
+               break;
+           }
+           i = 0;
+           for_starbases(j) {
+               for_commanders(k)
+                   if (game.state.baseqx[j]==game.state.cx[k] && game.state.baseqy[j]==game.state.cy[k] &&
+                       (game.state.baseqx[j]!=quadx || game.state.baseqy[j]!=quady) &&
+                       (game.state.baseqx[j]!=game.state.isx || game.state.baseqy[j]!=game.state.isy)) {
+                       i = 1;
+                       break;
+                   }
+               if (i == 1) break;
+           }
+           if (j>game.state.rembase) {
+               /* no match found -- try later */
+               game.future[FBATTAK] = game.state.date + expran(0.3*intime);
+               game.future[FCDBAS] = FOREVER;
+               break;
+           }
+           /* commander + starbase combination found -- launch attack */
+           batx = game.state.baseqx[j];
+           baty = game.state.baseqy[j];
+           game.future[FCDBAS] = game.state.date+1.0+3.0*Rand();
+           if (isatb) /* extra time if SC already attacking */
+               game.future[FCDBAS] += game.future[FSCDBAS]-game.state.date;
+           game.future[FBATTAK] = game.future[FCDBAS] +expran(0.3*intime);
+           iseenit = 0;
+           if (game.damage[DRADIO] != 0.0 &&
+               condit != IHDOCKED) break; /* No warning :-( */
+           iseenit = 1;
+           if (ipage==0) pause_game(1);
+           ipage = 1;
+           skip(1);
+           proutn("Lt. Uhura-  \"Captain, the starbase in ");
+           prout(cramlc(quadrant, batx, baty));
+           prout("   reports that it is under attack and that it can");
+           proutn("   hold out only until stardate %d",
+                  (int)game.future[FCDBAS]);
+           prout(".\"");
+           if (resting) {
+               skip(1);
+               proutn("Mr. Spock-  \"Captain, shall we cancel the rest period?\" ");
+               if (ja()) {
+                   resting = 0;
+                   Time = 0.0;
+                   return;
+               }
+           }
+           break;
+       case FSCDBAS: /* Supercommander destroys base */
+           game.future[FSCDBAS] = FOREVER;
+           isatb = 2;
+           if (!game.state.galaxy[game.state.isx][game.state.isy].starbase) 
+               break; /* WAS RETURN! */
+           ixhold = batx;
+           iyhold = baty;
+           batx = game.state.isx;
+           baty = game.state.isy;
+       case FCDBAS: /* Commander succeeds in destroying base */
+           if (line==FCDBAS) {
+               game.future[FCDBAS] = FOREVER;
+               /* find the lucky pair */
+               for_commanders(i)
+                   if (game.state.cx[i]==batx && game.state.cy[i]==baty) 
+                       break;
+               if (i > game.state.remcom || game.state.rembase == 0 ||
+                   !game.state.galaxy[batx][baty].starbase) {
+                   /* No action to take after all */
+                   batx = baty = 0;
+                   break;
+               }
+           }
+           /* Code merges here for any commander destroying base */
+           /* Not perfect, but will have to do */
+           /* Handle case where base is in same quadrant as starship */
+           if (batx==quadx && baty==quady) {
+               game.state.chart[batx][baty].starbase = FALSE;
+               game.quad[basex][basey]= IHDOT;
+               basex=basey=0;
+               newcnd();
+               skip(1);
+               prout("Spock-  \"Captain, I believe the starbase has been destroyegame.state.\"");
+           }
+           else if (game.state.rembase != 1 &&
+                    (game.damage[DRADIO] <= 0.0 || condit == IHDOCKED)) {
+               /* Get word via subspace radio */
+               if (ipage==0) pause_game(1);
+               ipage = 1;
+               skip(1);
+               prout("Lt. Uhura-  \"Captain, Starfleet Command reports that");
+               proutn("   the starbase in ");
+               proutn(cramlc(quadrant, batx, baty));
+               prout(" has been destroyed by");
+               if (isatb==2) prout("the Klingon Super-Commander");
+               else prout("a Klingon Commander");
+               game.state.chart[batx][baty].starbase = FALSE;
+           }
+           /* Remove Starbase from galaxy */
+           game.state.galaxy[batx][baty].starbase = FALSE;
+           for_starbases(i)
+               if (game.state.baseqx[i]==batx && game.state.baseqy[i]==baty) {
+                   game.state.baseqx[i]=game.state.baseqx[game.state.rembase];
+                   game.state.baseqy[i]=game.state.baseqy[game.state.rembase];
+               }
+           game.state.rembase--;
+           if (isatb == 2) {
+               /* reinstate a commander's base attack */
+               batx = ixhold;
+               baty = iyhold;
+               isatb = 0;
+           }
+           else {
+               batx = baty = 0;
+           }
+           break;
+       case FSCMOVE: /* Supercommander moves */
+           game.future[FSCMOVE] = game.state.date+0.2777;
+           if (ientesc+istract==0 &&
+               isatb!=1 &&
+               (iscate!=1 || justin==1)) scom(&ipage);
+           break;
+       case FDSPROB: /* Move deep space probe */
+           game.future[FDSPROB] = game.state.date + 0.01;
+           probex += probeinx;
+           probey += probeiny;
+           i = (int)(probex/QUADSIZE +0.05);
+           j = (int)(probey/QUADSIZE + 0.05);
+           if (probecx != i || probecy != j) {
+               probecx = i;
+               probecy = j;
+               if (!VALID_QUADRANT(i, j) ||
+                   game.state.galaxy[probecx][probecy].supernova) {
+                   // Left galaxy or ran into supernova
+                   if (game.damage[DRADIO]==0.0 || condit == IHDOCKED) {
+                       if (ipage==0) pause_game(1);
+                       ipage = 1;
+                       skip(1);
+                       proutn("Lt. Uhura-  \"The deep space probe ");
+                       if (!VALID_QUADRANT(j, i))
+                           proutn("has left the galaxy");
+                       else
+                           proutn("is no longer transmitting");
+                       prout(".\"");
+                   }
+                   game.future[FDSPROB] = FOREVER;
+                   break;
+               }
+               if (game.damage[DRADIO]==0.0   || condit == IHDOCKED) {
+                   if (ipage==0) pause_game(1);
+                   ipage = 1;
+                   skip(1);
+                   proutn("Lt. Uhura-  \"The deep space probe is now in ");
+                   proutn(cramlc(quadrant, probecx, probecy));
+                   prout(".\"");
+               }
+           }
+           /* Update star chart if Radio is working or have access to
+              radio. */
+           if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED) {
+               game.state.chart[probecx][probecy].klingons = game.state.galaxy[probecx][probecy].klingons;
+               game.state.chart[probecx][probecy].starbase = game.state.galaxy[probecx][probecy].starbase;
+               game.state.chart[probecx][probecy].stars = game.state.galaxy[probecx][probecy].stars;
+               game.state.galaxy[probecx][probecy].charted = TRUE;
+           }
+           proben--; // One less to travel
+           if (proben == 0 && isarmed &&
+               game.state.galaxy[probecx][probecy].stars) {
+               /* lets blow the sucker! */
+               snova(1,0);
+               game.future[FDSPROB] = FOREVER;
+               if (game.state.galaxy[quadx][quady].supernova) 
+                   return;
+           }
+           break;
+       }
+    }
+}
+
+                               
+void wait(void) 
+{
+    int key;
+    double temp, delay, origTime;
+
+    ididit = 0;
+    for (;;) {
+       key = scan();
+       if (key  != IHEOL) break;
+       proutn("How long? ");
+    }
+    chew();
+    if (key != IHREAL) {
+       huh();
+       return;
+    }
+    origTime = delay = aaitem;
+    if (delay <= 0.0) return;
+    if (delay >= game.state.remtime || nenhere != 0) {
+       proutn("Are you sure? ");
+       if (ja() == 0) return;
+    }
+
+    /* Alternate resting periods (events) with attacks */
+
+    resting = 1;
+    do {
+       if (delay <= 0) resting = 0;
+       if (resting == 0) {
+           prout("%d stardates left.", (int)game.state.remtime);
+           return;
+       }
+       temp = Time = delay;
+
+       if (nenhere) {
+           double rtime = 1.0 + Rand();
+           if (rtime < temp) temp = rtime;
+           Time = temp;
+       }
+       if (Time < delay) attack(0);
+       if (alldone) return;
+       events();
+       ididit = 1;
+       if (alldone) return;
+       delay -= temp;
+       /* Repair Deathray if long rest at starbase */
+       if (origTime-delay >= 9.99 && condit == IHDOCKED)
+           game.damage[DDRAY] = 0.0;
+    } while 
+       // leave if quadrant supernovas
+       (!game.state.galaxy[quadx][quady].supernova);
+
+    resting = 0;
+    Time = 0;
+}
+
+void nova(int ix, int iy) 
+{
+    static double course[] =
+       {0.0, 10.5, 12.0, 1.5, 9.0, 0.0, 3.0, 7.5, 6.0, 4.5};
+    int bot, top, top2, hits[QUADSIZE+1][3], kount, icx, icy, mm, nn, j;
+    int iquad, iquad1, i, ll, newcx, newcy, ii, jj;
+    if (Rand() < 0.05) {
+       /* Wow! We've supernova'ed */
+       snova(ix, iy);
+       return;
+    }
+
+    /* handle initial nova */
+    game.quad[ix][iy] = IHDOT;
+    crmena(1, IHSTAR, 2, ix, iy);
+    prout(" novas.");
+    game.state.galaxy[quadx][quady].stars--;
+    game.state.starkl++;
+       
+    /* Set up stack to recursively trigger adjacent stars */
+    bot = top = top2 = 1;
+    kount = 0;
+    icx = icy = 0;
+    hits[1][1] = ix;
+    hits[1][2] = iy;
+    while (1) {
+       for (mm = bot; mm <= top; mm++) 
+           for (nn = 1; nn <= 3; nn++)  /* nn,j represents coordinates around current */
+               for (j = 1; j <= 3; j++) {
+                   if (j==2 && nn== 2) continue;
+                   ii = hits[mm][1]+nn-2;
+                   jj = hits[mm][2]+j-2;
+                   if (!VALID_SECTOR(jj, ii)) continue;
+                   iquad = game.quad[ii][jj];
+                   switch (iquad) {
+                   // case IHDOT:      /* Empty space ends reaction
+                   // case IHQUEST:
+                   // case IHBLANK:
+                   // case IHT:
+                   // case IHWEB:
+                   default:
+                       break;
+                   case IHSTAR: /* Affect another star */
+                       if (Rand() < 0.05) {
+                           /* This star supernovas */
+                           snova(ii,jj);
+                           return;
+                       }
+                       top2++;
+                       hits[top2][1]=ii;
+                       hits[top2][2]=jj;
+                       game.state.galaxy[quadx][quady].stars -= 1;
+                       game.state.starkl++;
+                       crmena(1, IHSTAR, 2, ii, jj);
+                       prout(" novas.");
+                       game.quad[ii][jj] = IHDOT;
+                       break;
+                   case IHP: /* Destroy planet */
+                       game.state.galaxy[quadx][quady].planets -= 1;
+                       game.state.nplankl++;
+                       crmena(1, IHP, 2, ii, jj);
+                       prout(" destroyed.");
+                       DESTROY(&game.state.plnets[iplnet]);
+                       iplnet = plnetx = plnety = 0;
+                       if (landed == 1) {
+                           finish(FPNOVA);
+                           return;
+                       }
+                       game.quad[ii][jj] = IHDOT;
+                       break;
+                   case IHB: /* Destroy base */
+                       game.state.galaxy[quadx][quady].starbase = FALSE;
+                       for_starbases(i)
+                           if (game.state.baseqx[i]==quadx && game.state.baseqy[i]==quady) 
+                               break;
+                       game.state.baseqx[i] = game.state.baseqx[game.state.rembase];
+                       game.state.baseqy[i] = game.state.baseqy[game.state.rembase];
+                       game.state.rembase--;
+                       basex = basey = 0;
+                       game.state.basekl++;
+                       newcnd();
+                       crmena(1, IHB, 2, ii, jj);
+                       prout(" destroyed.");
+                       game.quad[ii][jj] = IHDOT;
+                       break;
+                   case IHE: /* Buffet ship */
+                   case IHF:
+                       prout("***Starship buffeted by nova.");
+                       if (shldup) {
+                           if (shield >= 2000.0) shield -= 2000.0;
+                           else {
+                               double diff = 2000.0 - shield;
+                               energy -= diff;
+                               shield = 0.0;
+                               shldup = 0;
+                               prout("***Shields knocked out.");
+                               game.damage[DSHIELD] += 0.005*damfac*Rand()*diff;
+                           }
+                       }
+                       else energy -= 2000.0;
+                       if (energy <= 0) {
+                           finish(FNOVA);
+                           return;
+                       }
+                       /* add in course nova contributes to kicking starship*/
+                       icx += sectx-hits[mm][1];
+                       icy += secty-hits[mm][2];
+                       kount++;
+                       break;
+                   case IHK: /* kill klingon */
+                       deadkl(ii,jj,iquad, ii, jj);
+                       break;
+                   case IHC: /* Damage/destroy big enemies */
+                   case IHS:
+                   case IHR:
+                       for_local_enemies(ll)
+                           if (game.kx[ll]==ii && game.ky[ll]==jj) break;
+                       game.kpower[ll] -= 800.0; /* If firepower is lost, die */
+                       if (game.kpower[ll] <= 0.0) {
+                           deadkl(ii, jj, iquad, ii, jj);
+                           break;
+                       }
+                       newcx = ii + ii - hits[mm][1];
+                       newcy = jj + jj - hits[mm][2];
+                       crmena(1, iquad, 2, ii, jj);
+                       proutn(" damaged");
+                       if (!VALID_SECTOR(newcx, newcy)) {
+                           /* can't leave quadrant */
+                           skip(1);
+                           break;
+                       }
+                       iquad1 = game.quad[newcx][newcy];
+                       if (iquad1 == IHBLANK) {
+                           proutn(", blasted into ");
+                           crmena(0, IHBLANK, 2, newcx, newcy);
+                           skip(1);
+                           deadkl(ii, jj, iquad, newcx, newcy);
+                           break;
+                       }
+                       if (iquad1 != IHDOT) {
+                           /* can't move into something else */
+                           skip(1);
+                           break;
+                       }
+                       proutn(", buffeted to ");
+                       proutn(cramlc(sector, newcx, newcy));
+                       game.quad[ii][jj] = IHDOT;
+                       game.quad[newcx][newcy] = iquad;
+                       game.kx[ll] = newcx;
+                       game.ky[ll] = newcy;
+                       game.kavgd[ll] = sqrt(square(sectx-newcx)+square(secty-newcy));
+                       game.kdist[ll] = game.kavgd[ll];
+                       skip(1);
+                       break;
+                   }
+               }
+       if (top == top2) 
+           break;
+       bot = top + 1;
+       top = top2;
+    }
+    if (kount==0) 
+       return;
+
+    /* Starship affected by nova -- kick it away. */
+    dist = kount*0.1;
+    if (icx) icx = (icx < 0 ? -1 : 1);
+    if (icy) icy = (icy < 0 ? -1 : 1);
+    direc = course[3*(icx+1)+icy+2];
+    if (direc == 0.0) dist = 0.0;
+    if (dist == 0.0) return;
+    Time = 10.0*dist/16.0;
+    skip(1);
+    prout("Force of nova displaces starship.");
+    iattak=2;  /* Eliminates recursion problem */
+    imove();
+    Time = 10.0*dist/16.0;
+    return;
+}
+       
+       
+void snova(int insx, int insy) 
+{
+    int comdead, nqx=0, nqy=0, nsx, nsy, num=0, kldead, iscdead;
+    int nrmdead, npdead;
+    int incipient=0;
+
+    nsx = insy;
+    nsy = insy;
+
+    if (insy== 0) {
+       if (insx == 1) {
+           /* NOVAMAX being used */
+           nqx = probecx;
+           nqy = probecy;
+       }
+       else {
+           int stars = 0;
+           /* Scheduled supernova -- select star */
+           /* logic changed here so that we won't favor quadrants in top
+              left of universe */
+           for_quadrants(nqx) {
+               for_quadrants(nqy) {
+                   stars += game.state.galaxy[nqx][nqy].stars;
+               }
+           }
+           if (stars == 0) return; /* nothing to supernova exists */
+           num = Rand()*stars + 1;
+           for_quadrants(nqx) {
+               for_quadrants(nqy) {
+                   num -= game.state.galaxy[nqx][nqy].stars;
+                   if (num <= 0) break;
+               }
+               if (num <=0) break;
+           }
+#ifdef DEBUG
+           if (idebug) {
+               proutn("Super nova here?");
+               if (ja()==1) {
+                   nqx = quadx;
+                   nqy = quady;
+               }
+           }
+#endif
+       }
+
+       if (nqx != quady || nqy != quady || justin != 0) {
+           /* it isn't here, or we just entered (treat as inroute) */
+           if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED) {
+               skip(1);
+               prout("Message from Starfleet Command       Stardate %.2f", game.state.date);
+               prout("     Supernova in %s; caution advised.",
+                     cramlc(quadrant, nqx, nqy));
+           }
+       }
+       else {
+           /* we are in the quadrant! */
+           incipient = 1;
+           num = Rand()* game.state.galaxy[nqx][nqy].stars + 1;
+           for_sectors(nsx) {
+               for_sectors(nsy) {
+                   if (game.quad[nsx][nsy]==IHSTAR) {
+                       num--;
+                       if (num==0) break;
+                   }
+               }
+               if (num==0) break;
+           }
+       }
+    }
+    else {
+       incipient = 1;
+    }
+
+    if (incipient) {
+       skip(1);
+       prouts("***RED ALERT!  RED ALERT!");
+       skip(1);
+       prout("***Incipient supernova detected at ", cramlc(sector, nsx, nsy));
+       nqx = quadx;
+       nqy = quady;
+       if (square(nsx-sectx) + square(nsy-secty) <= 2.1) {
+           proutn("Emergency override attempts t");
+           prouts("***************");
+           skip(1);
+           stars();
+           alldone=1;
+       }
+    }
+    /* destroy any Klingons in supernovaed quadrant */
+    kldead = game.state.galaxy[nqx][nqy].klingons;
+    game.state.galaxy[nqx][nqy].klingons = 0;
+    comdead = iscdead = 0;
+    if (nqx==game.state.isx && nqy == game.state.isy) {
+       /* did in the Supercommander! */
+       game.state.nscrem = game.state.isx = game.state.isy = isatb = iscate = 0;
+       iscdead = 1;
+       game.future[FSCMOVE] = game.future[FSCDBAS] = FOREVER;
+    }
+    if (game.state.remcom) {
+       int maxloop = game.state.remcom, l;
+       for (l = 1; l <= maxloop; l++) {
+           if (game.state.cx[l] == nqx && game.state.cy[l] == nqy) {
+               game.state.cx[l] = game.state.cx[game.state.remcom];
+               game.state.cy[l] = game.state.cy[game.state.remcom];
+               game.state.cx[game.state.remcom] = game.state.cy[game.state.remcom] = 0;
+               game.state.remcom--;
+               kldead--;
+               comdead++;
+               if (game.state.remcom==0) game.future[FTBEAM] = FOREVER;
+               break;
+           }
+       }
+    }
+    game.state.remkl -= kldead;
+    /* destroy Romulans and planets in supernovaed quadrant */
+    nrmdead = game.state.galaxy[nqx][nqy].romulans;
+    game.state.galaxy[nqx][nqy].romulans = 0;
+    game.state.nromrem -= nrmdead;
+    npdead = num - nrmdead*10;
+    if (npdead) {
+       int l;
+       for (l = 0; l < inplan; l++)
+           if (game.state.plnets[l].x == nqx && game.state.plnets[l].y == nqy) {
+               DESTROY(&game.state.plnets[l]);
+           }
+    }
+    /* Destroy any base in supernovaed quadrant */
+    if (game.state.rembase) {
+       int maxloop = game.state.rembase, l;
+       for (l = 1; l <= maxloop; l++)
+           if (game.state.baseqx[l]==nqx && game.state.baseqy[l]==nqy) {
+               game.state.baseqx[l] = game.state.baseqx[game.state.rembase];
+               game.state.baseqy[l] = game.state.baseqy[game.state.rembase];
+               game.state.baseqx[game.state.rembase] = game.state.baseqy[game.state.rembase] = 0;
+               game.state.rembase--;
+               break;
+           }
+    }
+    /* If starship caused supernova, tally up destruction */
+    if (insx) {
+       game.state.starkl += game.state.galaxy[nqx][nqy].stars;
+       game.state.basekl += game.state.galaxy[nqx][nqy].starbase;
+       game.state.nplankl += npdead;
+    }
+    /* mark supernova in galaxy and in star chart */
+    if ((quadx == nqx && quady == nqy) ||
+       game.damage[DRADIO] == 0 ||
+       condit == IHDOCKED)
+       game.state.galaxy[nqx][nqy].supernova = TRUE;
+    /* If supernova destroys last klingons give special message */
+    if (KLINGREM==0 && (nqx != quadx || nqy != quady)) {
+       skip(2);
+       if (insx == 0) prout("Lucky you!");
+       proutn("A supernova in %s has just destroyed the last Klingons.",
+              cramlc(quadrant, nqx, nqy));
+       finish(FWON);
+       return;
+    }
+    /* if some Klingons remain, continue or die in supernova */
+    if (alldone) finish(FSNOVAED);
+    return;
+}
+               
+                               
diff --git a/src/finish.c b/src/finish.c
new file mode 100644 (file)
index 0000000..c0d3569
--- /dev/null
@@ -0,0 +1,453 @@
+#include "sst.h"
+#include <string.h>
+#include <time.h>
+
+void dstrct() 
+{
+    /* Finish with a BANG! */
+    chew();
+    if (game.damage[DCOMPTR] != 0.0) {
+       prout("Computer damaged; cannot execute destruct sequence.");
+       return;
+    }
+    prouts("---WORKING---"); skip(1);
+    prouts("SELF-DESTRUCT-SEQUENCE-ACTIVATED"); skip(1);
+    prouts("   10"); skip(1);
+    prouts("       9"); skip(1);
+    prouts("          8"); skip(1);
+    prouts("             7"); skip(1);
+    prouts("                6"); skip(1);
+    skip(1);
+    prout("ENTER-CORRECT-PASSWORD-TO-CONTINUE-");
+    skip(1);
+    prout("SELF-DESTRUCT-SEQUENCE-OTHERWISE-");
+    skip(1);
+    prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");
+    skip(1);
+    scan();
+    chew();
+    if (strcmp(game.passwd, citem) != 0) {
+       prouts("PASSWORD-REJECTED;"); skip(1);
+       prouts("CONTINUITY-EFFECTED");
+       skip(2);
+       return;
+    }
+    prouts("PASSWORD-ACCEPTED"); skip(1);
+    prouts("                   5"); skip(1);
+    prouts("                      4"); skip(1);
+    prouts("                         3"); skip(1);
+    prouts("                            2"); skip(1);
+    prouts("                              1"); skip(1);
+    if (Rand() < 0.15) {
+       prouts("GOODBYE-CRUEL-WORLD");
+       skip(1);
+    }
+    kaboom();
+}
+
+void kaboom(void) 
+{
+    stars();
+    if (ship==IHE) prouts("***");
+    prouts("********* Entropy of ");
+    crmshp();
+    prouts(" maximized *********");
+    skip(1);
+    stars();
+    skip(1);
+    if (nenhere != 0) {
+       double whammo = 25.0 * energy;
+       int l=1;
+       while (l <= nenhere) {
+           if (game.kpower[l]*game.kdist[l] <= whammo) 
+               deadkl(game.kx[l],game.ky[l], game.quad[game.kx[l]][game.ky[l]], game.kx[l], game.ky[l]);
+           l++;
+       }
+    }
+    finish(FDILITHIUM);
+}
+                               
+
+void finish(FINTYPE ifin) 
+{
+    int igotit = 0;
+    alldone = 1;
+    skip(3);
+    prout("It is stardate %.1f.", game.state.date);
+    skip(1);
+    switch (ifin) {
+    case FWON: // Game has been won
+       if (game.state.nromrem != 0)
+           prout("The remaining %d Romulans surrender to Starfleet Command.",
+                 game.state.nromrem);
+
+       prout("You have smashed the Klingon invasion fleet and saved");
+       prout("the Federation.");
+       gamewon=1;
+       if (alive) {
+           double badpt;
+           badpt = 5.0*game.state.starkl + casual + 10.0*game.state.nplankl +
+               45.*nhelp+100.*game.state.basekl;
+           if (ship == IHF) badpt += 100.0;
+           else if (ship == 0) badpt += 200.0;
+           if (badpt < 100.0) badpt = 0.0;     // Close enough!
+           if (game.state.date-indate < 5.0 ||
+               // killsPerDate >= RateMax
+               KLINGKILLED/(game.state.date-indate) >=
+               0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {
+               skip(1);
+               prout("In fact, you have done so well that Starfleet Command");
+               switch (skill) {
+               case SKILL_NOVICE:
+                   prout("promotes you one step in rank from \"Novice\" to \"Fair\".");
+                   break;
+               case SKILL_FAIR:
+                   prout("promotes you one step in rank from \"Fair\" to \"Good\".");
+                   break;
+               case SKILL_GOOD:
+                   prout("promotes you one step in rank from \"Good\" to \"Expert\".");
+                   break;
+               case SKILL_EXPERT:
+                   prout("promotes you to Commodore Emeritus.");
+                   skip(1);
+                   prout("Now that you think you're really good, try playing");
+                   prout("the \"Emeritus\" game. It will splatter your ego.");
+                   break;
+               case SKILL_EMERITUS:
+                   skip(1);
+                   proutn("Computer-  ");
+                   prouts("ERROR-ERROR-ERROR-ERROR");
+                   skip(2);
+                   prouts("  YOUR-SKILL-HAS-EXCEEDED-THE-CAPACITY-OF-THIS-PROGRAM");
+                   skip(1);
+                   prouts("  THIS-PROGRAM-MUST-SURVIVE");
+                   skip(1);
+                   prouts("  THIS-PROGRAM-MUST-SURVIVE");
+                   skip(1);
+                   prouts("  THIS-PROGRAM-MUST-SURVIVE");
+                   skip(1);
+                   prouts("  THIS-PROGRAM-MUST?- MUST ? - SUR? ? -?  VI");
+                   skip(2);
+                   prout("Now you can retire and write your own Star Trek game!");
+                   skip(1);
+                   break;
+               }
+               if (skill >= SKILL_EXPERT) {
+                   if (thawed
+#ifdef DEBUG
+                       && !idebug
+#endif
+                       )
+                       prout("You cannot get a citation, so...");
+                   else {
+                       proutn("Do you want your Commodore Emeritus Citation printed? ");
+                       chew();
+                       if (ja()) {
+                           igotit = 1;
+                       }
+                   }
+               }
+           }
+           // Only grant long life if alive (original didn't!)
+           skip(1);
+           prout("LIVE LONG AND PROSPER.");
+       }
+       score();
+       if (igotit != 0) plaque();
+       return;
+    case FDEPLETE: // Federation Resources Depleted
+       prout("Your time has run out and the Federation has been");
+       prout("conquered.  Your starship is now Klingon property,");
+       prout("and you are put on trial as a war criminal.  On the");
+       proutn("basis of your record, you are ");
+       if (KLINGREM*3.0 > INKLINGTOT) {
+           prout("aquitted.");
+           skip(1);
+           prout("LIVE LONG AND PROSPER.");
+       }
+       else {
+           prout("found guilty and");
+           prout("sentenced to death by slow torture.");
+           alive = 0;
+       }
+       score();
+       return;
+    case FLIFESUP:
+       prout("Your life support reserves have run out, and");
+       prout("you die of thirst, starvation, and asphyxiation.");
+       prout("Your starship is a derelict in space.");
+       break;
+    case FNRG:
+       prout("Your energy supply is exhausted.");
+       skip(1);
+       prout("Your starship is a derelict in space.");
+       break;
+    case FBATTLE:
+       proutn("The ");
+       crmshp();
+       prout("has been destroyed in battle.");
+       skip(1);
+       prout("Dulce et decorum est pro patria mori.");
+       break;
+    case FNEG3:
+       prout("You have made three attempts to cross the negative energy");
+       prout("barrier which surrounds the galaxy.");
+       skip(1);
+       prout("Your navigation is abominable.");
+       score();
+       return;
+    case FNOVA:
+       prout("Your starship has been destroyed by a nova.");
+       prout("That was a great shot.");
+       skip(1);
+       break;
+    case FSNOVAED:
+       proutn("The ");
+       crmshp();
+       prout(" has been fried by a supernova.");
+       prout("...Not even cinders remain...");
+       break;
+    case FABANDN:
+       prout("You have been captured by the Klingons. If you still");
+       prout("had a starbase to be returned to, you would have been");
+       prout("repatriated and given another chance. Since you have");
+       prout("no starbases, you will be mercilessly tortured to death.");
+       break;
+    case FDILITHIUM:
+       prout("Your starship is now an expanding cloud of subatomic particles");
+       break;
+    case FMATERIALIZE:
+       prout("Starbase was unable to re-materialize your starship.");
+       prout("Sic transit gloria muntdi");
+       break;
+    case FPHASER:
+       proutn("The ");
+       crmshp();
+       prout(" has been cremated by its own phasers.");
+       break;
+    case FLOST:
+       prout("You and your landing party have been");
+       prout("converted to energy, disipating through space.");
+       break;
+    case FMINING:
+       prout("You are left with your landing party on");
+       prout("a wild jungle planet inhabited by primitive cannibals.");
+       skip(1);
+       prout("They are very fond of \"Captain Kirk\" soup.");
+       skip(1);
+       proutn("Without your leadership, the ");
+       crmshp();
+       prout(" is destroyed.");
+       break;
+    case FDPLANET:
+       prout("You and your mining party perish.");
+       skip(1);
+       prout("That was a great shot.");
+       skip(1);
+       break;
+    case FSSC:
+       prout("The Galileo is instantly annihilated by the supernova.");
+       // no break;
+    case FPNOVA:
+       prout("You and your mining party are atomized.");
+       skip(1);
+       proutn("Mr. Spock takes command of the ");
+       crmshp();
+       prout(" and");
+       prout("joins the Romulans, reigning terror on the Federation.");
+       break;
+    case FSTRACTOR:
+       prout("The shuttle craft Galileo is also caught,");
+       prout("and breaks up under the strain.");
+       skip(1);
+       prout("Your debris is scattered for millions of miles.");
+       proutn("Without your leadership, the ");
+       crmshp();
+       prout(" is destroyed.");
+       break;
+    case FDRAY:
+       prout("The mutants attack and kill Spock.");
+       prout("Your ship is captured by Klingons, and");
+       prout("your crew is put on display in a Klingon zoo.");
+       break;
+    case FTRIBBLE:
+       prout("Tribbles consume all remaining water,");
+       prout("food, and oxygen on your ship.");
+       skip(1);
+       prout("You die of thirst, starvation, and asphyxiation.");
+       prout("Your starship is a derelict in space.");
+       break;
+    case FHOLE:
+       prout("Your ship is drawn to the center of the black hole.");
+       prout("You are crushed into extremely dense matter.");
+       break;
+    }
+    if (ship==IHF) ship= 0;
+    else if (ship == IHE) ship = IHF;
+    alive = 0;
+    if (KLINGREM != 0) {
+       double goodies = game.state.remres/inresor;
+       double baddies = (game.state.remkl + 2.0*game.state.remcom)/(inkling+2.0*incom);
+       if (goodies/baddies >= 1.0+0.5*Rand()) {
+           prout("As a result of your actions, a treaty with the Klingon");
+           prout("Empire has been signed. The terms of the treaty are");
+           if (goodies/baddies >= 3.0+Rand()) {
+               prout("favorable to the Federation.");
+               skip(1);
+               prout("Congratulations!");
+           }
+           else
+               prout("highly unfavorable to the Federation.");
+       }
+       else
+           prout("The Federation will be destroyed.");
+    }
+    else {
+       prout("Since you took the last Klingon with you, you are a");
+       prout("martyr and a hero. Someday maybe they'll erect a");
+       prout("statue in your memory. Rest in peace, and try not");
+       prout("to think about pigeons.");
+       gamewon = 1;
+    }
+    score();
+}
+
+void score(void) 
+{
+    double timused = game.state.date - indate;
+    int ithperd, iwon, klship;
+
+    iskill = skill;
+    if ((timused == 0 || KLINGREM != 0) && timused < 5.0) timused = 5.0;
+    perdate = KLINGKILLED/timused;
+    ithperd = 500*perdate + 0.5;
+    iwon = 0;
+    if (gamewon) iwon = 100*skill;
+    if (ship == IHE) klship = 0;
+    else if (ship == IHF) klship = 1;
+    else klship = 2;
+    if (gamewon == 0) game.state.nromrem = 0; // None captured if no win
+    iscore = 10*NKILLK + 50*NKILLC + ithperd + iwon
+       - 100*game.state.basekl - 100*klship - 45*nhelp -5*game.state.starkl - casual
+       + 20*NKILLROM + 200*NKILLSC - 10*game.state.nplankl + game.state.nromrem;
+    if (alive == 0) iscore -= 200;
+    skip(2);
+    prout("Your score --");
+    if (NKILLROM)
+       prout("%6d Romulans destroyed                 %5d",
+             NKILLROM,20*NKILLROM);
+    if (game.state.nromrem)
+       prout("%6d Romulans captured                  %5d",
+             game.state.nromrem, game.state.nromrem);
+    if (NKILLK)
+       prout("%6d ordinary Klingons destroyed        %5d",
+             NKILLK, 10*NKILLK);
+    if (NKILLC)
+       prout("%6d Klingon commanders destroyed       %5d",
+             NKILLC, 50*NKILLC);
+    if (NKILLSC)
+       prout("%6d Super-Commander destroyed          %5d",
+             NKILLSC, 200*NKILLSC);
+    if (ithperd)
+       prout("%6.2f Klingons per stardate              %5d",
+             perdate, ithperd);
+    if (game.state.starkl)
+       prout("%6d stars destroyed by your action     %5d",
+             game.state.starkl, -5*game.state.starkl);
+    if (game.state.nplankl)
+       prout("%6d planets destroyed by your action   %5d",
+             game.state.nplankl, -10*game.state.nplankl);
+    if (game.state.basekl)
+       prout("%6d bases destroyed by your action     %5d",
+             game.state.basekl, -100*game.state.basekl);
+    if (nhelp)
+       prout("%6d calls for help from starbase       %5d",
+             nhelp, -45*nhelp);
+    if (casual)
+       prout("%6d casualties incurred                %5d",
+             casual, -casual);
+    if (klship)
+       prout("%6d ship(s) lost or destroyed          %5d",
+             klship, -100*klship);
+    if (alive==0)
+       prout("Penalty for getting yourself killed        -200");
+    if (gamewon) {
+       proutn("Bonus for winning ");
+       switch (skill) {
+       case SKILL_NOVICE:   proutn("Novice game  "); break;
+       case SKILL_FAIR:     proutn("Fair game    "); break;
+       case SKILL_GOOD:     proutn("Good game    "); break;
+       case SKILL_EXPERT:   proutn("Expert game  "); break;
+       case SKILL_EMERITUS: proutn("Emeritus game"); break;
+       }
+       prout("           %5d", iwon);
+    }
+    skip(1);
+    prout("TOTAL SCORE                               %5d", iscore);
+}
+
+void plaque(void) {
+       FILE *fp=NULL;
+       time_t t;
+       char *timestring;
+       int nskip;
+       char winner[128];
+
+       skip(2);
+       
+       while (fp == NULL) {
+                proutn("File or device name for your plaque: ");
+                cgetline(winner, sizeof(winner));
+               fp = fopen(winner, "w");
+               if (fp==NULL) {
+                        prout("Invalid name.");
+               }
+       }
+
+        proutn("Enter name to go on plaque (up to 30 characters): ");
+        cgetline(winner, sizeof(winner));
+       /* The 38 below must be 64 for 132-column paper */
+       nskip = 38 - strlen(winner)/2;
+
+       fprintf(fp,"\n\n\n\n");
+       /* --------DRAW ENTERPRISE PICTURE. */
+        fprintf(fp, "                                       EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n" );
+       fprintf(fp, "                                      EEE                      E  : :                                         :  E\n" );
+       fprintf(fp, "                                    EE   EEE                   E  : :                   NCC-1701              :  E\n");
+        fprintf(fp, "EEEEEEEEEEEEEEEE        EEEEEEEEEEEEEEE  : :                              : E\n");
+        fprintf(fp, " E                                     EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\n");
+       fprintf(fp, "                      EEEEEEEEE               EEEEEEEEEEEEE                 E  E\n");
+       fprintf(fp, "                               EEEEEEE   EEEEE    E          E              E  E\n");
+       fprintf(fp, "                                      EEE           E          E            E  E\n");
+       fprintf(fp, "                                                       E         E          E  E\n");
+       fprintf(fp, "                                                         EEEEEEEEEEEEE      E  E\n");
+       fprintf(fp, "                                                      EEE :           EEEEEEE  EEEEEEEE\n");
+       fprintf(fp, "                                                    :E    :                 EEEE       E\n");
+       fprintf(fp, "                                                   .-E   -:-----                       E\n");
+       fprintf(fp, "                                                    :E    :                            E\n");
+       fprintf(fp, "                                                      EE  :                    EEEEEEEE\n");
+       fprintf(fp, "                                                       EEEEEEEEEEEEEEEEEEEEEEE\n");
+       fprintf(fp, "\n\n\n");
+       fprintf(fp, "                                                       U. S. S. ENTERPRISE\n");
+       fprintf(fp, "\n\n\n\n");
+       fprintf(fp, "                                  For demonstrating outstanding ability as a starship captain\n");
+       fprintf(fp, "\n");
+       fprintf(fp, "                                                Starfleet Command bestows to you\n");
+       fprintf(fp, "\n");
+       fprintf(fp,"%*s%s\n\n", nskip, "", winner);
+       fprintf(fp, "                                                           the rank of\n\n");
+       fprintf(fp, "                                                       \"Commodore Emeritus\"\n\n");
+       fprintf(fp, "                                                          ");
+       switch (iskill) {
+               case SKILL_EXPERT: fprintf(fp," Expert level\n\n"); break;
+               case SKILL_EMERITUS: fprintf(fp,"Emeritus level\n\n"); break;
+               default: fprintf(fp," Cheat level\n\n"); break;
+       }
+       t = time(NULL);
+       timestring = ctime(&t);
+       fprintf(fp, "                                                 This day of %.6s %.4s, %.8s\n\n",
+                       timestring+4, timestring+20, timestring+11);
+       fprintf(fp,"                                                        Your score:  %d\n\n", iscore);
+       fprintf(fp,"                                                    Klingons per stardate:  %.2f\n", perdate);
+       fclose(fp);
+}
diff --git a/src/io.c b/src/io.c
new file mode 100644 (file)
index 0000000..adbbca0
--- /dev/null
+++ b/src/io.c
@@ -0,0 +1,438 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <curses.h>
+#include <signal.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#include "sst.h"
+#include "sstlinux.h"
+
+static int rows, linecount;    /* for paging */
+
+WINDOW *curwnd;
+
+static void outro(void)
+/* wrap up, either normally or due to signal */
+{
+    if (game.options & OPTION_CURSES) {
+       clear();
+       curs_set(1);
+       (void)refresh();
+       (void)resetterm();
+       //(void)echo();
+       (void)endwin();
+       putchar('\n');
+    }
+}
+
+void iostart(void) 
+{
+    if (!(game.options & OPTION_CURSES)) {
+       rows = atoi(getenv("LINES"));
+    } else {
+       if (atexit(outro)){
+           fprintf(stderr,"Unable to register outro(), exiting...\n");
+           exit(1);
+       }
+       (void)initscr();
+#ifdef KEY_MIN
+       keypad(stdscr, TRUE);
+#endif /* KEY_MIN */
+       (void)saveterm();
+       (void)nonl();
+       (void)cbreak();
+#ifdef A_COLOR
+       {
+           start_color();
+           init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
+           init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
+           init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
+           init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
+           init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
+           init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
+           init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
+           init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
+       }
+#endif /* A_COLOR */
+       //(void)noecho();
+       fullscreen_window = stdscr;
+       srscan_window     = newwin(12, 25, 0,       0);
+       report_window     = newwin(10, 0,  1,       25);
+       lrscan_window     = newwin(10, 0,  0,       64); 
+       message_window    = newwin(0,  0,  12,      0);
+       prompt_window     = newwin(1,  0,  LINES-2, 0); 
+       scrollok(message_window, TRUE);
+       setwnd(fullscreen_window);
+       textcolor(DEFAULT);
+    }
+}
+
+
+void waitfor(void)
+/* wait for user action -- OK to do nothing if on a TTY */
+{
+    if (game.options & OPTION_CURSES)
+       getch();
+}
+
+void pause_game(int i) 
+{
+    char *prompt;
+    char buf[BUFSIZ];
+    if (i==1) {
+       if (skill > SKILL_FAIR)
+           prompt = "[ANOUNCEMENT ARRIVING...]";
+       else
+           prompt = "[IMPORTANT ANNOUNCEMENT ARRIVING -- PRESS ENTER TO CONTINUE]";
+    }
+    else {
+       if (skill > SKILL_FAIR)
+           prompt = "[CONTINUE?]";
+       else
+           prompt = "[PRESS ENTER TO CONTINUE]";
+
+    }
+    if (game.options & OPTION_CURSES) {
+       drawmaps(0);
+       setwnd(prompt_window);
+       wclear(prompt_window);
+       waddstr(prompt_window, prompt);
+       wgetnstr(prompt_window, buf, sizeof(buf));
+       wclear(prompt_window);
+       wrefresh(prompt_window);
+       setwnd(message_window);
+    } else {
+       putchar('\n');
+       proutn(prompt);
+       fgets(buf, sizeof(buf), stdin);
+       if (i != 0) {
+           int j;
+           for (j = 0; j < rows; j++)
+               putchar('\n');
+       }
+       linecount = 0;
+    }
+}
+
+
+void skip(int i) 
+{
+    while (i-- > 0) {
+       if (game.options & OPTION_CURSES) {
+           if (curwnd == message_window && linecount >= getmaxy(curwnd) - 3) {
+               pause_game(0);
+               clrscr();
+           } else {
+               proutn("\n");
+               if (curwnd == message_window)
+                   linecount++;
+           }
+       } else {
+           linecount++;
+           if (linecount >= rows)
+               pause_game(0);
+           else
+               putchar('\n');
+       }
+    }
+}
+
+static void vproutn(char *fmt, va_list ap) 
+{
+    if (game.options & OPTION_CURSES) {
+       vwprintw(curwnd, fmt, ap);
+       wrefresh(curwnd);
+    }
+    else
+       vprintf(fmt, ap);
+}
+
+void proutn(char *fmt, ...) 
+{
+    va_list ap;
+    va_start(ap, fmt);
+    vproutn(fmt, ap);
+    va_end(ap);
+}
+
+void prout(char *fmt, ...) 
+{
+    va_list ap;
+    va_start(ap, fmt);
+    vproutn(fmt, ap);
+    va_end(ap);
+    skip(1);
+}
+
+void prouts(char *fmt, ...) 
+/* print slowly! */
+{
+    char *s, buf[BUFSIZ];
+    va_list ap;
+    va_start(ap, fmt);
+    vsprintf(buf, fmt, ap);
+    va_end(ap);
+    for (s = buf; *s; s++) {
+       delay(30);
+       if (game.options & OPTION_CURSES) {
+           waddch(curwnd, *s);
+           wrefresh(curwnd);
+       }
+       else {
+           putchar(*s);
+           fflush(stdout);
+       }
+    }
+}
+
+void cgetline(char *line, int max)
+{
+    if (game.options & OPTION_CURSES) {
+       wgetnstr(curwnd, line, max);
+       strcat(line, "\n");
+       wrefresh(curwnd);
+    } else {
+       fgets(line, max, stdin);
+    }
+    line[strlen(line)-1] = '\0';
+}
+
+void setwnd(WINDOW *wnd)
+/* change windows -- OK for this to be a no-op in tty mode */
+{
+    if (game.options & OPTION_CURSES) {
+     curwnd=wnd;
+     curs_set(wnd == fullscreen_window || wnd == message_window || wnd == prompt_window);
+    }
+}
+
+void clreol (void)
+/* clear to end of line -- can be a no-op in tty mode */
+{
+   if (game.options & OPTION_CURSES) {
+       wclrtoeol(curwnd);
+       wrefresh(curwnd);
+   }
+}
+
+void clrscr (void)
+/* clear screen -- can be a no-op in tty mode */
+{
+   if (game.options & OPTION_CURSES) {
+       wclear(curwnd);
+       wmove(curwnd,0,0);
+       wrefresh(curwnd);
+   }
+   linecount = 0;
+}
+
+void textcolor (int color)
+{
+#ifdef A_COLOR
+    if (game.options & OPTION_CURSES) {
+       switch(color) {
+       case DEFAULT: 
+           wattrset(curwnd, 0);
+           break;
+       case BLACK: 
+           wattron(curwnd, COLOR_PAIR(COLOR_BLACK));
+           break;
+       case BLUE: 
+           wattron(curwnd, COLOR_PAIR(COLOR_BLUE));
+           break;
+       case GREEN: 
+           wattron(curwnd, COLOR_PAIR(COLOR_GREEN));
+           break;
+       case CYAN: 
+           wattron(curwnd, COLOR_PAIR(COLOR_CYAN));
+           break;
+       case RED: 
+           wattron(curwnd, COLOR_PAIR(COLOR_RED));
+           break;
+       case MAGENTA: 
+           wattron(curwnd, COLOR_PAIR(COLOR_MAGENTA));
+           break;
+       case BROWN: 
+           wattron(curwnd, COLOR_PAIR(COLOR_YELLOW));
+           break;
+       case LIGHTGRAY: 
+           wattron(curwnd, COLOR_PAIR(COLOR_WHITE));
+           break;
+       case DARKGRAY: 
+           wattron(curwnd, COLOR_PAIR(COLOR_BLACK) | A_BOLD);
+           break;
+       case LIGHTBLUE: 
+           wattron(curwnd, COLOR_PAIR(COLOR_BLUE) | A_BOLD);
+           break;
+       case LIGHTGREEN: 
+           wattron(curwnd, COLOR_PAIR(COLOR_GREEN) | A_BOLD);
+           break;
+       case LIGHTCYAN: 
+           wattron(curwnd, COLOR_PAIR(COLOR_CYAN) | A_BOLD);
+           break;
+       case LIGHTRED: 
+           wattron(curwnd, COLOR_PAIR(COLOR_RED) | A_BOLD);
+           break;
+       case LIGHTMAGENTA: 
+           wattron(curwnd, COLOR_PAIR(COLOR_MAGENTA) | A_BOLD);
+           break;
+       case YELLOW: 
+           wattron(curwnd, COLOR_PAIR(COLOR_YELLOW) | A_BOLD);
+           break;
+       case WHITE:
+           wattron(curwnd, COLOR_PAIR(COLOR_WHITE) | A_BOLD);
+           break;
+       }
+    }
+#endif /* A_COLOR */
+}
+
+void highvideo (void)
+{
+    if (game.options & OPTION_CURSES) {
+       wattron(curwnd, A_REVERSE);
+    }
+}
+void commandhook(char *cmd, int before) {
+}
+
+/*
+ * Things past this point have policy implications.
+ */
+
+void drawmaps(short l)
+/* hook to be called after moving to redraw maps */
+{
+    if (game.options & OPTION_CURSES) {
+       if (l == 1)
+           sensor();
+        setwnd(srscan_window);
+        wmove(curwnd, 0, 0);
+        enqueue("no");
+        srscan(SCAN_FULL);
+       if (l != 2) {
+           setwnd(report_window);
+           wclear(report_window);
+           wmove(report_window, 0, 0);
+           srscan(SCAN_NO_LEFTSIDE);
+           setwnd(lrscan_window);
+           wclear(lrscan_window);
+           wmove(lrscan_window, 0, 0);
+           enqueue("l");
+           lrscan();
+       }
+    }
+}
+
+static void put_srscan_sym(int x, int y, char sym)
+{
+    wmove(srscan_window, x+1, y*2+2);
+    waddch(srscan_window, sym);
+    wrefresh(srscan_window);
+}
+
+void boom(int ii, int jj)
+/* enemy fall down, go boom */ 
+{
+    if (game.options & OPTION_CURSES) {
+       drawmaps(2);
+       setwnd(srscan_window);
+       wattron(srscan_window, A_REVERSE);
+       put_srscan_sym(ii, jj, game.quad[ii][jj]);
+       sound(500);
+       delay(1000);
+       nosound();
+       wattroff(srscan_window, A_REVERSE);
+       put_srscan_sym(ii, jj, game.quad[ii][jj]);
+       delay(500);
+       setwnd(message_window);
+    }
+} 
+
+void warble(void)
+/* sound and visual effects for teleportation */
+{
+    if (game.options & OPTION_CURSES) {
+       drawmaps(2);
+       setwnd(message_window);
+       sound(50);
+    }
+    prouts("     . . . . .     ");
+    if (game.options & OPTION_CURSES) {
+       delay(1000);
+       nosound();
+    }
+}
+
+void tracktorpedo(int ix, int iy, int l, int i, int n, int iquad)
+/* torpedo-track animation */
+{
+    if (!game.options & OPTION_CURSES) {
+       if (l == 1) {
+           if (n != 1) {
+               skip(1);
+               proutn("Track for torpedo number %d-  ", i);
+           }
+           else {
+               skip(1);
+               proutn("Torpedo track- ");
+           }
+       } else if (l==4 || l==9) 
+           skip(1);
+       proutn("%d - %d   ", ix, iy);
+    } else {
+       if (game.damage[DSRSENS]==0 || condit==IHDOCKED) {
+           if (i != 1 && l == 1) {
+               drawmaps(2);
+               delay(400);
+           }
+           if ((iquad==IHDOT)||(iquad==IHBLANK)){
+               put_srscan_sym(ix, iy, '+');
+               sound(l*10);
+               delay(100);
+               nosound();
+               put_srscan_sym(ix, iy, iquad);
+           }
+           else {
+               wattron(curwnd, A_REVERSE);
+               put_srscan_sym(ix, iy, iquad);
+               sound(500);
+               delay(1000);
+               nosound();
+               wattroff(curwnd, A_REVERSE);
+               put_srscan_sym(ix, iy, iquad);
+           }
+       } else {
+           proutn("%d - %d   ", ix, iy);
+       }
+    }
+}
+
+void makechart(void) 
+{
+    if (game.options & OPTION_CURSES) {
+       setwnd(message_window);
+       wclear(message_window);
+       chart(0);
+    }
+}
+
+void setpassword(void) 
+{
+    if (!(game.options & OPTION_CURSES)) {
+       while (TRUE) {
+           scan();
+           strcpy(game.passwd, citem);
+           chew();
+           if (*game.passwd != 0) break;
+           proutn("Please type in a secret password-");
+       }
+    } else {
+       int i;
+        for(i=0;i<3;i++) game.passwd[i]=(char)(97+(int)(Rand()*25));
+        game.passwd[3]=0;
+    }
+}
+
diff --git a/src/moving.c b/src/moving.c
new file mode 100644 (file)
index 0000000..a5d11b3
--- /dev/null
@@ -0,0 +1,1009 @@
+#include <unistd.h>
+#include "sstlinux.h"
+#include "sst.h"
+
+static void getcd(int, int);
+
+void imove(void) 
+{
+    double angle, deltax, deltay, bigger, x, y,
+        finald, finalx, finaly, stopegy, probf;
+    int trbeam = 0, n, l, ix=0, iy=0, kink, kinks, iquad;
+
+    if (inorbit) {
+       prout("Helmsman Sulu- \"Leaving standard orbit.\"");
+       inorbit = FALSE;
+    }
+
+    angle = ((15.0 - direc) * 0.5235988);
+    deltax = -sin(angle);
+    deltay = cos(angle);
+    if (fabs(deltax) > fabs(deltay))
+       bigger = fabs(deltax);
+    else
+       bigger = fabs(deltay);
+               
+    deltay /= bigger;
+    deltax /= bigger;
+
+    /* If tractor beam is to occur, don't move full distance */
+    if (game.state.date+Time >= game.future[FTBEAM]) {
+       trbeam = 1;
+       condit = IHRED;
+       dist = dist*(game.future[FTBEAM]-game.state.date)/Time + 0.1;
+       Time = game.future[FTBEAM] - game.state.date + 1e-5;
+    }
+    /* Move within the quadrant */
+    game.quad[sectx][secty] = IHDOT;
+    x = sectx;
+    y = secty;
+    n = 10.0*dist*bigger+0.5;
+
+    if (n > 0) {
+       for (l = 1; l <= n; l++) {
+           ix = (x += deltax) + 0.5;
+           iy = (y += deltay) + 0.5;
+           if (!VALID_SECTOR(ix, iy)) {
+               /* Leaving quadrant -- allow final enemy attack */
+               /* Don't do it if being pushed by Nova */
+               if (nenhere != 0 && iattak != 2) {
+                   newcnd();
+                   for_local_enemies(l) {
+                       finald = sqrt((ix-game.kx[l])*(double)(ix-game.kx[l]) +
+                                     (iy-game.ky[l])*(double)(iy-game.ky[l]));
+                       game.kavgd[l] = 0.5 * (finald+game.kdist[l]);
+                   }
+                   /*
+                    * Stas Sergeev added the condition
+                    * that attacks only happen if Klingons
+                    * are present and your skill is good.
+                    */
+                   if (skill > SKILL_GOOD && klhere > 0 && !game.state.galaxy[quadx][quady].supernova)
+                       attack(0);
+                   if (alldone) return;
+               }
+               /* compute final position -- new quadrant and sector */
+               x = QUADSIZE*(quadx-1)+sectx;
+               y = QUADSIZE*(quady-1)+secty;
+               ix = x+10.0*dist*bigger*deltax+0.5;
+               iy = y+10.0*dist*bigger*deltay+0.5;
+               /* check for edge of galaxy */
+               kinks = 0;
+               do {
+                   kink = 0;
+                   if (ix <= 0) {
+                       ix = -ix + 1;
+                       kink = 1;
+                   }
+                   if (iy <= 0) {
+                       iy = -iy + 1;
+                       kink = 1;
+                   }
+                   if (ix > GALSIZE*QUADSIZE) {
+                       ix = (GALSIZE*QUADSIZE*2)+1 - ix;
+                       kink = 1;
+                   }
+                   if (iy > GALSIZE*QUADSIZE) {
+                       iy = (GALSIZE*QUADSIZE*2)+1 - iy;
+                       kink = 1;
+                   }
+                   if (kink) kinks = 1;
+               } while (kink);
+
+               if (kinks) {
+                   nkinks += 1;
+                   if (nkinks == 3) {
+                       /* Three strikes -- you're out! */
+                       finish(FNEG3);
+                       return;
+                   }
+                   skip(1);
+                   prout("YOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER");
+                   prout("AT THE EDGE OF THE GALAXY.  THE THIRD TIME YOU TRY THIS,");
+                   prout("YOU WILL BE DESTROYED.");
+               }
+               /* Compute final position in new quadrant */
+               if (trbeam) return; /* Don't bother if we are to be beamed */
+               quadx = (ix+(QUADSIZE-1))/QUADSIZE;
+               quady = (iy+(QUADSIZE-1))/QUADSIZE;
+               sectx = ix - QUADSIZE*(quadx-1);
+               secty = iy - QUADSIZE*(quady-1);
+               skip(1);
+               prout("Entering %s.",
+                     cramlc(quadrant, quadx, quady));
+               game.quad[sectx][secty] = ship;
+               newqad(0);
+               if (skill>SKILL_NOVICE) attack(0);
+               return;
+           }
+           iquad = game.quad[ix][iy];
+           if (iquad != IHDOT) {
+               /* object encountered in flight path */
+               stopegy = 50.0*dist/Time;
+               dist=0.1*sqrt((sectx-ix)*(double)(sectx-ix) +
+                             (secty-iy)*(double)(secty-iy));
+               switch (iquad) {
+               case IHT: /* Ram a Tholian */
+               case IHK: /* Ram enemy ship */
+               case IHC:
+               case IHS:
+               case IHR:
+               case IHQUEST:
+                   sectx = ix;
+                   secty = iy;
+                   ram(0, iquad, sectx, secty);
+                   finalx = sectx;
+                   finaly = secty;
+                   break;
+               case IHBLANK:
+                   skip(1);
+                   prouts("***RED ALERT!  RED ALERT!");
+                   skip(1);
+                   proutn("***");
+                   crmshp();
+                   proutn(" pulled into black hole at ");
+                   prout(cramlc(sector, ix, iy));
+                   /*
+                    * Getting pulled into a black hole was certain
+                    * death in Almy's original.  Stas Sergeev added a
+                    * possibility that you'll get timewarped instead.
+                    */
+                   n=0;
+                   for (l=0;l<NDEVICES;l++)
+                       if (game.damage[l]>0) 
+                           n++;
+                   probf=pow(1.4,(energy+shield)/5000.0-1.0)*pow(1.3,1.0/(n+1)-1.0);
+                   if ((game.options & OPTION_BLKHOLE) && Rand()>probf) 
+                       timwrp();
+                   else 
+                       finish(FHOLE);
+                   return;
+               default:
+                   /* something else */
+                   skip(1);
+                   crmshp();
+                   if (iquad == IHWEB)
+                       proutn(" encounters Tholian web at ");
+                   else
+                       proutn(" blocked by object at ");
+                   proutn(cramlc(sector, ix,iy));
+                   prout(";");
+                   proutn("Emergency stop required ");
+                   prout("%2d units of energy.", (int)stopegy);
+                   energy -= stopegy;
+                   finalx = x-deltax+0.5;
+                   sectx = finalx;
+                   finaly = y-deltay+0.5;
+                   secty = finaly;
+                   if (energy <= 0) {
+                       finish(FNRG);
+                       return;
+                   }
+                   break;
+               }
+               goto no_quad_change;    /* sorry! */
+           }
+       }
+       dist = 0.1*sqrt((sectx-ix)*(double)(sectx-ix) +
+                       (secty-iy)*(double)(secty-iy));
+       sectx = ix;
+       secty = iy;
+    }
+    finalx = sectx;
+    finaly = secty;
+no_quad_change:
+    /* No quadrant change -- compute new avg enemy distances */
+    game.quad[sectx][secty] = ship;
+    if (nenhere) {
+       for_local_enemies(l) {
+           finald = sqrt((ix-game.kx[l])*(double)(ix-game.kx[l]) +
+                         (iy-game.ky[l])*(double)(iy-game.ky[l]));
+           game.kavgd[l] = 0.5 * (finald+game.kdist[l]);
+           game.kdist[l] = finald;
+       }
+       sortkl();
+       if (!game.state.galaxy[quadx][quady].supernova && iattak == 0)
+           attack(0);
+       for_local_enemies(l) game.kavgd[l] = game.kdist[l];
+    }
+    newcnd();
+    iattak = 0;
+    drawmaps(0);
+    setwnd(message_window);
+    return;
+}
+
+void dock(int l) 
+{
+    chew();
+    if (condit == IHDOCKED && l) {
+       prout("Already docked.");
+       return;
+    }
+    if (inorbit) {
+       prout("You must first leave standard orbit.");
+       return;
+    }
+    if (basex==0 || abs(sectx-basex) > 1 || abs(secty-basey) > 1) {
+       crmshp();
+       prout(" not adjacent to base.");
+       return;
+    }
+    condit = IHDOCKED;
+    if (l) prout("Docked.");
+    ididit=1;
+    if (energy < inenrg) energy = inenrg;
+    shield = inshld;
+    torps = intorps;
+    lsupres = inlsr;
+    if (game.damage[DRADIO] == 0.0 &&
+       (game.future[FCDBAS] < FOREVER || isatb == 1) && iseenit == 0) {
+       /* get attack report from base */
+       prout("Lt. Uhura- \"Captain, an important message from the starbase:\"");
+       attakreport(0);
+       iseenit = 1;
+    }
+}
+
+static void getcd(int isprobe, int akey) {
+       /* This program originally required input in terms of a (clock)
+          direction and distance. Somewhere in history, it was changed to
+          cartesian coordinates. So we need to convert. I think
+          "manual" input should still be done this way -- it's a real
+          pain if the computer isn't working! Manual mode is still confusing
+          because it involves giving x and y motions, yet the coordinates
+          are always displayed y - x, where +y is downward! */
+
+       
+        int irowq=quadx, icolq=quady, irows, icols, itemp=0, iprompt=0, key=0;
+       double xi, xj, xk, xl;
+       double deltax, deltay;
+       int automatic = -1;
+
+       /* Get course direction and distance. If user types bad values, return
+          with DIREC = -1.0. */
+
+       direc = -1.0;
+       
+       if (landed == 1 && !isprobe) {
+               prout("Dummy! You can't leave standard orbit until you");
+               proutn("are back aboard the ");
+               crmshp();
+               prout(".");
+               chew();
+               return;
+       }
+       while (automatic == -1) {
+               if (game.damage[DCOMPTR]) {
+                       if (isprobe)
+                               prout("Computer damaged; manual navigation only");
+                       else
+                               prout("Computer damaged; manual movement only");
+                       chew();
+                       automatic = 0;
+                       key = IHEOL;
+                       break;
+               }
+               if (isprobe && akey != -1) {
+                       /* For probe launch, use pre-scaned value first time */
+                       key = akey;
+                       akey = -1;
+               }
+               else 
+                       key = scan();
+
+               if (key == IHEOL) {
+                       proutn("Manual or automatic- ");
+                       iprompt = 1;
+                       chew();
+               }
+               else if (key == IHALPHA) {
+                       if (isit("manual")) {
+                               automatic =0;
+                               key = scan();
+                               break;
+                       }
+                       else if (isit("automatic")) {
+                               automatic = 1;
+                               key = scan();
+                               break;
+                       }
+                       else {
+                               huh();
+                               chew();
+                               return;
+                       }
+               }
+               else { /* numeric */
+                       if (isprobe)
+                               prout("(Manual navigation assumed.)");
+                       else
+                               prout("(Manual movement assumed.)");
+                       automatic = 0;
+                       break;
+               }
+       }
+
+       if (automatic) {
+               while (key == IHEOL) {
+                       if (isprobe)
+                               proutn("Target quadrant or quadrant&sector- ");
+                       else
+                               proutn("Destination sector or quadrant&sector- ");
+                       chew();
+                       iprompt = 1;
+                       key = scan();
+               }
+
+               if (key != IHREAL) {
+                       huh();
+                       return;
+               }
+               xi = aaitem;
+               key = scan();
+               if (key != IHREAL){
+                       huh();
+                       return;
+               }
+               xj = aaitem;
+               key = scan();
+               if (key == IHREAL) {
+                       /* both quadrant and sector specified */
+                       xk = aaitem;
+                       key = scan();
+                       if (key != IHREAL) {
+                               huh();
+                               return;
+                       }
+                       xl = aaitem;
+
+                       irowq = xi + 0.5;
+                       icolq = xj + 0.5;
+                       irows = xk + 0.5;
+                       icols = xl + 0.5;
+               }
+               else {
+                       if (isprobe) {
+                               /* only quadrant specified -- go to center of dest quad */
+                               irowq = xi + 0.5;
+                               icolq = xj + 0.5;
+                               irows = icols = 5;
+                       }
+                       else {
+                               irows = xi + 0.5;
+                               icols = xj + 0.5;
+                       }
+                       itemp = 1;
+               }
+               if (!VALID_QUADRANT(icolq,irowq)||!VALID_SECTOR(icols,irows)) {
+                   huh();
+                   return;
+               }
+               skip(1);
+               if (!isprobe) {
+                       if (itemp) {
+                               if (iprompt) {
+                                       prout("Helmsman Sulu- \"Course locked in for %s.\"",
+                                               cramlc(sector, irows, icols));
+                               }
+                       }
+                       else prout("Ensign Chekov- \"Course laid in, Captain.\"");
+               }
+               deltax = icolq - quady + 0.1*(icols-secty);
+               deltay = quadx - irowq + 0.1*(sectx-irows);
+       }
+       else { /* manual */
+               while (key == IHEOL) {
+                       proutn("X and Y displacements- ");
+                       chew();
+                       iprompt = 1;
+                       key = scan();
+               }
+               itemp = 2;
+               if (key != IHREAL) {
+                       huh();
+                       return;
+               }
+               deltax = aaitem;
+               key = scan();
+               if (key != IHREAL) {
+                       huh();
+                       return;
+               }
+               deltay = aaitem;
+       }
+       /* Check for zero movement */
+       if (deltax == 0 && deltay == 0) {
+               chew();
+               return;
+       }
+       if (itemp == 2 && !isprobe) {
+               skip(1);
+               prout("Helmsman Sulu- \"Aye, Sir.\"");
+       }
+       dist = sqrt(deltax*deltax + deltay*deltay);
+       direc = atan2(deltax, deltay)*1.90985932;
+       if (direc < 0.0) direc += 12.0;
+       chew();
+       return;
+
+}
+               
+
+
+void impuls(void) 
+{
+    double power;
+
+    ididit = 0;
+    if (game.damage[DIMPULS]) {
+       chew();
+       skip(1);
+       prout("Engineer Scott- \"The impulse engines are damaged, Sir.\"");
+       return;
+    }
+
+    if (energy > 30.0) {
+       getcd(FALSE, 0);
+       if (direc == -1.0) return;
+       power = 20.0 + 100.0*dist;
+    }
+    else
+       power = 30.0;
+
+    if (power >= energy) {
+       /* Insufficient power for trip */
+       skip(1);
+       prout("First Officer Spock- \"Captain, the impulse engines");
+       prout("require 20.0 units to engage, plus 100.0 units per");
+       if (energy > 30) {
+           proutn("quadrant.  We can go, therefore, a maximum of %d", 
+                  (int)(0.01 * (energy-20.0)-0.05));
+           prout(" quadrants.\"");
+       }
+       else {
+           prout("quadrant.  They are, therefore, useless.\"");
+       }
+       chew();
+       return;
+    }
+    /* Make sure enough time is left for the trip */
+    Time = dist/0.095;
+    if (Time >= game.state.remtime) {
+       prout("First Officer Spock- \"Captain, our speed under impulse");
+       prout("power is only 0.95 sectors per stardate. Are you sure");
+       proutn("we dare spend the time?\" ");
+       if (ja() == 0) return;
+    }
+    /* Activate impulse engines and pay the cost */
+    imove();
+    ididit = 1;
+    if (alldone) return;
+    power = 20.0 + 100.0*dist;
+    energy -= power;
+    Time = dist/0.095;
+    if (energy <= 0) finish(FNRG);
+    return;
+}
+
+
+void warp(int i) 
+{
+    int blooey=0, twarp=0, iwarp;
+    double power;
+
+    if (i!=2) { /* Not WARPX entry */
+       ididit = 0;
+       if (game.damage[DWARPEN] > 10.0) {
+           chew();
+           skip(1);
+           prout("Engineer Scott- \"The impulse engines are damaged, Sir.\"");
+           return;
+       }
+       if (game.damage[DWARPEN] > 0.0 && warpfac > 4.0) {
+           chew();
+           skip(1);
+           prout("Engineer Scott- \"Sorry, Captain. Until this damage");
+           prout("  is repaired, I can only give you warp 4.\"");
+           return;
+       }
+                       
+       /* Read in course and distance */
+       getcd(FALSE, 0);
+       if (direc == -1.0) return;
+
+       /* Make sure starship has enough energy for the trip */
+       power = (dist+0.05)*warpfac*warpfac*warpfac*(shldup+1);
+
+
+       if (power >= energy) {
+           /* Insufficient power for trip */
+           ididit = 0;
+           skip(1);
+           prout("Engineering to bridge--");
+           if (shldup==0 || 0.5*power > energy) {
+               iwarp = pow((energy/(dist+0.05)), 0.333333333);
+               if (iwarp <= 0) {
+                   prout("We can't do it, Captain. We haven't the energy.");
+               }
+               else {
+                   proutn("We haven't the energy, but we could do it at warp %d", iwarp);
+                   if (shldup) {
+                       prout(",");
+                       prout("if you'll lower the shields.");
+                   }
+                   else
+                       prout(".");
+               }
+           }
+           else
+               prout("We haven't the energy to go that far with the shields up.");
+           return;
+       }
+                                               
+       /* Make sure enough time is left for the trip */
+       Time = 10.0*dist/wfacsq;
+       if (Time >= 0.8*game.state.remtime) {
+           skip(1);
+           prout("First Officer Spock- \"Captain, I compute that such");
+           proutn("  a trip would require approximately %2.0f",
+                  100.0*Time/game.state.remtime);
+           prout(" percent of our");
+           proutn("  remaining time.  Are you sure this is wise?\" ");
+           if (ja() == 0) { ididit = 0; Time=0; return;}
+       }
+    }
+    /* Entry WARPX */
+    if (warpfac > 6.0) {
+       /* Decide if engine damage will occur */
+       double prob = dist*(6.0-warpfac)*(6.0-warpfac)/66.666666666;
+       if (prob > Rand()) {
+           blooey = 1;
+           dist = Rand()*dist;
+       }
+       /* Decide if time warp will occur */
+       if (0.5*dist*pow(7.0,warpfac-10.0) > Rand()) twarp=1;
+#ifdef DEBUG
+       if (idebug &&warpfac==10 && twarp==0) {
+           blooey=0;
+           proutn("Force time warp? ");
+           if (ja()==1) twarp=1;
+       }
+#endif
+       if (blooey || twarp) {
+           /* If time warp or engine damage, check path */
+           /* If it is obstructed, don't do warp or damage */
+           double angle = ((15.0-direc)*0.5235998);
+           double deltax = -sin(angle);
+           double deltay = cos(angle);
+           double bigger, x, y;
+           int n, l, ix, iy;
+           if (fabs(deltax) > fabs(deltay))
+               bigger = fabs(deltax);
+           else
+               bigger = fabs(deltay);
+                       
+           deltax /= bigger;
+           deltay /= bigger;
+           n = 10.0 * dist * bigger +0.5;
+           x = sectx;
+           y = secty;
+           for (l = 1; l <= n; l++) {
+               x += deltax;
+               ix = x + 0.5;
+               y += deltay;
+               iy = y +0.5;
+               if (!VALID_SECTOR(ix, iy)) break;
+               if (game.quad[ix][iy] != IHDOT) {
+                   blooey = 0;
+                   twarp = 0;
+               }
+           }
+       }
+    }
+                               
+
+    /* Activate Warp Engines and pay the cost */
+    imove();
+    if (alldone) return;
+    energy -= dist*warpfac*warpfac*warpfac*(shldup+1);
+    if (energy <= 0) finish(FNRG);
+    Time = 10.0*dist/wfacsq;
+    if (twarp) timwrp();
+    if (blooey) {
+       game.damage[DWARPEN] = damfac*(3.0*Rand()+1.0);
+       skip(1);
+       prout("Engineering to bridge--");
+       prout("  Scott here.  The warp engines are damaged.");
+       prout("  We'll have to reduce speed to warp 4.");
+    }
+    ididit = 1;
+    return;
+}
+
+
+
+void setwrp(void) 
+{
+    int key;
+    double oldfac;
+       
+    while ((key=scan()) == IHEOL) {
+       chew();
+       proutn("Warp factor- ");
+    }
+    chew();
+    if (key != IHREAL) {
+       huh();
+       return;
+    }
+    if (game.damage[DWARPEN] > 10.0) {
+       prout("Warp engines inoperative.");
+       return;
+    }
+    if (game.damage[DWARPEN] > 0.0 && aaitem > 4.0) {
+       prout("Engineer Scott- \"I'm doing my best, Captain,");
+       prout("  but right now we can only go warp 4.\"");
+       return;
+    }
+    if (aaitem > 10.0) {
+       prout("Helmsman Sulu- \"Our top speed is warp 10, Captain.\"");
+       return;
+    }
+    if (aaitem < 1.0) {
+       prout("Helmsman Sulu- \"We can't go below warp 1, Captain.\"");
+       return;
+    }
+    oldfac = warpfac;
+    warpfac = aaitem;
+    wfacsq=warpfac*warpfac;
+    if (warpfac <= oldfac || warpfac <= 6.0) {
+       proutn("Helmsman Sulu- \"Warp factor %d, Captain.\"", 
+              (int)warpfac);
+       return;
+    }
+    if (warpfac < 8.00) {
+       prout("Engineer Scott- \"Aye, but our maximum safe speed is warp 6.\"");
+       return;
+    }
+    if (warpfac == 10.0) {
+       prout("Engineer Scott- \"Aye, Captain, we'll try it.\"");
+       return;
+    }
+    prout("Engineer Scott- \"Aye, Captain, but our engines may not take it.\"");
+    return;
+}
+
+void atover(int igrab) 
+{
+    double power, distreq;
+
+    chew();
+    /* is captain on planet? */
+    if (landed==1) {
+       if (game.damage[DTRANSP]) {
+           finish(FPNOVA);
+           return;
+       }
+       prout("Scotty rushes to the transporter controls.");
+       if (shldup) {
+           prout("But with the shields up it's hopeless.");
+           finish(FPNOVA);
+       }
+       prouts("His desperate attempt to rescue you . . .");
+       if (Rand() <= 0.5) {
+           prout("fails.");
+           finish(FPNOVA);
+           return;
+       }
+       prout("SUCCEEDS!");
+       if (imine) {
+           imine = 0;
+           proutn("The crystals mined were ");
+           if (Rand() <= 0.25) {
+               prout("lost.");
+           }
+           else {
+               prout("saved.");
+               icrystl = 1;
+           }
+       }
+    }
+    if (igrab) return;
+
+    /* Check to see if captain in shuttle craft */
+    if (icraft) finish(FSTRACTOR);
+    if (alldone) return;
+
+    /* Inform captain of attempt to reach safety */
+    skip(1);
+    do {
+       if (justin) {
+           prouts("***RED ALERT!  READ ALERT!");
+           skip(1);
+           proutn("The ");
+           crmshp();
+           prout(" has stopped in a quadrant containing");
+           prouts("   a supernova.");
+           skip(2);
+       }
+       proutn("***Emergency automatic override attempts to hurl ");
+       crmshp();
+       skip(1);
+       prout("safely out of quadrant.");
+       if (game.damage[DRADIO] == 0.0)
+           game.state.galaxy[quadx][quady].charted = TRUE;
+       /* Try to use warp engines */
+       if (game.damage[DWARPEN]) {
+           skip(1);
+           prout("Warp engines damaged.");
+           finish(FSNOVAED);
+           return;
+       }
+       warpfac = 6.0+2.0*Rand();
+       wfacsq = warpfac * warpfac;
+       prout("Warp factor set to %d", (int)warpfac);
+       power = 0.75*energy;
+       dist = power/(warpfac*warpfac*warpfac*(shldup+1));
+       distreq = 1.4142+Rand();
+       if (distreq < dist) dist = distreq;
+       Time = 10.0*dist/wfacsq;
+       direc = 12.0*Rand();    /* How dumb! */
+       justin = 0;
+       inorbit = 0;
+       warp(2);
+       if (justin == 0) {
+           /* This is bad news, we didn't leave quadrant. */
+           if (alldone) return;
+           skip(1);
+           prout("Insufficient energy to leave quadrant.");
+           finish(FSNOVAED);
+           return;
+       }
+    } while 
+       /* Repeat if another snova */
+       (game.state.galaxy[quadx][quady].supernova);
+    if (KLINGREM==0) 
+       finish(FWON); /* Snova killed remaining enemy. */
+}
+
+void timwrp() 
+{
+    int l, gotit;
+    prout("***TIME WARP ENTERED.");
+    if (game.state.snap && Rand() < 0.5) {
+       /* Go back in time */
+       prout("You are traveling backwards in time %d stardates.",
+             (int)(game.state.date-game.snapsht.date));
+       game.state = game.snapsht;
+       game.state.snap = 0;
+       if (game.state.remcom) {
+           game.future[FTBEAM] = game.state.date + expran(intime/game.state.remcom);
+           game.future[FBATTAK] = game.state.date + expran(0.3*intime);
+       }
+       game.future[FSNOVA] = game.state.date + expran(0.5*intime);
+       game.future[FSNAP] = game.state.date +expran(0.25*game.state.remtime); /* next snapshot will
+                                                                                 be sooner */
+       if (game.state.nscrem) game.future[FSCMOVE] = 0.2777;
+       isatb = 0;
+       game.future[FCDBAS] = game.future[FSCDBAS] = FOREVER;
+       batx = baty = 0;
+
+       /* Make sure Galileo is consistant -- Snapshot may have been taken
+          when on planet, which would give us two Galileos! */
+       gotit = 0;
+       for (l = 0; l < inplan; l++) {
+           if (game.state.plnets[l].known == shuttle_down) {
+               gotit = 1;
+               if (iscraft==1 && ship==IHE) {
+                   prout("Checkov-  \"Security reports the Galileo has disappeared, Sir!");
+                   iscraft = 0;
+               }
+           }
+       }
+       /* Likewise, if in the original time the Galileo was abandoned, but
+          was on ship earlier, it would have vanished -- lets restore it */
+       if (iscraft==0 && gotit==0 && game.damage[DSHUTTL] >= 0.0) {
+           prout("Checkov-  \"Security reports the Galileo has reappeared in the dock!\"");
+           iscraft = 1;
+       }
+       /* 
+        * There used to be code to do the actual reconstrction here,
+        * but the starchart is now part of the snapshotted galaxy state.
+        */
+       prout("Spock has reconstructed a correct star chart from memory");
+    }
+    else {
+       /* Go forward in time */
+       Time = -0.5*intime*log(Rand());
+       prout("You are traveling forward in time %d stardates.", (int)Time);
+       /* cheat to make sure no tractor beams occur during time warp */
+       game.future[FTBEAM] += Time;
+       game.damage[DRADIO] += Time;
+    }
+    newqad(0);
+    events();  /* Stas Sergeev added this -- do pending events */
+}
+
+void probe(void) 
+{
+    double angle, bigger;
+    int key;
+    /* New code to launch a deep space probe */
+    if (nprobes == 0) {
+       chew();
+       skip(1);
+       if (ship == IHE) 
+           prout("Engineer Scott- \"We have no more deep space probes, Sir.\"");
+       else
+           prout("Ye Faerie Queene has no deep space probes.");
+       return;
+    }
+    if (game.damage[DDSP] != 0.0) {
+       chew();
+       skip(1);
+       prout("Engineer Scott- \"The probe launcher is damaged, Sir.\"");
+       return;
+    }
+    if (game.future[FDSPROB] != FOREVER) {
+       chew();
+       skip(1);
+       if (game.damage[DRADIO] != 0 && condit != IHDOCKED) {
+           prout("Spock-  \"Records show the previous probe has not yet");
+           prout("   reached its destination.\"");
+       }
+       else
+           prout("Uhura- \"The previous probe is still reporting data, Sir.\"");
+       return;
+    }
+    key = scan();
+
+    if (key == IHEOL) {
+       /* slow mode, so let Kirk know how many probes there are left */
+       prout(nprobes==1 ? "%d probe left." : "%d probes left.", nprobes);
+       proutn("Are you sure you want to fire a probe? ");
+       if (ja()==0) return;
+    }
+
+    isarmed = FALSE;
+    if (key == IHALPHA && strcmp(citem,"armed") == 0) {
+       isarmed = TRUE;
+       key = scan();
+    }
+    else if (key == IHEOL) {
+       proutn("Arm NOVAMAX warhead? ");
+       isarmed = ja();
+    }
+    getcd(TRUE, key);
+    if (direc == -1.0) return;
+    nprobes--;
+    angle = ((15.0 - direc) * 0.5235988);
+    probeinx = -sin(angle);
+    probeiny = cos(angle);
+    if (fabs(probeinx) > fabs(probeiny))
+       bigger = fabs(probeinx);
+    else
+       bigger = fabs(probeiny);
+               
+    probeiny /= bigger;
+    probeinx /= bigger;
+    proben = 10.0*dist*bigger +0.5;
+    probex = quadx*QUADSIZE + sectx - 1;       // We will use better packing than original
+    probey = quady*QUADSIZE + secty - 1;
+    probecx = quadx;
+    probecy = quady;
+    game.future[FDSPROB] = game.state.date + 0.01; // Time to move one sector
+    prout("Ensign Chekov-  \"The deep space probe is launched, Captain.\"");
+    ididit = 1;
+    return;
+}
+
+void help(void) 
+{
+    /* There's more than one way to move in this game! */
+    double ddist, xdist, probf;
+    int line = 0, l, ix, iy;
+
+    chew();
+    /* Test for conditions which prevent calling for help */
+    if (condit == IHDOCKED) {
+       prout("Lt. Uhura-  \"But Captain, we're already docked.\"");
+       return;
+    }
+    if (game.damage[DRADIO] != 0) {
+       prout("Subspace radio damaged.");
+       return;
+    }
+    if (game.state.rembase==0) {
+       prout("Lt. Uhura-  \"Captain, I'm not getting any response from Starbase.\"");
+       return;
+    }
+    if (landed == 1) {
+       proutn("You must be aboard the ");
+       crmshp();
+       prout(".");
+       return;
+    }
+    /* OK -- call for help from nearest starbase */
+    nhelp++;
+    if (basex!=0) {
+       /* There's one in this quadrant */
+       ddist = sqrt(square(basex-sectx)+square(basey-secty));
+    }
+    else {
+       ddist = FOREVER;
+       for_starbases(l) {
+           xdist=10.0*sqrt(square(game.state.baseqx[l]-quadx)+square(game.state.baseqy[l]-quady));
+           if (xdist < ddist) {
+               ddist = xdist;
+               line = l;
+           }
+       }
+       /* Since starbase not in quadrant, set up new quadrant */
+       quadx = game.state.baseqx[line];
+       quady = game.state.baseqy[line];
+       newqad(1);
+    }
+    /* dematerialize starship */
+    game.quad[sectx][secty]=IHDOT;
+    proutn("Starbase in %s responds--", cramlc(quadrant, quadx, quady));
+    proutn("");
+    crmshp();
+    prout(" dematerializes.");
+    sectx=0;
+    for (l = 1; l <= 5; l++) {
+       ix = basex+3.0*Rand()-1;
+       iy = basey+3.0*Rand()-1;
+       if (VALID_SECTOR(ix,iy) && game.quad[ix][iy]==IHDOT) {
+           /* found one -- finish up */
+           sectx=ix;
+           secty=iy;
+           break;
+       }
+    }
+    if (sectx==0){
+       prout("You have been lost in space...");
+       finish(FMATERIALIZE);
+       return;
+    }
+    /* Give starbase three chances to rematerialize starship */
+    probf = pow((1.0 - pow(0.98,ddist)), 0.33333333);
+    for (l = 1; l <= 3; l++) {
+       switch (l) {
+       case 1: proutn("1st"); break;
+       case 2: proutn("2nd"); break;
+       case 3: proutn("3rd"); break;
+       }
+       proutn(" attempt to re-materialize ");
+       crmshp();
+       switch (l){
+       case 1: game.quad[ix][iy]=IHMATER0;
+           break;
+       case 2: game.quad[ix][iy]=IHMATER1;
+           break;
+       case 3: game.quad[ix][iy]=IHMATER2;
+           break;
+       }
+       textcolor(RED);
+       warble();
+       if (Rand() > probf) break;
+       prout("fails.");
+       delay(500);
+       textcolor(DEFAULT);
+    }
+    if (l > 3) {
+       game.quad[ix][iy]=IHQUEST;
+       alive = 0;
+       drawmaps(1);
+       setwnd(message_window);
+       finish(FMATERIALIZE);
+       return;
+    }
+    game.quad[ix][iy]=ship;
+    textcolor(GREEN);
+    prout("succeeds.");
+    textcolor(DEFAULT);
+    dock(0);
+    skip(1);
+    prout("Lt. Uhura-  \"Captain, we made it!\"");
+}
diff --git a/src/planets.c b/src/planets.c
new file mode 100644 (file)
index 0000000..217ce14
--- /dev/null
@@ -0,0 +1,506 @@
+#include "sst.h"
+
+static char *classes[] = {"M","N","O"};
+
+static int consumeTime(void) 
+{
+/* I think most of this avoidance was caused by overlay scheme.
+   Let's see what happens if all events can occur here */
+
+//  double asave;
+    ididit = 1;
+#if 0
+    /* Don't worry about this */
+    if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {
+       /* We are about to be tractor beamed -- operation fails */
+       return 1;
+    }
+#endif
+//     asave = future[FSNOVA];
+//     future[FSNOVA] = FOREVER; /* defer supernovas */
+    events();  /* Used to avoid if future[FSCMOVE] within time */
+//     future[FSNOVA] = asave;
+    /*fails if game over, quadrant super-novas or we've moved to new quadrant*/
+    if (alldone || game.state.galaxy[quadx][quady].supernova || justin != 0) return 1;
+    return 0;
+}
+
+void preport(void) 
+{
+    int iknow = 0, i;
+    skip(1);
+    chew();
+    prout("Spock-  \"Planet report follows, Captain.\"");
+    skip(1);
+    for (i = 0; i < inplan; i++) {
+       if (game.state.plnets[i].known != unknown
+#ifdef DEBUG
+           || ( idebug && game.state.plnets[i].x !=0)
+#endif
+           ) {
+           iknow = 1;
+#ifdef DEBUG
+           if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) ");
+#endif
+           proutn(cramlc(quadrant, game.state.plnets[i].x, game.state.plnets[i].y));
+           proutn("   class ");
+           proutn(classes[game.state.plnets[i].pclass]);
+           proutn("   ");
+           if (game.state.plnets[i].crystals == 0) proutn("no ");
+           prout("dilithium crystals present.");
+           if (game.state.plnets[i].known==shuttle_down) 
+               prout("    Shuttle Craft Galileo on surface.");
+       }
+    }
+    if (iknow==0) prout("No information available.");
+}
+
+void orbit(void) 
+{
+    skip(1);
+    chew();
+    if (inorbit!=0) {
+       prout("Already in standard orbit.");
+       return;
+    }
+    if (game.damage[DWARPEN] != 0 && game.damage[DIMPULS] != 0) {
+       prout("Both warp and impulse engines damaged.");
+       return;
+    }
+    if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {
+       crmshp();
+       prout(" not adjacent to planet.");
+       skip(1);
+       return;
+    }
+    Time = 0.02+0.03*Rand();
+    prout("Helmsman Sulu-  \"Entering standard orbit, Sir.\"");
+    newcnd();
+    if (consumeTime()) return;
+    game.height = (1400.0+7200.0*Rand());
+    prout("Sulu-  \"Entered orbit at altitude %.2f kilometers.\"", game.height);
+    inorbit = 1;
+    ididit=1;
+}
+
+void sensor(void) 
+{
+    skip(1);
+    chew();
+    if (game.damage[DSRSENS] != 0.0) {
+       prout("Short range sensors damaged.");
+       return;
+    }
+    if (!plnetx && (game.options & OPTION_TTY)) {
+       prout("Spock- \"No planet in this quadrant, Captain.\"");
+       return;
+    }
+    if ((plnetx != 0)&& (game.state.plnets[iplnet].known == unknown)) {
+       prout("Spock-  \"Sensor scan for %s-", cramlc(quadrant, quadx, quady));
+       skip(1);
+       prout("         Planet at %s is of class %s.", 
+             cramlc(sector, plnetx, plnety),
+             classes[game.state.plnets[iplnet].pclass]);
+       if (game.state.plnets[iplnet].known==shuttle_down) 
+           prout("         Sensors show Galileo still on surface.");
+       proutn("         Readings indicate");
+       if (game.state.plnets[iplnet].crystals == 0) proutn(" no");
+       prout(" dilithium crystals present.\"");
+       if (game.state.plnets[iplnet].known == unknown) game.state.plnets[iplnet].known = known;
+    }
+}
+
+void beam(void) 
+{
+    chew();
+    skip(1);
+    if (game.damage[DTRANSP] != 0) {
+       prout("Transporter damaged.");
+       if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) {
+           skip(1);
+           proutn("Spock-  \"May I suggest the shuttle craft, Sir?\" ");
+           if (ja() != 0) shuttle();
+       }
+       return;
+    }
+    if (inorbit==0) {
+       crmshp();
+       prout(" not in standard orbit.");
+       return;
+    }
+    if (shldup!=0) {
+       prout("Impossible to transport through shields.");
+       return;
+    }
+    if (game.state.plnets[iplnet].known==unknown) {
+       prout("Spock-  \"Captain, we have no information on this planet");
+       prout("  and Starfleet Regulations clearly state that in this situation");
+       prout("  you may not go down.\"");
+       return;
+    }
+    if (landed==1) {
+       /* Coming from planet */
+       if (game.state.plnets[iplnet].known==shuttle_down) {
+           proutn("Spock-  \"Wouldn't you rather take the Galileo?\" ");
+           if (ja() != 0) {
+               chew();
+               return;
+           }
+           prout("Your crew hides the Galileo to prevent capture by aliens.");
+       }
+       prout("Landing party assembled, ready to beam up.");
+       skip(1);
+       prout("Kirk whips out communicator...");
+       prouts("BEEP  BEEP  BEEP");
+       skip(2);
+       prout("\"Kirk to enterprise-  Lock on coordinates...energize.\"");
+    }
+    else {
+       /* Going to planet */
+       if (game.state.plnets[iplnet].crystals==0) {
+           prout("Spock-  \"Captain, I fail to see the logic in");
+           prout("  exploring a planet with no dilithium crystals.");
+           proutn("  Are you sure this is wise?\" ");
+           if (ja()==0) {
+               chew();
+               return;
+           }
+       }
+       prout("Scotty-  \"Transporter room ready, Sir.\"");
+       skip(1);
+       prout("Kirk, and landing party prepare to beam down to planet surface.");
+       skip(1);
+       prout("Kirk-  \"Energize.\"");
+    }
+    ididit=1;
+    skip(1);
+    prouts("WWHOOOIIIIIRRRRREEEE.E.E.  .  .  .  .   .    .");
+    skip(2);
+    if (Rand() > 0.98) {
+       prouts("BOOOIIIOOOIIOOOOIIIOIING . . .");
+       skip(2);
+       prout("Scotty-  \"Oh my God!  I've lost them.\"");
+       finish(FLOST);
+       return;
+    }
+    prouts(".    .   .  .  .  .  .E.E.EEEERRRRRIIIIIOOOHWW");
+    skip(2);
+    prout("Transport complete.");
+    landed = -landed;
+    if (landed==1 && game.state.plnets[iplnet].known==shuttle_down) {
+       prout("The shuttle craft Galileo is here!");
+    }
+    if (landed!=1 && imine==1) {
+       icrystl = 1;
+       cryprob = 0.05;
+    }
+    imine = 0;
+    return;
+}
+
+void mine(void) 
+{
+    skip(1);
+    chew();
+    if (landed!= 1) {
+       prout("Mining party not on planet.");
+       return;
+    }
+    if (game.state.plnets[iplnet].crystals == 0) {
+       prout("No dilithium crystals on this planet.");
+       return;
+    }
+    if (imine == 1) {
+       prout("You've already mined enough crystals for this trip.");
+       return;
+    }
+    if (icrystl == 1 && cryprob == 0.05) {
+       proutn("With all those fresh crystals aboard the ");
+       crmshp();
+       skip(1);
+       prout("there's no reason to mine more at this time.");
+       return;
+    }
+    Time = (0.1+0.2*Rand())*game.state.plnets[iplnet].pclass;
+    if (consumeTime()) return;
+    prout("Mining operation complete.");
+    imine = 1;
+    ididit=1;
+}
+
+void usecrystals(void) 
+{
+    ididit=0;
+    skip(1);
+    chew();
+    if (icrystl!=1) {
+       prout("No dilithium crystals available.");
+       return;
+    }
+    if (energy >= 1000) {
+       prout("Spock-  \"Captain, Starfleet Regulations prohibit such an operation");
+       prout("  except when condition Yellow exists.");
+       return;
+    }
+    prout("Spock- \"Captain, I must warn you that loading");
+    prout("  raw dilithium crystals into the ship's power");
+    prout("  system may risk a severe explosion.");
+    proutn("  Are you sure this is wise?\" ");
+    if (ja()==0) {
+       chew();
+       return;
+    }
+    skip(1);
+    prout("Engineering Officer Scott-  \"(GULP) Aye Sir.");
+    prout("  Mr. Spock and I will try it.\"");
+    skip(1);
+    prout("Spock-  \"Crystals in place, Sir.");
+    prout("  Ready to activate circuit.\"");
+    skip(1);
+    prouts("Scotty-  \"Keep your fingers crossed, Sir!\"");
+    skip(1);
+    if (Rand() <= cryprob) {
+       prouts("  \"Activating now! - - No good!  It's***");
+       skip(2);
+       prouts("***RED ALERT!  RED A*L********************************");
+       skip(1);
+       stars();
+       prouts("******************   KA-BOOM!!!!   *******************");
+       skip(1);
+       kaboom();
+       return;
+    }
+    energy += 5000.0*(1.0 + 0.9*Rand());
+    prouts("  \"Activating now! - - ");
+    prout("The instruments");
+    prout("   are going crazy, but I think it's");
+    prout("   going to work!!  Congratulations, Sir!\"");
+    cryprob *= 2.0;
+    ididit=1;
+}
+
+void shuttle(void) 
+{
+    chew();
+    skip(1);
+    if(game.damage[DSHUTTL] != 0.0) {
+       if (game.damage[DSHUTTL] == -1.0) {
+           if (inorbit && game.state.plnets[iplnet].known == shuttle_down)
+               prout("Ye Faerie Queene has no shuttle craft bay to dock it at.");
+           else
+               prout("Ye Faerie Queene had no shuttle craft.");
+       }
+       else if (game.damage[DSHUTTL] > 0)
+           prout("The Galileo is damaged.");
+       else prout("Shuttle craft is now serving Big Macs.");
+       return;
+    }
+    if (inorbit==0) {
+       crmshp();
+       prout(" not in standard orbit.");
+       return;
+    }
+    if ((game.state.plnets[iplnet].known != shuttle_down) && iscraft != 1) {
+       prout("Shuttle craft not currently available.");
+       return;
+    }
+    if (landed==-1 && game.state.plnets[iplnet].known==shuttle_down) {
+       prout("You will have to beam down to retrieve the shuttle craft.");
+       return;
+    }
+    if (shldup!=0 || condit == IHDOCKED) {
+       prout("Shuttle craft cannot pass through shields.");
+       return;
+    }
+    if (game.state.plnets[iplnet].known==unknown) {
+       prout("Spock-  \"Captain, we have no information on this planet");
+       prout("  and Starfleet Regulations clearly state that in this situation");
+       prout("  you may not fly down.\"");
+       return;
+    }
+    Time = 3.0e-5*game.height;
+    if (Time >= 0.8*game.state.remtime) {
+       prout("First Officer Spock-  \"Captain, I compute that such");
+       proutn("  a maneuver would require approximately 2d%% of our",
+              (int)(100*Time/game.state.remtime));
+       prout("remaining time.");
+       proutn("Are you sure this is wise?\" ");
+       if (ja()==0) {
+           Time = 0.0;
+           return;
+       }
+    }
+    if (landed == 1) {
+       /* Kirk on planet */
+       if (iscraft==1) {
+           /* Galileo on ship! */
+           if (game.damage[DTRANSP]==0) {
+               proutn("Spock-  \"Would you rather use the transporter?\" ");
+               if (ja() != 0) {
+                   beam();
+                   return;
+               }
+               proutn("Shuttle crew");
+           }
+           else
+               proutn("Rescue party");
+           prout(" boards Galileo and swoops toward planet surface.");
+           iscraft = 0;
+           skip(1);
+           if (consumeTime()) return;
+           game.state.plnets[iplnet].known=shuttle_down;
+           prout("Trip complete.");
+           return;
+       }
+       else {
+           /* Ready to go back to ship */
+           prout("You and your mining party board the");
+           prout("shuttle craft for the trip back to the Enterprise.");
+           skip(1);
+           prout("The short hop begins . . .");
+           game.state.plnets[iplnet].known=known;
+           icraft = 1;
+           skip(1);
+           landed = -1;
+           if (consumeTime()) return;
+           iscraft = 1;
+           icraft = 0;
+           if (imine!=0) {
+               icrystl = 1;
+               cryprob = 0.05;
+           }
+           imine = 0;
+           prout("Trip complete.");
+           return;
+       }
+    }
+    else {
+       /* Kirk on ship */
+       /* and so is Galileo */
+       prout("Mining party assembles in the hangar deck,");
+       prout("ready to board the shuttle craft \"Galileo\".");
+       skip(1);
+       prouts("The hangar doors open; the trip begins.");
+       skip(1);
+       icraft = 1;
+       iscraft = 0;
+       if (consumeTime()) return;
+       game.state.plnets[iplnet].known = shuttle_down;
+       landed = 1;
+       icraft = 0;
+       prout("Trip complete");
+       return;
+    }
+}
+
+void deathray(void) 
+{
+    double dprob, r = Rand();
+       
+    ididit = 0;
+    skip(1);
+    chew();
+    if (ship != IHE) {
+       prout("Ye Faerie Queene has no death ray.");
+       return;
+    }
+    if (nenhere==0) {
+       prout("Sulu-  \"But Sir, there are no enemies in this quadrant.\"");
+       return;
+    }
+    if (game.damage[DDRAY] > 0.0) {
+       prout("Death Ray is damaged.");
+       return;
+    }
+    prout("Spock-  \"Captain, the 'Experimental Death Ray'");
+    prout("  is highly unpredictible.  Considering the alternatives,");
+    proutn("  are you sure this is wise?\" ");
+    if (ja()==0) return;
+    prout("Spock-  \"Acknowledged.\"");
+    skip(1);
+    ididit=1;
+    prouts("WHOOEE ... WHOOEE ... WHOOEE ... WHOOEE");
+    skip(1);
+    prout("Crew scrambles in emergency preparation.");
+    prout("Spock and Scotty ready the death ray and");
+    prout("prepare to channel all ship's power to the device.");
+    skip(1);
+    prout("Spock-  \"Preparations complete, sir.\"");
+    prout("Kirk-  \"Engage!\"");
+    skip(1);
+    prouts("WHIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");
+    skip(1);
+    dprob = .30;
+    if (game.options & OPTION_PLAIN)
+       dprob = .5;
+    if (r > dprob) {
+       prouts("Sulu- \"Captain!  It's working!\"");
+       skip(2);
+       while (nenhere > 0)
+           deadkl(game.kx[1],game.ky[1],game.quad[game.kx[1]][game.ky[1]],game.kx[1],game.ky[1]);
+       prout("Ensign Chekov-  \"Congratulations, Captain!\"");
+       if (KLINGREM == 0) finish(FWON);
+       if ((game.options & OPTION_PLAIN) == 0) {
+           prout("Spock-  \"Captain, I believe the `Experimental Death Ray'");
+           if (Rand() <= 0.05) {
+               prout("   is still operational.\"");
+           }
+           else {
+               prout("   has been rendered nonfunctional.\"");
+               game.damage[DDRAY] = 39.95;
+           }
+       }
+       return;
+    }
+    r = Rand();        // Pick failure method 
+    if (r <= .30) {
+       prouts("Sulu- \"Captain!  It's working!\"");
+       skip(1);
+       prouts("***RED ALERT!  RED ALERT!");
+       skip(1);
+       prout("***MATTER-ANTIMATTER IMPLOSION IMMINENT!");
+       skip(1);
+       prouts("***RED ALERT!  RED A*L********************************");
+       skip(1);
+       stars();
+       prouts("******************   KA-BOOM!!!!   *******************");
+       skip(1);
+       kaboom();
+       return;
+    }
+    if (r <= .55) {
+       prouts("Sulu- \"Captain!  Yagabandaghangrapl, brachriigringlanbla!\"");
+       skip(1);
+       prout("Lt. Uhura-  \"Graaeek!  Graaeek!\"");
+       skip(1);
+       prout("Spock-  \"Fascinating!  . . . All humans aboard");
+       prout("  have apparently been transformed into strange mutations.");
+       prout("  Vulcans do not seem to be affected.");
+       skip(1);
+       prout("Kirk-  \"Raauch!  Raauch!\"");
+       finish(FDRAY);
+       return;
+    }
+    if (r <= 0.75) {
+       int i,j;
+       prouts("Sulu- \"Captain!  It's   --WHAT?!?!\"");
+       skip(2);
+       proutn("Spock-  \"I believe the word is");
+       prouts(" *ASTONISHING*");
+       prout(" Mr. Sulu.");
+       for_sectors(i)
+           for_sectors(j)
+               if (game.quad[i][j] == IHDOT) game.quad[i][j] = IHQUEST;
+       prout("  Captain, our quadrant is now infested with");
+       prouts(" - - - - - -  *THINGS*.");
+       skip(1);
+       prout("  I have no logical explanation.\"");
+       return;
+    }
+    prouts("Sulu- \"Captain!  The Death Ray is creating tribbles!\"");
+    skip(1);
+    prout("Scotty-  \"There are so many tribbles down here");
+    prout("  in Engineering, we can't move for 'em, Captain.\"");
+    finish(FTRIBBLE);
+    return;
+}
diff --git a/src/reports.c b/src/reports.c
new file mode 100644 (file)
index 0000000..f0dc134
--- /dev/null
@@ -0,0 +1,537 @@
+#include "sst.h"
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+void attakreport(int curt) 
+{
+    if (!curt) {
+       if (game.future[FCDBAS] < FOREVER) {
+           prout("Starbase in %s is currently under Commander attack.",
+                 cramlc(quadrant, batx, baty));
+           prout("It can hold out until Stardate %d.", 
+                 (int)game.future[FCDBAS]);
+       }
+       if (isatb == 1) {
+           prout("Starbase in %s is under Super-commander attack.",
+                 cramlc(quadrant, game.state.isx, game.state.isy));
+           prout("It can hold out until Stardate %d.", 
+                 (int)game.future[FSCDBAS]);
+       }
+    } else {
+        if (game.future[FCDBAS] < FOREVER)
+           proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]);
+        if (isatb == 1)
+           proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
+    }
+    clreol();
+}
+       
+
+void report(void) 
+{
+    char *s1,*s2,*s3;
+
+    chew();
+    s1 = (thawed?"thawed ":"");
+    switch (length) {
+    case 1: s2="short"; break;
+    case 2: s2="medium"; break;
+    case 4: s2="long"; break;
+    default: s2="unknown length"; break;
+    }
+    switch (skill) {
+    case SKILL_NOVICE: s3="novice"; break;
+    case SKILL_FAIR: s3="fair"; break;
+    case SKILL_GOOD: s3="good"; break;
+    case SKILL_EXPERT: s3="expert"; break;
+    case SKILL_EMERITUS: s3="emeritus"; break;
+    default: s3="skilled"; break;
+    }
+    prout("");
+    prout("You %s playing a %s%s %s game.",
+         alldone? "were": "are now", s1, s2, s3);
+    if (skill>SKILL_GOOD && thawed && !alldone) prout("No plaque is allowed.");
+    if (tourn) prout("This is tournament game %d.", tourn);
+    prout("Your secret password is \"%s\"",game.passwd);
+    proutn("%d of %d Klingons have been killed", KLINGKILLED, INKLINGTOT);
+    if (NKILLC) prout(", including %d Commander%s.", NKILLC, NKILLC==1?"":"s");
+    else if (NKILLK + NKILLSC > 0) prout(", but no Commanders.");
+    else prout(".");
+    if (skill > SKILL_FAIR) prout("The Super Commander has %sbeen destroyed.",
+                                 game.state.nscrem?"not ":"");
+    if (game.state.rembase != inbase) {
+       proutn("There ");
+       if (inbase-game.state.rembase==1) proutn("has been 1 base");
+       else {
+           proutn("have been %d bases", inbase-game.state.rembase);
+       }
+       prout(" destroyed, %d remaining.", game.state.rembase);
+    }
+    else prout("There are %d bases.", inbase);
+    if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
+       /* Don't report this if not seen and
+          either the radio is dead or not at base! */
+       attakreport(0);
+       iseenit = 1;
+    }
+    if (casual) prout("%d casualt%s suffered so far.",
+                     casual, casual==1? "y" : "ies");
+    if (nhelp) prout("There were %d call%s for help.",
+                    nhelp, nhelp==1 ? "" : "s");
+    if (ship == IHE) {
+       proutn("You have ");
+       if (nprobes) proutn("%d", nprobes);
+       else proutn("no");
+       proutn(" deep space probe");
+       if (nprobes!=1) proutn("s");
+       prout(".");
+    }
+    if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
+       game.future[FDSPROB] != FOREVER) {
+       if (isarmed) 
+           proutn("An armed deep space probe is in");
+       else
+           proutn("A deep space probe is in");
+       proutn(cramlc(quadrant, probecx, probecy));
+       prout(".");
+    }
+    if (icrystl) {
+       if (cryprob <= .05)
+           prout("Dilithium crystals aboard ship... not yet used.");
+       else {
+           int i=0;
+           double ai = 0.05;
+           while (cryprob > ai) {
+               ai *= 2.0;
+               i++;
+           }
+           prout("Dilithium crystals have been used %d time%s.",
+                 i, i==1? "" : "s");
+       }
+    }
+    skip(1);
+}
+       
+void lrscan(void) 
+{
+    int x, y;
+    chew();
+    if (game.damage[DLRSENS] != 0.0) {
+       /* Now allow base's sensors if docked */
+       if (condit != IHDOCKED) {
+           prout("LONG-RANGE SENSORS DAMAGED.");
+           return;
+       }
+       prout("Starbase's long-range scan");
+    }
+    else {
+       prout("Long-range scan");
+    }
+    for (x = quadx-1; x <= quadx+1; x++) {
+       proutn(" ");
+       for (y = quady-1; y <= quady+1; y++) {
+           if (!VALID_QUADRANT(x, y))
+               proutn("  -1");
+           else {
+               if (!game.damage[DRADIO])
+                   game.state.galaxy[x][y].charted = TRUE;
+               game.state.chart[x][y].klingons = game.state.galaxy[x][y].klingons;
+               game.state.chart[x][y].starbase = game.state.galaxy[x][y].starbase;
+               game.state.chart[x][y].stars = game.state.galaxy[x][y].stars;
+               if (game.state.galaxy[x][y].supernova) 
+                   proutn(" ***");
+               else
+                   proutn(" %3d", game.state.chart[x][y].klingons*100 + game.state.chart[x][y].starbase * 10 + game.state.chart[x][y].stars);
+           }
+       }
+       prout(" ");
+    }
+}
+
+void dreprt(void) 
+{
+    int jdam = FALSE, i;
+    chew();
+
+    for (i = 0; i < NDEVICES; i++) {
+       if (game.damage[i] > 0.0) {
+           if (!jdam) {
+               prout("DEVICE            -REPAIR TIMES-");
+               prout("                IN FLIGHT   DOCKED");
+               jdam = TRUE;
+           }
+           prout("  %16s %8.2f  %8.2f", 
+                 device[i],
+                 game.damage[i]+0.05,
+                 docfac*game.damage[i]+0.005);
+       }
+    }
+    if (!jdam) prout("All devices functional.");
+}
+
+void rechart(void)
+/* update the chart in the Enterprise's computer from galaxy data */
+{
+    int i, j;
+    lastchart = game.state.date;
+    for_quadrants(i)
+       for_quadrants(j) 
+           if (game.state.galaxy[i][j].charted) {
+               game.state.chart[i][j].klingons = game.state.galaxy[i][j].klingons;
+               game.state.chart[i][j].starbase = game.state.galaxy[i][j].starbase;
+               game.state.chart[i][j].stars = game.state.galaxy[i][j].stars;
+           }
+}
+
+void chart(int nn) 
+{
+    int i,j;
+    chew();
+
+    if (game.damage[DRADIO] == 0.0)
+       rechart();
+
+    if (lastchart < game.state.date && condit == IHDOCKED) {
+       prout("Spock-  \"I revised the Star Chart from the starbase's records.\"");
+       rechart();
+    }
+
+    if (nn == 0) prout("       STAR CHART FOR THE KNOWN GALAXY");
+    if (game.state.date > lastchart)
+       prout("(Last surveillance update %d stardates ago).",
+             (int)(game.state.date-lastchart));
+    prout("      1    2    3    4    5    6    7    8");
+    for_quadrants(i) {
+       proutn("%d |", i);
+       for_quadrants(j) {
+           char buf[4];
+           if ((game.options & OPTION_SHOWME) && i == quadx && j == quady)
+               proutn("<");
+           else
+               proutn(" ");
+           if (game.state.galaxy[i][j].supernova)
+               strcpy(buf, "***");
+           else if (!game.state.galaxy[i][j].charted && game.state.galaxy[i][j].starbase)
+               strcpy(buf, ".1.");
+           else if (game.state.galaxy[i][j].charted)
+               sprintf(buf, "%3d", game.state.chart[i][j].klingons*100 + game.state.chart[i][j].starbase * 10 + game.state.chart[i][j].stars);
+           else
+               strcpy(buf, "...");
+           proutn(buf);
+           if ((game.options & OPTION_SHOWME) && i == quadx && j == quady)
+               proutn(">");
+           else
+               proutn(" ");
+       }
+       proutn("  |");
+       if (i<GALSIZE) skip(1);
+    }
+}
+
+static void sectscan(int goodScan, int i, int j) 
+{
+    if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
+       if ((game.quad[i][j]==IHMATER0)||(game.quad[i][j]==IHMATER1)||(game.quad[i][j]==IHMATER2)||(game.quad[i][j]==IHE)||(game.quad[i][j]==IHF)){
+           switch (condit) {
+           case IHRED: textcolor(RED); break;
+           case IHGREEN: textcolor(GREEN); break;
+           case IHYELLOW: textcolor(YELLOW); break;
+           case IHDOCKED: textcolor(CYAN); break;
+           case IHDEAD: textcolor(BROWN);
+           }
+           if (game.quad[i][j] != ship) 
+               highvideo();
+       }
+       proutn("%c ",game.quad[i][j]);
+       textcolor(DEFAULT);
+    }
+    else
+       proutn("- ");
+}
+
+static void status(int req) 
+{
+    char *cp = NULL;
+    int t, dam = 0;
+    switch (req) {
+    case 1:
+       proutn("Stardate      %.1f, Time Left %.2f", game.state.date, game.state.remtime);
+       break;
+    case 2:
+       if (condit != IHDOCKED) newcnd();
+       switch (condit) {
+       case IHRED: cp = "RED"; break;
+       case IHGREEN: cp = "GREEN"; break;
+       case IHYELLOW: cp = "YELLOW"; break;
+       case IHDOCKED: cp = "DOCKED"; break;
+       case IHDEAD: cp="DEAD"; break;
+       }
+       for (t=0;t<NDEVICES;t++)
+           if (game.damage[t]>0) 
+               dam++;
+       proutn("Condition     %s, %i DAMAGES", cp, dam);
+       break;
+    case 3:
+       proutn("Position      %d - %d , %d - %d",
+              quadx, quady, sectx, secty);
+       break;
+    case 4:
+       proutn("Life Support  ");
+       if (game.damage[DLIFSUP] != 0.0) {
+           if (condit == IHDOCKED)
+               proutn("DAMAGED, Base provides");
+           else
+               proutn("DAMAGED, reserves=%4.2f", lsupres);
+       }
+       else
+           proutn("ACTIVE");
+       break;
+    case 5:
+       proutn("Warp Factor   %.1f", warpfac);
+       break;
+    case 6:
+       proutn("Energy        %.2f", energy);
+       if (icrystl && (game.options & OPTION_SHOWME))  /* ESR */
+           proutn(" (have crystals)");
+       break;
+    case 7:
+       proutn("Torpedoes     %d", torps);
+       break;
+    case 8:
+       proutn("Shields       ");
+       if (game.damage[DSHIELD] != 0)
+           proutn("DAMAGED,");
+       else if (shldup)
+           proutn("UP,");
+       else
+           proutn("DOWN,");
+       proutn(" %d%% %.1f units",
+              (int)((100.0*shield)/inshld + 0.5), shield);
+       break;
+    case 9:
+       proutn("Klingons Left %d", KLINGREM);
+       break;
+    case 10:
+       attakreport(1);
+       break;
+    }
+}
+               
+int srscan(int l) 
+{
+    static char requests[][3] =
+       {"","da","co","po","ls","wa","en","to","sh","kl","ti"};
+    int leftside=TRUE, rightside=TRUE, i, j, jj, req=0, nn=FALSE;
+    int goodScan=TRUE;
+    switch (l) {
+    case SCAN_FULL: // SRSCAN
+       if (game.damage[DSRSENS] != 0) {
+           /* Allow base's sensors if docked */
+           if (condit != IHDOCKED) {
+               prout("   S.R. SENSORS DAMAGED!");
+               goodScan=FALSE;
+           }
+           else
+               prout("  [Using Base's sensors]");
+       }
+       else prout("     Short-range scan");
+       if (goodScan && !game.damage[DRADIO]) { 
+           game.state.chart[quadx][quady].klingons = game.state.galaxy[quadx][quady].klingons;
+           game.state.chart[quadx][quady].starbase = game.state.galaxy[quadx][quady].starbase;
+           game.state.chart[quadx][quady].stars = game.state.galaxy[quadx][quady].stars;
+           game.state.galaxy[quadx][quady].charted = TRUE;
+       }
+       scan();
+       if (isit("chart")) nn = TRUE;
+       if (isit("no")) rightside = FALSE;
+       chew();
+       prout("    1 2 3 4 5 6 7 8 9 10");
+       break;
+    case SCAN_REQUEST:
+       while (scan() == IHEOL)
+           proutn("Information desired? ");
+       chew();
+       for (req = 1; req <= sizeof(requests)/sizeof(requests[0]); req++)
+           if (strncmp(citem,requests[req],min(2,strlen(citem)))==0)
+               break;
+       if (req > sizeof(requests)/sizeof(requests[0])) {
+           prout("UNRECOGNIZED REQUEST. Legal requests are:");
+           prout("  date, condition, position, lsupport, warpfactor,");
+           prout("  energy, torpedoes, shields, klingons, time, bases.");
+           return FALSE;
+       }
+       // no break
+    case SCAN_STATUS: // STATUS
+       chew();
+       leftside = FALSE;
+       skip(1);
+       // no break
+    case SCAN_NO_LEFTSIDE: // REQUEST
+       leftside=FALSE;
+       break;
+    }
+    if (condit != IHDOCKED) newcnd();
+    for (i = 1; i <= max(QUADSIZE, sizeof(requests)/sizeof(requests[0])); i++) {
+       jj = (req!=0 ? req : i);
+       if (leftside && i <= QUADSIZE) {
+           proutn("%2d  ", i);
+           for_sectors(j) {
+               sectscan(goodScan, i, j);
+           }
+       }
+       if (rightside)
+           status(jj);
+       if (i<sizeof(requests)/sizeof(requests[0])) skip(1);
+       if (req!=0) return(goodScan);
+    }
+    prout("");
+    if (nn) chart(1);
+    return(goodScan);
+}
+                       
+                       
+void eta(void)
+{
+    int ix1, ix2, iy1, iy2, prompt=FALSE;
+    int wfl;
+    double ttime, twarp, tpower;
+    if (game.damage[DCOMPTR] != 0.0) {
+       prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
+       skip(1);
+       return;
+    }
+    if (scan() != IHREAL) {
+       prompt = TRUE;
+       chew();
+       proutn("Destination quadrant and/or sector? ");
+       if (scan()!=IHREAL) {
+           huh();
+           return;
+       }
+    }
+    iy1 = aaitem +0.5;
+    if (scan() != IHREAL) {
+       huh();
+       return;
+    }
+    ix1 = aaitem + 0.5;
+    if (scan() == IHREAL) {
+       iy2 = aaitem + 0.5;
+       if (scan() != IHREAL) {
+           huh();
+           return;
+       }
+       ix2 = aaitem + 0.5;
+    }
+    else {
+       if (quady>ix1) ix2 = 1;
+       else ix2=QUADSIZE;
+       if (quadx>iy1) iy2 = 1;
+       else iy2=QUADSIZE;
+    }
+
+    if (!VALID_QUADRANT(ix1, iy1) || !VALID_SECTOR(ix2, iy2)) {
+       huh();
+       return;
+    }
+    dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
+               square(ix1-quady+0.1*(ix2-secty)));
+    wfl = FALSE;
+
+    if (prompt) prout("Answer \"no\" if you don't know the value:");
+    while (TRUE) {
+       chew();
+       proutn("Time or arrival date? ");
+       if (scan()==IHREAL) {
+           ttime = aaitem;
+           if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
+           if (ttime <= 1e-10 ||
+               (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
+               prout("We'll never make it, sir.");
+               chew();
+               return;
+           }
+           if (twarp < 1.0) twarp = 1.0;
+           break;
+       }
+       chew();
+       proutn("Warp factor? ");
+       if (scan()== IHREAL) {
+           wfl = TRUE;
+           twarp = aaitem;
+           if (twarp<1.0 || twarp > 10.0) {
+               huh();
+               return;
+           }
+           break;
+       }
+       prout("Captain, certainly you can give me one of these.");
+    }
+    while (TRUE) {
+       chew();
+       ttime = (10.0*dist)/square(twarp);
+       tpower = dist*twarp*twarp*twarp*(shldup+1);
+       if (tpower >= energy) {
+           prout("Insufficient energy, sir.");
+           if (shldup==0 || tpower > energy*2.0) {
+               if (!wfl) return;
+               proutn("New warp factor to try? ");
+               if (scan() == IHREAL) {
+                   wfl = TRUE;
+                   twarp = aaitem;
+                   if (twarp<1.0 || twarp > 10.0) {
+                       huh();
+                       return;
+                   }
+                   continue;
+               }
+               else {
+                   chew();
+                   skip(1);
+                   return;
+               }
+           }
+           prout("But if you lower your shields,");
+           proutn("remaining");
+           tpower /= 2;
+       }
+       else
+           proutn("Remaining");
+       prout(" energy will be %.2f.", energy-tpower);
+       if (wfl) {
+           prout("And we will arrive at stardate %.2f.",
+                 game.state.date+ttime);
+       }
+       else if (twarp==1.0)
+           prout("Any warp speed is adequate.");
+       else {
+           prout("Minimum warp needed is %.2f,", twarp);
+           prout("and we will arrive at stardate %.2f.",
+                 game.state.date+ttime);
+       }
+       if (game.state.remtime < ttime)
+           prout("Unfortunately, the Federation will be destroyed by then.");
+       if (twarp > 6.0)
+           prout("You'll be taking risks at that speed, Captain");
+       if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
+            game.future[FSCDBAS]< ttime+game.state.date)||
+           (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
+           prout("The starbase there will be destroyed by then.");
+       proutn("New warp factor to try? ");
+       if (scan() == IHREAL) {
+           wfl = TRUE;
+           twarp = aaitem;
+           if (twarp<1.0 || twarp > 10.0) {
+               huh();
+               return;
+           }
+       }
+       else {
+           chew();
+           skip(1);
+           return;
+       }
+    }
+                       
+}
diff --git a/src/setup.c b/src/setup.c
new file mode 100644 (file)
index 0000000..04a0247
--- /dev/null
@@ -0,0 +1,737 @@
+#include <time.h>
+#include <sys/stat.h>
+#include "sst.h"
+
+static long filelength(int fd) {
+struct stat buf;
+    fstat(fd, &buf);
+    return buf.st_size;
+}
+
+void prelim(void) 
+{
+    skip(2);
+    prout("-SUPER- STAR TREK");
+    skip(1);
+#ifdef __HISTORICAL__
+    prout("Latest update-21 Sept 78");
+    skip(1);
+#endif /* __HISTORICAL__ */
+}
+
+void freeze(int boss) 
+{
+    FILE *fp;
+    int key;
+    if (boss) {
+       strcpy(citem, "emsave.trk");
+    }
+    else {
+       if ((key = scan()) == IHEOL) {
+           proutn("File name: ");
+           key = scan();
+       }
+       if (key != IHALPHA) {
+           huh();
+           return;
+       }
+       chew();
+       if (strchr(citem, '.') == NULL) {
+           strcat(citem, ".trk");
+       }
+    }
+    if ((fp = fopen(citem, "wb")) == NULL) {
+       proutn("Can't freeze game as file ");
+       proutn(citem);
+       skip(1);
+       return;
+    }
+    strcpy(game.magic, SSTMAGIC);
+    fwrite(&game, sizeof(game), 1, fp);
+
+    fclose(fp);
+
+    /* I hope that's enough! */
+}
+
+
+int thaw(void) 
+{
+    FILE *fp;
+    int key;
+
+    game.passwd[0] = '\0';
+    if ((key = scan()) == IHEOL) {
+       proutn("File name: ");
+       key = scan();
+    }
+    if (key != IHALPHA) {
+       huh();
+       return 1;
+    }
+    chew();
+    if (strchr(citem, '.') == NULL) {
+       strcat(citem, ".trk");
+    }
+    if ((fp = fopen(citem, "rb")) == NULL) {
+       proutn("Can't find game file ");
+       proutn(citem);
+       skip(1);
+       return 1;
+    }
+    fread(&game, sizeof(game), 1, fp);
+    if (feof(fp) || ftell(fp) != filelength(fileno(fp)) || strcmp(game.magic, SSTMAGIC)) {
+       prout("Game file format is bad, should begin with " SSTMAGIC);
+       skip(1);
+       fclose(fp);
+       return 1;
+    }
+
+    fclose(fp);
+
+    return 0;
+}
+
+void abandn(void) 
+{
+    int nb, l;
+
+    chew();
+    if (condit==IHDOCKED) {
+       if (ship!=IHE) {
+           prout("You cannot abandon Ye Faerie Queene.");
+           return;
+       }
+    }
+    else {
+       /* Must take shuttle craft to exit */
+       if (game.damage[DSHUTTL]==-1) {
+           prout("Ye Faerie Queene has no shuttle craft.");
+           return;
+       }
+       if (game.damage[DSHUTTL]<0) {
+           prout("Shuttle craft now serving Big Mac's.");
+           return;
+       }
+       if (game.damage[DSHUTTL]>0) {
+           prout("Shuttle craft damaged.");
+           return;
+       }
+       if (landed==1) {
+           prout("You must be aboard the Enterprise.");
+           return;
+       }
+       if (iscraft!=1) {
+           prout("Shuttle craft not currently available.");
+           return;
+       }
+       /* Print abandon ship messages */
+       skip(1);
+       prouts("***ABANDON SHIP!  ABANDON SHIP!");
+       skip(1);
+       prouts("***ALL HANDS ABANDON SHIP!");
+       skip(2);
+       prout("Captain and crew escape in shuttle craft.");
+       prout("Remainder of ship's complement beam down");
+       prout("to nearest habitable planet.");
+       if (game.state.rembase==0) {
+           /* Ops! no place to go... */
+           finish(FABANDN);
+           return;
+       }
+       /* If at least one base left, give 'em the Faerie Queene */
+       skip(1);
+       icrystl = 0; /* crystals are lost */
+       nprobes = 0; /* No probes */
+       prout("You are captured by Klingons and released to");
+       prout("the Federation in a prisoner-of-war exchange.");
+       nb = Rand()*game.state.rembase+1;
+       /* Set up quadrant and position FQ adjacient to base */
+       if (quadx!=game.state.baseqx[nb] || quady!=game.state.baseqy[nb]) {
+           quadx = game.state.baseqx[nb];
+           quady = game.state.baseqy[nb];
+           sectx = secty = 5;
+           newqad(1);
+       }
+       for (;;) {
+           /* position next to base by trial and error */
+           game.quad[sectx][secty] = IHDOT;
+           for_sectors(l) {
+               sectx = 3.0*Rand() - 1.0 + basex;
+               secty = 3.0*Rand() - 1.0 + basey;
+               if (VALID_SECTOR(sectx, secty) &&
+                   game.quad[sectx][secty] == IHDOT) break;
+           }
+           if (l < QUADSIZE+1) break; /* found a spot */
+           sectx=QUADSIZE/2;
+           secty=QUADSIZE/2;
+           newqad(1);
+       }
+    }
+    /* Get new commission */
+    game.quad[sectx][secty] = ship = IHF;
+    prout("Starfleet puts you in command of another ship,");
+    prout("the Faerie Queene, which is antiquated but,");
+    prout("still useable.");
+    if (icrystl!=0) prout("The dilithium crystals have been moved.");
+    imine=0;
+    iscraft=0; /* Gallileo disappears */
+    /* Resupply ship */
+    condit=IHDOCKED;
+    for (l = 0; l < NDEVICES; l++) 
+       game.damage[l] = 0.0;
+    game.damage[DSHUTTL] = -1;
+    energy = inenrg = 3000.0;
+    shield = inshld = 1250.0;
+    torps = intorps = 6;
+    lsupres=inlsr=3.0;
+    shldup=0;
+    warpfac=5.0;
+    wfacsq=25.0;
+    return;
+}
+       
+void setup(int needprompt) 
+{
+    int i,j, krem, klumper;
+    int ix, iy;
+#ifdef DEBUG
+    idebug = 0;
+#endif
+    //  Decide how many of everything
+    if (choose(needprompt)) return; // frozen game
+    // Prepare the Enterprise
+    alldone = gamewon = 0;
+    ship = IHE;
+    energy = inenrg = 5000.0;
+    shield = inshld = 2500.0;
+    shldchg = shldup = 0;
+    inlsr = 4.0;
+    lsupres = 4.0;
+    iran(GALSIZE, &quadx, &quady);
+    iran(QUADSIZE, &sectx, &secty);
+    torps = intorps = 10;
+    nprobes = (int)(3.0*Rand() + 2.0); /* Give them 2-4 of these wonders */
+    warpfac = 5.0;
+    wfacsq = warpfac * warpfac;
+    for (i=0; i < NDEVICES; i++) 
+       game.damage[i] = 0.0;
+    // Set up assorted game parameters
+    batx = baty = 0;
+    game.state.date = indate = 100.0*(int)(31.0*Rand()+20.0);
+    nkinks = nhelp = resting = casual = 0;
+    isatb = iscate = imine = icrystl = icraft = game.state.nplankl = 0;
+    game.state.starkl = game.state.basekl = 0;
+    iscraft = 1;
+    landed = -1;
+    alive = 1;
+    docfac = 0.25;
+    for_quadrants(i)
+       for_quadrants(j) {
+           game.state.galaxy[i][j].charted = 0;
+           game.state.galaxy[i][j].planets = 0;
+           game.state.galaxy[i][j].romulans = 0;
+           game.state.galaxy[i][j].klingons = 0;
+           game.state.galaxy[i][j].starbase = 0;
+           game.state.galaxy[i][j].supernova = 0;
+       }
+    // Initialize times for extraneous events
+    game.future[FSNOVA] = game.state.date + expran(0.5 * intime);
+    game.future[FTBEAM] = game.state.date + expran(1.5 * (intime / game.state.remcom));
+    game.future[FSNAP] = game.state.date + 1.0 + Rand(); // Force an early snapshot
+    game.future[FBATTAK] = game.state.date + expran(0.3*intime);
+    game.future[FCDBAS] = FOREVER;
+    game.future[FSCMOVE] = game.state.nscrem ? game.state.date+0.2777 : FOREVER;
+    game.future[FSCDBAS] = FOREVER;
+    game.future[FDSPROB] = FOREVER;
+    // Starchart is functional but we've never seen it
+    lastchart = FOREVER;
+    // Put stars in the galaxy
+    instar = 0;
+    for_quadrants(i)
+       for_quadrants(j) {
+           int k = Rand()*9.0 + 1.0;
+           instar += k;
+           game.state.galaxy[i][j].stars = k;
+       }
+    // Locate star bases in galaxy
+    for (i = 1; i <= inbase; i++) {
+       int contflag;
+       do {
+           do iran(GALSIZE, &ix, &iy);
+           while (game.state.galaxy[ix][iy].starbase);
+           contflag = FALSE;
+           for (j = i-1; j > 0; j--) {
+               /* Improved placement algorithm to spread out bases */
+               double distq = square(ix-game.state.baseqx[j]) + square(iy-game.state.baseqy[j]);
+               if (distq < 6.0*(BASEMAX+1-inbase) && Rand() < 0.75) {
+                   contflag = TRUE;
+#ifdef DEBUG
+                   prout("DEBUG: Abandoning base #%d at %d-%d", i, ix, iy);
+#endif
+                   break;
+               }
+#ifdef DEBUG
+               else if (distq < 6.0 * (BASEMAX+1-inbase)) {
+                   prout("DEBUG: saving base #%d, close to #%d", i, j);
+               }
+#endif
+           }
+       } while (contflag);
+                       
+       game.state.baseqx[i] = ix;
+       game.state.baseqy[i] = iy;
+       game.state.galaxy[ix][iy].starbase = 1;
+       game.state.chart[ix][iy].starbase = 1;
+    }
+    // Position ordinary Klingon Battle Cruisers
+    krem = inkling;
+    klumper = 0.25*skill*(9.0-length)+1.0;
+    if (klumper > 9) klumper = 9; // Can't have more than 9 in quadrant
+    do {
+       double r = Rand();
+       int klump = (1.0 - r*r)*klumper;
+       if (klump > krem) klump = krem;
+       krem -= klump;
+       do iran(GALSIZE,&ix,&iy);
+       while (game.state.galaxy[ix][iy].supernova ||
+               game.state.galaxy[ix][iy].klingons + klump > 9);
+       game.state.galaxy[ix][iy].klingons += klump;
+    } while (krem > 0);
+    // Position Klingon Commander Ships
+#ifdef DEBUG
+    klumper = 1;
+#endif
+    for (i = 1; i <= incom; i++) {
+       do {
+           do { /* IF debugging, put commanders by bases, always! */
+#ifdef DEBUG
+               if (idebug && klumper <= inbase) {
+                   ix = game.state.baseqx[klumper];
+                   iy = game.state.baseqy[klumper];
+                   klumper++;
+               }
+               else
+#endif
+                   iran(GALSIZE, &ix, &iy);
+           }
+           while ((!game.state.galaxy[ix][iy].klingons && Rand() < 0.75)||
+                  game.state.galaxy[ix][iy].supernova||
+                  game.state.galaxy[ix][iy].klingons > 8);
+           // check for duplicate
+           for (j = 1; j < i; j++)
+               if (game.state.cx[j]==ix && game.state.cy[j]==iy) break;
+       } while (j < i);
+       game.state.galaxy[ix][iy].klingons++;
+       game.state.cx[i] = ix;
+       game.state.cy[i] = iy;
+    }
+    // Locate planets in galaxy
+    for (i = 0; i < inplan; i++) {
+       do iran(GALSIZE, &ix, &iy); while (game.state.galaxy[ix][iy].planets);
+       game.state.galaxy[ix][iy].planets = 1;
+       game.state.plnets[i].x = ix;
+       game.state.plnets[i].y = iy;
+       game.state.plnets[i].pclass = Rand()*3.0; // Planet class M N or O
+       game.state.plnets[i].crystals = 1.5*Rand();             // 1 in 3 chance of crystals
+       game.state.plnets[i].known = unknown;
+    }
+    // Locate Romulans
+    for (i = 1; i <= game.state.nromrem; i++) {
+       iran(GALSIZE, &ix, &iy);
+       game.state.galaxy[ix][iy].romulans = 1;
+    }
+    // Locate the Super Commander
+    if (game.state.nscrem > 0) {
+       do iran(GALSIZE, &ix, &iy);
+       while (game.state.galaxy[ix][iy].supernova || game.state.galaxy[ix][iy].klingons > 8);
+       game.state.isx = ix;
+       game.state.isy = iy;
+       game.state.galaxy[ix][iy].klingons++;
+    }
+    // Place thing (in tournament game, thingx == -1, don't want one!)
+    if (thingx != -1) {
+       iran(GALSIZE, &thingx, &thingy);
+    }
+    else {
+       thingx = thingy = 0;
+    }
+
+//     idate = date;
+    skip(2);
+    game.state.snap = 0;
+               
+    if (skill == SKILL_NOVICE) {
+       prout("It is stardate %d. The Federation is being attacked by",
+             (int)game.state.date);
+       prout("a deadly Klingon invasion force. As captain of the United");
+       prout("Starship U.S.S. Enterprise, it is your mission to seek out");
+       prout("and destroy this invasion force of %d battle cruisers.",
+             INKLINGTOT);
+       prout("You have an initial allotment of %d stardates to complete", (int)intime);
+       prout("your mission.  As you proceed you may be given more time.");
+       prout("");
+       prout("You will have %d supporting starbases.", inbase);
+       proutn("Starbase locations-  ");
+    }
+    else {
+       prout("Stardate %d.", (int)game.state.date);
+       prout("");
+       prout("%d Klingons.", INKLINGTOT);
+       prout("An unknown number of Romulans.");
+       if (game.state.nscrem) prout("and one (GULP) Super-Commander.");
+       prout("%d stardates.",(int)intime);
+       proutn("%d starbases in ", inbase);
+    }
+    for (i = 1; i <= inbase; i++) {
+       proutn(cramlc(0, game.state.baseqx[i], game.state.baseqy[i]));
+       proutn("  ");
+    }
+    skip(2);
+    proutn("The Enterprise is currently in ");
+    proutn(cramlc(quadrant, quadx, quady));
+    proutn(" ");
+    proutn(cramlc(sector, sectx, secty));
+    skip(2);
+    prout("Good Luck!");
+    if (game.state.nscrem) prout("  YOU'LL NEED IT.");
+    waitfor();
+    newqad(0);
+    if (nenhere-iqhere-ithere) shldup=1.0;
+    if (neutz) attack(0);      // bad luck to start in a Romulan Neutral Zone
+}
+
+int choose(int needprompt) 
+{
+    while (TRUE) {
+       tourn = 0;
+       thawed = 0;
+       skill = SKILL_NONE;
+       length = 0;
+       if (needprompt) /* Can start with command line options */
+           proutn("Would you like a regular, tournament, or saved game? ");
+       scan();
+       if (strlen(citem)==0) continue; // Try again
+       if (isit("tournament")) {
+           while (scan() == IHEOL) {
+               proutn("Type in tournament number-");
+           }
+           if (aaitem == 0) {
+               chew();
+               continue; // We don't want a blank entry
+           }
+           tourn = (int)aaitem;
+           thingx = -1;
+           srand((unsigned int)(int)aaitem);
+           break;
+       }
+       if (isit("saved") || isit("frozen")) {
+           if (thaw()) continue;
+           chew();
+           if (*game.passwd==0) continue;
+           if (!alldone) thawed = 1; // No plaque if not finished
+           report();
+           waitfor();
+           return TRUE;
+       }
+       if (isit("regular")) break;
+       proutn("What is \"");
+       proutn(citem);
+       prout("\"?");
+       chew();
+    }
+    while (length==0 || skill==SKILL_NONE) {
+       if (scan() == IHALPHA) {
+           if (isit("short")) length = 1;
+           else if (isit("medium")) length = 2;
+           else if (isit("long")) length = 4;
+           else if (isit("novice")) skill = SKILL_NOVICE;
+           else if (isit("fair")) skill = SKILL_FAIR;
+           else if (isit("good")) skill = SKILL_GOOD;
+           else if (isit("expert")) skill = SKILL_EXPERT;
+           else if (isit("emeritus")) skill = SKILL_EMERITUS;
+           else {
+               proutn("What is \"");
+               proutn(citem);
+               prout("\"?");
+           }
+       }
+       else {
+           chew();
+           if (length==0) proutn("Would you like a Short, Medium, or Long game? ");
+           else if (skill == SKILL_NONE) proutn("Are you a Novice, Fair, Good, Expert, or Emeritus player? ");
+       }
+    }
+    // Choose game options -- added by ESR for SST2K
+    if (scan() != IHALPHA) {
+       chew();
+       proutn("Choose your game options: ");
+       scan();
+    }
+    if (isit("plain")) {
+       // Approximates the UT FORTRAN version.
+       game.options &=~ (OPTION_THOLIAN | OPTION_PLANETS | OPTION_THINGY | OPTION_PROBE | OPTION_RAMMING | OPTION_MVBADDY | OPTION_BLKHOLE | OPTION_BASE);
+       game.options |= OPTION_PLAIN;
+    } 
+    else if (isit("almy")) {
+       // Approximates Tom Almy's version.
+       game.options &=~ (OPTION_THINGY | OPTION_BLKHOLE | OPTION_BASE);
+       game.options |= OPTION_ALMY;
+    }
+    else if (isit("fancy"))
+       /* do nothing */;
+    else if (strlen(citem)) {
+           proutn("What is \"");
+           proutn(citem);
+           prout("\"?");
+    }
+    setpassword();
+#ifdef DEBUG
+    if (strcmp(game.passwd, "debug")==0) idebug = 1;
+#endif
+
+    // Use parameters to generate initial values of things
+    damfac = 0.5 * skill;
+    game.state.rembase = 2.0 + Rand()*(BASEMAX-2.0);
+    inbase = game.state.rembase;
+    if (game.options & OPTION_PLANETS)
+       inplan = (PLNETMAX/2) + (PLNETMAX/2+1)*Rand();
+    game.state.nromrem = inrom = (2.0+Rand())*skill;
+    game.state.nscrem = inscom = (skill > SKILL_FAIR ? 1 : 0);
+    game.state.remtime = 7.0 * length;
+    intime = game.state.remtime;
+    game.state.remkl = inkling = 2.0*intime*((skill+1 - 2*Rand())*skill*0.1+.15);
+    incom = skill + 0.0625*inkling*Rand();
+    game.state.remcom = min(10, incom);
+    incom = game.state.remcom;
+    game.state.remres = (inkling+4*incom)*intime;
+    inresor = game.state.remres;
+    if (inkling > 50) {
+       inbase = (game.state.rembase += 1);
+    }
+    return FALSE;
+}
+
+void dropin(int iquad, int *ix, int *iy) 
+{
+    do iran(QUADSIZE, ix, iy);
+    while (game.quad[*ix][*iy] != IHDOT);
+    game.quad[*ix][*iy] = iquad;
+}
+
+void newcnd(void) 
+{
+    condit = IHGREEN;
+    if (energy < 1000.0) condit = IHYELLOW;
+    if (game.state.galaxy[quadx][quady].klingons || game.state.galaxy[quadx][quady].romulans)
+       condit = IHRED;
+    if (!alive) condit=IHDEAD;
+}
+
+
+void newqad(int shutup) 
+{
+    int i, j, ix, iy, nplan;
+
+    iattak = 1;
+    justin = 1;
+    basex = basey = 0;
+    klhere = 0;
+    comhere = 0;
+    plnetx = plnety = 0;
+    ishere = 0;
+    irhere = 0;
+    iplnet = 0;
+    nenhere = 0;
+    neutz = 0;
+    inorbit = 0;
+    landed = -1;
+    ientesc = 0;
+    ithere = 0;
+    iqhere=0;
+    iqengry=0;
+    iseenit = 0;
+    if (iscate) {
+       // Attempt to escape Super-commander, so tbeam back!
+       iscate = 0;
+       ientesc = 1;
+    }
+    // Clear quadrant
+    for_sectors(i)
+       for_sectors(j) 
+           game.quad[i][j] = IHDOT;
+    // cope with supernova
+    if (game.state.galaxy[quadx][quady].supernova)
+       return;
+    klhere = game.state.galaxy[quadx][quady].klingons;
+    irhere = game.state.galaxy[quadx][quady].romulans;
+    nplan  = game.state.galaxy[quadx][quady].planets;
+    nenhere = klhere + irhere;
+
+    // Position Starship
+    game.quad[sectx][secty] = ship;
+
+    if (game.state.galaxy[quadx][quady].klingons) {
+       // Position ordinary Klingons
+       for (i = 1; i <= klhere; i++) {
+           dropin(IHK, &ix, &iy);
+           game.kx[i] = ix;
+           game.ky[i] = iy;
+           game.kdist[i] = game.kavgd[i] = sqrt(square(sectx-ix) + square(secty-iy));
+           game.kpower[i] = Rand()*150.0 +300.0 +25.0*skill;
+       }
+       // If we need a commander, promote a Klingon
+       for_commanders(i)
+           if (game.state.cx[i]==quadx && game.state.cy[i]==quady) break;
+                       
+       if (i <= game.state.remcom) {
+           game.quad[ix][iy] = IHC;
+           game.kpower[klhere] = 950.0+400.0*Rand()+50.0*skill;
+           comhere = 1;
+       }
+
+       // If we need a super-commander, promote a Klingon
+       if (quadx == game.state.isx && quady == game.state.isy) {
+           game.quad[game.kx[1]][game.ky[1]] = IHS;
+           game.kpower[1] = 1175.0 + 400.0*Rand() + 125.0*skill;
+           iscate = game.state.remkl>1;
+           ishere = 1;
+       }
+    }
+    // Put in Romulans if needed
+    for (i = klhere+1; i <= nenhere; i++) {
+       dropin(IHR, &ix, &iy);
+       game.kx[i] = ix;
+       game.ky[i] = iy;
+       game.kdist[i] = game.kavgd[i] = sqrt(square(sectx-ix) + square(secty-iy));
+       game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*skill;
+    }
+    // If quadrant needs a starbase, put it in
+    if (game.state.galaxy[quadx][quady].starbase)
+       dropin(IHB, &basex, &basey);
+       
+    if (nplan) {
+       // If quadrant needs a planet, put it in
+       for (i=0; i < inplan; i++)
+           if (game.state.plnets[i].x == quadx && game.state.plnets[i].y == quady) break;
+       if (i < inplan) {
+           iplnet = i;
+           dropin(IHP, &plnetx, &plnety);
+       }
+    }
+    // Check for condition
+    newcnd();
+    // And finally the stars
+    for (i = 1; i <= game.state.galaxy[quadx][quady].stars; i++) 
+       dropin(IHSTAR, &ix, &iy);
+
+    // Check for RNZ
+    if (irhere > 0 && klhere == 0) {
+       neutz = 1;
+       if (game.damage[DRADIO] <= 0.0) {
+           skip(1);
+           prout("LT. Uhura- \"Captain, an urgent message.");
+           prout("  I'll put it on audio.\"  CLICK");
+           skip(1);
+           prout("INTRUDER! YOU HAVE VIOLATED THE ROMULAN NEUTRAL ZONE.");
+           prout("LEAVE AT ONCE, OR YOU WILL BE DESTROYED!");
+       }
+    }
+
+    if (shutup==0) {
+       // Put in THING if needed
+       if (thingx == quadx && thingy == quady) {
+           dropin(IHQUEST, &ix, &iy);
+           iran(GALSIZE, &thingx, &thingy);
+           nenhere++;
+           iqhere=1;
+           game.kx[nenhere] = ix;
+           game.ky[nenhere] = iy;
+           game.kdist[nenhere] = game.kavgd[nenhere] =
+               sqrt(square(sectx-ix) + square(secty-iy));
+           game.kpower[nenhere] = Rand()*6000.0 +500.0 +250.0*skill;
+           if (game.damage[DSRSENS] == 0.0) {
+               skip(1);
+               prout("MR. SPOCK- \"Captain, this is most unusual.");
+               prout("    Please examine your short-range scan.\"");
+           }
+       }
+    }
+
+    // Decide if quadrant needs a Tholian
+    if (game.options & OPTION_THOLIAN) {
+       if ((skill < SKILL_GOOD && Rand() <= 0.02) ||   /* Lighten up if skill is low */
+           (skill == SKILL_GOOD && Rand() <= 0.05) ||
+           (skill > SKILL_GOOD && Rand() <= 0.08)
+    #ifdef DEBUG
+           || strcmp(game.passwd, "tholianx")==0
+    #endif
+           ) {
+           do {
+               ithx = Rand() > 0.5 ? QUADSIZE : 1;
+               ithy = Rand() > 0.5 ? QUADSIZE : 1;
+           } while (game.quad[ithx][ithy] != IHDOT);
+           game.quad[ithx][ithy] = IHT;
+           ithere = 1;
+           nenhere++;
+           game.kx[nenhere] = ithx;
+           game.ky[nenhere] = ithy;
+           game.kdist[nenhere] = game.kavgd[nenhere] =
+               sqrt(square(sectx-ithx) + square(secty-ithy));
+           game.kpower[nenhere] = Rand()*400.0 +100.0 +25.0*skill;
+           /* Reserve unocupied corners */
+           if (game.quad[1][1]==IHDOT) game.quad[1][1] = 'X';
+           if (game.quad[1][QUADSIZE]==IHDOT) game.quad[1][QUADSIZE] = 'X';
+           if (game.quad[QUADSIZE][1]==IHDOT) game.quad[QUADSIZE][1] = 'X';
+           if (game.quad[QUADSIZE][QUADSIZE]==IHDOT) game.quad[QUADSIZE][QUADSIZE] = 'X';
+       }
+    }
+
+    sortkl();
+
+    // Put in a few black holes
+    for (i = 1; i <= 3; i++)
+       if (Rand() > 0.5) 
+           dropin(IHBLANK, &ix, &iy);
+
+    // Take out X's in corners if Tholian present
+    if (ithere) {
+       if (game.quad[1][1]=='X') game.quad[1][1] = IHDOT;
+       if (game.quad[1][QUADSIZE]=='X') game.quad[1][QUADSIZE] = IHDOT;
+       if (game.quad[QUADSIZE][1]=='X') game.quad[QUADSIZE][1] = IHDOT;
+       if (game.quad[QUADSIZE][QUADSIZE]=='X') game.quad[QUADSIZE][QUADSIZE] = IHDOT;
+    }          
+}
+
+void sortkl(void) 
+{
+    double t;
+    int sw, j, k;
+
+    // The author liked bubble sort. So we will use it. :-(
+
+    if (nenhere-iqhere-ithere < 2) return;
+
+    do {
+       sw = FALSE;
+       for (j = 1; j < nenhere; j++)
+           if (game.kdist[j] > game.kdist[j+1]) {
+               sw = TRUE;
+               t = game.kdist[j];
+               game.kdist[j] = game.kdist[j+1];
+               game.kdist[j+1] = t;
+               t = game.kavgd[j];
+               game.kavgd[j] = game.kavgd[j+1];
+               game.kavgd[j+1] = t;
+               k = game.kx[j];
+               game.kx[j] = game.kx[j+1];
+               game.kx[j+1] = k;
+               k = game.ky[j];
+               game.ky[j] = game.ky[j+1];
+               game.ky[j+1] = k;
+               t = game.kpower[j];
+               game.kpower[j] = game.kpower[j+1];
+               game.kpower[j+1] = t;
+           }
+    } while (sw);
+}
diff --git a/src/sst.c b/src/sst.c
new file mode 100644 (file)
index 0000000..75dca51
--- /dev/null
+++ b/src/sst.c
@@ -0,0 +1,871 @@
+#include <ctype.h>
+#include <getopt.h>
+#include <time.h>
+#include "sstlinux.h"
+#include "sst.h"
+
+#define DOC_NAME "sst.doc"
+       
+/*
+
+Dave Matuszek says:
+
+   SRSCAN, MOVE, PHASERS, CALL, STATUS, IMPULSE, PHOTONS, ABANDON,
+   LRSCAN, WARP, SHIELDS, DESTRUCT, CHART, REST, DOCK, QUIT, and DAMAGE
+   were in the original non-"super" version of UT FORTRAN Star Trek.
+
+   Tholians weren't in the original. Dave is dubious about their merits.
+   (They are now controlled by OPTION_THOLIAN and turned off if the game
+   type is "plain".)
+
+   Planets and dilithium crystals weren't in the original.  Dave is OK
+   with this idea. (It's now controlled by OPTION_PLANETS and turned 
+   off if the game type is "plain".)
+
+   Dave says the bit about the Galileo getting turned into a
+   McDonald's is "consistant with our original vision".  (This has been
+   left permanently enabled, as it can only happen if OPTION_PLANETS
+   is on.)
+
+   Dave also says the Space Thingy should not be preserved across saved
+   games, so you can't prove to others that you've seen it.  He says it
+   shouldn't fire back, either.  It should do nothing except scream and
+   disappear when hit by photon torpedos.  It's OK that it may move
+   when attacked, but it didn't in the original.  (Whether the Thingy
+   can fire back is now controlled by OPTION_THINGY and turned off if the
+   game type is "plain" or "almy".  The no-save behavior has been restored.)
+
+   The Faerie Queen, black holes, and time warping were in the original.
+
+Here are Tom Almy's changes:
+
+   In early 1997, I got the bright idea to look for references to
+   "Super Star Trek" on the World Wide Web. There weren't many hits,
+   but there was one that came up with 1979 Fortran sources! This
+   version had a few additional features that mine didn't have,
+   however mine had some feature it didn't have. So I merged its
+   features that I liked. I also took a peek at the DECUS version (a
+   port, less sources, to the PDP-10), and some other variations.
+
+   1, Compared to the original UT version, I've changed the "help" command to
+      "call" and the "terminate" command to "quit" to better match
+      user expectations. The DECUS version apparently made those changes
+      as well as changing "freeze" to "save". However I like "freeze".
+      (Both "freeze" and "save" work in SST2K.)
+
+   2. The experimental deathray originally had only a 5% chance of
+      success, but could be used repeatedly. I guess after a couple
+      years of use, it was less "experimental" because the 1979
+      version had a 70% success rate. However it was prone to breaking
+      after use. I upgraded the deathray, but kept the original set of
+      failure modes (great humor!).  (Now controlled by OPTION_DEATHRAY
+      and turned off if game type is "plain".)
+
+   3. The 1979 version also mentions srscan and lrscan working when
+      docked (using the starbase's scanners), so I made some changes here
+      to do this (and indicating that fact to the player), and then realized
+      the base would have a subspace radio as well -- doing a Chart when docked
+      updates the star chart, and all radio reports will be heard. The Dock
+      command will also give a report if a base is under attack.
+
+   4. Tholian Web from the 1979 version.  (Now controlled by
+      OPTION_THOLIAN and turned off if game type is "plain".)
+
+   5. Enemies can ram the Enterprise. (Now controlled by OPTION_RAMMING
+      and turned off if game type is "plain".)
+
+   6. Regular Klingons and Romulans can move in Expert and Emeritus games. 
+      This code could use improvement. (Now controlled by OPTION_MVBADDY
+      and turned off if game type is "plain".)
+
+   7. The deep-space probe feature from the DECUS version.  (Now controlled
+      by OPTION_PROBE and turned off if game type is "plain").
+
+   8. 'emexit' command from the 1979 version.
+
+   9. Bugfix: Klingon commander movements are no longer reported if long-range 
+      sensors are damaged.
+
+   10. Bugfix: Better base positioning at startup (more spread out).
+      That made sense to add because most people abort games with 
+      bad base placement.
+
+   In June 2002, I fixed two known bugs and a documentation typo.
+   In June 2004 I fixed a number of bugs involving: 1) parsing invalid
+   numbers, 2) manual phasers when SR scan is damaged and commander is
+   present, 3) time warping into the future, 4) hang when moving
+   klingons in crowded quadrants.  (These fixes are in SST2K.)
+
+Here are Stas Sergeev's changes:
+
+   1. The Space Thingy can be shoved, if you ram it, and can fire back if 
+      fired upon. (Now controlled by OPTION_THINGY and turned off if game 
+      type is "plain" or "almy".)
+
+   2. When you are docked, base covers you with an almost invincible shield. 
+      (A commander can still ram you, or a Romulan can destroy the base,
+      or a SCom can even succeed with direct attack IIRC, but this rarely 
+      happens.)  (Now controlled by OPTION_BASE and turned off if game 
+      type is "plain" or "almy".)
+
+   3. Ramming a black hole is no longer instant death.  There is a
+      chance you might get timewarped instead. (Now controlled by 
+      OPTION_BLKHOLE and turned off if game type is "plain" or "almy".)
+
+   4. The Tholian can be hit with phasers.
+
+   5. SCom can't escape from you if no more enemies remain 
+      (without this, chasing SCom can take an eternity).
+
+   6. Probe target you enter is now the destination quadrant. Before I don't 
+      remember what it was, but it was something I had difficulty using.
+
+   7. Secret password is now autogenerated.
+
+   8. "Plaque" is adjusted for A4 paper :-)
+
+   9. Phasers now tells you how much energy needed, but only if the computer 
+      is alive.
+
+   10. Planets are auto-scanned when you enter the quadrant.
+
+   11. Mining or using crystals in presense of enemy now yields an attack.
+       There are other minor adjustments to what yields an attack
+       and what does not.
+
+   12. "freeze" command reverts to "save", most people will understand this
+       better anyway. (SST2K recognizes both.)
+
+   13. Screen-oriented interface, with sensor scans always up.  (SST2K
+       supports both screen-oriented and TTY modes.)
+
+Eric Raymond's changes:
+
+Mainly, I translated this C code out of FORTRAN into C -- created #defines
+for a lot of magic numbers and refactored the heck out of it.
+
+   1. "sos" and "call" becomes "mayday", "freeze" and "save" are both good.
+
+   2. Status report now indicates when dilithium crystals are on board.
+
+   3. Per Dave Matuszek's remarks, Thingy state is never saved across games.
+
+   4. Added game option selection so you can play a close (but not bug-for-
+      bug identical) approximation of older versions.
+*/
+
+/* the input queue */
+static char line[128], *linep = line;
+
+struct game game;
+int thingx, thingy, iqhere, iqengry;
+int iscore, iskill; // Common PLAQ
+double aaitem;
+double perdate;
+char citem[10];
+
+char *device[NDEVICES] = {
+       "S. R. Sensors",
+       "L. R. Sensors",
+       "Phasers",
+       "Photon Tubes",
+       "Life Support",
+       "Warp Engines",
+       "Impulse Engines",
+       "Shields",
+       "Subspace Radio",
+       "Shuttle Craft",
+       "Computer",
+       "Transporter",
+       "Shield Control",
+       "Death Ray",
+       "D. S. Probe"};                                                                 
+
+static struct 
+{
+    char *name;
+    int value;
+    unsigned long option;
+}
+
+commands[] = {
+#define SRSCAN 0
+       {"SRSCAN",      SRSCAN,         OPTION_TTY},
+#define STATUS 1
+       {"STATUS",      STATUS,         OPTION_TTY},
+#define REQUEST        2
+       {"REQUEST",     REQUEST,        OPTION_TTY},
+#define LRSCAN 3
+       {"LRSCAN",      LRSCAN,         OPTION_TTY},
+#define PHASERS        4
+       {"PHASERS",     PHASERS,        0},
+#define TORPEDO        5
+        {"TORPEDO",    TORPEDO,        0},
+       {"PHOTONS",     TORPEDO,        0},
+#define MOVE   6
+       {"MOVE",        MOVE,           0},
+#define SHIELDS        7
+       {"SHIELDS",     SHIELDS,        0},
+#define DOCK   8
+       {"DOCK",        DOCK,           0},
+#define DAMAGES        9
+       {"DAMAGES",     DAMAGES,        0},
+#define CHART  10
+       {"CHART",       CHART,          0},
+#define IMPULSE        11
+       {"IMPULSE",     IMPULSE,        0},
+#define REST   12
+       {"REST",        REST,           0},
+#define WARP   13
+       {"WARP",        WARP,           0},
+#define SCORE  14
+       {"SCORE",       SCORE,          0},
+#define SENSORS        15
+       {"SENSORS",     SENSORS,        OPTION_PLANETS},
+#define ORBIT  16
+       {"ORBIT",       ORBIT,          OPTION_PLANETS},
+#define TRANSPORT      17
+       {"TRANSPORT",   TRANSPORT,      OPTION_PLANETS},
+#define MINE   18
+       {"MINE",        MINE,           OPTION_PLANETS},
+#define CRYSTALS       19
+       {"CRYSTALS",    CRYSTALS,       OPTION_PLANETS},
+#define SHUTTLE        20
+       {"SHUTTLE",     SHUTTLE,        OPTION_PLANETS},
+#define PLANETS        21
+       {"PLANETS",     PLANETS,        OPTION_PLANETS},
+#define REPORT 22
+       {"REPORT",      REPORT,         0},
+#define COMPUTER       23
+       {"COMPUTER",    COMPUTER,       0},
+#define COMMANDS       24
+       {"COMMANDS",    COMMANDS,       0},
+#define EMEXIT 25
+       {"EMEXIT",      EMEXIT,         0},
+#define PROBE  26
+       {"PROBE",       PROBE,          OPTION_PROBE},
+#define SAVE   27
+       {"SAVE",        SAVE,           0},
+       {"FREEZE",      SAVE,           0},
+#define ABANDON        28
+       {"ABANDON",     ABANDON,        0},
+#define DESTRUCT       29
+       {"DESTRUCT",    DESTRUCT,       0},
+#define DEATHRAY       30
+       {"DEATHRAY",    DEATHRAY,       0},
+#define DEBUGCMD       31
+       {"DEBUG",       DEBUGCMD,       0},
+#define MAYDAY 32
+       {"MAYDAY",      MAYDAY,         0},
+       //{"SOS",               MAYDAY,         0},
+       //{"CALL",      MAYDAY,         0},
+#define QUIT   33
+       {"QUIT",        QUIT,           0},
+#define HELP   34
+       {"HELP",        HELP,           0},
+};
+
+#define NUMCOMMANDS    sizeof(commands)/sizeof(commands[0])
+#define ACCEPT(i)      (!commands[i].option || (commands[i].option & game.options))
+
+static void listCommands(void) {
+    int i, k = 0;
+    proutn("LEGAL COMMANDS ARE:");
+    for (i = 0; i < NUMCOMMANDS; i++) {
+       if (!ACCEPT(i))
+           continue;
+       if (k % 5 == 0)
+           skip(1);
+       proutn("%-12s ", commands[i].name); 
+       k++;
+    }
+    skip(1);
+}
+
+static void helpme(void) 
+{
+    int i, j;
+    char cmdbuf[32], *cp;
+    char linebuf[132];
+    FILE *fp;
+    /* Give help on commands */
+    int key;
+    key = scan();
+    while (TRUE) {
+       if (key == IHEOL) {
+           setwnd(prompt_window);
+           proutn("Help on what command? ");
+           key = scan();
+       }
+       setwnd(message_window);
+       if (key == IHEOL) return;
+       for (i = 0; i < NUMCOMMANDS; i++) {
+           if (ACCEPT(i) && strcasecmp(commands[i].name, citem)==0) {
+               i = commands[i].value;
+               break;
+           }
+       }
+       if (i != NUMCOMMANDS) break;
+       skip(1);
+       prout("Valid commands:");
+       listCommands();
+       key = IHEOL;
+       chew();
+       skip(1);
+    }
+    if (i == COMMANDS) {
+       strcpy(cmdbuf, " ABBREV");
+    }
+    else {
+       for (j = 0; commands[i].name[j]; j++)
+           cmdbuf[j] = toupper(commands[i].name[j]);
+       cmdbuf[j] = '\0';
+    }
+    fp = fopen(SSTDOC, "r");
+    if (fp == NULL)
+        fp = fopen(DOC_NAME, "r");
+    if (fp == NULL) {
+       prout("Spock-  \"Captain, that information is missing from the");
+        prout("   computer. You need to find "DOC_NAME" and put it in the");
+        prout("   current directory or to "SSTDOC".\"");
+       /*
+        * This used to continue: "You need to find SST.DOC and put 
+        * it in the current directory."
+        */
+       return;
+    }
+    for (;;) {
+       if (fgets(linebuf, sizeof(linebuf), fp) == NULL) {
+           prout("Spock- \"Captain, there is no information on that command.\"");
+           fclose(fp);
+           return;
+       }
+       if (linebuf[0] == '%' && linebuf[1] == '%'&& linebuf[2] == ' ') {
+           for (cp = linebuf+3; isspace(*cp); cp++)
+               continue;
+           linebuf[strlen(linebuf)-1] = '\0';
+           if (strcasecmp(cp, cmdbuf) == 0)
+               break;
+       }
+    }
+
+    skip(1);
+    prout("Spock- \"Captain, I've found the following information:\"");
+    skip(1);
+
+    while (fgets(linebuf, sizeof(linebuf),fp)) {
+       if (strstr(linebuf, "******"))
+           break;
+       proutn(linebuf);
+    }
+    fclose(fp);
+}
+
+void enqueue(char *s) 
+{
+    strcpy(line, s);
+}
+
+static void makemoves(void) 
+{
+    int i, v = 0, hitme;
+    clrscr();
+    setwnd(message_window);
+    while (TRUE) { /* command loop */
+       drawmaps(1);
+       while (TRUE)  { /* get a command */
+           hitme = FALSE;
+           justin = 0;
+           Time = 0.0;
+           i = -1;
+           chew();
+           setwnd(prompt_window);
+           clrscr();
+           proutn("COMMAND> ");
+           if (scan() == IHEOL) {
+               makechart();
+               continue;
+           }
+           ididit=0;
+           clrscr();
+           setwnd(message_window);
+           clrscr();
+           for (i=0; i < ABANDON; i++)
+               if (ACCEPT(i) && isit(commands[i].name)) {
+                   v = commands[i].value;
+                   break;
+               }
+           if (i < ABANDON && (!commands[i].option || (commands[i].option & game.options))) 
+               break;
+           for (; i < NUMCOMMANDS; i++)
+               if (ACCEPT(i) && strcasecmp(commands[i].name, citem) == 0) {
+                   v = commands[i].value;
+                   break;
+               }
+           if (i < NUMCOMMANDS && (!commands[i].option || (commands[i].option & game.options))) 
+               break;
+           listCommands();
+       }
+       commandhook(commands[i].name, TRUE);
+       switch (v) { /* command switch */
+       case SRSCAN:                 // srscan
+           srscan(SCAN_FULL);
+           break;
+       case STATUS:                 // status
+           srscan(SCAN_STATUS);
+           break;
+       case REQUEST:                   // status request 
+           srscan(SCAN_REQUEST);
+           break;
+       case LRSCAN:                    // lrscan
+           lrscan();
+           break;
+       case PHASERS:                   // phasers
+           phasers();
+           if (ididit) hitme = TRUE;
+           break;
+       case TORPEDO:                   // photons
+           photon();
+           if (ididit) hitme = TRUE;
+           break;
+       case MOVE:                      // move
+           warp(1);
+           break;
+       case SHIELDS:                   // shields
+           doshield(1);
+           if (ididit) {
+               hitme=TRUE;
+               shldchg = 0;
+           }
+           break;
+       case DOCK:                      // dock
+           dock(1);
+           if (ididit) attack(0);
+           break;
+       case DAMAGES:                   // damages
+           dreprt();
+           break;
+       case CHART:                     // chart
+           chart(0);
+           break;
+       case IMPULSE:                   // impulse
+           impuls();
+           break;
+       case REST:                      // rest
+           wait();
+           if (ididit) hitme = TRUE;
+           break;
+       case WARP:                      // warp
+           setwrp();
+           break;
+       case SCORE:                     // score
+           score();
+           break;
+       case SENSORS:                   // sensors
+           sensor();
+           break;
+       case ORBIT:                     // orbit
+           orbit();
+           if (ididit) hitme = TRUE;
+           break;
+       case TRANSPORT:                 // transport "beam"
+           beam();
+           break;
+       case MINE:                      // mine
+           mine();
+           if (ididit) hitme = TRUE;
+           break;
+       case CRYSTALS:                  // crystals
+           usecrystals();
+           if (ididit) hitme = TRUE;
+           break;
+       case SHUTTLE:                   // shuttle
+           shuttle();
+           if (ididit) hitme = TRUE;
+           break;
+       case PLANETS:                   // Planet list
+           preport();
+           break;
+       case REPORT:                    // Game Report 
+           report();
+           break;
+       case COMPUTER:                  // use COMPUTER!
+           eta();
+           break;
+       case COMMANDS:
+           listCommands();
+           break;
+       case EMEXIT:                    // Emergency exit
+           clrscr();                   // Hide screen
+           freeze(TRUE);               // forced save
+           exit(1);                    // And quick exit
+           break;
+       case PROBE:
+           probe();                    // Launch probe
+           if (ididit) hitme = TRUE;
+           break;
+       case ABANDON:                   // Abandon Ship
+           abandn();
+           break;
+       case DESTRUCT:                  // Self Destruct
+           dstrct();
+           break;
+       case SAVE:                      // Save Game
+           freeze(FALSE);
+           clrscr();
+           if (skill > SKILL_GOOD)
+               prout("WARNING--Saved games produce no plaques!");
+           break;
+       case DEATHRAY:                  // Try a desparation measure
+           deathray();
+           if (ididit) hitme = TRUE;
+           break;
+       case DEBUGCMD:                  // What do we want for debug???
+#ifdef DEBUG
+           debugme();
+#endif
+           break;
+       case MAYDAY:                    // Call for help
+           help();
+           if (ididit) hitme = TRUE;
+           break;
+       case QUIT:
+           alldone = 1;                // quit the game
+#ifdef DEBUG
+           if (idebug) score();
+#endif
+           break;
+       case HELP:
+           helpme();   // get help
+           break;
+       }
+       commandhook(commands[i].name, FALSE);
+       for (;;) {
+           if (alldone) break;         // Game has ended
+#ifdef DEBUG
+           if (idebug) prout("2500");
+#endif
+           if (Time != 0.0) {
+               events();
+               if (alldone) break;     // Events did us in
+           }
+           if (game.state.galaxy[quadx][quady].supernova) { // Galaxy went Nova!
+               atover(0);
+               continue;
+           }
+           if (hitme && justin==0) {
+               attack(2);
+               if (alldone) break;
+               if (game.state.galaxy[quadx][quady].supernova) {        // went NOVA! 
+                   atover(0);
+                   hitme = TRUE;
+                   continue;
+               }
+           }
+           break;
+       }
+       if (alldone) break;
+    }
+}
+
+
+int main(int argc, char **argv) 
+{
+    int i, option;
+
+    game.options = OPTION_ALL &~ (OPTION_IOMODES | OPTION_SHOWME | OPTION_PLAIN | OPTION_ALMY);
+    if (getenv("TERM"))
+       game.options |= OPTION_CURSES | OPTION_SHOWME;
+    else
+       game.options |= OPTION_TTY;
+
+    while ((option = getopt(argc, argv, "t")) != -1) {
+       switch (option) {
+       case 't':
+           game.options |= OPTION_TTY;
+           game.options &=~ OPTION_CURSES;
+           break;
+       default:
+           fprintf(stderr, "usage: sst [-t] [startcommand...].\n");
+           exit(0);
+       }
+    }
+
+    randomize();
+    iostart();
+
+    line[0] = '\0';
+    for (i = optind; i < argc;  i++) {
+       strcat(line, argv[i]);
+       strcat(line, " ");
+    }
+    while (TRUE) { /* Play a game */
+       setwnd(fullscreen_window);
+#ifdef DEBUG
+       prout("INITIAL OPTIONS: %0lx", game.options);
+#endif /* DEBUG */
+       clrscr();
+       prelim();
+       setup(line[0] == '\0');
+       if (alldone) {
+           score();
+           alldone = 0;
+       }
+       else makemoves();
+       skip(1);
+       stars();
+       skip(1);
+
+       if (tourn && alldone) {
+           proutn("Do you want your score recorded?");
+           if (ja()) {
+               chew2();
+               freeze(FALSE);
+           }
+       }
+       proutn("Do you want to play again? ");
+       if (!ja()) break;
+    }
+    skip(1);
+    prout("May the Great Bird of the Galaxy roost upon your home planet.");
+    return 0;
+}
+
+
+void cramen(int i) 
+{
+    /* return an enemy */
+    char *s;
+       
+    switch (i) {
+    case IHR: s = "Romulan"; break;
+    case IHK: s = "Klingon"; break;
+    case IHC: s = "Commander"; break;
+    case IHS: s = "Super-commander"; break;
+    case IHSTAR: s = "Star"; break;
+    case IHP: s = "Planet"; break;
+    case IHB: s = "Starbase"; break;
+    case IHBLANK: s = "Black hole"; break;
+    case IHT: s = "Tholian"; break;
+    case IHWEB: s = "Tholian web"; break;
+    case IHQUEST: s = "Stranger"; break;
+    default: s = "Unknown??"; break;
+    }
+    proutn(s);
+}
+
+char *cramlc(enum loctype key, int x, int y)
+{
+    static char buf[32];
+    buf[0] = '\0';
+    if (key == quadrant) strcpy(buf, "Quadrant ");
+    else if (key == sector) strcpy(buf, "Sector ");
+    sprintf(buf+strlen(buf), "%d - %d", x, y);
+    return buf;
+}
+
+void crmena(int i, int enemy, int key, int x, int y) 
+{
+    if (i == 1) proutn("***");
+    cramen(enemy);
+    proutn(" at ");
+    proutn(cramlc(key, x, y));
+}
+
+void crmshp(void) 
+{
+    char *s;
+    switch (ship) {
+    case IHE: s = "Enterprise"; break;
+    case IHF: s = "Faerie Queene"; break;
+    default:  s = "Ship???"; break;
+    }
+    proutn(s);
+}
+
+void stars(void) 
+{
+    prouts("******************************************************");
+    skip(1);
+}
+
+double expran(double avrage) 
+{
+    return -avrage*log(1e-7 + Rand());
+}
+
+double Rand(void) {
+       return rand()/(1.0 + (double)RAND_MAX);
+}
+
+void iran(int size, int *i, int *j) 
+{
+    *i = Rand()*(size*1.0) + 1.0;
+    *j = Rand()*(size*1.0) + 1.0;
+}
+
+void chew(void)
+{
+    linep = line;
+    *linep = 0;
+}
+
+void chew2(void) 
+{
+    /* return IHEOL next time */
+    linep = line+1;
+    *linep = 0;
+}
+
+int scan(void) 
+{
+    int i;
+    char *cp;
+
+    // Init result
+    aaitem = 0.0;
+    *citem = 0;
+
+    // Read a line if nothing here
+    if (*linep == 0) {
+       if (linep != line) {
+           chew();
+           return IHEOL;
+       }
+       cgetline(line, sizeof(line));
+       fflush(stdin);
+       if (curwnd==prompt_window){
+           clrscr();
+           setwnd(message_window);
+           clrscr();
+       }
+       linep = line;
+    }
+    // Skip leading white space
+    while (*linep == ' ') linep++;
+    // Nothing left
+    if (*linep == 0) {
+       chew();
+       return IHEOL;
+    }
+    if (isdigit(*linep) || *linep=='+' || *linep=='-' || *linep=='.') {
+       // treat as a number
+       i = 0;
+       if (sscanf(linep, "%lf%n", &aaitem, &i) < 1) {
+           linep = line; // Invalid numbers are ignored
+           *linep = 0;
+           return IHEOL;
+       }
+       else {
+           // skip to end
+           linep += i;
+           return IHREAL;
+       }
+    }
+    // Treat as alpha
+    cp = citem;
+    while (*linep && *linep!=' ') {
+       if ((cp - citem) < 9) *cp++ = tolower(*linep);
+       linep++;
+    }
+    *cp = 0;
+    return IHALPHA;
+}
+
+int ja(void) 
+{
+    chew();
+    while (TRUE) {
+       scan();
+       chew();
+       if (*citem == 'y') return TRUE;
+       if (*citem == 'n') return FALSE;
+       proutn("Please answer with \"Y\" or \"N\": ");
+    }
+}
+
+void huh(void) 
+{
+    chew();
+    skip(1);
+    prout("Beg your pardon, Captain?");
+}
+
+int isit(char *s) 
+{
+    /* New function -- compares s to scanned citem and returns true if it
+       matches to the length of s */
+
+    return strncasecmp(s, citem, max(1, strlen(citem))) == 0;
+
+}
+
+#ifdef DEBUG
+void debugme(void) 
+{
+    proutn("Reset levels? ");
+    if (ja() != 0) {
+       if (energy < inenrg) energy = inenrg;
+       shield = inshld;
+       torps = intorps;
+       lsupres = inlsr;
+    }
+    proutn("Reset damage? ");
+    if (ja() != 0) {
+       int i;
+       for (i=0; i < NDEVICES; i++) 
+           if (game.damage[i] > 0.0) 
+               game.damage[i] = 0.0;
+    }
+    proutn("Toggle idebug? ");
+    if (ja() != 0) {
+       idebug = !idebug;
+       if (idebug) prout("Debug output ON");
+       else prout("Debug output OFF");
+    }
+    proutn("Cause selective damage? ");
+    if (ja() != 0) {
+       int i, key;
+       for (i=0; i < NDEVICES; i++) {
+           proutn("Kill ");
+           proutn(device[i]);
+           proutn("? ");
+           chew();
+           key = scan();
+           if (key == IHALPHA &&  isit("y")) {
+               game.damage[i] = 10.0;
+           }
+       }
+    }
+    proutn("Examine/change events? ");
+    if (ja() != 0) {
+       int i;
+       for (i = 1; i < NEVENTS; i++) {
+           int key;
+           if (game.future[i] == FOREVER) continue;
+           switch (i) {
+           case FSNOVA:  proutn("Supernova       "); break;
+           case FTBEAM:  proutn("T Beam          "); break;
+           case FSNAP:   proutn("Snapshot        "); break;
+           case FBATTAK: proutn("Base Attack     "); break;
+           case FCDBAS:  proutn("Base Destroy    "); break;
+           case FSCMOVE: proutn("SC Move         "); break;
+           case FSCDBAS: proutn("SC Base Destroy "); break;
+           }
+           proutn("%.2f", game.future[i]-game.state.date);
+           chew();
+           proutn("  ?");
+           key = scan();
+           if (key == IHREAL) {
+               game.future[i] = game.state.date + aaitem;
+           }
+       }
+       chew();
+    }
+    proutn("Induce supernova here? ");
+    if (ja() != 0) {
+       game.state.galaxy[quadx][quady].supernova = TRUE;
+       atover(1);
+    }
+}
+#endif
diff --git a/src/sst.h b/src/sst.h
new file mode 100644 (file)
index 0000000..0c0e492
--- /dev/null
+++ b/src/sst.h
@@ -0,0 +1,515 @@
+#ifndef __SST_H__
+
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <curses.h>
+
+#ifdef DATA_DIR
+#define SSTDOC DATA_DIR"/"DOC_NAME
+#else
+#define SSTDOC DOC_NAME
+#endif
+
+#define min(x, y)      ((x)<(y)?(x):(y))
+#define max(x, y)      ((x)>(y)?(x):(y))
+
+// #define DEBUG
+
+#define PHASEFAC (2.0)
+#define PLNETMAX (10)
+#define GALSIZE        (8)
+#define QUADSIZE (10)
+#define BASEMAX        (5)
+
+/*
+ * These macros hide the difference between 0-origin and 1-origin addressing.
+ * They're a step towards de-FORTRANizing the code.
+ */
+#define VALID_QUADRANT(x, y)   ((x)>=1 && (x)<=GALSIZE && (y)>=1 && (y)<=GALSIZE)
+#define VALID_SECTOR(x, y)     ((x)>=1 && (x)<=QUADSIZE && (y)>=1 && (y)<=QUADSIZE)
+#define for_quadrants(i)       for (i = 1; i <= GALSIZE; i++)
+#define for_sectors(i)         for (i = 1; i <= QUADSIZE; i++)
+#define for_commanders(i)      for (i = 1; i <= game.state.remcom; i++)
+#define for_local_enemies(i)   for (i = 1; i <= nenhere; i++)
+#define for_starbases(i)       for (i = 1; i <= game.state.rembase; i++)
+
+typedef struct {
+    int x;     /* Quadrant location of planet */
+    int y;
+    enum {M=0, N=1, O=2} pclass;
+    int crystals; /* has crystals */
+    enum {unknown, known, shuttle_down} known;
+} planet;
+
+#define DESTROY(pl)    memset(pl, '\0', sizeof(planet))
+
+typedef struct {
+    int snap,          // snapshot taken
+       remkl,                  // remaining klingons
+       remcom,                 // remaining commanders
+       nscrem,                 // remaining super commanders
+       rembase,                // remaining bases
+       starkl,                 // destroyed stars
+       basekl,                 // destroyed bases
+       cx[QUADSIZE+1],cy[QUADSIZE+1],  // Commander quadrant coordinates
+       baseqx[BASEMAX+1],              // Base quadrant X
+       baseqy[BASEMAX+1],              // Base quadrant Y
+       isx, isy,               // Coordinate of Super Commander
+       nromrem,                // Romulans remaining
+       nplankl;                // destroyed planets
+       planet plnets[PLNETMAX];  // Planet information
+       double date,            // stardate
+           remres,             // remaining resources
+           remtime;            // remaining time
+    struct {
+       int stars;
+       int planets;
+       int starbase;
+       int klingons;
+       int romulans;
+       int supernova;
+       int charted;
+    } galaxy[GALSIZE+1][GALSIZE+1];    // The Galaxy (subscript 0 not used)
+    struct {
+       int stars;
+       int starbase;
+       int klingons;
+    } chart[GALSIZE+1][GALSIZE+1];     // the starchart (subscript 0 not used)
+} snapshot;                            // Data that is snapshot
+
+#define NKILLK (inkling - game.state.remkl)
+#define NKILLC (incom - game.state.remcom)
+#define NKILLSC (inscom - game.state.nscrem)
+#define NKILLROM (inrom - game.state.nromrem)
+#define KLINGREM (game.state.remkl + game.state.remcom + game.state.nscrem)
+#define INKLINGTOT (inkling + incom + inscom)
+#define KLINGKILLED (INKLINGTOT - KLINGREM)
+
+#define SKILL_NONE     0
+#define SKILL_NOVICE   1
+#define SKILL_FAIR     2
+#define SKILL_GOOD     3
+#define SKILL_EXPERT   4
+#define SKILL_EMERITUS 5
+
+/* game options */
+#define OPTION_ALL     0xffffffff
+#define OPTION_TTY     0x00000001      /* old interface */
+#define OPTION_CURSES  0x00000002      /* new interface */
+#define OPTION_IOMODES 0x00000003      /* cover both interfaces */
+#define OPTION_PLANETS 0x00000004      /* planets and mining */
+#define OPTION_THOLIAN 0x00000008      /* Tholians and their webs */
+#define OPTION_THINGY  0x00000010      /* Space Thingy can shoot back */
+#define OPTION_PROBE   0x00000020      /* deep-space probes */
+#define OPTION_SHOWME  0x00000040      /* bracket Enterprise in chart */
+#define OPTION_RAMMING 0x00000080      /* enemies may ram Enterprise */
+#define OPTION_MVBADDY 0x00000100      /* more enemies can move */
+#define OPTION_BLKHOLE 0x00000200      /* black hole may timewarp you */
+#define OPTION_BASE    0x00000400      /* bases have good shields */
+#define OPTION_PLAIN   0x01000000      /* user chose plain game */
+#define OPTION_ALMY    0x02000000      /* user chose Almy variant */
+
+/* Define devices */
+#define DSRSENS 0
+#define DLRSENS 1
+#define DPHASER 2
+#define DPHOTON 3
+#define DLIFSUP 4
+#define DWARPEN 5
+#define DIMPULS 6
+#define DSHIELD 7
+#define DRADIO  8
+#define DSHUTTL 9
+#define DCOMPTR 10
+#define DTRANSP 11
+#define DSHCTRL 12
+#define DDRAY   13  // Added deathray
+#define DDSP    14  // Added deep space probe
+#define NDEVICES (15)  // Number of devices
+
+#define FOREVER        1e30
+
+/* Define future events */
+#define FSPY   0       // Spy event happens always (no future[] entry)
+                                       // can cause SC to tractor beam Enterprise
+#define FSNOVA  1   // Supernova
+#define FTBEAM  2   // Commander tractor beams Enterprise
+#define FSNAP   3   // Snapshot for time warp
+#define FBATTAK 4   // Commander attacks base
+#define FCDBAS  5   // Commander destroys base
+#define FSCMOVE 6   // Supercommander moves (might attack base)
+#define FSCDBAS 7   // Supercommander destroys base
+#define FDSPROB 8   // Move deep space probe
+#define NEVENTS (9)
+
+// Scalar variables that are needed for freezing the game
+// are placed in a structure. #defines are used to access by their
+// original names. Gee, I could have done this with the d structure,
+// but I just didn't think of it back when I started.
+
+#define SSTMAGIC       "SST2.0\n"
+
+extern WINDOW *curwnd;
+
+struct game {
+    char magic[sizeof(SSTMAGIC)];
+    unsigned long options;
+    snapshot state;
+    snapshot snapsht;
+    char quad[QUADSIZE+1][QUADSIZE+1];         // contents of our quadrant
+    double kpower[(QUADSIZE+1)*(QUADSIZE+1)];          // enemy energy levels
+    double kdist[(QUADSIZE+1)*(QUADSIZE+1)];           // enemy distances
+    double kavgd[(QUADSIZE+1)*(QUADSIZE+1)];           // average distances
+    double damage[NDEVICES];   // damage encountered
+    double future[NEVENTS];    // future events
+    char passwd[10];           // Self Destruct password
+    int kx[(QUADSIZE+1)*(QUADSIZE+1)];                 // enemy sector locations
+    int ky[(QUADSIZE+1)*(QUADSIZE+1)];
+    /* members with macro definitions start here */
+    int inkling,
+       inbase,
+       incom,
+       inscom,
+       inrom,
+       instar,
+       intorps,
+       condit,
+       torps,
+       ship,
+       quadx,
+       quady,
+       sectx,
+       secty,
+       length,
+       skill,
+       basex,
+       basey,
+       klhere,
+       comhere,
+       casual,
+       nhelp,
+       nkinks,
+       ididit,
+       gamewon,
+       alive,
+       justin,
+       alldone,
+       shldchg,
+       plnetx,
+       plnety,
+       inorbit,
+       landed,
+       iplnet,
+       imine,
+       inplan,
+       nenhere,
+       ishere,
+       neutz,
+       irhere,
+       icraft,
+       ientesc,
+       iscraft,
+       isatb,
+       iscate,
+#ifdef DEBUG
+       idebug,
+#endif
+       iattak,
+       icrystl,
+       tourn,
+       thawed,
+       batx,
+       baty,
+       ithere,
+       ithx,
+       ithy,
+       iseenit,
+       probecx,
+       probecy,
+       proben,
+       isarmed,
+       nprobes;
+    double inresor,
+       intime,
+       inenrg,
+       inshld,
+       inlsr,
+       indate,
+       energy,
+       shield,
+       shldup,
+       warpfac,
+       wfacsq,
+       lsupres,
+       dist,
+       direc,
+       Time,
+       docfac,
+       resting,
+       damfac,
+       lastchart,
+       cryprob,
+       probex,
+       probey,
+       probeinx,
+       probeiny,
+       height;
+};
+extern struct game game;
+
+#define inkling game.inkling           // Initial number of klingons
+#define inbase game.inbase             // Initial number of bases
+#define incom game.incom               // Initian number of commanders
+#define inscom game.inscom             // Initian number of commanders
+#define inrom game.inrom               // Initian number of commanders
+#define instar game.instar             // Initial stars
+#define intorps game.intorps           // Initial/Max torpedoes
+#define condit game.condit             // Condition (red/yellow/green/docked)
+#define torps game.torps               // number of torpedoes
+#define ship game.ship                 // Ship type -- 'E' is Enterprise
+#define quadx game.quadx               // where we are
+#define quady game.quady               //
+#define sectx game.sectx               // where we are
+#define secty game.secty               //
+#define length game.length             // length of game
+#define skill game.skill               // skill level
+#define basex game.basex               // position of base in current quad
+#define basey game.basey               //
+#define klhere game.klhere             // klingons here
+#define comhere game.comhere           // commanders here
+#define casual game.casual             // causalties
+#define nhelp game.nhelp               // calls for help
+#define nkinks game.nkinks             //
+#define ididit game.ididit             // Action taken -- allows enemy to attack
+#define gamewon game.gamewon           // Finished!
+#define alive game.alive               // We are alive (not killed)
+#define justin game.justin             // just entered quadrant
+#define alldone game.alldone           // game is now finished
+#define shldchg game.shldchg           // shield is changing (affects efficiency)
+#define plnetx game.plnetx             // location of planet in quadrant
+#define plnety game.plnety             //
+#define inorbit game.inorbit           // orbiting
+#define landed game.landed             // party on planet (1), on ship (-1)
+#define iplnet game.iplnet             // planet # in quadrant
+#define imine game.imine               // mining
+#define inplan game.inplan             // initial planets
+#define nenhere game.nenhere           // Number of enemies in quadrant
+#define ishere game.ishere             // Super-commander in quandrant
+#define neutz game.neutz               // Romulan Neutral Zone
+#define irhere game.irhere             // Romulans in quadrant
+#define icraft game.icraft             // Kirk in Galileo
+#define ientesc game.ientesc           // Attempted escape from supercommander
+#define iscraft game.iscraft           // =1 if craft on ship, -1 if removed from game
+#define isatb game.isatb               // =1 if SuperCommander is attacking base
+#define iscate game.iscate             // Super Commander is here
+#ifdef DEBUG
+#define idebug game.idebug             // Debug mode
+#endif
+#define iattak game.iattak             // attack recursion elimination (was cracks[4])
+#define icrystl game.icrystl           // dilithium crystals aboard
+#define tourn game.tourn               // Tournament number
+#define thawed game.thawed             // Thawed game
+#define batx game.batx                 // Base coordinates being attacked
+#define baty game.baty                 //
+#define ithere game.ithere             // Tholean is here 
+#define ithx game.ithx                 // coordinates of tholean
+#define ithy game.ithy
+#define iseenit game.iseenit           // Seen base attack report
+#define inresor game.inresor           // initial resources
+#define intime game.intime             // initial time
+#define inenrg game.inenrg             // Initial/Max Energy
+#define inshld game.inshld             // Initial/Max Shield
+#define inlsr game.inlsr               // initial life support resources
+#define indate game.indate             // Initial date
+#define energy game.energy             // Energy level
+#define shield game.shield             // Shield level
+#define shldup game.shldup             // Shields are up
+#define warpfac game.warpfac           // Warp speed
+#define wfacsq game.wfacsq             // squared warp factor
+#define lsupres game.lsupres           // life support reserves
+#define dist game.dist                 // movement distance
+#define direc game.direc               // movement direction
+#define Time game.Time                 // time taken by current operation
+#define docfac game.docfac             // repair factor when docking (constant?)
+#define resting game.resting           // rest time
+#define damfac game.damfac             // damage factor
+#define lastchart game.lastchart       // time star chart was last updated
+#define cryprob game.cryprob           // probability that crystal will work
+#define probex game.probex             // location of probe
+#define probey game.probey
+#define probecx game.probecx           // current probe quadrant
+#define probecy game.probecy   
+#define probeinx game.probeinx         // Probe x,y increment
+#define probeiny game.probeiny         
+#define proben game.proben             // number of moves for probe
+#define isarmed game.isarmed           // Probe is armed
+#define nprobes game.nprobes           // number of probes available
+
+/* the following global state doesn't need to be saved */
+extern char *device[NDEVICES];
+extern int iscore, iskill; // Common PLAQ
+extern double perdate;
+extern double aaitem;
+extern char citem[10];
+
+/* the Space Thingy's global state should *not* be saved! */
+extern int thingx, thingy, iqhere, iqengry;
+
+typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE,
+              FNEG3, FNOVA, FSNOVAED, FABANDN, FDILITHIUM,
+                         FMATERIALIZE, FPHASER, FLOST, FMINING, FDPLANET,
+                         FPNOVA, FSSC, FSTRACTOR, FDRAY, FTRIBBLE,
+                         FHOLE} FINTYPE ;
+enum loctype {neither, quadrant, sector};
+
+#ifndef TRUE
+#define TRUE (1)
+#define FALSE (0)
+#endif
+
+#define IHR 'R'
+#define IHK 'K'
+#define IHC 'C'
+#define IHS 'S'
+#define IHSTAR '*'
+#define IHP 'P'
+#define IHB 'B'
+#define IHBLANK ' '
+#define IHDOT '.'
+#define IHQUEST '?'
+#define IHE 'E'
+#define IHF 'F'
+#define IHT 'T'
+#define IHWEB '#'
+#define IHGREEN 'G'
+#define IHYELLOW 'Y'
+#define IHRED 'R'
+#define IHDOCKED 'D'
+#define IHDEAD 'Z'
+#define IHMATER0 '-'
+#define IHMATER1 'o'
+#define IHMATER2 '0'
+
+
+/* Function prototypes */
+void prelim(void);
+void attack(int);
+int choose(int);
+void setup(int);
+void score(void);
+void atover(int);
+int srscan(int);
+void lrscan(void);
+void phasers(void);
+void photon(void);
+void warp(int);
+void doshield(int);
+void dock(int);
+void dreprt(void);
+void chart(int);
+void rechart(void);
+void impuls(void);
+void wait(void);
+void setwrp(void);
+void events(void);
+void report(void);
+void eta(void);
+void help(void);
+void abandn(void);
+void finish(FINTYPE);
+void dstrct(void);
+void kaboom(void);
+void freeze(int);
+int thaw(void);
+void plaque(void);
+int scan(void);
+#define IHEOL (0)
+#define IHALPHA (1)
+#define IHREAL (2)
+void chew(void);
+void chew2(void);
+void skip(int);
+void prout(char *, ...);
+void proutn(char *, ...);
+void stars(void);
+void newqad(int);
+int ja(void);
+void cramen(int);
+void crmshp(void);
+char *cramlc(enum loctype, int, int);
+double expran(double);
+double Rand(void);
+void iran(int, int *, int *);
+#define square(i) ((i)*(i))
+void dropin(int, int*, int*);
+void newcnd(void);
+void sortkl(void);
+void imove(void);
+void ram(int, int, int, int);
+void crmena(int, int, int, int, int);
+void deadkl(int, int, int, int, int);
+void timwrp(void);
+void movcom(void);
+void torpedo(double, double, int, int, double *, int, int);
+void huh(void);
+void pause_game(int);
+void nova(int, int);
+void snova(int, int);
+void scom(int *);
+void hittem(double *);
+void prouts(char *, ...);
+int isit(char *);
+void preport(void);
+void orbit(void);
+void sensor(void);
+void drawmaps(short);
+void beam(void);
+void mine(void);
+void usecrystals(void);
+void shuttle(void);
+void deathray(void);
+void debugme(void);
+void attakreport(int);
+void movetho(void);
+void probe(void);
+void iostart(void);
+void setwnd(WINDOW *);
+void warble(void);
+void boom(int ii, int jj);
+void tracktorpedo(int ix, int iy, int l, int i, int n, int iquad);
+void cgetline(char *, int);
+void waitfor(void);
+void setpassword(void);
+void commandhook(char *, int);
+void makechart(void);
+void enqueue(char *);
+
+/* mode arguments for srscan() */
+#define SCAN_FULL              1
+#define SCAN_REQUEST           2
+#define SCAN_STATUS            3
+#define SCAN_NO_LEFTSIDE       4
+
+WINDOW *fullscreen_window;
+WINDOW *srscan_window;
+WINDOW *report_window;
+WINDOW *lrscan_window;
+WINDOW *message_window;
+WINDOW *prompt_window;
+
+extern void clreol(void);
+extern void clrscr(void);
+extern void textcolor(int color);
+extern void highvideo(void);
+
+enum COLORS {
+   DEFAULT,
+   BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY,
+   DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
+};
+
+#define DAMAGED        128     /* marker for damaged ship in starmap */
+
+#endif
diff --git a/src/sstlinux.c b/src/sstlinux.c
new file mode 100644 (file)
index 0000000..3c2ebbe
--- /dev/null
@@ -0,0 +1,27 @@
+#include "config.h"
+#include "sstlinux.h"
+
+#ifdef HAVE_LINUX_KD_H
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+static int fd = 0;
+#endif
+
+void sound(unsigned int freq)
+{
+#ifdef HAVE_LINUX_KD_H
+    if(fd==0) fd=open("/dev/console", O_RDONLY);
+    if(fd>0) ioctl(fd, KDMKTONE, 1193180/freq + (0xFFFF<<16));
+#endif
+}
+
+void nosound(void)
+{
+#ifdef HAVE_LINUX_KD_H
+    if(fd>0) ioctl(fd, KDMKTONE, 0);
+#endif
+}
diff --git a/src/sstlinux.h b/src/sstlinux.h
new file mode 100644 (file)
index 0000000..1080f96
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __SSTLINUX_H
+#define __SSTLINUX_H
+
+void sound(unsigned int);
+void nosound(void);
+
+#define delay(x) usleep(x*1000)
+#define randomize() srand((unsigned)time(NULL))
+
+#endif
diff --git a/sst-doc.xml b/sst-doc.xml
deleted file mode 100644 (file)
index 8510e6d..0000000
+++ /dev/null
@@ -1,1964 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE book PUBLIC 
-    "-//OASIS//DTD DocBook XML V4.1.2//EN" 
-    "docbook/docbookxx.dtd"[
-<!ENTITY sst-site      "http://sst.berlios.de/">
-<!ENTITY retro         "http://catb.org/~esr/retro/">
-]>
-<book>
-<bookinfo>
-<title>Super Star Trek</title>
-
-<authorgroup>
-<author>
-  <firstname>David</firstname>
-  <surname>Matuzsek</surname>
-</author>
-<author>
-  <firstname>Paul</firstname>
-  <surname>Reynolds</surname>
-</author>
-<author>
-  <firstname>Tom</firstname>
-  <surname>Almy</surname>
-</author>
-<author>
-  <firstname>Stas</firstname>
-  <surname>Sergeev</surname>
-</author>
-<author>
-  <firstname>Eric</firstname>
-  <othername>Steven</othername>
-  <surname>Raymond</surname>
-</author>
-</authorgroup>
-
-<legalnotice>
-<para>Permission is hereby granted for the copying, distribution,
-modification and use of this program and associated documentation
-for recreational purposes, provided that all references to the
-authors are retained.  However, permission is not and will not be
-granted for the sale or promotional use of this program or program
-documentation, or for use in any situation in which profit may be
-considered an objective, since it is the desire of the authors to
-respect the copyrights of the originators of Star Trek.</para>
-</legalnotice>
-</bookinfo>
-
-
-<dedication>
-<literallayout format='linespecific' class='monospaced'>
-                SSSSS   U   U   PPPPP   EEEEE   RRRRR
-                S       U   U   P   P   E       R   R
-                SSSSS   U   U   PPPPP   EEEE    RRRRR
-                    S   U   U   P       E       R  R
-                SSSSS   UUUUU   P       EEEEE   R   R
-
-
-                 SSSSSSS  TTTTTTTT     A     RRRRRRR
-                SSSSSSSS  TTTTTTTT    AAA    RRRRRRRR
-               SS            TT       AAA    RR     RR
-               SSSSSSS       TT      AA AA   RR     RR
-                SSSSSSS      TT      AA AA   RRRRRRRR
-                      SS     TT     AAAAAAA  RRRRRRR
-                      SS     TT     AAAAAAA  RR   RR
-               SSSSSSSS      TT    AA     AA RR    RR
-               SSSSSSS       TT    AA     AA RR     RR
-    
-    
-    
-                TTTTTTTT RRRRRRR   EEEEEEEEE KK     KK
-                TTTTTTTT RRRRRRRR  EEEEEEEEE KK    KK
-                   TT    RR     RR EE        KK   KK
-                   TT    RR     RR EEEEEE    KKKKKK
-                   TT    RRRRRRRR  EEEEEE    KKKKK
-                   TT    RRRRRRR   EE        KK  KK
-                   TT    RR   RR   EE        KK   KK
-                   TT    RR    RR  EEEEEEEEE KK    KK
-                   TT    RR     RR EEEEEEEEE KK     KK
-
-
-                     Produced For Your Enjoyment
-
-                                 By
-
-                            David Matuszek
-                                 and
-                            Paul Reynolds
-
-                        With Modifications By
-                              Don Smith
-
-                            Resurrected By
-                               Tom Almy
-
-                         Curses Interface By
-                              Stas Sergeev 
-
-               SST 2K polishing and historical research by
-                            Eric S. Raymond
-</literallayout>
-</dedication>
-
-<chapter><title>Introduction</title>
-<para>The Organian Peace Treaty has collapsed, and the Federation is at war
-with the Klingon Empire.  Joining the Klingons against the Federation
-are the members of the <quote>Romulan Star Empire.</quote>  As commander of the
-Starship U.S.S. Enterprise, your job is to wipe out the Klingon
-invasion fleet and make the galaxy safe for democracy.</para>
-
-<para>Your battleground is the entire galaxy, which for convenience is
-divided up into eight rows of eight quadrants each, like a
-checkerboard.  Rows are numbered from top to bottom, and columns are
-numbered left to right, so quadrant 1 - 8 would be in the upper right
-hand corner of the galaxy.</para>
-
-<para>During battle you will be concerned only with those enemies that
-occupy the same quadrant as yourself.  Quadrants are divided up into
-sectors: ten rows of ten sectors each. Sectors are numbered in the
-same way as quadrants, so the sector in the upper right corner is
-sector 1 - 10.  You have a short-range scanner which allows you to
-look at the entire quadrant in a single display.</para>
-
-<para>Enemies recharge during your absence.  If you leave a quadrant
-containing a weakened enemy, when you return to that quadrant he will
-be strong again.  Also, each time you enter a quadrant, the positions
-of everthing in the quadrant (except your ship) are randomized, to
-save you the trouble of trying to remember where everything in the
-quadrant is.  Notice that this refers only to the positions of things
-in the quadrant&mdash;the numbers of each kind of thing are not changed
-(except for black holes and the Super-commander, which move around
-the galaxy).  If you kill something, it stays dead.</para>
-
-<para>The Romulans are not as serious a threat to the Federation as the
-Klingons.  For one thing, there are not as many of them.  For
-another, the Romulans are not as treacherous.  However, Romulans are
-not to be trifled with, especially when you are in violation of the
-Romulan Neutral Zone.</para>
-
-<para>There are two kinds of Klingons: Ordinary Klingons, which are
-bad enough, and Klingon Commanders, which are even worse.  Commanders
-are about three times stronger than ordinary Klingons.  Commanders are
-more resistant to your weapons.  Commanders can move about during
-battle while Ordinary Klingons stay put.  And finally, Commanders have
-a thing called a <quote>long-range tractor beam</quote> which they can
-use, at random intervals, to yank you away from what you are doing
-into their quadrant, to do battle with them.  There is also a special
-commander, called the <quote>Super-commander.</quote> This character
-is so bad he is reserved for the Good, Expert, and Emeritus games.
-Fortunately, there is just one Super-commander in a game.  In addition
-to the undesirable traits of Commanders, he can move from quadrant to
-quadrant at will, seeking out and destroying your starbases and any
-helpful planets he runs across.  He also has a spy planted aboard your
-ship, giving him valuable information about your condition.  Using
-this information, he can do dastardly things like tractor beam your
-ship when you are in bad shape.  And once you've been tractor beamed
-by the Super-commander &mdash;</para>
-
-<para>But the advantages are not all on the side of the enemy.  Your ship
-is more powerful, and has better weapons.  Besides, in the this
-galaxy there are from two to five starbases, at which you can stop to
-refuel and lick your wounds, safe from phaser attack or tractor
-beams.  But you had best not dally there too long, since time is not
-on your side.  The Klingons are not just after you; they are
-attacking the entire Federation.  There is always a finite <quote>time
-left,</quote> which is how much longer the Federation can hold out if you
-just sit on your fat behind and do nothing.  As you wipe out
-Klingons, you reduce the rate at which the invasion fleet weakens the
-Federation, and so the time left until the Federation collapses may
-actually increase.  Since Klingons are the main threat to the
-Federation, the Romulans do not figure into the <quote>time left.</quote>  In
-fact, you need not kill all the Romulans to win.  If you can get all
-the Klingons, the Federation will abide forever, and you have won the
-game.</para>
-
-<para>Space is vast, and it takes precious time to move from one place to
-another.  In comparison, other things happen so quickly that we
-assume they take no time at all. Two ways that time can pass are when
-you move, or when you issue a command to sit still and rest for a
-period of time.  You will sometimes want to do the latter, since the
-various devices aboard your starship may be damaged and require time
-to repair.  Of course, repairs can be made more quickly at a starbase
-than than can in flight.</para>
-
-<para>In addition to Klingons, Romulans, and starbases, the galaxy
-contains (surprise) stars.  Mostly, stars are a nuisance and just get
-in your way.  You can trigger a star into going nova by shooting one
-of your photon torpedoes at it.  When a star novas, it does a lot of
-dammage to anything immediately adjacent to it.  If another star is
-adjacent to a nova, it too will go nova.  Stars may also occasionally
-go supernova; a supernova in a quadrant destroys everything in the
-quadrant andmakes the quadrant permanently uninhabitable.  You may
-<quote>jump over</quote> a quadrant containing a supernova when you
-move, but you should not stop there.</para>
-
-<para>Supernovas may happen spontaneously, without provocation.  If a
-supernova occurs in the same quadrant you are in, your starship has an
-<quote>emergency automatic override</quote> which picks some random
-direction and some random warp factor, and tries to throw you clear of
-the supernova. If the supernova occurs in some other quadrant, you
-just get a warning message from starfleet about it (provided, of
-course, that your subspace radio is working).</para>
-
-<para>Also a few planets are scattered through the galaxy.  These can
-sometimes be a great help since some of them will have <quote>dilithium
-crystals,</quote> which are capable of replenishing the ship's energy
-supply.  You can either beam down to the planet surface using the
-transporter, or take the shuttle craft <quote>Galileo</quote>.</para>
-
-<para>Finally, each quadrant will contain from zero to three black
-holes.  These can deflect or swallow torpedoes passing near them. They
-also swallow enemy ships knocked into them.  If your ship enters one
-&mdash;</para>
-
-<para>Star Trek is a rich game, full of detail.  These instructions are
-written at a moderate level&mdash;no attempt has been made fully to
-describe everything about the game, but there is quite a bit more
-here than you need to get started.  If you are new to the game, just
-get a rough idea of the kinds of commands available, and start
-playing.  After a game or two you will have learned everthing
-important, and the detailed command descriptions which follow will be
-a lot more meaningful to you.</para>
-
-<para>You have weapons: phasers and photon torpedoes. You have a defense:
-deflector shields.  You can look at things: long-range scaners,
-short-range scanners, and a star chart.  You can move about, under
-warp drive or impulse power.  You can also dock at a starbase, rest
-while repairs are being made, abandon ship, self destruct, or give up
-and start a new game.</para>
-
-<para>The Klingons are waiting.</para>
-
-</chapter>
-<chapter><title>Starting the Game</title>
-
-<para>The program will ask you some setup questions.  You can give it 
-command-line arguments that will be treated as answers.  Any token
-may be abbreviated to a unique prefix.</para>
-
-<para>The first question concerns whether you want a regullar,
-tournament, or saved game.  For discussion, see the <link
-linkend="freeze">description of the freeze command</link>.</para>
-
-<para>The second question will concern the length of the game.  
-Longer games include more enemies.</para>
-
-<para>The third question will set the game's difficulty level.
-You should probably start out at the novice level, even if you are
-already familiar with one of the other versions of the Star Trek
-game&mdash;but, of course, the level of game you play is up to you.  If
-you want to start at the Expert level, go ahead.  It's your funeral.
-The Emeritus game is strictly for masochists.</para>
-
-<para>The fourth question, new in SST2K, sets your game options.  A
-blank answer or 'fancy' enables all SST2K features.  The option
-'plain' disables a number of features (Tholians, planets &amp;
-dilithium, Thingies shooting back, deep-space-probes, Klingon ramming
-and movement, time-warping through black holes, death-ray upgrade),
-approximating the original CDC 6600 FORTRAN game from UT Austin.  The
-option 'almy' approximates Tom Almy's C translation from 1979,
-disabling Thingies shooting back, base shields, and time-warping
-through black holes.</para>
-
-</chapter>
-<chapter><title>How To Issue Commands</title>
-
-<para>When the game is waiting for you to enter a command it will
-print out</para>
-
-<screen>
-       COMMAND>
-</screen>
-
-<para>You may then type in your command.  All you have to remember for each
-command is the mnemonic. For example, if you want to move straight up
-one quadrant, you can type in the mnemonic (case insensitive)</para>
-
-<screen>
-       move
-</screen>
-
-<para>and the computer will prompt you with</para>
-
-<screen>
-       Manual or automatic- 
-</screen>
-
-<para>Say you type in <quote>manual</quote>. The computer then responds</para>
-
-<screen>
-       X and Y displacements- 
-</screen>
-
-<para>Now you type in <quote>0 1</quote> which specifies an X movement of zero and a Y
-movement of one.</para>
-
-<para>When you have learned the commands, you can avoid being prompted
-simply by typing in the information without waiting to be asked for
-it. For example, in the above example, you could simply type in</para>
-
-<screen>
-       move manual 0 1
-</screen>
-
-<para>and it will be done.  Or you could type in</para>
-
-<screen>
-       move manual
-</screen>
-
-<para>and when the computer responds with the displacement prompt, you
-can type in</para>
-
-<screen>
-       0 1
-</screen>
-
-<para>and it will understand.</para>
-
-<para>You can abbreviate most mnemonics.  For <quote>move</quote>, you can use any
-of</para>
-
-<screen>
-       move mov mo m
-</screen>
-
-<para>successfully.  For your safety, certain critical commands (such as to
-abandon ship) must be written out in full.  Also, in a few cases two
-or more commands begin with the same letter, and in this case that
-letter refers to a particular one of the commands; to get the other,
-your abbreviation must be two or more characters long.  This sounds
-complicated, but you will learn the abbreviations qGuickly enough.</para>
-
-<para>What this all boils down to is:</para>
-
-<orderedlist>
-<listitem><para>You can abbreviate practically anything</para></listitem>
-<listitem><para>If you forget, the computer will prompt you</para></listitem>
-<listitem><para>If you remember, you can type it all on one line</para></listitem>
-</orderedlist>
-
-<para>If you are part way through entering a command and you change your
-minde, you can cancel the command by typing -1 as one of the
-parameters, with the exception of the manual move command.</para>
-
-<para>If anything is not clear to you, experiment.  The worst you can do is
-lose a game or two.</para>
-
-</chapter>
-<chapter><title>List of Commands</title>
-
-<sect1><title>Short-Range Scan</title>
-
-<literallayout>
-Mnemonic:  SRSCAN
-Shortest abbreviation:  S
-Full commands:  SRSCAN
-                SRSCAN NO
-                SRSCAN CHART
-</literallayout>
-
-<!-- This is new in SST 2K -->
-<para>If you are using the screen-oriented interface, this command is
-suppressed; instead, a short-range scan will always be present on the
-screen.</para>
-
-<para>The short-range scan gives you a considerable amount of information
-about the quadrant your starship is in.  A short-range scan is best
-described by an example.</para>
-
-<screen>
-         1 2 3 4 5 6 7 8 9 10
-      1  * . . . . R . . . .  Stardate      2516.3
-      2  . . . E . . . . . .  Condition     RED  
-      3  . . . . . * . B . .  Position      5 - 1, 2 - 4
-      4  . . . S . . . . . .  Life Support  DAMAGED, Reserves=2.30
-      5  . . . . . . . K . .  Warp Factor   5.0
-      6  . K .   . . . . * .  Energy        2176.24
-      7  . . . . . P . . . .  Torpedoes     3
-      8  . . . . * . . . . .  Shields       UP, 42% 1050.0 units
-      9  . * . . * . . . C .  Klingons Left 12
-     10  . . . . . . . . . .  Time Left     3.72
-</screen>
-
-<para>The left part is a picture of the quadrant.  The E at sector 2 -
-4 represents the Enterprise; the B at sector 3 - 8 is a starbase.
-There are ordinary Klingons (K) at sectors 5 - 8 and 6 - 2, and a
-Klingon Commander (C) at 9 - 9.  The (GULP)
-<quote>Super-commander</quote> (S) is occupies sector 4 - 4, and a
-Romulan (R) is at 1 - 6.  A planet (P) is at sector 7 - 6.  There are
-also a large number of stars (*). The periods (.) are just empty
-space&mdash;they are printed to help you get your bearings.  Sector 6
-- 4 contains a black hole ( ).</para>
-
-<para>The information on the right is assorted status information. You
-can get this alone with the STATUS command.  The status information
-will be absent if you type <quote>N</quote> after SRSCAN.  Otherwise
-status information will be presented.</para>
-
-<para>If you type <quote>C</quote> after SRSCAN, you will be given a
-short-range scan and a Star Chart.</para>
-
-<para>Short-range scans are free.  That is, they use up no energy and no
-time.  If you are in battle, doing a short-range scan does not give
-the enemies another chance to hit you.  You can safely do a
-short-range scan anytime you like.</para>
-
-<para>If your short-range sensors are damaged, this command will only show
-the contents of adjacent sectors.</para>
-</sect1>
-<sect1><title>Status Report</title>
-
-<literallayout>
-Mnemonic:  STATUS
-Shortest abbreviation: ST
-</literallayout>
-
-<!-- This is new in SST 2K --> 
-<para>If you are using the screen-oriented interface, this command is
-suppressed; instead, a full status report will always be present on the
-screen.</para>
-
-<para>This command gives you information about the current state of your
-starship as follows:</para>
-
-<variablelist>
-<varlistentry>
-<term>STARDATE</term>
-<listitem>
-<para>The current date. A stardate is the same as a day.</para>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>CONDITION</term>
-<listitem>
-<para>There are four possible conditions:</para>
-    <variablelist>
-    <varlistentry>
-    <term>DOCKED</term>
-    <listitem><para>docked at starbase.</para></listitem>
-    </varlistentry>
-    <varlistentry>
-    <term>RED</term>
-    <listitem><para>in battle.</para></listitem>
-    </varlistentry>
-    <varlistentry>
-    <term>YELLOW</term>
-    <listitem><para>low on energy (&lt;1000 units)</para></listitem>
-    </varlistentry>
-    <varlistentry>
-    <term>GREEN</term>
-    <listitem><para>none of the above</para></listitem>
-    </varlistentry>
-    </variablelist>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>POSITION</term>
-<listitem>
-<para>Quadrant is given first, then sector</para>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>LIFE SUPPOR</term>
-<listitem>
-<para>If <quote>ACTIVE</quote> then life support systems are functioning
-normally. If on <quote>RESERVES</quote> the number is how many stardates your
-reserve food, air, etc. will last&mdash;you must get repairs made or get to
-starbase before your reserves run out.</para>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>WARP FACTOR</term>
-<listitem>
-<para>What your warp factor is currently set to.</para>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>ENERGY</term>
-<listitem>
-<para>The amount of energy you have left. If it drops to zero, you die.</para>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>TORPEDOES</term>
-<listitem>
-<para>How many photon torpedoes you have left.</para>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>SHIELDS</term>
-<listitem>
-<para>Whether your shields are up or down, how strong they are
-(what percentage of a hit they can deflect), and shield energy.</para> 
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>KLINGONS LEFT</term>
-<listitem>
-<para>How many of the Klingons are still out there.</para>
-</listitem>
-</varlistentry>
-<varlistentry>
-<term>TIME LEFT</term>
-<listitem>
-<para>How long the Federation can hold out against the
-present number of Klingons; that is, how long until the end
-if you do nothing in the meantime.  If you kill Klingons
-quickly, this number will go up&mdash;if not, it will go down.  If
-it reaches zero, the federation is conquered and you lose.</para>
-</listitem>
-</varlistentry>
-</variablelist>
-
-<para>Status information is free&mdash;it uses no time or energy, and
-if you are in battle, the Klingons are not given another chance to hit
-you.</para>
-
-<para>Status information can also be obtained by doing a short-range scan.
-See the SRSCAN command for details.</para>
-
-<para>Each item of information can be obtained singly by requesting it.
-See REQUEST command for details.</para>
-
-</sect1>
-<sect1><title>Long-Range Scan</title>
-
-<literallayout>
-Mnemonic:  LRSCAN
-Shortest abbreviation:  L
-</literallayout>
-
-<!-- This is new in SST 2K --> 
-<para>If you are using the screen-oriented interface, this command is
-suppressed; instead, a long-range scan will always be present on the
-screen.</para>
-
-<para>A long-range scan gives you general information about where you are
-and what is around you.  Here is an example output.</para>
-
-<screen>
-    Long-range scan for Quadrant 5 - 1
-       -1  107  103
-       -1  316    5
-       -1  105 1000
-</screen>
-
-<para>This scan says that you are in row 5, column 1 of the 8 by 8 galaxy.
-The numbers in the scan indicate how many of each kind of thing there
-is in your quadrant and all adjacent quadrants.  The digits are
-interpreted as follows.</para>
-
-<informaltable>
-<tgroup cols='2'>
-<tbody>
-<row>
-  <entry>Thousands digit:</entry>
-  <entry>1000 indicates a supernova (only)</entry>
-</row>
-<row>
-  <entry>Hundreds digit:</entry>
-  <entry>number of Klingons present</entry>
-</row>
-<row>
-  <entry>Tens digit:</entry>
-  <entry>number of starbases present</entry>
-</row>
-<row>
-  <entry>Ones digit:</entry>
-  <entry>number of stars present</entry>
-</row>
-</tbody>
-</tgroup>
-</informaltable>
-
-<para>For example, in your quadrant (5 - 1) the number is 316, which
-indicates 3 Klingons, 1 starbase, and 6 stars.  The long-range
-scanner does not distinguish between ordinary Klingons and Klingon
-command ships.  If there is a supernova, as in the quadrant below and
-to your right (quadrant 6 - 2), there is nothing else in the
-quadrant. </para>
-
-<para>Romulans possess a <quote>cloaking device</quote> which prevents
-their detection by long-range scan.  Because of this fact, Starfleet
-Command is never sure how many Romulans are <quote>out there</quote>.
-When you kill the last Klingon, the remaining Romulans surrender to
-the Federation.</para>
-
-<para>Planets are also undetectable by long-range scan.  The only way to
-detect a planet is to find it in your current quadrant with the
-short-range sensors.</para>
-
-<para>Since you are in column 1, there are no quadrants to your left. The
-minus ones indicate the negative energy barrier at the edge of the
-galaxy, which you are not permitted to cross.</para>
-
-<para>Long-range scans are free.  They use up no energy or time, and can be
-done safely regardless of battle conditions.</para>
-</sect1>
-<sect1><title>Star Chart</title>
-
-<literallayout>
-Mnemonic:  CHART
-Shortest abbreviation:  C
-</literallayout>
-
-<para>As you proceed in the game, you learn more and more about what things
-are where in the galaxy. When ever you first do a scan in a quadrant,
-telemetry sensors are ejected which will report any changes in the
-quadrant(s) back to your ship, providing the sub-space radio is
-working. Spock will enter this information in the chart. If the radio
-is not working, Spock can only enter new information discovered from
-scans, and information in other quadrants may be obsolete.</para>
-
-<para>The chart looks like an 8 by 8 array of numbers.  These numbers are
-interpreted exactly as they are on a long-range scan. A period (.) in
-place of a digit means you do not know that information yet.  For
-example, ... means you know nothing about the quadrant, while .1.
-menas you know it contains a base, but an unknown number of Klingons
-and stars.</para>
-
-<para>Looking at the star chart is a free operation.  It costs neither time
-nor energy, and can be done safely whether in or out of battle.</para>
-
-</sect1>
-<sect1><title>Damage Report</title>
-
-<literallayout>
-Mnemonic:  DAMAGES
-Shortest abbreviation:  DA
-</literallayout>
-
-<para>At any time you may ask for a damage report to find out what devices
-are damaged and how long it will take to repair them.  Naturally,
-repairs proceed faster at a starbase.</para>
-
-<para>If you suffer damages while moving, it is possible that a subsequent
-damage report will not show any damage.  This happens if the time
-spent on the move exceeds the repair time, since in this case the
-damaged devices were fixed en route.</para>
-
-<para>Damage reports are free.  They use no energy or time, and can be done
-safely even in the midst of battle.</para>
-
-</sect1>
-<sect1><title>Move Under Warp Drive</title>
-
-<literallayout>
-Mnemonic:  MOVE
-Shortest abbreviation:  M
-Full command:  MOVE MANUAL &lt;displacement&gt;
-               MOVE AUTOMATIC &lt;destination&gt;
-</literallayout>
-
-<para>This command is the usual way to move from one place to another
-within the galaxy.  You move under warp drive, according to the
-current warp factor (see <quote>WARP FACTOR</quote>).</para>
-
-<para>There are two command modes for movement: MANUAL and AUTOMATIC.
-The manual mode requires the following format:</para>
-
-<screen>
-       MOVE MANUAL &lt;deltax&gt; &lt;deltay&gt;
-</screen>
-
-<para>&lt;deltax&gt; and &lt;deltay&gt; are the horizontal and vertical
-displacements for your starship, in quadrants; a displacement of one
-sector is 0.1 quadrants.  Specifying &lt;deltax&gt; and &lt;deltay&gt;
-causes your ship to move in a straight line to the specified
-destination. If &lt;deltay&gt; is omitted, it is assumed zero. For
-example, the shortest possible command to move one sector to the right
-would be</para>
-
-<screen>
-       M M .1
-</screen>
-
-<para>The following examples of manual movement refer to the short-range
-scan shown earlier.</para>
-
-<screen>
-  Destination Sector   Manual Movement command
-       3 - 1                   M M -.3 -.1
-       2 - 1                   M M -.3
-       1 - 2                   M M -.2 .1
-       1 - 4                   M M 0 .1
-  (leaving quadrant)           M M 0 .2
-</screen>
-
-<para>The automatic mode is as follows:</para>
-
-<screen>
-       MOVE AUTOMATIC &lt;qrow&gt; &lt;qcol&gt; &lt;srow&gt; &lt;scol&gt;
-</screen>
-
-<para>&lt;para&gt;where &lt;qrow&gt; and &lt;qcol&gt; are the row and column
-numbers of the destination quadrant, and &lt;srow&gt; and &lt;scol&gt;
-are the row and column numbers of the destination sector in that
-quadrant.  This command also moves your ship in a straight line path
-to the destination.  For moving within a quadrant, &lt;qrow&gt; and
-&lt;qcol&gt; may be omitted. For example, to move to sector 2 - 9 in
-the current quadrant, the shortest command would be</para>
-
-<screen>
-       M A 2 9
-</screen>
-
-<para>To move to quadrant 3 - 7, sector 5 - 8, type</para>
-
-<screen>
-       M A 3 7 5 8
-</screen>
-
-<para>and it will be done.  In automatic mode, either two or four numbers
-must be supplied.</para>
-
-<para>Automatic mode utilizes the ship's <quote>battle computer.</quote>  If the
-computer is damaged, manual movement must be used.</para>
-
-<para>If warp engines are damaged less than 10 stardates (undocked) you can
-still go warp 4.</para>
-
-<para>It uses time and energy to move.  How much time and how much energy
-depends on your current warp factor, the distance you move, and
-whether your shields are up.  The higher the warp factor, the faster
-you move, but higher warp factors require more energy.  You may move
-with your shields up, but this doubles the energy required.</para>
-
-<para>You can move within a quadrant without being attacked if you just
-entered the quadrant or have been attacked since your last move
-command.  This enables you to move and hit them before they
-retaliate.</para>
-
-</sect1>
-<sect1><title>Warp Factor</title>
-
-<literallayout>
-Mnemonic:  WARP
-Shortest abbreviation:  W
-Full command:  WARP &lt;number&gt;
-</literallayout>
-
-<para>Your warp factor controls the speed of your starship.  The larger the
-warp factor, the faster you go and the more energy you use.</para>
-
-<para>Your minimum warp factor is 1.0 and your maximum warp factor is 10.0
-(which is 100 times as fast and uses 1000 times as much energy).  At
-speeds above warp 6 there is some danger of causing damage to your
-warp engines; this damage is larger at higher warp factors and also
-depends on how far you go at that warp factor.</para>
-
-<para>At exactly warp 10 there is some probability of entering a
-so-called <quote>time warp</quote> and being thrown foward or backward
-in time.  The farther you go at warp 10, the greater is the
-probability of entering the time warp.</para>
-
-</sect1>
-<sect1><title>Impulse Engines</title>
-
-<literallayout>
-Mnemonic:  IMPULSE
-Shortest abbreviation:  I
-Full command:  IMPULSE MANUAL &lt;displacement&gt;
-               IMPULSE AUTOMATIC &lt;destination&gt;
-</literallayout>
-
-<para>The impulse engines give you a way to move when your warp engines are
-damaged.  They move you at a speed of 0.95 sectors per stardate,
-which is the equivalent of a warp factor of about 0.975, so they are
-much too slow to use except in emergencies.</para>
-
-<para>Movement commands are indicated just as in the <quote>MOVE</quote> command.</para>
-
-<para>The impulse engines require 20 units of energy to engage, plus 10
-units per sector (100 units per quadrant) traveled. It does not cost
-extra to move with the shields up.</para>
-
-</sect1>
-<sect1><title>Deflector Shields</title>
-
-<literallayout>
-Mnemonic:  SHIELDS
-Shortest abbreviation:  SH
-Full commands:  SHIELDS UP
-                SHIELDS DOWN
-                SHIELDS TRANSFER &lt;amount of energy to transfer&gt;
-</literallayout>
-
-<para>Your deflector shields are a defensive device to protect you from
-Klingon attacks (and nearby novas).  As the shields protect you, they
-gradually weaken.  A shield strength of 75%, for example, means that
-the next time a Klingon hits you, your shields will deflect 75% of
-the hit, and let 25% get through to hurt you.</para>
-
-<para>It costs 50 units of energy to raise shields, nothing to lower them.
-You may move with your shields up; this costs nothing under impulse
-power, but doubles the energy required for warp drive.</para>
-
-<para>Each time you raise or lower your shields, the Klingons have another
-chance to attack.  Since shields do not raise and lower
-instantaneously, the hits you receive will be intermediate between
-what they would be if the shields were completely up or completely
-down. </para>
-
-<para>You may not fire phasers through your shields.  However you may
-use the <quote>high-speed shield control</quote> to lower shields,
-fire phasers, and raise the shields again before the Klingons can
-react.  Since rapid lowering and raising of the shields requires more
-energy than normal speed operation, it costs you 200 units of energy
-to activate this control.  It is automatically activated when you fire
-phasers while shields are up.  You may fire photon torpedoes, but they
-may be deflected considerably from their intended course as they pass
-through the shields (depending on shield strength).</para>
-
-<para>You may transfer energy beteen the ship's energy (given as
-<quote>Energy</quote> in the status) and the shields.  The word
-<quote>TRANSFER</quote> may be abbreviated <quote>T</quote>.  The
-ammount of energy to transfer is the number of units of energy you
-wish to take from the ship's energy and put into the shields.  If you
-specify an negative number, energy is drained from the shields to the
-ship.  Transfering energy constitutes a turn.  If you transfer energy
-to the shields while you are under attack, they will be at the new
-energy level when you are next hit.</para>
-
-<para>Enemy torpedoes hitting your ship explode on your shields (if they
-are up) and have essentially the same effect as phaser hits.</para>
-
-</sect1>
-<sect1><title>Phasers</title>
-
-<literallayout>
-Mnemonic:  PHASERS
-Shortest abbreviation:  P
-Full commands:  PHASERS AUTOMATIC &lt;AMOUNT TO FIRE&gt; &lt;NO&gt;
-                PHASERS &lt;AMOUNT TO FIRE&gt; &lt;NO&gt;
-                PHASERS MANUAL &lt;NO&gt; &lt;AMOUNT 1&gt; &lt;AMOUNT 2&gt;...&lt;AMOUNT N&gt; 
-</literallayout>
-
-<para>Phasers are energy weapons. As you fire phasers at Klingons, you
-specify an <quote>amount to fire</quote> which is drawn from your
-energy reserves.  The amount of total hit required to kill an enemy is
-partly random.  but also depends on skill level.</para>
-
-<para>The average hit required to kill an ordinary Klingon varies from 200
-units in the Novice game to 250 units in the Emeritus game.
-Commanders normally require from 600 (Novice) to 700 (Emeritus).  The
-Super-commander requres from 875 (Good) to 1000 (Emeritus). Romulans
-require an average of 350 (Novice) to 450 (Emeritus).</para>
-
-<para>Hits on enemies are cumulative, as long as you don't leave the
-quadrant. </para>
-
-<para>In general, not all that you fire will reach the Klingons.  The
-farther away they are, the less phaser energy will reach them. If a
-Klingon is adjacent to you, he will receive about 90% of the phaser
-energy directed at him; a Klingon 5 sectors away will receive about
-60% and a Klingon 10 sectors away will receive about 35%. There is
-some randomness involved, so these figures are not exact. Phasers
-have no effect beyond the boundaries of the quadrant you are in.</para>
-
-<para>Phasers may overheat (and be damaged) if you fire too large a burst
-at once. Firing up to 1500 units is safe.  From 1500 on up the
-probability of overheat increases with the amount fired.</para>
-
-<para>If phaser firing is automatic, the computer decides how to
-divide up your &lt;amount to fire&gt; among the Klingons present.  If
-phaser firing is manual, you specify how much energy to fire at each
-Klingon present (nearest first), rather than just specifying a total
-amount.  You can abreviate <quote>MANUAL</quote> and
-<quote>AUTOMATIC</quote> to one or more letters; if you mention
-neither, automatic fire is usually assumed.</para>
-
-<para>Battle computer information is available by firing phasers manually,
-and allowing the computer to prompt you.  If you enter zero for the
-amount to fire at each enemy, you will get a complete report, without
-cost.  The battle computer will tell you how much phaser energy to
-fire at each enemy for a sure kill.  This information appears in
-parentheses prior to the prompt for each enemy.  Since the amount is
-computed from sensor data, if either the computer or the S.R. sensors
-are damaged, this information will be unavailable, and phasers must
-be fired manually.</para>
-
-<para>A safety interlock prevents phasers from being fired through
-the shields.  If this were not so, the shields would contain your fire
-and you would fry yourself.  However, you may utilize the
-<quote>high-speed shield control</quote> to drop shields, fire
-phasers, and raise shields before the enemy can react.  Since it takes
-more energy to work the shields rapidly with a shot, it costs you 200
-units of energy each time you activate this control.  It is
-automatically activated when you fire phasers while the shields are
-up. By specifying the &lt;no&gt; option, shields are not raised after
-firing.</para>
-
-<para>Phasers have no effect on starbases (which are shielded) or on
-stars.</para>
-
-</sect1>
-<sect1><title>Report</title>
-
-<literallayout>
-Mnemonic:  REPORT
-Shortest abbreviation: REP
-</literallayout>
-
-<para>This command supplies you with information about the state of the
-current game.  Its purpose is to remind you of things that you have
-learned during play, but may have forgotten, and cannot otherwise
-retrieve if you are not playing at a hard-copy terminal.</para>
-
-<para>You are told the following things:</para>
-
-<itemizedlist>
-<listitem><para>The length and skill level of the game you are playing</para></listitem>
-<listitem><para>The original number of Klingons</para></listitem>
-<listitem><para>How many Klingons you have destroyed</para></listitem>
-<listitem><para>Whether the Super-Commander has been destroyed</para></listitem>
-<listitem><para>How many bases have been destroyed</para></listitem>
-<listitem><para>How many bases are left</para></listitem>
-<listitem><para>What bases (if any) are under attack; your subspace radio
-must have been working since the attack to get this 
-information.</para></listitem>
-<listitem><para>How many casualties you have suffered</para></listitem>
-<listitem><para>How many times you have called for help.</para></listitem>
-</itemizedlist>
-
-<para>This same information is automatically given to you when you start to
-play a frozen game.</para>
-
-</sect1>
-<sect1><title>Computer</title>
-
-<literallayout>
-Mnemonic:  COMPUTER
-Shortest abbreviation: CO
-</literallayout>
-
-<para>This command allows using the ship's computer (if functional) to
-calculate travel times and energy usage.</para>
-
-</sect1>
-<sect1><title>Photon Torpedoes</title>
-
-<literallayout>
-Mnemonic:  PHOTONS
-Shortest abbreviation:  PHO
-Full commands:  PHOTONS &lt;NUMBER&gt; &lt;TARG1&gt; &lt;TARG2&gt; &lt;TARG3&gt;
-</literallayout>
-
-<para>Photon torpedoes are projectile weapons&mdash;you either hit what you aim
-at, or you don't.  There are no <quote>partial hits</quote>.</para>
-
-<para>One photon torpedo will usually kill one ordinary Klingon, but it
-usually takes about two for a Klingon Commander.  Photon torpedoes
-can also blow up stars and starbases, if you aren't careful.</para>
-
-<para>You may fire photon torpedoes singly, or in bursts of two or three.
-Each torpedo is individually targetable.  The computer will prompt
-you, asking for the target sector for each torpedo.  Alternately, you
-may specify each target in the command line.</para>
-
-<para>Photon torpedoes cannot be aimed precisely&mdash;there is always some
-randomness involved in the direction they go.  Photon torpedoes may
-be fired with your shields up, but as they pass through the shields
-they are randomly deflected from their intended course even more.</para>
-
-<para>Photon torpedoes are proximity-fused.  The closer they explode to the
-enemy, the more damage they do.  There is a hit <quote>window</quote> about one
-sector wide.  If the torpedo misses the hit window, it does not
-explode and the enemy is unaffected.  Photon torpedoes are only
-effective within the quadrant.  They have no effect on things in
-adjacent quadrants.</para>
-
-<para>If more than one torpedo is fired and only one target sector is
-specified, all torpedoes are fired at that sector.  For example, to
-fire two torpedoes at sector 3 - 4, you type</para>
-
-<screen>
-     PHO 2 3 4           (or)           PHO 2 3 4 3 4
-</screen>
-
-<para>To fire torpedoes at, consecutively, sectors 2 - 6, 1 - 10, and 4 -
-7, type</para>
-
-<screen>
-     PHO 3 2 6 1 10 4 7
-</screen>
-
-<para>There is no restriction to fire directly at a sector.  For example,
-you can enter</para>
-
-<screen>
-       PHO 1 3 2.5
-</screen>
-
-<para>to aim between two sectors.  However, sector numbers must be 1 to 10
-inclusive.</para>
-
-</sect1>
-<sect1><title>Dock at Starbase</title>
-
-<literallayout>
-Mnemonic:  DOCK
-Shortest abbreviation:  D
-</literallayout>
-
-<para>You may dock your starship whenever you are in one of the eight
-sector positions immediately adjacent to a starbase.  When you dock,
-your starship is resupplied with energy, shield energy photon
-torpedoes, and life support reserves.  Repairs also proceed faster at
-starbase, so if some of your devices are damaged, you may wish to stay
-at base (by using the <quote>REST</quote> command) until they are
-fixed.  If your ship has more than its normal maximum energy (which
-can happen if you've loaded crystals) the ship's energy is not
-changed.</para>
-
-<para>You may not dock while in standard orbit around a planet.</para>
-
-<para>Starbases have their own deflector shields, so you are completely
-safe from phaser attack while docked.  You are also safe from
-long-range tractor beams.</para>
-
-<para>Starbases also have both short and long range sensors, which you can
-use if yours are broken. There's also a subspace radio to get
-information about happenings in the galaxy. Mr. Spock will update the
-star chart if your ask for it while docked and your own radio is dead.</para>
-
-</sect1>
-<sect1><title>Rest</title>
-
-<literallayout>
-Mnemonic:  REST
-Shortest abbreviation:  R
-Full command:  REST &lt;NUMBER OF STARDATES&gt;
-</literallayout>
-
-<para>This command simply allows the specified number of stardates to go
-by.  This is useful if you have suffered damages and wish to wait
-until repairs are made before you go back into battle.</para>
-
-<para>It is not generally advisable to rest while you are under attack by
-Klingons.</para>
-
-</sect1>
-<sect1><title>Call Starbase for Help</title>
-
-<literallayout>
-Mnemonic:  MAYDAY
-(No abbreviation)
-</literallayout>
-
-<para>[Originally, this command was called <quote>HELP</quote>, but
-these days that might be misconstrued as an attempt to browae built-in
-documentation! In some later versions it was CALL.]</para>
-
-<para>When you get into serious trouble, you may call a starbase for
-help.  Starbases have a device called a <quote>long-range transporter
-beam</quote> which they can use to teleport you to base.  This works
-by dematerializing your starship at its current position and
-re-materializing it adjacent to the nearest starbase.  Teleportation
-is instantaneous, and starbase supplies the required energy&mdash;all
-you have to do is let them know (via subspace radio) that you need to
-be rescued.</para>
-
-<para>This command should be employed only when absolutely necessary.  In
-the first place, calling for help is an admission on your part that
-you got yourself into something you cannot get yourself out of, and
-you are heavily penalized for this in the final scoring.  Secondly,
-the long-range transporter beam is not reliable&mdash;starbase can always
-manage to dematerialize your starship, but (depending on distance)
-may or may not be able to re-materialize you again.  The long-range
-transporter beam has no absolute maximum range; if you are in the
-same quadrant as a starbase, you have a good chance (about 90%) of
-re-materializing successfully.  your chances drop to roughly 50-50 at
-just over 3 quadrants.</para>
-
-</sect1>
-<sect1><title>Abandon Ship</title>
-
-<literallayout>
-Mnemonic:  ABANDON
-(no abbreviation)
-</literallayout>
-
-<para>You may abandon the Enterprise if necessary.  If there is still a
-starbase in the galaxy, you will be sent there and put in charge of a
-weaker ship, the Faerie Queene.</para>
-
-<para>The Faerie Queene cannot be abandoned.</para>
-
-</sect1>
-<sect1><title>Self-Destruct</title>
-
-<literallayout>
-Mnemonic:  DESTRUCT
-(no abbreviation)
-</literallayout>
-
-<para>You may self-destruct, thus killing yourself and ending the game.  If
-there are nearby Klingons, you may take a few of them with you (the
-more energy you have left, the bigger the bang).</para>
-
-<para>In order to self-destruct you must remember the password you typed in
-at the beginning of the game.</para>
-
-</sect1>
-<sect1><title>Quit Game</title>
-
-<literallayout>
-Mnemonic:  QUIT
-(no abbreviation)
-</literallayout>
-
-<para>Immediately cancel the current game; no conclusion is reached.  You
-will be given an opportunity to start a new game or to leave the Star
-Trek program.</para>
-
-</sect1>
-<sect1><title>Sensor-Scan</title>
-
-<literallayout>
-Mnemonic:  SENSORS
-Shortest abbreviation:  SE
-</literallayout>
-
-<para>Utilizing the short-range sensors, science officer Spock gives you a
-readout on any planet in your quadrant.  Planets come in three
-classes: M, N, and O.  Only class M planets have earth-like
-conditions.  Spock informs you if the planet has any dilithium
-crystals.  Sensor scans are free.</para>
-
-</sect1>
-<sect1><title>Enter Standard Orbit</title>
-
-<literallayout>
-Mnemonic:  ORBIT
-Shortest abbreviation:  O
-</literallayout>
-
-<para>To land on a planet you must first be in standard orbit.  You achieve
-this in a manner similar to docking at starbase.  Moving to one of
-the eight sector positions immediately adjacent to the planet, you
-give the orbit command which puts your ship into standard orbit about
-the planet.  Since this is a maneuver, a small amount of time is
-used; negligible energy is required.  If enemies are present, they
-will attack.</para>
-
-</sect1>
-<sect1><title>Transporter Travel</title>
-
-<literallayout>
-Mnemonic:  TRANSPORT
-Shortest abbreviation:  T
-</literallayout>
-
-<para>The transporter is a device which can convert any physical object
-into energy, beam the energy through space, and reconstruct the
-physical object at some destination.  Transporting is one way to land
-on a planet.  Since the transporter has a limited range, you must be
-in standard orbit to beam down to a planet.  Shields must be down
-while transporting.</para>
-
-<para>The transport command is used to beam a landing party onto a planet
-to mine <quote>dilithium crystals</quote>.  Each time the command is given the
-landing party (which you lead) moves from the ship to the planet, or
-vice-versa.</para>
-
-<para>You are advised against needless transporting, since like all
-devices, the transporter will sometimes malfunction.</para>
-
-<para>The transporter consumes negligible time and energy.  Its use does
-not constitute a <quote>turn</quote>.</para>
-
-</sect1>
-<sect1><title>Shuttle Craft</title>
-
-<literallayout>
-Mnemonic:  SHUTTLE
-Shortest abbreviation:  SHU
-</literallayout>
-
-<para>An alternate way to travel to and from planets.  Because of limited
-range, you must be in standard orbit to use the shuttle craft, named
-"Galileo".  Shields must be down.</para>
-
-<para>Unlike transporting, use of the shuttle craft does constitute a
-<quote>turn</quote> since time is consumed.  The time naturally
-depends on orbit altitude, and is equal to 3.0e-5 times altitude.
-Shuttling uses no ship energy.</para>
-
-<para>You should use the same travel device going from the planet to the
-ship as you use to go from the ship to the planet. However it is
-possible to transport to the planet and have the Galileo crew come
-and pick your landing party up, or to take the Galileo to the planet
-and then transport back, leaving the shuttle craft on the planet.</para>
-
-</sect1>
-<sect1><title>Mine Dilithium Crystals</title>
-
-<literallayout>  
-Mnemonic:  MINE
-Shortest abbreviation:  MI
-</literallayout>
-
-<para>Once you and your mining party are on the surface of a planet which
-has dilithium crystals, this command will dig them for you.</para>
-
-<para>Mining requires time and constitutes a <quote>turn</quote>.  No
-energy is used.  Class M planets require 0.1 to 0.3 stardates to mine.
-Class N planets take twice as long, and class O planets take three
-times as long.</para>
-
-<para>Dilithium crystals contain enormous energy in a form that is readily
-released in the ship's power system.  It is an excellent idea to mine
-them whenever possible, for use in emergencies.  You keep the
-crystals until the game is over or you abandon ship when not at a
-starbase.</para>
-
-</sect1>
-<sect1><title>Load Dilithium Crystals</title>
-
-<literallayout>  
-Mnemonic:  CRYSTALS
-Shortest abbreviation:  CR
-</literallayout>
-
-<para>This is a very powerful command which should be used with caution.
-Once you have dilithium crystals aboard ship, this command will
-instruct engineering officer Scott and Mr. Spock to place a raw
-dilithium crystal into the power channel of the ship's
-matter-antimatter converter.  When it works, this command will
-greatly boost the ship's energy.</para>
-
-<para>Because the crystals are raw and impure, instabilities can occur in
-the power channel.  Usually Scotty can control these.  When he
-cannot, the results are disastrous. Scotty will use those crystals
-that appear to be most stable first.</para>
-
-<para>Since using raw dilithium crystals for this purpose entails
-considerable risk, Starfleet Regulations allow its use only during
-"condition yellow".  No time or energy is used.</para>
-
-</sect1>
-<sect1><title>Planet Report</title>
-
-<literallayout>  
-Mnemonic:  PLANETS
-Shortest abbreviation:  PL
-</literallayout>
-
-<para>Mr. Spock presents you a list of the available information on planets
-in the galaxy.  Since planets do not show up on long-range scans, the
-only way to obtain this information is with the <quote>SENSORS</quote> command.</para>
-
-</sect1>
-<sect1 id="freeze"><title>Freeze</title>
-
-<literallayout> 
-Mnemonic:  FREEZE
-(no abbreviation)
-Full command:  FREEZE &lt;FILE NAME&gt;
-</literallayout>
-
-<para>The purpose of the FREEZE command is to allow a player to save the
-current state of the game, so that it can be finished later.  A
-plaque may not be generated from a frozen game. A file with the
-specified &lt;file name&gt; and type '.TRK' is created (if necessary) in
-the current directory, and all pertinent information about the game
-is written to that file. The game may be continued as usual or be
-terminated at the user's option.</para>
-
-<para>To restart a game created by the <quote>FREEZE</quote> command,
-the user need only type <quote>FROZEN</quote> in response to the
-initial question about the type of game desired, followed by the
-&lt;file name&gt;.</para>
-
-<para>NOTE: A <quote>tournament</quote> game is like a frozen game,
-with the following differences.  (1) Tournament games always start
-from the beginning, while a frozen game can start at any point.  (2)
-Tournament games require only that the player remember the name or
-number of the tournament, while the information about a frozen game
-must be kept on a file. Tournament games can be frozen, but then they
-behave like regular frozen games.</para>
-
-<para>A point worth noting is that 'FREEZE' does not save the seed for the
-random number generator, so that identical actions after restarting
-the same frozen game can lead to different results.  However,
-identical actions after starting a given tournament game always lead
-to the same results.</para>
-
-</sect1>
-<sect1><title>Request</title>
-
-<literallayout>  
-Mnemonic:  REQUEST
-Shortest abbreviation:  REQ
-Full command:  REQUEST &lt;ITEM&gt;
-</literallayout>
-
-<!-- This is new in SST 2K --> 
-<para>If you are using the screen-oriented interface, this command is
-suppressed; instead, a full status report will always be present on the
-screen.</para>
-
-<para>This command allows you to get any single piece of information
-from the &lt;STATUS&gt; command.  &lt;ITEM&gt; specifies which
-information as follows:</para>
-
-<informaltable> 
-<tgroup cols='3'>
-<thead>
-<row>
-  <entry>Information</entry>
-  <entry>Mnemonic for &lt;item&gt;</entry>
-  <entry>Shortest Abbreviation</entry>
-</row>
-</thead>
-<tbody>
-<row><entry>STARDATE</entry>    <entry>DATE</entry>      <entry>D</entry></row>
-<row><entry>CONDITION</entry>   <entry>CONDITION</entry> <entry>C</entry></row>
-<row><entry>POSITION</entry>    <entry>POSITION</entry>  <entry>P</entry></row>
-<row><entry>LIFE SUPPORT</entry><entry>LSUPPORT</entry>  <entry>L</entry></row> 
-<row><entry>WARP FACTOR</entry> <entry>WARPFACTOR</entry><entry>W</entry></row>
-<row><entry>ENERGY</entry>      <entry>ENERGY</entry>    <entry>E</entry></row>
-<row><entry>TORPEDOES</entry>   <entry>TORPEDOES</entry> <entry>T</entry></row>
-<row><entry>SHIELDS</entry>     <entry>SHIELDS</entry>   <entry>S</entry></row>
-<row><entry>KLINGONS LEFT</entry><entry>KLINGONS</entry> <entry>K</entry></row>
-<row><entry>TIME LEFT</entry>   <entry>TIME</entry>     <entry>TI</entry></row>
-<row><entry>BASES LEFT</entry>   <entry>BASES</entry>   <entry>BA</entry></row>
-</tbody>
-</tgroup>
-</informaltable>
-
-</sect1>
-<sect1><title>Experimental Death Ray</title>
-
-<literallayout>
-Mnemonic:  DEATHRAY
-(No abbreviation)
-</literallayout>
-
-<para>This command should be used only in those desperate cases where
-you have absolutely no alternative.  The death ray uses energy to
-rearrange matter.  Unfortunately, its working principles are not yet
-thoroughly understood, and the results are highly
-unpredictable.</para>
-
-<para>The only good thing that can result is the destruction of all
-enemies in your current quadrant.  This will happen about 70% of the
-time.  Only enemies are destroyed; starbases, stars, and planets are
-unaffected.</para>
-
-<para>Constituting the remaining 30% are results varying from bad to
-fatal.</para>
-
-<para>The death ray requires no energy or time, but if you survive, enemies
-will hit you.</para>
-
-<para>The Faerie Queene has no death ray.</para>
-
-<para>If the death ray is damaged in its use, it must be totally replaced.
-This can only be done at starbase.  Because it is a very complex
-device, it takes 9.99 stardates at base to replace the death ray.
-The death ray cannot be repaired in flight.</para>
-
-</sect1>
-<sect1><title>Launch Deep Space Probe</title>
-
-<literallayout>
-Mnemonic:  PROBE
-Shortest abbreviation:  PR
-Full command:  PROBE &lt;ARMED&gt; MANUAL &lt;displacement&gt;
-               PROBE &lt;ARMED&gt; AUTOMATIC &lt;destination&gt;
-</literallayout>
-
-<para>The Enterprise carries a limited number of Long Range Probes. These
-fly to the end of the galaxy and report back a count of the number of
-important things found in each quadrant through which it went. The
-probe flies at warp 10, and therefore uses time during its flight.
-Results are reported immediately via subspace radio and are recorded
-in the star chart.</para>
-
-<para>The probe can also be armed with a NOVAMAX warhead. When launched
-with the warhead armed, the probe flies the same except as soon as it
-reaches the target location, it detonates the warhead in the heart of
-a star, causing a supernova and destroying everything in the
-quadrant. It then flies no further. There must be a star in the
-target quadrant for the NOVAMAX to function. </para>
-
-<para>The probe can fly around objects in a galaxy, but is destroyed if it
-enters a quadrant containing a supernova, or if it leaves the galaxy.</para>
-
-<para>The target location is specified in the same manner as the MOVE
-command, however for automatic movement, if only one pair of
-coordinates are specified they are assumed to be the quadrant and not
-the sector in the current quadrant!</para>
-
-<para>The Faerie Queene has no probes.</para>
-
-</sect1>
-<sect1><title>Emergency Exit</title>
-
-<literallayout>
-Mnemonic:  EMEXIT
-Shortest abbreviation:  E
-</literallayout>
-
-<para>This command provides a quick way to exit from the game when you
-observe a Klingon battle cruiser approaching your terminal.  Its
-effect is to freeze the game on the file 'EMSAVE.TRK' in your current
-directory, erase the screen, and exit.</para>
-
-<para>Of course, you do lose the chance to get a plaque when you use this
-maneuver.</para>
-
-</sect1>
-<sect1><title>Ask for Help</title>
-
-<literallayout>
-Mnemonic:  HELP
-Full command:  HELP &lt;command&gt;
-</literallayout>
-
-<para>This command reads the appropriate section from the SST.DOC file,
-providing the file is in the current directory.</para>
-
-</sect1>
-</chapter>
-<chapter><title>Miscellaneous Notes</title>
-
-<para>Starbases can be attacked by either commanders or by the
-<quote>Super-Commander</quote>.  When this happens, you will be
-notified by subspace radio, provided it is working.  The message will
-inform you how long the base under attack can last.  Since the
-<quote>Super-Commander</quote> is more powerful than an ordinary
-commander, he can destroy a base more quickly.</para>
-
-<para>The <quote>Super-Commander</quote> travels around the galaxy at
-a speed of about warp 6 or 7.  His movement is strictly time based;
-the more time passes, the further he can go.</para>
-
-<para>Scattered through the galaxy are certain zones of control,
-collectively designated the <quote>Romulan Neutral Zone</quote>.  Any
-quadrant which contains Romulans without Klingons is part of the
-Neutral Zone, except if a base is present.  Since Romulans do not show
-on either the long-range scan or the star chart, it is easy for you to
-stumble into this zone.  When you do, if your subspace radio is
-working, you will receive a warning message from the Romulan, politely
-asking you to leave.</para>
-
-<para>In general, Romulans are a galactic nuisance.</para>
-
-<para>The high-speed shield control is fairly reliable, but it has been
-known to malfunction.</para>
-
-<para>You can observe the galactic movements of the
-<quote>Super-Commander</quote> on the star chart, provided he is in
-territory you have scanned and your subspace radio is working.</para>
-
-<para>Periodically, you will receive intelligence reports from
-starfleet command, indicating the current quadrant of the
-<quote>Super-Commander</quote>.  Your subspace radio must be working,
-of course.</para>
-
-<para>Each quadrant will contain from 0 to 3 black holes.  Torpedoes
-entering a black hole disappear.  In fact, anything entering a black
-hole disappears, permanently.  If you can displace an enemy into one,
-he is a goner.  Black holes do not necessarily remain in a quadrant.
-they are transient phenomena.</para>
-
-<para>Commanders will ram your ship, killing themselves and inflicting
-heavy damage to you, if they should happen to decide to advance into
-your sector.</para>
-
-<para>You can get a list of commands by typing
-<quote>COMMANDS</quote>.</para>
-
-</chapter>
-<chapter><title>Scoring</title>
-
-<para>Scoring is fairly simple.  You get points for good things, and you
-lose points for bad things.</para>
-
-<para>You gain&mdash;</para>
-
-<orderedlist>
-<listitem><para>10 points for each ordinary Klingon you kill,</para></listitem>
-<listitem><para>50 points for each commander you kill,</para></listitem>
-<listitem><para>200 points for killing the <quote>Super-Commander</quote>,</para></listitem>
-<listitem><para>20 points for each Romulan killed,</para></listitem>
-<listitem><para>1 point for each Romulan captured.</para></listitem>
-<listitem>
-<para>100 times your average Klingon/stardate kill rate.  If you lose
-the game, your kill rate is based on a minimum of 5 stardates.</para>
-</listitem>
-<listitem>
-<para>You get a bonus if you win the game, based on your rating:</para>
-<para>Novice=100, Fair=200, Good=300, Expert=400, Emeritus=500.</para>
-</listitem>
-</orderedlist>
-
-<para>You lose&mdash;</para>
-
-<orderedlist>
-<listitem><para>200 points if you get yourself killed,</para></listitem>
-<listitem><para>100 points for each starbase you destroy,</para></listitem>
-<listitem><para>100 points for each starship you lose,</para></listitem>
-<listitem><para>45 points for each time you had to call for help,</para></listitem>
-<listitem><para>10 points for each planet you destroyed,</para></listitem>
-<listitem><para>5 points for each star you destroyed, and</para></listitem>
-<listitem><para>1 point for each casualty you incurred.</para></listitem>
-</orderedlist>
-
-<para>In addition to your score, you may also be promoted one grade in rank
-if you play well enough.  Promotion is based primarily on your
-Klingon/stardate kill rate, since this is the best indicator of
-whether you are ready to go on to the next higher rating.  However,
-if you have lost 100 or more points in penalties, the required kill
-rate goes up. Normally, the required kill rate is 0.1 * skill *
-(skill + 1.0) + 0.1, where skill ranges from 1 for Novice to 5 for
-Emeritus.</para>
-
-<para>You can be promoted from any level.  There is a special
-promotion available if you go beyond the <quote>Expert</quote> range.
-You can also have a certificate of merit printed with your name, date,
-and Klingon kill rate, provided you are promoted from either the
-<quote>Expert</quote> or <quote>Emeritus</quote> levels. This
-<quote>plaque</quote> requires a 132 column printer. You may need
-print the certificate to a file, import it into your word processor,
-selecting Courier 8pt font, and then print in <quote>landscape
-orientation</quote>.</para>
-
-</chapter>
-<chapter><title>Handy Reference Page</title>
-
-<literallayout format='linespecific' class='monospaced'>
- ABBREV    FULL COMMAND                           DEVICE USED
- ------    ------------                           -----------
- ABANDON   ABANDON                                shuttle craft
- C         CHART                                  (none)
- CO        COMPUTER                               computer
- CR        CRYSTALS                               (none)
- DA        DAMAGES                                (none)
- DEATHRAY  DEATHRAY                               (none)  
- DESTRUCT  DESTRUCT                               computer
- D         DOCK                                   (none)
- E         EMEXIT                                 (none)
- FREEZE    FREEZE &lt;FILE NAME&gt;                     (none)
- I         IMPULSE &lt;MANUAL&gt; &lt;DISPLACEMENT&gt;        impulse engines
-           IMPULSE AUTOMATIC &lt;DESTINATION&gt;        impulse engines and computer
- L         LRSCAN                                 long-range sensors
- MAYDAY    MAYDAY (for help)                      subspace radio
- MI        MINE                                   (none)
- M         MOVE &lt;MANUAL&gt; &lt;DISPLACEMENT&gt;           warp engines
-           MOVE AUTOMATIC &lt;DESTINATION&gt;           warp engines and computer
- O         ORBIT                                  warp or impulse engines
- P         PHASERS &lt;TOTAL AMOUNT&gt;                 phasers and computer
-           PHASERS AUTOMATIC &lt;TOTAL AMOUNT&gt;       phasers, computer, sr sensors
-           PHASERS MANUAL &lt;AMT1&gt; &lt;AMT2&gt; ...       phasers
- PHO       PHOTONS &lt;NUMBER&gt; &lt;TARGETS&gt;             torpedo tubes 
- PL        PLANETS                                (none)
- PR        PROBE &lt;ARMED&gt; &lt;MANUAL&gt; &lt;DISPLACEMENT&gt;  probe launcher, radio 
-           PROBE &lt;ARMED&gt; AUTOMATIC &lt;DESTINATION&gt;  launcher, radio, computer
- REP       REPORT                                 (none)
- REQ       REQUEST                                (none)
- R         REST &lt;NUMBER OF STARDATES&gt;             (none)
- QUIT      QUIT                                   (none)
- S         SRSCAN &lt;NO or CHART&gt;                   short-range sensors
- SE        SENSORS                                short-range sensors
- SH        SHIELDS &lt;UP, DOWN, or TRANSFER&gt;        deflector shields
- SHU       SHUTTLE                                shuttle craft
- ST        STATUS                                 (none)
- T         TRANSPORT                              transporter
- W         WARP &lt;FACTOR&gt;                          (none)
-
- L. R. Scan:   thousands digit:   supernova
-               hundreds digit:    Klingons
-               tens digit:        starbases
-               ones digit:        stars
-               period (.):        digit not known (star chart only)
-
-Courses are given in manual mode in X - Y displacements; in automatic
-    mode as destination quadrant and/or sector.  Manual mode is default.
-Distances are given in quadrants.  A distance of one sector is 0.1 quadrant.
-Ordinary Klingons have about 400 units of energy, Commanders about
-    1200.  Romulans normally have about 800 units of energy, and the
-    (GULP) "Super-Commander" has about 1800.
-Phaser fire diminishes to about 60 percent at 5 sectors.  Up to 1500
-    units may be fired in a single burst without danger of overheat.
-Warp 6 is the fastest safe speed.  At higher speeds, engine damage
-    may occur.  At warp 10 you may enter a time warp.
-Shields cost 50 units of energy to raise, and double the power
-    requirements of moving under warp drive.  Engaging the high-speed
-    shield control requires 200 units of energy.
-Warp drive requires (distance)*(warp factor cubed) units of energy
-    to travel at a speed of (warp factor squared)/10 quadrants per stardate.
-Impulse engines require 20 units to warm up, plus 100 units per
-     quadrant.  Speed is just under one sector per stardate.
-</literallayout>
-
-</chapter>
-<chapter><title>Game History and Modifications</title>
-
-<sect1><title>Origins</title>
-
-<para>The original Star Trek seems to have been written by Mike
-Mayfield at the beginning of the 1970s.  His first version was in
-BASIC for a Sigma 7 in 1971; in 1972 he rewrote it in Hewlett Packard
-BASIC. The source is <ulink
-url="&sst-site;www/historic/mayfield.basic">available</ulink> on the
-SST2K website. In January 1975 it became part of the DECUS library
-under the name <ulink
-url='http://www.trailing-edge.com/~shoppa/decus/110174.html'>SPACWR</ulink>.</para>
-
-<para>While some people claim to have recollections of playing Trek
-games in the late 1960s, the earlier ones seem actually to have been
-variants of
-<ulink url='http://en.wikipedia.org/wiki/Spacewar!'>
-SPACEWAR</ulink>, the earlier space-combat game on the
-PDP-1. Mayfield <ulink
-url='http://www3.sympatico.ca/maury/games/space/star_trek.html'>wrote
-in 2000</ulink> that he invented the Trek-style galactic grid, and the
-evidence seems to back that up.  Some of the confusion probably stems 
-from the fact that Mayfield's original and several early descendants 
-were distributed under the name SPACWR.</para>
-
-<para>Many different versions radiated from Mayfield's original; most
-of the ones in BASIC are descended from a SPACWR version that David
-Ahl published in <citetitle>101 BASIC Computer Games</citetitle>,
-July 1973. This was a port of Mayfield's version obtained from the HP
-Contributed Programs library.  </para>
-
-<para>Our SST2K is descended from a Taurus BASIC program by Grady
-Hicks dated 5 April 1973. This does not appear to have been derived
-from Ahl's SPACWR. The header says "GENERAL IDEA STOLEN FROM
-PENN. U.", and the game has several features not present in SPACEWR:
-notably, the Death Ray, ramming, and the Klingon summons to surrender.
-And, of course, it predates Ahl's book.  The source is <ulink
-url="&sst-site;www/historic/UT-Trek.basic">available</ulink> on the
-SST2K website.</para>
-
-<para>Dave Matuszek, Paul Reynolds et. al. at UT Austin played the
-Hicks version on a CDC6600, but disliked the long load time and
-extreme slowness of the BASIC program. (David Matuszek notes that the
-Hicks version he played had a habit of throwing long
-quotes from Marcus Aurelius at the users, a feature he found
-intolerable on a TTY at 110 baud.  It must, therefore, have been
-rather longer than  the one we have.)  The Austin crew proceeded to
-write their own Trek game, loosely based on the Hicks version, in
-CDC6600 FORTRAN.  At that time, it was just called "Star Trek"; the
-"Super" was added by later developers. In the rest of this history
-we'll call it the "UT FORTRAN" version.</para>
-
-<para>At the time the UT FORTRAN source was last translated to C it emitted
-the message "Latest update-21 Sept 78".  Thus, it actually predated
-(and may have influenced) the best-known BASIC version, the "Super
-Star Trek" published by David Ahl in his November 1978 sequel
-<citetitle>BASIC Computer Games</citetitle>.</para>
-
-<para>This 1978 "Super Star Trek" had been reworked by Robert Leedom and
-friends from (according to Leedom) Mayfield's HP port. There is
-internal evidence to suggest that at least some features of Leedom's
-SST may have derived from the UT FORTRAN version.  In particular, Dave
-Matuszek recalls implementing command words to replace the original
-numeric command codes, a feature Leedom's SST also had but the
-1973 and 1975 SPACWRs did not.</para>
-
-<para>One signature trait of the UT FORTRAN game and its descendants
-is that the sectors are 10x10 (rather than the 8x8 in Mike Mayfield's
-1972 original and its BASIC descendants).  The UT FORTRAN version also
-preserves the original numbered quadrants rather than the
-astronomically-named quadrants introduced in Ahl's SST and its
-descendants.</para>
-
-<!-- Dave thinks his Fortran Star Trek used the clockface for quadrant -->
-<!-- navigation. -->
-
-<para>Eric Allman's BSD Trek game is one of these, also descended from
-the UT FORTRAN version via translation to C.  However, the mainline version
-(now SST2K) has had a lot more stuff folded into it over the years
-&mdash; deep space probes, dilithium mining, the Tholian Web, and so
-forth.</para>
-</sect1>
-
-<sect1><title>Tom Almy's story</title>
-
-<para>Back in (about) 1977 I got a copy of the Super Star Trek game for
-the CDC 6600 mainframe computer. Someone had converted it to PDP-11
-Fortran but couldn't get it to run because of its size. I modified
-the program to use overlays and managed to shoehorn it in on the 56k
-byte machine.</para>
-
-<para>I liked the game so much I put some time into fixing bugs, mainly
-what could be called continuity errors and loopholes in the game's
-logic. We even played a couple tournaments.</para>
-
-<para>In 1979, I lost access to that PDP-11. I did save the source code
-listing. In 1995, missing that old friend, I started converting the
-program into portable ANSI C. It's been slow, tedious work that took
-over a year to accomplish.</para>
-
-<para>In early 1997, I got the bright idea to look for references to
-<quote>Super Star Trek</quote> on the World Wide Web. There weren't
-many hits, but there was one that came up with 1979 Fortran sources!
-This version had a few additional features that mine didn't have,
-however mine had some feature it didn't have. So I merged its features
-that I liked. I also took a peek at the DECUS version (a port, less
-sources, to the PDP-10), and some other variations.</para>
-
-<para>Modifications I made:</para>
-
-<para>Compared to original version, I've changed the
-<quote>help</quote> command to <quote>call</quote> and the
-<quote>terminate</quote> command to <quote>quit</quote> to better
-match user expectations. The DECUS version apparently made those
-changes as well as changing <quote>freeze</quote> to
-<quote>save</quote>. However I like <quote>freeze</quote>.</para>
-
-<para>I added EMEXIT from the 1979 version.</para>
-
-<para>That later version also mentions srscan and lrscan working when
-docked (using the starbase's scanners), so I made some changes here
-to do this (and indicating that fact to the player), and then
-realized the base would have a subspace radio as well &mdash; doing a
-Chart when docked updates the star chart, and all radio reports will
-be heard. The Dock command will also give a report if a base is under
-attack.</para>
-
-<para>It also had some added logic to spread the initial positioning of
-bases. That made sense to add because most people abort games with
-bad base placement.</para>
-
-<para>The experimental deathray originally had only a 5% chance of success,
-but could be used repeatedly. I guess after a couple years of use, it
-was less <quote>experimental</quote> because the 1979 version had a 70% success
-rate. However it was prone to breaking after use. I upgraded the
-deathray, but kept the original set of failure modes (great humor!).</para>
-
-<para>I put in the Tholian Web code from the 1979 version.</para>
-
-<para>I added code so that Romulans and regular Klingons could move in 
-advanced games. I re-enabled the code which allows enemy ships to
-ram the Enterprise; it had never worked right. The 1979 version
-seems to have it all fixed up, but I'm still not overly happy with
-the algorithm.</para>
-
-<para>The DECUS version had a Deep Space Probe. Looked like a good idea
-so I implemented it based on its description.</para>
-
-</sect1>
-<sect1><title>Stas Sergeev's story</title>
-
-<para>I started from an older Tom Almy version and added features I had
-seen in other mainframe variants of the game, I wrote a screen-oriented 
-interface for it based on the curses library.</para>
-
-<itemizedlist>
-<listitem>
-<para>The Space Thingy can be shoved, if you ram it, and can fire back if 
-fired upon.</para>
-</listitem>
-<listitem>
-<para>The Tholian can be hit with phasers.</para>
-</listitem>
-<listitem>
-<para>When you are docked, base covers you with an almost invincible shields 
-      (a commander can still ram you, or a Romulan can destroy the base,
-      or a SCom can even succeed with direct attack IIRC, but this rarely 
-      happens).</para>
-</listitem>
-<listitem>
-<para>SCom can't escape from you if no more enemies remain (without this, 
-      chasing SCom can take an eternity).</para>
-</listitem>
-<listitem>
-<para>Probe target you enter is now the destination quadrant. Before I don't 
-      remember what it was, but it was something I had difficulty using.</para>
-</listitem>
-<listitem>
-<para>Secret password is now autogenerated.</para>
-</listitem>
-<listitem>
-<para>Victory plaque is adjusted for A4 paper rather than 132-column greenbar
-:-)</para>
-</listitem>
-<listitem>
-<para>Phasers now tells you how much energy needed, but only if the computer 
-is alive.</para>
-</listitem>
-<listitem>
-<para>Planets are auto-scanned when you enter the quadrant.</para>
-</listitem>
-<listitem>
-<para>Mining or using crystals in presense of enemy now yields an attack.
-There are other minor adjustments to what yields an attack
-and what does not.</para>
-</listitem>
-<listitem>
-<para>Ramming a black hole is no longer instant death.  There is a
-chance you might get timewarped instead.</para>
-</listitem>
-<listitem>
-<para>"freeze" command reverts to "save", most people will understand this
-better anyway.</para>
-</listitem>
-<listitem>
-<para>Screen-oriented interface, with sensor scans always up.</para>
-</listitem>
-</itemizedlist>
-
-<para>My changes got merged into SST2K in 2005, and I work on it now.</para>
-
-</sect1>
-<sect1><title>Eric Raymond's story</title>
-
-<para>I played the FORTRAN version of this game in the late 1970s on a
-DEC minicomputer.  In the late 1980s Dave Matuszek and I became
-friends; I was vaguely aware that he had had something to do with the
-original Star Trek game.  In October 2004, sitting in Dave's living
-room, we got to talking about the game and I realized it would make a
-great exhibit for the <ulink
-url='&retro;'>Retrocomputing Museum</ulink>.</para>
-
-<para>A few quick web searches later we found Tom Almy's page.  We
-downloaded his code and Dave verified that that it was a direct
-descendent of UT Super Star Trek &mdash; even though it had been translated
-to C, he was able to recognize names and techniques from the FORTRAN
-version he co-wrote.</para>
-
-<para>This game became an open-source project; see the <ulink
-url='http://developer.berlios.de/projects/sst/'>project
-site</ulink>.</para>
-
-<para>After I launched the Berlios project, Stas Sergeev contacted me.
-We worked together to merge in his changes.</para>
-
-<para>Modifications I've made:</para>
-
-<itemizedlist>
-<listitem><para>
-I converted the flat-text SST.DOC file to XML-Docbook so it can be
-webbed. (That's what you're reading now.)
-</para></listitem>
-<listitem><para>
-The command-help code needed a rewrite because the flat-text form of
-the documentation is now generated from XML and doesn't have the
-easily recognizable section delimiters it used to.  I wrote a script
-to filter that flat-text form into an sst.doc that's easy to parse for
-command descriptions, and changed some logic in sst.c to match.
-</para></listitem>
-<listitem><para>
-I've cleaned up a lot of grubby FORTRANisms in the code internals --
-used sizeof(), replaced magic numeric constants with #defines,
-that sort of thing.
-</para></listitem>
-<listitem><para>
-I fixed a surprising number of typos in the code and documentation.
-</para></listitem>
-<listitem><para>
-All the game state now lives in one big structure that can be
-written to and read from disk as one blob.  The write gives it an
-an identifiable magic number and the thaw logic checks for same. 
-</para></listitem>
-<listitem><para>
-I made the internal pager work, and in the process got rid of a number
-of platform dependencies in the code.
-</para></listitem>
-<listitem><para>
-The HELP/CALL/SOS command is now MAYDAY.
-</para></listitem>
-<listitem><para>
-Status report now indicates if dilithium crystals are on board.
-</para></listitem>
-<listitem><para>
-At Dave's prompting, restored the Space Thingy's original elusive behavior.
-</para></listitem>
-<listitem><para>
-Clean separation of game engine from the UI code, improving Stas
-Sergeev's excellent work on the curses interface.
-</para></listitem>
-</itemizedlist>
-
-<para>Here are some good pages on the history of Star Trek games:</para>
-
-<itemizedlist>
-<listitem><para>
-<ulink url='http://www.dunnington.u-net.com/public/startrek/'>http://www.dunnington.u-net.com/public/startrek/</ulink>
-</para></listitem>
-<listitem><para>
-<ulink url='http://www3.sympatico.ca/maury/games/space/star_trek.html'>http://www3.sympatico.ca/maury/games/space/star_trek.html</ulink>
-</para></listitem>
-<listitem><para>
-<ulink url='http://www.cactus.org/%7Enystrom/startrek.html'>http://www.cactus.org/%7Enystrom/startrek.html</ulink>
-</para></listitem>
-</itemizedlist>
-
-</sect1>
-<sect1><title>Authors' Acknowledgments</title>
-
-<para>These are the original acknowledgments by Dave Matuszek and Paul
-Reynolds:</para>
-
-<para>The authors would like to thank Professor Michael Duggan for his
-encouragement and administrative assistance with the development of
-the Star Trek game, without which it might never have been completed.</para>
-
-<para>Much credit is due to Patrick McGehearty and Rich Cohen, who assisted
-with the original design of the game and contributed greatly to its
-conceptual development.</para>
-
-<para>Thanks are also due to Carl Strange, Hardy Tichenor and Steven Bruell
-for their assistance with certain coding problems.</para>
-
-<para>This game was inspired by and rather loosely based on an earlier
-game, programmed in the BASIC language, by Jim Korp and Grady Hicks.
-It is the authors' understanding that the BASIC game was in turn
-derived from a still earlier version in use at Penn State University.</para>
-
-</sect1>
-<sect1><title>References</title>
-
-<orderedlist>
-<listitem><para><citetitle>Star Trek</citetitle> (the original television
-series), produced and directed by Gene Rodenberry.</para></listitem>
-
-<listitem><para><citetitle>Star Trek</citetitle> (the animated
-television series), produced by Gene Rodenberry and directed by Hal
-Sutherland.  Also excellent, and not just kiddie fare.  If you enjoyed
-the original series you should enjoy this one (unless you have some
-sort of a hangup about watching cartoons).</para></listitem>
-
-<listitem><para><citetitle>The Making of Star Trek</citetitle>, by
-Steven E. Whitfield and Gene Rodenberry.  The best and most complete
-readily available book about Star Trek.  (Ballantine
-Books)</para></listitem>
-
-<listitem><para><citetitle>The World of Star Trek</citetitle>, by
-David Gerrold.  Similiar in scope to the above book.
-(Bantam)</para></listitem>
-
-<listitem><para><citetitle>The Star Trek Guide</citetitle>, third revision 4/17/67, by Gene
-Roddenberry.  The original writer's guide for the television
-series, but less comprehensive than (3) above.
-(Norway Productions)</para></listitem>
-
-<listitem><para><citetitle>The Trouble With Tribbles</citetitle>, by
-David Gerrold.  Includes the complete script of this popular show.
-(Ballantine Books)</para></listitem>
-
-<listitem><para><citetitle>Star Trek</citetitle>, <citetitle>Star Trek
-2</citetitle>, ..., <citetitle>Star Trek 9</citetitle>, by James
-Blish.  The original shows in short story form.
-(Bantam)</para></listitem>
-
-<listitem><para><citetitle>Spock Must Die</citetitle>, by James Blish.
-An original novel, but rather similar to the show <citetitle>The Enemy
-Within</citetitle>.  (Bantam)</para></listitem>
-
-<listitem><para>Model kits of the Enterprise and a <quote>Klingon
-Battle-Cruiser</quote> by AMT Corporation are available at most hobby
-shops.</para></listitem>
-</orderedlist>
-
-</sect1>
-</chapter>
-</book>
diff --git a/sst-layer.xsl b/sst-layer.xsl
deleted file mode 100644 (file)
index 774dd27..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                version="1.0">
-
-<!-- force an encoding we can throw on an xterm window -->
-<xsl:output method="html"
-            encoding="ISO-8859-1"
-            indent="no"/>
-
-</xsl:stylesheet>
-
diff --git a/sst.c b/sst.c
deleted file mode 100644 (file)
index e95fa2a..0000000
--- a/sst.c
+++ /dev/null
@@ -1,846 +0,0 @@
-#define INCLUDED       // Define externs here
-#include <ctype.h>
-#include <getopt.h>
-#include <time.h>
-#include "sstlinux.h"
-#include "sst.h"
-
-#ifndef SSTDOC
-#define SSTDOC "sst.doc"
-#endif
-       
-/*
-
-Dave Matuszek says:
-
-   SRSCAN, MOVE, PHASERS, CALL, STATUS, IMPULSE, PHOTONS, ABANDON,
-   LRSCAN, WARP, SHIELDS, DESTRUCT, CHART, REST, DOCK, QUIT, and DAMAGE
-   were in the original non-"super" version of UT FORTRAN Star Trek.
-
-   Tholians weren't in the original. Dave is dubious about their merits.
-   (They are now controlled by OPTION_THOLIAN and turned off if the game
-   type is "plain".)
-
-   Planets and dilithium crystals weren't in the original.  Dave is OK
-   with this idea. (It's now controlled by OPTION_PLANETS and turned 
-   off if the game type is "plain".)
-
-   Dave says the bit about the Galileo getting turned into a
-   McDonald's is "consistant with our original vision".  (This has been
-   left permanently enabled, as it can only happen if OPTION_PLANETS
-   is on.)
-
-   Dave also says the Space Thingy should not be preserved across saved
-   games, so you can't prove to others that you've seen it.  He says it
-   shouldn't fire back, either.  It should do nothing except scream and
-   disappear when hit by photon torpedos.  It's OK that it may move
-   when attacked, but it didn't in the original.  (Whether the Thingy
-   can fire back is now controlled by OPTION_THINGY and turned off if the
-   game type is "plain" or "almy".  The no-save behavior has been restored.)
-
-   The Faerie Queen, black holes, and time warping were in the original.
-
-Here are Tom Almy's changes:
-
-   In early 1997, I got the bright idea to look for references to
-   "Super Star Trek" on the World Wide Web. There weren't many hits,
-   but there was one that came up with 1979 Fortran sources! This
-   version had a few additional features that mine didn't have,
-   however mine had some feature it didn't have. So I merged its
-   features that I liked. I also took a peek at the DECUS version (a
-   port, less sources, to the PDP-10), and some other variations.
-
-   1, Compared to the original UT version, I've changed the "help" command to
-      "call" and the "terminate" command to "quit" to better match
-      user expectations. The DECUS version apparently made those changes
-      as well as changing "freeze" to "save". However I like "freeze".
-      (Both "freeze" and "save" work in SST2K.)
-
-   2. The experimental deathray originally had only a 5% chance of
-      success, but could be used repeatedly. I guess after a couple
-      years of use, it was less "experimental" because the 1979
-      version had a 70% success rate. However it was prone to breaking
-      after use. I upgraded the deathray, but kept the original set of
-      failure modes (great humor!).  (Now controlled by OPTION_DEATHRAY
-      and turned off if game type is "plain".)
-
-   3. The 1979 version also mentions srscan and lrscan working when
-      docked (using the starbase's scanners), so I made some changes here
-      to do this (and indicating that fact to the player), and then realized
-      the base would have a subspace radio as well -- doing a Chart when docked
-      updates the star chart, and all radio reports will be heard. The Dock
-      command will also give a report if a base is under attack.
-
-   4. Tholian Web from the 1979 version.  (Now controlled by
-      OPTION_THOLIAN and turned off if game type is "plain".)
-
-   5. Enemies can ram the Enterprise. (Now controlled by OPTION_RAMMING
-      and turned off if game type is "plain".)
-
-   6. Regular Klingons and Romulans can move in Expert and Emeritus games. 
-      This code could use improvement. (Now controlled by OPTION_MVBADDY
-      and turned off if game type is "plain".)
-
-   7. The deep-space probe feature from the DECUS version.  (Now controlled
-      by OPTION_PROBE and turned off if game type is "plain").
-
-   8. 'emexit' command from the 1979 version.
-
-   9. Bugfix: Klingon commander movements are no longer reported if long-range 
-      sensors are damaged.
-
-   10. Bugfix: Better base positioning at startup (more spread out).
-      That made sense to add because most people abort games with 
-      bad base placement.
-
-   In June 2002, I fixed two known bugs and a documentation typo.
-   In June 2004 I fixed a number of bugs involving: 1) parsing invalid
-   numbers, 2) manual phasers when SR scan is damaged and commander is
-   present, 3) time warping into the future, 4) hang when moving
-   klingons in crowded quadrants.  (These fixes are in SST2K.)
-
-Here are Stas Sergeev's changes:
-
-   1. The Space Thingy can be shoved, if you ram it, and can fire back if 
-      fired upon. (Now controlled by OPTION_THINGY and turned off if game 
-      type is "plain" or "almy".)
-
-   2. When you are docked, base covers you with an almost invincible shield. 
-      (A commander can still ram you, or a Romulan can destroy the base,
-      or a SCom can even succeed with direct attack IIRC, but this rarely 
-      happens.)  (Now controlled by OPTION_BASE and turned off if game 
-      type is "plain" or "almy".)
-
-   3. Ramming a black hole is no longer instant death.  There is a
-      chance you might get timewarped instead. (Now controlled by 
-      OPTION_BLKHOLE and turned off if game type is "plain" or "almy".)
-
-   4. The Tholian can be hit with phasers.
-
-   5. SCom can't escape from you if no more enemies remain 
-      (without this, chasing SCom can take an eternity).
-
-   6. Probe target you enter is now the destination quadrant. Before I don't 
-      remember what it was, but it was something I had difficulty using.
-
-   7. Secret password is now autogenerated.
-
-   8. "Plaque" is adjusted for A4 paper :-)
-
-   9. Phasers now tells you how much energy needed, but only if the computer 
-      is alive.
-
-   10. Planets are auto-scanned when you enter the quadrant.
-
-   11. Mining or using crystals in presense of enemy now yields an attack.
-       There are other minor adjustments to what yields an attack
-       and what does not.
-
-   12. "freeze" command reverts to "save", most people will understand this
-       better anyway. (SST2K recognizes both.)
-
-   13. Screen-oriented interface, with sensor scans always up.  (SST2K
-       supports both screen-oriented and TTY modes.)
-
-Eric Raymond's changes:
-
-Mainly, I translated this C code out of FORTRAN into C -- created #defines
-for a lot of magic numbers and refactored the heck out of it.
-
-   1. "sos" and "call" becomes "mayday", "freeze" and "save" are both good.
-
-   2. Status report now indicates when dilithium crystals are on board.
-
-   3. Per Dave Matuszek's remarks, Thingy state is never saved across games.
-
-   4. Added game option selection so you can play a close (but not bug-for-
-      bug identical) approximation of older versions.
-*/
-
-/* the input queue */
-static char line[128], *linep = line;
-
-static struct 
-{
-    char *name;
-    int value;
-    unsigned long option;
-}
-commands[] = {
-#define SRSCAN 0
-       {"SRSCAN",      SRSCAN,         OPTION_TTY},
-#define STATUS 1
-       {"STATUS",      STATUS,         OPTION_TTY},
-#define REQUEST        2
-       {"REQUEST",     REQUEST,        OPTION_TTY},
-#define LRSCAN 3
-       {"LRSCAN",      LRSCAN,         OPTION_TTY},
-#define PHASERS        4
-       {"PHASERS",     PHASERS,        0},
-#define TORPEDO        5
-        {"TORPEDO",    TORPEDO,        0},
-       {"PHOTONS",     TORPEDO,        0},
-#define MOVE   6
-       {"MOVE",        MOVE,           0},
-#define SHIELDS        7
-       {"SHIELDS",     SHIELDS,        0},
-#define DOCK   8
-       {"DOCK",        DOCK,           0},
-#define DAMAGES        9
-       {"DAMAGES",     DAMAGES,        0},
-#define CHART  10
-       {"CHART",       CHART,          0},
-#define IMPULSE        11
-       {"IMPULSE",     IMPULSE,        0},
-#define REST   12
-       {"REST",        REST,           0},
-#define WARP   13
-       {"WARP",        WARP,           0},
-#define SCORE  14
-       {"SCORE",       SCORE,          0},
-#define SENSORS        15
-       {"SENSORS",     SENSORS,        OPTION_PLANETS},
-#define ORBIT  16
-       {"ORBIT",       ORBIT,          OPTION_PLANETS},
-#define TRANSPORT      17
-       {"TRANSPORT",   TRANSPORT,      OPTION_PLANETS},
-#define MINE   18
-       {"MINE",        MINE,           OPTION_PLANETS},
-#define CRYSTALS       19
-       {"CRYSTALS",    CRYSTALS,       OPTION_PLANETS},
-#define SHUTTLE        20
-       {"SHUTTLE",     SHUTTLE,        OPTION_PLANETS},
-#define PLANETS        21
-       {"PLANETS",     PLANETS,        OPTION_PLANETS},
-#define REPORT 22
-       {"REPORT",      REPORT,         0},
-#define COMPUTER       23
-       {"COMPUTER",    COMPUTER,       0},
-#define COMMANDS       24
-       {"COMMANDS",    COMMANDS,       0},
-#define EMEXIT 25
-       {"EMEXIT",      EMEXIT,         0},
-#define PROBE  26
-       {"PROBE",       PROBE,          OPTION_PROBE},
-#define SAVE   27
-       {"SAVE",        SAVE,           0},
-       {"FREEZE",      SAVE,           0},
-#define ABANDON        28
-       {"ABANDON",     ABANDON,        0},
-#define DESTRUCT       29
-       {"DESTRUCT",    DESTRUCT,       0},
-#define DEATHRAY       30
-       {"DEATHRAY",    DEATHRAY,       0},
-#define DEBUGCMD       31
-       {"DEBUG",       DEBUGCMD,       0},
-#define MAYDAY 32
-       {"MAYDAY",      MAYDAY,         0},
-       //{"SOS",               MAYDAY,         0},
-       //{"CALL",      MAYDAY,         0},
-#define QUIT   33
-       {"QUIT",        QUIT,           0},
-#define HELP   34
-       {"HELP",        HELP,           0},
-};
-
-#define NUMCOMMANDS    sizeof(commands)/sizeof(commands[0])
-#define ACCEPT(i)      (!commands[i].option || (commands[i].option & game.options))
-
-static void listCommands(void) {
-    int i, k = 0;
-    proutn("LEGAL COMMANDS ARE:");
-    for (i = 0; i < NUMCOMMANDS; i++) {
-       if (!ACCEPT(i))
-           continue;
-       if (k % 5 == 0)
-           skip(1);
-       proutn("%-12s ", commands[i].name); 
-       k++;
-    }
-    skip(1);
-}
-
-static void helpme(void) 
-{
-    int i, j;
-    char cmdbuf[32], *cp;
-    char linebuf[132];
-    FILE *fp;
-    /* Give help on commands */
-    int key;
-    key = scan();
-    while (TRUE) {
-       if (key == IHEOL) {
-           setwnd(prompt_window);
-           proutn("Help on what command? ");
-           key = scan();
-       }
-       setwnd(message_window);
-       if (key == IHEOL) return;
-       for (i = 0; i < NUMCOMMANDS; i++) {
-           if (ACCEPT(i) && strcasecmp(commands[i].name, citem)==0) {
-               i = commands[i].value;
-               break;
-           }
-       }
-       if (i != NUMCOMMANDS) break;
-       skip(1);
-       prout("Valid commands:");
-       listCommands();
-       key = IHEOL;
-       chew();
-       skip(1);
-    }
-    if (i == COMMANDS) {
-       strcpy(cmdbuf, " ABBREV");
-    }
-    else {
-       for (j = 0; commands[i].name[j]; j++)
-           cmdbuf[j] = toupper(commands[i].name[j]);
-       cmdbuf[j] = '\0';
-    }
-    fp = fopen(SSTDOC, "r");
-    if (fp == NULL) {
-       prout("Spock-  \"Captain, that information is missing from the");
-       prout("   computer.\"");
-       /*
-        * This used to continue: "You need to find SST.DOC and put 
-        * it in the current directory."
-        */
-       return;
-    }
-    for (;;) {
-       if (fgets(linebuf, sizeof(linebuf), fp) == NULL) {
-           prout("Spock- \"Captain, there is no information on that command.\"");
-           fclose(fp);
-           return;
-       }
-       if (linebuf[0] == '%' && linebuf[1] == '%'&& linebuf[2] == ' ') {
-           for (cp = linebuf+3; isspace(*cp); cp++)
-               continue;
-           linebuf[strlen(linebuf)-1] = '\0';
-           if (strcasecmp(cp, cmdbuf) == 0)
-               break;
-       }
-    }
-
-    skip(1);
-    prout("Spock- \"Captain, I've found the following information:\"");
-    skip(1);
-
-    while (fgets(linebuf, sizeof(linebuf),fp)) {
-       if (strstr(linebuf, "******"))
-           break;
-       proutn(linebuf);
-    }
-    fclose(fp);
-}
-
-void enqueue(char *s) 
-{
-    strcpy(line, s);
-}
-
-static void makemoves(void) 
-{
-    int i, v = 0, hitme;
-    clrscr();
-    setwnd(message_window);
-    while (TRUE) { /* command loop */
-       drawmaps(1);
-       while (TRUE)  { /* get a command */
-           hitme = FALSE;
-           justin = 0;
-           Time = 0.0;
-           i = -1;
-           chew();
-           setwnd(prompt_window);
-           clrscr();
-           proutn("COMMAND> ");
-           if (scan() == IHEOL) {
-               makechart();
-               continue;
-           }
-           ididit=0;
-           clrscr();
-           setwnd(message_window);
-           clrscr();
-           for (i=0; i < ABANDON; i++)
-               if (ACCEPT(i) && isit(commands[i].name)) {
-                   v = commands[i].value;
-                   break;
-               }
-           if (i < ABANDON && (!commands[i].option || (commands[i].option & game.options))) 
-               break;
-           for (; i < NUMCOMMANDS; i++)
-               if (ACCEPT(i) && strcasecmp(commands[i].name, citem) == 0) {
-                   v = commands[i].value;
-                   break;
-               }
-           if (i < NUMCOMMANDS && (!commands[i].option || (commands[i].option & game.options))) 
-               break;
-           listCommands();
-       }
-       commandhook(commands[i].name, TRUE);
-       switch (v) { /* command switch */
-       case SRSCAN:                 // srscan
-           srscan(SCAN_FULL);
-           break;
-       case STATUS:                 // status
-           srscan(SCAN_STATUS);
-           break;
-       case REQUEST:                   // status request 
-           srscan(SCAN_REQUEST);
-           break;
-       case LRSCAN:                    // lrscan
-           lrscan();
-           break;
-       case PHASERS:                   // phasers
-           phasers();
-           if (ididit) hitme = TRUE;
-           break;
-       case TORPEDO:                   // photons
-           photon();
-           if (ididit) hitme = TRUE;
-           break;
-       case MOVE:                      // move
-           warp(1);
-           break;
-       case SHIELDS:                   // shields
-           doshield(1);
-           if (ididit) {
-               hitme=TRUE;
-               shldchg = 0;
-           }
-           break;
-       case DOCK:                      // dock
-           dock(1);
-           if (ididit) attack(0);
-           break;
-       case DAMAGES:                   // damages
-           dreprt();
-           break;
-       case CHART:                     // chart
-           chart(0);
-           break;
-       case IMPULSE:                   // impulse
-           impuls();
-           break;
-       case REST:                      // rest
-           wait();
-           if (ididit) hitme = TRUE;
-           break;
-       case WARP:                      // warp
-           setwrp();
-           break;
-       case SCORE:                     // score
-           score();
-           break;
-       case SENSORS:                   // sensors
-           sensor();
-           break;
-       case ORBIT:                     // orbit
-           orbit();
-           if (ididit) hitme = TRUE;
-           break;
-       case TRANSPORT:                 // transport "beam"
-           beam();
-           break;
-       case MINE:                      // mine
-           mine();
-           if (ididit) hitme = TRUE;
-           break;
-       case CRYSTALS:                  // crystals
-           usecrystals();
-           if (ididit) hitme = TRUE;
-           break;
-       case SHUTTLE:                   // shuttle
-           shuttle();
-           if (ididit) hitme = TRUE;
-           break;
-       case PLANETS:                   // Planet list
-           preport();
-           break;
-       case REPORT:                    // Game Report 
-           report();
-           break;
-       case COMPUTER:                  // use COMPUTER!
-           eta();
-           break;
-       case COMMANDS:
-           listCommands();
-           break;
-       case EMEXIT:                    // Emergency exit
-           clrscr();                   // Hide screen
-           freeze(TRUE);               // forced save
-           exit(1);                    // And quick exit
-           break;
-       case PROBE:
-           probe();                    // Launch probe
-           if (ididit) hitme = TRUE;
-           break;
-       case ABANDON:                   // Abandon Ship
-           abandn();
-           break;
-       case DESTRUCT:                  // Self Destruct
-           dstrct();
-           break;
-       case SAVE:                      // Save Game
-           freeze(FALSE);
-           clrscr();
-           if (skill > SKILL_GOOD)
-               prout("WARNING--Saved games produce no plaques!");
-           break;
-       case DEATHRAY:                  // Try a desparation measure
-           deathray();
-           if (ididit) hitme = TRUE;
-           break;
-       case DEBUGCMD:                  // What do we want for debug???
-#ifdef DEBUG
-           debugme();
-#endif
-           break;
-       case MAYDAY:                    // Call for help
-           help();
-           if (ididit) hitme = TRUE;
-           break;
-       case QUIT:
-           alldone = 1;                // quit the game
-#ifdef DEBUG
-           if (idebug) score();
-#endif
-           break;
-       case HELP:
-           helpme();   // get help
-           break;
-       }
-       commandhook(commands[i].name, FALSE);
-       for (;;) {
-           if (alldone) break;         // Game has ended
-#ifdef DEBUG
-           if (idebug) prout("2500");
-#endif
-           if (Time != 0.0) {
-               events();
-               if (alldone) break;     // Events did us in
-           }
-           if (game.state.galaxy[quadx][quady].supernova) { // Galaxy went Nova!
-               atover(0);
-               continue;
-           }
-           if (hitme && justin==0) {
-               attack(2);
-               if (alldone) break;
-               if (game.state.galaxy[quadx][quady].supernova) {        // went NOVA! 
-                   atover(0);
-                   hitme = TRUE;
-                   continue;
-               }
-           }
-           break;
-       }
-       if (alldone) break;
-    }
-}
-
-
-int main(int argc, char **argv) 
-{
-    int i, option;
-
-    game.options = OPTION_ALL &~ (OPTION_IOMODES | OPTION_SHOWME | OPTION_PLAIN | OPTION_ALMY);
-    if (getenv("TERM"))
-       game.options |= OPTION_CURSES | OPTION_SHOWME;
-    else
-       game.options |= OPTION_TTY;
-
-    while ((option = getopt(argc, argv, "t")) != -1) {
-       switch (option) {
-       case 't':
-           game.options |= OPTION_TTY;
-           game.options &=~ OPTION_CURSES;
-           break;
-       default:
-           fprintf(stderr, "usage: sst [-t] [startcommand...].\n");
-           exit(0);
-       }
-    }
-
-    randomize();
-    iostart();
-
-    line[0] = '\0';
-    for (i = optind; i < argc;  i++) {
-       strcat(line, argv[i]);
-       strcat(line, " ");
-    }
-    while (TRUE) { /* Play a game */
-       setwnd(fullscreen_window);
-#ifdef DEBUG
-       prout("INITIAL OPTIONS: %0lx", game.options);
-#endif /* DEBUG */
-       clrscr();
-       prelim();
-       setup(line[0] == '\0');
-       if (alldone) {
-           score();
-           alldone = 0;
-       }
-       else makemoves();
-       skip(1);
-       stars();
-       skip(1);
-
-       if (tourn && alldone) {
-           proutn("Do you want your score recorded?");
-           if (ja()) {
-               chew2();
-               freeze(FALSE);
-           }
-       }
-       proutn("Do you want to play again? ");
-       if (!ja()) break;
-    }
-    skip(1);
-    prout("May the Great Bird of the Galaxy roost upon your home planet.");
-    return 0;
-}
-
-
-void cramen(int i) 
-{
-    /* return an enemy */
-    char *s;
-       
-    switch (i) {
-    case IHR: s = "Romulan"; break;
-    case IHK: s = "Klingon"; break;
-    case IHC: s = "Commander"; break;
-    case IHS: s = "Super-commander"; break;
-    case IHSTAR: s = "Star"; break;
-    case IHP: s = "Planet"; break;
-    case IHB: s = "Starbase"; break;
-    case IHBLANK: s = "Black hole"; break;
-    case IHT: s = "Tholian"; break;
-    case IHWEB: s = "Tholian web"; break;
-    case IHQUEST: s = "Stranger"; break;
-    default: s = "Unknown??"; break;
-    }
-    proutn(s);
-}
-
-char *cramlc(enum loctype key, int x, int y)
-{
-    static char buf[32];
-    buf[0] = '\0';
-    if (key == quadrant) strcpy(buf, "Quadrant ");
-    else if (key == sector) strcpy(buf, "Sector ");
-    sprintf(buf+strlen(buf), "%d - %d", x, y);
-    return buf;
-}
-
-void crmena(int i, int enemy, int key, int x, int y) 
-{
-    if (i == 1) proutn("***");
-    cramen(enemy);
-    proutn(" at ");
-    proutn(cramlc(key, x, y));
-}
-
-void crmshp(void) 
-{
-    char *s;
-    switch (ship) {
-    case IHE: s = "Enterprise"; break;
-    case IHF: s = "Faerie Queene"; break;
-    default:  s = "Ship???"; break;
-    }
-    proutn(s);
-}
-
-void stars(void) 
-{
-    prouts("******************************************************");
-    skip(1);
-}
-
-double expran(double avrage) 
-{
-    return -avrage*log(1e-7 + Rand());
-}
-
-double Rand(void) {
-       return rand()/(1.0 + (double)RAND_MAX);
-}
-
-void iran(int size, int *i, int *j) 
-{
-    *i = Rand()*(size*1.0) + 1.0;
-    *j = Rand()*(size*1.0) + 1.0;
-}
-
-void chew(void)
-{
-    linep = line;
-    *linep = 0;
-}
-
-void chew2(void) 
-{
-    /* return IHEOL next time */
-    linep = line+1;
-    *linep = 0;
-}
-
-int scan(void) 
-{
-    int i;
-    char *cp;
-
-    // Init result
-    aaitem = 0.0;
-    *citem = 0;
-
-    // Read a line if nothing here
-    if (*linep == 0) {
-       if (linep != line) {
-           chew();
-           return IHEOL;
-       }
-       cgetline(line, sizeof(line));
-       fflush(stdin);
-       if (curwnd==prompt_window){
-           clrscr();
-           setwnd(message_window);
-           clrscr();
-       }
-       linep = line;
-    }
-    // Skip leading white space
-    while (*linep == ' ') linep++;
-    // Nothing left
-    if (*linep == 0) {
-       chew();
-       return IHEOL;
-    }
-    if (isdigit(*linep) || *linep=='+' || *linep=='-' || *linep=='.') {
-       // treat as a number
-       i = 0;
-       if (sscanf(linep, "%lf%n", &aaitem, &i) < 1) {
-           linep = line; // Invalid numbers are ignored
-           *linep = 0;
-           return IHEOL;
-       }
-       else {
-           // skip to end
-           linep += i;
-           return IHREAL;
-       }
-    }
-    // Treat as alpha
-    cp = citem;
-    while (*linep && *linep!=' ') {
-       if ((cp - citem) < 9) *cp++ = tolower(*linep);
-       linep++;
-    }
-    *cp = 0;
-    return IHALPHA;
-}
-
-int ja(void) 
-{
-    chew();
-    while (TRUE) {
-       scan();
-       chew();
-       if (*citem == 'y') return TRUE;
-       if (*citem == 'n') return FALSE;
-       proutn("Please answer with \"Y\" or \"N\": ");
-    }
-}
-
-void huh(void) 
-{
-    chew();
-    skip(1);
-    prout("Beg your pardon, Captain?");
-}
-
-int isit(char *s) 
-{
-    /* New function -- compares s to scanned citem and returns true if it
-       matches to the length of s */
-
-    return strncasecmp(s, citem, max(1, strlen(citem))) == 0;
-
-}
-
-#ifdef DEBUG
-void debugme(void) 
-{
-    proutn("Reset levels? ");
-    if (ja() != 0) {
-       if (energy < inenrg) energy = inenrg;
-       shield = inshld;
-       torps = intorps;
-       lsupres = inlsr;
-    }
-    proutn("Reset damage? ");
-    if (ja() != 0) {
-       int i;
-       for (i=0; i < NDEVICES; i++) 
-           if (game.damage[i] > 0.0) 
-               game.damage[i] = 0.0;
-    }
-    proutn("Toggle idebug? ");
-    if (ja() != 0) {
-       idebug = !idebug;
-       if (idebug) prout("Debug output ON");
-       else prout("Debug output OFF");
-    }
-    proutn("Cause selective damage? ");
-    if (ja() != 0) {
-       int i, key;
-       for (i=0; i < NDEVICES; i++) {
-           proutn("Kill ");
-           proutn(device[i]);
-           proutn("? ");
-           chew();
-           key = scan();
-           if (key == IHALPHA &&  isit("y")) {
-               game.damage[i] = 10.0;
-           }
-       }
-    }
-    proutn("Examine/change events? ");
-    if (ja() != 0) {
-       int i;
-       for (i = 1; i < NEVENTS; i++) {
-           int key;
-           if (game.future[i] == FOREVER) continue;
-           switch (i) {
-           case FSNOVA:  proutn("Supernova       "); break;
-           case FTBEAM:  proutn("T Beam          "); break;
-           case FSNAP:   proutn("Snapshot        "); break;
-           case FBATTAK: proutn("Base Attack     "); break;
-           case FCDBAS:  proutn("Base Destroy    "); break;
-           case FSCMOVE: proutn("SC Move         "); break;
-           case FSCDBAS: proutn("SC Base Destroy "); break;
-           }
-           proutn("%.2f", game.future[i]-game.state.date);
-           chew();
-           proutn("  ?");
-           key = scan();
-           if (key == IHREAL) {
-               game.future[i] = game.state.date + aaitem;
-           }
-       }
-       chew();
-    }
-    proutn("Induce supernova here? ");
-    if (ja() != 0) {
-       game.state.galaxy[quadx][quady].supernova = TRUE;
-       atover(1);
-    }
-}
-#endif
diff --git a/sst.h b/sst.h
deleted file mode 100644 (file)
index f8d65ff..0000000
--- a/sst.h
+++ /dev/null
@@ -1,528 +0,0 @@
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <curses.h>
-#ifndef INCLUDED
-#define EXTERN extern
-#else
-#define EXTERN
-#endif
-
-#define min(x, y)      ((x)<(y)?(x):(y))
-#define max(x, y)      ((x)>(y)?(x):(y))
-
-// #define DEBUG
-
-#define PHASEFAC (2.0)
-#define PLNETMAX (10)
-#define GALSIZE        (8)
-#define QUADSIZE (10)
-#define BASEMAX        (5)
-
-/*
- * These macros hide the difference between 0-origin and 1-origin addressing.
- * They're a step towards de-FORTRANizing the code.
- */
-#define VALID_QUADRANT(x, y)   ((x)>=1 && (x)<=GALSIZE && (y)>=1 && (y)<=GALSIZE)
-#define VALID_SECTOR(x, y)     ((x)>=1 && (x)<=QUADSIZE && (y)>=1 && (y)<=QUADSIZE)
-#define for_quadrants(i)       for (i = 1; i <= GALSIZE; i++)
-#define for_sectors(i)         for (i = 1; i <= QUADSIZE; i++)
-#define for_commanders(i)      for (i = 1; i <= game.state.remcom; i++)
-#define for_local_enemies(i)   for (i = 1; i <= nenhere; i++)
-#define for_starbases(i)       for (i = 1; i <= game.state.rembase; i++)
-
-typedef struct {
-    int x;     /* Quadrant location of planet */
-    int y;
-    enum {M=0, N=1, O=2} pclass;
-    int crystals; /* has crystals */
-    enum {unknown, known, shuttle_down} known;
-} planet;
-
-#define DESTROY(pl)    memset(pl, '\0', sizeof(planet))
-
-typedef struct {
-    int snap,          // snapshot taken
-       remkl,                  // remaining klingons
-       remcom,                 // remaining commanders
-       nscrem,                 // remaining super commanders
-       rembase,                // remaining bases
-       starkl,                 // destroyed stars
-       basekl,                 // destroyed bases
-       cx[QUADSIZE+1],cy[QUADSIZE+1],  // Commander quadrant coordinates
-       baseqx[BASEMAX+1],              // Base quadrant X
-       baseqy[BASEMAX+1],              // Base quadrant Y
-       isx, isy,               // Coordinate of Super Commander
-       nromrem,                // Romulans remaining
-       nplankl;                // destroyed planets
-       planet plnets[PLNETMAX];  // Planet information
-       double date,            // stardate
-           remres,             // remaining resources
-           remtime;            // remaining time
-    struct {
-       int stars;
-       int planets;
-       int starbase;
-       int klingons;
-       int romulans;
-       int supernova;
-       int charted;
-    } galaxy[GALSIZE+1][GALSIZE+1];    // The Galaxy (subscript 0 not used)
-    struct {
-       int stars;
-       int starbase;
-       int klingons;
-    } chart[GALSIZE+1][GALSIZE+1];     // the starchart (subscript 0 not used)
-} snapshot;                            // Data that is snapshot
-
-#define NKILLK (inkling - game.state.remkl)
-#define NKILLC (incom - game.state.remcom)
-#define NKILLSC (inscom - game.state.nscrem)
-#define NKILLROM (inrom - game.state.nromrem)
-#define KLINGREM (game.state.remkl + game.state.remcom + game.state.nscrem)
-#define INKLINGTOT (inkling + incom + inscom)
-#define KLINGKILLED (INKLINGTOT - KLINGREM)
-
-#define SKILL_NONE     0
-#define SKILL_NOVICE   1
-#define SKILL_FAIR     2
-#define SKILL_GOOD     3
-#define SKILL_EXPERT   4
-#define SKILL_EMERITUS 5
-
-/* game options */
-#define OPTION_ALL     0xffffffff
-#define OPTION_TTY     0x00000001      /* old interface */
-#define OPTION_CURSES  0x00000002      /* new interface */
-#define OPTION_IOMODES 0x00000003      /* cover both interfaces */
-#define OPTION_PLANETS 0x00000004      /* planets and mining */
-#define OPTION_THOLIAN 0x00000008      /* Tholians and their webs */
-#define OPTION_THINGY  0x00000010      /* Space Thingy can shoot back */
-#define OPTION_PROBE   0x00000020      /* deep-space probes */
-#define OPTION_SHOWME  0x00000040      /* bracket Enterprise in chart */
-#define OPTION_RAMMING 0x00000080      /* enemies may ram Enterprise */
-#define OPTION_MVBADDY 0x00000100      /* more enemies can move */
-#define OPTION_BLKHOLE 0x00000200      /* black hole may timewarp you */
-#define OPTION_BASE    0x00000400      /* bases have good shields */
-#define OPTION_PLAIN   0x01000000      /* user chose plain game */
-#define OPTION_ALMY    0x02000000      /* user chose Almy variant */
-
-/* Define devices */
-#define DSRSENS 0
-#define DLRSENS 1
-#define DPHASER 2
-#define DPHOTON 3
-#define DLIFSUP 4
-#define DWARPEN 5
-#define DIMPULS 6
-#define DSHIELD 7
-#define DRADIO  8
-#define DSHUTTL 9
-#define DCOMPTR 10
-#define DTRANSP 11
-#define DSHCTRL 12
-#define DDRAY   13  // Added deathray
-#define DDSP    14  // Added deep space probe
-#define NDEVICES (15)  // Number of devices
-
-#define FOREVER        1e30
-
-/* Define future events */
-#define FSPY   0       // Spy event happens always (no future[] entry)
-                                       // can cause SC to tractor beam Enterprise
-#define FSNOVA  1   // Supernova
-#define FTBEAM  2   // Commander tractor beams Enterprise
-#define FSNAP   3   // Snapshot for time warp
-#define FBATTAK 4   // Commander attacks base
-#define FCDBAS  5   // Commander destroys base
-#define FSCMOVE 6   // Supercommander moves (might attack base)
-#define FSCDBAS 7   // Supercommander destroys base
-#define FDSPROB 8   // Move deep space probe
-#define NEVENTS (9)
-
-// Scalar variables that are needed for freezing the game
-// are placed in a structure. #defines are used to access by their
-// original names. Gee, I could have done this with the d structure,
-// but I just didn't think of it back when I started.
-
-#define SSTMAGIC       "SST2.0\n"
-
-EXTERN WINDOW *curwnd;
-
-EXTERN struct {
-    char magic[sizeof(SSTMAGIC)];
-    unsigned long options;
-    snapshot state;
-    snapshot snapsht;
-    char quad[QUADSIZE+1][QUADSIZE+1];         // contents of our quadrant
-    double kpower[(QUADSIZE+1)*(QUADSIZE+1)];          // enemy energy levels
-    double kdist[(QUADSIZE+1)*(QUADSIZE+1)];           // enemy distances
-    double kavgd[(QUADSIZE+1)*(QUADSIZE+1)];           // average distances
-    double damage[NDEVICES];   // damage encountered
-    double future[NEVENTS];    // future events
-    char passwd[10];           // Self Destruct password
-    int kx[(QUADSIZE+1)*(QUADSIZE+1)];                 // enemy sector locations
-    int ky[(QUADSIZE+1)*(QUADSIZE+1)];
-    /* members with macro definitions start here */
-    int inkling,
-       inbase,
-       incom,
-       inscom,
-       inrom,
-       instar,
-       intorps,
-       condit,
-       torps,
-       ship,
-       quadx,
-       quady,
-       sectx,
-       secty,
-       length,
-       skill,
-       basex,
-       basey,
-       klhere,
-       comhere,
-       casual,
-       nhelp,
-       nkinks,
-       ididit,
-       gamewon,
-       alive,
-       justin,
-       alldone,
-       shldchg,
-       plnetx,
-       plnety,
-       inorbit,
-       landed,
-       iplnet,
-       imine,
-       inplan,
-       nenhere,
-       ishere,
-       neutz,
-       irhere,
-       icraft,
-       ientesc,
-       iscraft,
-       isatb,
-       iscate,
-#ifdef DEBUG
-       idebug,
-#endif
-       iattak,
-       icrystl,
-       tourn,
-       thawed,
-       batx,
-       baty,
-       ithere,
-       ithx,
-       ithy,
-       iseenit,
-       probecx,
-       probecy,
-       proben,
-       isarmed,
-       nprobes;
-    double inresor,
-       intime,
-       inenrg,
-       inshld,
-       inlsr,
-       indate,
-       energy,
-       shield,
-       shldup,
-       warpfac,
-       wfacsq,
-       lsupres,
-       dist,
-       direc,
-       Time,
-       docfac,
-       resting,
-       damfac,
-       lastchart,
-       cryprob,
-       probex,
-       probey,
-       probeinx,
-       probeiny,
-       height;
-} game;
-
-#define inkling game.inkling           // Initial number of klingons
-#define inbase game.inbase             // Initial number of bases
-#define incom game.incom               // Initian number of commanders
-#define inscom game.inscom             // Initian number of commanders
-#define inrom game.inrom               // Initian number of commanders
-#define instar game.instar             // Initial stars
-#define intorps game.intorps           // Initial/Max torpedoes
-#define condit game.condit             // Condition (red/yellow/green/docked)
-#define torps game.torps               // number of torpedoes
-#define ship game.ship                 // Ship type -- 'E' is Enterprise
-#define quadx game.quadx               // where we are
-#define quady game.quady               //
-#define sectx game.sectx               // where we are
-#define secty game.secty               //
-#define length game.length             // length of game
-#define skill game.skill               // skill level
-#define basex game.basex               // position of base in current quad
-#define basey game.basey               //
-#define klhere game.klhere             // klingons here
-#define comhere game.comhere           // commanders here
-#define casual game.casual             // causalties
-#define nhelp game.nhelp               // calls for help
-#define nkinks game.nkinks             //
-#define ididit game.ididit             // Action taken -- allows enemy to attack
-#define gamewon game.gamewon           // Finished!
-#define alive game.alive               // We are alive (not killed)
-#define justin game.justin             // just entered quadrant
-#define alldone game.alldone           // game is now finished
-#define shldchg game.shldchg           // shield is changing (affects efficiency)
-#define plnetx game.plnetx             // location of planet in quadrant
-#define plnety game.plnety             //
-#define inorbit game.inorbit           // orbiting
-#define landed game.landed             // party on planet (1), on ship (-1)
-#define iplnet game.iplnet             // planet # in quadrant
-#define imine game.imine               // mining
-#define inplan game.inplan             // initial planets
-#define nenhere game.nenhere           // Number of enemies in quadrant
-#define ishere game.ishere             // Super-commander in quandrant
-#define neutz game.neutz               // Romulan Neutral Zone
-#define irhere game.irhere             // Romulans in quadrant
-#define icraft game.icraft             // Kirk in Galileo
-#define ientesc game.ientesc           // Attempted escape from supercommander
-#define iscraft game.iscraft           // =1 if craft on ship, -1 if removed from game
-#define isatb game.isatb               // =1 if SuperCommander is attacking base
-#define iscate game.iscate             // Super Commander is here
-#ifdef DEBUG
-#define idebug game.idebug             // Debug mode
-#endif
-#define iattak game.iattak             // attack recursion elimination (was cracks[4])
-#define icrystl game.icrystl           // dilithium crystals aboard
-#define tourn game.tourn               // Tournament number
-#define thawed game.thawed             // Thawed game
-#define batx game.batx                 // Base coordinates being attacked
-#define baty game.baty                 //
-#define ithere game.ithere             // Tholean is here 
-#define ithx game.ithx                 // coordinates of tholean
-#define ithy game.ithy
-#define iseenit game.iseenit           // Seen base attack report
-#define inresor game.inresor           // initial resources
-#define intime game.intime             // initial time
-#define inenrg game.inenrg             // Initial/Max Energy
-#define inshld game.inshld             // Initial/Max Shield
-#define inlsr game.inlsr               // initial life support resources
-#define indate game.indate             // Initial date
-#define energy game.energy             // Energy level
-#define shield game.shield             // Shield level
-#define shldup game.shldup             // Shields are up
-#define warpfac game.warpfac           // Warp speed
-#define wfacsq game.wfacsq             // squared warp factor
-#define lsupres game.lsupres           // life support reserves
-#define dist game.dist                 // movement distance
-#define direc game.direc               // movement direction
-#define Time game.Time                 // time taken by current operation
-#define docfac game.docfac             // repair factor when docking (constant?)
-#define resting game.resting           // rest time
-#define damfac game.damfac             // damage factor
-#define lastchart game.lastchart       // time star chart was last updated
-#define cryprob game.cryprob           // probability that crystal will work
-#define probex game.probex             // location of probe
-#define probey game.probey
-#define probecx game.probecx           // current probe quadrant
-#define probecy game.probecy   
-#define probeinx game.probeinx         // Probe x,y increment
-#define probeiny game.probeiny         
-#define proben game.proben             // number of moves for probe
-#define isarmed game.isarmed           // Probe is armed
-#define nprobes game.nprobes           // number of probes available
-
-/* the following global state doesn't need to be saved */
-EXTERN char    *device[NDEVICES];
-EXTERN int iscore, iskill; // Common PLAQ
-EXTERN double perdate;
-EXTERN double aaitem;
-EXTERN char citem[10];
-
-/* the Space Thingy's global state should *not* be saved! */
-EXTERN int thingx, thingy, iqhere, iqengry;
-
-typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE,
-              FNEG3, FNOVA, FSNOVAED, FABANDN, FDILITHIUM,
-                         FMATERIALIZE, FPHASER, FLOST, FMINING, FDPLANET,
-                         FPNOVA, FSSC, FSTRACTOR, FDRAY, FTRIBBLE,
-                         FHOLE} FINTYPE ;
-enum loctype {neither, quadrant, sector};
-
-#ifdef INCLUDED
-char *device[NDEVICES] = {
-       "S. R. Sensors",
-       "L. R. Sensors",
-       "Phasers",
-       "Photon Tubes",
-       "Life Support",
-       "Warp Engines",
-       "Impulse Engines",
-       "Shields",
-       "Subspace Radio",
-       "Shuttle Craft",
-       "Computer",
-       "Transporter",
-       "Shield Control",
-       "Death Ray",
-       "D. S. Probe"};                                                                 
-#endif
-
-#ifndef TRUE
-#define TRUE (1)
-#define FALSE (0)
-#endif
-
-#define IHR 'R'
-#define IHK 'K'
-#define IHC 'C'
-#define IHS 'S'
-#define IHSTAR '*'
-#define IHP 'P'
-#define IHB 'B'
-#define IHBLANK ' '
-#define IHDOT '.'
-#define IHQUEST '?'
-#define IHE 'E'
-#define IHF 'F'
-#define IHT 'T'
-#define IHWEB '#'
-#define IHGREEN 'G'
-#define IHYELLOW 'Y'
-#define IHRED 'R'
-#define IHDOCKED 'D'
-#define IHDEAD 'Z'
-#define IHMATER0 '-'
-#define IHMATER1 'o'
-#define IHMATER2 '0'
-
-
-/* Function prototypes */
-void prelim(void);
-void attack(int);
-int choose(int);
-void setup(int);
-void score(void);
-void atover(int);
-int srscan(int);
-void lrscan(void);
-void phasers(void);
-void photon(void);
-void warp(int);
-void doshield(int);
-void dock(int);
-void dreprt(void);
-void chart(int);
-void rechart(void);
-void impuls(void);
-void wait(void);
-void setwrp(void);
-void events(void);
-void report(void);
-void eta(void);
-void help(void);
-void abandn(void);
-void finish(FINTYPE);
-void dstrct(void);
-void kaboom(void);
-void freeze(int);
-int thaw(void);
-void plaque(void);
-int scan(void);
-#define IHEOL (0)
-#define IHALPHA (1)
-#define IHREAL (2)
-void chew(void);
-void chew2(void);
-void skip(int);
-void prout(char *, ...);
-void proutn(char *, ...);
-void stars(void);
-void newqad(int);
-int ja(void);
-void cramen(int);
-void crmshp(void);
-char *cramlc(enum loctype, int, int);
-double expran(double);
-double Rand(void);
-void iran(int, int *, int *);
-#define square(i) ((i)*(i))
-void dropin(int, int*, int*);
-void newcnd(void);
-void sortkl(void);
-void imove(void);
-void ram(int, int, int, int);
-void crmena(int, int, int, int, int);
-void deadkl(int, int, int, int, int);
-void timwrp(void);
-void movcom(void);
-void torpedo(double, double, int, int, double *, int, int);
-void huh(void);
-void pause_game(int);
-void nova(int, int);
-void snova(int, int);
-void scom(int *);
-void hittem(double *);
-void prouts(char *, ...);
-int isit(char *);
-void preport(void);
-void orbit(void);
-void sensor(void);
-void drawmaps(short);
-void beam(void);
-void mine(void);
-void usecrystals(void);
-void shuttle(void);
-void deathray(void);
-void debugme(void);
-void attakreport(int);
-void movetho(void);
-void probe(void);
-void iostart(void);
-void setwnd(WINDOW *);
-void warble(void);
-void boom(int ii, int jj);
-void tracktorpedo(int ix, int iy, int l, int i, int n, int iquad);
-void cgetline(char *, int);
-void waitfor(void);
-void setpassword(void);
-void commandhook(char *, int);
-void makechart(void);
-void enqueue(char *);
-
-/* mode arguments for srscan() */
-#define SCAN_FULL              1
-#define SCAN_REQUEST           2
-#define SCAN_STATUS            3
-#define SCAN_NO_LEFTSIDE       4
-
-WINDOW *fullscreen_window;
-WINDOW *srscan_window;
-WINDOW *report_window;
-WINDOW *lrscan_window;
-WINDOW *message_window;
-WINDOW *prompt_window;
-
-extern void clreol(void);
-extern void clrscr(void);
-extern void textcolor(int color);
-extern void highvideo(void);
-
-enum COLORS {
-   DEFAULT,
-   BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY,
-   DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
-};
-
-#define DAMAGED        128     /* marker for damaged ship in starmap */
diff --git a/sst.xml b/sst.xml
deleted file mode 100644 (file)
index 5a56584..0000000
--- a/sst.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE refentry PUBLIC 
-   "-//OASIS//DTD DocBook XML V4.1.2//EN"
-   "docbook/docbookx.dtd">
-<refentry id='sst.6'>
-<refmeta>
-<refentrytitle>sst</refentrytitle>
-<manvolnum>6</manvolnum>
-<refmiscinfo class='date'>Nov 1 2004</refmiscinfo>
-</refmeta>
-<refnamediv id='name'>
-<refname>sst</refname>
-<refpurpose>the classic Super Star Trek game</refpurpose>
-</refnamediv>
-<refsynopsisdiv id='synopsis'>
-
-<cmdsynopsis>
-<command>sst</command>
-<arg choice='opt'>-t </arg> 
-<arg rep='repeat' ><replaceable>command</replaceable></arg>  
-</cmdsynopsis>
-
-</refsynopsisdiv>
-
-<refsect1 id='description'><title>DESCRIPTION</title>
-
-<para>The Organian Peace Treaty has collapsed, and the Federation is
-at war with the Klingon Empire. Joining the Klingons against the
-Federation are the members of the Romulan Star Empire. As commander
-of the Starship U.S.S. Enterprise, your job is to wipe out the Klingon
-invasion fleet and make the galaxy safe for democracy.</para>
-
-<para>This is one of the great early classic computer games from the
-1970s and still has a remarkable amount of play value. Run
-<command>sst</command> in a terminal window to start it.  Typing
-'comands' at the prompt will list all commands; help is available for
-each one individually as well.  Full documentation is <ulink
-url='http://sst.berlios.de/sst-doc.html'>browseable</ulink>.  On
-systems where <filename>/usr/share/doc/sst/</filename> is a legal
-filename, it will probably be installed there as well.</para>
-
-<para>There is one option -t, which forces the original pure-tty mode.
-Normally sst tries to come up in full-screen mode that assumes it is
-running on a cursor-addressable terminal or terminal emulator.</para>
-
-<para>Input tokens for the setup prompts will be read from the
-remainder of the command line before standard input.  Thus, for
-example, you can invoke the program as</para>
-
-<programlisting>
-sst regular medium good fancy
-</programlisting>
-
-<para>to start a regular medium game as a good player in 'fancy'
-mode (all features enabled).</para>
-</refsect1>
-
-<refsect1 id='authors'><title>AUTHORS</title> 
-<para>Super Star Trek was designed and written by David Matuszek, Paul
-Reynolds, and Don Smith in the 1970s.  It was resurrected by Tom Almy.
-The screen-oriented interface is by Stas Sergeev. This version has
-been cleaned up and documented by Eric S. Raymond
-<email>esr@snark.thyrsus.com</email>.  There is a <ulink
-url='https://developer.berlios.de/projects/sst/'>project
-page</ulink>.</para>
-</refsect1>
-</refentry>
-
diff --git a/sstlinux.c b/sstlinux.c
deleted file mode 100644 (file)
index 90d50ad..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <linux/kd.h>
-#include "sstlinux.h"
-
-static int fd = 0;
-
-void sound(unsigned int freq)
-{
-    if(fd==0) fd=open("/dev/console", O_RDONLY);
-    if(fd>0) ioctl(fd, KDMKTONE, 1193180/freq + (0xFFFF<<16));
-}
-
-void nosound(void)
-{
-    if(fd>0) ioctl(fd, KDMKTONE, 0);
-}
diff --git a/sstlinux.h b/sstlinux.h
deleted file mode 100644 (file)
index 1080f96..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __SSTLINUX_H
-#define __SSTLINUX_H
-
-void sound(unsigned int);
-void nosound(void);
-
-#define delay(x) usleep(x*1000)
-#define randomize() srand((unsigned)time(NULL))
-
-#endif