All old versions moved to 'historic' directoery.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 1 Dec 2010 04:15:48 +0000 (23:15 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 1 Dec 2010 04:15:48 +0000 (23:15 -0500)
131 files changed:
c-version/ABOUT-NLS [deleted file]
c-version/AUTHORS [deleted file]
c-version/COPYING [deleted file]
c-version/ChangeLog [deleted file]
c-version/INSTALL [deleted file]
c-version/Makefile.am [deleted file]
c-version/NEWS [deleted file]
c-version/README [deleted file]
c-version/autogen.sh [deleted file]
c-version/compile [deleted file]
c-version/config.guess [deleted file]
c-version/config.rpath [deleted file]
c-version/config.sub [deleted file]
c-version/configure.ac [deleted file]
c-version/depcomp [deleted file]
c-version/install-sh [deleted file]
c-version/m4/ChangeLog [deleted file]
c-version/m4/codeset.m4 [deleted file]
c-version/m4/gettext.m4 [deleted file]
c-version/m4/glibc2.m4 [deleted file]
c-version/m4/glibc21.m4 [deleted file]
c-version/m4/iconv.m4 [deleted file]
c-version/m4/intdiv0.m4 [deleted file]
c-version/m4/intmax.m4 [deleted file]
c-version/m4/inttypes-pri.m4 [deleted file]
c-version/m4/inttypes.m4 [deleted file]
c-version/m4/inttypes_h.m4 [deleted file]
c-version/m4/isc-posix.m4 [deleted file]
c-version/m4/lcmessage.m4 [deleted file]
c-version/m4/lib-ld.m4 [deleted file]
c-version/m4/lib-link.m4 [deleted file]
c-version/m4/lib-prefix.m4 [deleted file]
c-version/m4/longdouble.m4 [deleted file]
c-version/m4/longlong.m4 [deleted file]
c-version/m4/nls.m4 [deleted file]
c-version/m4/po.m4 [deleted file]
c-version/m4/printf-posix.m4 [deleted file]
c-version/m4/progtest.m4 [deleted file]
c-version/m4/signed.m4 [deleted file]
c-version/m4/size_max.m4 [deleted file]
c-version/m4/stdint_h.m4 [deleted file]
c-version/m4/uintmax_t.m4 [deleted file]
c-version/m4/ulonglong.m4 [deleted file]
c-version/m4/wchar_t.m4 [deleted file]
c-version/m4/wint_t.m4 [deleted file]
c-version/m4/xsize.m4 [deleted file]
c-version/missing [deleted file]
c-version/mkinstalldirs [deleted file]
c-version/src/Makefile.am [deleted file]
c-version/src/ai.c [deleted file]
c-version/src/battle.c [deleted file]
c-version/src/events.c [deleted file]
c-version/src/finish.c [deleted file]
c-version/src/io.c [deleted file]
c-version/src/moving.c [deleted file]
c-version/src/planets.c [deleted file]
c-version/src/reports.c [deleted file]
c-version/src/setup.c [deleted file]
c-version/src/sst.c [deleted file]
c-version/src/sst.h [deleted file]
c-version/src/sstlinux.c [deleted file]
c-version/src/sstlinux.h [deleted file]
c-version/sst.spec [deleted file]
historic/README [new file with mode: 0644]
historic/UT-Trek.basic [new file with mode: 0644]
historic/c-version/ABOUT-NLS [new file with mode: 0644]
historic/c-version/AUTHORS [new file with mode: 0644]
historic/c-version/COPYING [new file with mode: 0644]
historic/c-version/ChangeLog [new file with mode: 0644]
historic/c-version/INSTALL [new file with mode: 0644]
historic/c-version/Makefile.am [new file with mode: 0644]
historic/c-version/NEWS [new file with mode: 0644]
historic/c-version/README [new file with mode: 0644]
historic/c-version/autogen.sh [new file with mode: 0755]
historic/c-version/compile [new file with mode: 0755]
historic/c-version/config.guess [new file with mode: 0755]
historic/c-version/config.rpath [new file with mode: 0755]
historic/c-version/config.sub [new file with mode: 0755]
historic/c-version/configure.ac [new file with mode: 0644]
historic/c-version/depcomp [new file with mode: 0755]
historic/c-version/install-sh [new file with mode: 0755]
historic/c-version/m4/ChangeLog [new file with mode: 0644]
historic/c-version/m4/codeset.m4 [new file with mode: 0644]
historic/c-version/m4/gettext.m4 [new file with mode: 0644]
historic/c-version/m4/glibc2.m4 [new file with mode: 0644]
historic/c-version/m4/glibc21.m4 [new file with mode: 0644]
historic/c-version/m4/iconv.m4 [new file with mode: 0644]
historic/c-version/m4/intdiv0.m4 [new file with mode: 0644]
historic/c-version/m4/intmax.m4 [new file with mode: 0644]
historic/c-version/m4/inttypes-pri.m4 [new file with mode: 0644]
historic/c-version/m4/inttypes.m4 [new file with mode: 0644]
historic/c-version/m4/inttypes_h.m4 [new file with mode: 0644]
historic/c-version/m4/isc-posix.m4 [new file with mode: 0644]
historic/c-version/m4/lcmessage.m4 [new file with mode: 0644]
historic/c-version/m4/lib-ld.m4 [new file with mode: 0644]
historic/c-version/m4/lib-link.m4 [new file with mode: 0644]
historic/c-version/m4/lib-prefix.m4 [new file with mode: 0644]
historic/c-version/m4/longdouble.m4 [new file with mode: 0644]
historic/c-version/m4/longlong.m4 [new file with mode: 0644]
historic/c-version/m4/nls.m4 [new file with mode: 0644]
historic/c-version/m4/po.m4 [new file with mode: 0644]
historic/c-version/m4/printf-posix.m4 [new file with mode: 0644]
historic/c-version/m4/progtest.m4 [new file with mode: 0644]
historic/c-version/m4/signed.m4 [new file with mode: 0644]
historic/c-version/m4/size_max.m4 [new file with mode: 0644]
historic/c-version/m4/stdint_h.m4 [new file with mode: 0644]
historic/c-version/m4/uintmax_t.m4 [new file with mode: 0644]
historic/c-version/m4/ulonglong.m4 [new file with mode: 0644]
historic/c-version/m4/wchar_t.m4 [new file with mode: 0644]
historic/c-version/m4/wint_t.m4 [new file with mode: 0644]
historic/c-version/m4/xsize.m4 [new file with mode: 0644]
historic/c-version/missing [new file with mode: 0755]
historic/c-version/mkinstalldirs [new file with mode: 0755]
historic/c-version/src/Makefile.am [new file with mode: 0644]
historic/c-version/src/ai.c [new file with mode: 0644]
historic/c-version/src/battle.c [new file with mode: 0644]
historic/c-version/src/events.c [new file with mode: 0644]
historic/c-version/src/finish.c [new file with mode: 0644]
historic/c-version/src/io.c [new file with mode: 0644]
historic/c-version/src/moving.c [new file with mode: 0644]
historic/c-version/src/planets.c [new file with mode: 0644]
historic/c-version/src/reports.c [new file with mode: 0644]
historic/c-version/src/setup.c [new file with mode: 0644]
historic/c-version/src/sst.c [new file with mode: 0644]
historic/c-version/src/sst.h [new file with mode: 0644]
historic/c-version/src/sstlinux.c [new file with mode: 0644]
historic/c-version/src/sstlinux.h [new file with mode: 0644]
historic/c-version/sst.spec [new file with mode: 0644]
historic/mayfield.basic [new file with mode: 0644]
www/historic/UT-Trek.basic [deleted file]
www/historic/mayfield.basic [deleted file]

diff --git a/c-version/ABOUT-NLS b/c-version/ABOUT-NLS
deleted file mode 100644 (file)
index e32d52d..0000000
+++ /dev/null
@@ -1,996 +0,0 @@
-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/c-version/AUTHORS b/c-version/AUTHORS
deleted file mode 100644 (file)
index 9d94a70..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-David Matuszek <matuszek@cis.upenn.edu>
-Paul Reynolds
-Don Smith
-Tom Almy <tom@almy.us>
-Stas Sergeev <stsp@aknet.ru>
-Eric S. Raymond <esr@thyrsus.com>
diff --git a/c-version/COPYING b/c-version/COPYING
deleted file mode 100644 (file)
index 34a1386..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-The NEWS, ChangeLog, and COPYING files in this directory are stubs to appease
-the cruel gods of autoconf.  See the top-level directory of the distributoon for
-the real ones.
-
diff --git a/c-version/ChangeLog b/c-version/ChangeLog
deleted file mode 100644 (file)
index 34a1386..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-The NEWS, ChangeLog, and COPYING files in this directory are stubs to appease
-the cruel gods of autoconf.  See the top-level directory of the distributoon for
-the real ones.
-
diff --git a/c-version/INSTALL b/c-version/INSTALL
deleted file mode 100644 (file)
index a4b3414..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-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/c-version/Makefile.am b/c-version/Makefile.am
deleted file mode 100644 (file)
index b43f594..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = src
-
-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/c-version/NEWS b/c-version/NEWS
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/c-version/README b/c-version/README
deleted file mode 100644 (file)
index 99cab9d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-This is an archive of the last C version of SST.  The game was moved to
-Python in 2006.
-
-The NEWS, ChangeLog, and COPYING files in this directory are stubs to appease
-the cruel gods of autoconf.
diff --git a/c-version/autogen.sh b/c-version/autogen.sh
deleted file mode 100755 (executable)
index 1c69a72..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-
-autoreconf -v
diff --git a/c-version/compile b/c-version/compile
deleted file mode 100755 (executable)
index 1b1d232..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-#! /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/c-version/config.guess b/c-version/config.guess
deleted file mode 100755 (executable)
index 917bbc5..0000000
+++ /dev/null
@@ -1,1463 +0,0 @@
-#! /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/c-version/config.rpath b/c-version/config.rpath
deleted file mode 100755 (executable)
index 3f1bef3..0000000
+++ /dev/null
@@ -1,571 +0,0 @@
-#! /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/c-version/config.sub b/c-version/config.sub
deleted file mode 100755 (executable)
index 1c366df..0000000
+++ /dev/null
@@ -1,1579 +0,0 @@
-#! /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/c-version/configure.ac b/c-version/configure.ac
deleted file mode 100644 (file)
index 786ea79..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#                                               -*- 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(ncursesw, 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
-])
-
-# These used to be in AC_CONFIG_FILES before the C version became obsolete.
-# Now the build machinery in them is separate/
-#    po/Makefile.in
-#    doc/Makefile
-
-AC_OUTPUT
diff --git a/c-version/depcomp b/c-version/depcomp
deleted file mode 100755 (executable)
index 04701da..0000000
+++ /dev/null
@@ -1,530 +0,0 @@
-#! /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/c-version/install-sh b/c-version/install-sh
deleted file mode 100755 (executable)
index 4d4a951..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-#!/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/c-version/m4/ChangeLog b/c-version/m4/ChangeLog
deleted file mode 100644 (file)
index 6fb230e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-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/c-version/m4/codeset.m4 b/c-version/m4/codeset.m4
deleted file mode 100644 (file)
index a6e67ec..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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/c-version/m4/gettext.m4 b/c-version/m4/gettext.m4
deleted file mode 100644 (file)
index 624a807..0000000
+++ /dev/null
@@ -1,549 +0,0 @@
-# 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/c-version/m4/glibc2.m4 b/c-version/m4/glibc2.m4
deleted file mode 100644 (file)
index e8f5bfe..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/c-version/m4/glibc21.m4 b/c-version/m4/glibc21.m4
deleted file mode 100644 (file)
index d95fd98..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/c-version/m4/iconv.m4 b/c-version/m4/iconv.m4
deleted file mode 100644 (file)
index 654c415..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-# 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/c-version/m4/intdiv0.m4 b/c-version/m4/intdiv0.m4
deleted file mode 100644 (file)
index b8d7817..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-# 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/c-version/m4/intmax.m4 b/c-version/m4/intmax.m4
deleted file mode 100644 (file)
index d99c999..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/c-version/m4/inttypes-pri.m4 b/c-version/m4/inttypes-pri.m4
deleted file mode 100644 (file)
index 4d56a9a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/c-version/m4/inttypes.m4 b/c-version/m4/inttypes.m4
deleted file mode 100644 (file)
index 779bcea..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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/c-version/m4/inttypes_h.m4 b/c-version/m4/inttypes_h.m4
deleted file mode 100644 (file)
index a5d075d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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/c-version/m4/isc-posix.m4 b/c-version/m4/isc-posix.m4
deleted file mode 100644 (file)
index 74dc8f2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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/c-version/m4/lcmessage.m4 b/c-version/m4/lcmessage.m4
deleted file mode 100644 (file)
index 19aa77e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/c-version/m4/lib-ld.m4 b/c-version/m4/lib-ld.m4
deleted file mode 100644 (file)
index 96c4e2c..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-# 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/c-version/m4/lib-link.m4 b/c-version/m4/lib-link.m4
deleted file mode 100644 (file)
index ea0b0c4..0000000
+++ /dev/null
@@ -1,553 +0,0 @@
-# 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/c-version/m4/lib-prefix.m4 b/c-version/m4/lib-prefix.m4
deleted file mode 100644 (file)
index 0d895ca..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-# 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/c-version/m4/longdouble.m4 b/c-version/m4/longdouble.m4
deleted file mode 100644 (file)
index 40cd7ce..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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/c-version/m4/longlong.m4 b/c-version/m4/longlong.m4
deleted file mode 100644 (file)
index 7b399e0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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/c-version/m4/nls.m4 b/c-version/m4/nls.m4
deleted file mode 100644 (file)
index 2082c3b..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# 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/c-version/m4/po.m4 b/c-version/m4/po.m4
deleted file mode 100644 (file)
index f2795ee..0000000
+++ /dev/null
@@ -1,429 +0,0 @@
-# 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/c-version/m4/printf-posix.m4 b/c-version/m4/printf-posix.m4
deleted file mode 100644 (file)
index af10170..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# 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/c-version/m4/progtest.m4 b/c-version/m4/progtest.m4
deleted file mode 100644 (file)
index a56365c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-# 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/c-version/m4/signed.m4 b/c-version/m4/signed.m4
deleted file mode 100644 (file)
index 048f593..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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/c-version/m4/size_max.m4 b/c-version/m4/size_max.m4
deleted file mode 100644 (file)
index 4fe81c7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# 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/c-version/m4/stdint_h.m4 b/c-version/m4/stdint_h.m4
deleted file mode 100644 (file)
index 3355f35..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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/c-version/m4/uintmax_t.m4 b/c-version/m4/uintmax_t.m4
deleted file mode 100644 (file)
index bf83ed7..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/c-version/m4/ulonglong.m4 b/c-version/m4/ulonglong.m4
deleted file mode 100644 (file)
index dee10cc..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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/c-version/m4/wchar_t.m4 b/c-version/m4/wchar_t.m4
deleted file mode 100644 (file)
index cde2129..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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/c-version/m4/wint_t.m4 b/c-version/m4/wint_t.m4
deleted file mode 100644 (file)
index b8fff9c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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/c-version/m4/xsize.m4 b/c-version/m4/xsize.m4
deleted file mode 100644 (file)
index 85bb721..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# 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/c-version/missing b/c-version/missing
deleted file mode 100755 (executable)
index 894e786..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-#! /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/c-version/mkinstalldirs b/c-version/mkinstalldirs
deleted file mode 100755 (executable)
index 6fbe5e1..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-#! /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/c-version/src/Makefile.am b/c-version/src/Makefile.am
deleted file mode 100644 (file)
index 837cd06..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-AM_CFLAGS = -Wall -Wimplicit -Wunused -Wmissing-prototypes -Wundef \
-    -Wuninitialized -Wdeclaration-after-statement \
-    -fno-inline -O1 -DDATA_DIR=\"$(pkgdatadir)\" \
-    -DLOCALEDIR=\"$(datadir)/locale\" \
-    @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
-
-# Experimental XaW code, not yet integrated with the game
-xio: xio.o
-       gcc xio.c -lXaw3d -o xio
diff --git a/c-version/src/ai.c b/c-version/src/ai.c
deleted file mode 100644 (file)
index 91e3ec9..0000000
+++ /dev/null
@@ -1,631 +0,0 @@
-#include "sst.h"
-
-static bool tryexit(coord look, int ienm, int loccom, bool irun) 
-/* a bad guy attempts to bug out */
-{
-    int n;
-    coord iq;
-
-    iq.x = game.quadrant.x+(look.x+(QUADSIZE-1))/QUADSIZE - 1;
-    iq.y = game.quadrant.y+(look.y+(QUADSIZE-1))/QUADSIZE - 1;
-    if (!VALID_QUADRANT(iq.x,iq.y) ||
-       game.state.galaxy[iq.x][iq.y].supernova ||
-       game.state.galaxy[iq.x][iq.y].klingons > MAXKLQUAD-1)
-       return false; /* no can do -- neg energy, supernovae, or >MAXKLQUAD-1 Klingons */
-    if (ienm == IHR)
-       return false; /* Romulans cannot escape! */
-    if (!irun) {
-       /* avoid intruding on another commander's territory */
-       if (ienm == IHC) {
-           for (n = 1; n <= game.state.remcom; n++)
-               if (same(game.state.kcmdr[n],iq))
-                   return false;
-           /* refuse to leave if currently attacking starbase */
-           if (same(game.battle, game.quadrant))
-               return false;
-       }
-       /* don't leave if over 1000 units of energy */
-       if (game.kpower[loccom] > 1000.0)
-           return false;
-    }
-    // print escape message and move out of quadrant.
-    // We know this if either short or long range sensors are working
-    if (!damaged(DSRSENS) || !damaged(DLRSENS) ||
-       game.condition == docked) {
-       crmena(true, ienm, sector, game.ks[loccom]);
-       prout(_(" escapes to %s (and regains strength)."),
-             cramlc(quadrant, iq));
-    }
-    /* handle local matters related to escape */
-    game.quad[game.ks[loccom].x][game.ks[loccom].y] = IHDOT;
-    game.ks[loccom] = game.ks[game.nenhere];
-    game.kavgd[loccom] = game.kavgd[game.nenhere];
-    game.kpower[loccom] = game.kpower[game.nenhere];
-    game.kdist[loccom] = game.kdist[game.nenhere];
-    game.klhere--;
-    game.nenhere--;
-    if (game.condition != docked)
-       newcnd();
-    /* Handle global matters related to escape */
-    game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons--;
-    game.state.galaxy[iq.x][iq.y].klingons++;
-    if (ienm==IHS) {
-       game.ishere = false;
-       game.iscate = false;
-       game.ientesc = false;
-       game.isatb = 0;
-       schedule(FSCMOVE, 0.2777);
-       unschedule(FSCDBAS);
-       game.state.kscmdr=iq;
-    }
-    else {
-       for (n = 1; n <= game.state.remcom; n++) {
-           if (same(game.state.kcmdr[n], game.quadrant)) {
-               game.state.kcmdr[n]=iq;
-               break;
-           }
-       }
-       game.comhere = false;
-    }
-    return true; /* success */
-}
-
-/*************************************************************************
-The bad-guy movement algorithm:
-
-1. 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.
-
-2. 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.
-
-3. 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.
-
-4.  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*game.skill, generally forcing a
-retreat, especially at high skill levels.
-
-5.  Motion is limited to skill level, except for SC hi-tailing it out.
-**************************************************************************/
-
-static void movebaddy(coord com, int loccom, feature ienm)
-/* tactical movement for the bad guys */
-{
-    int motion, mdist, nsteps, mx, my, ll;
-    coord next, look;
-    int krawlx, krawly;
-    bool success, irun = false;
-    int attempts;
-    /* This should probably be just game.comhere + game.ishere */
-    int nbaddys = game.skill >= SKILL_EXPERT ?
-       (int)((game.comhere*2 + game.ishere*2+game.klhere*1.23+game.irhere*1.5)/2.0):
-       (game.comhere + game.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 || (game.condition==docked && !damaged(DPHOTON)))) {
-       irun = true;
-       motion = -QUADSIZE;
-    }
-    else {
-       /* decide whether to advance, retreat, or hold position */
-       forces = game.kpower[loccom]+100.0*game.nenhere+400*(nbaddys-1);
-       if (!game.shldup)
-           forces += 1000; /* Good for enemy if shield is down! */
-       if (!damaged(DPHASER) || !damaged(DPHOTON)) {
-           if (damaged(DPHASER)) /* phasers damaged */
-               forces += 300.0;
-           else
-               forces -= 0.2*(game.energy - 2500.0);
-           if (damaged(DPHOTON)) /* photon torpedoes damaged */
-               forces += 300.0;
-           else
-               forces -= 50.0*game.torps;
-       }
-       else {
-           /* phasers and photon tubes both out! */
-           forces += 1000.0;
-       }
-       motion = 0;
-       if (forces <= 1000.0 && game.condition != docked) /* 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 (game.condition==docked && (game.options & OPTION_BASE)) /* protected by base -- back off ! */
-               motion -= game.skill*(2.0-square(Rand()));
-       }
-       if (idebug)
-           proutn("=== MOTION = %d, FORCES = %1.2f, ", motion, forces);
-       /* don't move if no motion */
-       if (motion==0)
-           return;
-       /* Limit motion according to skill */
-       if (abs(motion) > game.skill)
-           motion = (motion < 0) ? -game.skill : game.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 */
-    if (idebug) {
-       proutn("NSTEPS = %d:", nsteps);
-    }
-    /* Compute preferred values of delta X and Y */
-    mx = game.sector.x - com.x;
-    my = game.sector.y - com.y;
-    if (2.0 * abs(mx) < abs(my))
-       mx = 0;
-    if (2.0 * abs(my) < abs(game.sector.x-com.x))
-       my = 0;
-    if (mx != 0)
-       mx = mx*motion < 0 ? -1 : 1;
-    if (my != 0)
-       my = my*motion < 0 ? -1 : 1;
-    next = com;
-    /* main move loop */
-    for (ll = 0; ll < nsteps; ll++) {
-       if (idebug)
-           proutn(" %d", ll+1);
-       /* Check if preferred position available */
-       look.x = next.x + mx;
-       look.y = next.y + my;
-       krawlx = mx < 0 ? 1 : -1;
-       krawly = my < 0 ? 1 : -1;
-       success = false;
-       attempts = 0; /* Settle mysterious hang problem */
-       while (attempts++ < 20 && !success) {
-           if (look.x < 1 || look.x > QUADSIZE) {
-               if (motion < 0 && tryexit(look, ienm, loccom, irun))
-                   return;
-               if (krawlx == mx || my == 0)
-                   break;
-               look.x = next.x + krawlx;
-               krawlx = -krawlx;
-           }
-           else if (look.y < 1 || look.y > QUADSIZE) {
-               if (motion < 0 && tryexit(look, ienm, loccom, irun))
-                   return;
-               if (krawly == my || mx == 0)
-                   break;
-               look.y = next.y + krawly;
-               krawly = -krawly;
-           }
-           else if ((game.options & OPTION_RAMMING) && game.quad[look.x][look.y] != IHDOT) {
-               /* See if we should ram ship */
-               if (game.quad[look.x][look.y] == game.ship &&
-                   (ienm == IHC || ienm == IHS)) {
-                   ram(true, ienm, com);
-                   return;
-               }
-               if (krawlx != mx && my != 0) {
-                   look.x = next.x + krawlx;
-                   krawlx = -krawlx;
-               }
-               else if (krawly != my && mx != 0) {
-                   look.y = next.y + krawly;
-                   krawly = -krawly;
-               }
-               else
-                   break; /* we have failed */
-           }
-           else
-               success = true;
-       }
-       if (success) {
-           next = look;
-           if (idebug)
-               proutn(cramlc(neither, next));
-       }
-       else
-           break; /* done early */
-       
-    }
-    if (idebug)
-       skip(1);
-    /* Put commander in place within same quadrant */
-    game.quad[com.x][com.y] = IHDOT;
-    game.quad[next.x][next.y] = ienm;
-    if (!same(next, com)) {
-       /* it moved */
-       game.ks[loccom] = next;
-       game.kdist[loccom] = game.kavgd[loccom] = distance(game.sector, next);
-       if (!damaged(DSRSENS) || game.condition == docked) {
-           proutn("***");
-           cramen(ienm);
-           proutn(_(" from %s"), cramlc(sector, com));
-           if (game.kdist[loccom] < dist1)
-               proutn(_(" advances to "));
-           else
-               proutn(_(" retreats to "));
-           prout(cramlc(sector, next));
-       }
-    }
-}
-
-void moveklings(void) 
-/* Klingon tactical movement */
-{
-    coord w; 
-    int i;
-
-    if (idebug)
-       prout("== MOVCOM");
-
-    // Figure out which Klingon is the commander (or Supercommander)
-    //   and do move
-    if (game.comhere) 
-       for (i = 1; i <= game.nenhere; i++) {
-           w = game.ks[i];
-           if (game.quad[w.x][w.y] == IHC) {
-               movebaddy(w, i, IHC);
-               break;
-           }
-       }
-    if (game.ishere) 
-       for (i = 1; i <= game.nenhere; i++) {
-           w = game.ks[i];
-           if (game.quad[w.x][w.y] == IHS) {
-               movebaddy(w, 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 (game.skill >= SKILL_EXPERT && (game.options & OPTION_MVBADDY)) 
-       for (i = 1; i <= game.nenhere; i++) {
-           w = game.ks[i];
-           if (game.quad[w.x][w.y] == IHK || game.quad[w.x][w.y] == IHR)
-               movebaddy(w, i, game.quad[w.x][w.y]);
-       }
-
-    sortklings();
-}
-
-static bool movescom(coord iq, bool avoid) 
-/* commander movement helper */
-{
-    int i;
-
-    if (same(iq, game.quadrant) || !VALID_QUADRANT(iq.x, iq.y) ||
-       game.state.galaxy[iq.x][iq.y].supernova ||
-       game.state.galaxy[iq.x][iq.y].klingons > MAXKLQUAD-1) 
-       return 1;
-    if (avoid) {
-       /* Avoid quadrants with bases if we want to avoid Enterprise */
-       for (i = 1; i <= game.state.rembase; i++)
-           if (same(game.state.baseq[i], iq)) 
-               return true;
-    }
-    if (game.justin && !game.iscate)
-       return true;
-    /* do the move */
-    game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons--;
-    game.state.kscmdr = iq;
-    game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons++;
-    if (game.ishere) {
-       /* SC has scooted, Remove him from current quadrant */
-       game.iscate=false;
-       game.isatb=0;
-       game.ishere = false;
-       game.ientesc = false;
-       unschedule(FSCDBAS);
-       for (i = 1; i <= game.nenhere; i++) 
-           if (game.quad[game.ks[i].x][game.ks[i].y] == IHS)
-               break;
-       game.quad[game.ks[i].x][game.ks[i].y] = IHDOT;
-       game.ks[i] = game.ks[game.nenhere];
-       game.kdist[i] = game.kdist[game.nenhere];
-       game.kavgd[i] = game.kavgd[game.nenhere];
-       game.kpower[i] = game.kpower[game.nenhere];
-       game.klhere--;
-       game.nenhere--;
-       if (game.condition!=docked)
-           newcnd();
-       sortklings();
-    }
-    /* check for a helpful planet */
-    for (i = 0; i < game.inplan; i++) {
-       if (same(game.state.planets[i].w, game.state.kscmdr) &&
-           game.state.planets[i].crystals == present) {
-           /* destroy the planet */
-           game.state.planets[i].pclass = destroyed;
-           game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = NOPLANET;
-           if (!damaged(DRADIO) || game.condition == docked) {
-               announce();
-               prout(_("Lt. Uhura-  \"Captain, Starfleet Intelligence reports"));
-               proutn(_("   a planet in "));
-               proutn(cramlc(quadrant, game.state.kscmdr));
-               prout(_(" has been destroyed"));
-               prout(_("   by the Super-commander.\""));
-           }
-           break;
-       }
-    }
-    return false; /* looks good! */
-}
-                       
-void supercommander(void)
-/* move the Super Commander */
-{
-    int i, i2, j, ideltax, ideltay, ifindit, iwhichb;
-    coord iq, sc, ibq;
-    int basetbl[BASEMAX+1];
-    double bdist[BASEMAX+1];
-    bool avoid;
-
-    if (idebug)
-       prout("== SUPERCOMMANDER");
-
-    /* Decide on being active or passive */
-    avoid = ((game.incom - game.state.remcom + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*game.skill*(game.skill+1.0) ||
-           (game.state.date-game.indate) < 3.0);
-    if (!game.iscate && avoid) {
-       /* compute move away from Enterprise */
-       ideltax = game.state.kscmdr.x-game.quadrant.x;
-       ideltay = game.state.kscmdr.y-game.quadrant.y;
-       if (sqrt(ideltax*(double)ideltax+ideltay*(double)ideltay) > 2.0) {
-           /* circulate in space */
-           ideltax = game.state.kscmdr.y-game.quadrant.y;
-           ideltay = game.quadrant.x-game.state.kscmdr.x;
-       }
-    }
-    else {
-       /* compute distances to starbases */
-       if (game.state.rembase <= 0) {
-           /* nothing left to do */
-           unschedule(FSCMOVE);
-           return;
-       }
-       sc = game.state.kscmdr;
-       for (i = 1; i <= game.state.rembase; i++) {
-           basetbl[i] = i;
-           bdist[i] = distance(game.state.baseq[i], sc);
-       }
-       if (game.state.rembase > 1) {
-           /* sort into nearest first order */
-           bool iswitch;
-           do {
-               iswitch = false;
-               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 = true;
-                   }
-               }
-           } 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 (i2 = 1; i2 <= game.state.rembase; i2++) {
-           i = basetbl[i2];    /* bug in original had it not finding nearest*/
-           ibq = game.state.baseq[i];
-           if (same(ibq, game.quadrant) || same(ibq, game.battle) ||
-               game.state.galaxy[ibq.x][ibq.y].supernova ||
-               game.state.galaxy[ibq.x][ibq.y].klingons > MAXKLQUAD-1) 
-               continue;
-           // if there is a commander, and no other base is appropriate,
-           //   we will take the one with the commander
-           for (j = 1; j <= game.state.remcom; j++) {
-               if (same(ibq, game.state.kcmdr[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*/
-       ibq = game.state.baseq[iwhichb];
-       /* decide how to move toward base */
-       ideltax = ibq.x - game.state.kscmdr.x;
-       ideltay = ibq.y - game.state.kscmdr.y;
-    }
-    /* 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 */
-    iq.x = game.state.kscmdr.x + ideltax;
-    iq.y = game.state.kscmdr.y + ideltax;
-    if (movescom(iq, avoid)) {
-       /* failed -- try some other maneuvers */
-       if (ideltax==0 || ideltay==0) {
-           /* attempt angle move */
-           if (ideltax != 0) {
-               iq.y = game.state.kscmdr.y + 1;
-               if (movescom(iq, avoid)) {
-                   iq.y = game.state.kscmdr.y - 1;
-                   movescom(iq, avoid);
-               }
-           }
-           else {
-               iq.x = game.state.kscmdr.x + 1;
-               if (movescom(iq, avoid)) {
-                   iq.x = game.state.kscmdr.x - 1;
-                   movescom(iq, avoid);
-               }
-           }
-       }
-       else {
-           /* try moving just in x or y */
-           iq.y = game.state.kscmdr.y;
-           if (movescom(iq, avoid)) {
-               iq.y = game.state.kscmdr.y + ideltay;
-               iq.x = game.state.kscmdr.x;
-               movescom(iq, avoid);
-           }
-       }
-    }
-    /* check for a base */
-    if (game.state.rembase == 0) {
-       unschedule(FSCMOVE);
-    }
-    else {
-       for (i = 1; i <= game.state.rembase; i++) {
-           ibq = game.state.baseq[i];
-           if (same(ibq, game.state.kscmdr) && same(game.state.kscmdr, game.battle)) {
-               /* attack the base */
-               if (avoid)
-                   return; /* no, don't attack base! */
-               game.iseenit = false;
-               game.isatb = 1;
-               schedule(FSCDBAS, 1.0 +2.0*Rand());
-               if (is_scheduled(FCDBAS)) 
-                   postpone(FSCDBAS, scheduled(FCDBAS)-game.state.date);
-               if (damaged(DRADIO) && game.condition != docked)
-                   return; /* no warning */
-               game.iseenit = true;
-               announce();
-               proutn(_("Lt. Uhura-  \"Captain, the starbase in "));
-               proutn(cramlc(quadrant, game.state.kscmdr));
-               skip(1);
-               prout(_("   reports that it is under attack from the Klingon Super-commander."));
-               proutn(_("   It can survive until stardate %d.\""),
-                      (int)scheduled(FSCDBAS));
-               if (!game.resting)
-                   return;
-               prout(_("Mr. Spock-  \"Captain, shall we cancel the rest period?\""));
-               if (ja() == false)
-                   return;
-               game.resting = false;
-               game.optime = 0.0; /* actually finished */
-               return;
-           }
-       }
-    }
-    /* Check for intelligence report */
-    if (
-       !idebug &&
-       (Rand() > 0.2 ||
-        (damaged(DRADIO) && game.condition != docked) ||
-        !game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].charted))
-       return;
-    announce();
-    prout(_("Lt. Uhura-  \"Captain, Starfleet Intelligence reports"));
-    proutn(_("   the Super-commander is in "));
-    proutn(cramlc(quadrant, game.state.kscmdr));
-    prout(".\"");
-    return;
-}
-
-void movetholian(void)
-/* move the Tholian */
-{
-    int idx, idy, im, i;
-    if (!game.ithere || game.justin)
-       return;
-
-    if (game.tholian.x == 1 && game.tholian.y == 1) {
-       idx = 1; idy = QUADSIZE;
-    }
-    else if (game.tholian.x == 1 && game.tholian.y == QUADSIZE) {
-       idx = QUADSIZE; idy = QUADSIZE;
-    }
-    else if (game.tholian.x == QUADSIZE && game.tholian.y == QUADSIZE) {
-       idx = QUADSIZE; idy = 1;
-    }
-    else if (game.tholian.x == QUADSIZE && game.tholian.y == 1) {
-       idx = 1; idy = 1;
-    }
-    else {
-       /* something is wrong! */
-       game.ithere = false;
-       return;
-    }
-
-    /* do nothing if we are blocked */
-    if (game.quad[idx][idy]!= IHDOT && game.quad[idx][idy]!= IHWEB)
-       return;
-    game.quad[game.tholian.x][game.tholian.y] = IHWEB;
-
-    if (game.tholian.x != idx) {
-       /* move in x axis */
-       im = fabs((double)idx - game.tholian.x)/((double)idx - game.tholian.x);
-       while (game.tholian.x != idx) {
-           game.tholian.x += im;
-           if (game.quad[game.tholian.x][game.tholian.y]==IHDOT)
-               game.quad[game.tholian.x][game.tholian.y] = IHWEB;
-       }
-    }
-    else if (game.tholian.y != idy) {
-       /* move in y axis */
-       im = fabs((double)idy - game.tholian.y)/((double)idy - game.tholian.y);
-       while (game.tholian.y != idy) {
-           game.tholian.y += im;
-           if (game.quad[game.tholian.x][game.tholian.y]==IHDOT)
-               game.quad[game.tholian.x][game.tholian.y] = IHWEB;
-       }
-    }
-    game.quad[game.tholian.x][game.tholian.y] = IHT;
-    game.ks[game.nenhere] = game.tholian;
-
-    /* check to see if all holes plugged */
-    for (i = 1; i <= QUADSIZE; 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[game.tholian.x][game.tholian.y]=IHWEB;
-    dropin(IHBLANK);
-    crmena(true, IHT, sector, game.tholian);
-    prout(_(" completes web."));
-    game.ithere = false;
-    game.nenhere--;
-    return;
-}
diff --git a/c-version/src/battle.c b/c-version/src/battle.c
deleted file mode 100644 (file)
index 223a981..0000000
+++ /dev/null
@@ -1,1389 +0,0 @@
-#include "sst.h"
-
-void doshield(bool raise) 
-/* change shield status */
-{
-    int key;
-    enum {NONE, SHUP, SHDN, NRG} action = NONE;
-
-    game.ididit = false;
-
-    if (raise) 
-       action = SHUP;
-    else {
-       key = scan();
-       if (key == IHALPHA) {
-           if (isit("transfer"))
-               action = NRG;
-           else {
-               chew();
-               if (damaged(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() == true) {
-               proutn(_("Energy to transfer to shields- "));
-               action = NRG;
-           }
-           else if (damaged(DSHIELD)) {
-               prout(_("Shields damaged and down."));
-               return;
-           }
-           else if (game.shldup) {
-               proutn(_("Shields are up. Do you want them down? "));
-               if (ja() == true)
-                   action = SHDN;
-               else {
-                   chew();
-                   return;
-               }
-           }
-           else {
-               proutn(_("Shields are down. Do you want them up? "));
-               if (ja() == true)
-                   action = SHUP;
-               else {
-                   chew();
-                   return;
-               }
-           }
-       }
-    }
-    switch (action) {
-    case SHUP: /* raise shields */
-       if (game.shldup) {
-           prout(_("Shields already up."));
-           return;
-       }
-       game.shldup = true;
-       game.shldchg = true;
-       if (game.condition != docked)
-           game.energy -= 50.0;
-       prout(_("Shields raised."));
-       if (game.energy <= 0) {
-           skip(1);
-           prout(_("Shields raising uses up last of energy."));
-           finish(FNRG);
-           return;
-       }
-       game.ididit=true;
-       return;
-    case SHDN:
-       if (!game.shldup) {
-           prout(_("Shields already down."));
-           return;
-       }
-       game.shldup=false;
-       game.shldchg=true;
-       prout(_("Shields lowered."));
-       game.ididit = true;
-       return;
-    case NRG:
-       while (scan() != IHREAL) {
-           chew();
-           proutn(_("Energy to transfer to shields- "));
-       }
-       chew();
-       if (aaitem==0)
-           return;
-       if (aaitem > game.energy) {
-           prout(_("Insufficient ship energy."));
-           return;
-       }
-       game.ididit = true;
-       if (game.shield+aaitem >= game.inshld) {
-           prout(_("Shield energy maximized."));
-           if (game.shield+aaitem > game.inshld) {
-               prout(_("Excess energy requested returned to ship energy"));
-           }
-           game.energy -= game.inshld-game.shield;
-           game.shield = game.inshld;
-           return;
-       }
-       if (aaitem < 0.0 && game.energy-aaitem > game.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."));
-           game.ididit = false;
-           return;
-       }
-       if (game.shield+aaitem < 0) {
-           prout(_("All shield energy transferred to ship."));
-           game.energy += game.shield;
-           game.shield = 0.0;
-           return;
-       }
-       proutn(_("Scotty- \""));
-       if (aaitem > 0)
-           prout(_("Transferring energy to shields.\""));
-       else
-           prout(_("Draining energy from shields.\""));
-       game.shield += aaitem;
-       game.energy -= aaitem;
-       return;
-    case NONE:;        /* avoid gcc warning */
-    }
-}
-
-static int randdevice(void)
-/* choose a device to damage, at random. */
-{
-    /*
-     * Quoth Eric Allman in the code of BSD-Trek:
-     * "Under certain conditions you can get a critical hit.  This
-     * sort of hit damages devices.  The probability that a given
-     * device is damaged depends on the device.  Well protected
-     * devices (such as the computer, which is in the core of the
-     * ship and has considerable redundancy) almost never get
-     * damaged, whereas devices which are exposed (such as the
-     * warp engines) or which are particularly delicate (such as
-     * the transporter) have a much higher probability of being
-     * damaged."
-     *
-     * This is one place where OPTION_PLAIN does not restore the
-     * original behavior, which was equiprobable damage across
-     * all devices.  If we wanted that, we'd return NDEVICES*Rand()
-     * and have done with it.  Also, in the original game, DNAVYS
-     * and DCOMPTR were the same device. 
-     *
-     * Instead, we use a table of weights similar to the one from BSD Trek.
-     * BSD doesn't have the shuttle, shield controller, death ray, or probes. 
-     * We don't have a cloaking device.  The shuttle got the allocation
-     * for the cloaking device, then we shaved a half-percent off
-     * everything to have some weight to give DSHCTRL/DDRAY/DDSP.
-     */
-    static int weights[NDEVICES] = {
-       105,    /* DSRSENS: short range scanners        10.5% */
-       105,    /* DLRSENS: long range scanners         10.5% */
-       120,    /* DPHASER: phasers                     12.0% */
-       120,    /* DPHOTON: photon torpedoes            12.0% */
-       25,     /* DLIFSUP: life support                 2.5% */
-       65,     /* DWARPEN: warp drive                   6.5% */
-       70,     /* DIMPULS: impulse engines              6.5% */
-       145,    /* DSHIELD: deflector shields           14.5% */
-       30,     /* DRADIO:  subspace radio               3.0% */
-       45,     /* DSHUTTL: shuttle                      4.5% */
-       15,     /* DCOMPTR: computer                     1.5% */
-       20,     /* NAVCOMP: navigation system            2.0% */
-       75,     /* DTRANSP: transporter                  7.5% */
-       20,     /* DSHCTRL: high-speed shield controller 2.0% */
-       10,     /* DDRAY: death ray                      1.0% */
-       30,     /* DDSP: deep-space probes               3.0% */
-    };
-    int sum, i, idx = Rand() * 1000.0; /* weights must sum to 1000 */
-
-    for (i = sum = 0; i < NDEVICES; i++) {
-       sum += weights[i];
-       if (idx < sum)
-           return i;
-    }
-    return -1; /* we should never get here, but this quiets GCC */
-}
-
-void ram(bool ibumpd, feature ienm, coord w)
-/* make our ship ram something */
-{
-    double hardness, extradm;
-    int icas, m, ncrits;
-       
-    prouts(_("***RED ALERT!  RED ALERT!"));
-    skip(1);
-    prout(_("***COLLISION IMMINENT."));
-    skip(2);
-    proutn("***");
-    crmshp();
-    switch (ienm) {
-    case IHR: hardness = 1.5; break;
-    case IHC: hardness = 2.0; break;
-    case IHS: hardness = 2.5; break;
-    case IHT: hardness = 0.5; break;
-    case IHQUEST: hardness = 4.0; break;
-    default: hardness = 1.0; break;
-    }
-    proutn(ibumpd ? _(" rammed by ") : _(" rams "));
-    crmena(false, ienm, sector, w);
-    if (ibumpd)
-       proutn(_(" (original position)"));
-    skip(1);
-    deadkl(w, ienm, game.sector);
-    proutn("***");
-    crmshp();
-    prout(_(" heavily damaged."));
-    icas = 10.0+20.0*Rand();
-    prout(_("***Sickbay reports %d casualties"), icas);
-    game.casual += icas;
-    game.state.crew -= icas;
-    /*
-     * In the pre-SST2K version, all devices got equiprobably damaged,
-     * which was silly.  Instead, pick up to half the devices at
-     * random according to our weighting table,
-     */
-    ncrits = Rand() * (NDEVICES/2);
-    for (m=0; m < ncrits; m++) {
-       int dev = randdevice();
-       if (game.damage[dev] < 0) 
-           continue;
-       extradm = (10.0*hardness*Rand()+1.0)*game.damfac;
-       /* Damage for at least time of travel! */
-       game.damage[dev] += game.optime + extradm;
-    }
-    game.shldup = false;
-    prout(_("***Shields are down."));
-    if (game.state.remkl + game.state.remcom + game.state.nscrem) {
-       announce();
-       damagereport();
-    }
-    else
-       finish(FWON);
-    return;
-}
-
-void torpedo(double course, double r, coord in, double *hit, int i, int n)
-/* let a photon torpedo fly */
-{
-    int l, iquad=0, ll;
-    bool shoved = false;
-    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=in.x, y=in.y, bigger;
-    double ang, temp, xx, yy, kp, h1;
-    struct quadrant *q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
-    coord w, jw;
-
-    w.x = w.y = jw.x = jw.y = 0;
-    bigger = fabs(deltax);
-    if (fabs(deltay) > bigger)
-       bigger = fabs(deltay);
-    deltax /= bigger;
-    deltay /= bigger;
-    if (!damaged(DSRSENS) || game.condition==docked) 
-       setwnd(srscan_window);
-    else 
-       setwnd(message_window);
-    /* Loop to move a single torpedo */
-    for (l=1; l <= 15; l++) {
-       x += deltax;
-       w.x = x + 0.5;
-       y += deltay;
-       w.y = y + 0.5;
-       if (!VALID_SECTOR(w.x, w.y))
-           break;
-       iquad=game.quad[w.x][w.y];
-       tracktorpedo(w, l, i, n, iquad);
-       if (iquad==IHDOT)
-           continue;
-       /* hit something */
-       setwnd(message_window);
-       if (damaged(DSRSENS) && !game.condition==docked)
-           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 * distance(w, in) * fabs(sin(bullseye-angle));
-           *hit = fabs(*hit);
-           newcnd(); /* we're blown out of dock */
-           /* We may be displaced. */
-           if (game.landed || game.condition==docked) 
-               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;
-           jw.x=w.x+xx+0.5;
-           jw.y=w.y+yy+0.5;
-           if (!VALID_SECTOR(jw.x, jw.y))
-               return;
-           if (game.quad[jw.x][jw.y]==IHBLANK) {
-               finish(FHOLE);
-               return;
-           }
-           if (game.quad[jw.x][jw.y]!=IHDOT) {
-               /* can't move into object */
-               return;
-           }
-           game.sector = jw;
-           crmshp();
-           shoved = true;
-           break;
-                                         
-       case IHC: /* Hit a commander */
-       case IHS:
-           if (Rand() <= 0.05) {
-               crmena(true, iquad, sector, w);
-               prout(_(" uses anti-photon device;"));
-               prout(_("   torpedo neutralized."));
-               return;
-           }
-       case IHR: /* Hit a regular enemy */
-       case IHK:
-           /* find the enemy */
-           for (ll = 1; ll <= game.nenhere; ll++)
-               if (same(w, game.ks[ll]))
-                   break;
-           kp = fabs(game.kpower[ll]);
-           h1 = 700.0 + 100.0*Rand() -
-               1000.0 * distance(w, in) * 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(w, iquad, w);
-               return;
-           }
-           crmena(true, iquad, sector, w);
-           /* 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;
-           jw.x=w.x+xx+0.5;
-           jw.y=w.y+yy+0.5;
-           if (!VALID_SECTOR(jw.x, jw.y)) {
-               prout(_(" damaged but not destroyed."));
-               return;
-           }
-           if (game.quad[jw.x][jw.y]==IHBLANK) {
-               prout(_(" buffeted into black hole."));
-               deadkl(w, iquad, jw);
-               return;
-           }
-           if (game.quad[jw.x][jw.y]!=IHDOT) {
-               /* can't move into object */
-               prout(_(" damaged but not destroyed."));
-               return;
-           }
-           proutn(_(" damaged--"));
-           game.ks[ll] = jw;
-           shoved = true;
-           break;
-       case IHB: /* Hit a base */
-           skip(1);
-           prout(_("***STARBASE DESTROYED.."));
-           for (ll = 1; ll <= game.state.rembase; ll++) {
-               if (same(game.state.baseq[ll], game.quadrant)) {
-                   game.state.baseq[ll]=game.state.baseq[game.state.rembase];
-                   break;
-               }
-           }
-           game.quad[w.x][w.y]=IHDOT;
-           game.state.rembase--;
-           game.base.x=game.base.y=0;
-           q->starbase--;
-           game.state.chart[game.quadrant.x][game.quadrant.y].starbase--;
-           game.state.basekl++;
-           newcnd();
-           return;
-       case IHP: /* Hit a planet */
-           crmena(true, iquad, sector, w);
-           prout(_(" destroyed."));
-           game.state.nplankl++;
-           q->planet = NOPLANET;
-           game.state.planets[game.iplnet].pclass = destroyed;
-           game.iplnet = 0;
-           invalidate(game.plnet);
-           game.quad[w.x][w.y] = IHDOT;
-           if (game.landed) {
-               /* captain perishes on planet */
-               finish(FDPLANET);
-           }
-           return;
-       case IHW: /* Hit an inhabited world -- very bad! */
-           crmena(true, iquad, sector, w);
-           prout(_(" destroyed."));
-           game.state.nworldkl++;
-           q->planet = NOPLANET;
-           game.state.planets[game.iplnet].pclass = destroyed;
-           game.iplnet = 0;
-           invalidate(game.plnet);
-           game.quad[w.x][w.y] = IHDOT;
-           if (game.landed) {
-               /* captain perishes on planet */
-               finish(FDPLANET);
-           }
-           prout(_("You have just destroyed an inhabited planet."));
-           prout(_("Celebratory rallies are being held on the Klingon homeworld."));
-           return;
-       case IHSTAR: /* Hit a star */
-           if (Rand() > 0.10) {
-               nova(w);
-               return;
-           }
-           crmena(true, IHSTAR, sector, w);
-           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(w, iquad, w);
-           } 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 = true;
-               shoved = true;
-           }
-           return;
-       case IHBLANK: /* Black hole */
-           skip(1);
-           crmena(true, IHBLANK, sector, w);
-           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 * distance(w, in) * fabs(sin(bullseye-angle));
-           h1 = fabs(h1);
-           if (h1 >= 600) {
-               game.quad[w.x][w.y] = IHDOT;
-               game.ithere = false;
-               deadkl(w, iquad, w);
-               return;
-           }
-           skip(1);
-           crmena(true, IHT, sector, w);
-           if (Rand() > 0.05) {
-               prout(_(" survives photon blast."));
-               return;
-           }
-           prout(_(" disappears."));
-           game.quad[w.x][w.y] = IHWEB;
-           game.ithere = false;
-           game.nenhere--;
-           dropin(IHBLANK);
-           return;
-                                       
-       default: /* Problem! */
-           skip(1);
-           proutn("Don't know how to handle collision with ");
-           crmena(true, iquad, sector, w);
-           skip(1);
-           return;
-       }
-       break;
-    }
-    if(curwnd!=message_window) {
-       setwnd(message_window);
-    }
-    if (shoved) {
-       game.quad[w.x][w.y]=IHDOT;
-       game.quad[jw.x][jw.y]=iquad;
-       prout(_(" displaced by blast to %s "), cramlc(sector, jw));
-       for (ll = 1; ll <= game.nenhere; ll++)
-           game.kdist[ll] = game.kavgd[ll] = distance(game.sector,game.ks[ll]);
-       sortklings();
-       return;
-    }
-    skip(1);
-    prout(_("Torpedo missed."));
-    return;
-}
-
-static void fry(double hit)
-/* critical-hit resolution */
-{
-    double ncrit, extradm;
-    int ktr=1, loop1, loop2, j, cdam[NDEVICES];
-
-    /* a critical hit occured */
-    if (hit < (275.0-25.0*game.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 (loop1 = 0; loop1 < ncrit; loop1++) {
-       do {
-           j = randdevice();
-           /* Cheat to prevent shuttle damage unless on ship */
-       } while 
-             (game.damage[j]<0.0 || (j==DSHUTTL && game.iscraft != onship));
-       cdam[loop1] = j;
-       extradm = (hit*game.damfac)/(ncrit*(75.0+25.0*Rand()));
-       game.damage[j] += extradm;
-       if (loop1 > 0) {
-           for (loop2 = 0; loop2 < loop1 && j != cdam[loop2]; loop2++) ;
-           if (loop2 < loop1)
-               continue;
-           ktr += 1;
-           if (ktr==3)
-               skip(1);
-           proutn(_(" and "));
-       }
-       proutn(device[j]);
-    }
-    prout(_(" damaged."));
-    if (damaged(DSHIELD) && game.shldup) {
-       prout(_("***Shields knocked down."));
-       game.shldup=false;
-    }
-}
-
-void attack(bool torps_ok) 
-/* bad guy attacks us */
-{
-    /* torps_ok == false forces use of phasers in an attack */
-    int percent, loop, iquad;
-    bool usephasers, atackd = false, attempt = false, ihurt = false;
-    double hit, pfac, dustfac, hitmax=0.0, hittot=0.0, chgfac=1.0, r;
-    coord jay;
-    enum loctype where = neither;
-
-    /* game could be over at this point, check */
-    if (game.alldone) 
-       return;
-
-    if (idebug) 
-       prout("=== ATTACK!");
-
-    /* Tholian gewts to move before attacking */
-    if (game.ithere) 
-       movetholian();
-
-    /* if you have just entered the RNZ, you'll get a warning */
-    if (game.neutz) { /* The one chance not to be attacked */
-       game.neutz = false;
-       return;
-    }
-
-    /* commanders get a chance to tac-move towards you */
-    if ((((game.comhere || game.ishere) && !game.justin) || game.skill == SKILL_EMERITUS) && torps_ok) 
-       moveklings();
-
-    /* if no enemies remain after movement, we're done */
-    if (game.nenhere==0 || (game.nenhere==1 && iqhere && !iqengry)) 
-       return;
-
-    /* set up partial hits if attack happens during shield status change */
-    pfac = 1.0/game.inshld;
-    if (game.shldchg)
-       chgfac = 0.25+0.5*Rand();
-
-    skip(1);
-
-    /* message verbosity control */
-    if (game.skill <= SKILL_FAIR) 
-       where = sector;
-
-    for (loop = 1; loop <= game.nenhere; loop++) {
-       if (game.kpower[loop] < 0)
-           continue;   /* too weak to attack */
-       /* compute hit strength and diminish shield power */
-       r = Rand();
-       /* Increase chance of photon torpedos if docked or enemy energy low */
-       if (game.condition == docked)
-           r *= 0.25;
-       if (game.kpower[loop] < 500)
-           r *= 0.25; 
-       jay = game.ks[loop];
-       iquad = game.quad[jay.x][jay.y];
-       if (iquad==IHT || (iquad==IHQUEST && !iqengry))
-           continue;
-       /* different enemies have different probabilities of throwing a torp */
-       usephasers = !torps_ok || \
-           (iquad == IHK && r > 0.0005) || 
-           (iquad==IHC && r > 0.015) ||
-           (iquad==IHR && r > 0.3) ||
-           (iquad==IHS && r > 0.07) ||
-           (iquad==IHQUEST && r > 0.05);
-       if (usephasers) {           /* Enemy uses phasers */
-           if (game.condition == docked)
-               continue; /* Don't waste the effort! */
-           attempt = true; /* Attempt to attack */
-           dustfac = 0.8+0.05*Rand();
-           hit = game.kpower[loop]*pow(dustfac,game.kavgd[loop]);
-           game.kpower[loop] *= 0.75;
-       }
-       else { /* Enemy uses photon torpedo */
-           double course = 1.90985*atan2((double)game.sector.y-jay.y, (double)jay.x-game.sector.x);
-           hit = 0;
-           proutn(_("***TORPEDO INCOMING"));
-           if (!damaged(DSRSENS)) {
-               proutn(_(" From "));
-               crmena(false, iquad, where, jay);
-           }
-           attempt = true;
-           prout("  ");
-           r = (Rand()+Rand())*0.5 -0.5;
-           r += 0.002*game.kpower[loop]*r;
-           torpedo(course, r, jay, &hit, 1, 1);
-           if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0) 
-               finish(FWON); /* Klingons did themselves in! */
-           if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova || game.alldone) 
-               return; /* Supernova or finished */
-           if (hit == 0)
-               continue;
-       }
-       /* incoming phaser or torpedo, shields may dissipate it */
-       if (game.shldup || game.shldchg || game.condition==docked) {
-           /* shields will take hits */
-           double absorb, hitsh, propor = pfac*game.shield*(game.condition==docked ? 2.1 : 1.0);
-           if (propor < 0.1)
-               propor = 0.1;
-           hitsh = propor*chgfac*hit+1.0;
-           absorb = 0.8*hitsh;
-           if (absorb > game.shield)
-               absorb = game.shield;
-           game.shield -= absorb;
-           hit -= hitsh;
-           /* taking a hit blasts us out of a starbase dock */
-           if (game.condition == docked)
-               dock(false);
-           /* but the shields may take care of it */
-           if (propor > 0.1 && hit < 0.005*game.energy) 
-               continue;
-       }
-       /* hit from this opponent got through shields, so take damage */
-       ihurt = true;
-       proutn(_("%d unit hit"), (int)hit);
-       if ((damaged(DSRSENS) && usephasers) || game.skill<=SKILL_FAIR) {
-           proutn(_(" on the "));
-           crmshp();
-       }
-       if (!damaged(DSRSENS) && usephasers) {
-           proutn(_(" from "));
-           crmena(false, iquad, where, jay);
-       }
-       skip(1);
-       /* Decide if hit is critical */
-       if (hit > hitmax)
-           hitmax = hit;
-       hittot += hit;
-       fry(hit);
-       game.energy -= hit;
-    }
-    if (game.energy <= 0) {
-       /* Returning home upon your shield, not with it... */
-       finish(FBATTLE);
-       return;
-    }
-    if (!attempt && game.condition == docked)
-       prout(_("***Enemies decide against attacking your ship."));
-    if (!atackd)
-       return;
-    percent = 100.0*pfac*game.shield+0.5;
-    if (!ihurt) {
-       /* 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)game.energy);
-       if (game.shldup)
-           proutn(_("up "));
-       else if (!damaged(DSHIELD))
-           proutn(_("down "));
-       else
-           proutn(_("damaged, "));
-    }
-    prout(_("%d%%,   torpedoes left %d"), percent, game.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.\""));
-           game.casual += icas;
-           game.state.crew -= icas;
-       }
-    }
-    /* After attack, reset average distance to enemies */
-    for (loop = 1; loop <= game.nenhere; loop++)
-       game.kavgd[loop] = game.kdist[loop];
-    sortklings();
-    return;
-}
-               
-void deadkl(coord w, feature type, coord mv)
-/* kill a Klingon, Tholian, Romulan, or Thingy */
-{
-    /* Added mv to allow enemy to "move" before dying */
-    int i,j;
-
-    crmena(true, type, sector, mv);
-    /* Decide what kind of enemy it is and update appropriately */
-    if (type == IHR) {
-       /* chalk up a Romulan */
-       game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans--;
-       game.irhere--;
-       game.state.nromrem--;
-    }
-    else if (type == IHT) {
-       /* Killed a Tholian */
-       game.ithere = false;
-    }
-    else if (type == IHQUEST) {
-       /* Killed a Thingy */
-       iqhere = iqengry = false;
-       invalidate(thing);
-    }
-    else {
-       /* Some type of a Klingon */
-       game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons--;
-       game.klhere--;
-       switch (type) {
-       case IHC:
-           game.comhere = false;
-           for (i = 1; i <= game.state.remcom; i++)
-               if (same(game.state.kcmdr[i], game.quadrant)) 
-                   break;
-           game.state.kcmdr[i] = game.state.kcmdr[game.state.remcom];
-           game.state.kcmdr[game.state.remcom].x = 0;
-           game.state.kcmdr[game.state.remcom].y = 0;
-           game.state.remcom--;
-           unschedule(FTBEAM);
-           if (game.state.remcom != 0)
-               schedule(FTBEAM, expran(1.0*game.incom/game.state.remcom));
-           break;
-       case IHK:
-           game.state.remkl--;
-           break;
-       case IHS:
-           game.state.nscrem--;
-           game.ishere = false;
-           game.state.kscmdr.x = game.state.kscmdr.y = game.isatb = 0;
-           game.iscate = false;
-           unschedule(FSCMOVE);
-           unschedule(FSCDBAS);
-           break;
-       default:        /* avoids a gcc warning */
-           prout("*** Internal error, deadkl() called on %c\n", type);
-           break;
-       }
-    }
-
-    /* For each kind of enemy, finish message to player */
-    prout(_(" destroyed."));
-    game.quad[w.x][w.y] = IHDOT;
-    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
-       return;
-
-    game.state.remtime = game.state.remkl + game.state.remcom > 0 ?
-           game.state.remres/(game.state.remkl + 4*game.state.remcom) : 99;
-
-    /* Remove enemy ship from arrays describing local conditions */
-    if (is_scheduled(FCDBAS) && same(game.battle, game.quadrant) && type==IHC)
-       unschedule(FCDBAS);
-    for (i = 1; i <= game.nenhere; i++)
-       if (same(game.ks[i], w))
-           break;
-    game.nenhere--;
-    if (i <= game.nenhere)  {
-       for (j=i; j<=game.nenhere; j++) {
-           game.ks[j] = game.ks[j+1];
-           game.kpower[j] = game.kpower[j+1];
-           game.kavgd[j] = game.kdist[j] = game.kdist[j+1];
-       }
-    }
-    game.ks[game.nenhere+1].x = 0;
-    game.ks[game.nenhere+1].x = 0;
-    game.kdist[game.nenhere+1] = 0;
-    game.kavgd[game.nenhere+1] = 0;
-    game.kpower[game.nenhere+1] = 0;
-    return;
-}
-
-static bool targetcheck(double x, double y, double *course) 
-{
-    double deltx, delty;
-    /* Return true if target is invalid */
-    if (!VALID_SECTOR(x, y)) {
-       huh();
-       return true;
-    }
-    deltx = 0.1*(y - game.sector.y);
-    delty = 0.1*(game.sector.x - 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 true;
-    }
-    *course = 1.90985932*atan2(deltx, delty);
-    return false;
-}
-
-void torps(void) 
-/* launch photon torpedo salvo */
-{
-    double targ[4][3], course[4];
-    double r, dummy;
-    int key, n, i;
-
-    game.ididit = false;
-
-    if (damaged(DPHOTON)) {
-       prout(_("Photon tubes damaged."));
-       chew();
-       return;
-    }
-    if (game.torps == 0) {
-       prout(_("No torpedoes left."));
-       chew();
-       return;
-    }
-    key = scan();
-    for (;;) {
-       if (key == IHALPHA) {
-           huh();
-           return;
-       }
-       else if (key == IHEOL) {
-           prout(_("%d torpedoes left."), game.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 <= game.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;
-       }
-    }
-    game.ididit = true;
-    /* Loop for moving <n> torpedoes */
-    for (i = 1; i <= n; i++) {
-       if (game.condition != docked)
-           game.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."));
-           if (Rand() <= 0.2) {
-               prout(_("***Photon tubes damaged by misfire."));
-               game.damage[DPHOTON] = game.damfac*(1.0+2.0*Rand());
-           }
-           break;
-       }
-       if (game.shldup || game.condition == docked) 
-           r *= 1.0 + 0.0001*game.shield;
-       torpedo(course[i], r, game.sector, &dummy, i, n);
-       if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
-           return;
-    }
-    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
-       finish(FWON);
-}
-
-       
-
-static void overheat(double rpow)
-/* check for phasers overheating */
-{
-    if (rpow > 1500) {
-       double chekbrn = (rpow-1500.)*0.00038;
-       if (Rand() <= chekbrn) {
-           prout(_("Weapons officer Sulu-  \"Phasers overheated, sir.\""));
-           game.damage[DPHASER] = game.damfac*(1.0 + Rand()) * (1.0+chekbrn);
-       }
-    }
-}
-
-static bool checkshctrl(double rpow) 
-/* check shield control */
-{
-    double hit;
-    int icas;
-       
-    skip(1);
-    if (Rand() < 0.998) {
-       prout(_("Shields lowered."));
-       return false;
-    }
-    /* Something bad has happened */
-    prouts(_("***RED ALERT!  RED ALERT!"));
-    skip(2);
-    hit = rpow*game.shield/game.inshld;
-    game.energy -= rpow+hit*0.8;
-    game.shield -= hit*0.2;
-    if (game.energy <= 0.0) {
-       prouts(_("Sulu-  \"Captain! Shield malf***********************\""));
-       skip(1);
-       stars();
-       finish(FPHASER);
-       return true;
-    }
-    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);
-       game.casual += icas;
-       game.state.crew -= icas;
-    }
-    skip(1);
-    prout(_("Phaser energy dispersed by shields."));
-    prout(_("Enemy unaffected."));
-    overheat(rpow);
-    return true;
-}
-       
-
-void phasers(void) 
-/* fire phasers */
-{
-    double hits[21], rpow=0, extra, powrem, over, temp;
-    int kz = 0, k=1, i, irec=0; /* Cheating inhibitor */
-    bool ifast = false, no = false, itarg = true, msgflag = true;
-    enum {NOTSET, MANUAL, FORCEMAN, AUTOMATIC} automode = NOTSET;
-    int key=0;
-
-    skip(1);
-    /* SR sensors and Computer are needed fopr automode */
-    if (damaged(DSRSENS) || damaged(DCOMPTR)) 
-       itarg = false;
-    if (game.condition == docked) {
-       prout(_("Phasers can't be fired through base shields."));
-       chew();
-       return;
-    }
-    if (damaged(DPHASER)) {
-       prout(_("Phaser control damaged."));
-       chew();
-       return;
-    }
-    if (game.shldup) {
-       if (damaged(DSHCTRL)) {
-           prout(_("High speed shield control damaged."));
-           chew();
-           return;
-       }
-       if (game.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 = true;
-               
-    }
-    /* Original code so convoluted, I re-did it all */
-    while (automode==NOTSET) {
-       key=scan();
-       if (key == IHALPHA) {
-           if (isit("manual")) {
-               if (game.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 ((!itarg) && game.nenhere != 0) {
-                   automode = FORCEMAN;
-               }
-               else {
-                   if (game.nenhere==0)
-                       prout(_("Energy will be expended into space."));
-                   automode = AUTOMATIC;
-                   key = scan();
-               }
-           }
-           else if (isit("no")) {
-               no = true;
-           }
-           else {
-               huh();
-               return;
-           }
-       }
-       else if (key == IHREAL) {
-           if (game.nenhere==0) {
-               prout(_("Energy will be expended into space."));
-               automode = AUTOMATIC;
-           }
-           else if (!itarg)
-               automode = FORCEMAN;
-           else
-               automode = AUTOMATIC;
-       }
-       else {
-           /* IHEOL */
-           if (game.nenhere==0) {
-               prout(_("Energy will be expended into space."));
-               automode = AUTOMATIC;
-           }
-           else if (!itarg)
-               automode = FORCEMAN;
-           else 
-               proutn(_("Manual or automatic? "));
-       }
-    }
-                               
-    switch (automode) {
-    case AUTOMATIC:
-       if (key == IHALPHA && isit("no")) {
-           no = true;
-           key = scan();
-       }
-       if (key != IHREAL && game.nenhere != 0) {
-           prout(_("Phasers locked on target. Energy available: %.2f"),
-                 ifast?game.energy-200.0:game.energy);
-       }
-       irec=0;
-       do {
-           chew();
-           if (!kz)
-               for (i = 1; i <= game.nenhere; 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?game.energy-200:game.energy)) {
-               proutn(_("Energy available= %.2f"),
-                      ifast?game.energy-200:game.energy);
-               skip(1);
-               key = IHEOL;
-           }
-       } while (rpow > (ifast?game.energy-200:game.energy));
-       if (rpow<=0) {
-           /* chicken out */
-           chew();
-           return;
-       }
-       if ((key=scan()) == IHALPHA && isit("no")) {
-           no = true;
-       }
-       if (ifast) {
-           game.energy -= 200; /* Go and do it! */
-           if (checkshctrl(rpow))
-               return;
-       }
-       chew();
-       game.energy -= rpow;
-       extra = rpow;
-       if (game.nenhere) {
-           extra = 0.0;
-           powrem = rpow;
-           for (i = 1; i <= game.nenhere; 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);
-           game.ididit = true;
-       }
-       if (extra > 0 && !game.alldone) {
-           if (game.ithere) {
-               proutn(_("*** Tholian web absorbs "));
-               if (game.nenhere>0)
-                   proutn(_("excess "));
-               prout(_("phaser energy."));
-           }
-           else {
-               prout(_("%d expended on empty space."), (int)extra);
-           }
-       }
-       break;
-
-    case FORCEMAN:
-       chew();
-       key = IHEOL;
-       if (damaged(DCOMPTR))
-           prout(_("Battle computer damaged, manual fire 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 <= game.nenhere;) {
-           coord aim = game.ks[k];
-           int ienm = game.quad[aim.x][aim.y];
-           if (msgflag) {
-               proutn(_("Energy available= %.2f"),
-                      game.energy-.006-(ifast?200:0));
-               skip(1);
-               msgflag = false;
-               rpow = 0.0;
-           }
-           if (damaged(DSRSENS) && !(abs(game.sector.x-aim.x) < 2 && abs(game.sector.y-aim.y) < 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 (itarg && 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 (!damaged(DCOMPTR))
-                   proutn("%d", irec);
-               else
-                   proutn("??");
-               proutn(")  ");
-               proutn(_("units to fire at "));
-               crmena(false, ienm, sector, aim);
-               proutn("-  ");
-               key = scan();
-           }
-           if (key == IHALPHA && isit("no")) {
-               no = true;
-               key = scan();
-               continue;
-           }
-           if (key == IHALPHA) {
-               huh();
-               return;
-           }
-           if (key == IHEOL) {
-               if (k==1) { /* Let me say I'm baffled by this */
-                   msgflag = true;
-               }
-               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?game.energy-200:game.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 = true;
-       }
-       game.energy -= rpow;
-       chew();
-       if (ifast) {
-           game.energy -= 200.0;
-           if (checkshctrl(rpow))
-               return;
-       }
-       hittem(hits);
-       game.ididit = true;
-    case NOTSET:;      /* avoid gcc warning */
-    }
-    /* Say shield raised or malfunction, if necessary */
-    if (game.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!"));
-               game.shldup = false;
-           }
-           else
-               prout(_("Shields raised."));
-       }
-       else
-           game.shldup = false;
-    }
-    overheat(rpow);
-}
-
-void hittem(double *hits) 
-/* register a phaser hit on Klingons and Romulans */
-{
-    double kp, kpow, wham, hit, dustfac, kpini;
-    int nenhr2=game.nenhere, k=1, kk=1, ienm;
-    coord w;
-
-    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];
-       w = game.ks[kk];
-       if (hit > 0.005) {
-           if (!damaged(DSRSENS))
-               boom(w);
-           proutn(_("%d unit hit on "), (int)hit);
-       }
-       else
-           proutn(_("Very small hit on "));
-       ienm = game.quad[w.x][w.y];
-       if (ienm==IHQUEST)
-           iqengry = true;
-       crmena(false,ienm,sector,w);
-       skip(1);
-       if (kpow == 0) {
-           deadkl(w, ienm, w);
-           if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
-               finish(FWON);           
-           if (game.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 %s"),
-                     cramlc(sector, w));
-               prout(_("   has just lost its firepower.\""));
-               game.kpower[kk] = -kpow;
-           }
-    }
-    return;
-}
-
diff --git a/c-version/src/events.c b/c-version/src/events.c
deleted file mode 100644 (file)
index 3362fdd..0000000
+++ /dev/null
@@ -1,971 +0,0 @@
-/*
- * events.c -- event-queue handling
- *
- * This isn't a real event queue a la BSD Trek yet -- you can only have one 
- * event of each type active at any given time.  Mostly these means we can 
- * only have one FDISTR/FENSLV/FREPRO sequence going at any given time;
- * BSD Trek, from which we swiped the idea, can have up to 5.
- */
-#include "sst.h"
-#include <math.h>
-
-event *unschedule(int evtype)
-/* remove an event from the schedule */
-{
-    game.future[evtype].date = FOREVER;
-    return &game.future[evtype];
-}
-
-int is_scheduled(int evtype)
-/* is an event of specified type scheduled */
-{
-    return game.future[evtype].date != FOREVER;
-}
-
-double scheduled(int evtype)
-/* when will this event happen? */
-{
-    return game.future[evtype].date;
-}
-
-event *schedule(int evtype, double offset)
-/* schedule an event of specified type */
-{
-    game.future[evtype].date = game.state.date + offset;
-    return &game.future[evtype];
-}
-
-void postpone(int evtype, double offset)
-/* postpone a scheduled event */
-{
-    game.future[evtype].date += offset;
-}
-
-static bool cancelrest(void)
-/* rest period is interrupted by event */
-{
-    if (game.resting) {
-       skip(1);
-       proutn(_("Mr. Spock-  \"Captain, shall we cancel the rest period?\""));
-       if (ja() == true) {
-           game.resting = false;
-           game.optime = 0.0;
-           return true;
-       }
-    }
-
-    return false;
-}
-
-void events(void) 
-/* run through the event queue looking for things to do */
-{
-    int evcode, i=0, j, k, l;
-    double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
-    bool ictbeam = false, istract = false;
-    struct quadrant *pdest, *q;
-    coord w, hold;
-    event *ev, *ev2;
-    bool fixed_dev[NDEVICES];
-
-    if (idebug) {
-       prout("=== EVENTS from %.2f to %.2f:", game.state.date, fintim);
-       for (i = 1; i < NEVENTS; i++) {
-           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;
-           case FDSPROB: proutn("=== Probe Move      "); break;
-           case FDISTR:  proutn("=== Distress Call   "); break;
-           case FENSLV:  proutn("=== Enslavement     "); break;
-           case FREPRO:  proutn("=== Klingon Build   "); break;
-           }
-           if (is_scheduled(i))
-               prout("%.2f", scheduled(i));
-           else
-               prout("never");
-
-       }
-    }
-
-    hold.x = hold.y = 0;
-    for (;;) {
-       /* Select earliest extraneous event, evcode==0 if no events */
-       evcode = FSPY;
-       if (game.alldone)
-           return;
-       datemin = fintim;
-       for (l = 1; l < NEVENTS; l++)
-           if (game.future[l].date < datemin) {
-               evcode = l;
-               if (idebug)
-                   prout("== Event %d fires", evcode);
-               datemin = game.future[l].date;
-           }
-       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.remkl + game.state.remcom > 0 ?
-               game.state.remres/(game.state.remkl + 4*game.state.remcom) : 99;
-       if (game.state.remtime <=0) {
-           finish(FDEPLETE);
-           return;
-       }
-       /* Any crew left alive? */
-       if (game.state.crew <=0) {
-           finish(FCREW);
-           return;
-       }
-       /* Is life support adequate? */
-       if (damaged(DLIFSUP) && game.condition != docked) {
-           if (game.lsupres < xtime && game.damage[DLIFSUP] > game.lsupres) {
-               finish(FLIFESUP);
-               return;
-           }
-           game.lsupres -= xtime;
-           if (game.damage[DLIFSUP] <= xtime)
-               game.lsupres = game.inlsr;
-       }
-       /* Fix devices */
-       repair = xtime;
-       if (game.condition == docked)
-           repair /= game.docfac;
-       /* Don't fix Deathray here */
-       for (l=0; l<NDEVICES; l++) {
-           fixed_dev[l] = false;
-           if (game.damage[l] > 0.0 && l != DDRAY) {
-               double reminder = (game.damage[l] > repair ?
-                       game.damage[l] - repair : .0);
-               game.damage[l] = reminder;
-               if (!(reminder > 0))
-                   fixed_dev[l] = true;
-           }
-       }
-       /* If radio repaired, update star chart and attack reports */
-       if (fixed_dev[DRADIO]) {
-           prout(_("Lt. Uhura- \"Captain, the sub-space radio is working and"));
-           prout(_("   surveillance reports are coming in."));
-           skip(1);
-           if (!game.iseenit) {
-               attackreport(false);
-               game.iseenit = true;
-           }
-           prout(_("   The star chart is now up to date.\""));
-           skip(1);
-       }
-       if (fixed_dev[DRADIO] || fixed_dev[DLRSENS] || fixed_dev[DSRSENS])
-           rechart();
-       /* Cause extraneous event EVCODE to occur */
-       game.optime -= xtime;
-       switch (evcode) {
-       case FSNOVA: /* Supernova */
-           announce();
-           supernova(false, NULL);
-           schedule(FSNOVA, expran(0.5*game.intime));
-           if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
-               return;
-           break;
-       case FSPY: /* Check with spy to see if S.C. should tractor beam */
-           if (game.state.nscrem == 0 ||
-               ictbeam || istract ||
-               game.condition==docked || game.isatb==1 || game.iscate)
-               return;
-           if (game.ientesc ||
-               (game.energy < 2000 && game.torps < 4 && game.shield < 1250) ||
-               (damaged(DPHASER) && (damaged(DPHOTON) || game.torps < 4)) ||
-               (damaged(DSHIELD) &&
-                (game.energy < 2500 || damaged(DPHASER)) &&
-                (game.torps < 5 || damaged(DPHOTON)))) {
-               /* Tractor-beam her! */
-               istract = true;
-               yank = distance(game.state.kscmdr, game.quadrant);
-               /********* fall through to FTBEAM code ***********/
-           }
-           else
-               return;
-       case FTBEAM: /* Tractor beam */
-           if (evcode==FTBEAM) {
-               if (game.state.remcom == 0) {
-                   unschedule(FTBEAM);
-                   break;
-               }
-               i = Rand()*game.state.remcom+1.0;
-               yank = square(game.state.kcmdr[i].x-game.quadrant.x) + square(game.state.kcmdr[i].y-game.quadrant.y);
-               if (istract || game.condition == docked || yank == 0) {
-                   /* Drats! Have to reschedule */
-                   schedule(FTBEAM, 
-                            game.optime + expran(1.5*game.intime/game.state.remcom));
-                   break;
-               }
-           }
-           /* tractor beaming cases merge here */
-           yank = sqrt(yank);
-           announce();
-           game.optime = (10.0/(7.5*7.5))*yank; /* 7.5 is yank rate (warp 7.5) */
-           ictbeam = true;
-           skip(1);
-           proutn("***");
-           crmshp();
-           prout(_(" caught in long range tractor beam--"));
-           /* If Kirk & Co. screwing around on planet, handle */
-           atover(true); /* atover(true) is Grab */
-           if (game.alldone)
-               return;
-           if (game.icraft) { /* Caught in Galileo? */
-               finish(FSTRACTOR);
-               return;
-           }
-           /* Check to see if shuttle is aboard */
-           if (game.iscraft == offship) {
-               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;
-                   game.iscraft = removed;
-               }
-               else {
-                   prout(_("Galileo, left on the planet surface, is well hidden."));
-               }
-           }
-           if (evcode==0)
-               game.quadrant = game.state.kscmdr;
-           else
-               game.quadrant = game.state.kcmdr[i];
-           game.sector = randplace(QUADSIZE);
-           crmshp();
-           proutn(_(" is pulled to "));
-           proutn(cramlc(quadrant, game.quadrant));
-           proutn(", ");
-           prout(cramlc(sector, game.sector));
-           if (game.resting) {
-               prout(_("(Remainder of rest/repair period cancelled.)"));
-               game.resting = false;
-           }
-           if (!game.shldup) {
-               if (!damaged(DSHIELD) && game.shield > 0) {
-                   doshield(true); /* raise shields */
-                   game.shldchg=false;
-               }
-               else
-                   prout(_("(Shields not currently useable.)"));
-           }
-           newqad(false);
-           /* Adjust finish time to time of tractor beaming */
-           fintim = game.state.date+game.optime;
-           attack(false);
-           if (game.state.remcom <= 0)
-               unschedule(FTBEAM);
-           else 
-               schedule(FTBEAM, game.optime+expran(1.5*game.intime/game.state.remcom));
-           break;
-       case FSNAP: /* Snapshot of the universe (for time warp) */
-           game.snapsht = game.state;
-           game.state.snap = true;
-           schedule(FSNAP, expran(0.5 * game.intime));
-           break;
-       case FBATTAK: /* Commander attacks starbase */
-           if (game.state.remcom==0 || game.state.rembase==0) {
-               /* no can do */
-               unschedule(FBATTAK);
-               unschedule(FCDBAS);
-               break;
-           }
-           i = 0;
-           for (j = 1; j <= game.state.rembase; j++) {
-               for (k = 1; k <= game.state.remcom; k++)
-                   if (same(game.state.baseq[j], game.state.kcmdr[k]) &&
-                       !same(game.state.baseq[j], game.quadrant) &&
-                       !same(game.state.baseq[j], game.state.kscmdr)) {
-                       i = 1;
-                       break;
-                   }
-               if (i == 1)
-                   break;
-           }
-           if (j>game.state.rembase) {
-               /* no match found -- try later */
-               schedule(FBATTAK, expran(0.3*game.intime));
-               unschedule(FCDBAS);
-               break;
-           }
-           /* commander + starbase combination found -- launch attack */
-           game.battle = game.state.baseq[j];
-           schedule(FCDBAS, 1.0+3.0*Rand());
-           if (game.isatb) /* extra time if SC already attacking */
-               postpone(FCDBAS, scheduled(FSCDBAS)-game.state.date);
-           game.future[FBATTAK].date = game.future[FCDBAS].date + expran(0.3*game.intime);
-           game.iseenit = false;
-           if (!damaged(DRADIO) && game.condition != docked) 
-               break; /* No warning :-( */
-           game.iseenit = true;
-           announce();
-           skip(1);
-           proutn(_("Lt. Uhura-  \"Captain, the starbase in "));
-           prout(cramlc(quadrant, game.battle));
-           prout(_("   reports that it is under attack and that it can"));
-           proutn(_("   hold out only until stardate %d"),
-                  (int)scheduled(FCDBAS));
-           prout(".\"");
-           if (cancelrest())
-               return;
-           break;
-       case FSCDBAS: /* Supercommander destroys base */
-           unschedule(FSCDBAS);
-           game.isatb = 2;
-           if (!game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].starbase) 
-               break; /* WAS RETURN! */
-           hold = game.battle;
-           game.battle = game.state.kscmdr;
-           /* FALL THROUGH */
-       case FCDBAS: /* Commander succeeds in destroying base */
-           if (evcode==FCDBAS) {
-               unschedule(FCDBAS);
-               /* find the lucky pair */
-               for (i = 1; i <= game.state.remcom; i++)
-                   if (same(game.state.kcmdr[i], game.battle)) 
-                       break;
-               if (i > game.state.remcom || game.state.rembase == 0 ||
-                   !game.state.galaxy[game.battle.x][game.battle.y].starbase) {
-                   /* No action to take after all */
-                   invalidate(game.battle);
-                   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 (same(game.battle, game.quadrant)) {
-               game.state.chart[game.battle.x][game.battle.y].starbase = false;
-               game.quad[game.base.x][game.base.y] = IHDOT;
-               game.base.x=game.base.y=0;
-               newcnd();
-               skip(1);
-               prout(_("Spock-  \"Captain, I believe the starbase has been destroyed.\""));
-           }
-           else if (game.state.rembase != 1 &&
-                    (!damaged(DRADIO) || game.condition == docked)) {
-               /* Get word via subspace radio */
-               announce();
-               skip(1);
-               prout(_("Lt. Uhura-  \"Captain, Starfleet Command reports that"));
-               proutn(_("   the starbase in "));
-               proutn(cramlc(quadrant, game.battle));
-               prout(_(" has been destroyed by"));
-               if (game.isatb == 2) 
-                   prout(_("the Klingon Super-Commander"));
-               else
-                   prout(_("a Klingon Commander"));
-               game.state.chart[game.battle.x][game.battle.y].starbase = false;
-           }
-           /* Remove Starbase from galaxy */
-           game.state.galaxy[game.battle.x][game.battle.y].starbase = false;
-           for (i = 1; i <= game.state.rembase; i++)
-               if (same(game.state.baseq[i], game.battle))
-                   game.state.baseq[i] = game.state.baseq[game.state.rembase];
-           game.state.rembase--;
-           if (game.isatb == 2) {
-               /* reinstate a commander's base attack */
-               game.battle = hold;
-               game.isatb = 0;
-           }
-           else
-               invalidate(game.battle);
-           break;
-       case FSCMOVE: /* Supercommander moves */
-           schedule(FSCMOVE, 0.2777);
-           if (!game.ientesc && !istract && game.isatb != 1 &&
-                       (!game.iscate || !game.justin)) 
-               supercommander();
-           break;
-       case FDSPROB: /* Move deep space probe */
-           schedule(FDSPROB, 0.01);
-           game.probex += game.probeinx;
-           game.probey += game.probeiny;
-           i = (int)(game.probex/QUADSIZE +0.05);
-           j = (int)(game.probey/QUADSIZE + 0.05);
-           if (game.probec.x != i || game.probec.y != j) {
-               game.probec.x = i;
-               game.probec.y = j;
-               if (!VALID_QUADRANT(i, j) ||
-                   game.state.galaxy[game.probec.x][game.probec.y].supernova) {
-                   // Left galaxy or ran into supernova
-                   if (!damaged(DRADIO) || game.condition == docked) {
-                       announce();
-                       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(".\"");
-                   }
-                   unschedule(FDSPROB);
-                   break;
-               }
-               if (!damaged(DRADIO) || game.condition == docked) {
-                   announce();
-                   skip(1);
-                   proutn(_("Lt. Uhura-  \"The deep space probe is now in "));
-                   proutn(cramlc(quadrant, game.probec));
-                   prout(".\"");
-               }
-           }
-           pdest = &game.state.galaxy[game.probec.x][game.probec.y];
-           /* Update star chart if Radio is working or have access to
-              radio. */
-           if (!damaged(DRADIO) || game.condition == docked) {
-               struct page *chp = &game.state.chart[game.probec.x][game.probec.y];
-
-               chp->klingons = pdest->klingons;
-               chp->starbase = pdest->starbase;
-               chp->stars = pdest->stars;
-               pdest->charted = true;
-           }
-           game.proben--; // One less to travel
-           if (game.proben == 0 && game.isarmed && pdest->stars) {
-               /* lets blow the sucker! */
-               supernova(true, &game.probec);
-               unschedule(FDSPROB);
-               if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) 
-                   return;
-           }
-           break;
-       case FDISTR: /* inhabited system issues distress call */
-           unschedule(FDISTR);
-           /* try a whole bunch of times to find something suitable */
-           i = 100;
-           do {
-               // need a quadrant which is not the current one,
-               // which has some stars which are inhabited and
-               // not already under attack, which is not
-               // supernova'ed, and which has some Klingons in it
-               w = randplace(GALSIZE);
-               q = &game.state.galaxy[w.x][w.y];
-           } while (--i &&
-                    (same(game.quadrant, w) || q->planet == NOPLANET ||
-                     game.state.planets[q->planet].inhabited == UNINHABITED ||
-                     q->supernova || q->status!=secure || q->klingons<=0));
-           if (i == 0) {
-               /* can't seem to find one; ignore this call */
-               if (idebug)
-                   prout("=== Couldn't find location for distress event.");
-               break;
-           }
-
-           /* got one!!  Schedule its enslavement */
-           ev = schedule(FENSLV, expran(game.intime));
-           ev->quadrant = w;
-           q->status = distressed;
-
-           /* tell the captain about it if we can */
-           if (!damaged(DRADIO) || game.condition == docked)
-           {
-               prout(_("Uhura- Captain, %s in %s reports it is under attack"),
-                     systnames[q->planet], cramlc(quadrant, w));
-               prout(_("by a Klingon invasion fleet."));
-               if (cancelrest())
-                   return;
-           }
-           break;
-       case FENSLV:            /* starsystem is enslaved */
-           ev = unschedule(FENSLV);
-           /* see if current distress call still active */
-           q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
-           if (q->klingons <= 0) {
-               q->status = secure;
-               break;
-           }
-           q->status = enslaved;
-
-           /* play stork and schedule the first baby */
-           ev2 = schedule(FREPRO, expran(2.0 * game.intime));
-           ev2->quadrant = ev->quadrant;
-
-           /* report the disaster if we can */
-           if (!damaged(DRADIO) || game.condition == docked)
-           {
-               prout(_("Uhura- We've lost contact with starsystem %s"),
-                     systnames[q->planet]);
-               prout(_("in %s.\n"), cramlc(quadrant, ev->quadrant));
-           }
-           break;
-       case FREPRO:            /* Klingon reproduces */
-           // If we ever switch to a real event queue, we'll need to
-           // explicitly retrieve and restore the x and y.
-           ev = schedule(FREPRO, expran(1.0 * game.intime));
-           /* see if current distress call still active */
-           q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
-           if (q->klingons <= 0) {
-               q->status = secure;
-               break;
-           }
-           if (game.state.remkl >=MAXKLGAME)
-               break;          /* full right now */
-           /* reproduce one Klingon */
-           w = ev->quadrant;
-           if (game.klhere >= MAXKLQUAD) {
-               /* this quadrant not ok, pick an adjacent one */
-               for (i = w.x - 1; i <= w.x + 1; i++)
-               {
-                   for (j = w.y - 1; j <= w.y + 1; j++)
-                   {
-                       if (!VALID_QUADRANT(i, j))
-                           continue;
-                       q = &game.state.galaxy[w.x][w.y];
-                       /* check for this quad ok (not full & no snova) */
-                       if (q->klingons >= MAXKLQUAD || q->supernova)
-                           continue;
-                       goto foundit;
-                   }
-               }
-               break;  /* search for eligible quadrant failed */
-           foundit:
-               w.x = i;
-               w.y = j;
-           }
-
-           /* deliver the child */
-           game.state.remkl++;
-           q->klingons++;
-           if (same(game.quadrant, w))
-               newkling(++game.klhere);
-
-           /* recompute time left */
-           game.state.remtime = game.state.remkl + game.state.remcom > 0 ?
-                   game.state.remres/(game.state.remkl + 4*game.state.remcom) : 99;
-           /* report the disaster if we can */
-           if (!damaged(DRADIO) || game.condition == docked)
-           {
-               if (same(game.quadrant, w)) {
-                   prout(_("Spock- sensors indicate the Klingons have"));
-                   prout(_("launched a warship from %s."), systnames[q->planet]);
-               } else {
-                   prout(_("Uhura- Starfleet reports increased Klingon activity"));
-                   if (q->planet != NOPLANET)
-                       proutn(_("near %s "), systnames[q->planet]);
-                   prout(_("in %s.\n"), cramlc(quadrant, w));
-               }
-           }
-           break;
-       }
-    }
-}
-
-                               
-void wait(void) 
-/* wait on events */
-{
-    int key;
-    double temp, delay, origTime;
-
-    game.ididit = false;
-    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 || game.nenhere != 0) {
-       proutn(_("Are you sure? "));
-       if (ja() == false)
-           return;
-    }
-
-    /* Alternate resting periods (events) with attacks */
-
-    game.resting = true;
-    do {
-       if (delay <= 0)
-           game.resting = false;
-       if (!game.resting) {
-           prout(_("%d stardates left."), (int)game.state.remtime);
-           return;
-       }
-       temp = game.optime = delay;
-
-       if (game.nenhere) {
-           double rtime = 1.0 + Rand();
-           if (rtime < temp)
-               temp = rtime;
-           game.optime = temp;
-       }
-       if (game.optime < delay)
-           attack(false);
-       if (game.alldone)
-           return;
-       events();
-       game.ididit = true;
-       if (game.alldone)
-           return;
-       delay -= temp;
-       /* Repair Deathray if long rest at starbase */
-       if (origTime-delay >= 9.99 && game.condition == docked)
-           game.damage[DDRAY] = 0.0;
-    } while 
-       // leave if quadrant supernovas
-       (!game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova);
-
-    game.resting = false;
-    game.optime = 0;
-}
-
-/*
- *     A nova occurs.  It is the result of having a star hit with a
- *     photon torpedo, or possibly of a probe warhead going off.
- *     Stars that go nova cause stars which surround them to undergo
- *     the same probabilistic process.  Klingons next to them are
- *     destroyed.  And if the starship is next to it, it gets zapped.
- *     If the zap is too much, it gets destroyed.
- */
-void nova(coord nov) 
-/* star goes nova */
-{
-    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;
-    coord newc, scratch;
-
-    if (Rand() < 0.05) {
-       /* Wow! We've supernova'ed */
-       supernova(false, &nov);
-       return;
-    }
-
-    /* handle initial nova */
-    game.quad[nov.x][nov.y] = IHDOT;
-    crmena(false, IHSTAR, sector, nov);
-    prout(_(" novas."));
-    game.state.galaxy[game.quadrant.x][game.quadrant.y].stars--;
-    game.state.starkl++;
-       
-    /* Set up stack to recursively trigger adjacent stars */
-    bot = top = top2 = 1;
-    kount = 0;
-    icx = icy = 0;
-    hits[1][1] = nov.x;
-    hits[1][2] = nov.y;
-    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;
-                   scratch.x = hits[mm][1]+nn-2;
-                   scratch.y = hits[mm][2]+j-2;
-                   if (!VALID_SECTOR(scratch.y, scratch.x))
-                       continue;
-                   iquad = game.quad[scratch.x][scratch.y];
-                   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 */
-                           supernova(false, &scratch);
-                           return;
-                       }
-                       top2++;
-                       hits[top2][1]=scratch.x;
-                       hits[top2][2]=scratch.y;
-                       game.state.galaxy[game.quadrant.x][game.quadrant.y].stars -= 1;
-                       game.state.starkl++;
-                       crmena(true, IHSTAR, sector, scratch);
-                       prout(_(" novas."));
-                       game.quad[scratch.x][scratch.y] = IHDOT;
-                       break;
-                   case IHP: /* Destroy planet */
-                       game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
-                       game.state.nplankl++;
-                       crmena(true, IHP, sector, scratch);
-                       prout(_(" destroyed."));
-                       game.state.planets[game.iplnet].pclass = destroyed;
-                       game.iplnet = 0;
-                       invalidate(game.plnet);
-                       if (game.landed) {
-                           finish(FPNOVA);
-                           return;
-                       }
-                       game.quad[scratch.x][scratch.y] = IHDOT;
-                       break;
-                   case IHB: /* Destroy base */
-                       game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase = false;
-                       for (i = 1; i <= game.state.rembase; i++)
-                           if (same(game.state.baseq[i], game.quadrant)) 
-                               break;
-                       game.state.baseq[i] = game.state.baseq[game.state.rembase];
-                       game.state.rembase--;
-                       invalidate(game.base);
-                       game.state.basekl++;
-                       newcnd();
-                       crmena(true, IHB, sector, scratch);
-                       prout(_(" destroyed."));
-                       game.quad[scratch.x][scratch.y] = IHDOT;
-                       break;
-                   case IHE: /* Buffet ship */
-                   case IHF:
-                       prout(_("***Starship buffeted by nova."));
-                       if (game.shldup) {
-                           if (game.shield >= 2000.0)
-                               game.shield -= 2000.0;
-                           else {
-                               double diff = 2000.0 - game.shield;
-                               game.energy -= diff;
-                               game.shield = 0.0;
-                               game.shldup = false;
-                               prout(_("***Shields knocked out."));
-                               game.damage[DSHIELD] += 0.005*game.damfac*Rand()*diff;
-                           }
-                       }
-                       else
-                           game.energy -= 2000.0;
-                       if (game.energy <= 0) {
-                           finish(FNOVA);
-                           return;
-                       }
-                       /* add in course nova contributes to kicking starship*/
-                       icx += game.sector.x-hits[mm][1];
-                       icy += game.sector.y-hits[mm][2];
-                       kount++;
-                       break;
-                   case IHK: /* kill klingon */
-                       deadkl(scratch,iquad, scratch);
-                       break;
-                   case IHC: /* Damage/destroy big enemies */
-                   case IHS:
-                   case IHR:
-                       for (ll = 1; ll <= game.nenhere; ll++)
-                           if (same(game.ks[ll], scratch))
-                               break;
-                       game.kpower[ll] -= 800.0; /* If firepower is lost, die */
-                       if (game.kpower[ll] <= 0.0) {
-                           deadkl(scratch, iquad, scratch);
-                           break;
-                       }
-                       newc.x = scratch.x + scratch.x - hits[mm][1];
-                       newc.y = scratch.y + scratch.y - hits[mm][2];
-                       crmena(true, iquad, sector, scratch);
-                       proutn(_(" damaged"));
-                       if (!VALID_SECTOR(newc.x, newc.y)) {
-                           /* can't leave quadrant */
-                           skip(1);
-                           break;
-                       }
-                       iquad1 = game.quad[newc.x][newc.y];
-                       if (iquad1 == IHBLANK) {
-                           proutn(_(", blasted into "));
-                           crmena(false, IHBLANK, sector, newc);
-                           skip(1);
-                           deadkl(scratch, iquad, newc);
-                           break;
-                       }
-                       if (iquad1 != IHDOT) {
-                           /* can't move into something else */
-                           skip(1);
-                           break;
-                       }
-                       proutn(_(", buffeted to "));
-                       proutn(cramlc(sector, newc));
-                       game.quad[scratch.x][scratch.y] = IHDOT;
-                       game.quad[newc.x][newc.y] = iquad;
-                       game.ks[ll] = newc;
-                       game.kdist[ll] = game.kavgd[ll] = distance(game.sector, newc);
-                       skip(1);
-                       break;
-                   }
-               }
-       if (top == top2) 
-           break;
-       bot = top + 1;
-       top = top2;
-    }
-    if (kount==0) 
-       return;
-
-    /* Starship affected by nova -- kick it away. */
-    game.dist = kount*0.1;
-    if (icx)
-       icx = (icx < 0 ? -1 : 1);
-    if (icy)
-       icy = (icy < 0 ? -1 : 1);
-    game.direc = course[3*(icx+1)+icy+2];
-    if (game.direc == 0.0)
-       game.dist = 0.0;
-    if (game.dist == 0.0)
-       return;
-    game.optime = 10.0*game.dist/16.0;
-    skip(1);
-    prout(_("Force of nova displaces starship."));
-    imove(true);
-    game.optime = 10.0*game.dist/16.0;
-    return;
-}
-       
-       
-void supernova(bool induced, coord *w) 
-/* star goes supernova */
-{
-    int num = 0, nrmdead, npdead = 0, kldead, loop;
-    coord nq;
-
-    if (w != NULL) 
-       nq = *w;
-    else {
-       int stars = 0;
-       /* Scheduled supernova -- select star */
-       /* logic changed here so that we won't favor quadrants in top
-          left of universe */
-       for (nq.x = 1; nq.x <= GALSIZE; nq.x++)
-           for (nq.y = 1; nq.y <= GALSIZE; nq.y++)
-               stars += game.state.galaxy[nq.x][nq.y].stars;
-       if (stars == 0)
-           return; /* nothing to supernova exists */
-       num = Rand()*stars + 1;
-       for (nq.x = 1; nq.x <= GALSIZE; nq.x++) {
-           for (nq.y = 1; nq.y <= GALSIZE; nq.y++) {
-               num -= game.state.galaxy[nq.x][nq.y].stars;
-               if (num <= 0)
-                   break;
-           }
-           if (num <=0)
-               break;
-       }
-       if (idebug) {
-           proutn("=== Super nova here?");
-           if (ja() == true)
-               nq = game.quadrant;
-       }
-    }
-
-    if (!same(nq, game.quadrant) || game.justin) {
-       /* it isn't here, or we just entered (treat as enroute) */
-       if (!damaged(DRADIO) || game.condition == docked) {
-           skip(1);
-           prout(_("Message from Starfleet Command       Stardate %.2f"), game.state.date);
-           prout(_("     Supernova in %s; caution advised."),
-                 cramlc(quadrant, nq));
-       }
-    }
-    else {
-       coord ns;
-       /* we are in the quadrant! */
-       num = Rand()* game.state.galaxy[nq.x][nq.y].stars + 1;
-       for (ns.x = 1; ns.x <= QUADSIZE; ns.x++) {
-           for (ns.y = 1; ns.y <= QUADSIZE; ns.y++) {
-               if (game.quad[ns.x][ns.y]==IHSTAR) {
-                   num--;
-                   if (num==0)
-                       break;
-               }
-           }
-           if (num==0)
-               break;
-       }
-
-       skip(1);
-       prouts(_("***RED ALERT!  RED ALERT!"));
-       skip(1);
-       prout(_("***Incipient supernova detected at %s"), cramlc(sector, ns));
-       if (square(ns.x-game.sector.x) + square(ns.y-game.sector.y) <= 2.1) {
-           proutn(_("Emergency override attempts t"));
-           prouts("***************");
-           skip(1);
-           stars();
-           game.alldone = true;
-       }
-    }
-
-    /* destroy any Klingons in supernovaed quadrant */
-    kldead = game.state.galaxy[nq.x][nq.y].klingons;
-    game.state.galaxy[nq.x][nq.y].klingons = 0;
-    if (same(nq, game.state.kscmdr)) {
-       /* did in the Supercommander! */
-       game.state.nscrem = game.state.kscmdr.x = game.state.kscmdr.y = game.isatb =  0;
-       game.iscate = false;
-       unschedule(FSCMOVE);
-    }
-    if (same(nq, game.battle)) {
-       unschedule(FSCDBAS);
-       unschedule(FCDBAS);
-       invalidate(game.battle);
-    }
-    if (game.state.remcom) {
-       int maxloop = game.state.remcom, l;
-       for (l = 1; l <= maxloop; l++) {
-           if (same(game.state.kcmdr[l], nq)) {
-               game.state.kcmdr[l] = game.state.kcmdr[game.state.remcom];
-               invalidate(game.state.kcmdr[game.state.remcom]);
-               game.state.remcom--;
-               kldead--;
-               if (game.state.remcom==0)
-                   unschedule(FTBEAM);
-               break;
-           }
-       }
-    }
-    game.state.remkl -= kldead;
-    /* destroy Romulans and planets in supernovaed quadrant */
-    nrmdead = game.state.galaxy[nq.x][nq.y].romulans;
-    game.state.galaxy[nq.x][nq.y].romulans = 0;
-    game.state.nromrem -= nrmdead;
-    /* Destroy planets */
-    for (loop = 0; loop < game.inplan; loop++) {
-       if (same(game.state.planets[loop].w, nq)) {
-           game.state.planets[loop].pclass = destroyed;
-           npdead++;
-       }
-    }
-    /* Destroy any base in supernovaed quadrant */
-    if (game.state.rembase) {
-       int maxloop = game.state.rembase, loop;
-       for (loop = 1; loop <= maxloop; loop++)
-           if (same(game.state.baseq[loop], nq)) {
-               game.state.baseq[loop] = game.state.baseq[game.state.rembase];
-               invalidate(game.state.baseq[game.state.rembase]);
-               game.state.rembase--;
-               break;
-           }
-    }
-    /* If starship caused supernova, tally up destruction */
-    if (induced) {
-       game.state.starkl += game.state.galaxy[nq.x][nq.y].stars;
-       game.state.basekl += game.state.galaxy[nq.x][nq.y].starbase;
-       game.state.nplankl += npdead;
-    }
-    /* mark supernova in galaxy and in star chart */
-    if (same(game.quadrant, nq) || !damaged(DRADIO) || game.condition == docked)
-       game.state.galaxy[nq.x][nq.y].supernova = true;
-    /* If supernova destroys last Klingons give special message */
-    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0 && !same(nq, game.quadrant)) {
-       skip(2);
-       if (!induced)
-           prout(_("Lucky you!"));
-       proutn(_("A supernova in %s has just destroyed the last Klingons."),
-              cramlc(quadrant, nq));
-       finish(FWON);
-       return;
-    }
-    /* if some Klingons remain, continue or die in supernova */
-    if (game.alldone)
-       finish(FSNOVAED);
-    return;
-}
diff --git a/c-version/src/finish.c b/c-version/src/finish.c
deleted file mode 100644 (file)
index 90b23fc..0000000
+++ /dev/null
@@ -1,489 +0,0 @@
-#include "sst.h"
-#include <string.h>
-#include <time.h>
-
-void selfdestruct(void)
-/* self-destruct maneuver */
-{
-    /* Finish with a BANG! */
-    chew();
-    if (damaged(DCOMPTR)) {
-       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 (game.ship==IHE)
-       prouts("***");
-    prouts(_("********* Entropy of "));
-    crmshp();
-    prouts(_(" maximized *********"));
-    skip(1);
-    stars();
-    skip(1);
-    if (game.nenhere != 0) {
-       double whammo = 25.0 * game.energy;
-       int l=1;
-       while (l <= game.nenhere) {
-           if (game.kpower[l]*game.kdist[l] <= whammo) 
-               deadkl(game.ks[l], game.quad[game.ks[l].x][game.ks[l].y], game.ks[l]);
-           l++;
-       }
-    }
-    finish(FDILITHIUM);
-}
-                               
-
-void finish(FINTYPE ifin)
-/* end the game, with appropriate notfications */
-{
-    bool igotit = false;
-    game.alldone = true;
-    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."));
-       game.gamewon = true;
-       if (game.alive) {
-           double badpt;
-           badpt = 5.0*game.state.starkl \
-               + game.casual \
-               + 10.0*game.state.nplankl \
-               + 300.0*game.state.nworldkl \
-               + 45.0*game.nhelp \
-               + 100.0*game.state.basekl \
-               + 3.0*game.abandoned;
-           if (game.ship == IHF)
-               badpt += 100.0;
-           else if (game.ship == 0)
-               badpt += 200.0;
-           if (badpt < 100.0)
-               badpt = 0.0;    // Close enough!
-           if (game.state.date-game.indate < 5.0 ||
-               // killsPerDate >= RateMax
-               ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem))/(game.state.date-game.indate) >=
-               0.1*game.skill*(game.skill+1.0) + 0.1 + 0.008*badpt) {
-               skip(1);
-               prout(_("In fact, you have done so well that Starfleet Command"));
-               switch (game.skill) {
-               case SKILL_NONE:
-                   break;      /* quiet gcc warning */
-               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 (game.skill >= SKILL_EXPERT) {
-                   if (game.thawed && !idebug)
-                       prout(_("You cannot get a citation, so..."));
-                   else {
-                       proutn(_("Do you want your Commodore Emeritus Citation printed? "));
-                       chew();
-                       if (ja() == true) {
-                           igotit = true;
-                       }
-                   }
-               }
-           }
-           // Only grant long life if alive (original didn't!)
-           skip(1);
-           prout(_("LIVE LONG AND PROSPER."));
-       }
-       score();
-       if (igotit)
-           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 ((game.state.remkl + game.state.remcom + game.state.nscrem)*3.0 > (game.inkling + game.incom + game.inscom)) {
-           prout(_("acquitted."));
-           skip(1);
-           prout(_("LIVE LONG AND PROSPER."));
-       }
-       else {
-           prout(_("found guilty and"));
-           prout(_("sentenced to death by slow torture."));
-           game.alive = false;
-       }
-       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 mundi"));
-       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;
-    case FCREW:
-       prout(_("Your last crew member has died."));
-       break;
-    }
-    if (game.ship==IHF)
-       game.ship= 0;
-    else if (game.ship == IHE)
-       game.ship = IHF;
-    game.alive = false;
-    if ((game.state.remkl + game.state.remcom + game.state.nscrem) != 0) {
-       double goodies = game.state.remres/game.inresor;
-       double baddies = (game.state.remkl + 2.0*game.state.remcom)/(game.inkling+2.0*game.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."));
-       game.gamewon = true;
-    }
-    score();
-}
-
-static void score_item(const char *str, int num, int score)
-{
-    if (num) {
-       prout(str, num, score);
-       iscore += score;
-    }
-}
-
-static void score_item1(const char *str, int score)
-{
-    prout(str, score);
-    iscore += score;
-}
-
-static void score_itemf(const char *str, float num, int score)
-{
-    if (num > 0) {
-       prout(str, num, score);
-       iscore += score;
-    }
-}
-
-void score(void) 
-/* compute player's score */
-{
-    double timused = game.state.date - game.indate;
-    int iwon, klship, num;
-
-    iskill = game.skill;
-    if ((timused == 0 || (game.state.remkl + game.state.remcom + game.state.nscrem) != 0) && timused < 5.0)
-       timused = 5.0;
-    iwon = 0;
-    if (game.gamewon)
-       iwon = 100*game.skill;
-    if (game.ship == IHE) 
-       klship = 0;
-    else if (game.ship == IHF) 
-       klship = 1;
-    else
-       klship = 2;
-    iscore = 0;
-    skip(2);
-    prout(_("Your score --"));
-    num = game.inrom - game.state.nromrem;
-    score_item(_("%6d Romulans destroyed                 %5d"), num, 20 * num);
-    if (game.gamewon)
-       score_item(_("%6d Romulans captured                  %5d"),
-             game.state.nromrem, game.state.nromrem);
-    num = game.inkling - game.state.remkl;
-    score_item(_("%6d ordinary Klingons destroyed        %5d"), num, 10 * num);
-    num = game.incom - game.state.remcom;
-    score_item(_("%6d Klingon commanders destroyed       %5d"), num, 50 * num);
-    num = game.inscom - game.state.nscrem;
-    score_item(_("%6d Super-Commander destroyed          %5d"), num, 200 * num);
-    perdate = ((game.inkling + game.incom + game.inscom) -
-           (game.state.remkl + game.state.remcom + game.state.nscrem))/timused;
-    score_itemf(_("%6.2f Klingons per stardate              %5d"), perdate,
-           500 * perdate + 0.5);
-    score_item(_("%6d stars destroyed by your action     %5d"),
-           game.state.starkl, -5*game.state.starkl);
-    score_item(_("%6d planets destroyed by your action   %5d"),
-           game.state.nplankl, -10*game.state.nplankl);
-    if (game.options & OPTION_WORLDS)
-       score_item(_("%6d inhabited planets destroyed by your action   %5d"),
-               game.state.nworldkl, -300*game.state.nworldkl);
-    score_item(_("%6d bases destroyed by your action     %5d"),
-           game.state.basekl, -100*game.state.basekl);
-    score_item(_("%6d calls for help from starbase       %5d"),
-           game.nhelp, -45*game.nhelp);
-    score_item(_("%6d casualties incurred                %5d"),
-           game.casual, -game.casual);
-    score_item(_("%6d crew abandoned in space            %5d"),
-           game.abandoned, -3*game.abandoned);
-    score_item(_("%6d ship(s) lost or destroyed          %5d"),
-           klship, -100*klship);
-    if (!game.alive)
-       score_item1(_("Penalty for getting yourself killed        %5d"), -200);
-    if (game.gamewon) {
-       proutn(_("Bonus for winning "));
-       switch (game.skill) {
-       case SKILL_NONE:     break;     /* quiet gcc warning */
-       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)
-/* emit winner's commemmorative plaque */
-{
-       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/c-version/src/io.c b/c-version/src/io.c
deleted file mode 100644 (file)
index fa028f5..0000000
+++ /dev/null
@@ -1,466 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <wchar.h>
-
-#include "config.h"
-#include "sst.h"
-#include "sstlinux.h"
-
-static int rows, linecount;    /* for paging */
-
-WINDOW *curwnd;
-WINDOW *fullscreen_window;
-WINDOW *srscan_window;
-WINDOW *report_window;
-WINDOW *status_window;
-WINDOW *lrscan_window;
-WINDOW *message_window;
-WINDOW *prompt_window;
-
-static void outro(void)
-/* wrap up, either normally or due to signal */
-{
-    if (game.options & OPTION_CURSES) {
-       //clear();
-       //curs_set(1);
-       //refresh();
-       //resetterm();
-       //echo();
-       endwin();
-       putchar('\n');
-    }
-    if (logfp)
-       fclose(logfp);
-}
-
-void iostart(void) 
-{
-    setlocale(LC_ALL, "");
-    bindtextdomain(PACKAGE, LOCALEDIR);
-    textdomain(PACKAGE);
-
-    if (atexit(outro)){
-       fprintf(stderr,"Unable to register outro(), exiting...\n");
-       exit(1);
-    }
-    if (!(game.options & OPTION_CURSES)) {
-       char *ln_env = getenv("LINES");
-       rows = ln_env ? atoi(ln_env) : 25;
-    } else {
-       initscr();
-#ifdef KEY_MIN
-       keypad(stdscr, TRUE);
-#endif /* KEY_MIN */
-       saveterm();
-       nonl();
-       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 */
-       //noecho();
-       fullscreen_window = stdscr;
-       srscan_window     = newwin(12, 25, 0,       0);
-       report_window     = newwin(11, 0,  1,       25);
-       status_window     = newwin(10, 0,  1,       39);
-       lrscan_window     = newwin(5,  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)
-       wgetch(prompt_window);
-}
-
-void announce(void)
-{
-    skip(1);
-    prouts(_("[ANNOUNCEMENT ARRIVING...]"));
-    skip(1);
-}
-
-static void pause_game(void)
-{
-       char *prompt;
-       char buf[BUFSIZ];
-        if (game.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 {
-           int j;
-           putchar('\n');
-           proutn(prompt);
-           fgets(buf, sizeof(buf), stdin);
-           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 && getcury(curwnd) >= getmaxy(curwnd) - 3) {
-               pause_game();
-               clrscr();
-           } else {
-               proutn("\n");
-           }
-       } else {
-           linecount++;
-           if (linecount >= rows)
-               pause_game();
-           else
-               putchar('\n');
-       }
-    }
-}
-
-static void vproutn(const char *fmt, va_list ap) 
-{
-    if (game.options & OPTION_CURSES) {
-       vwprintw(curwnd, fmt, ap);
-       wrefresh(curwnd);
-    }
-    else
-       vprintf(fmt, ap);
-}
-
-void proutn(const char *fmt, ...) 
-{
-    va_list ap;
-    va_start(ap, fmt);
-    vproutn(fmt, ap);
-    va_end(ap);
-}
-
-void prout(const char *fmt, ...) 
-{
-    va_list ap;
-    va_start(ap, fmt);
-    vproutn(fmt, ap);
-    va_end(ap);
-    skip(1);
-}
-
-void prouts(const char *fmt, ...) 
-/* print slowly! */
-{
-    char buf[BUFSIZ];
-    wchar_t *s, mbuf[BUFSIZ];
-    va_list ap;
-    va_start(ap, fmt);
-    vsprintf(buf, fmt, ap);
-    va_end(ap);
-    mbstowcs(mbuf, buf, BUFSIZ);
-    for (s = mbuf; *s; s++) {
-       /* HOW to convince ncurses to use wchar_t?? */
-       /* WHY putwchar() doesn't work?? */
-       /* OK then, convert back to mbs... */
-       char c[MB_CUR_MAX*2];
-       int n;
-       n = wctomb(c, *s);
-       c[n] = 0;
-       delay(30);
-       proutn(c);
-       if (game.options & OPTION_CURSES)
-           wrefresh(curwnd);
-       else
-           fflush(stdout);
-    }
-    delay(300);
-}
-
-void cgetline(char *line, int max)
-{
-    if (game.options & OPTION_CURSES) {
-       wgetnstr(curwnd, line, max);
-       strcat(line, "\n");
-       wrefresh(curwnd);
-    } else {
-       if (replayfp && !feof(replayfp))
-           (void)fgets(line, max, replayfp);
-       else
-           (void)fgets(line, max, stdin);
-    }
-    if (logfp)
-       (void)fputs(line, logfp);
-    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, bool before) {
-}
-
-/*
- * Things past this point have policy implications.
- */
-
-void drawmaps(int mode)
-/* hook to be called after moving to redraw maps */
-{
-    if (game.options & OPTION_CURSES) {
-       if (mode == 1)
-           sensor();
-        setwnd(srscan_window);
-        wmove(curwnd, 0, 0);
-        srscan();
-       if (mode != 2) {
-           setwnd(status_window);
-           wclear(status_window);
-           wmove(status_window, 0, 0);
-           setwnd(report_window);
-           wclear(report_window);
-           wmove(report_window, 0, 0);
-           status(0);
-           setwnd(lrscan_window);
-           wclear(lrscan_window);
-           wmove(lrscan_window, 0, 0);
-           lrscan();
-       }
-    }
-}
-
-static void put_srscan_sym(coord w, char sym)
-{
-    wmove(srscan_window, w.x+1, w.y*2+2);
-    waddch(srscan_window, sym);
-    wrefresh(srscan_window);
-}
-
-void boom(coord w)
-/* enemy fall down, go boom */ 
-{
-    if (game.options & OPTION_CURSES) {
-       drawmaps(2);
-       setwnd(srscan_window);
-       wattron(srscan_window, A_REVERSE);
-       put_srscan_sym(w, game.quad[w.x][w.y]);
-       sound(500);
-       delay(1000);
-       nosound();
-       wattroff(srscan_window, A_REVERSE);
-       put_srscan_sym(w, game.quad[w.x][w.y]);
-       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(coord w, 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   ", w.x, w.y);
-    } else {
-       if (!damaged(DSRSENS) || game.condition==docked) {
-           if (i != 1 && l == 1) {
-               drawmaps(2);
-               delay(400);
-           }
-           if ((iquad==IHDOT)||(iquad==IHBLANK)){
-               put_srscan_sym(w, '+');
-               sound(l*10);
-               delay(100);
-               nosound();
-               put_srscan_sym(w, iquad);
-           }
-           else {
-               wattron(curwnd, A_REVERSE);
-               put_srscan_sym(w, iquad);
-               sound(500);
-               delay(1000);
-               nosound();
-               wattroff(curwnd, A_REVERSE);
-               put_srscan_sym(w, iquad);
-           }
-       } else {
-           proutn("%d - %d   ", w.x, w.y);
-       }
-    }
-}
-
-void makechart(void) 
-{
-    if (game.options & OPTION_CURSES) {
-       setwnd(message_window);
-       wclear(message_window);
-    }
-    chart();
-    if (game.options & OPTION_TTY) {
-       skip(1);
-    }
-}
-
-void prstat(const char *txt, const char *fmt, ...)
-{
-#define NSYM 14
-    int i;
-    va_list args;
-    proutn(txt);
-    if (game.options & OPTION_CURSES) {
-       skip(1);
-    } else  {
-       for (i = mblen(txt, strlen(txt)); i < NSYM; i++)
-           proutn(" ");
-    }
-    if (game.options & OPTION_CURSES)
-       setwnd(status_window);
-    va_start(args, fmt);
-    vproutn(fmt, args);
-    va_end(args);
-    skip(1);
-    if (game.options & OPTION_CURSES)
-       setwnd(report_window);
-}
diff --git a/c-version/src/moving.c b/c-version/src/moving.c
deleted file mode 100644 (file)
index 0d41dd1..0000000
+++ /dev/null
@@ -1,1202 +0,0 @@
-#include <unistd.h>
-#include "sstlinux.h"
-#include "sst.h"
-
-static void getcd(bool, int);
-
-void imove(bool novapush)
-/* movement execution for warp, impulse, supernova, and tractor-beam events */
-{
-    double angle, deltax, deltay, bigger, x, y,
-        finald, stopegy, probf;
-    int n, m, kink, kinks;
-    feature iquad;
-    coord w, final;
-    bool trbeam = false;
-
-    w.x = w.y = 0;
-    if (game.inorbit) {
-       prout(_("Helmsman Sulu- \"Leaving standard orbit.\""));
-       game.inorbit = false;
-    }
-
-    angle = ((15.0 - game.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+game.optime >= scheduled(FTBEAM)) {
-       trbeam = true;
-       game.condition = red;
-       game.dist = game.dist*(scheduled(FTBEAM)-game.state.date)/game.optime + 0.1;
-       game.optime = scheduled(FTBEAM) - game.state.date + 1e-5;
-    }
-    /* Move within the quadrant */
-    game.quad[game.sector.x][game.sector.y] = IHDOT;
-    x = game.sector.x;
-    y = game.sector.y;
-    n = 10.0*game.dist*bigger+0.5;
-
-    if (n > 0) {
-       for (m = 1; m <= n; m++) {
-           w.x = (x += deltax) + 0.5;
-           w.y = (y += deltay) + 0.5;
-           if (!VALID_SECTOR(w.x, w.y)) {
-               /* Leaving quadrant -- allow final enemy attack */
-               /* Don't do it if being pushed by Nova */
-               if (game.nenhere != 0 && !novapush) {
-                   newcnd();
-                   for (m = 1; m <= game.nenhere; m++) {
-                       finald = distance(w, game.ks[m]);
-                       game.kavgd[m] = 0.5 * (finald + game.kdist[m]);
-                   }
-                   /*
-                    * Stas Sergeev added the condition
-                    * that attacks only happen if Klingons
-                    * are present and your skill is good.
-                    */
-                   if (game.skill > SKILL_GOOD && game.klhere > 0 && !game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
-                       attack(false);
-                   if (game.alldone)
-                       return;
-               }
-               /* compute final position -- new quadrant and sector */
-               x = QUADSIZE*(game.quadrant.x-1)+game.sector.x;
-               y = QUADSIZE*(game.quadrant.y-1)+game.sector.y;
-               w.x = x+10.0*game.dist*bigger*deltax+0.5;
-               w.y = y+10.0*game.dist*bigger*deltay+0.5;
-               /* check for edge of galaxy */
-               kinks = 0;
-               do {
-                   kink = 0;
-                   if (w.x <= 0) {
-                       w.x = -w.x + 1;
-                       kink = 1;
-                   }
-                   if (w.y <= 0) {
-                       w.y = -w.y + 1;
-                       kink = 1;
-                   }
-                   if (w.x > GALSIZE*QUADSIZE) {
-                       w.x = (GALSIZE*QUADSIZE*2)+1 - w.x;
-                       kink = 1;
-                   }
-                   if (w.y > GALSIZE*QUADSIZE) {
-                       w.y = (GALSIZE*QUADSIZE*2)+1 - w.y;
-                       kink = 1;
-                   }
-                   if (kink)
-                       kinks = 1;
-               } while (kink);
-
-               if (kinks) {
-                   game.nkinks += 1;
-                   if (game.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) /* Don't bother if we are to be beamed */
-                   return;
-               game.quadrant.x = (w.x+(QUADSIZE-1))/QUADSIZE;
-               game.quadrant.y = (w.y+(QUADSIZE-1))/QUADSIZE;
-               game.sector.x = w.x - QUADSIZE*(game.quadrant.x-1);
-               game.sector.y = w.y - QUADSIZE*(game.quadrant.y-1);
-               skip(1);
-               prout(_("Entering %s."), cramlc(quadrant, game.quadrant));
-               game.quad[game.sector.x][game.sector.y] = game.ship;
-               newqad(false);
-               if (game.skill>SKILL_NOVICE)
-                   attack(false);  
-               return;
-           }
-           iquad = game.quad[w.x][w.y];
-           if (iquad != IHDOT) {
-               /* object encountered in flight path */
-               stopegy = 50.0*game.dist/game.optime;
-               game.dist = distance(game.sector, w) / (QUADSIZE * 1.0);
-               switch (iquad) {
-               case IHT: /* Ram a Tholian */
-               case IHK: /* Ram enemy ship */
-               case IHC:
-               case IHS:
-               case IHR:
-               case IHQUEST:
-                   game.sector = w;
-                   ram(false, iquad, game.sector);
-                   final = game.sector;
-                   break;
-               case IHBLANK:
-                   skip(1);
-                   prouts(_("***RED ALERT!  RED ALERT!"));
-                   skip(1);
-                   proutn("***");
-                   crmshp();
-                   proutn(_(" pulled into black hole at "));
-                   prout(cramlc(sector, w));
-                   /*
-                    * 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 (m=0;m<NDEVICES;m++)
-                       if (game.damage[m]>0) 
-                           n++;
-                   probf=pow(1.4,(game.energy+game.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, w));
-                   prout(";");
-                   proutn(_("Emergency stop required "));
-                   prout(_("%2d units of energy."), (int)stopegy);
-                   game.energy -= stopegy;
-                   final.x = x-deltax+0.5;
-                   final.y = y-deltay+0.5;
-                   game.sector = final;
-                   if (game.energy <= 0) {
-                       finish(FNRG);
-                       return;
-                   }
-                   break;
-               }
-               goto no_quad_change;    /* sorry! */
-           }
-       }
-       game.dist = distance(game.sector, w) / (QUADSIZE * 1.0);
-       game.sector = w;
-    }
-    final = game.sector;
-no_quad_change:
-    /* No quadrant change -- compute new avg enemy distances */
-    game.quad[game.sector.x][game.sector.y] = game.ship;
-    if (game.nenhere) {
-       for (m = 1; m <= game.nenhere; m++) {
-           finald = distance(w, game.ks[m]);
-           game.kavgd[m] = 0.5 * (finald+game.kdist[m]);
-           game.kdist[m] = finald;
-       }
-       sortklings();
-       if (!game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
-           attack(false);
-       for (m = 1; m <= game.nenhere; m++)
-           game.kavgd[m] = game.kdist[m];
-    }
-    newcnd();
-    drawmaps(0);
-    setwnd(message_window);
-    return;
-}
-
-void dock(bool verbose) 
-/* dock our ship at a starbase */
-{
-    chew();
-    if (game.condition == docked && verbose) {
-       prout(_("Already docked."));
-       return;
-    }
-    if (game.inorbit) {
-       prout(_("You must first leave standard orbit."));
-       return;
-    }
-    if (!is_valid(game.base) || abs(game.sector.x-game.base.x) > 1 || abs(game.sector.y-game.base.y) > 1) {
-       crmshp();
-       prout(_(" not adjacent to base."));
-       return;
-    }
-    game.condition = docked;
-    if (verbose)
-       prout(_("Docked."));
-    game.ididit = true;
-    if (game.energy < game.inenrg)
-       game.energy = game.inenrg;
-    game.shield = game.inshld;
-    game.torps = game.intorps;
-    game.lsupres = game.inlsr;
-    game.state.crew = FULLCREW;
-    if (!damaged(DRADIO) &&
-       (is_scheduled(FCDBAS) || game.isatb == 1) && !game.iseenit) {
-       /* get attack report from base */
-       prout(_("Lt. Uhura- \"Captain, an important message from the starbase:\""));
-       attackreport(false);
-       game.iseenit = true;
-    }
-}
-
-/* 
- * 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.  Probably
- * "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!
- */
-
-static void getcd(bool isprobe, int akey)
-/* get course and distance */
-{
-    int irowq=game.quadrant.x, icolq=game.quadrant.y, key=0;
-    double xi, xj, xk, xl;
-    double deltax, deltay;
-    enum {unspecified, manual, automatic} navmode = unspecified;
-    enum {curt, normal, verbose} itemp = curt;
-    coord incr;
-    bool iprompt = false;
-
-    // Get course direction and distance. If user types bad values, return
-    // with DIREC = -1.0.
-    game.direc = -1.0;
-       
-    if (game.landed && !isprobe) {
-       prout(_("Dummy! You can't leave standard orbit until you"));
-       proutn(_("are back aboard the ship."));
-       chew();
-       return;
-    }
-    while (navmode == unspecified) {
-       if (damaged(DNAVSYS)) {
-           if (isprobe)
-               prout(_("Computer damaged; manual navigation only"));
-           else
-               prout(_("Computer damaged; manual movement only"));
-           chew();
-           navmode = manual;
-           key = IHEOL;
-           break;
-       }
-       if (isprobe && akey != -1) {
-           /* For probe launch, use pre-scanned value first time */
-           key = akey;
-           akey = -1;
-       }
-       else 
-           key = scan();
-
-       if (key == IHEOL) {
-           proutn(_("Manual or automatic- "));
-           iprompt = true;
-           chew();
-       }
-       else if (key == IHALPHA) {
-           if (isit("manual")) {
-               navmode = manual;
-               key = scan();
-               break;
-           }
-           else if (isit("automatic")) {
-               navmode = automatic;
-               key = scan();
-               break;
-           }
-           else {
-               huh();
-               chew();
-               return;
-           }
-       }
-       else { /* numeric */
-           if (isprobe)
-               prout(_("(Manual navigation assumed.)"));
-           else
-               prout(_("(Manual movement assumed.)"));
-           navmode = manual;
-           break;
-       }
-    }
-
-    if (navmode == automatic) {
-       while (key == IHEOL) {
-           if (isprobe)
-               proutn(_("Target quadrant or quadrant&sector- "));
-           else
-               proutn(_("Destination sector or quadrant&sector- "));
-           chew();
-           iprompt = true;
-           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;
-           incr.y = xk + 0.5;
-           incr.x = xl + 0.5;
-       }
-       else {
-           if (isprobe) {
-               /* only quadrant specified -- go to center of dest quad */
-               irowq = xi + 0.5;
-               icolq = xj + 0.5;
-               incr.y = incr.x = 5;
-           }
-           else {
-               incr.y = xi + 0.5;
-               incr.x = xj + 0.5;
-           }
-           itemp = normal;
-       }
-       if (!VALID_QUADRANT(icolq,irowq)||!VALID_SECTOR(incr.x,incr.y)) {
-           huh();
-           return;
-       }
-       skip(1);
-       if (!isprobe) {
-           if (itemp > curt) {
-               if (iprompt) {
-                   prout(_("Helmsman Sulu- \"Course locked in for %s.\""),
-                         cramlc(sector, incr));
-               }
-           }
-           else
-               prout(_("Ensign Chekov- \"Course laid in, Captain.\""));
-       }
-       deltax = icolq - game.quadrant.y + 0.1*(incr.x-game.sector.y);
-       deltay = game.quadrant.x - irowq + 0.1*(game.sector.x-incr.y);
-    }
-    else { /* manual */
-       while (key == IHEOL) {
-           proutn(_("X and Y displacements- "));
-           chew();
-           iprompt = true;
-           key = scan();
-       }
-       itemp = verbose;
-       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 == verbose && !isprobe) {
-       skip(1);
-       prout(_("Helmsman Sulu- \"Aye, Sir.\""));
-    }
-    game.dist = sqrt(deltax*deltax + deltay*deltay);
-    game.direc = atan2(deltax, deltay)*1.90985932;
-    if (game.direc < 0.0)
-       game.direc += 12.0;
-    chew();
-    return;
-}
-               
-
-
-void impulse(void) 
-/* move under impulse power */
-{
-    double power;
-
-    game.ididit = false;
-    if (damaged(DIMPULS)) {
-       chew();
-       skip(1);
-       prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\""));
-       return;
-    }
-
-    if (game.energy > 30.0) {
-       getcd(false, 0);
-       if (game.direc == -1.0)
-           return;
-       power = 20.0 + 100.0*game.dist;
-    }
-    else
-       power = 30.0;
-
-    if (power >= game.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 (game.energy > 30) {
-           proutn(_("quadrant.  We can go, therefore, a maximum of %d"),
-                  (int)(0.01 * (game.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 */
-    game.optime = game.dist/0.095;
-    if (game.optime >= 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() == false)
-           return;
-    }
-    /* Activate impulse engines and pay the cost */
-    imove(false);
-    game.ididit = true;
-    if (game.alldone)
-       return;
-    power = 20.0 + 100.0*game.dist;
-    game.energy -= power;
-    game.optime = game.dist/0.095;
-    if (game.energy <= 0)
-       finish(FNRG);
-    return;
-}
-
-
-void warp(bool timewarp)
-/* move under warp drive */
-{
-    int iwarp;
-    bool blooey = false, twarp = false;
-    double power;
-
-    if (!timewarp) { /* Not WARPX entry */
-       game.ididit = false;
-       if (game.damage[DWARPEN] > 10.0) {
-           chew();
-           skip(1);
-           prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\""));
-           return;
-       }
-       if (damaged(DWARPEN) && game.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 (game.direc == -1.0)
-           return;
-
-       /* Make sure starship has enough energy for the trip */
-       power = (game.dist+0.05)*game.warpfac*game.warpfac*game.warpfac*(game.shldup+1);
-
-
-       if (power >= game.energy) {
-           /* Insufficient power for trip */
-           game.ididit = false;
-           skip(1);
-           prout(_("Engineering to bridge--"));
-           if (!game.shldup || 0.5*power > game.energy) {
-               iwarp = pow((game.energy/(game.dist+0.05)), 0.333333333);
-               if (iwarp <= 0) {
-                   prout(_("We can't do it, Captain. We don't have enough energy."));
-               }
-               else {
-                   proutn(_("We don't have enough energy, but we could do it at warp %d"), iwarp);
-                   if (game.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 */
-       game.optime = 10.0*game.dist/game.wfacsq;
-       if (game.optime >= 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*game.optime/game.state.remtime);
-           prout(_(" percent of our"));
-           proutn(_("  remaining time.  Are you sure this is wise?\" "));
-           if (ja() == false) {
-               game.ididit = false;
-               game.optime=0; 
-               return;
-           }
-       }
-    }
-    /* Entry WARPX */
-    if (game.warpfac > 6.0) {
-       /* Decide if engine damage will occur */
-       double prob = game.dist*(6.0-game.warpfac)*(6.0-game.warpfac)/66.666666666;
-       if (prob > Rand()) {
-           blooey = true;
-           game.dist = Rand()*game.dist;
-       }
-       /* Decide if time warp will occur */
-       if (0.5*game.dist*pow(7.0,game.warpfac-10.0) > Rand())
-           twarp = true;
-       if (idebug && game.warpfac==10 && !twarp) {
-           blooey = false;
-           proutn("=== Force time warp? ");
-           if (ja() == true)
-               twarp = true;
-       }
-       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-game.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 * game.dist * bigger +0.5;
-           x = game.sector.x;
-           y = game.sector.y;
-           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 = false;
-                   twarp = false;
-               }
-           }
-       }
-    }
-                               
-
-    /* Activate Warp Engines and pay the cost */
-    imove(false);
-    if (game.alldone)
-       return;
-    game.energy -= game.dist*game.warpfac*game.warpfac*game.warpfac*(game.shldup+1);
-    if (game.energy <= 0)
-       finish(FNRG);
-    game.optime = 10.0*game.dist/game.wfacsq;
-    if (twarp)
-       timwrp();
-    if (blooey) {
-       game.damage[DWARPEN] = game.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."));
-    }
-    game.ididit = true;
-    return;
-}
-
-
-
-void setwarp(void) 
-/* change the warp factor */
-{
-    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 (damaged(DWARPEN) && 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 = game.warpfac;
-    game.warpfac = aaitem;
-    game.wfacsq=game.warpfac*game.warpfac;
-    if (game.warpfac <= oldfac || game.warpfac <= 6.0) {
-       prout(_("Helmsman Sulu- \"Warp factor %d, Captain.\""),
-              (int)game.warpfac);
-       return;
-    }
-    if (game.warpfac < 8.00) {
-       prout(_("Engineer Scott- \"Aye, but our maximum safe speed is warp 6.\""));
-       return;
-    }
-    if (game.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(bool igrab) 
-/* cope with being tossed out of quadrant by supernova or yanked by beam */
-{
-    double power, distreq;
-
-    chew();
-    /* is captain on planet? */
-    if (game.landed) {
-       if (damaged(DTRANSP)) {
-           finish(FPNOVA);
-           return;
-       }
-       prout(_("Scotty rushes to the transporter controls."));
-       if (game.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 (game.imine) {
-           game.imine = false;
-           proutn(_("The crystals mined were "));
-           if (Rand() <= 0.25) {
-               prout(_("lost."));
-           }
-           else {
-               prout(_("saved."));
-               game.icrystl = true;
-           }
-       }
-    }
-    if (igrab)
-       return;
-
-    /* Check to see if captain in shuttle craft */
-    if (game.icraft)
-       finish(FSTRACTOR);
-    if (game.alldone)
-       return;
-
-    /* Inform captain of attempt to reach safety */
-    skip(1);
-    do {
-       if (game.justin) {
-           prouts(_("***RED ALERT!  RED 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."));
-       game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
-       /* Try to use warp engines */
-       if (damaged(DWARPEN)) {
-           skip(1);
-           prout(_("Warp engines damaged."));
-           finish(FSNOVAED);
-           return;
-       }
-       game.warpfac = 6.0+2.0*Rand();
-       game.wfacsq = game.warpfac * game.warpfac;
-       prout(_("Warp factor set to %d"), (int)game.warpfac);
-       power = 0.75*game.energy;
-       game.dist = power/(game.warpfac*game.warpfac*game.warpfac*(game.shldup+1));
-       distreq = 1.4142+Rand();
-       if (distreq < game.dist)
-           game.dist = distreq;
-       game.optime = 10.0*game.dist/game.wfacsq;
-       game.direc = 12.0*Rand();       /* How dumb! */
-       game.justin = false;
-       game.inorbit = false;
-       warp(true);
-       if (!game.justin) {
-           /* This is bad news, we didn't leave quadrant. */
-           if (game.alldone)
-               return;
-           skip(1);
-           prout(_("Insufficient energy to leave quadrant."));
-           finish(FSNOVAED);
-           return;
-       }
-    } while 
-       /* Repeat if another snova */
-       (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova);
-    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0) 
-       finish(FWON); /* Snova killed remaining enemy. */
-}
-
-void timwrp() 
-/* let's do the time warp again */
-{
-    int l;
-    bool 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 = false;
-       if (game.state.remcom) {
-           schedule(FTBEAM, expran(game.intime/game.state.remcom));
-           schedule(FBATTAK, expran(0.3*game.intime));
-       }
-       schedule(FSNOVA, expran(0.5*game.intime));
-       /* next snapshot will be sooner */
-       schedule(FSNAP, expran(0.25*game.state.remtime));
-                               
-       if (game.state.nscrem)
-           schedule(FSCMOVE, 0.2777);      
-       game.isatb = 0;
-       unschedule(FCDBAS);
-       unschedule(FSCDBAS);
-       invalidate(game.battle);
-
-       /* Make sure Galileo is consistant -- Snapshot may have been taken
-          when on planet, which would give us two Galileos! */
-       gotit = false;
-       for (l = 0; l < game.inplan; l++) {
-           if (game.state.planets[l].known == shuttle_down) {
-               gotit = true;
-               if (game.iscraft == onship && game.ship==IHE) {
-                   prout(_("Checkov-  \"Security reports the Galileo has disappeared, Sir!"));
-                   game.iscraft = offship;
-               }
-           }
-       }
-       // Likewise, if in the original time the Galileo was abandoned, but
-       // was on ship earlier, it would have vanished -- let's restore it.
-       if (game.iscraft == offship && !gotit && game.damage[DSHUTTL] >= 0.0) {
-           prout(_("Checkov-  \"Security reports the Galileo has reappeared in the dock!\""));
-           game.iscraft = onship;
-       }
-       /* 
-        * 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 */
-       game.optime = -0.5*game.intime*log(Rand());
-       prout(_("You are traveling forward in time %d stardates."), (int)game.optime);
-       /* cheat to make sure no tractor beams occur during time warp */
-       postpone(FTBEAM, game.optime);
-       game.damage[DRADIO] += game.optime;
-    }
-    newqad(false);
-    events();  /* Stas Sergeev added this -- do pending events */
-}
-
-void probe(void) 
-/* launch deep-space probe */
-{
-    double angle, bigger;
-    int key;
-    /* New code to launch a deep space probe */
-    if (game.nprobes == 0) {
-       chew();
-       skip(1);
-       if (game.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 (damaged(DDSP)) {
-       chew();
-       skip(1);
-       prout(_("Engineer Scott- \"The probe launcher is damaged, Sir.\""));
-       return;
-    }
-    if (is_scheduled(FDSPROB)) {
-       chew();
-       skip(1);
-       if (damaged(DRADIO) && game.condition != docked) {
-           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(game.nprobes==1 ? _("%d probe left.") : _("%d probes left."), game.nprobes);
-       proutn(_("Are you sure you want to fire a probe? "));
-       if (ja() == false)
-           return;
-    }
-
-    game.isarmed = false;
-    if (key == IHALPHA && strcmp(citem,"armed") == 0) {
-       game.isarmed = true;
-       key = scan();
-    }
-    else if (key == IHEOL) {
-       proutn(_("Arm NOVAMAX warhead? "));
-       game.isarmed = ja();
-    }
-    getcd(true, key);
-    if (game.direc == -1.0)
-       return;
-    game.nprobes--;
-    angle = ((15.0 - game.direc) * 0.5235988);
-    game.probeinx = -sin(angle);
-    game.probeiny = cos(angle);
-    if (fabs(game.probeinx) > fabs(game.probeiny))
-       bigger = fabs(game.probeinx);
-    else
-       bigger = fabs(game.probeiny);
-               
-    game.probeiny /= bigger;
-    game.probeinx /= bigger;
-    game.proben = 10.0*game.dist*bigger +0.5;
-    game.probex = game.quadrant.x*QUADSIZE + game.sector.x - 1;        // We will use better packing than original
-    game.probey = game.quadrant.y*QUADSIZE + game.sector.y - 1;
-    game.probec = game.quadrant;
-    schedule(FDSPROB, 0.01); // Time to move one sector
-    prout(_("Ensign Chekov-  \"The deep space probe is launched, Captain.\""));
-    game.ididit = true;
-    return;
-}
-
-/*
- *     Here's how the mayday code works:
- *
- *     First, the closest starbase is selected.  If there is a
- *     a starbase in your own quadrant, you are in good shape.
- *     This distance takes quadrant distances into account only.
- *
- *     A magic number is computed based on the distance which acts
- *     as the probability that you will be rematerialized.  You
- *     get three tries.
- *
- *     When it is determined that you should be able to be remater-
- *     ialized (i.e., when the probability thing mentioned above
- *     comes up positive), you are put into that quadrant (anywhere).
- *     Then, we try to see if there is a spot adjacent to the star-
- *     base.  If not, you can't be rematerialized!!!  Otherwise,
- *     it drops you there.  It only tries five times to find a spot
- *     to drop you.  After that, it's your problem.
- */
-
-void mayday(void) 
-/* yell for help from nearest starbase */
-{
-    /* There's more than one way to move in this game! */
-    double ddist, xdist, probf;
-    int line = 0, m, ix, iy;
-
-    chew();
-    /* Test for conditions which prevent calling for help */
-    if (game.condition == docked) {
-       prout(_("Lt. Uhura-  \"But Captain, we're already docked.\""));
-       return;
-    }
-    if (damaged(DRADIO)) {
-       prout(_("Subspace radio damaged."));
-       return;
-    }
-    if (game.state.rembase==0) {
-       prout(_("Lt. Uhura-  \"Captain, I'm not getting any response from Starbase.\""));
-       return;
-    }
-    if (game.landed) {
-       proutn(_("You must be aboard the "));
-       crmshp();
-       prout(".");
-       return;
-    }
-    /* OK -- call for help from nearest starbase */
-    game.nhelp++;
-    if (game.base.x!=0) {
-       /* There's one in this quadrant */
-       ddist = distance(game.base, game.sector);
-    }
-    else {
-       ddist = FOREVER;
-       for (m = 1; m <= game.state.rembase; m++) {
-           xdist = QUADSIZE * distance(game.state.baseq[m], game.quadrant);
-           if (xdist < ddist) {
-               ddist = xdist;
-               line = m;
-           }
-       }
-       /* Since starbase not in quadrant, set up new quadrant */
-       game.quadrant = game.state.baseq[line];
-       newqad(true);
-    }
-    /* dematerialize starship */
-    game.quad[game.sector.x][game.sector.y]=IHDOT;
-    proutn(_("Starbase in %s responds--"), cramlc(quadrant, game.quadrant));
-    crmshp();
-    prout(_(" dematerializes."));
-    game.sector.x=0;
-    for (m = 1; m <= 5; m++) {
-       ix = game.base.x+3.0*Rand()-1;
-       iy = game.base.y+3.0*Rand()-1;
-       if (VALID_SECTOR(ix,iy) && game.quad[ix][iy]==IHDOT) {
-           /* found one -- finish up */
-           game.sector.x=ix;
-           game.sector.y=iy;
-           break;
-       }
-    }
-    if (!is_valid(game.sector)){
-       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 (m = 1; m <= 3; m++) {
-       switch (m) {
-       case 1: proutn(_("1st")); break;
-       case 2: proutn(_("2nd")); break;
-       case 3: proutn(_("3rd")); break;
-       }
-       proutn(_(" attempt to re-materialize "));
-       crmshp();
-       switch (m){
-       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 (m > 3) {
-       game.quad[ix][iy]=IHQUEST;
-       game.alive = false;
-       drawmaps(1);
-       setwnd(message_window);
-       finish(FMATERIALIZE);
-       return;
-    }
-    game.quad[ix][iy]=game.ship;
-    textcolor(GREEN);
-    prout(_("succeeds."));
-    textcolor(DEFAULT);
-    dock(false);
-    skip(1);
-    prout(_("Lt. Uhura-  \"Captain, we made it!\""));
-}
-
-/*
- *  Abandon Ship
- *
- *     The ship is abandoned.  If your current ship is the Faire
- *     Queene, or if your shuttlecraft is dead, you're out of
- *     luck.  You need the shuttlecraft in order for the captain
- *     (that's you!!) to escape.
- *
- *     Your crew can beam to an inhabited starsystem in the
- *     quadrant, if there is one and if the transporter is working.
- *     If there is no inhabited starsystem, or if the transporter
- *     is out, they are left to die in outer space.
- *
- *     If there are no starbases left, you are captured by the
- *     Klingons, who torture you mercilessly.  However, if there
- *     is at least one starbase, you are returned to the
- *     Federation in a prisoner of war exchange.  Of course, this
- *     can't happen unless you have taken some prisoners.
- *
- */
-
-void abandon(void) 
-/* abandon ship */
-{
-    int nb, l;
-    struct quadrant *q;
-
-    chew();
-    if (game.condition==docked) {
-       if (game.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 Macs."));
-           return;
-       }
-       if (game.damage[DSHUTTL]>0) {
-           prout(_("Shuttle craft damaged."));
-           return;
-       }
-       if (game.landed) {
-           prout(_("You must be aboard the ship."));
-           return;
-       }
-       if (game.iscraft != onship) {
-           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."));
-       if (game.state.rembase==0) {
-           /* Oops! no place to go... */
-           finish(FABANDN);
-           return;
-       }
-       q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
-       /* Dispose of crew */
-       if (!(game.options & OPTION_WORLDS) && !damaged(DTRANSP)) {
-           prout(_("Remainder of ship's complement beam down"));
-           prout(_("to nearest habitable planet."));
-       } else if (q->planet != NOPLANET && !damaged(DTRANSP)) {
-           prout(_("Remainder of ship's complement beam down to %s."),
-                   systnames[q->planet]);
-       } else {
-           prout(_("Entire crew of %d left to die in outer space."),
-                   game.state.crew);
-           game.casual += game.state.crew;
-           game.abandoned += game.state.crew;
-       }
-
-       /* If at least one base left, give 'em the Faerie Queene */
-       skip(1);
-       game.icrystl = false; /* crystals are lost */
-       game.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 (!same(game.quadrant, game.state.baseq[nb])) {
-           game.quadrant = game.state.baseq[nb];
-           game.sector.x = game.sector.y = 5;
-           newqad(true);
-       }
-       for (;;) {
-           /* position next to base by trial and error */
-           game.quad[game.sector.x][game.sector.y] = IHDOT;
-           for (l = 1; l <= QUADSIZE; l++) {
-               game.sector.x = 3.0*Rand() - 1.0 + game.base.x;
-               game.sector.y = 3.0*Rand() - 1.0 + game.base.y;
-               if (VALID_SECTOR(game.sector.x, game.sector.y) &&
-                   game.quad[game.sector.x][game.sector.y] == IHDOT) break;
-           }
-           if (l < QUADSIZE+1)
-               break; /* found a spot */
-           game.sector.x=QUADSIZE/2;
-           game.sector.y=QUADSIZE/2;
-           newqad(true);
-       }
-    }
-    /* Get new commission */
-    game.quad[game.sector.x][game.sector.y] = game.ship = IHF;
-    game.state.crew = FULLCREW;
-    prout(_("Starfleet puts you in command of another ship,"));
-    prout(_("the Faerie Queene, which is antiquated but,"));
-    prout(_("still useable."));
-    if (game.icrystl)
-       prout(_("The dilithium crystals have been moved."));
-    game.imine = false;
-    game.iscraft = offship; /* Galileo disappears */
-    /* Resupply ship */
-    game.condition=docked;
-    for (l = 0; l < NDEVICES; l++) 
-       game.damage[l] = 0.0;
-    game.damage[DSHUTTL] = -1;
-    game.energy = game.inenrg = 3000.0;
-    game.shield = game.inshld = 1250.0;
-    game.torps = game.intorps = 6;
-    game.lsupres=game.inlsr=3.0;
-    game.shldup=false;
-    game.warpfac=5.0;
-    game.wfacsq=25.0;
-    return;
-}
diff --git a/c-version/src/planets.c b/c-version/src/planets.c
deleted file mode 100644 (file)
index e8ead07..0000000
+++ /dev/null
@@ -1,542 +0,0 @@
-#include "sst.h"
-
-static char *classes[] = {"M","N","O"};
-
-static bool consumeTime(void)
-/* abort a lengthy operation if an event interrupts it */
-{
-    game.ididit = true;
-    events();
-    if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova || game.justin) 
-       return true;
-    return false;
-}
-
-void survey(void) 
-/* report on (uninhabited) planets in the galaxy */
-{
-    bool iknow = false;
-    int i;
-    skip(1);
-    chew();
-    prout(_("Spock-  \"Planet report follows, Captain.\""));
-    skip(1);
-    for (i = 0; i < game.inplan; i++) {
-       if (game.state.planets[i].pclass == destroyed)
-           continue;
-       if ((game.state.planets[i].known != unknown
-            && game.state.planets[i].inhabited == UNINHABITED)
-           || idebug) {
-           iknow = true;
-           if (idebug && game.state.planets[i].known==unknown)
-               proutn("(Unknown) ");
-           proutn(cramlc(quadrant, game.state.planets[i].w));
-           proutn(_("   class "));
-           proutn(classes[game.state.planets[i].pclass]);
-           proutn("   ");
-           if (game.state.planets[i].crystals != present)
-               proutn(_("no "));
-           prout(_("dilithium crystals present."));
-           if (game.state.planets[i].known==shuttle_down) 
-               prout(_("    Shuttle Craft Galileo on surface."));
-       }
-    }
-    if (!iknow)
-       prout(_("No information available."));
-}
-
-void orbit(void)
-/* enter standard orbit */
-{
-    skip(1);
-    chew();
-    if (game.inorbit) {
-       prout(_("Already in standard orbit."));
-       return;
-    }
-    if (damaged(DWARPEN) && damaged(DIMPULS)) {
-       prout(_("Both warp and impulse engines damaged."));
-       return;
-    }
-    if (!is_valid(game.plnet) || abs(game.sector.x-game.plnet.x) > 1 || abs(game.sector.y-game.plnet.y) > 1) {
-       crmshp();
-       prout(_(" not adjacent to planet."));
-       skip(1);
-       return;
-    }
-    game.optime = 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);
-    game.inorbit = true;
-    game.ididit = true;
-}
-
-void sensor(void)
-/* examine planets in this quadrant */
-{
-    if (damaged(DSRSENS)) {
-       if (game.options & OPTION_TTY)
-           prout(_("Short range sensors damaged."));
-       return;
-    }
-    if (!is_valid(game.plnet)) {
-       if (game.options & OPTION_TTY)
-           prout(_("Spock- \"No planet in this quadrant, Captain.\""));
-       return;
-    }
-    if (game.state.planets[game.iplnet].known == unknown) {
-       prout(_("Spock-  \"Sensor scan for %s-"), cramlc(quadrant, game.quadrant));
-       skip(1);
-       prout(_("         Planet at %s is of class %s."),
-             cramlc(sector,game.plnet),
-             classes[game.state.planets[game.iplnet].pclass]);
-       if (game.state.planets[game.iplnet].known==shuttle_down) 
-           prout(_("         Sensors show Galileo still on surface."));
-       proutn(_("         Readings indicate"));
-       if (game.state.planets[game.iplnet].crystals != present)
-           proutn(_(" no"));
-       prout(_(" dilithium crystals present.\""));
-       if (game.state.planets[game.iplnet].known == unknown)
-           game.state.planets[game.iplnet].known = known;
-    }
-}
-
-void beam(void) 
-/* use the transporter */
-{
-    double nrgneed = 0;
-    chew();
-    skip(1);
-    if (damaged(DTRANSP)) {
-       prout(_("Transporter damaged."));
-       if (!damaged(DSHUTTL) && (game.state.planets[game.iplnet].known==shuttle_down || game.iscraft == onship)) {
-           skip(1);
-           proutn(_("Spock-  \"May I suggest the shuttle craft, Sir?\" "));
-           if (ja() == true)
-               shuttle();
-       }
-       return;
-    }
-    if (!game.inorbit) {
-       crmshp();
-       prout(_(" not in standard orbit."));
-       return;
-    }
-    if (game.shldup) {
-       prout(_("Impossible to transport through shields."));
-       return;
-    }
-    if (game.state.planets[game.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 (!game.landed && game.state.planets[game.iplnet].crystals==absent) {
-       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() == false) {
-           chew();
-           return;
-       }
-    }
-    if (!(game.options & OPTION_PLAIN)) {
-       nrgneed = 50 * game.skill + game.height / 100.0;
-       if (nrgneed > game.energy) {
-           prout(_("Engineering to bridge--"));
-           prout(_("  Captain, we don't have enough energy for transportation."));
-           return;
-       }
-       if (!game.landed && nrgneed * 2 > game.energy) {
-           prout(_("Engineering to bridge--"));
-           prout(_("  Captain, we have enough energy only to transport you down to"));
-           prout(_("  the planet, but there wouldn't be an energy for the trip back."));
-           if (game.state.planets[game.iplnet].known == shuttle_down)
-               prout(_("  Although the Galileo shuttle craft may still be on a surface."));
-           proutn(_("  Are you sure this is wise?\" "));
-           if (ja() == false) {
-               chew();
-               return;
-           }
-       }
-    }
-    if (game.landed) {
-       /* Coming from planet */
-       if (game.state.planets[game.iplnet].known==shuttle_down) {
-           proutn(_("Spock-  \"Wouldn't you rather take the Galileo?\" "));
-           if (ja() == true) {
-               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 */
-       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.\""));
-    }
-    game.ididit = true;
-    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");
-    game.landed = !game.landed;
-    game.energy -= nrgneed;
-    skip(2);
-    prout(_("Transport complete."));
-    if (game.landed && game.state.planets[game.iplnet].known==shuttle_down) {
-       prout(_("The shuttle craft Galileo is here!"));
-    }
-    if (!game.landed && game.imine) {
-       game.icrystl = true;
-       game.cryprob = 0.05;
-    }
-    game.imine = false;
-    return;
-}
-
-void mine(void) 
-/* strip-mine a world for dilithium */
-{
-    skip(1);
-    chew();
-    if (!game.landed) {
-       prout(_("Mining party not on planet."));
-       return;
-    }
-    if (game.state.planets[game.iplnet].crystals == mined) {
-       prout(_("This planet has already been strip-mined for dilithium."));
-       return;
-    }
-    else if (game.state.planets[game.iplnet].crystals == absent) {
-       prout(_("No dilithium crystals on this planet."));
-       return;
-    }
-    if (game.imine) {
-       prout(_("You've already mined enough crystals for this trip."));
-       return;
-    }
-    if (game.icrystl && game.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;
-    }
-    game.optime = (0.1+0.2*Rand())*game.state.planets[game.iplnet].pclass;
-    if (consumeTime())
-       return;
-    prout(_("Mining operation complete."));
-    game.state.planets[game.iplnet].crystals = mined;
-    game.imine = game.ididit = true;
-}
-
-void usecrystals(void)
-/* use dilithium crystals */
-{
-    game.ididit = false;
-    skip(1);
-    chew();
-    if (!game.icrystl) {
-       prout(_("No dilithium crystals available."));
-       return;
-    }
-    if (game.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() == false) {
-       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() <= game.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;
-    }
-    game.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!\""));
-    game.cryprob *= 2.0;
-    game.ididit = true;
-}
-
-void shuttle(void) 
-/* use shuttlecraft for planetary jaunt */
-{
-    chew();
-    skip(1);
-    if(damaged(DSHUTTL)) {
-       if (game.damage[DSHUTTL] == -1.0) {
-           if (game.inorbit && game.state.planets[game.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 /* game.damage[DSHUTTL] < 0 */ 
-           prout(_("Shuttle craft is now serving Big Macs."));
-       return;
-    }
-    if (!game.inorbit) {
-       crmshp();
-       prout(_(" not in standard orbit."));
-       return;
-    }
-    if ((game.state.planets[game.iplnet].known != shuttle_down) && game.iscraft != onship) {
-       prout(_("Shuttle craft not currently available."));
-       return;
-    }
-    if (!game.landed && game.state.planets[game.iplnet].known==shuttle_down) {
-       prout(_("You will have to beam down to retrieve the shuttle craft."));
-       return;
-    }
-    if (game.shldup || game.condition == docked) {
-       prout(_("Shuttle craft cannot pass through shields."));
-       return;
-    }
-    if (game.state.planets[game.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;
-    }
-    game.optime = 3.0e-5*game.height;
-    if (game.optime >= 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*game.optime/game.state.remtime));
-       prout(_("remaining time."));
-       proutn(_("Are you sure this is wise?\" "));
-       if (ja() == false) {
-           game.optime = 0.0;
-           return;
-       }
-    }
-    if (game.landed) {
-       /* Kirk on planet */
-       if (game.iscraft == onship) {
-           /* Galileo on ship! */
-           if (!damaged(DTRANSP)) {
-               proutn(_("Spock-  \"Would you rather use the transporter?\" "));
-               if (ja() == true) {
-                   beam();
-                   return;
-               }
-               proutn(_("Shuttle crew"));
-           }
-           else
-               proutn(_("Rescue party"));
-           prout(_(" boards Galileo and swoops toward planet surface."));
-           game.iscraft = offship;
-           skip(1);
-           if (consumeTime())
-               return;
-           game.state.planets[game.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);
-           prouts(_("The short hop begins . . ."));
-           skip(1);
-           game.state.planets[game.iplnet].known=known;
-           game.icraft = true;
-           skip(1);
-           game.landed = false;
-           if (consumeTime())
-               return;
-           game.iscraft = onship;
-           game.icraft = false;
-           if (game.imine) {
-               game.icrystl = true;
-               game.cryprob = 0.05;
-           }
-           game.imine = false;
-           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);
-       game.icraft = true;
-       game.iscraft = offship;
-       if (consumeTime())
-           return;
-       game.state.planets[game.iplnet].known = shuttle_down;
-       game.landed = true;
-       game.icraft = false;
-       prout(_("Trip complete."));
-       return;
-    }
-}
-
-void deathray(void)
-/* use the big zapper */
-{
-    double dprob, r = Rand();
-       
-    game.ididit = false;
-    skip(1);
-    chew();
-    if (game.ship != IHE) {
-       prout(_("Ye Faerie Queene has no death ray."));
-       return;
-    }
-    if (game.nenhere==0) {
-       prout(_("Sulu-  \"But Sir, there are no enemies in this quadrant.\""));
-       return;
-    }
-    if (damaged(DDRAY)) {
-       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() == false)
-       return;
-    prout(_("Spock-  \"Acknowledged.\""));
-    skip(1);
-    game.ididit = true;
-    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 (game.nenhere > 0)
-           deadkl(game.ks[1], game.quad[game.ks[1].x][game.ks[1].y],game.ks[1]);
-       prout(_("Ensign Chekov-  \"Congratulations, Captain!\""));
-       if ((game.state.remkl + game.state.remcom + game.state.nscrem) == 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 (i = 1; i <= QUADSIZE; i++)
-           for (j = 1; j <= QUADSIZE; 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/c-version/src/reports.c b/c-version/src/reports.c
deleted file mode 100644 (file)
index fb8916a..0000000
+++ /dev/null
@@ -1,676 +0,0 @@
-#include "sst.h"
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-
-void attackreport(bool curt)
-/* report status of bases under attack */
-{
-    if (!curt) {
-       if (is_scheduled(FCDBAS)) {
-           prout(_("Starbase in %s is currently under Commander attack."),
-                 cramlc(quadrant, game.battle));
-           prout(_("It can hold out until Stardate %d."),
-                 (int)scheduled(FCDBAS));
-       }
-       else if (game.isatb == 1) {
-           prout(_("Starbase in %s is under Super-commander attack."),
-                 cramlc(quadrant, game.state.kscmdr));
-           prout(_("It can hold out until Stardate %d."),
-                 (int)scheduled(FSCDBAS));
-       } else {
-           prout(_("No Starbase is currently under attack."));
-       }
-    } else {
-        if (is_scheduled(FCDBAS))
-           proutn(_("Base in %i - %i attacked by C. Alive until %.1f"), game.battle.x, game.battle.y, scheduled(FCDBAS));
-        if (game.isatb)
-           proutn(_("Base in %i - %i attacked by S. Alive until %.1f"), game.state.kscmdr.x, game.state.kscmdr.y, scheduled(FSCDBAS));
-       clreol();
-    }
-}
-       
-
-void report(void)
-/* report on general game status */
-{
-    char *s1,*s2,*s3;
-
-    chew();
-    s1 = (game.thawed?_("thawed "):"");
-    switch (game.length) {
-    case 1: s2=_("short"); break;
-    case 2: s2=_("medium"); break;
-    case 4: s2=_("long"); break;
-    default: s2=_("unknown length"); break;
-    }
-    switch (game.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;
-    }
-    skip(1);
-    prout(_("You %s a %s%s %s game."),
-         game.alldone? _("were playing") : _("are playing"), s1, s2, s3);
-    if (game.skill>SKILL_GOOD && game.thawed && !game.alldone)
-       prout(_("No plaque is allowed."));
-    if (game.tourn)
-       prout(_("This is tournament game %d."), game.tourn);
-    prout(_("Your secret password is \"%s\""),game.passwd);
-    proutn(_("%d of %d Klingons have been killed"), 
-          ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem)), 
-          (game.inkling + game.incom + game.inscom));
-    if (game.incom - game.state.remcom)
-       prout(_(", including %d Commander%s."), game.incom - game.state.remcom, (game.incom - game.state.remcom)==1?"":_("s"));
-    else if (game.inkling - game.state.remkl + (game.inscom - game.state.nscrem) > 0)
-       prout(_(", but no Commanders."));
-    else
-       prout(".");
-    if (game.skill > SKILL_FAIR)
-       prout(_("The Super Commander has %sbeen destroyed."),
-             game.state.nscrem?_("not "):"");
-    if (game.state.rembase != game.inbase) {
-       proutn(_("There "));
-       if (game.inbase-game.state.rembase==1)
-           proutn(_("has been 1 base"));
-       else {
-           proutn(_("have been %d bases"), game.inbase-game.state.rembase);
-       }
-       prout(_(" destroyed, %d remaining."), game.state.rembase);
-    }
-    else
-       prout(_("There are %d bases."), game.inbase);
-    if (!damaged(DRADIO) || game.condition == docked || game.iseenit) {
-       // Don't report this if not seen and
-       // either the radio is dead or not at base!
-       attackreport(false);
-       game.iseenit = true;
-    }
-    if (game.casual) 
-       prout(_("%d casualt%s suffered so far."),
-             game.casual, game.casual==1? "y" : "ies");
-    if (game.nhelp)
-       prout(_("There were %d call%s for help."),
-             game.nhelp, game.nhelp==1 ? "" : _("s"));
-    if (game.ship == IHE) {
-       proutn(_("You have "));
-       if (game.nprobes)
-           proutn("%d", game.nprobes);
-       else
-           proutn(_("no"));
-       proutn(_(" deep space probe"));
-       if (game.nprobes!=1)
-           proutn(_("s"));
-       prout(".");
-    }
-    if ((!damaged(DRADIO) || game.condition == docked)
-               && is_scheduled(FDSPROB)) {
-       if (game.isarmed) 
-           proutn(_("An armed deep space probe is in "));
-       else
-           proutn(_("A deep space probe is in "));
-       proutn(cramlc(quadrant, game.probec));
-       prout(".");
-    }
-    if (game.icrystl) {
-       if (game.cryprob <= .05)
-           prout(_("Dilithium crystals aboard ship... not yet used."));
-       else {
-           int i=0;
-           double ai = 0.05;
-           while (game.cryprob > ai) {
-               ai *= 2.0;
-               i++;
-           }
-           prout(_("Dilithium crystals have been used %d time%s."),
-                 i, i==1? "" : _("s"));
-       }
-    }
-    skip(1);
-}
-       
-void lrscan(void) 
-/* long-range sensor scan */
-{
-    int x, y;
-    if (damaged(DLRSENS)) {
-       /* Now allow base's sensors if docked */
-       if (game.condition != docked) {
-           prout(_("LONG-RANGE SENSORS DAMAGED."));
-           return;
-       }
-       prout(_("Starbase's long-range scan"));
-    }
-    else {
-       prout(_("Long-range scan"));
-    }
-    for (x = game.quadrant.x-1; x <= game.quadrant.x+1; x++) {
-       proutn(" ");
-       for (y = game.quadrant.y-1; y <= game.quadrant.y+1; y++) {
-           if (!VALID_QUADRANT(x, y))
-               proutn("  -1");
-           else {
-               game.state.galaxy[x][y].charted = true;
-               rechart();
-               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 damagereport(void) 
-/* damage report */
-{
-    bool jdam = false;
-    int i;
-    chew();
-
-    for (i = 0; i < NDEVICES; i++) {
-       if (damaged(i)) {
-           if (!jdam) {
-               prout(_("\tDEVICE\t\t\t-REPAIR TIMES-"));
-               prout(_("\t\t\tIN FLIGHT\t\tDOCKED"));
-               jdam = true;
-           }
-           prout("  %-26s\t%8.2f\t\t%8.2f", 
-                 device[i],
-                 game.damage[i]+0.05,
-                 game.docfac*game.damage[i]+0.005);
-       }
-    }
-    if (!jdam)
-       prout(_("All devices functional."));
-}
-
-static void rechart_quad(int x, int y)
-{
-    if (game.state.galaxy[x][y].charted) {
-       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;
-    }
-}
-
-static void rechart_dsradio(void)
-/* update the chart in the Enterprise's computer from galaxy data */
-{
-    int i, j;
-    game.lastchart = game.state.date;
-    for (i = 1; i <= GALSIZE; i++)
-       for (j = 1; j <= GALSIZE; j++)
-           rechart_quad(i, j);
-}
-
-static void rechart_lr(void)
-/* update the chart in the Enterprise's computer from galaxy data */
-{
-    int i, j;
-    for (i = game.quadrant.x-1; i <= game.quadrant.x+1; i++) {
-       for (j = game.quadrant.y-1; j <= game.quadrant.y+1; j++) {
-           if (i == game.quadrant.x && j == game.quadrant.y)
-               continue;
-           rechart_quad(i, j);
-       }
-    }
-}
-
-static void rechart_sr(void)
-/* update the chart in the Enterprise's computer from galaxy data */
-{
-    rechart_quad(game.quadrant.x, game.quadrant.y);
-}
-
-void rechart(void)
-{
-    if (!damaged(DRADIO) || game.condition == docked) {
-       if (game.lastchart < game.state.date && game.condition == docked)
-           prout(_("Spock-  \"I revised the Star Chart from the "
-                   "starbase's records.\""));
-       rechart_dsradio();
-    } else {
-       if (!damaged(DLRSENS))
-           rechart_lr();
-       if (!damaged(DSRSENS))
-           rechart_sr();
-    }
-}
-
-void chart(void)
-/* display the star chart */ 
-{
-    int i,j;
-    chew();
-
-    rechart();
-
-    prout(_("       STAR CHART FOR THE KNOWN GALAXY"));
-    if (game.state.date > game.lastchart)
-       prout(_("(Last surveillance update %d stardates ago)."),
-             (int)(game.state.date-game.lastchart));
-    prout("      1    2    3    4    5    6    7    8");
-    for (i = 1; i <= GALSIZE; i++) {
-       proutn("%d |", i);
-       for (j = 1; j <= GALSIZE; j++) {
-           char buf[4];
-           if ((game.options & OPTION_SHOWME) && i == game.quadrant.x && j == game.quadrant.y)
-               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 == game.quadrant.x && j == game.quadrant.y)
-               proutn(">");
-           else
-               proutn(" ");
-       }
-       proutn("  |");
-       if (i<GALSIZE)
-           skip(1);
-    }
-}
-
-static void sectscan(int goodScan, int i, int j) 
-/* light up an individual dot in a sector */
-{
-    if (goodScan || (abs(i-game.sector.x)<= 1 && abs(j-game.sector.y) <= 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 (game.condition) {
-           case red: textcolor(RED); break;
-           case green: textcolor(GREEN); break;
-           case yellow: textcolor(YELLOW); break;
-           case docked: textcolor(CYAN); break;
-           case dead: textcolor(BROWN);
-           }
-           if (game.quad[i][j] != game.ship) 
-               highvideo();
-       }
-       proutn("%c ",game.quad[i][j]);
-       textcolor(DEFAULT);
-    }
-    else
-       proutn("- ");
-}
-
-void status(int req)
-/* print status report lines */
-{
-#define RQ(n, a) if (!req || req == n) do { a } while(0)
-    char *cp = NULL, s[256];
-    int t, dam = 0;
-
-    RQ(1,
-       prstat(_("Stardate"), _("%.1f, Time Left %.2f"), game.state.date, game.state.remtime);
-    );
-
-    RQ(2,
-       if (game.condition != docked)
-           newcnd();
-       switch (game.condition) {
-           case red: cp = _("RED"); break;
-           case green: cp = _("GREEN"); break;
-           case yellow: cp = _("YELLOW"); break;
-           case docked: cp = _("DOCKED"); break;
-           case dead: cp = _("DEAD"); break;
-       }
-       for (t=0;t<NDEVICES;t++)
-           if (game.damage[t]>0) 
-               dam++;
-       prstat(_("Condition"), _("%s, %i DAMAGES"), cp, dam);
-    );
-
-    RQ(3,
-       prstat(_("Position"), "%d - %d , %d - %d",
-             game.quadrant.x, game.quadrant.y, game.sector.x, game.sector.y);
-    );
-
-    RQ(4,
-       if (damaged(DLIFSUP)) {
-           if (game.condition == docked)
-               sprintf(s, _("DAMAGED, Base provides"));
-           else
-               sprintf(s, _("DAMAGED, reserves=%4.2f"), game.lsupres);
-       }
-       else
-           sprintf(s, _("ACTIVE"));
-       prstat(_("Life Support"), s);
-    );
-
-    RQ(5,
-       prstat(_("Warp Factor"), "%.1f", game.warpfac);
-    );
-
-    RQ(6,
-       prstat(_("Energy"), "%.2f%s", game.energy,
-               (game.icrystl && (game.options & OPTION_SHOWME)) ? /* ESR */
-               _(" (have crystals)") : "");
-    );
-
-    RQ(7,
-       prstat(_("Torpedoes"), "%d", game.torps);
-    );
-
-    RQ(8,
-       if (damaged(DSHIELD))
-           strcpy(s, _("DAMAGED,"));
-       else if (game.shldup)
-           strcpy(s, _("UP,"));
-       else
-           strcpy(s, _("DOWN,"));
-       sprintf(s + strlen(s), _(" %d%% %.1f units"),
-              (int)((100.0*game.shield)/game.inshld + 0.5), game.shield);
-       prstat(_("Shields"), s);
-    );
-
-    RQ(9,
-        prstat(_("Klingons Left"), "%d", game.state.remkl + game.state.remcom + game.state.nscrem);
-    );
-
-    RQ(10,
-       if (game.options & OPTION_WORLDS) {
-           int plnet = game.state.galaxy[game.quadrant.x][game.quadrant.y].planet;
-           if (plnet != NOPLANET && game.state.planets[plnet].inhabited != UNINHABITED)
-               prstat(_("Major system"), "%s", systnames[plnet]);
-           else
-               prout(_("Sector is uninhabited"));
-       }
-    );
-
-    RQ(11,
-       attackreport(!req);
-    );
-
-#undef RQ
-}
-
-void request(void)
-{
-    int req;
-    static char requests[][3] =
-       {"da","co","po","ls","wa","en","to","sh","kl","sy", "ti"};
-
-    while (scan() == IHEOL)
-       proutn(_("Information desired? "));
-    chew();
-    for (req = 0; req < ARRAY_SIZE(requests); req++)
-       if (strncmp(citem, requests[req], min(2,strlen(citem)))==0)
-           break;
-    if (req >= ARRAY_SIZE(requests)) {
-       prout(_("UNRECOGNIZED REQUEST. Legal requests are:"));
-       prout(("  date, condition, position, lsupport, warpfactor,"));
-       prout(("  energy, torpedoes, shields, klingons, system, time."));
-       return;
-    }
-    status(req + 1);
-}
-               
-void srscan(void)
-/* short-range scan */
-{
-    int i, j;
-    int goodScan=true;
-    if (damaged(DSRSENS)) {
-       /* Allow base's sensors if docked */
-       if (game.condition != docked) {
-           prout(_("   S.R. SENSORS DAMAGED!"));
-           goodScan=false;
-       }
-       else
-           prout(_("  [Using Base's sensors]"));
-    }
-    else
-       prout(_("     Short-range scan"));
-    if (goodScan) {
-       game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
-       rechart();
-    }
-    prout("    1 2 3 4 5 6 7 8 9 10");
-    if (game.condition != docked)
-       newcnd();
-    for (i = 1; i <= QUADSIZE; i++) {
-       proutn("%2d  ", i);
-       for (j = 1; j <= QUADSIZE; j++) {
-           sectscan(goodScan, i, j);
-       }
-       skip(1);
-    }
-}
-                       
-                       
-void eta(void)
-/* use computer to get estimated time of arrival for a warp jump */
-{
-    coord w1, w2;
-    bool wfl, prompt = false;
-    double ttime, twarp, tpower;
-    if (damaged(DCOMPTR)) {
-       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;
-       }
-    }
-    w1.y = aaitem +0.5;
-    if (scan() != IHREAL) {
-       huh();
-       return;
-    }
-    w1.x = aaitem + 0.5;
-    if (scan() == IHREAL) {
-       w2.y = aaitem + 0.5;
-       if (scan() != IHREAL) {
-           huh();
-           return;
-       }
-       w2.x = aaitem + 0.5;
-    }
-    else {
-       if (game.quadrant.y>w1.x)
-           w2.x = 1;
-       else
-           w2.x=QUADSIZE;
-       if (game.quadrant.x>w1.y)
-           w2.y = 1;
-       else
-           w2.y=QUADSIZE;
-    }
-
-    if (!VALID_QUADRANT(w1.x, w1.y) || !VALID_SECTOR(w2.x, w2.y)) {
-       huh();
-       return;
-    }
-    game.dist = sqrt(square(w1.y-game.quadrant.y+0.1*(w2.y-game.sector.y))+
-               square(w1.x-game.quadrant.x+0.1*(w2.x-game.sector.x)));
-    wfl = false;
-
-    if (prompt)
-       prout(_("Answer \"no\" if you don't know the value:"));
-    for (;;) {
-       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*game.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."));
-    }
-    for (;;) {
-       chew();
-       ttime = (10.0*game.dist)/square(twarp);
-       tpower = game.dist*twarp*twarp*twarp*(game.shldup+1);
-       if (tpower >= game.energy) {
-           prout(_("Insufficient energy, sir."));
-           if (!game.shldup || tpower > game.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."), game.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 ((game.isatb==1 && same(game.state.kscmdr, w1) &&
-            scheduled(FSCDBAS)< ttime+game.state.date)||
-           (scheduled(FCDBAS)<ttime+game.state.date && same(game.battle, w1)))
-           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;
-       }
-    }
-                       
-}
-
-#ifdef BSD_BUG_FOR_BUG
-/*
- *     A visual scan is made in a particular direction of three sectors
- *     in the general direction specified.  This takes time, and
- *     Klingons can attack you, so it should be done only when sensors
- *     are out.  Code swiped from BSD-Trek.  Not presently used, as we
- *     automatically display all adjacent sectors on the short-range
- *     scan even when short-range sensors are out.
- */
-
-/* This struct[] has the delta x, delta y for particular directions */
-coord visdelta[] =
-{
-    {-1,-1},
-    {-1, 0},
-    {-1, 1},
-    {0,         1},
-    {1,         1},
-    {1,         0},
-    {1,        -1},
-    {0,        -1},
-    {-1,-1},
-    {-1, 0},
-    {-1, 1},
-};
-
-void visual(void)
-{
-    int                co, ix, iy;
-    coord      *v;
-
-    if (scan() != IHREAL) {
-       chew();
-       proutn(_("Direction? "));
-       if (scan()!=IHREAL) {
-           huh();
-           return;
-       }
-    }
-    if (aaitem < 0.0 || aaitem > 360.0)
-       return;
-    co = (aaitem + 22) / 45;
-    v = &visdelta[co];
-    ix = game.sector.x + v->x;
-    iy = game.sector.y + v->y;
-    if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE)
-       co = '?';
-    else
-       co = game.quad[ix][iy];
-    printf("%d,%d %c ", ix, iy, co);
-    v++;
-    ix = game.sector.x + v->x;
-    iy = game.sector.y + v->y;
-    if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE)
-       co = '?';
-    else
-       co = game.quad[ix][iy];
-    printf("%c ", co);
-    v++;
-    ix = game.sector.x + v->x;
-    iy = game.sector.y + v->y;
-    if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE)
-       co = '?';
-    else
-       co = game.quad[ix][iy];
-    printf("%c %d,%d\n", co, ix, iy);
-    game.optime = 0.5;
-    game.ididit = true;
-}
-#endif
diff --git a/c-version/src/setup.c b/c-version/src/setup.c
deleted file mode 100644 (file)
index e6bba3f..0000000
+++ /dev/null
@@ -1,809 +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)
-/* issue a historically correct banner */
-{
-    skip(2);
-    prout(_("-SUPER- STAR TREK"));
-    skip(1);
-#ifdef __HISTORICAL__
-    prout(_("Latest update-21 Sept 78"));
-    skip(1);
-#endif /* __HISTORICAL__ */
-}
-
-void freeze(bool boss)
-/* save game */
-{
-    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);
-}
-
-
-bool thaw(void) 
-/* retrieve saved game */
-{
-    FILE *fp;
-    int key;
-
-    game.passwd[0] = '\0';
-    if ((key = scan()) == IHEOL) {
-       proutn(_("File name: "));
-       key = scan();
-    }
-    if (key != IHALPHA) {
-       huh();
-       return true;
-    }
-    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)) {
-       proutn(_("Game file format is bad, should begin with "));
-       prout(SSTMAGIC);
-       skip(1);
-       fclose(fp);
-       return 1;
-    }
-
-    fclose(fp);
-
-    return false;
-}
-
-#define SYSTEM_NAMES \
-    { \
-       /* \
-        * I used <http://www.memory-alpha.org> to find planets \
-        * with references in ST:TOS.  Eath and the Alpha Centauri \
-        * Colony have been omitted. \
-        * \
-        * Some planets marked Class G and P here will be displayed as class M \
-        * because of the way planets are generated. This is a known bug. \
-        */ \
-       /* Federation Worlds */ \
-       _("Andoria (Fesoan)"),  /* several episodes */ \
-       _("Tellar Prime (Miracht)"),    /* TOS: "Journey to Babel" */ \
-       _("Vulcan (T'Khasi)"),  /* many episodes */ \
-       _("Medusa"),            /* TOS: "Is There in Truth No Beauty?" */ \
-       _("Argelius II (Nelphia)"),/* TOS: "Wolf in the Fold" ("IV" in BSD) */ \
-       _("Ardana"),            /* TOS: "The Cloud Minders" */ \
-       _("Catulla (Cendo-Prae)"),      /* TOS: "The Way to Eden" */ \
-       _("Gideon"),            /* TOS: "The Mark of Gideon" */ \
-       _("Aldebaran III"),     /* TOS: "The Deadly Years" */ \
-       _("Alpha Majoris I"),   /* TOS: "Wolf in the Fold" */ \
-       _("Altair IV"),         /* TOS: "Amok Time */ \
-       _("Ariannus"),          /* TOS: "Let That Be Your Last Battlefield" */ \
-       _("Benecia"),           /* TOS: "The Conscience of the King" */ \
-       _("Beta Niobe I (Sarpeidon)"),  /* TOS: "All Our Yesterdays" */ \
-       _("Alpha Carinae II"),  /* TOS: "The Ultimate Computer" */ \
-       _("Capella IV (Kohath)"),       /* TOS: "Friday's Child" (Class G) */ \
-       _("Daran V"),           /* TOS: "For the World is Hollow and I Have Touched the Sky" */ \
-       _("Deneb II"),          /* TOS: "Wolf in the Fold" ("IV" in BSD) */ \
-       _("Eminiar VII"),               /* TOS: "A Taste of Armageddon" */ \
-       _("Gamma Canaris IV"),  /* TOS: "Metamorphosis" */ \
-       _("Gamma Tranguli VI (Vaalel)"),        /* TOS: "The Apple" */ \
-       _("Ingraham B"),                /* TOS: "Operation: Annihilate" */ \
-       _("Janus IV"),          /* TOS: "The Devil in the Dark" */ \
-       _("Makus III"),         /* TOS: "The Galileo Seven" */ \
-       _("Marcos XII"),                /* TOS: "And the Children Shall Lead", */ \
-       _("Omega IV"),          /* TOS: "The Omega Glory" */ \
-       _("Regulus V"),         /* TOS: "Amok Time */ \
-       _("Deneva"),            /* TOS: "Operation -- Annihilate!" */ \
-       /* Worlds from BSD Trek */ \
-       _("Rigel II"),          /* TOS: "Shore Leave" ("III" in BSD) */ \
-       _("Beta III"),          /* TOS: "The Return of the Archons" */ \
-       _("Triacus"),           /* TOS: "And the Children Shall Lead", */ \
-       _("Exo III"),           /* TOS: "What Are Little Girls Made Of?" (Class P) */ \
-    }
-#if 0  /* Others */
-       _("Hansen's Planet"),   /* TOS: "The Galileo Seven" */
-       _("Taurus IV"),         /* TOS: "The Galileo Seven" (class G) */
-       _("Antos IV (Doraphane)"),      /* TOS: "Whom Gods Destroy", "Who Mourns for Adonais?" */
-       _("Izar"),                      /* TOS: "Whom Gods Destroy" */
-       _("Tiburon"),           /* TOS: "The Way to Eden" */
-       _("Merak II"),          /* TOS: "The Cloud Minders" */
-       _("Coridan (Desotriana)"),      /* TOS: "Journey to Babel" */
-       _("Iotia"),             /* TOS: "A Piece of the Action" */
-#endif
-
-#define DEVICE_NAMES \
-    { \
-       _("S. R. Sensors"), \
-       _("L. R. Sensors"), \
-       _("Phasers"), \
-       _("Photon Tubes"), \
-       _("Life Support"), \
-       _("Warp Engines"), \
-       _("Impulse Engines"), \
-       _("Shields"), \
-       _("Subspace Radio"), \
-       _("Shuttle Craft"), \
-       _("Computer"), \
-       _("Navigation System"), \
-       _("Transporter"), \
-       _("Shield Control"), \
-       _("Death Ray"), \
-       _("D. S. Probe") \
-    }
-
-static void setup_names(void)
-/* Sets up some arrays with localized names.
- * Must be done after iostart() for localization to work. */
-{
-    char *tmp1[ARRAY_SIZE(systnames)] = SYSTEM_NAMES;
-    char *tmp2[ARRAY_SIZE(device)] = DEVICE_NAMES;
-
-    memcpy(systnames, tmp1, sizeof(systnames));
-    memcpy(device, tmp2, sizeof(device));
-}
-       
-void setup(bool needprompt) 
-/* prepare to play, set up cosmos */
-{
-    int i,j, krem, klumper;
-    coord w;
-
-    /* call the setup hooks here */
-    setup_names();
-
-    //  Decide how many of everything
-    if (choose(needprompt))
-       return; // frozen game
-    // Prepare the Enterprise
-    game.alldone = game.gamewon = false;
-    game.ship = IHE;
-    game.state.crew = FULLCREW;
-    game.energy = game.inenrg = 5000.0;
-    game.shield = game.inshld = 2500.0;
-    game.shldchg = false;
-    game.shldup = false;
-    game.inlsr = 4.0;
-    game.lsupres = 4.0;
-    game.quadrant = randplace(GALSIZE);
-    game.sector = randplace(QUADSIZE);
-    game.torps = game.intorps = 10;
-    game.nprobes = (int)(3.0*Rand() + 2.0);    /* Give them 2-4 of these wonders */
-    game.warpfac = 5.0;
-    game.wfacsq = game.warpfac * game.warpfac;
-    for (i=0; i < NDEVICES; i++) 
-       game.damage[i] = 0.0;
-    // Set up assorted game parameters
-    invalidate(game.battle);
-    game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0);
-    game.nkinks = game.nhelp = game.casual = game.abandoned = 0;
-    game.iscate = game.resting = game.imine = game.icrystl = game.icraft = false;
-    game.isatb = game.state.nplankl = 0;
-    game.state.starkl = game.state.basekl = 0;
-    game.iscraft = onship;
-    game.landed = false;
-    game.alive = true;
-    game.docfac = 0.25;
-    for (i = 1; i <= GALSIZE; i++)
-       for (j = 1; j <= GALSIZE; j++) {
-           struct quadrant *quad = &game.state.galaxy[i][j];
-           quad->charted = 0;
-           quad->planet = NOPLANET;
-           quad->romulans = 0;
-           quad->klingons = 0;
-           quad->starbase = false;
-           quad->supernova = false;
-           quad->status = secure;
-       }
-    // Initialize times for extraneous events
-    schedule(FSNOVA, expran(0.5 * game.intime));
-    schedule(FTBEAM, expran(1.5 * (game.intime / game.state.remcom)));
-    schedule(FSNAP, 1.0 + Rand()); // Force an early snapshot
-    schedule(FBATTAK, expran(0.3*game.intime));
-    unschedule(FCDBAS);
-    if (game.state.nscrem)
-       schedule(FSCMOVE, 0.2777);
-    else
-       unschedule(FSCMOVE);
-    unschedule(FSCDBAS);
-    unschedule(FDSPROB);
-    if ((game.options & OPTION_WORLDS) && game.skill >= SKILL_GOOD)
-       schedule(FDISTR, expran(1.0 + game.intime));
-    else
-       unschedule(FDISTR);
-    unschedule(FENSLV);
-    unschedule(FREPRO);
-    // Starchart is functional but we've never seen it
-    game.lastchart = FOREVER;
-    // Put stars in the galaxy
-    game.instar = 0;
-    for (i = 1; i <= GALSIZE; i++)
-       for (j = 1; j <= GALSIZE; j++) {
-           int k = Rand()*9.0 + 1.0;
-           game.instar += k;
-           game.state.galaxy[i][j].stars = k;
-       }
-    // Locate star bases in galaxy
-    for (i = 1; i <= game.inbase; i++) {
-       bool contflag;
-       do {
-           do w = randplace(GALSIZE);
-           while (game.state.galaxy[w.x][w.y].starbase);
-           contflag = false;
-           for (j = i-1; j > 0; j--) {
-               /* Improved placement algorithm to spread out bases */
-               double distq = square(w.x-game.state.baseq[j].x) + square(w.y-game.state.baseq[j].y);
-               if (distq < 6.0*(BASEMAX+1-game.inbase) && Rand() < 0.75) {
-                   contflag = true;
-                   if (idebug)
-                       prout("=== Abandoning base #%d at %d-%d", i, w.x, w.y);
-                   break;
-               }
-               else if (distq < 6.0 * (BASEMAX+1-game.inbase)) {
-                   if (idebug)
-                       prout("=== Saving base #%d, close to #%d", i, j);
-               }
-           }
-       } while (contflag);
-                       
-       game.state.baseq[i] = w;
-       game.state.galaxy[w.x][w.y].starbase = true;
-       game.state.chart[w.x][w.y].starbase = true;
-    }
-    // Position ordinary Klingon Battle Cruisers
-    krem = game.inkling;
-    klumper = 0.25*game.skill*(9.0-game.length)+1.0;
-    if (klumper > MAXKLQUAD) 
-       klumper = MAXKLQUAD;
-    do {
-       double r = Rand();
-       int klump = (1.0 - r*r)*klumper;
-       if (klump > krem)
-           klump = krem;
-       krem -= klump;
-       do w = randplace(GALSIZE);
-       while (game.state.galaxy[w.x][w.y].supernova ||
-               game.state.galaxy[w.x][w.y].klingons + klump > 9);
-       game.state.galaxy[w.x][w.y].klingons += klump;
-    } while (krem > 0);
-    // Position Klingon Commander Ships
-#ifdef ODEBUG
-    klumper = 1;
-#endif /* ODEBUG */
-    for (i = 1; i <= game.incom; i++) {
-       do {
-           do { /* IF debugging, put commanders by bases, always! */
-#ifdef ODEBUG
-               if (game.idebug && klumper <= game.inbase) {
-                   w = game.state.baseq[klumper];
-                   klumper++;
-               }
-               else
-#endif /* ODEBUG */
-                   w = randplace(GALSIZE);
-           }
-           while ((!game.state.galaxy[w.x][w.y].klingons && Rand() < 0.75)||
-                  game.state.galaxy[w.x][w.y].supernova||
-                  game.state.galaxy[w.x][w.y].klingons > 8);
-           // check for duplicate
-           for (j = 1; j < i; j++)
-               if (same(game.state.kcmdr[j], w))
-                   break;
-       } while (j < i);
-       game.state.galaxy[w.x][w.y].klingons++;
-       game.state.kcmdr[i] = w;
-    }
-    // Locate planets in galaxy
-    for (i = 0; i < game.inplan; i++) {
-       do w = randplace(GALSIZE); 
-       while (game.state.galaxy[w.x][w.y].planet != NOPLANET);
-       game.state.planets[i].w = w;
-       if ((game.options & OPTION_WORLDS) && i < NINHAB) {
-           game.state.planets[i].pclass = M;   // All inhabited planets are class M
-           game.state.planets[i].crystals = absent;
-           game.state.planets[i].known = known;
-           game.state.planets[i].inhabited = i;
-       } else {
-           game.state.planets[i].pclass = Rand()*3.0; // Planet class M N or O
-           game.state.planets[i].crystals = Rand()*1.5;                // 1 in 3 chance of crystals
-           game.state.planets[i].known = unknown;
-           game.state.planets[i].inhabited = UNINHABITED;
-       }
-       game.state.galaxy[w.x][w.y].planet = i;
-    }
-    // Locate Romulans
-    for (i = 1; i <= game.state.nromrem; i++) {
-       w = randplace(GALSIZE);
-       game.state.galaxy[w.x][w.y].romulans = 1;
-    }
-    // Locate the Super Commander
-    if (game.state.nscrem > 0) {
-       do w = randplace(GALSIZE);
-       while (game.state.galaxy[w.x][w.y].supernova || game.state.galaxy[w.x][w.y].klingons > 8);
-       game.state.kscmdr = w;
-       game.state.galaxy[w.x][w.y].klingons++;
-    }
-    // Place thing (in tournament game, thingx == -1, don't want one!)
-    if (thing.x != -1) {
-       thing = randplace(GALSIZE);
-    }
-    else
-       invalidate(thing);
-
-    skip(2);
-    game.state.snap = false;
-               
-    if (game.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."),
-             (game.inkling + game.incom + game.inscom));
-       prout(_("You have an initial allotment of %d stardates to complete"), (int)game.intime);
-       prout(_("your mission.  As you proceed you may be given more time."));
-       skip(1);
-       prout(_("You will have %d supporting starbases."), game.inbase);
-       proutn(_("Starbase locations-  "));
-    }
-    else {
-       prout(_("Stardate %d."), (int)game.state.date);
-       skip(1);
-       prout(_("%d Klingons."), game.inkling + game.incom + game.inscom);
-       prout(_("An unknown number of Romulans."));
-       if (game.state.nscrem)
-           prout(_("And one (GULP) Super-Commander."));
-       prout(_("%d stardates."),(int)game.intime);
-       proutn(_("%d starbases in "), game.inbase);
-    }
-    for (i = 1; i <= game.inbase; i++) {
-       proutn(cramlc(0, game.state.baseq[i]));
-       proutn("  ");
-    }
-    skip(2);
-    proutn(_("The Enterprise is currently in "));
-    proutn(cramlc(quadrant, game.quadrant));
-    proutn(" ");
-    proutn(cramlc(sector, game.sector));
-    skip(2);
-    prout(_("Good Luck!"));
-    if (game.state.nscrem)
-       prout(_("  YOU'LL NEED IT."));
-    waitfor();
-    newqad(false);
-    if (game.nenhere-iqhere-game.ithere)
-       game.shldup = true;
-    if (game.neutz)    // bad luck to start in a Romulan Neutral Zone
-       attack(false);
-}
-
-bool choose(bool needprompt) 
-/* choose your game type */
-{
-    for(;;) {
-       game.tourn = 0;
-       game.thawed = false;
-       game.skill = SKILL_NONE;
-       game.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) // Try again
-           continue;
-       if (isit("tournament")) {
-           while (scan() == IHEOL) {
-               proutn(_("Type in tournament number-"));
-           }
-           if (aaitem == 0) {
-               chew();
-               continue; // We don't want a blank entry
-           }
-           game.tourn = (int)aaitem;
-           thing.x = -1;
-           srand((unsigned int)(int)aaitem);
-           break;
-       }
-       if (isit("saved") || isit("frozen")) {
-           if (thaw())
-               continue;
-           chew();
-           if (*game.passwd==0)
-               continue;
-           if (!game.alldone)
-               game.thawed = true; // No plaque if not finished
-           report();
-           waitfor();
-           return true;
-       }
-       if (isit("regular"))
-           break;
-       proutn(_("What is \""));
-       proutn(citem);
-       prout("\"?");
-       chew();
-    }
-    while (game.length==0 || game.skill==SKILL_NONE) {
-       if (scan() == IHALPHA) {
-           if (isit("short"))
-               game.length = 1;
-           else if (isit("medium"))
-               game.length = 2;
-           else if (isit("long"))
-               game.length = 4;
-           else if (isit("novice"))
-               game.skill = SKILL_NOVICE;
-           else if (isit("fair"))
-               game.skill = SKILL_FAIR;
-           else if (isit("good"))
-               game.skill = SKILL_GOOD;
-           else if (isit("expert"))
-               game.skill = SKILL_EXPERT;
-           else if (isit("emeritus"))
-               game.skill = SKILL_EMERITUS;
-           else {
-               proutn(_("What is \""));
-               proutn(citem);
-               prout("\"?");
-           }
-       }
-       else {
-           chew();
-           if (game.length==0)
-               proutn(_("Would you like a Short, Medium, or Long game? "));
-           else if (game.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 style (plain, almy, fancy or just press enter): "));
-       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 | OPTION_WORLDS);
-       game.options |= OPTION_PLAIN;
-    } 
-    else if (isit("almy")) {
-       // Approximates Tom Almy's version.
-       game.options &=~ (OPTION_THINGY | OPTION_BLKHOLE | OPTION_BASE | OPTION_WORLDS);
-       game.options |= OPTION_ALMY;
-    }
-    else if (isit("fancy"))
-       /* do nothing */;
-    else if (strlen(citem)) {
-           proutn(_("What is \""));
-           proutn(citem);
-           prout("\"?");
-    }
-    setpassword();
-    if (strcmp(game.passwd, "debug")==0) {
-       idebug = true;
-       fputs("=== Debug mode enabled\n", stdout);
-    }
-
-    // Use parameters to generate initial values of things
-    game.damfac = 0.5 * game.skill;
-    game.state.rembase = 2.0 + Rand()*(BASEMAX-2.0);
-    game.inbase = game.state.rembase;
-    game.inplan = 0;
-    if (game.options & OPTION_PLANETS)
-       game.inplan += (MAXUNINHAB/2) + (MAXUNINHAB/2+1)*Rand();
-    if (game.options & OPTION_WORLDS)
-       game.inplan += NINHAB;
-    game.state.nromrem = game.inrom = (2.0+Rand())*game.skill;
-    game.state.nscrem = game.inscom = (game.skill > SKILL_FAIR ? 1 : 0);
-    game.state.remtime = 7.0 * game.length;
-    game.intime = game.state.remtime;
-    game.state.remkl = game.inkling = 2.0*game.intime*((game.skill+1 - 2*Rand())*game.skill*0.1+.15);
-    game.incom = game.skill + 0.0625*game.inkling*Rand();
-    game.state.remcom = min(10, game.incom);
-    game.incom = game.state.remcom;
-    game.state.remres = (game.inkling+4*game.incom)*game.intime;
-    game.inresor = game.state.remres;
-    if (game.inkling > 50) {
-       game.inbase = (game.state.rembase += 1);
-    }
-    return false;
-}
-
-coord dropin(feature iquad)
-/* drop a feature on a random dot in the current quadrant */
-{
-    coord w;
-    do w = randplace(QUADSIZE);
-    while (game.quad[w.x][w.y] != IHDOT);
-    game.quad[w.x][w.y] = iquad;
-    return w;
-}
-
-void newcnd(void)
-/* update our alert status */
-{
-    game.condition = green;
-    if (game.energy < 1000.0)
-       game.condition = yellow;
-    if (game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons || game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans)
-       game.condition = red;
-    if (!game.alive)
-       game.condition=dead;
-}
-
-coord newkling(int i)
-/* drop new Klingon into current quadrant */
-{
-    coord pi = dropin(IHK);
-    game.ks[i] = pi;
-    game.kdist[i] = game.kavgd[i] = distance(game.sector, pi);
-    game.kpower[i] = Rand()*150.0 +300.0 +25.0*game.skill;
-    return pi;
-}
-
-void newqad(bool shutup)
-/* set up a new state of quadrant, for when we enter or re-enter it */
-{
-    int i, j;
-    coord w;
-    struct quadrant *q;
-
-    game.justin = true;
-    invalidate(game.base);
-    game.klhere = 0;
-    game.comhere = false;
-    invalidate(game.plnet);
-    game.ishere = false;
-    game.irhere = 0;
-    game.iplnet = 0;
-    game.nenhere = 0;
-    game.neutz = false;
-    game.inorbit = false;
-    game.landed = false;
-    game.ientesc = false;
-    game.ithere = false;
-    iqhere = false;
-    iqengry = false;
-    game.iseenit = false;
-    if (game.iscate) {
-       // Attempt to escape Super-commander, so tbeam back!
-       game.iscate = false;
-       game.ientesc = true;
-    }
-    // Clear quadrant
-    for (i = 1; i <= QUADSIZE; i++)
-       for (j = 1; j <= QUADSIZE; j++)
-           game.quad[i][j] = IHDOT;
-    q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
-    // cope with supernova
-    if (q->supernova)
-       return;
-    game.klhere = q->klingons;
-    game.irhere = q->romulans;
-    game.nenhere = game.klhere + game.irhere;
-
-    // Position Starship
-    game.quad[game.sector.x][game.sector.y] = game.ship;
-
-    if (q->klingons) {
-       w.x = w.y = 0;  /* quiet a gcc warning */
-       // Position ordinary Klingons
-       for (i = 1; i <= game.klhere; i++)
-           w = newkling(i);
-       // If we need a commander, promote a Klingon
-       for (i = 1; i <= game.state.remcom; i++)
-           if (same(game.state.kcmdr[i], game.quadrant))
-               break;
-                       
-       if (i <= game.state.remcom) {
-           game.quad[w.x][w.y] = IHC;
-           game.kpower[game.klhere] = 950.0+400.0*Rand()+50.0*game.skill;
-           game.comhere = true;
-       }
-
-       // If we need a super-commander, promote a Klingon
-       if (same(game.quadrant, game.state.kscmdr)) {
-           game.quad[game.ks[1].x][game.ks[1].y] = IHS;
-           game.kpower[1] = 1175.0 + 400.0*Rand() + 125.0*game.skill;
-           game.iscate = (game.state.remkl > 1);
-           game.ishere = true;
-       }
-    }
-    // Put in Romulans if needed
-    for (i = game.klhere+1; i <= game.nenhere; i++) {
-       w = dropin(IHR);
-       game.ks[i] = w;
-       game.kdist[i] = game.kavgd[i] = distance(game.sector, w);
-       game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*game.skill;
-    }
-    // If quadrant needs a starbase, put it in
-    if (q->starbase)
-       game.base = dropin(IHB);
-       
-    // If quadrant needs a planet, put it in
-    if (q->planet != NOPLANET) {
-       game.iplnet = q->planet;
-       if (game.state.planets[q->planet].inhabited == UNINHABITED)
-           game.plnet = dropin(IHP);
-       else
-           game.plnet = dropin(IHW);
-    }
-    // Check for condition
-    newcnd();
-    // And finally the stars
-    for (i = 1; i <= q->stars; i++) 
-       dropin(IHSTAR);
-
-    // Check for RNZ
-    if (game.irhere > 0 && game.klhere == 0) {
-       game.neutz = true;
-       if (!damaged(DRADIO)) {
-           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 (same(thing, game.quadrant)) {
-           w = dropin(IHQUEST);
-           thing = randplace(GALSIZE);
-           game.nenhere++;
-           iqhere = true;
-           game.ks[game.nenhere] = w;
-           game.kdist[game.nenhere] = game.kavgd[game.nenhere] =
-               distance(game.sector, w);
-           game.kpower[game.nenhere] = Rand()*6000.0 +500.0 +250.0*game.skill;
-           if (!damaged(DSRSENS)) {
-               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 ((game.skill < SKILL_GOOD && Rand() <= 0.02) ||   /* Lighten up if skill is low */
-           (game.skill == SKILL_GOOD && Rand() <= 0.05) ||
-           (game.skill > SKILL_GOOD && Rand() <= 0.08)
-           ) {
-           do {
-               game.tholian.x = Rand() > 0.5 ? QUADSIZE : 1;
-               game.tholian.y = Rand() > 0.5 ? QUADSIZE : 1;
-           } while (game.quad[game.tholian.x][game.tholian.y] != IHDOT);
-           game.quad[game.tholian.x][game.tholian.y] = IHT;
-           game.ithere = true;
-           game.nenhere++;
-           game.ks[game.nenhere] = game.tholian;
-           game.kdist[game.nenhere] = game.kavgd[game.nenhere] =
-               distance(game.sector, game.tholian);
-           game.kpower[game.nenhere] = Rand()*400.0 +100.0 +25.0*game.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';
-       }
-    }
-
-    sortklings();
-
-    // Put in a few black holes
-    for (i = 1; i <= 3; i++)
-       if (Rand() > 0.5) 
-           dropin(IHBLANK);
-
-    // Take out X's in corners if Tholian present
-    if (game.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 sortklings(void) 
-/* sort Klingons by distance from us */
-{
-    double t;
-    int j, k;
-    bool sw;
-
-    // The author liked bubble sort. So we will use it. :-(
-
-    if (game.nenhere-iqhere-game.ithere < 2)
-       return;
-
-    do {
-       sw = false;
-       for (j = 1; j < game.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.ks[j].x;
-               game.ks[j].x = game.ks[j+1].x;
-               game.ks[j+1].x = k;
-               k = game.ks[j].y;
-               game.ks[j].y = game.ks[j+1].y;
-               game.ks[j+1].y = k;
-               t = game.kpower[j];
-               game.kpower[j] = game.kpower[j+1];
-               game.kpower[j+1] = t;
-           }
-    } while (sw);
-}
-
-void setpassword(void)
-/* set the self-destruct password */
-{
-    if (game.options & OPTION_PLAIN) {
-       while (TRUE) {
-           chew();
-           proutn(_("Please type in a secret password- "));
-           scan();
-           strcpy(game.passwd, citem);
-           if (*game.passwd != 0)
-               break;
-       }
-    } else {
-       int i;
-        for(i=0;i<3;i++)
-           game.passwd[i]=(char)(97+(int)(Rand()*25));
-        game.passwd[3]=0;
-    }
-}
diff --git a/c-version/src/sst.c b/c-version/src/sst.c
deleted file mode 100644 (file)
index c9bf9f4..0000000
+++ /dev/null
@@ -1,983 +0,0 @@
-#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.
-
-   5. Half the quadrants now have inhabited planets, from which one 
-      cannot mine dilithium (there will still be the same additional number
-      of dilithium-bearing planets).  Torpedoing an inhabited world is *bad*.
-      There is BSD-Trek-like logic for Klingons to attack and enslave 
-      inhabited worlds, producing more ships (only is skill is 'good' or 
-      better). (Controlled by OPTION_WORLDS and turned off if game 
-      type is "plain" or "almy".)
-
-   6. User input is now logged so we can do regression testing.
-
-   7. More BSD-Trek features: You can now lose if your entire crew
-      dies in battle.  When abandoning ship in a game with inhabited
-      worlds enabled, they must have one in the quadrant to beam down
-      to; otherwise they die in space and this counts heavily against
-      your score.  Docking at a starbase replenishes your crew.
-
-   8. Still more BSD-Trek: we now have a weighted damage table.
-      Also, the nav subsystem (enabling automatic course
-      setting) can be damaged separately from the main computer (which
-      handles weapons targeting, ETA calculation, and self-destruct).
-*/
-
-/* the input queue */
-static char line[128], *linep = line;
-
-struct game game;
-coord thing;
-bool iqhere, iqengry;
-int iscore, iskill;    // Common PLAQ
-double aaitem;
-double perdate;
-char citem[12];
-int seed;              // the random-number seed
-bool idebug;           // debug mode
-FILE *logfp, *replayfp;
-
-char *systnames[NINHAB];
-char *device[NDEVICES];
-
-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   7
-       {"MOVE",        MOVE,           0},
-#define SHIELDS        8
-       {"SHIELDS",     SHIELDS,        0},
-#define DOCK   9
-       {"DOCK",        DOCK,           0},
-#define DAMAGES        10
-       {"DAMAGES",     DAMAGES,        0},
-#define CHART  11
-       {"CHART",       CHART,          0},
-#define IMPULSE        12
-       {"IMPULSE",     IMPULSE,        0},
-#define REST   13
-       {"REST",        REST,           0},
-#define WARP   14
-       {"WARP",        WARP,           0},
-#define SCORE  15
-       {"SCORE",       SCORE,          0},
-#define SENSORS        16
-       {"SENSORS",     SENSORS,        OPTION_PLANETS},
-#define ORBIT  17
-       {"ORBIT",       ORBIT,          OPTION_PLANETS},
-#define TRANSPORT      18
-       {"TRANSPORT",   TRANSPORT,      OPTION_PLANETS},
-#define MINE   19
-       {"MINE",        MINE,           OPTION_PLANETS},
-#define CRYSTALS       20
-       {"CRYSTALS",    CRYSTALS,       OPTION_PLANETS},
-#define SHUTTLE        21
-       {"SHUTTLE",     SHUTTLE,        OPTION_PLANETS},
-#define PLANETS        22
-       {"PLANETS",     PLANETS,        OPTION_PLANETS},
-#define REPORT 23
-       {"REPORT",      REPORT,         0},
-#define COMPUTER       24
-       {"COMPUTER",    COMPUTER,       0},
-#define COMMANDS       25
-       {"COMMANDS",    COMMANDS,       0},
-#define EMEXIT 26
-       {"EMEXIT",      EMEXIT,         0},
-#define PROBE  27
-       {"PROBE",       PROBE,          OPTION_PROBE},
-#define SAVE   28
-       {"SAVE",        SAVE,           0},
-       {"FREEZE",      SAVE,           0},
-#define ABANDON        30
-       {"ABANDON",     ABANDON,        0},
-#define DESTRUCT       31
-       {"DESTRUCT",    DESTRUCT,       0},
-#define DEATHRAY       32
-       {"DEATHRAY",    DEATHRAY,       0},
-#define DEBUGCMD       33
-       {"DEBUG",       DEBUGCMD,       0},
-#define MAYDAY 34
-       {"MAYDAY",      MAYDAY,         0},
-       //{"SOS",               MAYDAY,         0},
-       //{"CALL",      MAYDAY,         0},
-#define QUIT   35
-       {"QUIT",        QUIT,           0},
-#define HELP   36
-       {"HELP",        HELP,           0},
-#define SEED   37
-       {"SEED",        SEED,           0},
-#ifdef BSD_BUG_FOR_BUG
-#define VISUAL 38
-       {"VISUAL",      VISUAL,         0},
-#endif
-};
-
-#define NUMCOMMANDS    ARRAY_SIZE(commands)
-#define ACCEPT(i)      (!commands[i].option || (commands[i].option & game.options))
-
-static void listCommands(void) 
-/* generate a list of legal commands */
-{
-    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)
-/* browse on-line help */
-{
-    int i, j;
-    char cmdbuf[32], *cp;
-    char linebuf[132];
-    FILE *fp;
-    /* Give help on commands */
-    int key;
-    key = scan();
-    for(;;) {
-       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);
-       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"));
-        proutn(_("   computer. You need to find "));
-        proutn(DOC_NAME);
-        prout(_(" and put it in the"));
-        proutn(_("   current directory or to "));
-        proutn(SSTDOC);
-        prout(".\"");
-       /*
-        * 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)) {
-       char *eol;
-       if (strstr(linebuf, "******"))
-           break;
-       if ((eol = strpbrk(linebuf, "\r\n")))
-           *eol = 0;
-       prout(linebuf);
-    }
-    fclose(fp);
-}
-
-static void makemoves(void)
-/* command-interpretation loop */
-{
-    int key, i, v = 0;
-    bool hitme;
-    clrscr();
-    setwnd(message_window);
-    for(;;) { /* command loop */
-       drawmaps(1);
-       for(;;)  { /* get a command */
-           hitme = false;
-           game.justin = false;
-           game.optime = 0.0;
-           i = -1;
-           chew();
-           setwnd(prompt_window);
-           clrscr();
-           proutn("COMMAND> ");
-           if (scan() == IHEOL) {
-               if (game.options & OPTION_CURSES)
-                   makechart();
-               continue;
-           }
-           game.ididit = false;
-           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();
-           break;
-       case STATUS:                 // status
-           status(0);
-           break;
-       case REQUEST:                   // status request 
-           request();
-           break;
-       case LRSCAN:                    // lrscan
-           lrscan();
-           break;
-       case PHASERS:                   // phasers
-           phasers();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case TORPEDO:                   // photon torpedoes
-           torps();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case MOVE:                      // move
-           warp(false);
-           break;
-       case SHIELDS:                   // shields
-           doshield(false);
-           if (game.ididit) {
-               hitme = true;
-               game.shldchg = false;
-           }
-           break;
-       case DOCK:                      // dock
-           dock(true);
-           if (game.ididit)
-               attack(false);          
-           break;
-       case DAMAGES:                   // damages
-           damagereport();
-           break;
-       case CHART:                     // chart
-           makechart();
-           break;
-       case IMPULSE:                   // impulse
-           impulse();
-           break;
-       case REST:                      // rest
-           wait();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case WARP:                      // warp
-           setwarp();
-           break;
-       case SCORE:                     // score
-           score();
-           break;
-       case SENSORS:                   // sensors
-           sensor();
-           break;
-       case ORBIT:                     // orbit
-           orbit();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case TRANSPORT:                 // transport "beam"
-           beam();
-           break;
-       case MINE:                      // mine
-           mine();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case CRYSTALS:                  // crystals
-           usecrystals();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case SHUTTLE:                   // shuttle
-           shuttle();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case PLANETS:                   // Planet list
-           survey();
-           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 (game.ididit)
-               hitme = true;
-           break;
-       case ABANDON:                   // Abandon Ship
-           abandon();
-           break;
-       case DESTRUCT:                  // Self Destruct
-           selfdestruct();
-           break;
-       case SAVE:                      // Save Game
-           freeze(false);
-           clrscr();
-           if (game.skill > SKILL_GOOD)
-               prout(_("WARNING--Saved games produce no plaques!"));
-           break;
-       case DEATHRAY:                  // Try a desparation measure
-           deathray();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case DEBUGCMD:                  // What do we want for debug???
-           debugme();
-           break;
-       case MAYDAY:                    // Call for help
-           mayday();
-           if (game.ididit)
-               hitme = true;
-           break;
-       case QUIT:
-           game.alldone = true;                // quit the game
-           break;
-       case HELP:
-           helpme();                   // get help
-           break;
-       case SEED:                      // set random-number seed
-           key = scan();
-           if (key == IHREAL)
-               seed = (int)aaitem;
-           break;
-#ifdef BSD_BUG_FOR_BUG
-       case VISUAL:
-           visual();                   // perform visual scan
-           break;
-#endif
-       }
-       commandhook(commands[i].name, false);
-       for (;;) {
-           if (game.alldone)
-               break;          // Game has ended
-           if (game.optime != 0.0) {
-               events();
-               if (game.alldone)
-                   break;      // Events did us in
-           }
-           if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) { // Galaxy went Nova!
-               atover(false);
-               continue;
-           }
-           if (hitme && !game.justin) {
-               attack(true);
-               if (game.alldone)
-                   break;
-               if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) {    // went NOVA! 
-                   atover(false);
-                   hitme = true;
-                   continue;
-               }
-           }
-           break;
-       }
-       if (game.alldone)
-           break;
-    }
-    if (idebug)
-       prout("=== Ending");
-}
-
-
-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;
-
-    seed = (int)time(NULL);
-    while ((option = getopt(argc, argv, "r:tx")) != -1) {
-       switch (option) {
-       case 'r':
-           replayfp = fopen(optarg, "r");
-           if (replayfp == NULL) {
-               fprintf(stderr, "sst: can't open replay file %s\n", optarg);
-               exit(1);
-           }
-           if (fscanf(replayfp, "seed %d\n", &seed) != 1) {
-               fprintf(stderr, "sst: replay file %s is ill-formed\n", optarg);
-               exit(1);
-           }
-           /* FALL THROUGH */
-       case 't':
-           game.options |= OPTION_TTY;
-           game.options &=~ OPTION_CURSES;
-           break;
-       case 'x':
-           idebug = true;
-           break;
-       default:
-           fprintf(stderr, "usage: sst [-t] [-x] [startcommand...].\n");
-           exit(0);
-       }
-    }
-    /* where to save the input in case of bugs */
-    logfp = fopen("/usr/tmp/sst-input.log", "w");
-    if (logfp) {
-       setlinebuf(logfp);
-       fprintf(logfp, "seed %d\n", seed);
-    }
-    srand(seed);
-
-    iostart();
-
-    line[0] = '\0';
-    for (i = optind; i < argc;  i++) {
-       strcat(line, argv[i]);
-       strcat(line, " ");
-    }
-    for(;;) { /* Play a game */
-       setwnd(fullscreen_window);
-       clrscr();
-       prelim();
-       setup(line[0] == '\0');
-       if (game.alldone) {
-           score();
-           game.alldone = false;
-       }
-       else
-           makemoves();
-       skip(1);
-       stars();
-       skip(1);
-
-       if (game.tourn && game.alldone) {
-           proutn(_("Do you want your score recorded?"));
-           if (ja() == true) {
-               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(feature i) 
-/* print the name of an enemy */
-{
-    /* 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;
-    case IHW: s = _("Inhabited World"); break;
-    default: s = "Unknown??"; break;
-    }
-    proutn(s);
-}
-
-char *cramlc(enum loctype key, coord w)
-/* name a location */
-{
-    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", w.x, w.y);
-    return buf;
-}
-
-void crmena(bool stars, feature enemy, enum loctype key, coord w) 
-/* print an enemy and his location */
-{
-    if (stars)
-       proutn("***");
-    cramen(enemy);
-    proutn(_(" at "));
-    proutn(cramlc(key, w));
-}
-
-void crmshp(void)
-/* print our ship name */
-{
-    char *s;
-    switch (game.ship) {
-    case IHE: s = _("Enterprise"); break;
-    case IHF: s = _("Faerie Queene"); break;
-    default:  s = "Ship???"; break;
-    }
-    proutn(s);
-}
-
-void stars(void)
-/* print a line of stars */
-{
-    prouts("******************************************************");
-    skip(1);
-}
-
-double expran(double avrage) 
-{
-    return -avrage*log(1e-7 + Rand());
-}
-
-double Rand(void) 
-{
-    return rand()/(1.0 + (double)RAND_MAX);
-}
-
-coord randplace(int size)
-/* choose a random location */ 
-{
-    coord w;
-    w.x = Rand()*(size*1.0) + 1.0;
-    w.y = Rand()*(size*1.0) + 1.0;
-    return w;
-}
-
-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;
-    }
-    i = 0;
-    // try a number
-    if (sscanf(linep, "%lf%n", &aaitem, &i) > 0) {
-       // 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;
-}
-
-bool ja(void)
-/* yes-or-no confirmation */
-{
-    chew();
-    for(;;) {
-       scan();
-       chew();
-       if (*citem == 'y')
-           return true;
-       if (*citem == 'n')
-           return false;
-       proutn(_("Please answer with \"y\" or \"n\": "));
-    }
-}
-
-void huh(void)
-/* complain about unparseable input */
-{
-    chew();
-    skip(1);
-    prout(_("Beg your pardon, Captain?"));
-}
-
-bool isit(char *s) 
-/* compares s to citem and returns true if it matches to the length of s */
-{
-    return strncasecmp(s, citem, max(1, strlen(citem))) == 0;
-}
-
-void debugme(void)
-/* access to the internals for debugging */
-{
-    proutn("Reset levels? ");
-    if (ja() == true) {
-       if (game.energy < game.inenrg)
-           game.energy = game.inenrg;
-       game.shield = game.inshld;
-       game.torps = game.intorps;
-       game.lsupres = game.inlsr;
-    }
-    proutn("Reset damage? ");
-    if (ja() == true) {
-       int i;
-       for (i=0; i < NDEVICES; i++) 
-           if (game.damage[i] > 0.0) 
-               game.damage[i] = 0.0;
-    }
-    proutn("Toggle debug flag? ");
-    if (ja() == true) {
-       idebug = !idebug;
-       if (idebug)
-           prout("Debug output ON");       
-       else
-           prout("Debug output OFF");
-    }
-    proutn("Cause selective damage? ");
-    if (ja() == true) {
-       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() == true) {
-       event *ev;
-       coord w;
-       int i;
-       for (i = 1; i < NEVENTS; i++) {
-           int key;
-           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;
-           case FDSPROB: proutn("Probe Move      "); break;
-           case FDISTR:  proutn("Distress Call   "); break;
-           case FENSLV:  proutn("Enlavement      "); break;
-           case FREPRO:  proutn("Klingon Build   "); break;
-           }
-           if (is_scheduled(i)) {
-               proutn("%.2f", scheduled(i)-game.state.date);
-               if (i == FENSLV || i == FREPRO) {
-                   ev = findevent(i);
-                   proutn(" in %d-%d", ev->quadrant.x,ev->quadrant.y);
-               }
-           } else
-               proutn("never");
-           proutn("? ");
-           chew();
-           key = scan();
-           if (key == 'n') {
-               unschedule(i);
-               chew();
-           } else if (key == IHREAL) {
-               ev = schedule(i, aaitem);
-               if (i == FENSLV || i == FREPRO) {
-                   chew();
-                   proutn("In quadrant- ");
-                   key = scan();
-                   /* IHEOL says to leave coordinates as they are */
-                   if (key != IHEOL) {
-                       if (key != IHREAL) {
-                           prout("Event %d canceled, no x coordinate.", i);
-                           unschedule(i);
-                           continue;
-                       }
-                       w.x = (int)aaitem;
-                       key = scan();
-                       if (key != IHREAL) {
-                           prout("Event %d canceled, no y coordinate.", i);
-                           unschedule(i);
-                           continue;
-                       }
-                       w.y = (int)aaitem;
-                       ev->quadrant = w;
-                   }
-               }
-           }
-       }
-       chew();
-    }
-    proutn("Induce supernova here? ");
-    if (ja() == true) {
-       game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova = true;
-       atover(true);
-    }
-}
diff --git a/c-version/src/sst.h b/c-version/src/sst.h
deleted file mode 100644 (file)
index dce01e0..0000000
+++ /dev/null
@@ -1,446 +0,0 @@
-#ifndef __SST_H__
-
-#include <stdio.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <libintl.h>
-#include <curses.h>
-#include <stdbool.h>
-
-#ifdef DATA_DIR
-#define SSTDOC DATA_DIR"/"DOC_NAME
-#else
-#define SSTDOC DOC_NAME
-#endif
-
-#define _(str) gettext(str)
-
-#define min(x, y)      ((x)<(y)?(x):(y))
-#define max(x, y)      ((x)>(y)?(x):(y))
-
-#define PHASEFAC       2.0
-#define GALSIZE                8
-#define NINHAB         (GALSIZE * GALSIZE / 2)
-#define MAXUNINHAB     10
-#define PLNETMAX       (NINHAB + MAXUNINHAB)
-#define QUADSIZE       10
-#define BASEMAX                (GALSIZE * GALSIZE / 12)
-#define MAXKLGAME      127
-#define MAXKLQUAD      9
-
-/*
- * 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)
-
-typedef struct {int x; int y;} coord;
-
-#define square(i)              ((i)*(i))
-#define same(c1, c2)           ((c1.x == c2.x) && (c1.y == c2.y))
-#define distance(c1, c2)       sqrt(square(c1.x - c2.x) + square(c1.y - c2.y))
-#define invalidate(w)          w.x = w.y = 0
-#define is_valid(w)            (w.x != 0 && w.y != 0)
-
-typedef struct {
-    coord w;
-    enum {destroyed= -1, M=0, N=1, O=2} pclass;
-    int inhabited;     /* if NZ, an index into a name array */
-#define UNINHABITED    -1
-    enum {mined=-1, present=0, absent=1} crystals; /* has crystals */
-    enum {unknown, known, shuttle_down} known;
-} planet;
-
-typedef enum {
-    IHR = 'R',
-    IHK = 'K',
-    IHC = 'C',
-    IHS = 'S',
-    IHSTAR = '*',
-    IHP = 'P',
-    IHW = '@',
-    IHB = 'B',
-    IHBLANK = ' ',
-    IHDOT = '.',
-    IHQUEST = '?',
-    IHE = 'E',
-    IHF = 'F',
-    IHT = 'T',
-    IHWEB = '#',
-    IHMATER0 = '-',
-    IHMATER1 = 'o',
-    IHMATER2 = '0',
-} feature;
-
-typedef struct {
-    bool snap;                 // snapshot taken
-    int crew,                  // crew complement
-#define FULLCREW       428     /* BSD Trek was 387, that's wrong */
-       remkl,                  // remaining klingons
-       remcom,                 // remaining commanders
-       nscrem,                 // remaining super commanders
-       rembase,                // remaining bases
-       starkl,                 // destroyed stars
-       basekl,                 // destroyed bases
-       nromrem,                // Romulans remaining
-       nplankl,                // destroyed uninhabited planets
-       nworldkl;               // destroyed inhabited planets
-    planet planets[PLNETMAX];  // Planet information
-    double date,               // stardate
-       remres,                 // remaining resources
-       remtime;                // remaining time
-    coord baseq[BASEMAX+1];    // Base quadrant coordinates
-    coord kcmdr[QUADSIZE+1];   // Commander quadrant coordinates
-    coord kscmdr;              // Supercommander quadrant coordinates
-    struct quadrant {
-       int stars;
-       int planet;
-#define NOPLANET       -1
-       bool starbase;
-       int klingons;
-       int romulans;
-       bool supernova;
-       bool charted;
-       enum {secure, distressed, enslaved} status;
-    } galaxy[GALSIZE+1][GALSIZE+1];    // The Galaxy (subscript 0 not used)
-    struct page {
-       int stars;
-       bool starbase;
-       int klingons;
-    } chart[GALSIZE+1][GALSIZE+1];     // the starchart (subscript 0 not used)
-} snapshot;                            // Data that is snapshot
-
-/* 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_WORLDS  0x00000800      /* logic for inhabited worlds */
-#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 DNAVSYS        11
-#define DTRANSP 12
-#define DSHCTRL 13
-#define DDRAY   14
-#define DDSP    15
-#define NDEVICES (16)  // Number of devices
-
-#define damaged(dev)   (game.damage[dev] != 0.0)
-
-#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 FDISTR 9   // Emit distress call from an inhabited world 
-#define FENSLV 10  // Inhabited word is enslaved */
-#define FREPRO 11  // Klingons build a ship in an enslaved system
-#define NEVENTS (12)
-
-typedef struct {
-    double date;
-    coord quadrant;
-} event;
-
-/*
- * abstract out the event handling -- underlying data structures will change
- * when we implement stateful events
- */
-extern event *unschedule(int);
-extern int is_scheduled(int);
-extern event *schedule(int, double);
-extern void postpone(int, double);
-extern double scheduled(int);
-#define findevent(evtype)      &game.future[evtype]
-
-#define SSTMAGIC       "SST2.0\n"
-
-#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
-
-struct game {
-    char magic[sizeof(SSTMAGIC)];
-    unsigned long options;
-    snapshot state;
-    snapshot snapsht;
-    feature 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
-    event future[NEVENTS];     // future events
-    char passwd[10];           // Self Destruct password
-    coord ks[(QUADSIZE+1)*(QUADSIZE+1)];       // enemy sector locations
-    coord quadrant, sector;    // where we are
-    coord tholian;             // coordinates of Tholian
-    coord base;                        // position of base in current quadrant
-    coord battle;              // base coordinates being attacked
-    coord plnet;               // location of planet in quadrant
-    coord probec;      // current probe quadrant
-    bool gamewon,      // Finished!
-       ididit,         // action taken -- allows enemy to attack
-       alive,          // we are alive (not killed)
-       justin,         // just entered quadrant
-       shldup,         // shields are up
-       shldchg,        // shield is changing (affects efficiency)
-       comhere,        // commander here
-       ishere,         // super-commander in quadrant
-       iscate,         // super commander is here
-       ientesc,        // attempted escape from supercommander
-       ithere,         // Tholian is here 
-       resting,        // rest time
-       icraft,         // Kirk in Galileo
-       landed,         // party on planet (true), on ship (false)
-       alldone,        // game is now finished
-       neutz,          // Romulan Neutral Zone
-       isarmed,        // probe is armed
-       inorbit,        // orbiting a planet
-       imine,          // mining
-       icrystl,        // dilithium crystals aboard
-       iseenit,        // seen base attack report
-       thawed;         // thawed game
-    enum {
-       green,
-       yellow,
-       red,
-       docked,
-       dead,
-    } condition;               // condition (red/yellow/green/docked)
-    enum {
-       onship,
-       offship,
-       removed,
-    } iscraft;         // 'onship' if craft on ship, 'removed' if out of game
-    enum {
-       SKILL_NONE,
-       SKILL_NOVICE,
-       SKILL_FAIR,
-       SKILL_GOOD,
-       SKILL_EXPERT,
-       SKILL_EMERITUS,
-    } skill;           // skill level
-    int inkling,       // initial number of klingons
-       inbase,         // initial number of bases
-       incom,          // initial number of commanders
-       inscom,         // initial number of commanders
-       inrom,          // initial number of commanders
-       instar,         // initial stars
-       intorps,        // initial/max torpedoes
-       torps,          // number of torpedoes
-       ship,           // ship type -- 'E' is Enterprise
-       abandoned,      // count of crew abandoned in space
-       length,         // length of game
-       klhere,         // klingons here
-       casual,         // causalties
-       nhelp,          // calls for help
-       nkinks,         // count of energy-barrier crossings
-       iplnet,         // planet # in quadrant
-       inplan,         // initial planets
-       nenhere,        // number of enemies in quadrant
-       irhere,         // Romulans in quadrant
-       isatb,          // =2 if super commander is attacking base
-       tourn,          // tournament number
-       proben,         // number of moves for probe
-       nprobes;        // number of probes available
-    double inresor,    // initial resources
-       intime,         // initial time
-       inenrg,         // initial/max energy
-       inshld,         // initial/max shield
-       inlsr,          // initial life support resources
-       indate,         // initial date
-       energy,         // energy level
-       shield,         // shield level
-       warpfac,        // warp speed
-       wfacsq,         // squared warp factor
-       lsupres,        // life support reserves
-       dist,           // movement distance
-       direc,          // movement direction
-       optime,         // time taken by current operation
-       docfac,         // repair factor when docking (constant?)
-       damfac,         // damage factor
-       lastchart,      // time star chart was last updated
-       cryprob,        // probability that crystal will work
-       probex,         // location of probe
-       probey,         //
-       probeinx,       // probe x,y increment
-       probeiny,       //
-       height;         // height of orbit around planet
-};
-extern struct game game;
-
-/* the following global state doesn't need to be saved */
-extern char *device[NDEVICES];
-extern char *systnames[NINHAB];
-extern int iscore, iskill; // Common PLAQ
-extern double perdate;
-extern double aaitem;
-extern char citem[12];
-extern int seed;
-extern bool idebug;
-extern FILE *logfp, *replayfp;
-
-/* the Space Thingy's global state should *not* be saved! */
-extern coord thing;
-extern bool 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, FCREW
-} FINTYPE ;
-
-enum loctype {neither, quadrant, sector};
-
-/* Function prototypes */
-extern void prelim(void);
-extern void attack(bool);
-extern bool choose(bool);
-extern void setup(bool);
-extern void score(void);
-extern void atover(bool);
-extern void srscan(void);
-extern void lrscan(void);
-extern void phasers(void);
-extern void torps(void);
-extern void warp(bool);
-extern void doshield(bool);
-extern void dock(bool);
-extern void damagereport(void);
-extern void chart(void);
-extern void rechart(void);
-extern void impulse(void);
-extern void wait(void);
-extern void setwarp(void);
-extern void events(void);
-extern void report(void);
-extern void eta(void);
-extern void mayday(void);
-extern void abandon(void);
-extern void finish(FINTYPE);
-extern void selfdestruct(void);
-extern void kaboom(void);
-extern void freeze(bool);
-extern bool thaw(void);
-extern void plaque(void);
-extern int scan(void);
-extern void status(int req);
-extern void request(void);
-#define IHEOL (0)
-#define IHALPHA (1)
-#define IHREAL (2)
-extern void chew(void);
-extern void chew2(void);
-extern void skip(int);
-extern void prout(const char *, ...) __attribute__((format(printf, 1, 2)));
-extern void proutn(const char *, ...) __attribute__((format(printf, 1, 2)));
-extern void prouts(const char *, ...) __attribute__((format(printf, 1, 2)));
-extern void prstat(const char *txt, const char *fmt, ...)
-       __attribute__((format(printf, 2, 3)));
-extern void stars(void);
-extern void newqad(bool);
-extern bool ja(void);
-extern void cramen(feature);
-extern void crmshp(void);
-extern char *cramlc(enum loctype, coord w);
-extern double expran(double);
-extern double Rand(void);
-extern coord randplace(int);
-extern coord dropin(feature);
-extern void newcnd(void);
-extern void sortklings(void);
-extern void imove(bool);
-extern void ram(bool, feature, coord);
-extern void crmena(bool, feature, enum loctype, coord w);
-extern void deadkl(coord, feature, coord);
-extern void timwrp(void);
-extern void moveklings(void);
-extern void torpedo(double, double, coord, double *, int, int);
-extern void huh(void);
-extern void announce(void);
-extern void nova(coord);
-extern void supernova(bool, coord *);
-extern void supercommander(void);
-extern void hittem(double *);
-extern bool isit(char *);
-extern void survey(void);
-extern void orbit(void);
-extern void sensor(void);
-extern void drawmaps(int);
-extern void beam(void);
-extern void mine(void);
-extern void usecrystals(void);
-extern void shuttle(void);
-extern void deathray(void);
-extern void debugme(void);
-extern void attackreport(bool);
-extern void movetholian(void);
-extern void probe(void);
-extern void iostart(void);
-extern void setwnd(WINDOW *);
-extern void warble(void);
-extern void boom(coord);
-extern void tracktorpedo(coord, int, int, int, int);
-extern void cgetline(char *, int);
-extern void waitfor(void);
-extern void setpassword(void);
-extern void commandhook(char *, bool);
-extern void makechart(void);
-extern coord newkling(int);
-#ifdef BSD_BUG_FOR_BUG
-extern void visual(void);
-#endif
-
-extern WINDOW *curwnd;
-extern WINDOW *fullscreen_window;
-extern WINDOW *srscan_window;
-extern WINDOW *report_window;
-extern WINDOW *lrscan_window;
-extern WINDOW *message_window;
-extern WINDOW *prompt_window;
-
-extern void clreol(void);
-extern void clrscr(void);
-extern void textcolor(int);
-extern void highvideo(void);
-
-enum COLORS {
-   DEFAULT,
-   BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY,
-   DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
-};
-
-#endif
diff --git a/c-version/src/sstlinux.c b/c-version/src/sstlinux.c
deleted file mode 100644 (file)
index 422c305..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#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/c-version/src/sstlinux.h b/c-version/src/sstlinux.h
deleted file mode 100644 (file)
index c241f12..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __SSTLINUX_H
-#define __SSTLINUX_H
-
-void sound(unsigned int);
-void nosound(void);
-
-#define delay(x) usleep(x*1000)
-
-#endif
diff --git a/c-version/sst.spec b/c-version/sst.spec
deleted file mode 100644 (file)
index 445f133..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-Name: sst
-Version: 2.0
-Release: 1
-URL: http://sst.berlios.de
-Source0: %{name}-%{version}.tar.gz
-License: GPL
-Group: Games
-Summary: the classic game of Super Star Trek
-BuildRoot: %{_tmppath}/%{name}-root
-#Freshmeat-Name: strek
-
-%description
-Save the Federation from the invading Klingons!  Visit exotic planets and
-strip-mine them for dilithium!  Encounter mysterious space thingies!
-The classic Super Star Trek game from the days of slow teletypes, reloaded.
-
-%prep
-%setup -q
-
-%build
-make %{?_smp_mflags} all sst-doc.html
-
-%install
-[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
-mkdir -p "$RPM_BUILD_ROOT"%{_bindir}
-mkdir -p "$RPM_BUILD_ROOT"%{_mandir}/man6/
-cp sst "$RPM_BUILD_ROOT"%{_bindir}
-cp sst.6 "$RPM_BUILD_ROOT"%{_mandir}/man6/
-mkdir -p "$RPM_BUILD_ROOT"%{_defaultdocdir}/sst/
-cp sst.doc "$RPM_BUILD_ROOT"%{_defaultdocdir}/sst/
-cp sst-doc.html "$RPM_BUILD_ROOT"%{_defaultdocdir}/sst/index.html
-
-%clean
-[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
-
-%files
-%doc README COPYING
-%defattr(-,root,root,-)
-%{_mandir}/man6/sst.6*
-%{_bindir}/sst
-%{_defaultdocdir}/sst/sst.doc
-%{_defaultdocdir}/sst/index.html
-
-%changelog
-
-* Thu Apr 14 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.0-1
-- First release under new management.
-
-
diff --git a/historic/README b/historic/README
new file mode 100644 (file)
index 0000000..5996e82
--- /dev/null
@@ -0,0 +1,13 @@
+This directory contains historic versions of this game.
+
+The c-version directory contains a buildable, runnable version from judt before
+the game was translated to Python by ESR in 2006; it's ESR's translatoion of 
+the UT FORTRAN version.
+
+The mayfield.basic file is Mayfield's 1972 version for HP basic, the first
+rewrite of his original 1971 game and probably the oldest version still
+in existence.
+
+The UT-Trek.basic file the Grady Hicks version, from 1973.  This code,
+or much like it, was what the authors of UT Trek wanted to replace.
+
diff --git a/historic/UT-Trek.basic b/historic/UT-Trek.basic
new file mode 100644 (file)
index 0000000..452bf0a
--- /dev/null
@@ -0,0 +1,1192 @@
+1  PRINT "U. OF TEXAS STAR TREK GAME BY GRADY HICKS AND JIM KORP."
+2  PRINT "GENERAL IDEA STOLEN FROM PENN. U. BY HICKS."
+3  PRINT "VASTLY IMPROVED, AND ADAPTED TO TAURUS BY KORP, 5 APRIL 73."
+4  GOSUB 9980
+5  PRINT "   BE CAREFUL AND HAVE A GOOD TIME."
+6  PRINT
+7  PRINT
+8  X8=RND(0)
+9  DIM Q$(10)
+10  DIM G(8,8),Q(8,8),D(8),K(9,3),N(3)
+11  DIM C$(20)
+12  GOSUB 8050
+13  PRINT "   TO PLAY SHORT VERSION, TYPE 1 ---"
+14  PRINT "   TO PLAY REGULAR VERSION, TYPE 2:";
+15  INPUT V
+16  IF V = 1 THEN 20
+17  IF V = 2 THEN 20
+18  PRINT
+19  GOTO 13
+20  T0=INT(RND(0)*20+20)*100
+21  T=T0
+22  T9=40
+23  E0=3000
+24  E=3000
+25  P0=10
+26  P=10
+27  S9=200
+29  GOSUB 8200
+30  DEF FNO(F)=SQR((K(F,1)-S1)^2+(K(F,2)-S2)^2)
+32  Q1=INT(RND(0)*8+1)
+34  Q2=INT(RND(0)*8+1)
+35  F=1
+40  FOR I=1 TO 7
+42  D(I)=0
+44  NEXT I
+62  S1=INT(RND(0)*8+1)
+64  S2=INT(RND(0)*8+1)
+65  DIM F$(12)
+66  DIM N$(15)
+72  REM: SET UP GALAXY
+75  B9=0
+76  LET E4=W3=A9=C5=0
+77  Z$="DOWN"
+80  K9=0
+85  FOR I=1 TO 8
+90  FOR J=1 TO 8
+91  R=RND(0)*64
+95  IF V=2 THEN 150
+100  T9=20
+
+110  IF R>=.28 THEN 114
+111  K3=4
+112  GOTO 135
+114  IF R>=1.78 THEN 118
+115  K3=3
+116  GOTO 135
+118  IF R>=5.28  THEN 122
+119  K3=2
+120  GOTO 135
+122  IF R>=9.28 THEN 130
+123  K3=1
+124  GOTO 135
+130  K3=0
+135  K9=K9+K3
+145  GOTO 206
+150  REM: DETERMINE NUMBER OF KLINGONS, BASES AND STARS.
+152  IF R>=.01 THEN 156
+153  K3=9
+154  GOTO 195
+156  IF R>=.10 THEN 160
+157  K3=8
+158  GOTO 195
+160  IF R>=.30 THEN 164
+161  K3=7
+162  GOTO 195
+164  IF R>=.80 THEN 168
+165  K3=6
+166  GOTO 195
+168  IF R>=1.25 THEN 172
+169  K3=5
+170  GOTO 195
+172  IF R>=2.00 THEN 176
+173  K3=4
+174  GOTO 195
+176  IF R>=5.28 THEN 180
+177  K3=3
+178  GOTO 195
+180  IF R>=8.28 THEN 183
+181  K3=2
+182  GOTO 195
+183  IF R>=13.28 THEN 190
+184  K3=1
+185  GOTO 195
+190  K3=0
+195  K9=K9+K3
+200  B3=RND(0)
+202  IF B3<=.97 THEN 206
+204  B3=1
+205  GOTO 221
+206  B3=0
+221  B9=B9+B3
+230  S3=INT(RND(0)*8+1)
+235  G(I,J)=K3*100+B3*10+S3
+250  NEXT J
+260  NEXT I
+265  K0=K9
+270  IF B9>0 THEN 285
+271  I=INT(RND(0)*8+1)
+272  J=INT(RND(0)*8+1)
+275  G(I,J)=G(I,J)+10
+276  B9=1
+285  LET P2=1
+294  PRINT
+295  PRINT "   PLEASE TYPE A SECRET PASSWORD:";
+296  INPUT X$
+297  PRINT
+298  LET N1=N9=N7=A7=0
+300  REM: DETERMINE KLINGON COMMANDER
+302  IF A9<>0 THEN 320
+304  R1=INT(RND(0)*8+1)
+306  R2=INT(RND(0)*8+1)
+308  C2=R1
+310  C3=R2
+312  G(C2,C3)=G(C2,C3)+100
+314  K9=K9+1
+315  K0=K9
+316  A9=A9+1
+320  REM: CONTINUE
+399  GOTO 9045
+400  REM: SET UP QUADRANT
+405  K3=B3=S3=0
+410  IF Q1<1 THEN 500
+420  IF Q1>8 THEN 500
+430  IF Q2<1 THEN 500
+440  IF Q2>8 THEN 500
+450  X=G(Q1,Q2)/99.999
+460  K3=INT(X)
+470  B3=INT((X-K3)*10.0)
+480  S3=G(Q1,Q2)-INT(G(Q1,Q2)*.1)*10
+490  'MAT K=ZER
+491  FOR I=1 TO 8
+492  FOR J=1 TO 8
+493  Q(I,J)=0
+494  NEXT J
+495  NEXT I
+500  FOR I=1 TO 8
+510  FOR J=1 TO 8
+520  Q(I,J)=0
+530  NEXT J
+540  NEXT I
+545  IF N1<>1 THEN 550
+548  Q(S1,S2)=5
+549  GOTO 560
+550  Q(S1,S2)=1
+560  FOR I=1 TO K3
+570  GOSUB 9000
+580  Q(R1,R2)=2
+590  K(I,1)=R1
+591  K(I,2)=R2
+593  K(I,3)=S9
+600  NEXT I
+601  IF Q1<>C2 THEN 610
+602  IF Q2<>C3 THEN 610
+603  K(I,3)=800
+605  Q(K(I,1),K(I,2))=6
+610  FOR I=1 TO B3
+620  GOSUB 9000
+630  Q(R1,R2)=3
+640  NEXT I
+650  FOR I=1 TO S3
+660  GOSUB 9000
+670  Q(R1,R2)=4
+680  NEXT I
+690  A=-1
+691  IF P2=1 THEN 700
+693  GOSUB 5000
+694  IF E<=0 THEN 5200
+699  GOTO 955
+700  REM: SHORT RANGE SENSOR SCAN
+702  P2=P2+1
+705  LET T8=S1-1
+706  LET U=S1+1
+707  LET M=S2-1
+708  LET N=S2+1
+709  IF T8>=1 THEN 711
+710  T8=1
+711  IF U<=8 THEN 713
+712  U=8
+713  IF M>=1 THEN 715
+714  M=1
+715  IF N<=8 THEN 720
+716  N=8
+720  FOR I=T8 TO U
+725  FOR J=M TO N
+735  IF Q(I,J)<>3 THEN 740
+736  C$="DOCKED"
+737  GOSUB 7700
+739  GOTO 801
+740  NEXT J
+745  NEXT I
+770  IF K3>0 THEN 790
+775  IF E<E0*.1 THEN 800
+780  C$="GREEN"
+785  GOTO 801
+790  C$="RED"
+795  GOTO 801
+800  C$="YELLOW"
+801  IF A<0 THEN 803
+802  GOTO 804
+803  GOSUB 5000
+804  IF E<=0 THEN 5200
+805  IF D(2) >= 0 THEN 830
+815  PRINT "SHORT RANGE SENSORS ARE OUT "
+820  PRINT
+825  GOTO 955
+830  PRINT "----------------------"
+835  FOR I=1 TO 8
+836  FOR J=1 TO 8
+838  PRINT Q$(Q(I,J)+1);" ";
+840  NEXT J
+841  PRINT "   ";
+845  GOSUB 854
+847  NEXT I
+848  PRINT "--------------------------"
+849  GOTO 955
+854  IF I>1 THEN 859
+855  PRINT "STARDATE         "T
+856  GOTO 900
+859  IF I>2 THEN 864
+860  PRINT "CONDITION        "C$
+861  GOTO 900
+864  IF I>3 THEN 869
+865  PRINT "QUADRANT         "Q1;"-"Q2
+866  GOTO 900
+869  IF I>4 THEN 874
+870  PRINT "SECTOR           "S1;"-"S2
+871  GOTO 900
+874  IF I>5 THEN 879
+875  PRINT "ENERGY           "E
+876  GOTO 900
+879  IF I>6 THEN 884
+880  PRINT "PHOTON TORPEDOES "P
+881  GOTO 900
+884  IF I>7 THEN 890
+885  PRINT "KLINGONS LEFT    "K9
+886  GOTO 900
+890  PRINT "ENERGY SHIELDS   "Z$
+900  RETURN
+955  IF N9<>1 THEN 959
+956  GOSUB  7950
+957  IF N7=1 THEN 3582
+958  N9=2
+959  PRINT "COMMAND:";
+960  INPUT A
+961  IF C$<>"DOCKED" THEN 964
+962  GOSUB 7700
+964  GOTO 7100
+974  PRINT
+975  PRINT "   0 = SET COURSE"
+980  PRINT "   1 = SHORT RANGE SENSOR SCAN"
+985  PRINT "   2 = LONG RANGE SENSOR SCAN"
+990  PRINT "   3 = FIRE PHASERS"
+995  PRINT "   4 = FIRE PHOTON TORPEDOES"
+1000  PRINT "   5 = DAMAGE CONTROL REPORT"
+1005  PRINT "   6 = SELF-DESTRUCT"
+1006  PRINT "   7 = ABANDON SHIP"
+1007  PRINT "   8 = ACTIVATE ENERGY SHIELDS"
+1008  PRINT "   9 = DEACTIVATE ENERGY SHIELDS"
+1009  PRINT "   10 = FIRE EXPERIMENTAL DEATH RAY"
+1018  IF H6=1 THEN 9946
+1019  PRINT
+1020  GOTO 955
+1030  REM: WARP DRIVE
+1035  C$="MOVING"
+1040  PRINT "COURSE (1-8.9999):";
+1050  INPUT C1
+1060  IF C1=0 THEN 955
+1070  IF C1<1 THEN 959
+1080  IF C1>= 9 THEN 1040
+1090  PRINT "WARP FACTOR (0-12):";
+1100  INPUT W1
+1110  IF W1<0 THEN 959
+1120  IF W1>12 THEN 959
+1130  IF W1<=.25 THEN 1163
+1140  IF D(1) >= 0 THEN 1163
+1150  PRINT "WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .25"
+1160  GOTO 1040
+1163  GOTO 7500
+1164  E=E-C5
+1165  IF E<=0 THEN 5200
+1168  IF W1=12 THEN 3500
+1170  REM: THIS IS A CONTINUE CARD
+1180  GOSUB 5000
+1185  IF N9=1 THEN 955
+1190  IF E <=0 THEN 5230
+1200  FOR I=1 TO 7
+1215  IF D(I)=0 THEN 1230
+1220  D(I)=D(I)+2
+1222  IF D(I)<0 THEN 1230
+1225  D(I)=0
+1230  NEXT I
+1240  IF RND(0)>.20 THEN 1320
+1250  R1=INT(RND(0)*7+1)
+1260  IF RND(0)>.5 THEN 1300
+1270  D(R1)=D(R1)-(RND(0)*5+1)
+1280  PRINT "*** SPACE STORM, ";
+1281  GOSUB 6000
+1283  PRINT F$" DAMAGED ***"
+1290  GOTO 1320
+1300  FOR I=R1 TO 7
+1301  IF D(I)<0 THEN 1307
+1302  NEXT I
+1303  FOR I=1 TO R1-1
+1304  IF D(I)<0 THEN 1307
+1305  NEXT I
+1306  GOTO 1320
+1307  R1=I
+1308  D(I)=D(I)+RND(0)*5+1
+1309  IF D(I)<=0 THEN 1311
+1310  D(I)=0
+1311  PRINT "*** TEMPORARY TRUCE, ";
+1312  GOSUB 6000
+1313  PRINT F$" STATE OF REPAIR IMPROVED ***"
+1320  N=INT(W1*8)
+1322  E=E-N-N+5
+1324  T=T+1
+1326  Q(S1,S2)=0
+1327  X=S1
+1328  Y=S2
+1330  IF T>T0+T9 THEN 5200
+1340  GOSUB 3460
+1350  FOR I=1 TO N
+1352  S1=S1+X1
+1354  S2=S2+X2
+1356  X3=INT(S1+.5)
+1357  Y3=INT(S2+.5)
+1370  IF S1<.5 THEN 1480
+1375  IF S2<.5 THEN 1480
+1380  IF S1>=8.5 THEN 1480
+1385  IF S2>=8.5 THEN 1480
+1388  IF Q(X3,Y3)<>0 THEN 1392
+1390  NEXT I
+1391  GOTO 1460
+1392  LET Z5=Q(X3,Y3)
+1393  IF Z5=6 THEN 6300
+1394  IF Z5<>2 THEN 1405
+1400  GOTO 6300
+1405  PRINT
+1406  GOSUB 7900
+1407  PRINT N$;"BLOCKED BY OBJECT AT SECTOR"S1;"-"S2
+1408  S1=S1-X1
+1410  S2=S2-X2
+1460  S1=INT(S1+.5)
+1465  S2=INT(S2+.5)
+1467  Q(S1,S2)=A5
+1470  GOTO 955
+1480  Q1=INT(Q1+W1*X1+(X-.5)/8)
+1481  Q2=INT(Q2+W1*X2+(Y-.5)/8)
+1482  IF Q1>=1 THEN 1485
+1483  Q1=1
+1484  Z2=1
+1485  IF Q1<=8 THEN 1488
+1486  Q1=8
+1487  Z2=1
+1488  IF Q2>=1 THEN 1491
+1489  Q2=1
+1490  Z2=1
+1491  IF Q2<=8 THEN 1494
+1492  Q2=8
+1493  Z2=1
+1494  IF Z2<>1 THEN 1497
+1496  GOSUB 8970
+1497  PRINT
+1498  IF G(Q1,Q2)>999 THEN 7650
+1499  Z2=0
+1500  S1=INT(RND(0)*8+1)
+1510  S2=INT(RND(0)*8+1)
+1550  GOTO 400
+1600  REM: LONG RANGE SENSOR SCAN
+1610  IF D(3) >= 0 THEN 1640
+1620  PRINT "LONG RANGE SENSORS ARE INOPERABLE"
+1625  PRINT
+1630  GOTO 955
+1640  PRINT "LONG RANGE SENSOR SCAN FOR QUADRANT"Q1","Q2
+1645  PRINT "----------------- '"
+1660  FOR I=Q1-1 TO Q1+1
+1670  N(1)=N(2)=N(3)=0
+1680  FOR J=Q2-1 TO Q2+1
+1690  IF I<1 THEN 1740
+1700  IF I>8 THEN 1740
+1710  IF J<1 THEN 1740
+1720  IF J>8 THEN 1740
+1730  N(J-Q2+2)=G(I,J)
+1740  NEXT J
+1750  PRINT ":"N(1);":"N(2);":"N(3)
+1760  PRINT "------------------- '"
+1770  NEXT I
+1775  PRINT
+1780  GOTO 955
+1800  REM: PHASER CONTROL
+1810  IF D(4) >= 0 THEN 1832
+1820  PRINT "PHASER CONTROL IS DISABLED"
+1825  PRINT
+1830  GOTO 955
+1832  IF C5=0 THEN 1840
+1834  PRINT "YOU MUST LOWER YOUR ENERGY SHIELDS TO FIRE."
+1836  PRINT
+1837  GOTO 959
+1840  PRINT "PHASERS LOCKED ON TARGET.  ENERGY AVAILABLE = "E
+1850  PRINT "NUMBER OF UNITS TO FIRE:";
+1860  INPUT X
+1870  IF X <= 0 THEN 955
+1880  IF E-X<0 THEN 1840
+1890  E=E-X
+1895  IF K3=0 THEN 2010
+1898  W2=K3
+1900  FOR I=1 TO 9
+1910  IF K(I,3) <= 0 THEN 1990
+1929  H=(X)/(FNO(I))*(3.0+RND(0))
+1930  K(I,3)=K(I,3)-(H/W2)
+1940  PRINT H/W2;"UNIT HIT ON KLINGON AT SECTOR"K(I,1);"-"K(I,2)
+1950  PRINT "("K(I,3);"LEFT)"
+1960  IF K(I,3)>0 THEN 1990
+1970  GOSUB 4500
+1980  IF K9 <= 0 THEN 5300
+1990  NEXT I
+1995  IF K3<=0 THEN 2020
+2000  GOSUB 5000
+2010  IF E <= 0 THEN 5250
+2020  GOTO 955
+3000  REM: PHOTON TORPEDOES
+3010  IF D(5) >= 0 THEN 3040
+3020  PRINT "PHOTON TUBES ARE NOT OPERATIONAL"
+3025  PRINT
+3030  GOTO 955
+3040  IF P>0 THEN 3062
+3050  PRINT "ALL PHOTON TORPEDOES EXPENDED"
+3060  GOTO 955
+3062  IF C5=0 THEN 3068
+3064  PRINT "YOU MUST LOWER YOUR ENERGY SHIELDS TO FIRE."
+3066  PRINT
+3067  GOTO 959
+3068  PRINT "DO YOU WISH TO FIRE A SPREAD:";
+3069  INPUT M$
+3070  PRINT "TORPEDO COURSE (1-8.9999):";
+3080  INPUT C1
+3090  IF C1=0 THEN 955
+3100  IF C1<1 THEN 3070
+3110  IF C1>=9 THEN 3070
+3111  IF P<3 THEN 3120
+3116  IF M$="YES" THEN 6500
+3120  GOSUB 3460
+3130  X=S1
+3132  Y=S2
+3134  P=P-1
+3140  PRINT "TORPEDO TRACK:";
+3150  X=X+X1
+3155  Y=Y+X2
+3160  IF X<.5 THEN 3422
+3165  IF Y<.5 THEN 3422
+3170  IF X>=8.5 THEN 3422
+3175  IF Y>=8.5 THEN 3422
+3200  PRINT X;"-"Y;
+3202  X5=INT(X+.5)
+3204  Y5=INT(Y+.5)
+3210  IF Q(X5,Y5)<>0 THEN 3230
+3220  GOTO 3150
+3230  LET F7=Q(X5,Y5)
+3236  IF F7=1 THEN 3150
+3237  IF F7=2 THEN 3244
+3238  IF F7=3 THEN 3301
+3239  IF F7=4 THEN 3323
+3240  IF F7=6 THEN 3244
+3244  PRINT
+3245  PRINT "*** KLINGON DESTROYED ***"
+3250  K3=K3-1
+3255  K9=K9-1
+3260  IF K9<=0 THEN 5300
+3271  FOR I=1 TO 9
+3272  IF K(I,1)<>X5 THEN 3275
+3273  IF K(I,2)<>Y5 THEN 3275
+3274  GOTO 3400
+3275  NEXT I
+3301  Q(X5,Y5)=0
+3310  PRINT
+3311  PRINT "*** STARBASE DESTROYED ... CONGRATULATIONS ***"
+3313  B3=B3-1
+3315  GOTO 3410
+3323  Q(X5,Y5)=0
+3334  PRINT
+3335  PRINT "***STAR DESTROYED***"
+3340  S3=S3-1
+3345  IF S3>=0 THEN 3410
+3347  S3=0
+3350  GOTO 3410
+3400  K(I,3)=0
+3401  Q(X5,Y5)=0
+3410  G(Q1,Q2)=K3*100+B3*10+S3
+3420  GOTO 3430
+3422  PRINT
+3425  PRINT "TORPEDO MISSED"
+3430  IF E4=0 THEN 3439
+3432  E4=E4+1
+3433  IF E4>3.5 THEN 3438
+3435  GOTO 6520
+3438  IF K3<=0 THEN 3445
+3439  GOSUB 5000
+3440  IF E <= 0 THEN 5230
+3445  E4=0
+3450  GOTO 955
+3460  X2=COS((C1-1)*.785398)
+3470  X1=-SIN((C1-1)*.785398)
+3480  RETURN
+3500  W9=RND(0)
+3502  IF T>T0+15 THEN 3510
+3504  PRINT "WARP 12 CANNOT BE USED UNTIL STARDATE"T0+16
+3506  GOTO 1040
+3510  PRINT "SPEED APPROACHING WARP 12."
+3520  PRINT "ENGINES OPERATING ABOVE DANGER LEVEL."
+3530  PRINT "ALL SAFETY DEVICES DISFUNCTIONAL."
+3540  PRINT "CRITICAL OVERHEATING--SPONTANEOUS IMPLOSION IMMINENT."
+3570  IF W9>.40 THEN 3600
+3575  FOR I=1 TO 2
+3576  PRINT "*****************************************************"
+3577  NEXT I
+3578  GOSUB 7900
+3580  PRINT "*** ENTROPY OF"N$;"MAXIMIZED **************"
+3582  GOSUB 9980
+3583  PRINT "  YOU ATE THAT ONE."
+3584  GOTO 9992
+3600  IF W9>.55 THEN 3700
+3610  PRINT
+3620  PRINT " YOU ARE TRAVELLING BACK IN TIME."
+3630  T=T-6
+3640  PRINT "*** STARDATE ="T+1
+3650  GOTO 1170
+3700  IF W9>.60 THEN 3800
+3710  PRINT
+3720  PRINT " YOU ARE TRAVELLING BACK IN TIME."
+3730  T=T-11
+3740  PRINT "*** STARDATE ="T+1
+3750  GOTO 1170
+3800  IF W9>.70 THEN 3900
+3810  PRINT
+3820  PRINT " YOU ARE TRAVELLING FORWARD IN TIME."
+3830  T=T+5
+3840  IF T>T0+T9 THEN 5200
+3850  PRINT "*** STARDATE ="T
+3860  GOTO 1170
+3900  PRINT
+3910  PRINT "NUCLEAR REACTOR CHAIN REACTION QUENCHED."
+3920  PRINT "*** TIME PORTAL MISSED ***"
+3930  GOTO 1170
+4000  REM: DAMAGE CONTROL REPORT
+4010  IF D(6) >= 0 THEN 4040
+4020  PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE"
+4025  PRINT
+4030  GOTO 955
+4040  PRINT
+4050  PRINT "DEVICE         STATE OF REPAIR"
+4060  FOR I=1 TO 7
+4065  R5=I-.5
+4066  GOSUB 6000
+4070  PRINT F$,D(I)
+4080  NEXT I
+4090  PRINT
+4100  GOTO 955
+4200  REM:
+4500  PRINT "*** KLINGON AT SECTOR"K(I,1);"-"K(I,2);"DESTROYED."
+4510  K3=K3-1
+4520  K9=K9-1
+4530  Q(K(I,1),K(I,2))=0
+4540  G(Q1,Q2)=K3*100+B3*10+S3
+4550  RETURN
+5000  REM: KLINGON ATTACK
+5002  GOSUB 7900
+5003  IF K3<=0 THEN 5110
+5005  IF C$ <> "DOCKED" THEN 5017
+5010  PRINT "STARBASE SHIELDS PROTECT THE"N$
+5012  RETURN
+5017  IF C5=0 THEN 5022
+5018  PRINT "** KLINGONS ATTACK-- ENERGY SHIELDS PROTECT"N$
+5020  GOTO 5110
+5022  IF K3*150<E THEN 5049
+5023  IF N1<>0 THEN 5049
+5024  PRINT
+5025  PRINT "   KLINGON COMMANDER TO ENTERPRISE---"
+5026  PRINT "AS YOU WELL KNOW, YOU ARE DANGEROUSLY LOW ON ENERGY"
+5027  PRINT "AND WILL PROBABLY BE DESTROYED BY MY NEXT ATTACK."
+5028  PRINT "AS AN OFFICER AND GENTLEMAN, I OFFER YOU A CHANCE TO"
+5029  PRINT "SAVE YOURSELF AND YOUR CREW----"
+5032  PRINT "    DO YOU SURRENDER:";
+5033  INPUT S$
+5034  IF S$<>"YES" THEN 5049
+5035  A7=1
+5036  N9=1
+5038  GOTO 5110
+5049  PRINT
+5050  FOR I=1 TO 9
+5051  IF K(I,3) <= 0 THEN 5100
+5060  H=(K(I,3)/FNO(I))*(2+RND(0))
+5070  E=E-H
+5075  GOSUB 7900
+5080  PRINT H;"UNIT HIT ON"N$;"FROM KLINGON, SECTOR "K(I,1);"-"K(I,2)
+5082  IF H<=180 THEN 5090
+5083  R5=INT(RND(0)*7+1)
+5084  D(R5)=D(R5)-(RND(0)*5+1)
+5085  PRINT "*** CRITICAL HIT,";
+5086  GOSUB 6000
+5087  PRINT F$" DAMAGED ***"
+5090  PRINT "("E;"LEFT)"
+5100  NEXT I
+5105  PRINT
+5110  RETURN
+5200  REM: LOSE
+5210  GOSUB 9985
+5220  PRINT "IT IS STARDATE"T
+5230  PRINT
+5250  GOSUB 7900
+5255  PRINT "THE"N$;"HAS BEEN DESTROYED."
+5260  PRINT "THERE ARE STILL"K9;"KLINGON BATTLE CRUISERS."
+5270  PRINT "THE FEDERATION WILL BE CONQUERED."
+5280  PRINT "YOU ARE DEAD, YOU INCOMPETENT FOOL."
+5290  GOTO 9992
+5300  REM: WIN
+5310  GOSUB 9985
+5320  PRINT "IT IS STARDATE"T
+5330  PRINT "THE LAST KLINGON BATTLE CRUISER IN THE GALAXY HAS BEEN"
+5331  PRINT "DESTROYED."
+5340  PRINT "THE FEDERATION HAS BEEN SAVED."
+5350  PRINT "YOU HAVE BEEN PROMOTED TO COMMODORE EMERITUS."
+5355  IF N1<>0 THEN 5380
+5360  PRINT K0;"KLINGONS IN"T-T0;"YEARS.  RATING="INT(K0/(T-T0)*1000)
+5370  GOTO 9992
+5380  PRINT K0;"KLINGONS IN"T-T0;"YEARS."
+5382  IF A7=5 THEN 5392
+5385  PRINT "ENTERPRISE CAPTURED."
+5390  PRINT "RATING ="INT(K0/(T-T0)*1000-1000)
+5391  GOTO 9992
+5392  PRINT "ENTERPRISE DESTROYED INTENTIONALLY."
+5393  PRINT "RATING ="INT(K0/(T-T0)*1000-500)
+5395  GOTO 9992
+6000  REM: SELECT DAMAGED DEVICE
+6002  IF A+1<>1 THEN 6010
+6004  R5=R1
+6010  IF R5>1 THEN 6040
+6020  F$="WARP ENGINES"
+6030  GOTO 8000
+6040  IF R5>2 THEN 6070
+6050  F$="S.R. SENSORS"
+6060  GOTO 8000
+6070  IF R5>3 THEN 6090
+6075  F$="L.R. SENSORS"
+6080  GOTO 8000
+6090  IF R5>4 THEN 6100
+6093  F$="PHASER CNTRL"
+6097  GOTO 8000
+6100  IF R5>5 THEN 6110
+6103  F$="PHOTON TUBES"
+6107  GOTO 8000
+6110  IF R5>6 THEN 6115
+6111  F$="DAMAGE CNTRL"
+6112  GOTO 8000
+6115  F$="ENERGY SHLDS"
+6118  GOTO 8000
+6300  REM: RAMMING KLINGON
+6301  PRINT
+6302  Q(S1,S2)=0
+6304  K3=K3-1
+6305  K9=K9-1
+6310  Z$="DOWN"
+6318  FOR I=1 TO 9
+6320  IF K(I,1)<>X3 THEN 6330
+6322  IF K(I,2)<>Y3 THEN 6330
+6323  Z6=K(I,1)
+6324  Z7=K(I,2)
+6325  GOTO 6360
+6330  NEXT I
+6360  K(I,3)=0
+6362  GOSUB 7900
+6363  Q(X3,Y3)=A5
+6365  GOTO 6370
+6370  G(Q1,Q2)=K3*100+B3*10+S3
+6380  PRINT "*** EMERGENCY ALERT ***"
+6381  PRINT "*** COLLISION IMMINENT ***"
+6382  GOSUB 9980
+6383  GOSUB 7900
+6384  PRINT N$;"RAMS KLINGON AT SECTOR"Z6;"-"Z7
+6385  PRINT "*** KLINGON DESTROYED,"N$;"HEAVILY DAMAGED. ***"
+6386  FOR I=1 TO 7
+6387  D(I)=D(I)-(RND(0)*4+1)
+6388  NEXT I
+6389  C5=0
+6390  E=E-500
+6391  IF K9<=0 THEN 5300
+6395  IF E<=0 THEN 5230
+6396  S1=Z6
+6397  S2=Z7
+6398  A=2
+6399  GOTO 4040
+6500  REM: TORPEDO SPREAD FORMATION
+6507  PRINT "SPREAD ANGLE (0.05-0.30):";
+6508  INPUT E5
+6509  IF E5=0 THEN 959
+6510  IF E5<0.05 THEN 6507
+6511  IF E5>0.30 THEN 6507
+6515  E4=1
+6520  PRINT "NUMBER"E4;
+6522  IF E4>1.5 THEN 6530
+6524  C1=C1-E5
+6525  GOTO 3120
+6530  C1=C1+E5
+6535  GOTO 3120
+7100  REM: COMMAND LINK
+7105  IF A+1 = 1 THEN 1030
+7106  IF A+1 = 2 THEN 700
+7107  IF A+1 = 3 THEN 1600
+7108  IF A+1 = 4 THEN 1800
+7109  IF A+1 = 5 THEN 3000
+7110  IF A+1 = 6 THEN 4000
+7111  IF A+1 = 7 THEN 8100
+7112  IF A+1 = 8 THEN 7400
+7113  IF A+1 = 9 THEN 7800
+7114  IF A+1 = 10 THEN 7850
+7115  IF A+1 = 11 THEN 7200
+7125  GOTO 974
+7200  REM: DEATH RAY
+7202  IF T>T0+18 THEN 7208
+7204  PRINT " DEATH RAY CANNOT BE USED UNTIL STARDATE"T0+19
+7205  PRINT
+7206  GOTO 959
+7208  IF W3<.05 THEN 7215
+7210  PRINT " DEATH RAY PERMANENTLY OUT OF ORDER."
+7212  PRINT
+7214  GOTO 959
+7215  IF C5=0 THEN 7225
+7220  PRINT " YOU MUST LOWER YOUR SHIELDS TO FIRE."
+7222  PRINT
+7223  GOTO 959
+7225  W3=RND(0)
+7227  PRINT
+7228  IF W3>.35 THEN 7260
+7230  PRINT " *ANTI-MATTER OVERLOAD."
+7231  PRINT " TEMPORARY PSUEDO-STARS CREATED FROM ENERGY."
+7232  FOR I=1 TO 8
+7233  FOR J=1 TO 8
+7235  IF Q(I,J)<>0 THEN 7240
+7238  Q(I,J)=4
+7240  NEXT J
+7241  NEXT I
+7245  PRINT
+7247  GOTO 830
+7260  IF W3>.50 THEN 7280
+7263  PRINT "*** DEATH RAY BACKFIRES ***"
+7265  PRINT "*** BETTER LUCK NEXT TIME ***"
+7270  GOTO 3575
+7280  IF W3>.60 THEN 7310
+7283  PRINT "*** DEATH RAY ANNIHILATES ALL KLINGONS IN QUADRANT"Q1;"-"Q2
+7285  K9=K9-K3
+7286  IF K9<=0 THEN 5300
+7287  FOR I=1 TO 8
+7288  FOR J=1 TO 8
+7289  IF Q(I,J)<>6 THEN 7292
+7290  Q(I,J)=0
+7292  IF Q(I,J)<>2 THEN 7294
+7293  Q(I,J)=0
+7294  NEXT J
+7295  NEXT I
+7296  K3=0
+7298  G(Q1,Q2)=INT(B3*10+S3)
+7300  GOTO 959
+7310  IF W3>.75 THEN 7325
+7312  PRINT "*THERMAL REACTOR ENERGY DRAIN."
+7314  E=E-(.95*E)
+7316  PRINT .95*E"UNITS OF ENERGY BURNED."
+7320  GOTO 7283
+7325  IF W3>.95 THEN 7350
+7328  PRINT "*MATTER/ANTI-MATTER TRANSFORMATION."
+7330  IF K3>0 THEN 7334
+7332  GOTO 7231
+7334  PRINT "KLINGONS HIT BY MAIN BEAM DUPLICATED."
+7335  P8=K3
+7338  FOR I=1 TO P8
+7339  IF K3>8 THEN 7345
+7341  K3=K3+1
+7342  K9=K9+1
+7344  NEXT I
+7345  G(Q1,Q2)=K3*100+B3*10+S3
+7346  P2=1
+7349  GOTO 1500
+7350  PRINT "*** DEATH RAY GOES CRAZY ***"
+7352  PRINT "*** DESTROYS EVERY KLINGON IN THE GALAXY ***"
+7353  PRINT "*** ALSO DESTROYS ENTERPRISE ***"
+7354  A7=N1=5
+7360  GOTO 5300
+7400  REM: ABANDON SHIP
+7401  IF N1=0 THEN 7404
+7402  PRINT "THE FAIRIE QUEENE CANNOT BE ABANDONED."
+7403  GOTO 959
+7404  PRINT
+7405  IF A7<>1 THEN 7420
+7410  PRINT "** YOU MAY NOT ABANDON SHIP AFTER YOU HAVE BEEN "
+7411  PRINT "ASKED TO SURRENDER."
+7415  PRINT
+7416  GOTO 959
+7420  PRINT "*** ABANDON SHIP ***"
+7421  PRINT "*** ABANDON SHIP ***"
+7425  PRINT
+7426  PRINT "SERIES ENTER-BLITZ INITIATED."
+7429  PRINT "FAIL-SAFE AUTO-OVERRIDE INSERTED."
+7433  PRINT "ENTERPRISE COMMANDER AND CREW ESCAPE IN SHUTTLE CRAFT."
+7435  PRINT
+7440  PRINT "*** ENTERPRISE REDUCED TO SUB-ATOMIC PARTICLES ***"
+7441  PRINT
+7445  A7=5
+7446  N1=1
+7448  N9=1
+7450  GOTO 955
+7500  REM: SUPERNOVA
+7501  IF V=2 THEN 7506
+7502  IF RND(0)>.15 THEN 7600
+7504  GOTO 7508
+7506  IF RND(0)>.10 THEN 7600
+7508  Z3=INT(RND(0)*8+1)
+7510  Z4=INT(RND(0)*8+1)
+7515  IF G(Z3,Z4)>999 THEN 7600
+7520  S4=G(Z3,Z4)-INT(G(Z3,Z4)*.1)*10
+7525  IF S4<=0 THEN 7600
+7530  PRINT
+7535  PRINT "*************************************************"
+7540  PRINT "********* SUPERNOVA IN QUADRANT"Z3;"-"Z4
+7542  PRINT "ALL MATTER IN THIS QUADRANT CONVERTED TO ENERGY."
+7543  IF Q1<>Z3 THEN 7575
+7544  IF Q2<>Z4 THEN 7575
+7545  PRINT
+7546  GOSUB 7900
+7548  PRINT "UNFORTUNATELY, THE"N$;"WAS IN THIS QUADRANT."
+7550  GOTO 3582
+7575  PRINT "FROM NOW ON, ANY VESSEL STOPPING IN THIS QUADRANT"
+7576  PRINT "WILL BE TOTALLY ENERGIZED."
+7577  PRINT "*************************************************"
+7579  PRINT
+7580  K4=INT(G(Z3,Z4)/99.99)
+7582  B4=INT((G(Z3,Z4)/99.99-K4)*10.0)
+7584 B9=B9-B4
+7585  K9=K9-K4
+7590  G(Z3,Z4)=INT(1000.0)
+7600  GOTO 1164
+7650  REM: STARSHIP ENCOUNTERS OLD SUPERNOVA
+7655  PRINT "*** HEY STUPID.  YOU WERE WARNED NOT TO STOP IN A"
+7656  PRINT "QUADRANT WHERE A SUPERNOVA HAD OCCURRED."
+7660  GOTO 8992
+7700  REM: VARIABLE RESUPPLY
+7701  IF N1=1 THEN 7710
+7703  E=3000
+7705  P=10
+7708  GOTO 7720
+7710  E=1500
+7715  P=5
+7720  A7=0
+7730  RETURN
+7800  REM: ACTIVATE ENERGY SHIELDS
+7802  IF D(7)>=0 THEN 7808
+7804  PRINT "ENERGY SHIELDS DISABLED."
+7806  GOTO 959
+7808  IF C5=0 THEN 7818
+7810  PRINT "ENERGY SHIELDS ALREADY ACTIVATED."
+7811  PRINT
+7812  GOTO 959
+7818  PRINT
+7819  PRINT "ENERGY SHIELDS ACTIVATED."
+7820  PRINT
+7822  C5=200
+7824  Z$="UP"
+7825  E=E-C5
+7826  IF E<=0 THEN 5200
+7828  GOSUB 5000
+7830  GOTO 959
+7850  REM: DEACTIVATE ENERGY SHIELDS
+7855  PRINT
+7860  PRINT "ENERGY SHIELDS DEACTIVATED."
+7863  PRINT
+7865  C5=0
+7868  Z$="DOWN"
+7870  GOSUB 5000
+7875  GOTO 955
+7900  REM: DETERMINE NAME
+7905  IF N1<>1 THEN 7915
+7908  A5=5
+7910  N$=" FAIRIE QUEENE "
+7912  GOTO 7920
+7915  N$=" ENTERPRISE "
+7918  A5=1
+7920  RETURN
+7950  REM: CHANGING OF THE GUARD AT BUCKINGHAM PALACE
+7951  PRINT
+7952  FOR I=1 TO 8
+7955  FOR J=1 TO 8
+7957  K3=INT(G(I,J)/99.99)
+7958  B3=INT((G(I,J)/99.99-K3)*10.0)
+7960  IF B3>0 THEN 7978
+7961  NEXT J
+7962  NEXT I
+7963  PRINT " YOU HAVE BEEN TAKEN TO KLINGON HEADQUARTERS."
+7964  PRINT "IF YOU HAD A STARBASE, YOU WOULD BE REPATRIATED"
+7965  PRINT "AND GIVEN A NEW STARSHIP TO COMMAND."
+7966  PRINT "SINCE YOU HAVE NO STARBASE, YOU WILL BE MERCILESSLY"
+7967  PRINT "TORTURED TO DEATH BY THE ARCHFIEND,"
+7968  PRINT "CECIL DYBOWSKI, SCOURGE OF THE UNIVERSE."
+7970  N7=1
+7975  GOTO 8000
+7978  N9=2
+7979  T=T+1
+7980  Q1=I
+7981  Q2=J
+7982  E=1500
+7983  P=5
+7984 N1=1
+7985  PRINT "YOU HAVE BEEN SENT BACK TO STARFLEET COMMAND."
+7987  PRINT "YOU ARE NOW IN COMMAND OF A NEW STARSHIP,"
+7988  PRINT "   THE FAIRIE QUEENE,"
+7989  PRINT "WHICH LOOKS LIKE /Q/ ON THE SCAN."
+7990  PRINT
+7992  PRINT "   YE FAIRIE QUEENE IS CURRENTLY IN QUADRANT"Q1;"-"Q2
+7994  PRINT "TRY TO BE MORE CAREFUL THIS TIME."
+7995  FOR I=1 TO 7
+7996  D(I)=0
+7997  NEXT I
+7998  PRINT
+7999  GOTO 1500
+8000  RETURN
+8050  Q$(1)="."
+8051  Q$(2)="E"
+8052  Q$(3)="K"
+8053  Q$(4)="B"
+8054  Q$(5)="*"
+8055  Q$(6)="Q"
+8056  Q$(7)="C"
+8060  RETURN
+8100  REM: SELF-DESTRUCT
+8105  PRINT
+8110  PRINT "SERIES ENTER-BLITZ INITIATED."
+8115  PRINT "IN TEN SECONDS THIS VESSEL WILL SELF-DESTRUCT."
+8116  PRINT "10"
+8117  PRINT "   9"
+8118  PRINT "      8"
+8119  PRINT "         7"
+8120  PRINT "            6"
+8122  PRINT
+8123  PRINT "T MINUS 5 SECONDS AND HOLDING."
+8124  PRINT "FAIL-SAFE MECHANISM ENGAGED.  ONLY THE COMMANDER OF"
+8125  PRINT "THE STARSHIP CAN OVERRIDE WITH HIS SECRET PASSWORD."
+8126  PRINT "SCIENCE OFFICER HICKS HAS ALREADY ENTERED HIS CORRECT"
+8127  PRINT "COUNTER-PASSWORD."
+8128  PRINT "TO CONTINUE SERIES ENTER-BLITZ, TYPE YOUR "
+8129  PRINT "SECRET PASSWORD:";
+8130  INPUT V$
+8135  IF V$<>X$ THEN 8150
+8139  PRINT
+8140  PRINT "               4"
+8141  PRINT "                  3"
+8142  PRINT "                     2"
+8143  PRINT "                        1"
+8145  GOTO 3575
+8150  PRINT
+8151  PRINT "SERIES ENTER-BLITZ TERMINATED."
+8155  PRINT
+8160  GOTO 955
+8200  REM: RANDOMIZE
+8205  PRINT
+8206  PRINT "   TYPE A WIERD NUMBER BETWEEN 0.0 AND 1.0 :";
+8207  INPUT E6
+8208  E9=RND(E6)
+8210  RETURN
+8970  REM: LEAVING GALAXY
+8975  IF F>2 THEN 8990
+8980  PRINT
+8981  PRINT "STARSHIP ENCOUNTERS END OF GALAXY."
+8982  PRINT
+8983  PRINT "FOOLISH MORTAL, YOU HAVE ATTEMPTED TO VENTURE OUT OF THE"
+8984  PRINT "GALAXY INTO SUB-SPACE.  ON THE THIRD TIME YOU TRY THIS,"
+8985  PRINT "THE LIVING GOD, KORP, WILL DESTROY YOU."
+8987  F=F+1
+8988  GOTO 8995
+8990  PRINT
+8991  PRINT "YOU HAVE DARED TO ENTER SUB-SPACE A THIRD TIME."
+8992  PRINT "FOR THIS, ************ YOU DIE ****************"
+8993  GOTO 3575
+8995  RETURN
+9000  REM: RANDOM NUMBER GENERATOR
+9010  R1=INT(RND(0)*8+1)
+9020  R2=INT(RND(0)*8+1)
+9030  IF Q(R1,R2) <> 0 THEN 9010
+9040  RETURN
+9045  PRINT
+9050  PRINT "ORDERS:  STARDATE = "T
+9060  PRINT
+9070  PRINT "   AS COMMANDER OF THE UNITED STARSHIP ENTERPRISE,"
+9080  PRINT "YOUR MISSION IS TO RID THE GALAXY OF THE DEADLY"
+9090  PRINT "KLINGON MENACE.  TO DO THIS, YOU MUST DESTROY THE "
+9100  PRINT "KLINGON INVASION FORCE OF "K9"BATTLE CRUISERS."
+9110  PRINT "YOU HAVE"T9;"SOLAR YEARS TO COMPLETE YOUR MISSION."
+9120  PRINT "(I.E. UNTIL STARDATE"T0+T9;")."
+9125  PRINT
+9130  IF B9 > 1 THEN 9133
+9131  PRINT "   YOU WILL HAVE ONE SUPPORTING STARBASE."
+9132  GOTO 9140
+9133  PRINT "   YOU WILL HAVE"B9"SUPPORTING STARBASES."
+9140  PRINT "WHEN THE ENTERPRISE DOCKS AT ONE (IS POSITIONED"
+9150  PRINT "NEXT TO ONE) IT IS RESUPPLIED WITH ENERGY AND"
+9160  PRINT "PHOTON TORPEDOES."
+9161  PRINT "THE ENTERPRISE IS CURRENTLY IN"
+9162  PRINT "QUADRANT"Q1"-"Q2"SECTOR"S1"-"S2
+9163  PRINT "DO YOU NEED FURTHER INSTRUCTIONS (REVISED 18 APRIL 73)";
+9164  INPUT A$
+9166  PRINT
+9170  IF A$<>"YES" THEN 400
+9175  GOSUB 9980
+9180  PRINT "   THE GALAXY IS DIVIDED INTO 64 QUADRANTS WITH"
+9190  PRINT "THE FOLLOWING COORDINATES:"
+9200  PRINT " Y--   1   2   3   4   5   6   7   8   '"
+9210  PRINT "   --------------------------------- X"
+9220  FOR I=1 TO 8
+9230  PRINT " ' :   :   :   :   :   :   :   :   :  "I
+9240  PRINT "   --------------------------------- '"
+9250  NEXT I
+9260  PRINT
+9270  PRINT
+9280  PRINT
+9300  PRINT "EACH QUADRANT IS SIMILARLY DIVIDED INTO 64 SECTORS."
+9310  GOSUB 9980
+9320  PRINT "::: DEVICES :::"
+9330  PRINT
+9340  PRINT "WARP ENGINES: "
+9350  PRINT
+9360  PRINT "COURSE = A REAL NUMBER FROM 1 TO 8.99999."
+9370  PRINT "NUMBERS INDICATE DIRECTION STARTING AT THE RIGHT AND"
+9380  PRINT "GOING COUNTER CLOCKWISE:"
+9390  PRINT
+9400  PRINT "        3"
+9410  PRINT "      4   2"
+9420  PRINT "         /"
+9430  PRINT "    5---*---1"
+9440  PRINT "       /"
+9450  PRINT "      6   8"
+9460  PRINT "        7"
+9470  PRINT
+9480  PRINT "WARP FACTOR = A REAL NUMBER FROM 0 TO 12."
+9490  PRINT "DISTANCE TRAVELED = INTEGER (WARP FACTOR) QUADRANTS:"
+9500  PRINT "   WARP .2 = THE ENTERPRISE TRAVELS 1 SECTOR."
+9510  PRINT "        .5 =                        4 SECTORS."
+9520  PRINT "         1 =                        1 QUADRANT."
+9530  PRINT "         2 =                        2 QUADRANTS."
+9535  PRINT
+9540  PRINT
+9550  PRINT "FOR EXAMPLE, IF YOU TRAVEL FROM:"
+9560  PRINT "QUADRANT 1 - 1, SECTOR 1 - 1, IN DIRECTION 1 AT WARP 2"
+9570  PRINT "YOU WOULD STOP AT"
+9580  PRINT "QUADRANT 1 - 3, SECTOR 1 - 1 IN THE NEXT STARDATE."
+9590  PRINT
+9591  PRINT " WHEN YOU CHANGE QUADRANTS, HOWEVER, THE POSITIONS OF"
+9592  PRINT "ALL OBJECTS IN THE NEW QUADRANT (INCLUDING THE ENTERPRISE)"
+9593  PRINT "ARE RANDOMIZED TO SIMULATE 3-D TRAVEL."
+9599  PRINT
+9600  PRINT "*** NOTE:  EVERY USE OF THE WARP ENGINES TAKES ONE"
+9610  PRINT "STARDATE.  IF THE ENTERPRISE IS BLOCKED BY SOMETHING"
+9620  PRINT "DURING INTRA-QUADRANT TRAVEL IT WILL STOP IN FRONT"
+9630  PRINT "OF IT (AND WASTE A STARDATE) ***"
+9631  PRINT
+9632  PRINT "***NOTE: THERE IS A TIME PORTAL AVAILABLE BY TRAVELLING"
+9633  PRINT "AT WARP 12.  YOU MAY BE CARRIED EITHER FORWARD OR"
+9634  PRINT "BACKWARD IN TIME, BUT THERE IS ALSO A .40 PROBABILITY"
+9635  PRINT "THAT YOU WILL BE DESTROYED IN A NUCLEAR IMPLOSION."
+9636  PRINT "A WARP FACTOR OF 12 MAY ONLY BE USED AFTER 15 SOLAR YEARS."
+9637  PRINT
+9638  PRINT "***NOTE:  IF THE ENTERPRISE RAMS A KLINGON VESSEL, EITHER"
+9639  PRINT "DELIBERATELY OR ACCIDENTLY, THE KLINGON WILL BE"
+9640  PRINT "DESTROYED AND THE ENTERPRISE HEAVILY DAMAGED."
+9649  GOSUB 9980
+9650  PRINT "SHORT RANGE SENSORS:"
+9660  PRINT
+9670  PRINT "   THE SHORT RANGE SENSORS OF THE ENTERPRISE DISPLAY"
+9680  PRINT "A DETAILED VIEW OF THE QUADRANT IT IS CURRENTLY IN."
+9690  PRINT "THE ENTERPRISE LOOKS LIKE /E/ ON THE SCREEN."
+9700  PRINT "KLINGON BATTLE CRUISERS LOOK LIKE /K/ ON THE SCREEN."
+9710  PRINT "STARBASES LOOK LIKE /B/ AND STARS LOOK LIKE * ."
+9715  PRINT "THE KLINGONS MAY HAVE A POWERFUL COMMAND SHIP, /C/."
+9720  PRINT
+9723  PRINT "***NOTE: DOCKING IS A TWO STEP PROCEDURE--FIRST YOU"
+9724  PRINT "MUST MOVE ADJACENT TO THE BASE.  THEN CONDUCT A "
+9725  PRINT "SHORT RANGE SCAN."
+9726  PRINT "WHILE DOCKED, STARBASE SHIELDS PROTECT THE STARSHIP."
+9729  PRINT
+9730  PRINT "***NOTE: CONDITION YELLOW MEANS YOU ARE DANGEROUSLY"
+9731  PRINT "LOW ON ENERGY AND SHOULD MAKE FOR A BASE POSTHASTE."
+9735  GOSUB 9980
+9736  PRINT "EXPERIMENTAL DEATH RAY"
+9737  PRINT
+9738  PRINT "   THE EXPERIMENTAL DEATH RAY, AS ITS NAME IMPLIES,"
+9739  PRINT "IS UNPREDICTABLE.  HOWEVER, ONE CAN CERTAINLY PREDICT"
+9740  PRINT "THAT, IN A GIVEN SITUATION, IT WILL DO WHATEVER IT"
+9741  PRINT "DAMN WELL PLEASES.  THERE IS A GOOD PROBABILITY THAT IT"
+9742  PRINT "WILL DESTROY MANY KLINGONS, BUT THERE COULD BE SOME"
+9743  PRINT "INTERESTING SIDE EFFECTS.  IT CAN PROBABLY ONLY BE"
+9744  PRINT "FIRED ONCE, BUT YOU NEVER KNOW.  IT CANNOT BE USED UNTIL"
+9745  PRINT "18 SOLAR YEARS HAVE PASSED."
+9757  GOSUB 9980
+9758  PRINT "LONG RANGE SENSORS:"
+9759  PRINT
+9760  PRINT "   THE LONG RANGE SENSORS OF THE ENTERPRISE DISPLAY"
+9770  PRINT "THE NUMBER OF OBJECTS IN THE 9 CLOSEST QUADRANTS,"
+9771  PRINT "WITH THE ENTERPRISE IN THE CENTRAL ONE."
+9780  PRINT "EACH DIGIT OF THE NUMBER IN EACH BOX MEANS SOMETHING:"
+9790  PRINT "   THE ONES DIGIT REPRESENTS THE NUMBER OF STARS."
+9800  PRINT "       TENS                                STARBASES."
+9810  PRINT "      HUNDREDS                             KLINGONS."
+9812  PRINT "      THOUSANDS                            SUPERNOVA."
+9820  PRINT "FOR EXAMPLE:"
+9830  PRINT "319 MEANS  3 KLINGONS, 1 STARBASE, AND 9 STARS."
+9840  PRINT "206 MEANS 2 KLINGONS, 0 STARBASES, AND 6 STARS."
+9850  PRINT "7 MEANS 0 KLINGONS, 0 STARBASES, AND 7 STARS."
+9860  GOSUB 9980
+9861  PRINT "ENERGY SHIELDS:"
+9862  PRINT
+9863  PRINT "   WHILE THE ENERGY SHIELDS OF A STARSHIP ARE ACTIVATED,"
+9864  PRINT "KLINGON ATTACKS ARE NULLIFIED.  EVERY TIME YOU MOVE WITH"
+9865  PRINT "YOUR SHIELDS UP, 200 UNITS OF ENERGY ARE USED."
+9866  PRINT "ALSO, SHIELD ACTIVATION ITSELF REQUIRES 200 UNITS."
+9867  PRINT "NOTE: YOU MUST LOWER YOUR SHIELDS TO ATTACK."
+9869  GOSUB 9980
+9870  PRINT "PHASERS:"
+9880  PRINT
+9890  PRINT "   ANY PORTION OF THE ENERGY AVAILABLE CAN BE FIRED."
+9900  PRINT "THE BATTLE COMPUTER DIVIDES THIS AMOUNT AMONG THE"
+9901  PRINT "KLINGON CRUISERS IN THE QUADRANT AND DETERMINES"
+9902  PRINT "THE VARIOUS DIRECTIONS OF FIRE.  THE EFFECTIVENESS"
+9903  PRINT "OF A HIT DEPENDS MOSTLY ON THE DISTANCE TO THE"
+9904  PRINT "TARGET.  A KLINGON BATTLE CRUISER STARTS WITH"S9
+9905  PRINT "UNITS OF ENERGY.  IT CAN FIRE AN AMOUNT EQUAL TO"
+9906  PRINT "WHATEVER ENERGY IT HAS LEFT."
+9907  PRINT
+9908  PRINT
+9909  PRINT "PHOTON TORPEDOES:"
+9910  PRINT
+9911  PRINT "   INITIALLY THE ENTERPRISE HAS"P0"PHOTON TORPEDOES."
+9912  PRINT "ONE TORPEDO DESTROYS WHATEVER IT HITS.  THE RANGE"
+9913  PRINT "OF PHOTON TORPEDOES (LIKE PHASERS) IS LIMITED TO"
+9914  PRINT "THE CURRENT QUADRANT.  THE COURSE OF A PHOTON TORPEDO"
+9915  PRINT "IS SET THE SAME WAY AS THAT OF THE ENTERPRISE."
+9916  PRINT "YOU MAY, IF YOU WISH, FIRE A SPREAD OF THREE TORPEDOES"
+9917  PRINT "AT ONCE.  THERE IS A TIME LAG IN LAUNCHING THEM, THE ONE"
+9918  PRINT "WITH THE LOWEST NUMERICAL COURSE BEING FIRED FIRST."
+9919  PRINT "FOR EXAMPLE, A TORPEDO COURSE OF 3.49 WITH A SPREAD"
+9920  PRINT "ANGLE OF 0.24 WOULD FIRE TORPEDOES AT DIRECTIONS"
+9921  PRINT "3.25, 3.49, AND 3.73 ."
+9924  GOSUB 9980
+9925  PRINT "DAMAGE CONTROL REPORT:"
+9926  PRINT "   THE DAMAGE CONTROL REPORT LISTS THE MAIN DEVICES AND"
+9927  PRINT "THEIR STATE OF REPAIR.  A NEGATIVE STATE OF REPAIR"
+9928  PRINT "INDICATES A DISABLES DEVICE.  DEVICES CAN BE DAMAGED OR"
+9929  PRINT "REPAIRED BY A SPACE STORM OR TRUCE, RESPECTIVELY."
+9930  PRINT "ALSO, DAMAGED DEVICES ARE REPAIRED 2 UNITS EVERY STARDATE."
+9935  GOSUB 9980
+9940  PRINT "COMMANDS:"
+9941  PRINT
+9942  H6=1
+9944  GOTO 975
+9946  H6=H6+1
+9952  GOSUB 9980
+9953  PRINT "P.S.--SAVE THIS COPY OF INSTRUCTIONS, SO THAT NEXT"
+9954  PRINT "TIME YOU WILL NOT NEED ADDITIONAL INSTRUCIONS AND"
+9955  PRINT "CAN PROCEED IMMEDIATELY TO PLAY."
+9956  PRINT
+9957  PRINT
+9960  GOSUB 9980
+9961  PRINT "WHEN YOU ARE READY TO CONTINUE, TYPE 9:";
+9962  INPUT X
+9963  GOSUB 9980
+9965  GOTO 400
+9980  REM
+9985  FOR I=1 TO 3
+9986  PRINT
+9990  NEXT I
+9991  RETURN
+9992  PRINT
+9993  PRINT
+9994  PRINT "  DO YOU WISH TO PLAY AGAIN:";
+9995  INPUT A$
+9996  IF A$ ="YES" THEN 5
+9997  PRINT
+9998  PRINT "  ** AVE ATQUE VALE **"
+9999  END
diff --git a/historic/c-version/ABOUT-NLS b/historic/c-version/ABOUT-NLS
new file mode 100644 (file)
index 0000000..e32d52d
--- /dev/null
@@ -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/historic/c-version/AUTHORS b/historic/c-version/AUTHORS
new file mode 100644 (file)
index 0000000..9d94a70
--- /dev/null
@@ -0,0 +1,6 @@
+David Matuszek <matuszek@cis.upenn.edu>
+Paul Reynolds
+Don Smith
+Tom Almy <tom@almy.us>
+Stas Sergeev <stsp@aknet.ru>
+Eric S. Raymond <esr@thyrsus.com>
diff --git a/historic/c-version/COPYING b/historic/c-version/COPYING
new file mode 100644 (file)
index 0000000..34a1386
--- /dev/null
@@ -0,0 +1,4 @@
+The NEWS, ChangeLog, and COPYING files in this directory are stubs to appease
+the cruel gods of autoconf.  See the top-level directory of the distributoon for
+the real ones.
+
diff --git a/historic/c-version/ChangeLog b/historic/c-version/ChangeLog
new file mode 100644 (file)
index 0000000..34a1386
--- /dev/null
@@ -0,0 +1,4 @@
+The NEWS, ChangeLog, and COPYING files in this directory are stubs to appease
+the cruel gods of autoconf.  See the top-level directory of the distributoon for
+the real ones.
+
diff --git a/historic/c-version/INSTALL b/historic/c-version/INSTALL
new file mode 100644 (file)
index 0000000..a4b3414
--- /dev/null
@@ -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/historic/c-version/Makefile.am b/historic/c-version/Makefile.am
new file mode 100644 (file)
index 0000000..b43f594
--- /dev/null
@@ -0,0 +1,18 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = src
+
+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/historic/c-version/NEWS b/historic/c-version/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/historic/c-version/README b/historic/c-version/README
new file mode 100644 (file)
index 0000000..99cab9d
--- /dev/null
@@ -0,0 +1,5 @@
+This is an archive of the last C version of SST.  The game was moved to
+Python in 2006.
+
+The NEWS, ChangeLog, and COPYING files in this directory are stubs to appease
+the cruel gods of autoconf.
diff --git a/historic/c-version/autogen.sh b/historic/c-version/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/historic/c-version/compile b/historic/c-version/compile
new file mode 100755 (executable)
index 0000000..1b1d232
--- /dev/null
@@ -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/historic/c-version/config.guess b/historic/c-version/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/historic/c-version/config.rpath b/historic/c-version/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/historic/c-version/config.sub b/historic/c-version/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/historic/c-version/configure.ac b/historic/c-version/configure.ac
new file mode 100644 (file)
index 0000000..786ea79
--- /dev/null
@@ -0,0 +1,56 @@
+#                                               -*- 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(ncursesw, 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
+])
+
+# These used to be in AC_CONFIG_FILES before the C version became obsolete.
+# Now the build machinery in them is separate/
+#    po/Makefile.in
+#    doc/Makefile
+
+AC_OUTPUT
diff --git a/historic/c-version/depcomp b/historic/c-version/depcomp
new file mode 100755 (executable)
index 0000000..04701da
--- /dev/null
@@ -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/historic/c-version/install-sh b/historic/c-version/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/historic/c-version/m4/ChangeLog b/historic/c-version/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/historic/c-version/m4/codeset.m4 b/historic/c-version/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/historic/c-version/m4/gettext.m4 b/historic/c-version/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/historic/c-version/m4/glibc2.m4 b/historic/c-version/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/historic/c-version/m4/glibc21.m4 b/historic/c-version/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/historic/c-version/m4/iconv.m4 b/historic/c-version/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/historic/c-version/m4/intdiv0.m4 b/historic/c-version/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/historic/c-version/m4/intmax.m4 b/historic/c-version/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/historic/c-version/m4/inttypes-pri.m4 b/historic/c-version/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/historic/c-version/m4/inttypes.m4 b/historic/c-version/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/historic/c-version/m4/inttypes_h.m4 b/historic/c-version/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/historic/c-version/m4/isc-posix.m4 b/historic/c-version/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/historic/c-version/m4/lcmessage.m4 b/historic/c-version/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/historic/c-version/m4/lib-ld.m4 b/historic/c-version/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/historic/c-version/m4/lib-link.m4 b/historic/c-version/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/historic/c-version/m4/lib-prefix.m4 b/historic/c-version/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/historic/c-version/m4/longdouble.m4 b/historic/c-version/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/historic/c-version/m4/longlong.m4 b/historic/c-version/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/historic/c-version/m4/nls.m4 b/historic/c-version/m4/nls.m4
new file mode 100644 (file)
index 0000000..2082c3b
--- /dev/null
@@ -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/historic/c-version/m4/po.m4 b/historic/c-version/m4/po.m4
new file mode 100644 (file)
index 0000000..f2795ee
--- /dev/null
@@ -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/historic/c-version/m4/printf-posix.m4 b/historic/c-version/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/historic/c-version/m4/progtest.m4 b/historic/c-version/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/historic/c-version/m4/signed.m4 b/historic/c-version/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/historic/c-version/m4/size_max.m4 b/historic/c-version/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/historic/c-version/m4/stdint_h.m4 b/historic/c-version/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/historic/c-version/m4/uintmax_t.m4 b/historic/c-version/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/historic/c-version/m4/ulonglong.m4 b/historic/c-version/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/historic/c-version/m4/wchar_t.m4 b/historic/c-version/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/historic/c-version/m4/wint_t.m4 b/historic/c-version/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/historic/c-version/m4/xsize.m4 b/historic/c-version/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/historic/c-version/missing b/historic/c-version/missing
new file mode 100755 (executable)
index 0000000..894e786
--- /dev/null
@@ -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/historic/c-version/mkinstalldirs b/historic/c-version/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/historic/c-version/src/Makefile.am b/historic/c-version/src/Makefile.am
new file mode 100644 (file)
index 0000000..837cd06
--- /dev/null
@@ -0,0 +1,28 @@
+AM_CFLAGS = -Wall -Wimplicit -Wunused -Wmissing-prototypes -Wundef \
+    -Wuninitialized -Wdeclaration-after-statement \
+    -fno-inline -O1 -DDATA_DIR=\"$(pkgdatadir)\" \
+    -DLOCALEDIR=\"$(datadir)/locale\" \
+    @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
+
+# Experimental XaW code, not yet integrated with the game
+xio: xio.o
+       gcc xio.c -lXaw3d -o xio
diff --git a/historic/c-version/src/ai.c b/historic/c-version/src/ai.c
new file mode 100644 (file)
index 0000000..91e3ec9
--- /dev/null
@@ -0,0 +1,631 @@
+#include "sst.h"
+
+static bool tryexit(coord look, int ienm, int loccom, bool irun) 
+/* a bad guy attempts to bug out */
+{
+    int n;
+    coord iq;
+
+    iq.x = game.quadrant.x+(look.x+(QUADSIZE-1))/QUADSIZE - 1;
+    iq.y = game.quadrant.y+(look.y+(QUADSIZE-1))/QUADSIZE - 1;
+    if (!VALID_QUADRANT(iq.x,iq.y) ||
+       game.state.galaxy[iq.x][iq.y].supernova ||
+       game.state.galaxy[iq.x][iq.y].klingons > MAXKLQUAD-1)
+       return false; /* no can do -- neg energy, supernovae, or >MAXKLQUAD-1 Klingons */
+    if (ienm == IHR)
+       return false; /* Romulans cannot escape! */
+    if (!irun) {
+       /* avoid intruding on another commander's territory */
+       if (ienm == IHC) {
+           for (n = 1; n <= game.state.remcom; n++)
+               if (same(game.state.kcmdr[n],iq))
+                   return false;
+           /* refuse to leave if currently attacking starbase */
+           if (same(game.battle, game.quadrant))
+               return false;
+       }
+       /* don't leave if over 1000 units of energy */
+       if (game.kpower[loccom] > 1000.0)
+           return false;
+    }
+    // print escape message and move out of quadrant.
+    // We know this if either short or long range sensors are working
+    if (!damaged(DSRSENS) || !damaged(DLRSENS) ||
+       game.condition == docked) {
+       crmena(true, ienm, sector, game.ks[loccom]);
+       prout(_(" escapes to %s (and regains strength)."),
+             cramlc(quadrant, iq));
+    }
+    /* handle local matters related to escape */
+    game.quad[game.ks[loccom].x][game.ks[loccom].y] = IHDOT;
+    game.ks[loccom] = game.ks[game.nenhere];
+    game.kavgd[loccom] = game.kavgd[game.nenhere];
+    game.kpower[loccom] = game.kpower[game.nenhere];
+    game.kdist[loccom] = game.kdist[game.nenhere];
+    game.klhere--;
+    game.nenhere--;
+    if (game.condition != docked)
+       newcnd();
+    /* Handle global matters related to escape */
+    game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons--;
+    game.state.galaxy[iq.x][iq.y].klingons++;
+    if (ienm==IHS) {
+       game.ishere = false;
+       game.iscate = false;
+       game.ientesc = false;
+       game.isatb = 0;
+       schedule(FSCMOVE, 0.2777);
+       unschedule(FSCDBAS);
+       game.state.kscmdr=iq;
+    }
+    else {
+       for (n = 1; n <= game.state.remcom; n++) {
+           if (same(game.state.kcmdr[n], game.quadrant)) {
+               game.state.kcmdr[n]=iq;
+               break;
+           }
+       }
+       game.comhere = false;
+    }
+    return true; /* success */
+}
+
+/*************************************************************************
+The bad-guy movement algorithm:
+
+1. 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.
+
+2. 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.
+
+3. 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.
+
+4.  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*game.skill, generally forcing a
+retreat, especially at high skill levels.
+
+5.  Motion is limited to skill level, except for SC hi-tailing it out.
+**************************************************************************/
+
+static void movebaddy(coord com, int loccom, feature ienm)
+/* tactical movement for the bad guys */
+{
+    int motion, mdist, nsteps, mx, my, ll;
+    coord next, look;
+    int krawlx, krawly;
+    bool success, irun = false;
+    int attempts;
+    /* This should probably be just game.comhere + game.ishere */
+    int nbaddys = game.skill >= SKILL_EXPERT ?
+       (int)((game.comhere*2 + game.ishere*2+game.klhere*1.23+game.irhere*1.5)/2.0):
+       (game.comhere + game.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 || (game.condition==docked && !damaged(DPHOTON)))) {
+       irun = true;
+       motion = -QUADSIZE;
+    }
+    else {
+       /* decide whether to advance, retreat, or hold position */
+       forces = game.kpower[loccom]+100.0*game.nenhere+400*(nbaddys-1);
+       if (!game.shldup)
+           forces += 1000; /* Good for enemy if shield is down! */
+       if (!damaged(DPHASER) || !damaged(DPHOTON)) {
+           if (damaged(DPHASER)) /* phasers damaged */
+               forces += 300.0;
+           else
+               forces -= 0.2*(game.energy - 2500.0);
+           if (damaged(DPHOTON)) /* photon torpedoes damaged */
+               forces += 300.0;
+           else
+               forces -= 50.0*game.torps;
+       }
+       else {
+           /* phasers and photon tubes both out! */
+           forces += 1000.0;
+       }
+       motion = 0;
+       if (forces <= 1000.0 && game.condition != docked) /* 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 (game.condition==docked && (game.options & OPTION_BASE)) /* protected by base -- back off ! */
+               motion -= game.skill*(2.0-square(Rand()));
+       }
+       if (idebug)
+           proutn("=== MOTION = %d, FORCES = %1.2f, ", motion, forces);
+       /* don't move if no motion */
+       if (motion==0)
+           return;
+       /* Limit motion according to skill */
+       if (abs(motion) > game.skill)
+           motion = (motion < 0) ? -game.skill : game.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 */
+    if (idebug) {
+       proutn("NSTEPS = %d:", nsteps);
+    }
+    /* Compute preferred values of delta X and Y */
+    mx = game.sector.x - com.x;
+    my = game.sector.y - com.y;
+    if (2.0 * abs(mx) < abs(my))
+       mx = 0;
+    if (2.0 * abs(my) < abs(game.sector.x-com.x))
+       my = 0;
+    if (mx != 0)
+       mx = mx*motion < 0 ? -1 : 1;
+    if (my != 0)
+       my = my*motion < 0 ? -1 : 1;
+    next = com;
+    /* main move loop */
+    for (ll = 0; ll < nsteps; ll++) {
+       if (idebug)
+           proutn(" %d", ll+1);
+       /* Check if preferred position available */
+       look.x = next.x + mx;
+       look.y = next.y + my;
+       krawlx = mx < 0 ? 1 : -1;
+       krawly = my < 0 ? 1 : -1;
+       success = false;
+       attempts = 0; /* Settle mysterious hang problem */
+       while (attempts++ < 20 && !success) {
+           if (look.x < 1 || look.x > QUADSIZE) {
+               if (motion < 0 && tryexit(look, ienm, loccom, irun))
+                   return;
+               if (krawlx == mx || my == 0)
+                   break;
+               look.x = next.x + krawlx;
+               krawlx = -krawlx;
+           }
+           else if (look.y < 1 || look.y > QUADSIZE) {
+               if (motion < 0 && tryexit(look, ienm, loccom, irun))
+                   return;
+               if (krawly == my || mx == 0)
+                   break;
+               look.y = next.y + krawly;
+               krawly = -krawly;
+           }
+           else if ((game.options & OPTION_RAMMING) && game.quad[look.x][look.y] != IHDOT) {
+               /* See if we should ram ship */
+               if (game.quad[look.x][look.y] == game.ship &&
+                   (ienm == IHC || ienm == IHS)) {
+                   ram(true, ienm, com);
+                   return;
+               }
+               if (krawlx != mx && my != 0) {
+                   look.x = next.x + krawlx;
+                   krawlx = -krawlx;
+               }
+               else if (krawly != my && mx != 0) {
+                   look.y = next.y + krawly;
+                   krawly = -krawly;
+               }
+               else
+                   break; /* we have failed */
+           }
+           else
+               success = true;
+       }
+       if (success) {
+           next = look;
+           if (idebug)
+               proutn(cramlc(neither, next));
+       }
+       else
+           break; /* done early */
+       
+    }
+    if (idebug)
+       skip(1);
+    /* Put commander in place within same quadrant */
+    game.quad[com.x][com.y] = IHDOT;
+    game.quad[next.x][next.y] = ienm;
+    if (!same(next, com)) {
+       /* it moved */
+       game.ks[loccom] = next;
+       game.kdist[loccom] = game.kavgd[loccom] = distance(game.sector, next);
+       if (!damaged(DSRSENS) || game.condition == docked) {
+           proutn("***");
+           cramen(ienm);
+           proutn(_(" from %s"), cramlc(sector, com));
+           if (game.kdist[loccom] < dist1)
+               proutn(_(" advances to "));
+           else
+               proutn(_(" retreats to "));
+           prout(cramlc(sector, next));
+       }
+    }
+}
+
+void moveklings(void) 
+/* Klingon tactical movement */
+{
+    coord w; 
+    int i;
+
+    if (idebug)
+       prout("== MOVCOM");
+
+    // Figure out which Klingon is the commander (or Supercommander)
+    //   and do move
+    if (game.comhere) 
+       for (i = 1; i <= game.nenhere; i++) {
+           w = game.ks[i];
+           if (game.quad[w.x][w.y] == IHC) {
+               movebaddy(w, i, IHC);
+               break;
+           }
+       }
+    if (game.ishere) 
+       for (i = 1; i <= game.nenhere; i++) {
+           w = game.ks[i];
+           if (game.quad[w.x][w.y] == IHS) {
+               movebaddy(w, 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 (game.skill >= SKILL_EXPERT && (game.options & OPTION_MVBADDY)) 
+       for (i = 1; i <= game.nenhere; i++) {
+           w = game.ks[i];
+           if (game.quad[w.x][w.y] == IHK || game.quad[w.x][w.y] == IHR)
+               movebaddy(w, i, game.quad[w.x][w.y]);
+       }
+
+    sortklings();
+}
+
+static bool movescom(coord iq, bool avoid) 
+/* commander movement helper */
+{
+    int i;
+
+    if (same(iq, game.quadrant) || !VALID_QUADRANT(iq.x, iq.y) ||
+       game.state.galaxy[iq.x][iq.y].supernova ||
+       game.state.galaxy[iq.x][iq.y].klingons > MAXKLQUAD-1) 
+       return 1;
+    if (avoid) {
+       /* Avoid quadrants with bases if we want to avoid Enterprise */
+       for (i = 1; i <= game.state.rembase; i++)
+           if (same(game.state.baseq[i], iq)) 
+               return true;
+    }
+    if (game.justin && !game.iscate)
+       return true;
+    /* do the move */
+    game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons--;
+    game.state.kscmdr = iq;
+    game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].klingons++;
+    if (game.ishere) {
+       /* SC has scooted, Remove him from current quadrant */
+       game.iscate=false;
+       game.isatb=0;
+       game.ishere = false;
+       game.ientesc = false;
+       unschedule(FSCDBAS);
+       for (i = 1; i <= game.nenhere; i++) 
+           if (game.quad[game.ks[i].x][game.ks[i].y] == IHS)
+               break;
+       game.quad[game.ks[i].x][game.ks[i].y] = IHDOT;
+       game.ks[i] = game.ks[game.nenhere];
+       game.kdist[i] = game.kdist[game.nenhere];
+       game.kavgd[i] = game.kavgd[game.nenhere];
+       game.kpower[i] = game.kpower[game.nenhere];
+       game.klhere--;
+       game.nenhere--;
+       if (game.condition!=docked)
+           newcnd();
+       sortklings();
+    }
+    /* check for a helpful planet */
+    for (i = 0; i < game.inplan; i++) {
+       if (same(game.state.planets[i].w, game.state.kscmdr) &&
+           game.state.planets[i].crystals == present) {
+           /* destroy the planet */
+           game.state.planets[i].pclass = destroyed;
+           game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = NOPLANET;
+           if (!damaged(DRADIO) || game.condition == docked) {
+               announce();
+               prout(_("Lt. Uhura-  \"Captain, Starfleet Intelligence reports"));
+               proutn(_("   a planet in "));
+               proutn(cramlc(quadrant, game.state.kscmdr));
+               prout(_(" has been destroyed"));
+               prout(_("   by the Super-commander.\""));
+           }
+           break;
+       }
+    }
+    return false; /* looks good! */
+}
+                       
+void supercommander(void)
+/* move the Super Commander */
+{
+    int i, i2, j, ideltax, ideltay, ifindit, iwhichb;
+    coord iq, sc, ibq;
+    int basetbl[BASEMAX+1];
+    double bdist[BASEMAX+1];
+    bool avoid;
+
+    if (idebug)
+       prout("== SUPERCOMMANDER");
+
+    /* Decide on being active or passive */
+    avoid = ((game.incom - game.state.remcom + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*game.skill*(game.skill+1.0) ||
+           (game.state.date-game.indate) < 3.0);
+    if (!game.iscate && avoid) {
+       /* compute move away from Enterprise */
+       ideltax = game.state.kscmdr.x-game.quadrant.x;
+       ideltay = game.state.kscmdr.y-game.quadrant.y;
+       if (sqrt(ideltax*(double)ideltax+ideltay*(double)ideltay) > 2.0) {
+           /* circulate in space */
+           ideltax = game.state.kscmdr.y-game.quadrant.y;
+           ideltay = game.quadrant.x-game.state.kscmdr.x;
+       }
+    }
+    else {
+       /* compute distances to starbases */
+       if (game.state.rembase <= 0) {
+           /* nothing left to do */
+           unschedule(FSCMOVE);
+           return;
+       }
+       sc = game.state.kscmdr;
+       for (i = 1; i <= game.state.rembase; i++) {
+           basetbl[i] = i;
+           bdist[i] = distance(game.state.baseq[i], sc);
+       }
+       if (game.state.rembase > 1) {
+           /* sort into nearest first order */
+           bool iswitch;
+           do {
+               iswitch = false;
+               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 = true;
+                   }
+               }
+           } 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 (i2 = 1; i2 <= game.state.rembase; i2++) {
+           i = basetbl[i2];    /* bug in original had it not finding nearest*/
+           ibq = game.state.baseq[i];
+           if (same(ibq, game.quadrant) || same(ibq, game.battle) ||
+               game.state.galaxy[ibq.x][ibq.y].supernova ||
+               game.state.galaxy[ibq.x][ibq.y].klingons > MAXKLQUAD-1) 
+               continue;
+           // if there is a commander, and no other base is appropriate,
+           //   we will take the one with the commander
+           for (j = 1; j <= game.state.remcom; j++) {
+               if (same(ibq, game.state.kcmdr[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*/
+       ibq = game.state.baseq[iwhichb];
+       /* decide how to move toward base */
+       ideltax = ibq.x - game.state.kscmdr.x;
+       ideltay = ibq.y - game.state.kscmdr.y;
+    }
+    /* 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 */
+    iq.x = game.state.kscmdr.x + ideltax;
+    iq.y = game.state.kscmdr.y + ideltax;
+    if (movescom(iq, avoid)) {
+       /* failed -- try some other maneuvers */
+       if (ideltax==0 || ideltay==0) {
+           /* attempt angle move */
+           if (ideltax != 0) {
+               iq.y = game.state.kscmdr.y + 1;
+               if (movescom(iq, avoid)) {
+                   iq.y = game.state.kscmdr.y - 1;
+                   movescom(iq, avoid);
+               }
+           }
+           else {
+               iq.x = game.state.kscmdr.x + 1;
+               if (movescom(iq, avoid)) {
+                   iq.x = game.state.kscmdr.x - 1;
+                   movescom(iq, avoid);
+               }
+           }
+       }
+       else {
+           /* try moving just in x or y */
+           iq.y = game.state.kscmdr.y;
+           if (movescom(iq, avoid)) {
+               iq.y = game.state.kscmdr.y + ideltay;
+               iq.x = game.state.kscmdr.x;
+               movescom(iq, avoid);
+           }
+       }
+    }
+    /* check for a base */
+    if (game.state.rembase == 0) {
+       unschedule(FSCMOVE);
+    }
+    else {
+       for (i = 1; i <= game.state.rembase; i++) {
+           ibq = game.state.baseq[i];
+           if (same(ibq, game.state.kscmdr) && same(game.state.kscmdr, game.battle)) {
+               /* attack the base */
+               if (avoid)
+                   return; /* no, don't attack base! */
+               game.iseenit = false;
+               game.isatb = 1;
+               schedule(FSCDBAS, 1.0 +2.0*Rand());
+               if (is_scheduled(FCDBAS)) 
+                   postpone(FSCDBAS, scheduled(FCDBAS)-game.state.date);
+               if (damaged(DRADIO) && game.condition != docked)
+                   return; /* no warning */
+               game.iseenit = true;
+               announce();
+               proutn(_("Lt. Uhura-  \"Captain, the starbase in "));
+               proutn(cramlc(quadrant, game.state.kscmdr));
+               skip(1);
+               prout(_("   reports that it is under attack from the Klingon Super-commander."));
+               proutn(_("   It can survive until stardate %d.\""),
+                      (int)scheduled(FSCDBAS));
+               if (!game.resting)
+                   return;
+               prout(_("Mr. Spock-  \"Captain, shall we cancel the rest period?\""));
+               if (ja() == false)
+                   return;
+               game.resting = false;
+               game.optime = 0.0; /* actually finished */
+               return;
+           }
+       }
+    }
+    /* Check for intelligence report */
+    if (
+       !idebug &&
+       (Rand() > 0.2 ||
+        (damaged(DRADIO) && game.condition != docked) ||
+        !game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].charted))
+       return;
+    announce();
+    prout(_("Lt. Uhura-  \"Captain, Starfleet Intelligence reports"));
+    proutn(_("   the Super-commander is in "));
+    proutn(cramlc(quadrant, game.state.kscmdr));
+    prout(".\"");
+    return;
+}
+
+void movetholian(void)
+/* move the Tholian */
+{
+    int idx, idy, im, i;
+    if (!game.ithere || game.justin)
+       return;
+
+    if (game.tholian.x == 1 && game.tholian.y == 1) {
+       idx = 1; idy = QUADSIZE;
+    }
+    else if (game.tholian.x == 1 && game.tholian.y == QUADSIZE) {
+       idx = QUADSIZE; idy = QUADSIZE;
+    }
+    else if (game.tholian.x == QUADSIZE && game.tholian.y == QUADSIZE) {
+       idx = QUADSIZE; idy = 1;
+    }
+    else if (game.tholian.x == QUADSIZE && game.tholian.y == 1) {
+       idx = 1; idy = 1;
+    }
+    else {
+       /* something is wrong! */
+       game.ithere = false;
+       return;
+    }
+
+    /* do nothing if we are blocked */
+    if (game.quad[idx][idy]!= IHDOT && game.quad[idx][idy]!= IHWEB)
+       return;
+    game.quad[game.tholian.x][game.tholian.y] = IHWEB;
+
+    if (game.tholian.x != idx) {
+       /* move in x axis */
+       im = fabs((double)idx - game.tholian.x)/((double)idx - game.tholian.x);
+       while (game.tholian.x != idx) {
+           game.tholian.x += im;
+           if (game.quad[game.tholian.x][game.tholian.y]==IHDOT)
+               game.quad[game.tholian.x][game.tholian.y] = IHWEB;
+       }
+    }
+    else if (game.tholian.y != idy) {
+       /* move in y axis */
+       im = fabs((double)idy - game.tholian.y)/((double)idy - game.tholian.y);
+       while (game.tholian.y != idy) {
+           game.tholian.y += im;
+           if (game.quad[game.tholian.x][game.tholian.y]==IHDOT)
+               game.quad[game.tholian.x][game.tholian.y] = IHWEB;
+       }
+    }
+    game.quad[game.tholian.x][game.tholian.y] = IHT;
+    game.ks[game.nenhere] = game.tholian;
+
+    /* check to see if all holes plugged */
+    for (i = 1; i <= QUADSIZE; 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[game.tholian.x][game.tholian.y]=IHWEB;
+    dropin(IHBLANK);
+    crmena(true, IHT, sector, game.tholian);
+    prout(_(" completes web."));
+    game.ithere = false;
+    game.nenhere--;
+    return;
+}
diff --git a/historic/c-version/src/battle.c b/historic/c-version/src/battle.c
new file mode 100644 (file)
index 0000000..223a981
--- /dev/null
@@ -0,0 +1,1389 @@
+#include "sst.h"
+
+void doshield(bool raise) 
+/* change shield status */
+{
+    int key;
+    enum {NONE, SHUP, SHDN, NRG} action = NONE;
+
+    game.ididit = false;
+
+    if (raise) 
+       action = SHUP;
+    else {
+       key = scan();
+       if (key == IHALPHA) {
+           if (isit("transfer"))
+               action = NRG;
+           else {
+               chew();
+               if (damaged(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() == true) {
+               proutn(_("Energy to transfer to shields- "));
+               action = NRG;
+           }
+           else if (damaged(DSHIELD)) {
+               prout(_("Shields damaged and down."));
+               return;
+           }
+           else if (game.shldup) {
+               proutn(_("Shields are up. Do you want them down? "));
+               if (ja() == true)
+                   action = SHDN;
+               else {
+                   chew();
+                   return;
+               }
+           }
+           else {
+               proutn(_("Shields are down. Do you want them up? "));
+               if (ja() == true)
+                   action = SHUP;
+               else {
+                   chew();
+                   return;
+               }
+           }
+       }
+    }
+    switch (action) {
+    case SHUP: /* raise shields */
+       if (game.shldup) {
+           prout(_("Shields already up."));
+           return;
+       }
+       game.shldup = true;
+       game.shldchg = true;
+       if (game.condition != docked)
+           game.energy -= 50.0;
+       prout(_("Shields raised."));
+       if (game.energy <= 0) {
+           skip(1);
+           prout(_("Shields raising uses up last of energy."));
+           finish(FNRG);
+           return;
+       }
+       game.ididit=true;
+       return;
+    case SHDN:
+       if (!game.shldup) {
+           prout(_("Shields already down."));
+           return;
+       }
+       game.shldup=false;
+       game.shldchg=true;
+       prout(_("Shields lowered."));
+       game.ididit = true;
+       return;
+    case NRG:
+       while (scan() != IHREAL) {
+           chew();
+           proutn(_("Energy to transfer to shields- "));
+       }
+       chew();
+       if (aaitem==0)
+           return;
+       if (aaitem > game.energy) {
+           prout(_("Insufficient ship energy."));
+           return;
+       }
+       game.ididit = true;
+       if (game.shield+aaitem >= game.inshld) {
+           prout(_("Shield energy maximized."));
+           if (game.shield+aaitem > game.inshld) {
+               prout(_("Excess energy requested returned to ship energy"));
+           }
+           game.energy -= game.inshld-game.shield;
+           game.shield = game.inshld;
+           return;
+       }
+       if (aaitem < 0.0 && game.energy-aaitem > game.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."));
+           game.ididit = false;
+           return;
+       }
+       if (game.shield+aaitem < 0) {
+           prout(_("All shield energy transferred to ship."));
+           game.energy += game.shield;
+           game.shield = 0.0;
+           return;
+       }
+       proutn(_("Scotty- \""));
+       if (aaitem > 0)
+           prout(_("Transferring energy to shields.\""));
+       else
+           prout(_("Draining energy from shields.\""));
+       game.shield += aaitem;
+       game.energy -= aaitem;
+       return;
+    case NONE:;        /* avoid gcc warning */
+    }
+}
+
+static int randdevice(void)
+/* choose a device to damage, at random. */
+{
+    /*
+     * Quoth Eric Allman in the code of BSD-Trek:
+     * "Under certain conditions you can get a critical hit.  This
+     * sort of hit damages devices.  The probability that a given
+     * device is damaged depends on the device.  Well protected
+     * devices (such as the computer, which is in the core of the
+     * ship and has considerable redundancy) almost never get
+     * damaged, whereas devices which are exposed (such as the
+     * warp engines) or which are particularly delicate (such as
+     * the transporter) have a much higher probability of being
+     * damaged."
+     *
+     * This is one place where OPTION_PLAIN does not restore the
+     * original behavior, which was equiprobable damage across
+     * all devices.  If we wanted that, we'd return NDEVICES*Rand()
+     * and have done with it.  Also, in the original game, DNAVYS
+     * and DCOMPTR were the same device. 
+     *
+     * Instead, we use a table of weights similar to the one from BSD Trek.
+     * BSD doesn't have the shuttle, shield controller, death ray, or probes. 
+     * We don't have a cloaking device.  The shuttle got the allocation
+     * for the cloaking device, then we shaved a half-percent off
+     * everything to have some weight to give DSHCTRL/DDRAY/DDSP.
+     */
+    static int weights[NDEVICES] = {
+       105,    /* DSRSENS: short range scanners        10.5% */
+       105,    /* DLRSENS: long range scanners         10.5% */
+       120,    /* DPHASER: phasers                     12.0% */
+       120,    /* DPHOTON: photon torpedoes            12.0% */
+       25,     /* DLIFSUP: life support                 2.5% */
+       65,     /* DWARPEN: warp drive                   6.5% */
+       70,     /* DIMPULS: impulse engines              6.5% */
+       145,    /* DSHIELD: deflector shields           14.5% */
+       30,     /* DRADIO:  subspace radio               3.0% */
+       45,     /* DSHUTTL: shuttle                      4.5% */
+       15,     /* DCOMPTR: computer                     1.5% */
+       20,     /* NAVCOMP: navigation system            2.0% */
+       75,     /* DTRANSP: transporter                  7.5% */
+       20,     /* DSHCTRL: high-speed shield controller 2.0% */
+       10,     /* DDRAY: death ray                      1.0% */
+       30,     /* DDSP: deep-space probes               3.0% */
+    };
+    int sum, i, idx = Rand() * 1000.0; /* weights must sum to 1000 */
+
+    for (i = sum = 0; i < NDEVICES; i++) {
+       sum += weights[i];
+       if (idx < sum)
+           return i;
+    }
+    return -1; /* we should never get here, but this quiets GCC */
+}
+
+void ram(bool ibumpd, feature ienm, coord w)
+/* make our ship ram something */
+{
+    double hardness, extradm;
+    int icas, m, ncrits;
+       
+    prouts(_("***RED ALERT!  RED ALERT!"));
+    skip(1);
+    prout(_("***COLLISION IMMINENT."));
+    skip(2);
+    proutn("***");
+    crmshp();
+    switch (ienm) {
+    case IHR: hardness = 1.5; break;
+    case IHC: hardness = 2.0; break;
+    case IHS: hardness = 2.5; break;
+    case IHT: hardness = 0.5; break;
+    case IHQUEST: hardness = 4.0; break;
+    default: hardness = 1.0; break;
+    }
+    proutn(ibumpd ? _(" rammed by ") : _(" rams "));
+    crmena(false, ienm, sector, w);
+    if (ibumpd)
+       proutn(_(" (original position)"));
+    skip(1);
+    deadkl(w, ienm, game.sector);
+    proutn("***");
+    crmshp();
+    prout(_(" heavily damaged."));
+    icas = 10.0+20.0*Rand();
+    prout(_("***Sickbay reports %d casualties"), icas);
+    game.casual += icas;
+    game.state.crew -= icas;
+    /*
+     * In the pre-SST2K version, all devices got equiprobably damaged,
+     * which was silly.  Instead, pick up to half the devices at
+     * random according to our weighting table,
+     */
+    ncrits = Rand() * (NDEVICES/2);
+    for (m=0; m < ncrits; m++) {
+       int dev = randdevice();
+       if (game.damage[dev] < 0) 
+           continue;
+       extradm = (10.0*hardness*Rand()+1.0)*game.damfac;
+       /* Damage for at least time of travel! */
+       game.damage[dev] += game.optime + extradm;
+    }
+    game.shldup = false;
+    prout(_("***Shields are down."));
+    if (game.state.remkl + game.state.remcom + game.state.nscrem) {
+       announce();
+       damagereport();
+    }
+    else
+       finish(FWON);
+    return;
+}
+
+void torpedo(double course, double r, coord in, double *hit, int i, int n)
+/* let a photon torpedo fly */
+{
+    int l, iquad=0, ll;
+    bool shoved = false;
+    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=in.x, y=in.y, bigger;
+    double ang, temp, xx, yy, kp, h1;
+    struct quadrant *q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
+    coord w, jw;
+
+    w.x = w.y = jw.x = jw.y = 0;
+    bigger = fabs(deltax);
+    if (fabs(deltay) > bigger)
+       bigger = fabs(deltay);
+    deltax /= bigger;
+    deltay /= bigger;
+    if (!damaged(DSRSENS) || game.condition==docked) 
+       setwnd(srscan_window);
+    else 
+       setwnd(message_window);
+    /* Loop to move a single torpedo */
+    for (l=1; l <= 15; l++) {
+       x += deltax;
+       w.x = x + 0.5;
+       y += deltay;
+       w.y = y + 0.5;
+       if (!VALID_SECTOR(w.x, w.y))
+           break;
+       iquad=game.quad[w.x][w.y];
+       tracktorpedo(w, l, i, n, iquad);
+       if (iquad==IHDOT)
+           continue;
+       /* hit something */
+       setwnd(message_window);
+       if (damaged(DSRSENS) && !game.condition==docked)
+           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 * distance(w, in) * fabs(sin(bullseye-angle));
+           *hit = fabs(*hit);
+           newcnd(); /* we're blown out of dock */
+           /* We may be displaced. */
+           if (game.landed || game.condition==docked) 
+               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;
+           jw.x=w.x+xx+0.5;
+           jw.y=w.y+yy+0.5;
+           if (!VALID_SECTOR(jw.x, jw.y))
+               return;
+           if (game.quad[jw.x][jw.y]==IHBLANK) {
+               finish(FHOLE);
+               return;
+           }
+           if (game.quad[jw.x][jw.y]!=IHDOT) {
+               /* can't move into object */
+               return;
+           }
+           game.sector = jw;
+           crmshp();
+           shoved = true;
+           break;
+                                         
+       case IHC: /* Hit a commander */
+       case IHS:
+           if (Rand() <= 0.05) {
+               crmena(true, iquad, sector, w);
+               prout(_(" uses anti-photon device;"));
+               prout(_("   torpedo neutralized."));
+               return;
+           }
+       case IHR: /* Hit a regular enemy */
+       case IHK:
+           /* find the enemy */
+           for (ll = 1; ll <= game.nenhere; ll++)
+               if (same(w, game.ks[ll]))
+                   break;
+           kp = fabs(game.kpower[ll]);
+           h1 = 700.0 + 100.0*Rand() -
+               1000.0 * distance(w, in) * 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(w, iquad, w);
+               return;
+           }
+           crmena(true, iquad, sector, w);
+           /* 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;
+           jw.x=w.x+xx+0.5;
+           jw.y=w.y+yy+0.5;
+           if (!VALID_SECTOR(jw.x, jw.y)) {
+               prout(_(" damaged but not destroyed."));
+               return;
+           }
+           if (game.quad[jw.x][jw.y]==IHBLANK) {
+               prout(_(" buffeted into black hole."));
+               deadkl(w, iquad, jw);
+               return;
+           }
+           if (game.quad[jw.x][jw.y]!=IHDOT) {
+               /* can't move into object */
+               prout(_(" damaged but not destroyed."));
+               return;
+           }
+           proutn(_(" damaged--"));
+           game.ks[ll] = jw;
+           shoved = true;
+           break;
+       case IHB: /* Hit a base */
+           skip(1);
+           prout(_("***STARBASE DESTROYED.."));
+           for (ll = 1; ll <= game.state.rembase; ll++) {
+               if (same(game.state.baseq[ll], game.quadrant)) {
+                   game.state.baseq[ll]=game.state.baseq[game.state.rembase];
+                   break;
+               }
+           }
+           game.quad[w.x][w.y]=IHDOT;
+           game.state.rembase--;
+           game.base.x=game.base.y=0;
+           q->starbase--;
+           game.state.chart[game.quadrant.x][game.quadrant.y].starbase--;
+           game.state.basekl++;
+           newcnd();
+           return;
+       case IHP: /* Hit a planet */
+           crmena(true, iquad, sector, w);
+           prout(_(" destroyed."));
+           game.state.nplankl++;
+           q->planet = NOPLANET;
+           game.state.planets[game.iplnet].pclass = destroyed;
+           game.iplnet = 0;
+           invalidate(game.plnet);
+           game.quad[w.x][w.y] = IHDOT;
+           if (game.landed) {
+               /* captain perishes on planet */
+               finish(FDPLANET);
+           }
+           return;
+       case IHW: /* Hit an inhabited world -- very bad! */
+           crmena(true, iquad, sector, w);
+           prout(_(" destroyed."));
+           game.state.nworldkl++;
+           q->planet = NOPLANET;
+           game.state.planets[game.iplnet].pclass = destroyed;
+           game.iplnet = 0;
+           invalidate(game.plnet);
+           game.quad[w.x][w.y] = IHDOT;
+           if (game.landed) {
+               /* captain perishes on planet */
+               finish(FDPLANET);
+           }
+           prout(_("You have just destroyed an inhabited planet."));
+           prout(_("Celebratory rallies are being held on the Klingon homeworld."));
+           return;
+       case IHSTAR: /* Hit a star */
+           if (Rand() > 0.10) {
+               nova(w);
+               return;
+           }
+           crmena(true, IHSTAR, sector, w);
+           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(w, iquad, w);
+           } 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 = true;
+               shoved = true;
+           }
+           return;
+       case IHBLANK: /* Black hole */
+           skip(1);
+           crmena(true, IHBLANK, sector, w);
+           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 * distance(w, in) * fabs(sin(bullseye-angle));
+           h1 = fabs(h1);
+           if (h1 >= 600) {
+               game.quad[w.x][w.y] = IHDOT;
+               game.ithere = false;
+               deadkl(w, iquad, w);
+               return;
+           }
+           skip(1);
+           crmena(true, IHT, sector, w);
+           if (Rand() > 0.05) {
+               prout(_(" survives photon blast."));
+               return;
+           }
+           prout(_(" disappears."));
+           game.quad[w.x][w.y] = IHWEB;
+           game.ithere = false;
+           game.nenhere--;
+           dropin(IHBLANK);
+           return;
+                                       
+       default: /* Problem! */
+           skip(1);
+           proutn("Don't know how to handle collision with ");
+           crmena(true, iquad, sector, w);
+           skip(1);
+           return;
+       }
+       break;
+    }
+    if(curwnd!=message_window) {
+       setwnd(message_window);
+    }
+    if (shoved) {
+       game.quad[w.x][w.y]=IHDOT;
+       game.quad[jw.x][jw.y]=iquad;
+       prout(_(" displaced by blast to %s "), cramlc(sector, jw));
+       for (ll = 1; ll <= game.nenhere; ll++)
+           game.kdist[ll] = game.kavgd[ll] = distance(game.sector,game.ks[ll]);
+       sortklings();
+       return;
+    }
+    skip(1);
+    prout(_("Torpedo missed."));
+    return;
+}
+
+static void fry(double hit)
+/* critical-hit resolution */
+{
+    double ncrit, extradm;
+    int ktr=1, loop1, loop2, j, cdam[NDEVICES];
+
+    /* a critical hit occured */
+    if (hit < (275.0-25.0*game.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 (loop1 = 0; loop1 < ncrit; loop1++) {
+       do {
+           j = randdevice();
+           /* Cheat to prevent shuttle damage unless on ship */
+       } while 
+             (game.damage[j]<0.0 || (j==DSHUTTL && game.iscraft != onship));
+       cdam[loop1] = j;
+       extradm = (hit*game.damfac)/(ncrit*(75.0+25.0*Rand()));
+       game.damage[j] += extradm;
+       if (loop1 > 0) {
+           for (loop2 = 0; loop2 < loop1 && j != cdam[loop2]; loop2++) ;
+           if (loop2 < loop1)
+               continue;
+           ktr += 1;
+           if (ktr==3)
+               skip(1);
+           proutn(_(" and "));
+       }
+       proutn(device[j]);
+    }
+    prout(_(" damaged."));
+    if (damaged(DSHIELD) && game.shldup) {
+       prout(_("***Shields knocked down."));
+       game.shldup=false;
+    }
+}
+
+void attack(bool torps_ok) 
+/* bad guy attacks us */
+{
+    /* torps_ok == false forces use of phasers in an attack */
+    int percent, loop, iquad;
+    bool usephasers, atackd = false, attempt = false, ihurt = false;
+    double hit, pfac, dustfac, hitmax=0.0, hittot=0.0, chgfac=1.0, r;
+    coord jay;
+    enum loctype where = neither;
+
+    /* game could be over at this point, check */
+    if (game.alldone) 
+       return;
+
+    if (idebug) 
+       prout("=== ATTACK!");
+
+    /* Tholian gewts to move before attacking */
+    if (game.ithere) 
+       movetholian();
+
+    /* if you have just entered the RNZ, you'll get a warning */
+    if (game.neutz) { /* The one chance not to be attacked */
+       game.neutz = false;
+       return;
+    }
+
+    /* commanders get a chance to tac-move towards you */
+    if ((((game.comhere || game.ishere) && !game.justin) || game.skill == SKILL_EMERITUS) && torps_ok) 
+       moveklings();
+
+    /* if no enemies remain after movement, we're done */
+    if (game.nenhere==0 || (game.nenhere==1 && iqhere && !iqengry)) 
+       return;
+
+    /* set up partial hits if attack happens during shield status change */
+    pfac = 1.0/game.inshld;
+    if (game.shldchg)
+       chgfac = 0.25+0.5*Rand();
+
+    skip(1);
+
+    /* message verbosity control */
+    if (game.skill <= SKILL_FAIR) 
+       where = sector;
+
+    for (loop = 1; loop <= game.nenhere; loop++) {
+       if (game.kpower[loop] < 0)
+           continue;   /* too weak to attack */
+       /* compute hit strength and diminish shield power */
+       r = Rand();
+       /* Increase chance of photon torpedos if docked or enemy energy low */
+       if (game.condition == docked)
+           r *= 0.25;
+       if (game.kpower[loop] < 500)
+           r *= 0.25; 
+       jay = game.ks[loop];
+       iquad = game.quad[jay.x][jay.y];
+       if (iquad==IHT || (iquad==IHQUEST && !iqengry))
+           continue;
+       /* different enemies have different probabilities of throwing a torp */
+       usephasers = !torps_ok || \
+           (iquad == IHK && r > 0.0005) || 
+           (iquad==IHC && r > 0.015) ||
+           (iquad==IHR && r > 0.3) ||
+           (iquad==IHS && r > 0.07) ||
+           (iquad==IHQUEST && r > 0.05);
+       if (usephasers) {           /* Enemy uses phasers */
+           if (game.condition == docked)
+               continue; /* Don't waste the effort! */
+           attempt = true; /* Attempt to attack */
+           dustfac = 0.8+0.05*Rand();
+           hit = game.kpower[loop]*pow(dustfac,game.kavgd[loop]);
+           game.kpower[loop] *= 0.75;
+       }
+       else { /* Enemy uses photon torpedo */
+           double course = 1.90985*atan2((double)game.sector.y-jay.y, (double)jay.x-game.sector.x);
+           hit = 0;
+           proutn(_("***TORPEDO INCOMING"));
+           if (!damaged(DSRSENS)) {
+               proutn(_(" From "));
+               crmena(false, iquad, where, jay);
+           }
+           attempt = true;
+           prout("  ");
+           r = (Rand()+Rand())*0.5 -0.5;
+           r += 0.002*game.kpower[loop]*r;
+           torpedo(course, r, jay, &hit, 1, 1);
+           if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0) 
+               finish(FWON); /* Klingons did themselves in! */
+           if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova || game.alldone) 
+               return; /* Supernova or finished */
+           if (hit == 0)
+               continue;
+       }
+       /* incoming phaser or torpedo, shields may dissipate it */
+       if (game.shldup || game.shldchg || game.condition==docked) {
+           /* shields will take hits */
+           double absorb, hitsh, propor = pfac*game.shield*(game.condition==docked ? 2.1 : 1.0);
+           if (propor < 0.1)
+               propor = 0.1;
+           hitsh = propor*chgfac*hit+1.0;
+           absorb = 0.8*hitsh;
+           if (absorb > game.shield)
+               absorb = game.shield;
+           game.shield -= absorb;
+           hit -= hitsh;
+           /* taking a hit blasts us out of a starbase dock */
+           if (game.condition == docked)
+               dock(false);
+           /* but the shields may take care of it */
+           if (propor > 0.1 && hit < 0.005*game.energy) 
+               continue;
+       }
+       /* hit from this opponent got through shields, so take damage */
+       ihurt = true;
+       proutn(_("%d unit hit"), (int)hit);
+       if ((damaged(DSRSENS) && usephasers) || game.skill<=SKILL_FAIR) {
+           proutn(_(" on the "));
+           crmshp();
+       }
+       if (!damaged(DSRSENS) && usephasers) {
+           proutn(_(" from "));
+           crmena(false, iquad, where, jay);
+       }
+       skip(1);
+       /* Decide if hit is critical */
+       if (hit > hitmax)
+           hitmax = hit;
+       hittot += hit;
+       fry(hit);
+       game.energy -= hit;
+    }
+    if (game.energy <= 0) {
+       /* Returning home upon your shield, not with it... */
+       finish(FBATTLE);
+       return;
+    }
+    if (!attempt && game.condition == docked)
+       prout(_("***Enemies decide against attacking your ship."));
+    if (!atackd)
+       return;
+    percent = 100.0*pfac*game.shield+0.5;
+    if (!ihurt) {
+       /* 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)game.energy);
+       if (game.shldup)
+           proutn(_("up "));
+       else if (!damaged(DSHIELD))
+           proutn(_("down "));
+       else
+           proutn(_("damaged, "));
+    }
+    prout(_("%d%%,   torpedoes left %d"), percent, game.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.\""));
+           game.casual += icas;
+           game.state.crew -= icas;
+       }
+    }
+    /* After attack, reset average distance to enemies */
+    for (loop = 1; loop <= game.nenhere; loop++)
+       game.kavgd[loop] = game.kdist[loop];
+    sortklings();
+    return;
+}
+               
+void deadkl(coord w, feature type, coord mv)
+/* kill a Klingon, Tholian, Romulan, or Thingy */
+{
+    /* Added mv to allow enemy to "move" before dying */
+    int i,j;
+
+    crmena(true, type, sector, mv);
+    /* Decide what kind of enemy it is and update appropriately */
+    if (type == IHR) {
+       /* chalk up a Romulan */
+       game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans--;
+       game.irhere--;
+       game.state.nromrem--;
+    }
+    else if (type == IHT) {
+       /* Killed a Tholian */
+       game.ithere = false;
+    }
+    else if (type == IHQUEST) {
+       /* Killed a Thingy */
+       iqhere = iqengry = false;
+       invalidate(thing);
+    }
+    else {
+       /* Some type of a Klingon */
+       game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons--;
+       game.klhere--;
+       switch (type) {
+       case IHC:
+           game.comhere = false;
+           for (i = 1; i <= game.state.remcom; i++)
+               if (same(game.state.kcmdr[i], game.quadrant)) 
+                   break;
+           game.state.kcmdr[i] = game.state.kcmdr[game.state.remcom];
+           game.state.kcmdr[game.state.remcom].x = 0;
+           game.state.kcmdr[game.state.remcom].y = 0;
+           game.state.remcom--;
+           unschedule(FTBEAM);
+           if (game.state.remcom != 0)
+               schedule(FTBEAM, expran(1.0*game.incom/game.state.remcom));
+           break;
+       case IHK:
+           game.state.remkl--;
+           break;
+       case IHS:
+           game.state.nscrem--;
+           game.ishere = false;
+           game.state.kscmdr.x = game.state.kscmdr.y = game.isatb = 0;
+           game.iscate = false;
+           unschedule(FSCMOVE);
+           unschedule(FSCDBAS);
+           break;
+       default:        /* avoids a gcc warning */
+           prout("*** Internal error, deadkl() called on %c\n", type);
+           break;
+       }
+    }
+
+    /* For each kind of enemy, finish message to player */
+    prout(_(" destroyed."));
+    game.quad[w.x][w.y] = IHDOT;
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
+       return;
+
+    game.state.remtime = game.state.remkl + game.state.remcom > 0 ?
+           game.state.remres/(game.state.remkl + 4*game.state.remcom) : 99;
+
+    /* Remove enemy ship from arrays describing local conditions */
+    if (is_scheduled(FCDBAS) && same(game.battle, game.quadrant) && type==IHC)
+       unschedule(FCDBAS);
+    for (i = 1; i <= game.nenhere; i++)
+       if (same(game.ks[i], w))
+           break;
+    game.nenhere--;
+    if (i <= game.nenhere)  {
+       for (j=i; j<=game.nenhere; j++) {
+           game.ks[j] = game.ks[j+1];
+           game.kpower[j] = game.kpower[j+1];
+           game.kavgd[j] = game.kdist[j] = game.kdist[j+1];
+       }
+    }
+    game.ks[game.nenhere+1].x = 0;
+    game.ks[game.nenhere+1].x = 0;
+    game.kdist[game.nenhere+1] = 0;
+    game.kavgd[game.nenhere+1] = 0;
+    game.kpower[game.nenhere+1] = 0;
+    return;
+}
+
+static bool targetcheck(double x, double y, double *course) 
+{
+    double deltx, delty;
+    /* Return true if target is invalid */
+    if (!VALID_SECTOR(x, y)) {
+       huh();
+       return true;
+    }
+    deltx = 0.1*(y - game.sector.y);
+    delty = 0.1*(game.sector.x - 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 true;
+    }
+    *course = 1.90985932*atan2(deltx, delty);
+    return false;
+}
+
+void torps(void) 
+/* launch photon torpedo salvo */
+{
+    double targ[4][3], course[4];
+    double r, dummy;
+    int key, n, i;
+
+    game.ididit = false;
+
+    if (damaged(DPHOTON)) {
+       prout(_("Photon tubes damaged."));
+       chew();
+       return;
+    }
+    if (game.torps == 0) {
+       prout(_("No torpedoes left."));
+       chew();
+       return;
+    }
+    key = scan();
+    for (;;) {
+       if (key == IHALPHA) {
+           huh();
+           return;
+       }
+       else if (key == IHEOL) {
+           prout(_("%d torpedoes left."), game.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 <= game.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;
+       }
+    }
+    game.ididit = true;
+    /* Loop for moving <n> torpedoes */
+    for (i = 1; i <= n; i++) {
+       if (game.condition != docked)
+           game.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."));
+           if (Rand() <= 0.2) {
+               prout(_("***Photon tubes damaged by misfire."));
+               game.damage[DPHOTON] = game.damfac*(1.0+2.0*Rand());
+           }
+           break;
+       }
+       if (game.shldup || game.condition == docked) 
+           r *= 1.0 + 0.0001*game.shield;
+       torpedo(course[i], r, game.sector, &dummy, i, n);
+       if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
+           return;
+    }
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
+       finish(FWON);
+}
+
+       
+
+static void overheat(double rpow)
+/* check for phasers overheating */
+{
+    if (rpow > 1500) {
+       double chekbrn = (rpow-1500.)*0.00038;
+       if (Rand() <= chekbrn) {
+           prout(_("Weapons officer Sulu-  \"Phasers overheated, sir.\""));
+           game.damage[DPHASER] = game.damfac*(1.0 + Rand()) * (1.0+chekbrn);
+       }
+    }
+}
+
+static bool checkshctrl(double rpow) 
+/* check shield control */
+{
+    double hit;
+    int icas;
+       
+    skip(1);
+    if (Rand() < 0.998) {
+       prout(_("Shields lowered."));
+       return false;
+    }
+    /* Something bad has happened */
+    prouts(_("***RED ALERT!  RED ALERT!"));
+    skip(2);
+    hit = rpow*game.shield/game.inshld;
+    game.energy -= rpow+hit*0.8;
+    game.shield -= hit*0.2;
+    if (game.energy <= 0.0) {
+       prouts(_("Sulu-  \"Captain! Shield malf***********************\""));
+       skip(1);
+       stars();
+       finish(FPHASER);
+       return true;
+    }
+    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);
+       game.casual += icas;
+       game.state.crew -= icas;
+    }
+    skip(1);
+    prout(_("Phaser energy dispersed by shields."));
+    prout(_("Enemy unaffected."));
+    overheat(rpow);
+    return true;
+}
+       
+
+void phasers(void) 
+/* fire phasers */
+{
+    double hits[21], rpow=0, extra, powrem, over, temp;
+    int kz = 0, k=1, i, irec=0; /* Cheating inhibitor */
+    bool ifast = false, no = false, itarg = true, msgflag = true;
+    enum {NOTSET, MANUAL, FORCEMAN, AUTOMATIC} automode = NOTSET;
+    int key=0;
+
+    skip(1);
+    /* SR sensors and Computer are needed fopr automode */
+    if (damaged(DSRSENS) || damaged(DCOMPTR)) 
+       itarg = false;
+    if (game.condition == docked) {
+       prout(_("Phasers can't be fired through base shields."));
+       chew();
+       return;
+    }
+    if (damaged(DPHASER)) {
+       prout(_("Phaser control damaged."));
+       chew();
+       return;
+    }
+    if (game.shldup) {
+       if (damaged(DSHCTRL)) {
+           prout(_("High speed shield control damaged."));
+           chew();
+           return;
+       }
+       if (game.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 = true;
+               
+    }
+    /* Original code so convoluted, I re-did it all */
+    while (automode==NOTSET) {
+       key=scan();
+       if (key == IHALPHA) {
+           if (isit("manual")) {
+               if (game.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 ((!itarg) && game.nenhere != 0) {
+                   automode = FORCEMAN;
+               }
+               else {
+                   if (game.nenhere==0)
+                       prout(_("Energy will be expended into space."));
+                   automode = AUTOMATIC;
+                   key = scan();
+               }
+           }
+           else if (isit("no")) {
+               no = true;
+           }
+           else {
+               huh();
+               return;
+           }
+       }
+       else if (key == IHREAL) {
+           if (game.nenhere==0) {
+               prout(_("Energy will be expended into space."));
+               automode = AUTOMATIC;
+           }
+           else if (!itarg)
+               automode = FORCEMAN;
+           else
+               automode = AUTOMATIC;
+       }
+       else {
+           /* IHEOL */
+           if (game.nenhere==0) {
+               prout(_("Energy will be expended into space."));
+               automode = AUTOMATIC;
+           }
+           else if (!itarg)
+               automode = FORCEMAN;
+           else 
+               proutn(_("Manual or automatic? "));
+       }
+    }
+                               
+    switch (automode) {
+    case AUTOMATIC:
+       if (key == IHALPHA && isit("no")) {
+           no = true;
+           key = scan();
+       }
+       if (key != IHREAL && game.nenhere != 0) {
+           prout(_("Phasers locked on target. Energy available: %.2f"),
+                 ifast?game.energy-200.0:game.energy);
+       }
+       irec=0;
+       do {
+           chew();
+           if (!kz)
+               for (i = 1; i <= game.nenhere; 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?game.energy-200:game.energy)) {
+               proutn(_("Energy available= %.2f"),
+                      ifast?game.energy-200:game.energy);
+               skip(1);
+               key = IHEOL;
+           }
+       } while (rpow > (ifast?game.energy-200:game.energy));
+       if (rpow<=0) {
+           /* chicken out */
+           chew();
+           return;
+       }
+       if ((key=scan()) == IHALPHA && isit("no")) {
+           no = true;
+       }
+       if (ifast) {
+           game.energy -= 200; /* Go and do it! */
+           if (checkshctrl(rpow))
+               return;
+       }
+       chew();
+       game.energy -= rpow;
+       extra = rpow;
+       if (game.nenhere) {
+           extra = 0.0;
+           powrem = rpow;
+           for (i = 1; i <= game.nenhere; 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);
+           game.ididit = true;
+       }
+       if (extra > 0 && !game.alldone) {
+           if (game.ithere) {
+               proutn(_("*** Tholian web absorbs "));
+               if (game.nenhere>0)
+                   proutn(_("excess "));
+               prout(_("phaser energy."));
+           }
+           else {
+               prout(_("%d expended on empty space."), (int)extra);
+           }
+       }
+       break;
+
+    case FORCEMAN:
+       chew();
+       key = IHEOL;
+       if (damaged(DCOMPTR))
+           prout(_("Battle computer damaged, manual fire 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 <= game.nenhere;) {
+           coord aim = game.ks[k];
+           int ienm = game.quad[aim.x][aim.y];
+           if (msgflag) {
+               proutn(_("Energy available= %.2f"),
+                      game.energy-.006-(ifast?200:0));
+               skip(1);
+               msgflag = false;
+               rpow = 0.0;
+           }
+           if (damaged(DSRSENS) && !(abs(game.sector.x-aim.x) < 2 && abs(game.sector.y-aim.y) < 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 (itarg && 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 (!damaged(DCOMPTR))
+                   proutn("%d", irec);
+               else
+                   proutn("??");
+               proutn(")  ");
+               proutn(_("units to fire at "));
+               crmena(false, ienm, sector, aim);
+               proutn("-  ");
+               key = scan();
+           }
+           if (key == IHALPHA && isit("no")) {
+               no = true;
+               key = scan();
+               continue;
+           }
+           if (key == IHALPHA) {
+               huh();
+               return;
+           }
+           if (key == IHEOL) {
+               if (k==1) { /* Let me say I'm baffled by this */
+                   msgflag = true;
+               }
+               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?game.energy-200:game.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 = true;
+       }
+       game.energy -= rpow;
+       chew();
+       if (ifast) {
+           game.energy -= 200.0;
+           if (checkshctrl(rpow))
+               return;
+       }
+       hittem(hits);
+       game.ididit = true;
+    case NOTSET:;      /* avoid gcc warning */
+    }
+    /* Say shield raised or malfunction, if necessary */
+    if (game.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!"));
+               game.shldup = false;
+           }
+           else
+               prout(_("Shields raised."));
+       }
+       else
+           game.shldup = false;
+    }
+    overheat(rpow);
+}
+
+void hittem(double *hits) 
+/* register a phaser hit on Klingons and Romulans */
+{
+    double kp, kpow, wham, hit, dustfac, kpini;
+    int nenhr2=game.nenhere, k=1, kk=1, ienm;
+    coord w;
+
+    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];
+       w = game.ks[kk];
+       if (hit > 0.005) {
+           if (!damaged(DSRSENS))
+               boom(w);
+           proutn(_("%d unit hit on "), (int)hit);
+       }
+       else
+           proutn(_("Very small hit on "));
+       ienm = game.quad[w.x][w.y];
+       if (ienm==IHQUEST)
+           iqengry = true;
+       crmena(false,ienm,sector,w);
+       skip(1);
+       if (kpow == 0) {
+           deadkl(w, ienm, w);
+           if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
+               finish(FWON);           
+           if (game.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 %s"),
+                     cramlc(sector, w));
+               prout(_("   has just lost its firepower.\""));
+               game.kpower[kk] = -kpow;
+           }
+    }
+    return;
+}
+
diff --git a/historic/c-version/src/events.c b/historic/c-version/src/events.c
new file mode 100644 (file)
index 0000000..3362fdd
--- /dev/null
@@ -0,0 +1,971 @@
+/*
+ * events.c -- event-queue handling
+ *
+ * This isn't a real event queue a la BSD Trek yet -- you can only have one 
+ * event of each type active at any given time.  Mostly these means we can 
+ * only have one FDISTR/FENSLV/FREPRO sequence going at any given time;
+ * BSD Trek, from which we swiped the idea, can have up to 5.
+ */
+#include "sst.h"
+#include <math.h>
+
+event *unschedule(int evtype)
+/* remove an event from the schedule */
+{
+    game.future[evtype].date = FOREVER;
+    return &game.future[evtype];
+}
+
+int is_scheduled(int evtype)
+/* is an event of specified type scheduled */
+{
+    return game.future[evtype].date != FOREVER;
+}
+
+double scheduled(int evtype)
+/* when will this event happen? */
+{
+    return game.future[evtype].date;
+}
+
+event *schedule(int evtype, double offset)
+/* schedule an event of specified type */
+{
+    game.future[evtype].date = game.state.date + offset;
+    return &game.future[evtype];
+}
+
+void postpone(int evtype, double offset)
+/* postpone a scheduled event */
+{
+    game.future[evtype].date += offset;
+}
+
+static bool cancelrest(void)
+/* rest period is interrupted by event */
+{
+    if (game.resting) {
+       skip(1);
+       proutn(_("Mr. Spock-  \"Captain, shall we cancel the rest period?\""));
+       if (ja() == true) {
+           game.resting = false;
+           game.optime = 0.0;
+           return true;
+       }
+    }
+
+    return false;
+}
+
+void events(void) 
+/* run through the event queue looking for things to do */
+{
+    int evcode, i=0, j, k, l;
+    double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
+    bool ictbeam = false, istract = false;
+    struct quadrant *pdest, *q;
+    coord w, hold;
+    event *ev, *ev2;
+    bool fixed_dev[NDEVICES];
+
+    if (idebug) {
+       prout("=== EVENTS from %.2f to %.2f:", game.state.date, fintim);
+       for (i = 1; i < NEVENTS; i++) {
+           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;
+           case FDSPROB: proutn("=== Probe Move      "); break;
+           case FDISTR:  proutn("=== Distress Call   "); break;
+           case FENSLV:  proutn("=== Enslavement     "); break;
+           case FREPRO:  proutn("=== Klingon Build   "); break;
+           }
+           if (is_scheduled(i))
+               prout("%.2f", scheduled(i));
+           else
+               prout("never");
+
+       }
+    }
+
+    hold.x = hold.y = 0;
+    for (;;) {
+       /* Select earliest extraneous event, evcode==0 if no events */
+       evcode = FSPY;
+       if (game.alldone)
+           return;
+       datemin = fintim;
+       for (l = 1; l < NEVENTS; l++)
+           if (game.future[l].date < datemin) {
+               evcode = l;
+               if (idebug)
+                   prout("== Event %d fires", evcode);
+               datemin = game.future[l].date;
+           }
+       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.remkl + game.state.remcom > 0 ?
+               game.state.remres/(game.state.remkl + 4*game.state.remcom) : 99;
+       if (game.state.remtime <=0) {
+           finish(FDEPLETE);
+           return;
+       }
+       /* Any crew left alive? */
+       if (game.state.crew <=0) {
+           finish(FCREW);
+           return;
+       }
+       /* Is life support adequate? */
+       if (damaged(DLIFSUP) && game.condition != docked) {
+           if (game.lsupres < xtime && game.damage[DLIFSUP] > game.lsupres) {
+               finish(FLIFESUP);
+               return;
+           }
+           game.lsupres -= xtime;
+           if (game.damage[DLIFSUP] <= xtime)
+               game.lsupres = game.inlsr;
+       }
+       /* Fix devices */
+       repair = xtime;
+       if (game.condition == docked)
+           repair /= game.docfac;
+       /* Don't fix Deathray here */
+       for (l=0; l<NDEVICES; l++) {
+           fixed_dev[l] = false;
+           if (game.damage[l] > 0.0 && l != DDRAY) {
+               double reminder = (game.damage[l] > repair ?
+                       game.damage[l] - repair : .0);
+               game.damage[l] = reminder;
+               if (!(reminder > 0))
+                   fixed_dev[l] = true;
+           }
+       }
+       /* If radio repaired, update star chart and attack reports */
+       if (fixed_dev[DRADIO]) {
+           prout(_("Lt. Uhura- \"Captain, the sub-space radio is working and"));
+           prout(_("   surveillance reports are coming in."));
+           skip(1);
+           if (!game.iseenit) {
+               attackreport(false);
+               game.iseenit = true;
+           }
+           prout(_("   The star chart is now up to date.\""));
+           skip(1);
+       }
+       if (fixed_dev[DRADIO] || fixed_dev[DLRSENS] || fixed_dev[DSRSENS])
+           rechart();
+       /* Cause extraneous event EVCODE to occur */
+       game.optime -= xtime;
+       switch (evcode) {
+       case FSNOVA: /* Supernova */
+           announce();
+           supernova(false, NULL);
+           schedule(FSNOVA, expran(0.5*game.intime));
+           if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
+               return;
+           break;
+       case FSPY: /* Check with spy to see if S.C. should tractor beam */
+           if (game.state.nscrem == 0 ||
+               ictbeam || istract ||
+               game.condition==docked || game.isatb==1 || game.iscate)
+               return;
+           if (game.ientesc ||
+               (game.energy < 2000 && game.torps < 4 && game.shield < 1250) ||
+               (damaged(DPHASER) && (damaged(DPHOTON) || game.torps < 4)) ||
+               (damaged(DSHIELD) &&
+                (game.energy < 2500 || damaged(DPHASER)) &&
+                (game.torps < 5 || damaged(DPHOTON)))) {
+               /* Tractor-beam her! */
+               istract = true;
+               yank = distance(game.state.kscmdr, game.quadrant);
+               /********* fall through to FTBEAM code ***********/
+           }
+           else
+               return;
+       case FTBEAM: /* Tractor beam */
+           if (evcode==FTBEAM) {
+               if (game.state.remcom == 0) {
+                   unschedule(FTBEAM);
+                   break;
+               }
+               i = Rand()*game.state.remcom+1.0;
+               yank = square(game.state.kcmdr[i].x-game.quadrant.x) + square(game.state.kcmdr[i].y-game.quadrant.y);
+               if (istract || game.condition == docked || yank == 0) {
+                   /* Drats! Have to reschedule */
+                   schedule(FTBEAM, 
+                            game.optime + expran(1.5*game.intime/game.state.remcom));
+                   break;
+               }
+           }
+           /* tractor beaming cases merge here */
+           yank = sqrt(yank);
+           announce();
+           game.optime = (10.0/(7.5*7.5))*yank; /* 7.5 is yank rate (warp 7.5) */
+           ictbeam = true;
+           skip(1);
+           proutn("***");
+           crmshp();
+           prout(_(" caught in long range tractor beam--"));
+           /* If Kirk & Co. screwing around on planet, handle */
+           atover(true); /* atover(true) is Grab */
+           if (game.alldone)
+               return;
+           if (game.icraft) { /* Caught in Galileo? */
+               finish(FSTRACTOR);
+               return;
+           }
+           /* Check to see if shuttle is aboard */
+           if (game.iscraft == offship) {
+               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;
+                   game.iscraft = removed;
+               }
+               else {
+                   prout(_("Galileo, left on the planet surface, is well hidden."));
+               }
+           }
+           if (evcode==0)
+               game.quadrant = game.state.kscmdr;
+           else
+               game.quadrant = game.state.kcmdr[i];
+           game.sector = randplace(QUADSIZE);
+           crmshp();
+           proutn(_(" is pulled to "));
+           proutn(cramlc(quadrant, game.quadrant));
+           proutn(", ");
+           prout(cramlc(sector, game.sector));
+           if (game.resting) {
+               prout(_("(Remainder of rest/repair period cancelled.)"));
+               game.resting = false;
+           }
+           if (!game.shldup) {
+               if (!damaged(DSHIELD) && game.shield > 0) {
+                   doshield(true); /* raise shields */
+                   game.shldchg=false;
+               }
+               else
+                   prout(_("(Shields not currently useable.)"));
+           }
+           newqad(false);
+           /* Adjust finish time to time of tractor beaming */
+           fintim = game.state.date+game.optime;
+           attack(false);
+           if (game.state.remcom <= 0)
+               unschedule(FTBEAM);
+           else 
+               schedule(FTBEAM, game.optime+expran(1.5*game.intime/game.state.remcom));
+           break;
+       case FSNAP: /* Snapshot of the universe (for time warp) */
+           game.snapsht = game.state;
+           game.state.snap = true;
+           schedule(FSNAP, expran(0.5 * game.intime));
+           break;
+       case FBATTAK: /* Commander attacks starbase */
+           if (game.state.remcom==0 || game.state.rembase==0) {
+               /* no can do */
+               unschedule(FBATTAK);
+               unschedule(FCDBAS);
+               break;
+           }
+           i = 0;
+           for (j = 1; j <= game.state.rembase; j++) {
+               for (k = 1; k <= game.state.remcom; k++)
+                   if (same(game.state.baseq[j], game.state.kcmdr[k]) &&
+                       !same(game.state.baseq[j], game.quadrant) &&
+                       !same(game.state.baseq[j], game.state.kscmdr)) {
+                       i = 1;
+                       break;
+                   }
+               if (i == 1)
+                   break;
+           }
+           if (j>game.state.rembase) {
+               /* no match found -- try later */
+               schedule(FBATTAK, expran(0.3*game.intime));
+               unschedule(FCDBAS);
+               break;
+           }
+           /* commander + starbase combination found -- launch attack */
+           game.battle = game.state.baseq[j];
+           schedule(FCDBAS, 1.0+3.0*Rand());
+           if (game.isatb) /* extra time if SC already attacking */
+               postpone(FCDBAS, scheduled(FSCDBAS)-game.state.date);
+           game.future[FBATTAK].date = game.future[FCDBAS].date + expran(0.3*game.intime);
+           game.iseenit = false;
+           if (!damaged(DRADIO) && game.condition != docked) 
+               break; /* No warning :-( */
+           game.iseenit = true;
+           announce();
+           skip(1);
+           proutn(_("Lt. Uhura-  \"Captain, the starbase in "));
+           prout(cramlc(quadrant, game.battle));
+           prout(_("   reports that it is under attack and that it can"));
+           proutn(_("   hold out only until stardate %d"),
+                  (int)scheduled(FCDBAS));
+           prout(".\"");
+           if (cancelrest())
+               return;
+           break;
+       case FSCDBAS: /* Supercommander destroys base */
+           unschedule(FSCDBAS);
+           game.isatb = 2;
+           if (!game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].starbase) 
+               break; /* WAS RETURN! */
+           hold = game.battle;
+           game.battle = game.state.kscmdr;
+           /* FALL THROUGH */
+       case FCDBAS: /* Commander succeeds in destroying base */
+           if (evcode==FCDBAS) {
+               unschedule(FCDBAS);
+               /* find the lucky pair */
+               for (i = 1; i <= game.state.remcom; i++)
+                   if (same(game.state.kcmdr[i], game.battle)) 
+                       break;
+               if (i > game.state.remcom || game.state.rembase == 0 ||
+                   !game.state.galaxy[game.battle.x][game.battle.y].starbase) {
+                   /* No action to take after all */
+                   invalidate(game.battle);
+                   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 (same(game.battle, game.quadrant)) {
+               game.state.chart[game.battle.x][game.battle.y].starbase = false;
+               game.quad[game.base.x][game.base.y] = IHDOT;
+               game.base.x=game.base.y=0;
+               newcnd();
+               skip(1);
+               prout(_("Spock-  \"Captain, I believe the starbase has been destroyed.\""));
+           }
+           else if (game.state.rembase != 1 &&
+                    (!damaged(DRADIO) || game.condition == docked)) {
+               /* Get word via subspace radio */
+               announce();
+               skip(1);
+               prout(_("Lt. Uhura-  \"Captain, Starfleet Command reports that"));
+               proutn(_("   the starbase in "));
+               proutn(cramlc(quadrant, game.battle));
+               prout(_(" has been destroyed by"));
+               if (game.isatb == 2) 
+                   prout(_("the Klingon Super-Commander"));
+               else
+                   prout(_("a Klingon Commander"));
+               game.state.chart[game.battle.x][game.battle.y].starbase = false;
+           }
+           /* Remove Starbase from galaxy */
+           game.state.galaxy[game.battle.x][game.battle.y].starbase = false;
+           for (i = 1; i <= game.state.rembase; i++)
+               if (same(game.state.baseq[i], game.battle))
+                   game.state.baseq[i] = game.state.baseq[game.state.rembase];
+           game.state.rembase--;
+           if (game.isatb == 2) {
+               /* reinstate a commander's base attack */
+               game.battle = hold;
+               game.isatb = 0;
+           }
+           else
+               invalidate(game.battle);
+           break;
+       case FSCMOVE: /* Supercommander moves */
+           schedule(FSCMOVE, 0.2777);
+           if (!game.ientesc && !istract && game.isatb != 1 &&
+                       (!game.iscate || !game.justin)) 
+               supercommander();
+           break;
+       case FDSPROB: /* Move deep space probe */
+           schedule(FDSPROB, 0.01);
+           game.probex += game.probeinx;
+           game.probey += game.probeiny;
+           i = (int)(game.probex/QUADSIZE +0.05);
+           j = (int)(game.probey/QUADSIZE + 0.05);
+           if (game.probec.x != i || game.probec.y != j) {
+               game.probec.x = i;
+               game.probec.y = j;
+               if (!VALID_QUADRANT(i, j) ||
+                   game.state.galaxy[game.probec.x][game.probec.y].supernova) {
+                   // Left galaxy or ran into supernova
+                   if (!damaged(DRADIO) || game.condition == docked) {
+                       announce();
+                       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(".\"");
+                   }
+                   unschedule(FDSPROB);
+                   break;
+               }
+               if (!damaged(DRADIO) || game.condition == docked) {
+                   announce();
+                   skip(1);
+                   proutn(_("Lt. Uhura-  \"The deep space probe is now in "));
+                   proutn(cramlc(quadrant, game.probec));
+                   prout(".\"");
+               }
+           }
+           pdest = &game.state.galaxy[game.probec.x][game.probec.y];
+           /* Update star chart if Radio is working or have access to
+              radio. */
+           if (!damaged(DRADIO) || game.condition == docked) {
+               struct page *chp = &game.state.chart[game.probec.x][game.probec.y];
+
+               chp->klingons = pdest->klingons;
+               chp->starbase = pdest->starbase;
+               chp->stars = pdest->stars;
+               pdest->charted = true;
+           }
+           game.proben--; // One less to travel
+           if (game.proben == 0 && game.isarmed && pdest->stars) {
+               /* lets blow the sucker! */
+               supernova(true, &game.probec);
+               unschedule(FDSPROB);
+               if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) 
+                   return;
+           }
+           break;
+       case FDISTR: /* inhabited system issues distress call */
+           unschedule(FDISTR);
+           /* try a whole bunch of times to find something suitable */
+           i = 100;
+           do {
+               // need a quadrant which is not the current one,
+               // which has some stars which are inhabited and
+               // not already under attack, which is not
+               // supernova'ed, and which has some Klingons in it
+               w = randplace(GALSIZE);
+               q = &game.state.galaxy[w.x][w.y];
+           } while (--i &&
+                    (same(game.quadrant, w) || q->planet == NOPLANET ||
+                     game.state.planets[q->planet].inhabited == UNINHABITED ||
+                     q->supernova || q->status!=secure || q->klingons<=0));
+           if (i == 0) {
+               /* can't seem to find one; ignore this call */
+               if (idebug)
+                   prout("=== Couldn't find location for distress event.");
+               break;
+           }
+
+           /* got one!!  Schedule its enslavement */
+           ev = schedule(FENSLV, expran(game.intime));
+           ev->quadrant = w;
+           q->status = distressed;
+
+           /* tell the captain about it if we can */
+           if (!damaged(DRADIO) || game.condition == docked)
+           {
+               prout(_("Uhura- Captain, %s in %s reports it is under attack"),
+                     systnames[q->planet], cramlc(quadrant, w));
+               prout(_("by a Klingon invasion fleet."));
+               if (cancelrest())
+                   return;
+           }
+           break;
+       case FENSLV:            /* starsystem is enslaved */
+           ev = unschedule(FENSLV);
+           /* see if current distress call still active */
+           q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
+           if (q->klingons <= 0) {
+               q->status = secure;
+               break;
+           }
+           q->status = enslaved;
+
+           /* play stork and schedule the first baby */
+           ev2 = schedule(FREPRO, expran(2.0 * game.intime));
+           ev2->quadrant = ev->quadrant;
+
+           /* report the disaster if we can */
+           if (!damaged(DRADIO) || game.condition == docked)
+           {
+               prout(_("Uhura- We've lost contact with starsystem %s"),
+                     systnames[q->planet]);
+               prout(_("in %s.\n"), cramlc(quadrant, ev->quadrant));
+           }
+           break;
+       case FREPRO:            /* Klingon reproduces */
+           // If we ever switch to a real event queue, we'll need to
+           // explicitly retrieve and restore the x and y.
+           ev = schedule(FREPRO, expran(1.0 * game.intime));
+           /* see if current distress call still active */
+           q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
+           if (q->klingons <= 0) {
+               q->status = secure;
+               break;
+           }
+           if (game.state.remkl >=MAXKLGAME)
+               break;          /* full right now */
+           /* reproduce one Klingon */
+           w = ev->quadrant;
+           if (game.klhere >= MAXKLQUAD) {
+               /* this quadrant not ok, pick an adjacent one */
+               for (i = w.x - 1; i <= w.x + 1; i++)
+               {
+                   for (j = w.y - 1; j <= w.y + 1; j++)
+                   {
+                       if (!VALID_QUADRANT(i, j))
+                           continue;
+                       q = &game.state.galaxy[w.x][w.y];
+                       /* check for this quad ok (not full & no snova) */
+                       if (q->klingons >= MAXKLQUAD || q->supernova)
+                           continue;
+                       goto foundit;
+                   }
+               }
+               break;  /* search for eligible quadrant failed */
+           foundit:
+               w.x = i;
+               w.y = j;
+           }
+
+           /* deliver the child */
+           game.state.remkl++;
+           q->klingons++;
+           if (same(game.quadrant, w))
+               newkling(++game.klhere);
+
+           /* recompute time left */
+           game.state.remtime = game.state.remkl + game.state.remcom > 0 ?
+                   game.state.remres/(game.state.remkl + 4*game.state.remcom) : 99;
+           /* report the disaster if we can */
+           if (!damaged(DRADIO) || game.condition == docked)
+           {
+               if (same(game.quadrant, w)) {
+                   prout(_("Spock- sensors indicate the Klingons have"));
+                   prout(_("launched a warship from %s."), systnames[q->planet]);
+               } else {
+                   prout(_("Uhura- Starfleet reports increased Klingon activity"));
+                   if (q->planet != NOPLANET)
+                       proutn(_("near %s "), systnames[q->planet]);
+                   prout(_("in %s.\n"), cramlc(quadrant, w));
+               }
+           }
+           break;
+       }
+    }
+}
+
+                               
+void wait(void) 
+/* wait on events */
+{
+    int key;
+    double temp, delay, origTime;
+
+    game.ididit = false;
+    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 || game.nenhere != 0) {
+       proutn(_("Are you sure? "));
+       if (ja() == false)
+           return;
+    }
+
+    /* Alternate resting periods (events) with attacks */
+
+    game.resting = true;
+    do {
+       if (delay <= 0)
+           game.resting = false;
+       if (!game.resting) {
+           prout(_("%d stardates left."), (int)game.state.remtime);
+           return;
+       }
+       temp = game.optime = delay;
+
+       if (game.nenhere) {
+           double rtime = 1.0 + Rand();
+           if (rtime < temp)
+               temp = rtime;
+           game.optime = temp;
+       }
+       if (game.optime < delay)
+           attack(false);
+       if (game.alldone)
+           return;
+       events();
+       game.ididit = true;
+       if (game.alldone)
+           return;
+       delay -= temp;
+       /* Repair Deathray if long rest at starbase */
+       if (origTime-delay >= 9.99 && game.condition == docked)
+           game.damage[DDRAY] = 0.0;
+    } while 
+       // leave if quadrant supernovas
+       (!game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova);
+
+    game.resting = false;
+    game.optime = 0;
+}
+
+/*
+ *     A nova occurs.  It is the result of having a star hit with a
+ *     photon torpedo, or possibly of a probe warhead going off.
+ *     Stars that go nova cause stars which surround them to undergo
+ *     the same probabilistic process.  Klingons next to them are
+ *     destroyed.  And if the starship is next to it, it gets zapped.
+ *     If the zap is too much, it gets destroyed.
+ */
+void nova(coord nov) 
+/* star goes nova */
+{
+    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;
+    coord newc, scratch;
+
+    if (Rand() < 0.05) {
+       /* Wow! We've supernova'ed */
+       supernova(false, &nov);
+       return;
+    }
+
+    /* handle initial nova */
+    game.quad[nov.x][nov.y] = IHDOT;
+    crmena(false, IHSTAR, sector, nov);
+    prout(_(" novas."));
+    game.state.galaxy[game.quadrant.x][game.quadrant.y].stars--;
+    game.state.starkl++;
+       
+    /* Set up stack to recursively trigger adjacent stars */
+    bot = top = top2 = 1;
+    kount = 0;
+    icx = icy = 0;
+    hits[1][1] = nov.x;
+    hits[1][2] = nov.y;
+    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;
+                   scratch.x = hits[mm][1]+nn-2;
+                   scratch.y = hits[mm][2]+j-2;
+                   if (!VALID_SECTOR(scratch.y, scratch.x))
+                       continue;
+                   iquad = game.quad[scratch.x][scratch.y];
+                   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 */
+                           supernova(false, &scratch);
+                           return;
+                       }
+                       top2++;
+                       hits[top2][1]=scratch.x;
+                       hits[top2][2]=scratch.y;
+                       game.state.galaxy[game.quadrant.x][game.quadrant.y].stars -= 1;
+                       game.state.starkl++;
+                       crmena(true, IHSTAR, sector, scratch);
+                       prout(_(" novas."));
+                       game.quad[scratch.x][scratch.y] = IHDOT;
+                       break;
+                   case IHP: /* Destroy planet */
+                       game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
+                       game.state.nplankl++;
+                       crmena(true, IHP, sector, scratch);
+                       prout(_(" destroyed."));
+                       game.state.planets[game.iplnet].pclass = destroyed;
+                       game.iplnet = 0;
+                       invalidate(game.plnet);
+                       if (game.landed) {
+                           finish(FPNOVA);
+                           return;
+                       }
+                       game.quad[scratch.x][scratch.y] = IHDOT;
+                       break;
+                   case IHB: /* Destroy base */
+                       game.state.galaxy[game.quadrant.x][game.quadrant.y].starbase = false;
+                       for (i = 1; i <= game.state.rembase; i++)
+                           if (same(game.state.baseq[i], game.quadrant)) 
+                               break;
+                       game.state.baseq[i] = game.state.baseq[game.state.rembase];
+                       game.state.rembase--;
+                       invalidate(game.base);
+                       game.state.basekl++;
+                       newcnd();
+                       crmena(true, IHB, sector, scratch);
+                       prout(_(" destroyed."));
+                       game.quad[scratch.x][scratch.y] = IHDOT;
+                       break;
+                   case IHE: /* Buffet ship */
+                   case IHF:
+                       prout(_("***Starship buffeted by nova."));
+                       if (game.shldup) {
+                           if (game.shield >= 2000.0)
+                               game.shield -= 2000.0;
+                           else {
+                               double diff = 2000.0 - game.shield;
+                               game.energy -= diff;
+                               game.shield = 0.0;
+                               game.shldup = false;
+                               prout(_("***Shields knocked out."));
+                               game.damage[DSHIELD] += 0.005*game.damfac*Rand()*diff;
+                           }
+                       }
+                       else
+                           game.energy -= 2000.0;
+                       if (game.energy <= 0) {
+                           finish(FNOVA);
+                           return;
+                       }
+                       /* add in course nova contributes to kicking starship*/
+                       icx += game.sector.x-hits[mm][1];
+                       icy += game.sector.y-hits[mm][2];
+                       kount++;
+                       break;
+                   case IHK: /* kill klingon */
+                       deadkl(scratch,iquad, scratch);
+                       break;
+                   case IHC: /* Damage/destroy big enemies */
+                   case IHS:
+                   case IHR:
+                       for (ll = 1; ll <= game.nenhere; ll++)
+                           if (same(game.ks[ll], scratch))
+                               break;
+                       game.kpower[ll] -= 800.0; /* If firepower is lost, die */
+                       if (game.kpower[ll] <= 0.0) {
+                           deadkl(scratch, iquad, scratch);
+                           break;
+                       }
+                       newc.x = scratch.x + scratch.x - hits[mm][1];
+                       newc.y = scratch.y + scratch.y - hits[mm][2];
+                       crmena(true, iquad, sector, scratch);
+                       proutn(_(" damaged"));
+                       if (!VALID_SECTOR(newc.x, newc.y)) {
+                           /* can't leave quadrant */
+                           skip(1);
+                           break;
+                       }
+                       iquad1 = game.quad[newc.x][newc.y];
+                       if (iquad1 == IHBLANK) {
+                           proutn(_(", blasted into "));
+                           crmena(false, IHBLANK, sector, newc);
+                           skip(1);
+                           deadkl(scratch, iquad, newc);
+                           break;
+                       }
+                       if (iquad1 != IHDOT) {
+                           /* can't move into something else */
+                           skip(1);
+                           break;
+                       }
+                       proutn(_(", buffeted to "));
+                       proutn(cramlc(sector, newc));
+                       game.quad[scratch.x][scratch.y] = IHDOT;
+                       game.quad[newc.x][newc.y] = iquad;
+                       game.ks[ll] = newc;
+                       game.kdist[ll] = game.kavgd[ll] = distance(game.sector, newc);
+                       skip(1);
+                       break;
+                   }
+               }
+       if (top == top2) 
+           break;
+       bot = top + 1;
+       top = top2;
+    }
+    if (kount==0) 
+       return;
+
+    /* Starship affected by nova -- kick it away. */
+    game.dist = kount*0.1;
+    if (icx)
+       icx = (icx < 0 ? -1 : 1);
+    if (icy)
+       icy = (icy < 0 ? -1 : 1);
+    game.direc = course[3*(icx+1)+icy+2];
+    if (game.direc == 0.0)
+       game.dist = 0.0;
+    if (game.dist == 0.0)
+       return;
+    game.optime = 10.0*game.dist/16.0;
+    skip(1);
+    prout(_("Force of nova displaces starship."));
+    imove(true);
+    game.optime = 10.0*game.dist/16.0;
+    return;
+}
+       
+       
+void supernova(bool induced, coord *w) 
+/* star goes supernova */
+{
+    int num = 0, nrmdead, npdead = 0, kldead, loop;
+    coord nq;
+
+    if (w != NULL) 
+       nq = *w;
+    else {
+       int stars = 0;
+       /* Scheduled supernova -- select star */
+       /* logic changed here so that we won't favor quadrants in top
+          left of universe */
+       for (nq.x = 1; nq.x <= GALSIZE; nq.x++)
+           for (nq.y = 1; nq.y <= GALSIZE; nq.y++)
+               stars += game.state.galaxy[nq.x][nq.y].stars;
+       if (stars == 0)
+           return; /* nothing to supernova exists */
+       num = Rand()*stars + 1;
+       for (nq.x = 1; nq.x <= GALSIZE; nq.x++) {
+           for (nq.y = 1; nq.y <= GALSIZE; nq.y++) {
+               num -= game.state.galaxy[nq.x][nq.y].stars;
+               if (num <= 0)
+                   break;
+           }
+           if (num <=0)
+               break;
+       }
+       if (idebug) {
+           proutn("=== Super nova here?");
+           if (ja() == true)
+               nq = game.quadrant;
+       }
+    }
+
+    if (!same(nq, game.quadrant) || game.justin) {
+       /* it isn't here, or we just entered (treat as enroute) */
+       if (!damaged(DRADIO) || game.condition == docked) {
+           skip(1);
+           prout(_("Message from Starfleet Command       Stardate %.2f"), game.state.date);
+           prout(_("     Supernova in %s; caution advised."),
+                 cramlc(quadrant, nq));
+       }
+    }
+    else {
+       coord ns;
+       /* we are in the quadrant! */
+       num = Rand()* game.state.galaxy[nq.x][nq.y].stars + 1;
+       for (ns.x = 1; ns.x <= QUADSIZE; ns.x++) {
+           for (ns.y = 1; ns.y <= QUADSIZE; ns.y++) {
+               if (game.quad[ns.x][ns.y]==IHSTAR) {
+                   num--;
+                   if (num==0)
+                       break;
+               }
+           }
+           if (num==0)
+               break;
+       }
+
+       skip(1);
+       prouts(_("***RED ALERT!  RED ALERT!"));
+       skip(1);
+       prout(_("***Incipient supernova detected at %s"), cramlc(sector, ns));
+       if (square(ns.x-game.sector.x) + square(ns.y-game.sector.y) <= 2.1) {
+           proutn(_("Emergency override attempts t"));
+           prouts("***************");
+           skip(1);
+           stars();
+           game.alldone = true;
+       }
+    }
+
+    /* destroy any Klingons in supernovaed quadrant */
+    kldead = game.state.galaxy[nq.x][nq.y].klingons;
+    game.state.galaxy[nq.x][nq.y].klingons = 0;
+    if (same(nq, game.state.kscmdr)) {
+       /* did in the Supercommander! */
+       game.state.nscrem = game.state.kscmdr.x = game.state.kscmdr.y = game.isatb =  0;
+       game.iscate = false;
+       unschedule(FSCMOVE);
+    }
+    if (same(nq, game.battle)) {
+       unschedule(FSCDBAS);
+       unschedule(FCDBAS);
+       invalidate(game.battle);
+    }
+    if (game.state.remcom) {
+       int maxloop = game.state.remcom, l;
+       for (l = 1; l <= maxloop; l++) {
+           if (same(game.state.kcmdr[l], nq)) {
+               game.state.kcmdr[l] = game.state.kcmdr[game.state.remcom];
+               invalidate(game.state.kcmdr[game.state.remcom]);
+               game.state.remcom--;
+               kldead--;
+               if (game.state.remcom==0)
+                   unschedule(FTBEAM);
+               break;
+           }
+       }
+    }
+    game.state.remkl -= kldead;
+    /* destroy Romulans and planets in supernovaed quadrant */
+    nrmdead = game.state.galaxy[nq.x][nq.y].romulans;
+    game.state.galaxy[nq.x][nq.y].romulans = 0;
+    game.state.nromrem -= nrmdead;
+    /* Destroy planets */
+    for (loop = 0; loop < game.inplan; loop++) {
+       if (same(game.state.planets[loop].w, nq)) {
+           game.state.planets[loop].pclass = destroyed;
+           npdead++;
+       }
+    }
+    /* Destroy any base in supernovaed quadrant */
+    if (game.state.rembase) {
+       int maxloop = game.state.rembase, loop;
+       for (loop = 1; loop <= maxloop; loop++)
+           if (same(game.state.baseq[loop], nq)) {
+               game.state.baseq[loop] = game.state.baseq[game.state.rembase];
+               invalidate(game.state.baseq[game.state.rembase]);
+               game.state.rembase--;
+               break;
+           }
+    }
+    /* If starship caused supernova, tally up destruction */
+    if (induced) {
+       game.state.starkl += game.state.galaxy[nq.x][nq.y].stars;
+       game.state.basekl += game.state.galaxy[nq.x][nq.y].starbase;
+       game.state.nplankl += npdead;
+    }
+    /* mark supernova in galaxy and in star chart */
+    if (same(game.quadrant, nq) || !damaged(DRADIO) || game.condition == docked)
+       game.state.galaxy[nq.x][nq.y].supernova = true;
+    /* If supernova destroys last Klingons give special message */
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0 && !same(nq, game.quadrant)) {
+       skip(2);
+       if (!induced)
+           prout(_("Lucky you!"));
+       proutn(_("A supernova in %s has just destroyed the last Klingons."),
+              cramlc(quadrant, nq));
+       finish(FWON);
+       return;
+    }
+    /* if some Klingons remain, continue or die in supernova */
+    if (game.alldone)
+       finish(FSNOVAED);
+    return;
+}
diff --git a/historic/c-version/src/finish.c b/historic/c-version/src/finish.c
new file mode 100644 (file)
index 0000000..90b23fc
--- /dev/null
@@ -0,0 +1,489 @@
+#include "sst.h"
+#include <string.h>
+#include <time.h>
+
+void selfdestruct(void)
+/* self-destruct maneuver */
+{
+    /* Finish with a BANG! */
+    chew();
+    if (damaged(DCOMPTR)) {
+       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 (game.ship==IHE)
+       prouts("***");
+    prouts(_("********* Entropy of "));
+    crmshp();
+    prouts(_(" maximized *********"));
+    skip(1);
+    stars();
+    skip(1);
+    if (game.nenhere != 0) {
+       double whammo = 25.0 * game.energy;
+       int l=1;
+       while (l <= game.nenhere) {
+           if (game.kpower[l]*game.kdist[l] <= whammo) 
+               deadkl(game.ks[l], game.quad[game.ks[l].x][game.ks[l].y], game.ks[l]);
+           l++;
+       }
+    }
+    finish(FDILITHIUM);
+}
+                               
+
+void finish(FINTYPE ifin)
+/* end the game, with appropriate notfications */
+{
+    bool igotit = false;
+    game.alldone = true;
+    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."));
+       game.gamewon = true;
+       if (game.alive) {
+           double badpt;
+           badpt = 5.0*game.state.starkl \
+               + game.casual \
+               + 10.0*game.state.nplankl \
+               + 300.0*game.state.nworldkl \
+               + 45.0*game.nhelp \
+               + 100.0*game.state.basekl \
+               + 3.0*game.abandoned;
+           if (game.ship == IHF)
+               badpt += 100.0;
+           else if (game.ship == 0)
+               badpt += 200.0;
+           if (badpt < 100.0)
+               badpt = 0.0;    // Close enough!
+           if (game.state.date-game.indate < 5.0 ||
+               // killsPerDate >= RateMax
+               ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem))/(game.state.date-game.indate) >=
+               0.1*game.skill*(game.skill+1.0) + 0.1 + 0.008*badpt) {
+               skip(1);
+               prout(_("In fact, you have done so well that Starfleet Command"));
+               switch (game.skill) {
+               case SKILL_NONE:
+                   break;      /* quiet gcc warning */
+               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 (game.skill >= SKILL_EXPERT) {
+                   if (game.thawed && !idebug)
+                       prout(_("You cannot get a citation, so..."));
+                   else {
+                       proutn(_("Do you want your Commodore Emeritus Citation printed? "));
+                       chew();
+                       if (ja() == true) {
+                           igotit = true;
+                       }
+                   }
+               }
+           }
+           // Only grant long life if alive (original didn't!)
+           skip(1);
+           prout(_("LIVE LONG AND PROSPER."));
+       }
+       score();
+       if (igotit)
+           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 ((game.state.remkl + game.state.remcom + game.state.nscrem)*3.0 > (game.inkling + game.incom + game.inscom)) {
+           prout(_("acquitted."));
+           skip(1);
+           prout(_("LIVE LONG AND PROSPER."));
+       }
+       else {
+           prout(_("found guilty and"));
+           prout(_("sentenced to death by slow torture."));
+           game.alive = false;
+       }
+       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 mundi"));
+       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;
+    case FCREW:
+       prout(_("Your last crew member has died."));
+       break;
+    }
+    if (game.ship==IHF)
+       game.ship= 0;
+    else if (game.ship == IHE)
+       game.ship = IHF;
+    game.alive = false;
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem) != 0) {
+       double goodies = game.state.remres/game.inresor;
+       double baddies = (game.state.remkl + 2.0*game.state.remcom)/(game.inkling+2.0*game.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."));
+       game.gamewon = true;
+    }
+    score();
+}
+
+static void score_item(const char *str, int num, int score)
+{
+    if (num) {
+       prout(str, num, score);
+       iscore += score;
+    }
+}
+
+static void score_item1(const char *str, int score)
+{
+    prout(str, score);
+    iscore += score;
+}
+
+static void score_itemf(const char *str, float num, int score)
+{
+    if (num > 0) {
+       prout(str, num, score);
+       iscore += score;
+    }
+}
+
+void score(void) 
+/* compute player's score */
+{
+    double timused = game.state.date - game.indate;
+    int iwon, klship, num;
+
+    iskill = game.skill;
+    if ((timused == 0 || (game.state.remkl + game.state.remcom + game.state.nscrem) != 0) && timused < 5.0)
+       timused = 5.0;
+    iwon = 0;
+    if (game.gamewon)
+       iwon = 100*game.skill;
+    if (game.ship == IHE) 
+       klship = 0;
+    else if (game.ship == IHF) 
+       klship = 1;
+    else
+       klship = 2;
+    iscore = 0;
+    skip(2);
+    prout(_("Your score --"));
+    num = game.inrom - game.state.nromrem;
+    score_item(_("%6d Romulans destroyed                 %5d"), num, 20 * num);
+    if (game.gamewon)
+       score_item(_("%6d Romulans captured                  %5d"),
+             game.state.nromrem, game.state.nromrem);
+    num = game.inkling - game.state.remkl;
+    score_item(_("%6d ordinary Klingons destroyed        %5d"), num, 10 * num);
+    num = game.incom - game.state.remcom;
+    score_item(_("%6d Klingon commanders destroyed       %5d"), num, 50 * num);
+    num = game.inscom - game.state.nscrem;
+    score_item(_("%6d Super-Commander destroyed          %5d"), num, 200 * num);
+    perdate = ((game.inkling + game.incom + game.inscom) -
+           (game.state.remkl + game.state.remcom + game.state.nscrem))/timused;
+    score_itemf(_("%6.2f Klingons per stardate              %5d"), perdate,
+           500 * perdate + 0.5);
+    score_item(_("%6d stars destroyed by your action     %5d"),
+           game.state.starkl, -5*game.state.starkl);
+    score_item(_("%6d planets destroyed by your action   %5d"),
+           game.state.nplankl, -10*game.state.nplankl);
+    if (game.options & OPTION_WORLDS)
+       score_item(_("%6d inhabited planets destroyed by your action   %5d"),
+               game.state.nworldkl, -300*game.state.nworldkl);
+    score_item(_("%6d bases destroyed by your action     %5d"),
+           game.state.basekl, -100*game.state.basekl);
+    score_item(_("%6d calls for help from starbase       %5d"),
+           game.nhelp, -45*game.nhelp);
+    score_item(_("%6d casualties incurred                %5d"),
+           game.casual, -game.casual);
+    score_item(_("%6d crew abandoned in space            %5d"),
+           game.abandoned, -3*game.abandoned);
+    score_item(_("%6d ship(s) lost or destroyed          %5d"),
+           klship, -100*klship);
+    if (!game.alive)
+       score_item1(_("Penalty for getting yourself killed        %5d"), -200);
+    if (game.gamewon) {
+       proutn(_("Bonus for winning "));
+       switch (game.skill) {
+       case SKILL_NONE:     break;     /* quiet gcc warning */
+       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)
+/* emit winner's commemmorative plaque */
+{
+       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/historic/c-version/src/io.c b/historic/c-version/src/io.c
new file mode 100644 (file)
index 0000000..fa028f5
--- /dev/null
@@ -0,0 +1,466 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <wchar.h>
+
+#include "config.h"
+#include "sst.h"
+#include "sstlinux.h"
+
+static int rows, linecount;    /* for paging */
+
+WINDOW *curwnd;
+WINDOW *fullscreen_window;
+WINDOW *srscan_window;
+WINDOW *report_window;
+WINDOW *status_window;
+WINDOW *lrscan_window;
+WINDOW *message_window;
+WINDOW *prompt_window;
+
+static void outro(void)
+/* wrap up, either normally or due to signal */
+{
+    if (game.options & OPTION_CURSES) {
+       //clear();
+       //curs_set(1);
+       //refresh();
+       //resetterm();
+       //echo();
+       endwin();
+       putchar('\n');
+    }
+    if (logfp)
+       fclose(logfp);
+}
+
+void iostart(void) 
+{
+    setlocale(LC_ALL, "");
+    bindtextdomain(PACKAGE, LOCALEDIR);
+    textdomain(PACKAGE);
+
+    if (atexit(outro)){
+       fprintf(stderr,"Unable to register outro(), exiting...\n");
+       exit(1);
+    }
+    if (!(game.options & OPTION_CURSES)) {
+       char *ln_env = getenv("LINES");
+       rows = ln_env ? atoi(ln_env) : 25;
+    } else {
+       initscr();
+#ifdef KEY_MIN
+       keypad(stdscr, TRUE);
+#endif /* KEY_MIN */
+       saveterm();
+       nonl();
+       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 */
+       //noecho();
+       fullscreen_window = stdscr;
+       srscan_window     = newwin(12, 25, 0,       0);
+       report_window     = newwin(11, 0,  1,       25);
+       status_window     = newwin(10, 0,  1,       39);
+       lrscan_window     = newwin(5,  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)
+       wgetch(prompt_window);
+}
+
+void announce(void)
+{
+    skip(1);
+    prouts(_("[ANNOUNCEMENT ARRIVING...]"));
+    skip(1);
+}
+
+static void pause_game(void)
+{
+       char *prompt;
+       char buf[BUFSIZ];
+        if (game.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 {
+           int j;
+           putchar('\n');
+           proutn(prompt);
+           fgets(buf, sizeof(buf), stdin);
+           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 && getcury(curwnd) >= getmaxy(curwnd) - 3) {
+               pause_game();
+               clrscr();
+           } else {
+               proutn("\n");
+           }
+       } else {
+           linecount++;
+           if (linecount >= rows)
+               pause_game();
+           else
+               putchar('\n');
+       }
+    }
+}
+
+static void vproutn(const char *fmt, va_list ap) 
+{
+    if (game.options & OPTION_CURSES) {
+       vwprintw(curwnd, fmt, ap);
+       wrefresh(curwnd);
+    }
+    else
+       vprintf(fmt, ap);
+}
+
+void proutn(const char *fmt, ...) 
+{
+    va_list ap;
+    va_start(ap, fmt);
+    vproutn(fmt, ap);
+    va_end(ap);
+}
+
+void prout(const char *fmt, ...) 
+{
+    va_list ap;
+    va_start(ap, fmt);
+    vproutn(fmt, ap);
+    va_end(ap);
+    skip(1);
+}
+
+void prouts(const char *fmt, ...) 
+/* print slowly! */
+{
+    char buf[BUFSIZ];
+    wchar_t *s, mbuf[BUFSIZ];
+    va_list ap;
+    va_start(ap, fmt);
+    vsprintf(buf, fmt, ap);
+    va_end(ap);
+    mbstowcs(mbuf, buf, BUFSIZ);
+    for (s = mbuf; *s; s++) {
+       /* HOW to convince ncurses to use wchar_t?? */
+       /* WHY putwchar() doesn't work?? */
+       /* OK then, convert back to mbs... */
+       char c[MB_CUR_MAX*2];
+       int n;
+       n = wctomb(c, *s);
+       c[n] = 0;
+       delay(30);
+       proutn(c);
+       if (game.options & OPTION_CURSES)
+           wrefresh(curwnd);
+       else
+           fflush(stdout);
+    }
+    delay(300);
+}
+
+void cgetline(char *line, int max)
+{
+    if (game.options & OPTION_CURSES) {
+       wgetnstr(curwnd, line, max);
+       strcat(line, "\n");
+       wrefresh(curwnd);
+    } else {
+       if (replayfp && !feof(replayfp))
+           (void)fgets(line, max, replayfp);
+       else
+           (void)fgets(line, max, stdin);
+    }
+    if (logfp)
+       (void)fputs(line, logfp);
+    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, bool before) {
+}
+
+/*
+ * Things past this point have policy implications.
+ */
+
+void drawmaps(int mode)
+/* hook to be called after moving to redraw maps */
+{
+    if (game.options & OPTION_CURSES) {
+       if (mode == 1)
+           sensor();
+        setwnd(srscan_window);
+        wmove(curwnd, 0, 0);
+        srscan();
+       if (mode != 2) {
+           setwnd(status_window);
+           wclear(status_window);
+           wmove(status_window, 0, 0);
+           setwnd(report_window);
+           wclear(report_window);
+           wmove(report_window, 0, 0);
+           status(0);
+           setwnd(lrscan_window);
+           wclear(lrscan_window);
+           wmove(lrscan_window, 0, 0);
+           lrscan();
+       }
+    }
+}
+
+static void put_srscan_sym(coord w, char sym)
+{
+    wmove(srscan_window, w.x+1, w.y*2+2);
+    waddch(srscan_window, sym);
+    wrefresh(srscan_window);
+}
+
+void boom(coord w)
+/* enemy fall down, go boom */ 
+{
+    if (game.options & OPTION_CURSES) {
+       drawmaps(2);
+       setwnd(srscan_window);
+       wattron(srscan_window, A_REVERSE);
+       put_srscan_sym(w, game.quad[w.x][w.y]);
+       sound(500);
+       delay(1000);
+       nosound();
+       wattroff(srscan_window, A_REVERSE);
+       put_srscan_sym(w, game.quad[w.x][w.y]);
+       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(coord w, 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   ", w.x, w.y);
+    } else {
+       if (!damaged(DSRSENS) || game.condition==docked) {
+           if (i != 1 && l == 1) {
+               drawmaps(2);
+               delay(400);
+           }
+           if ((iquad==IHDOT)||(iquad==IHBLANK)){
+               put_srscan_sym(w, '+');
+               sound(l*10);
+               delay(100);
+               nosound();
+               put_srscan_sym(w, iquad);
+           }
+           else {
+               wattron(curwnd, A_REVERSE);
+               put_srscan_sym(w, iquad);
+               sound(500);
+               delay(1000);
+               nosound();
+               wattroff(curwnd, A_REVERSE);
+               put_srscan_sym(w, iquad);
+           }
+       } else {
+           proutn("%d - %d   ", w.x, w.y);
+       }
+    }
+}
+
+void makechart(void) 
+{
+    if (game.options & OPTION_CURSES) {
+       setwnd(message_window);
+       wclear(message_window);
+    }
+    chart();
+    if (game.options & OPTION_TTY) {
+       skip(1);
+    }
+}
+
+void prstat(const char *txt, const char *fmt, ...)
+{
+#define NSYM 14
+    int i;
+    va_list args;
+    proutn(txt);
+    if (game.options & OPTION_CURSES) {
+       skip(1);
+    } else  {
+       for (i = mblen(txt, strlen(txt)); i < NSYM; i++)
+           proutn(" ");
+    }
+    if (game.options & OPTION_CURSES)
+       setwnd(status_window);
+    va_start(args, fmt);
+    vproutn(fmt, args);
+    va_end(args);
+    skip(1);
+    if (game.options & OPTION_CURSES)
+       setwnd(report_window);
+}
diff --git a/historic/c-version/src/moving.c b/historic/c-version/src/moving.c
new file mode 100644 (file)
index 0000000..0d41dd1
--- /dev/null
@@ -0,0 +1,1202 @@
+#include <unistd.h>
+#include "sstlinux.h"
+#include "sst.h"
+
+static void getcd(bool, int);
+
+void imove(bool novapush)
+/* movement execution for warp, impulse, supernova, and tractor-beam events */
+{
+    double angle, deltax, deltay, bigger, x, y,
+        finald, stopegy, probf;
+    int n, m, kink, kinks;
+    feature iquad;
+    coord w, final;
+    bool trbeam = false;
+
+    w.x = w.y = 0;
+    if (game.inorbit) {
+       prout(_("Helmsman Sulu- \"Leaving standard orbit.\""));
+       game.inorbit = false;
+    }
+
+    angle = ((15.0 - game.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+game.optime >= scheduled(FTBEAM)) {
+       trbeam = true;
+       game.condition = red;
+       game.dist = game.dist*(scheduled(FTBEAM)-game.state.date)/game.optime + 0.1;
+       game.optime = scheduled(FTBEAM) - game.state.date + 1e-5;
+    }
+    /* Move within the quadrant */
+    game.quad[game.sector.x][game.sector.y] = IHDOT;
+    x = game.sector.x;
+    y = game.sector.y;
+    n = 10.0*game.dist*bigger+0.5;
+
+    if (n > 0) {
+       for (m = 1; m <= n; m++) {
+           w.x = (x += deltax) + 0.5;
+           w.y = (y += deltay) + 0.5;
+           if (!VALID_SECTOR(w.x, w.y)) {
+               /* Leaving quadrant -- allow final enemy attack */
+               /* Don't do it if being pushed by Nova */
+               if (game.nenhere != 0 && !novapush) {
+                   newcnd();
+                   for (m = 1; m <= game.nenhere; m++) {
+                       finald = distance(w, game.ks[m]);
+                       game.kavgd[m] = 0.5 * (finald + game.kdist[m]);
+                   }
+                   /*
+                    * Stas Sergeev added the condition
+                    * that attacks only happen if Klingons
+                    * are present and your skill is good.
+                    */
+                   if (game.skill > SKILL_GOOD && game.klhere > 0 && !game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
+                       attack(false);
+                   if (game.alldone)
+                       return;
+               }
+               /* compute final position -- new quadrant and sector */
+               x = QUADSIZE*(game.quadrant.x-1)+game.sector.x;
+               y = QUADSIZE*(game.quadrant.y-1)+game.sector.y;
+               w.x = x+10.0*game.dist*bigger*deltax+0.5;
+               w.y = y+10.0*game.dist*bigger*deltay+0.5;
+               /* check for edge of galaxy */
+               kinks = 0;
+               do {
+                   kink = 0;
+                   if (w.x <= 0) {
+                       w.x = -w.x + 1;
+                       kink = 1;
+                   }
+                   if (w.y <= 0) {
+                       w.y = -w.y + 1;
+                       kink = 1;
+                   }
+                   if (w.x > GALSIZE*QUADSIZE) {
+                       w.x = (GALSIZE*QUADSIZE*2)+1 - w.x;
+                       kink = 1;
+                   }
+                   if (w.y > GALSIZE*QUADSIZE) {
+                       w.y = (GALSIZE*QUADSIZE*2)+1 - w.y;
+                       kink = 1;
+                   }
+                   if (kink)
+                       kinks = 1;
+               } while (kink);
+
+               if (kinks) {
+                   game.nkinks += 1;
+                   if (game.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) /* Don't bother if we are to be beamed */
+                   return;
+               game.quadrant.x = (w.x+(QUADSIZE-1))/QUADSIZE;
+               game.quadrant.y = (w.y+(QUADSIZE-1))/QUADSIZE;
+               game.sector.x = w.x - QUADSIZE*(game.quadrant.x-1);
+               game.sector.y = w.y - QUADSIZE*(game.quadrant.y-1);
+               skip(1);
+               prout(_("Entering %s."), cramlc(quadrant, game.quadrant));
+               game.quad[game.sector.x][game.sector.y] = game.ship;
+               newqad(false);
+               if (game.skill>SKILL_NOVICE)
+                   attack(false);  
+               return;
+           }
+           iquad = game.quad[w.x][w.y];
+           if (iquad != IHDOT) {
+               /* object encountered in flight path */
+               stopegy = 50.0*game.dist/game.optime;
+               game.dist = distance(game.sector, w) / (QUADSIZE * 1.0);
+               switch (iquad) {
+               case IHT: /* Ram a Tholian */
+               case IHK: /* Ram enemy ship */
+               case IHC:
+               case IHS:
+               case IHR:
+               case IHQUEST:
+                   game.sector = w;
+                   ram(false, iquad, game.sector);
+                   final = game.sector;
+                   break;
+               case IHBLANK:
+                   skip(1);
+                   prouts(_("***RED ALERT!  RED ALERT!"));
+                   skip(1);
+                   proutn("***");
+                   crmshp();
+                   proutn(_(" pulled into black hole at "));
+                   prout(cramlc(sector, w));
+                   /*
+                    * 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 (m=0;m<NDEVICES;m++)
+                       if (game.damage[m]>0) 
+                           n++;
+                   probf=pow(1.4,(game.energy+game.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, w));
+                   prout(";");
+                   proutn(_("Emergency stop required "));
+                   prout(_("%2d units of energy."), (int)stopegy);
+                   game.energy -= stopegy;
+                   final.x = x-deltax+0.5;
+                   final.y = y-deltay+0.5;
+                   game.sector = final;
+                   if (game.energy <= 0) {
+                       finish(FNRG);
+                       return;
+                   }
+                   break;
+               }
+               goto no_quad_change;    /* sorry! */
+           }
+       }
+       game.dist = distance(game.sector, w) / (QUADSIZE * 1.0);
+       game.sector = w;
+    }
+    final = game.sector;
+no_quad_change:
+    /* No quadrant change -- compute new avg enemy distances */
+    game.quad[game.sector.x][game.sector.y] = game.ship;
+    if (game.nenhere) {
+       for (m = 1; m <= game.nenhere; m++) {
+           finald = distance(w, game.ks[m]);
+           game.kavgd[m] = 0.5 * (finald+game.kdist[m]);
+           game.kdist[m] = finald;
+       }
+       sortklings();
+       if (!game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
+           attack(false);
+       for (m = 1; m <= game.nenhere; m++)
+           game.kavgd[m] = game.kdist[m];
+    }
+    newcnd();
+    drawmaps(0);
+    setwnd(message_window);
+    return;
+}
+
+void dock(bool verbose) 
+/* dock our ship at a starbase */
+{
+    chew();
+    if (game.condition == docked && verbose) {
+       prout(_("Already docked."));
+       return;
+    }
+    if (game.inorbit) {
+       prout(_("You must first leave standard orbit."));
+       return;
+    }
+    if (!is_valid(game.base) || abs(game.sector.x-game.base.x) > 1 || abs(game.sector.y-game.base.y) > 1) {
+       crmshp();
+       prout(_(" not adjacent to base."));
+       return;
+    }
+    game.condition = docked;
+    if (verbose)
+       prout(_("Docked."));
+    game.ididit = true;
+    if (game.energy < game.inenrg)
+       game.energy = game.inenrg;
+    game.shield = game.inshld;
+    game.torps = game.intorps;
+    game.lsupres = game.inlsr;
+    game.state.crew = FULLCREW;
+    if (!damaged(DRADIO) &&
+       (is_scheduled(FCDBAS) || game.isatb == 1) && !game.iseenit) {
+       /* get attack report from base */
+       prout(_("Lt. Uhura- \"Captain, an important message from the starbase:\""));
+       attackreport(false);
+       game.iseenit = true;
+    }
+}
+
+/* 
+ * 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.  Probably
+ * "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!
+ */
+
+static void getcd(bool isprobe, int akey)
+/* get course and distance */
+{
+    int irowq=game.quadrant.x, icolq=game.quadrant.y, key=0;
+    double xi, xj, xk, xl;
+    double deltax, deltay;
+    enum {unspecified, manual, automatic} navmode = unspecified;
+    enum {curt, normal, verbose} itemp = curt;
+    coord incr;
+    bool iprompt = false;
+
+    // Get course direction and distance. If user types bad values, return
+    // with DIREC = -1.0.
+    game.direc = -1.0;
+       
+    if (game.landed && !isprobe) {
+       prout(_("Dummy! You can't leave standard orbit until you"));
+       proutn(_("are back aboard the ship."));
+       chew();
+       return;
+    }
+    while (navmode == unspecified) {
+       if (damaged(DNAVSYS)) {
+           if (isprobe)
+               prout(_("Computer damaged; manual navigation only"));
+           else
+               prout(_("Computer damaged; manual movement only"));
+           chew();
+           navmode = manual;
+           key = IHEOL;
+           break;
+       }
+       if (isprobe && akey != -1) {
+           /* For probe launch, use pre-scanned value first time */
+           key = akey;
+           akey = -1;
+       }
+       else 
+           key = scan();
+
+       if (key == IHEOL) {
+           proutn(_("Manual or automatic- "));
+           iprompt = true;
+           chew();
+       }
+       else if (key == IHALPHA) {
+           if (isit("manual")) {
+               navmode = manual;
+               key = scan();
+               break;
+           }
+           else if (isit("automatic")) {
+               navmode = automatic;
+               key = scan();
+               break;
+           }
+           else {
+               huh();
+               chew();
+               return;
+           }
+       }
+       else { /* numeric */
+           if (isprobe)
+               prout(_("(Manual navigation assumed.)"));
+           else
+               prout(_("(Manual movement assumed.)"));
+           navmode = manual;
+           break;
+       }
+    }
+
+    if (navmode == automatic) {
+       while (key == IHEOL) {
+           if (isprobe)
+               proutn(_("Target quadrant or quadrant&sector- "));
+           else
+               proutn(_("Destination sector or quadrant&sector- "));
+           chew();
+           iprompt = true;
+           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;
+           incr.y = xk + 0.5;
+           incr.x = xl + 0.5;
+       }
+       else {
+           if (isprobe) {
+               /* only quadrant specified -- go to center of dest quad */
+               irowq = xi + 0.5;
+               icolq = xj + 0.5;
+               incr.y = incr.x = 5;
+           }
+           else {
+               incr.y = xi + 0.5;
+               incr.x = xj + 0.5;
+           }
+           itemp = normal;
+       }
+       if (!VALID_QUADRANT(icolq,irowq)||!VALID_SECTOR(incr.x,incr.y)) {
+           huh();
+           return;
+       }
+       skip(1);
+       if (!isprobe) {
+           if (itemp > curt) {
+               if (iprompt) {
+                   prout(_("Helmsman Sulu- \"Course locked in for %s.\""),
+                         cramlc(sector, incr));
+               }
+           }
+           else
+               prout(_("Ensign Chekov- \"Course laid in, Captain.\""));
+       }
+       deltax = icolq - game.quadrant.y + 0.1*(incr.x-game.sector.y);
+       deltay = game.quadrant.x - irowq + 0.1*(game.sector.x-incr.y);
+    }
+    else { /* manual */
+       while (key == IHEOL) {
+           proutn(_("X and Y displacements- "));
+           chew();
+           iprompt = true;
+           key = scan();
+       }
+       itemp = verbose;
+       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 == verbose && !isprobe) {
+       skip(1);
+       prout(_("Helmsman Sulu- \"Aye, Sir.\""));
+    }
+    game.dist = sqrt(deltax*deltax + deltay*deltay);
+    game.direc = atan2(deltax, deltay)*1.90985932;
+    if (game.direc < 0.0)
+       game.direc += 12.0;
+    chew();
+    return;
+}
+               
+
+
+void impulse(void) 
+/* move under impulse power */
+{
+    double power;
+
+    game.ididit = false;
+    if (damaged(DIMPULS)) {
+       chew();
+       skip(1);
+       prout(_("Engineer Scott- \"The impulse engines are damaged, Sir.\""));
+       return;
+    }
+
+    if (game.energy > 30.0) {
+       getcd(false, 0);
+       if (game.direc == -1.0)
+           return;
+       power = 20.0 + 100.0*game.dist;
+    }
+    else
+       power = 30.0;
+
+    if (power >= game.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 (game.energy > 30) {
+           proutn(_("quadrant.  We can go, therefore, a maximum of %d"),
+                  (int)(0.01 * (game.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 */
+    game.optime = game.dist/0.095;
+    if (game.optime >= 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() == false)
+           return;
+    }
+    /* Activate impulse engines and pay the cost */
+    imove(false);
+    game.ididit = true;
+    if (game.alldone)
+       return;
+    power = 20.0 + 100.0*game.dist;
+    game.energy -= power;
+    game.optime = game.dist/0.095;
+    if (game.energy <= 0)
+       finish(FNRG);
+    return;
+}
+
+
+void warp(bool timewarp)
+/* move under warp drive */
+{
+    int iwarp;
+    bool blooey = false, twarp = false;
+    double power;
+
+    if (!timewarp) { /* Not WARPX entry */
+       game.ididit = false;
+       if (game.damage[DWARPEN] > 10.0) {
+           chew();
+           skip(1);
+           prout(_("Engineer Scott- \"The warp engines are damaged, Sir.\""));
+           return;
+       }
+       if (damaged(DWARPEN) && game.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 (game.direc == -1.0)
+           return;
+
+       /* Make sure starship has enough energy for the trip */
+       power = (game.dist+0.05)*game.warpfac*game.warpfac*game.warpfac*(game.shldup+1);
+
+
+       if (power >= game.energy) {
+           /* Insufficient power for trip */
+           game.ididit = false;
+           skip(1);
+           prout(_("Engineering to bridge--"));
+           if (!game.shldup || 0.5*power > game.energy) {
+               iwarp = pow((game.energy/(game.dist+0.05)), 0.333333333);
+               if (iwarp <= 0) {
+                   prout(_("We can't do it, Captain. We don't have enough energy."));
+               }
+               else {
+                   proutn(_("We don't have enough energy, but we could do it at warp %d"), iwarp);
+                   if (game.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 */
+       game.optime = 10.0*game.dist/game.wfacsq;
+       if (game.optime >= 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*game.optime/game.state.remtime);
+           prout(_(" percent of our"));
+           proutn(_("  remaining time.  Are you sure this is wise?\" "));
+           if (ja() == false) {
+               game.ididit = false;
+               game.optime=0; 
+               return;
+           }
+       }
+    }
+    /* Entry WARPX */
+    if (game.warpfac > 6.0) {
+       /* Decide if engine damage will occur */
+       double prob = game.dist*(6.0-game.warpfac)*(6.0-game.warpfac)/66.666666666;
+       if (prob > Rand()) {
+           blooey = true;
+           game.dist = Rand()*game.dist;
+       }
+       /* Decide if time warp will occur */
+       if (0.5*game.dist*pow(7.0,game.warpfac-10.0) > Rand())
+           twarp = true;
+       if (idebug && game.warpfac==10 && !twarp) {
+           blooey = false;
+           proutn("=== Force time warp? ");
+           if (ja() == true)
+               twarp = true;
+       }
+       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-game.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 * game.dist * bigger +0.5;
+           x = game.sector.x;
+           y = game.sector.y;
+           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 = false;
+                   twarp = false;
+               }
+           }
+       }
+    }
+                               
+
+    /* Activate Warp Engines and pay the cost */
+    imove(false);
+    if (game.alldone)
+       return;
+    game.energy -= game.dist*game.warpfac*game.warpfac*game.warpfac*(game.shldup+1);
+    if (game.energy <= 0)
+       finish(FNRG);
+    game.optime = 10.0*game.dist/game.wfacsq;
+    if (twarp)
+       timwrp();
+    if (blooey) {
+       game.damage[DWARPEN] = game.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."));
+    }
+    game.ididit = true;
+    return;
+}
+
+
+
+void setwarp(void) 
+/* change the warp factor */
+{
+    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 (damaged(DWARPEN) && 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 = game.warpfac;
+    game.warpfac = aaitem;
+    game.wfacsq=game.warpfac*game.warpfac;
+    if (game.warpfac <= oldfac || game.warpfac <= 6.0) {
+       prout(_("Helmsman Sulu- \"Warp factor %d, Captain.\""),
+              (int)game.warpfac);
+       return;
+    }
+    if (game.warpfac < 8.00) {
+       prout(_("Engineer Scott- \"Aye, but our maximum safe speed is warp 6.\""));
+       return;
+    }
+    if (game.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(bool igrab) 
+/* cope with being tossed out of quadrant by supernova or yanked by beam */
+{
+    double power, distreq;
+
+    chew();
+    /* is captain on planet? */
+    if (game.landed) {
+       if (damaged(DTRANSP)) {
+           finish(FPNOVA);
+           return;
+       }
+       prout(_("Scotty rushes to the transporter controls."));
+       if (game.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 (game.imine) {
+           game.imine = false;
+           proutn(_("The crystals mined were "));
+           if (Rand() <= 0.25) {
+               prout(_("lost."));
+           }
+           else {
+               prout(_("saved."));
+               game.icrystl = true;
+           }
+       }
+    }
+    if (igrab)
+       return;
+
+    /* Check to see if captain in shuttle craft */
+    if (game.icraft)
+       finish(FSTRACTOR);
+    if (game.alldone)
+       return;
+
+    /* Inform captain of attempt to reach safety */
+    skip(1);
+    do {
+       if (game.justin) {
+           prouts(_("***RED ALERT!  RED 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."));
+       game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
+       /* Try to use warp engines */
+       if (damaged(DWARPEN)) {
+           skip(1);
+           prout(_("Warp engines damaged."));
+           finish(FSNOVAED);
+           return;
+       }
+       game.warpfac = 6.0+2.0*Rand();
+       game.wfacsq = game.warpfac * game.warpfac;
+       prout(_("Warp factor set to %d"), (int)game.warpfac);
+       power = 0.75*game.energy;
+       game.dist = power/(game.warpfac*game.warpfac*game.warpfac*(game.shldup+1));
+       distreq = 1.4142+Rand();
+       if (distreq < game.dist)
+           game.dist = distreq;
+       game.optime = 10.0*game.dist/game.wfacsq;
+       game.direc = 12.0*Rand();       /* How dumb! */
+       game.justin = false;
+       game.inorbit = false;
+       warp(true);
+       if (!game.justin) {
+           /* This is bad news, we didn't leave quadrant. */
+           if (game.alldone)
+               return;
+           skip(1);
+           prout(_("Insufficient energy to leave quadrant."));
+           finish(FSNOVAED);
+           return;
+       }
+    } while 
+       /* Repeat if another snova */
+       (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova);
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0) 
+       finish(FWON); /* Snova killed remaining enemy. */
+}
+
+void timwrp() 
+/* let's do the time warp again */
+{
+    int l;
+    bool 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 = false;
+       if (game.state.remcom) {
+           schedule(FTBEAM, expran(game.intime/game.state.remcom));
+           schedule(FBATTAK, expran(0.3*game.intime));
+       }
+       schedule(FSNOVA, expran(0.5*game.intime));
+       /* next snapshot will be sooner */
+       schedule(FSNAP, expran(0.25*game.state.remtime));
+                               
+       if (game.state.nscrem)
+           schedule(FSCMOVE, 0.2777);      
+       game.isatb = 0;
+       unschedule(FCDBAS);
+       unschedule(FSCDBAS);
+       invalidate(game.battle);
+
+       /* Make sure Galileo is consistant -- Snapshot may have been taken
+          when on planet, which would give us two Galileos! */
+       gotit = false;
+       for (l = 0; l < game.inplan; l++) {
+           if (game.state.planets[l].known == shuttle_down) {
+               gotit = true;
+               if (game.iscraft == onship && game.ship==IHE) {
+                   prout(_("Checkov-  \"Security reports the Galileo has disappeared, Sir!"));
+                   game.iscraft = offship;
+               }
+           }
+       }
+       // Likewise, if in the original time the Galileo was abandoned, but
+       // was on ship earlier, it would have vanished -- let's restore it.
+       if (game.iscraft == offship && !gotit && game.damage[DSHUTTL] >= 0.0) {
+           prout(_("Checkov-  \"Security reports the Galileo has reappeared in the dock!\""));
+           game.iscraft = onship;
+       }
+       /* 
+        * 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 */
+       game.optime = -0.5*game.intime*log(Rand());
+       prout(_("You are traveling forward in time %d stardates."), (int)game.optime);
+       /* cheat to make sure no tractor beams occur during time warp */
+       postpone(FTBEAM, game.optime);
+       game.damage[DRADIO] += game.optime;
+    }
+    newqad(false);
+    events();  /* Stas Sergeev added this -- do pending events */
+}
+
+void probe(void) 
+/* launch deep-space probe */
+{
+    double angle, bigger;
+    int key;
+    /* New code to launch a deep space probe */
+    if (game.nprobes == 0) {
+       chew();
+       skip(1);
+       if (game.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 (damaged(DDSP)) {
+       chew();
+       skip(1);
+       prout(_("Engineer Scott- \"The probe launcher is damaged, Sir.\""));
+       return;
+    }
+    if (is_scheduled(FDSPROB)) {
+       chew();
+       skip(1);
+       if (damaged(DRADIO) && game.condition != docked) {
+           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(game.nprobes==1 ? _("%d probe left.") : _("%d probes left."), game.nprobes);
+       proutn(_("Are you sure you want to fire a probe? "));
+       if (ja() == false)
+           return;
+    }
+
+    game.isarmed = false;
+    if (key == IHALPHA && strcmp(citem,"armed") == 0) {
+       game.isarmed = true;
+       key = scan();
+    }
+    else if (key == IHEOL) {
+       proutn(_("Arm NOVAMAX warhead? "));
+       game.isarmed = ja();
+    }
+    getcd(true, key);
+    if (game.direc == -1.0)
+       return;
+    game.nprobes--;
+    angle = ((15.0 - game.direc) * 0.5235988);
+    game.probeinx = -sin(angle);
+    game.probeiny = cos(angle);
+    if (fabs(game.probeinx) > fabs(game.probeiny))
+       bigger = fabs(game.probeinx);
+    else
+       bigger = fabs(game.probeiny);
+               
+    game.probeiny /= bigger;
+    game.probeinx /= bigger;
+    game.proben = 10.0*game.dist*bigger +0.5;
+    game.probex = game.quadrant.x*QUADSIZE + game.sector.x - 1;        // We will use better packing than original
+    game.probey = game.quadrant.y*QUADSIZE + game.sector.y - 1;
+    game.probec = game.quadrant;
+    schedule(FDSPROB, 0.01); // Time to move one sector
+    prout(_("Ensign Chekov-  \"The deep space probe is launched, Captain.\""));
+    game.ididit = true;
+    return;
+}
+
+/*
+ *     Here's how the mayday code works:
+ *
+ *     First, the closest starbase is selected.  If there is a
+ *     a starbase in your own quadrant, you are in good shape.
+ *     This distance takes quadrant distances into account only.
+ *
+ *     A magic number is computed based on the distance which acts
+ *     as the probability that you will be rematerialized.  You
+ *     get three tries.
+ *
+ *     When it is determined that you should be able to be remater-
+ *     ialized (i.e., when the probability thing mentioned above
+ *     comes up positive), you are put into that quadrant (anywhere).
+ *     Then, we try to see if there is a spot adjacent to the star-
+ *     base.  If not, you can't be rematerialized!!!  Otherwise,
+ *     it drops you there.  It only tries five times to find a spot
+ *     to drop you.  After that, it's your problem.
+ */
+
+void mayday(void) 
+/* yell for help from nearest starbase */
+{
+    /* There's more than one way to move in this game! */
+    double ddist, xdist, probf;
+    int line = 0, m, ix, iy;
+
+    chew();
+    /* Test for conditions which prevent calling for help */
+    if (game.condition == docked) {
+       prout(_("Lt. Uhura-  \"But Captain, we're already docked.\""));
+       return;
+    }
+    if (damaged(DRADIO)) {
+       prout(_("Subspace radio damaged."));
+       return;
+    }
+    if (game.state.rembase==0) {
+       prout(_("Lt. Uhura-  \"Captain, I'm not getting any response from Starbase.\""));
+       return;
+    }
+    if (game.landed) {
+       proutn(_("You must be aboard the "));
+       crmshp();
+       prout(".");
+       return;
+    }
+    /* OK -- call for help from nearest starbase */
+    game.nhelp++;
+    if (game.base.x!=0) {
+       /* There's one in this quadrant */
+       ddist = distance(game.base, game.sector);
+    }
+    else {
+       ddist = FOREVER;
+       for (m = 1; m <= game.state.rembase; m++) {
+           xdist = QUADSIZE * distance(game.state.baseq[m], game.quadrant);
+           if (xdist < ddist) {
+               ddist = xdist;
+               line = m;
+           }
+       }
+       /* Since starbase not in quadrant, set up new quadrant */
+       game.quadrant = game.state.baseq[line];
+       newqad(true);
+    }
+    /* dematerialize starship */
+    game.quad[game.sector.x][game.sector.y]=IHDOT;
+    proutn(_("Starbase in %s responds--"), cramlc(quadrant, game.quadrant));
+    crmshp();
+    prout(_(" dematerializes."));
+    game.sector.x=0;
+    for (m = 1; m <= 5; m++) {
+       ix = game.base.x+3.0*Rand()-1;
+       iy = game.base.y+3.0*Rand()-1;
+       if (VALID_SECTOR(ix,iy) && game.quad[ix][iy]==IHDOT) {
+           /* found one -- finish up */
+           game.sector.x=ix;
+           game.sector.y=iy;
+           break;
+       }
+    }
+    if (!is_valid(game.sector)){
+       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 (m = 1; m <= 3; m++) {
+       switch (m) {
+       case 1: proutn(_("1st")); break;
+       case 2: proutn(_("2nd")); break;
+       case 3: proutn(_("3rd")); break;
+       }
+       proutn(_(" attempt to re-materialize "));
+       crmshp();
+       switch (m){
+       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 (m > 3) {
+       game.quad[ix][iy]=IHQUEST;
+       game.alive = false;
+       drawmaps(1);
+       setwnd(message_window);
+       finish(FMATERIALIZE);
+       return;
+    }
+    game.quad[ix][iy]=game.ship;
+    textcolor(GREEN);
+    prout(_("succeeds."));
+    textcolor(DEFAULT);
+    dock(false);
+    skip(1);
+    prout(_("Lt. Uhura-  \"Captain, we made it!\""));
+}
+
+/*
+ *  Abandon Ship
+ *
+ *     The ship is abandoned.  If your current ship is the Faire
+ *     Queene, or if your shuttlecraft is dead, you're out of
+ *     luck.  You need the shuttlecraft in order for the captain
+ *     (that's you!!) to escape.
+ *
+ *     Your crew can beam to an inhabited starsystem in the
+ *     quadrant, if there is one and if the transporter is working.
+ *     If there is no inhabited starsystem, or if the transporter
+ *     is out, they are left to die in outer space.
+ *
+ *     If there are no starbases left, you are captured by the
+ *     Klingons, who torture you mercilessly.  However, if there
+ *     is at least one starbase, you are returned to the
+ *     Federation in a prisoner of war exchange.  Of course, this
+ *     can't happen unless you have taken some prisoners.
+ *
+ */
+
+void abandon(void) 
+/* abandon ship */
+{
+    int nb, l;
+    struct quadrant *q;
+
+    chew();
+    if (game.condition==docked) {
+       if (game.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 Macs."));
+           return;
+       }
+       if (game.damage[DSHUTTL]>0) {
+           prout(_("Shuttle craft damaged."));
+           return;
+       }
+       if (game.landed) {
+           prout(_("You must be aboard the ship."));
+           return;
+       }
+       if (game.iscraft != onship) {
+           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."));
+       if (game.state.rembase==0) {
+           /* Oops! no place to go... */
+           finish(FABANDN);
+           return;
+       }
+       q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
+       /* Dispose of crew */
+       if (!(game.options & OPTION_WORLDS) && !damaged(DTRANSP)) {
+           prout(_("Remainder of ship's complement beam down"));
+           prout(_("to nearest habitable planet."));
+       } else if (q->planet != NOPLANET && !damaged(DTRANSP)) {
+           prout(_("Remainder of ship's complement beam down to %s."),
+                   systnames[q->planet]);
+       } else {
+           prout(_("Entire crew of %d left to die in outer space."),
+                   game.state.crew);
+           game.casual += game.state.crew;
+           game.abandoned += game.state.crew;
+       }
+
+       /* If at least one base left, give 'em the Faerie Queene */
+       skip(1);
+       game.icrystl = false; /* crystals are lost */
+       game.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 (!same(game.quadrant, game.state.baseq[nb])) {
+           game.quadrant = game.state.baseq[nb];
+           game.sector.x = game.sector.y = 5;
+           newqad(true);
+       }
+       for (;;) {
+           /* position next to base by trial and error */
+           game.quad[game.sector.x][game.sector.y] = IHDOT;
+           for (l = 1; l <= QUADSIZE; l++) {
+               game.sector.x = 3.0*Rand() - 1.0 + game.base.x;
+               game.sector.y = 3.0*Rand() - 1.0 + game.base.y;
+               if (VALID_SECTOR(game.sector.x, game.sector.y) &&
+                   game.quad[game.sector.x][game.sector.y] == IHDOT) break;
+           }
+           if (l < QUADSIZE+1)
+               break; /* found a spot */
+           game.sector.x=QUADSIZE/2;
+           game.sector.y=QUADSIZE/2;
+           newqad(true);
+       }
+    }
+    /* Get new commission */
+    game.quad[game.sector.x][game.sector.y] = game.ship = IHF;
+    game.state.crew = FULLCREW;
+    prout(_("Starfleet puts you in command of another ship,"));
+    prout(_("the Faerie Queene, which is antiquated but,"));
+    prout(_("still useable."));
+    if (game.icrystl)
+       prout(_("The dilithium crystals have been moved."));
+    game.imine = false;
+    game.iscraft = offship; /* Galileo disappears */
+    /* Resupply ship */
+    game.condition=docked;
+    for (l = 0; l < NDEVICES; l++) 
+       game.damage[l] = 0.0;
+    game.damage[DSHUTTL] = -1;
+    game.energy = game.inenrg = 3000.0;
+    game.shield = game.inshld = 1250.0;
+    game.torps = game.intorps = 6;
+    game.lsupres=game.inlsr=3.0;
+    game.shldup=false;
+    game.warpfac=5.0;
+    game.wfacsq=25.0;
+    return;
+}
diff --git a/historic/c-version/src/planets.c b/historic/c-version/src/planets.c
new file mode 100644 (file)
index 0000000..e8ead07
--- /dev/null
@@ -0,0 +1,542 @@
+#include "sst.h"
+
+static char *classes[] = {"M","N","O"};
+
+static bool consumeTime(void)
+/* abort a lengthy operation if an event interrupts it */
+{
+    game.ididit = true;
+    events();
+    if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova || game.justin) 
+       return true;
+    return false;
+}
+
+void survey(void) 
+/* report on (uninhabited) planets in the galaxy */
+{
+    bool iknow = false;
+    int i;
+    skip(1);
+    chew();
+    prout(_("Spock-  \"Planet report follows, Captain.\""));
+    skip(1);
+    for (i = 0; i < game.inplan; i++) {
+       if (game.state.planets[i].pclass == destroyed)
+           continue;
+       if ((game.state.planets[i].known != unknown
+            && game.state.planets[i].inhabited == UNINHABITED)
+           || idebug) {
+           iknow = true;
+           if (idebug && game.state.planets[i].known==unknown)
+               proutn("(Unknown) ");
+           proutn(cramlc(quadrant, game.state.planets[i].w));
+           proutn(_("   class "));
+           proutn(classes[game.state.planets[i].pclass]);
+           proutn("   ");
+           if (game.state.planets[i].crystals != present)
+               proutn(_("no "));
+           prout(_("dilithium crystals present."));
+           if (game.state.planets[i].known==shuttle_down) 
+               prout(_("    Shuttle Craft Galileo on surface."));
+       }
+    }
+    if (!iknow)
+       prout(_("No information available."));
+}
+
+void orbit(void)
+/* enter standard orbit */
+{
+    skip(1);
+    chew();
+    if (game.inorbit) {
+       prout(_("Already in standard orbit."));
+       return;
+    }
+    if (damaged(DWARPEN) && damaged(DIMPULS)) {
+       prout(_("Both warp and impulse engines damaged."));
+       return;
+    }
+    if (!is_valid(game.plnet) || abs(game.sector.x-game.plnet.x) > 1 || abs(game.sector.y-game.plnet.y) > 1) {
+       crmshp();
+       prout(_(" not adjacent to planet."));
+       skip(1);
+       return;
+    }
+    game.optime = 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);
+    game.inorbit = true;
+    game.ididit = true;
+}
+
+void sensor(void)
+/* examine planets in this quadrant */
+{
+    if (damaged(DSRSENS)) {
+       if (game.options & OPTION_TTY)
+           prout(_("Short range sensors damaged."));
+       return;
+    }
+    if (!is_valid(game.plnet)) {
+       if (game.options & OPTION_TTY)
+           prout(_("Spock- \"No planet in this quadrant, Captain.\""));
+       return;
+    }
+    if (game.state.planets[game.iplnet].known == unknown) {
+       prout(_("Spock-  \"Sensor scan for %s-"), cramlc(quadrant, game.quadrant));
+       skip(1);
+       prout(_("         Planet at %s is of class %s."),
+             cramlc(sector,game.plnet),
+             classes[game.state.planets[game.iplnet].pclass]);
+       if (game.state.planets[game.iplnet].known==shuttle_down) 
+           prout(_("         Sensors show Galileo still on surface."));
+       proutn(_("         Readings indicate"));
+       if (game.state.planets[game.iplnet].crystals != present)
+           proutn(_(" no"));
+       prout(_(" dilithium crystals present.\""));
+       if (game.state.planets[game.iplnet].known == unknown)
+           game.state.planets[game.iplnet].known = known;
+    }
+}
+
+void beam(void) 
+/* use the transporter */
+{
+    double nrgneed = 0;
+    chew();
+    skip(1);
+    if (damaged(DTRANSP)) {
+       prout(_("Transporter damaged."));
+       if (!damaged(DSHUTTL) && (game.state.planets[game.iplnet].known==shuttle_down || game.iscraft == onship)) {
+           skip(1);
+           proutn(_("Spock-  \"May I suggest the shuttle craft, Sir?\" "));
+           if (ja() == true)
+               shuttle();
+       }
+       return;
+    }
+    if (!game.inorbit) {
+       crmshp();
+       prout(_(" not in standard orbit."));
+       return;
+    }
+    if (game.shldup) {
+       prout(_("Impossible to transport through shields."));
+       return;
+    }
+    if (game.state.planets[game.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 (!game.landed && game.state.planets[game.iplnet].crystals==absent) {
+       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() == false) {
+           chew();
+           return;
+       }
+    }
+    if (!(game.options & OPTION_PLAIN)) {
+       nrgneed = 50 * game.skill + game.height / 100.0;
+       if (nrgneed > game.energy) {
+           prout(_("Engineering to bridge--"));
+           prout(_("  Captain, we don't have enough energy for transportation."));
+           return;
+       }
+       if (!game.landed && nrgneed * 2 > game.energy) {
+           prout(_("Engineering to bridge--"));
+           prout(_("  Captain, we have enough energy only to transport you down to"));
+           prout(_("  the planet, but there wouldn't be an energy for the trip back."));
+           if (game.state.planets[game.iplnet].known == shuttle_down)
+               prout(_("  Although the Galileo shuttle craft may still be on a surface."));
+           proutn(_("  Are you sure this is wise?\" "));
+           if (ja() == false) {
+               chew();
+               return;
+           }
+       }
+    }
+    if (game.landed) {
+       /* Coming from planet */
+       if (game.state.planets[game.iplnet].known==shuttle_down) {
+           proutn(_("Spock-  \"Wouldn't you rather take the Galileo?\" "));
+           if (ja() == true) {
+               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 */
+       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.\""));
+    }
+    game.ididit = true;
+    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");
+    game.landed = !game.landed;
+    game.energy -= nrgneed;
+    skip(2);
+    prout(_("Transport complete."));
+    if (game.landed && game.state.planets[game.iplnet].known==shuttle_down) {
+       prout(_("The shuttle craft Galileo is here!"));
+    }
+    if (!game.landed && game.imine) {
+       game.icrystl = true;
+       game.cryprob = 0.05;
+    }
+    game.imine = false;
+    return;
+}
+
+void mine(void) 
+/* strip-mine a world for dilithium */
+{
+    skip(1);
+    chew();
+    if (!game.landed) {
+       prout(_("Mining party not on planet."));
+       return;
+    }
+    if (game.state.planets[game.iplnet].crystals == mined) {
+       prout(_("This planet has already been strip-mined for dilithium."));
+       return;
+    }
+    else if (game.state.planets[game.iplnet].crystals == absent) {
+       prout(_("No dilithium crystals on this planet."));
+       return;
+    }
+    if (game.imine) {
+       prout(_("You've already mined enough crystals for this trip."));
+       return;
+    }
+    if (game.icrystl && game.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;
+    }
+    game.optime = (0.1+0.2*Rand())*game.state.planets[game.iplnet].pclass;
+    if (consumeTime())
+       return;
+    prout(_("Mining operation complete."));
+    game.state.planets[game.iplnet].crystals = mined;
+    game.imine = game.ididit = true;
+}
+
+void usecrystals(void)
+/* use dilithium crystals */
+{
+    game.ididit = false;
+    skip(1);
+    chew();
+    if (!game.icrystl) {
+       prout(_("No dilithium crystals available."));
+       return;
+    }
+    if (game.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() == false) {
+       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() <= game.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;
+    }
+    game.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!\""));
+    game.cryprob *= 2.0;
+    game.ididit = true;
+}
+
+void shuttle(void) 
+/* use shuttlecraft for planetary jaunt */
+{
+    chew();
+    skip(1);
+    if(damaged(DSHUTTL)) {
+       if (game.damage[DSHUTTL] == -1.0) {
+           if (game.inorbit && game.state.planets[game.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 /* game.damage[DSHUTTL] < 0 */ 
+           prout(_("Shuttle craft is now serving Big Macs."));
+       return;
+    }
+    if (!game.inorbit) {
+       crmshp();
+       prout(_(" not in standard orbit."));
+       return;
+    }
+    if ((game.state.planets[game.iplnet].known != shuttle_down) && game.iscraft != onship) {
+       prout(_("Shuttle craft not currently available."));
+       return;
+    }
+    if (!game.landed && game.state.planets[game.iplnet].known==shuttle_down) {
+       prout(_("You will have to beam down to retrieve the shuttle craft."));
+       return;
+    }
+    if (game.shldup || game.condition == docked) {
+       prout(_("Shuttle craft cannot pass through shields."));
+       return;
+    }
+    if (game.state.planets[game.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;
+    }
+    game.optime = 3.0e-5*game.height;
+    if (game.optime >= 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*game.optime/game.state.remtime));
+       prout(_("remaining time."));
+       proutn(_("Are you sure this is wise?\" "));
+       if (ja() == false) {
+           game.optime = 0.0;
+           return;
+       }
+    }
+    if (game.landed) {
+       /* Kirk on planet */
+       if (game.iscraft == onship) {
+           /* Galileo on ship! */
+           if (!damaged(DTRANSP)) {
+               proutn(_("Spock-  \"Would you rather use the transporter?\" "));
+               if (ja() == true) {
+                   beam();
+                   return;
+               }
+               proutn(_("Shuttle crew"));
+           }
+           else
+               proutn(_("Rescue party"));
+           prout(_(" boards Galileo and swoops toward planet surface."));
+           game.iscraft = offship;
+           skip(1);
+           if (consumeTime())
+               return;
+           game.state.planets[game.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);
+           prouts(_("The short hop begins . . ."));
+           skip(1);
+           game.state.planets[game.iplnet].known=known;
+           game.icraft = true;
+           skip(1);
+           game.landed = false;
+           if (consumeTime())
+               return;
+           game.iscraft = onship;
+           game.icraft = false;
+           if (game.imine) {
+               game.icrystl = true;
+               game.cryprob = 0.05;
+           }
+           game.imine = false;
+           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);
+       game.icraft = true;
+       game.iscraft = offship;
+       if (consumeTime())
+           return;
+       game.state.planets[game.iplnet].known = shuttle_down;
+       game.landed = true;
+       game.icraft = false;
+       prout(_("Trip complete."));
+       return;
+    }
+}
+
+void deathray(void)
+/* use the big zapper */
+{
+    double dprob, r = Rand();
+       
+    game.ididit = false;
+    skip(1);
+    chew();
+    if (game.ship != IHE) {
+       prout(_("Ye Faerie Queene has no death ray."));
+       return;
+    }
+    if (game.nenhere==0) {
+       prout(_("Sulu-  \"But Sir, there are no enemies in this quadrant.\""));
+       return;
+    }
+    if (damaged(DDRAY)) {
+       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() == false)
+       return;
+    prout(_("Spock-  \"Acknowledged.\""));
+    skip(1);
+    game.ididit = true;
+    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 (game.nenhere > 0)
+           deadkl(game.ks[1], game.quad[game.ks[1].x][game.ks[1].y],game.ks[1]);
+       prout(_("Ensign Chekov-  \"Congratulations, Captain!\""));
+       if ((game.state.remkl + game.state.remcom + game.state.nscrem) == 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 (i = 1; i <= QUADSIZE; i++)
+           for (j = 1; j <= QUADSIZE; 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/historic/c-version/src/reports.c b/historic/c-version/src/reports.c
new file mode 100644 (file)
index 0000000..fb8916a
--- /dev/null
@@ -0,0 +1,676 @@
+#include "sst.h"
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+void attackreport(bool curt)
+/* report status of bases under attack */
+{
+    if (!curt) {
+       if (is_scheduled(FCDBAS)) {
+           prout(_("Starbase in %s is currently under Commander attack."),
+                 cramlc(quadrant, game.battle));
+           prout(_("It can hold out until Stardate %d."),
+                 (int)scheduled(FCDBAS));
+       }
+       else if (game.isatb == 1) {
+           prout(_("Starbase in %s is under Super-commander attack."),
+                 cramlc(quadrant, game.state.kscmdr));
+           prout(_("It can hold out until Stardate %d."),
+                 (int)scheduled(FSCDBAS));
+       } else {
+           prout(_("No Starbase is currently under attack."));
+       }
+    } else {
+        if (is_scheduled(FCDBAS))
+           proutn(_("Base in %i - %i attacked by C. Alive until %.1f"), game.battle.x, game.battle.y, scheduled(FCDBAS));
+        if (game.isatb)
+           proutn(_("Base in %i - %i attacked by S. Alive until %.1f"), game.state.kscmdr.x, game.state.kscmdr.y, scheduled(FSCDBAS));
+       clreol();
+    }
+}
+       
+
+void report(void)
+/* report on general game status */
+{
+    char *s1,*s2,*s3;
+
+    chew();
+    s1 = (game.thawed?_("thawed "):"");
+    switch (game.length) {
+    case 1: s2=_("short"); break;
+    case 2: s2=_("medium"); break;
+    case 4: s2=_("long"); break;
+    default: s2=_("unknown length"); break;
+    }
+    switch (game.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;
+    }
+    skip(1);
+    prout(_("You %s a %s%s %s game."),
+         game.alldone? _("were playing") : _("are playing"), s1, s2, s3);
+    if (game.skill>SKILL_GOOD && game.thawed && !game.alldone)
+       prout(_("No plaque is allowed."));
+    if (game.tourn)
+       prout(_("This is tournament game %d."), game.tourn);
+    prout(_("Your secret password is \"%s\""),game.passwd);
+    proutn(_("%d of %d Klingons have been killed"), 
+          ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem)), 
+          (game.inkling + game.incom + game.inscom));
+    if (game.incom - game.state.remcom)
+       prout(_(", including %d Commander%s."), game.incom - game.state.remcom, (game.incom - game.state.remcom)==1?"":_("s"));
+    else if (game.inkling - game.state.remkl + (game.inscom - game.state.nscrem) > 0)
+       prout(_(", but no Commanders."));
+    else
+       prout(".");
+    if (game.skill > SKILL_FAIR)
+       prout(_("The Super Commander has %sbeen destroyed."),
+             game.state.nscrem?_("not "):"");
+    if (game.state.rembase != game.inbase) {
+       proutn(_("There "));
+       if (game.inbase-game.state.rembase==1)
+           proutn(_("has been 1 base"));
+       else {
+           proutn(_("have been %d bases"), game.inbase-game.state.rembase);
+       }
+       prout(_(" destroyed, %d remaining."), game.state.rembase);
+    }
+    else
+       prout(_("There are %d bases."), game.inbase);
+    if (!damaged(DRADIO) || game.condition == docked || game.iseenit) {
+       // Don't report this if not seen and
+       // either the radio is dead or not at base!
+       attackreport(false);
+       game.iseenit = true;
+    }
+    if (game.casual) 
+       prout(_("%d casualt%s suffered so far."),
+             game.casual, game.casual==1? "y" : "ies");
+    if (game.nhelp)
+       prout(_("There were %d call%s for help."),
+             game.nhelp, game.nhelp==1 ? "" : _("s"));
+    if (game.ship == IHE) {
+       proutn(_("You have "));
+       if (game.nprobes)
+           proutn("%d", game.nprobes);
+       else
+           proutn(_("no"));
+       proutn(_(" deep space probe"));
+       if (game.nprobes!=1)
+           proutn(_("s"));
+       prout(".");
+    }
+    if ((!damaged(DRADIO) || game.condition == docked)
+               && is_scheduled(FDSPROB)) {
+       if (game.isarmed) 
+           proutn(_("An armed deep space probe is in "));
+       else
+           proutn(_("A deep space probe is in "));
+       proutn(cramlc(quadrant, game.probec));
+       prout(".");
+    }
+    if (game.icrystl) {
+       if (game.cryprob <= .05)
+           prout(_("Dilithium crystals aboard ship... not yet used."));
+       else {
+           int i=0;
+           double ai = 0.05;
+           while (game.cryprob > ai) {
+               ai *= 2.0;
+               i++;
+           }
+           prout(_("Dilithium crystals have been used %d time%s."),
+                 i, i==1? "" : _("s"));
+       }
+    }
+    skip(1);
+}
+       
+void lrscan(void) 
+/* long-range sensor scan */
+{
+    int x, y;
+    if (damaged(DLRSENS)) {
+       /* Now allow base's sensors if docked */
+       if (game.condition != docked) {
+           prout(_("LONG-RANGE SENSORS DAMAGED."));
+           return;
+       }
+       prout(_("Starbase's long-range scan"));
+    }
+    else {
+       prout(_("Long-range scan"));
+    }
+    for (x = game.quadrant.x-1; x <= game.quadrant.x+1; x++) {
+       proutn(" ");
+       for (y = game.quadrant.y-1; y <= game.quadrant.y+1; y++) {
+           if (!VALID_QUADRANT(x, y))
+               proutn("  -1");
+           else {
+               game.state.galaxy[x][y].charted = true;
+               rechart();
+               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 damagereport(void) 
+/* damage report */
+{
+    bool jdam = false;
+    int i;
+    chew();
+
+    for (i = 0; i < NDEVICES; i++) {
+       if (damaged(i)) {
+           if (!jdam) {
+               prout(_("\tDEVICE\t\t\t-REPAIR TIMES-"));
+               prout(_("\t\t\tIN FLIGHT\t\tDOCKED"));
+               jdam = true;
+           }
+           prout("  %-26s\t%8.2f\t\t%8.2f", 
+                 device[i],
+                 game.damage[i]+0.05,
+                 game.docfac*game.damage[i]+0.005);
+       }
+    }
+    if (!jdam)
+       prout(_("All devices functional."));
+}
+
+static void rechart_quad(int x, int y)
+{
+    if (game.state.galaxy[x][y].charted) {
+       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;
+    }
+}
+
+static void rechart_dsradio(void)
+/* update the chart in the Enterprise's computer from galaxy data */
+{
+    int i, j;
+    game.lastchart = game.state.date;
+    for (i = 1; i <= GALSIZE; i++)
+       for (j = 1; j <= GALSIZE; j++)
+           rechart_quad(i, j);
+}
+
+static void rechart_lr(void)
+/* update the chart in the Enterprise's computer from galaxy data */
+{
+    int i, j;
+    for (i = game.quadrant.x-1; i <= game.quadrant.x+1; i++) {
+       for (j = game.quadrant.y-1; j <= game.quadrant.y+1; j++) {
+           if (i == game.quadrant.x && j == game.quadrant.y)
+               continue;
+           rechart_quad(i, j);
+       }
+    }
+}
+
+static void rechart_sr(void)
+/* update the chart in the Enterprise's computer from galaxy data */
+{
+    rechart_quad(game.quadrant.x, game.quadrant.y);
+}
+
+void rechart(void)
+{
+    if (!damaged(DRADIO) || game.condition == docked) {
+       if (game.lastchart < game.state.date && game.condition == docked)
+           prout(_("Spock-  \"I revised the Star Chart from the "
+                   "starbase's records.\""));
+       rechart_dsradio();
+    } else {
+       if (!damaged(DLRSENS))
+           rechart_lr();
+       if (!damaged(DSRSENS))
+           rechart_sr();
+    }
+}
+
+void chart(void)
+/* display the star chart */ 
+{
+    int i,j;
+    chew();
+
+    rechart();
+
+    prout(_("       STAR CHART FOR THE KNOWN GALAXY"));
+    if (game.state.date > game.lastchart)
+       prout(_("(Last surveillance update %d stardates ago)."),
+             (int)(game.state.date-game.lastchart));
+    prout("      1    2    3    4    5    6    7    8");
+    for (i = 1; i <= GALSIZE; i++) {
+       proutn("%d |", i);
+       for (j = 1; j <= GALSIZE; j++) {
+           char buf[4];
+           if ((game.options & OPTION_SHOWME) && i == game.quadrant.x && j == game.quadrant.y)
+               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 == game.quadrant.x && j == game.quadrant.y)
+               proutn(">");
+           else
+               proutn(" ");
+       }
+       proutn("  |");
+       if (i<GALSIZE)
+           skip(1);
+    }
+}
+
+static void sectscan(int goodScan, int i, int j) 
+/* light up an individual dot in a sector */
+{
+    if (goodScan || (abs(i-game.sector.x)<= 1 && abs(j-game.sector.y) <= 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 (game.condition) {
+           case red: textcolor(RED); break;
+           case green: textcolor(GREEN); break;
+           case yellow: textcolor(YELLOW); break;
+           case docked: textcolor(CYAN); break;
+           case dead: textcolor(BROWN);
+           }
+           if (game.quad[i][j] != game.ship) 
+               highvideo();
+       }
+       proutn("%c ",game.quad[i][j]);
+       textcolor(DEFAULT);
+    }
+    else
+       proutn("- ");
+}
+
+void status(int req)
+/* print status report lines */
+{
+#define RQ(n, a) if (!req || req == n) do { a } while(0)
+    char *cp = NULL, s[256];
+    int t, dam = 0;
+
+    RQ(1,
+       prstat(_("Stardate"), _("%.1f, Time Left %.2f"), game.state.date, game.state.remtime);
+    );
+
+    RQ(2,
+       if (game.condition != docked)
+           newcnd();
+       switch (game.condition) {
+           case red: cp = _("RED"); break;
+           case green: cp = _("GREEN"); break;
+           case yellow: cp = _("YELLOW"); break;
+           case docked: cp = _("DOCKED"); break;
+           case dead: cp = _("DEAD"); break;
+       }
+       for (t=0;t<NDEVICES;t++)
+           if (game.damage[t]>0) 
+               dam++;
+       prstat(_("Condition"), _("%s, %i DAMAGES"), cp, dam);
+    );
+
+    RQ(3,
+       prstat(_("Position"), "%d - %d , %d - %d",
+             game.quadrant.x, game.quadrant.y, game.sector.x, game.sector.y);
+    );
+
+    RQ(4,
+       if (damaged(DLIFSUP)) {
+           if (game.condition == docked)
+               sprintf(s, _("DAMAGED, Base provides"));
+           else
+               sprintf(s, _("DAMAGED, reserves=%4.2f"), game.lsupres);
+       }
+       else
+           sprintf(s, _("ACTIVE"));
+       prstat(_("Life Support"), s);
+    );
+
+    RQ(5,
+       prstat(_("Warp Factor"), "%.1f", game.warpfac);
+    );
+
+    RQ(6,
+       prstat(_("Energy"), "%.2f%s", game.energy,
+               (game.icrystl && (game.options & OPTION_SHOWME)) ? /* ESR */
+               _(" (have crystals)") : "");
+    );
+
+    RQ(7,
+       prstat(_("Torpedoes"), "%d", game.torps);
+    );
+
+    RQ(8,
+       if (damaged(DSHIELD))
+           strcpy(s, _("DAMAGED,"));
+       else if (game.shldup)
+           strcpy(s, _("UP,"));
+       else
+           strcpy(s, _("DOWN,"));
+       sprintf(s + strlen(s), _(" %d%% %.1f units"),
+              (int)((100.0*game.shield)/game.inshld + 0.5), game.shield);
+       prstat(_("Shields"), s);
+    );
+
+    RQ(9,
+        prstat(_("Klingons Left"), "%d", game.state.remkl + game.state.remcom + game.state.nscrem);
+    );
+
+    RQ(10,
+       if (game.options & OPTION_WORLDS) {
+           int plnet = game.state.galaxy[game.quadrant.x][game.quadrant.y].planet;
+           if (plnet != NOPLANET && game.state.planets[plnet].inhabited != UNINHABITED)
+               prstat(_("Major system"), "%s", systnames[plnet]);
+           else
+               prout(_("Sector is uninhabited"));
+       }
+    );
+
+    RQ(11,
+       attackreport(!req);
+    );
+
+#undef RQ
+}
+
+void request(void)
+{
+    int req;
+    static char requests[][3] =
+       {"da","co","po","ls","wa","en","to","sh","kl","sy", "ti"};
+
+    while (scan() == IHEOL)
+       proutn(_("Information desired? "));
+    chew();
+    for (req = 0; req < ARRAY_SIZE(requests); req++)
+       if (strncmp(citem, requests[req], min(2,strlen(citem)))==0)
+           break;
+    if (req >= ARRAY_SIZE(requests)) {
+       prout(_("UNRECOGNIZED REQUEST. Legal requests are:"));
+       prout(("  date, condition, position, lsupport, warpfactor,"));
+       prout(("  energy, torpedoes, shields, klingons, system, time."));
+       return;
+    }
+    status(req + 1);
+}
+               
+void srscan(void)
+/* short-range scan */
+{
+    int i, j;
+    int goodScan=true;
+    if (damaged(DSRSENS)) {
+       /* Allow base's sensors if docked */
+       if (game.condition != docked) {
+           prout(_("   S.R. SENSORS DAMAGED!"));
+           goodScan=false;
+       }
+       else
+           prout(_("  [Using Base's sensors]"));
+    }
+    else
+       prout(_("     Short-range scan"));
+    if (goodScan) {
+       game.state.galaxy[game.quadrant.x][game.quadrant.y].charted = true;
+       rechart();
+    }
+    prout("    1 2 3 4 5 6 7 8 9 10");
+    if (game.condition != docked)
+       newcnd();
+    for (i = 1; i <= QUADSIZE; i++) {
+       proutn("%2d  ", i);
+       for (j = 1; j <= QUADSIZE; j++) {
+           sectscan(goodScan, i, j);
+       }
+       skip(1);
+    }
+}
+                       
+                       
+void eta(void)
+/* use computer to get estimated time of arrival for a warp jump */
+{
+    coord w1, w2;
+    bool wfl, prompt = false;
+    double ttime, twarp, tpower;
+    if (damaged(DCOMPTR)) {
+       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;
+       }
+    }
+    w1.y = aaitem +0.5;
+    if (scan() != IHREAL) {
+       huh();
+       return;
+    }
+    w1.x = aaitem + 0.5;
+    if (scan() == IHREAL) {
+       w2.y = aaitem + 0.5;
+       if (scan() != IHREAL) {
+           huh();
+           return;
+       }
+       w2.x = aaitem + 0.5;
+    }
+    else {
+       if (game.quadrant.y>w1.x)
+           w2.x = 1;
+       else
+           w2.x=QUADSIZE;
+       if (game.quadrant.x>w1.y)
+           w2.y = 1;
+       else
+           w2.y=QUADSIZE;
+    }
+
+    if (!VALID_QUADRANT(w1.x, w1.y) || !VALID_SECTOR(w2.x, w2.y)) {
+       huh();
+       return;
+    }
+    game.dist = sqrt(square(w1.y-game.quadrant.y+0.1*(w2.y-game.sector.y))+
+               square(w1.x-game.quadrant.x+0.1*(w2.x-game.sector.x)));
+    wfl = false;
+
+    if (prompt)
+       prout(_("Answer \"no\" if you don't know the value:"));
+    for (;;) {
+       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*game.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."));
+    }
+    for (;;) {
+       chew();
+       ttime = (10.0*game.dist)/square(twarp);
+       tpower = game.dist*twarp*twarp*twarp*(game.shldup+1);
+       if (tpower >= game.energy) {
+           prout(_("Insufficient energy, sir."));
+           if (!game.shldup || tpower > game.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."), game.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 ((game.isatb==1 && same(game.state.kscmdr, w1) &&
+            scheduled(FSCDBAS)< ttime+game.state.date)||
+           (scheduled(FCDBAS)<ttime+game.state.date && same(game.battle, w1)))
+           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;
+       }
+    }
+                       
+}
+
+#ifdef BSD_BUG_FOR_BUG
+/*
+ *     A visual scan is made in a particular direction of three sectors
+ *     in the general direction specified.  This takes time, and
+ *     Klingons can attack you, so it should be done only when sensors
+ *     are out.  Code swiped from BSD-Trek.  Not presently used, as we
+ *     automatically display all adjacent sectors on the short-range
+ *     scan even when short-range sensors are out.
+ */
+
+/* This struct[] has the delta x, delta y for particular directions */
+coord visdelta[] =
+{
+    {-1,-1},
+    {-1, 0},
+    {-1, 1},
+    {0,         1},
+    {1,         1},
+    {1,         0},
+    {1,        -1},
+    {0,        -1},
+    {-1,-1},
+    {-1, 0},
+    {-1, 1},
+};
+
+void visual(void)
+{
+    int                co, ix, iy;
+    coord      *v;
+
+    if (scan() != IHREAL) {
+       chew();
+       proutn(_("Direction? "));
+       if (scan()!=IHREAL) {
+           huh();
+           return;
+       }
+    }
+    if (aaitem < 0.0 || aaitem > 360.0)
+       return;
+    co = (aaitem + 22) / 45;
+    v = &visdelta[co];
+    ix = game.sector.x + v->x;
+    iy = game.sector.y + v->y;
+    if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE)
+       co = '?';
+    else
+       co = game.quad[ix][iy];
+    printf("%d,%d %c ", ix, iy, co);
+    v++;
+    ix = game.sector.x + v->x;
+    iy = game.sector.y + v->y;
+    if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE)
+       co = '?';
+    else
+       co = game.quad[ix][iy];
+    printf("%c ", co);
+    v++;
+    ix = game.sector.x + v->x;
+    iy = game.sector.y + v->y;
+    if (ix < 0 || ix >= QUADSIZE || iy < 0 || iy >= QUADSIZE)
+       co = '?';
+    else
+       co = game.quad[ix][iy];
+    printf("%c %d,%d\n", co, ix, iy);
+    game.optime = 0.5;
+    game.ididit = true;
+}
+#endif
diff --git a/historic/c-version/src/setup.c b/historic/c-version/src/setup.c
new file mode 100644 (file)
index 0000000..e6bba3f
--- /dev/null
@@ -0,0 +1,809 @@
+#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)
+/* issue a historically correct banner */
+{
+    skip(2);
+    prout(_("-SUPER- STAR TREK"));
+    skip(1);
+#ifdef __HISTORICAL__
+    prout(_("Latest update-21 Sept 78"));
+    skip(1);
+#endif /* __HISTORICAL__ */
+}
+
+void freeze(bool boss)
+/* save game */
+{
+    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);
+}
+
+
+bool thaw(void) 
+/* retrieve saved game */
+{
+    FILE *fp;
+    int key;
+
+    game.passwd[0] = '\0';
+    if ((key = scan()) == IHEOL) {
+       proutn(_("File name: "));
+       key = scan();
+    }
+    if (key != IHALPHA) {
+       huh();
+       return true;
+    }
+    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)) {
+       proutn(_("Game file format is bad, should begin with "));
+       prout(SSTMAGIC);
+       skip(1);
+       fclose(fp);
+       return 1;
+    }
+
+    fclose(fp);
+
+    return false;
+}
+
+#define SYSTEM_NAMES \
+    { \
+       /* \
+        * I used <http://www.memory-alpha.org> to find planets \
+        * with references in ST:TOS.  Eath and the Alpha Centauri \
+        * Colony have been omitted. \
+        * \
+        * Some planets marked Class G and P here will be displayed as class M \
+        * because of the way planets are generated. This is a known bug. \
+        */ \
+       /* Federation Worlds */ \
+       _("Andoria (Fesoan)"),  /* several episodes */ \
+       _("Tellar Prime (Miracht)"),    /* TOS: "Journey to Babel" */ \
+       _("Vulcan (T'Khasi)"),  /* many episodes */ \
+       _("Medusa"),            /* TOS: "Is There in Truth No Beauty?" */ \
+       _("Argelius II (Nelphia)"),/* TOS: "Wolf in the Fold" ("IV" in BSD) */ \
+       _("Ardana"),            /* TOS: "The Cloud Minders" */ \
+       _("Catulla (Cendo-Prae)"),      /* TOS: "The Way to Eden" */ \
+       _("Gideon"),            /* TOS: "The Mark of Gideon" */ \
+       _("Aldebaran III"),     /* TOS: "The Deadly Years" */ \
+       _("Alpha Majoris I"),   /* TOS: "Wolf in the Fold" */ \
+       _("Altair IV"),         /* TOS: "Amok Time */ \
+       _("Ariannus"),          /* TOS: "Let That Be Your Last Battlefield" */ \
+       _("Benecia"),           /* TOS: "The Conscience of the King" */ \
+       _("Beta Niobe I (Sarpeidon)"),  /* TOS: "All Our Yesterdays" */ \
+       _("Alpha Carinae II"),  /* TOS: "The Ultimate Computer" */ \
+       _("Capella IV (Kohath)"),       /* TOS: "Friday's Child" (Class G) */ \
+       _("Daran V"),           /* TOS: "For the World is Hollow and I Have Touched the Sky" */ \
+       _("Deneb II"),          /* TOS: "Wolf in the Fold" ("IV" in BSD) */ \
+       _("Eminiar VII"),               /* TOS: "A Taste of Armageddon" */ \
+       _("Gamma Canaris IV"),  /* TOS: "Metamorphosis" */ \
+       _("Gamma Tranguli VI (Vaalel)"),        /* TOS: "The Apple" */ \
+       _("Ingraham B"),                /* TOS: "Operation: Annihilate" */ \
+       _("Janus IV"),          /* TOS: "The Devil in the Dark" */ \
+       _("Makus III"),         /* TOS: "The Galileo Seven" */ \
+       _("Marcos XII"),                /* TOS: "And the Children Shall Lead", */ \
+       _("Omega IV"),          /* TOS: "The Omega Glory" */ \
+       _("Regulus V"),         /* TOS: "Amok Time */ \
+       _("Deneva"),            /* TOS: "Operation -- Annihilate!" */ \
+       /* Worlds from BSD Trek */ \
+       _("Rigel II"),          /* TOS: "Shore Leave" ("III" in BSD) */ \
+       _("Beta III"),          /* TOS: "The Return of the Archons" */ \
+       _("Triacus"),           /* TOS: "And the Children Shall Lead", */ \
+       _("Exo III"),           /* TOS: "What Are Little Girls Made Of?" (Class P) */ \
+    }
+#if 0  /* Others */
+       _("Hansen's Planet"),   /* TOS: "The Galileo Seven" */
+       _("Taurus IV"),         /* TOS: "The Galileo Seven" (class G) */
+       _("Antos IV (Doraphane)"),      /* TOS: "Whom Gods Destroy", "Who Mourns for Adonais?" */
+       _("Izar"),                      /* TOS: "Whom Gods Destroy" */
+       _("Tiburon"),           /* TOS: "The Way to Eden" */
+       _("Merak II"),          /* TOS: "The Cloud Minders" */
+       _("Coridan (Desotriana)"),      /* TOS: "Journey to Babel" */
+       _("Iotia"),             /* TOS: "A Piece of the Action" */
+#endif
+
+#define DEVICE_NAMES \
+    { \
+       _("S. R. Sensors"), \
+       _("L. R. Sensors"), \
+       _("Phasers"), \
+       _("Photon Tubes"), \
+       _("Life Support"), \
+       _("Warp Engines"), \
+       _("Impulse Engines"), \
+       _("Shields"), \
+       _("Subspace Radio"), \
+       _("Shuttle Craft"), \
+       _("Computer"), \
+       _("Navigation System"), \
+       _("Transporter"), \
+       _("Shield Control"), \
+       _("Death Ray"), \
+       _("D. S. Probe") \
+    }
+
+static void setup_names(void)
+/* Sets up some arrays with localized names.
+ * Must be done after iostart() for localization to work. */
+{
+    char *tmp1[ARRAY_SIZE(systnames)] = SYSTEM_NAMES;
+    char *tmp2[ARRAY_SIZE(device)] = DEVICE_NAMES;
+
+    memcpy(systnames, tmp1, sizeof(systnames));
+    memcpy(device, tmp2, sizeof(device));
+}
+       
+void setup(bool needprompt) 
+/* prepare to play, set up cosmos */
+{
+    int i,j, krem, klumper;
+    coord w;
+
+    /* call the setup hooks here */
+    setup_names();
+
+    //  Decide how many of everything
+    if (choose(needprompt))
+       return; // frozen game
+    // Prepare the Enterprise
+    game.alldone = game.gamewon = false;
+    game.ship = IHE;
+    game.state.crew = FULLCREW;
+    game.energy = game.inenrg = 5000.0;
+    game.shield = game.inshld = 2500.0;
+    game.shldchg = false;
+    game.shldup = false;
+    game.inlsr = 4.0;
+    game.lsupres = 4.0;
+    game.quadrant = randplace(GALSIZE);
+    game.sector = randplace(QUADSIZE);
+    game.torps = game.intorps = 10;
+    game.nprobes = (int)(3.0*Rand() + 2.0);    /* Give them 2-4 of these wonders */
+    game.warpfac = 5.0;
+    game.wfacsq = game.warpfac * game.warpfac;
+    for (i=0; i < NDEVICES; i++) 
+       game.damage[i] = 0.0;
+    // Set up assorted game parameters
+    invalidate(game.battle);
+    game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0);
+    game.nkinks = game.nhelp = game.casual = game.abandoned = 0;
+    game.iscate = game.resting = game.imine = game.icrystl = game.icraft = false;
+    game.isatb = game.state.nplankl = 0;
+    game.state.starkl = game.state.basekl = 0;
+    game.iscraft = onship;
+    game.landed = false;
+    game.alive = true;
+    game.docfac = 0.25;
+    for (i = 1; i <= GALSIZE; i++)
+       for (j = 1; j <= GALSIZE; j++) {
+           struct quadrant *quad = &game.state.galaxy[i][j];
+           quad->charted = 0;
+           quad->planet = NOPLANET;
+           quad->romulans = 0;
+           quad->klingons = 0;
+           quad->starbase = false;
+           quad->supernova = false;
+           quad->status = secure;
+       }
+    // Initialize times for extraneous events
+    schedule(FSNOVA, expran(0.5 * game.intime));
+    schedule(FTBEAM, expran(1.5 * (game.intime / game.state.remcom)));
+    schedule(FSNAP, 1.0 + Rand()); // Force an early snapshot
+    schedule(FBATTAK, expran(0.3*game.intime));
+    unschedule(FCDBAS);
+    if (game.state.nscrem)
+       schedule(FSCMOVE, 0.2777);
+    else
+       unschedule(FSCMOVE);
+    unschedule(FSCDBAS);
+    unschedule(FDSPROB);
+    if ((game.options & OPTION_WORLDS) && game.skill >= SKILL_GOOD)
+       schedule(FDISTR, expran(1.0 + game.intime));
+    else
+       unschedule(FDISTR);
+    unschedule(FENSLV);
+    unschedule(FREPRO);
+    // Starchart is functional but we've never seen it
+    game.lastchart = FOREVER;
+    // Put stars in the galaxy
+    game.instar = 0;
+    for (i = 1; i <= GALSIZE; i++)
+       for (j = 1; j <= GALSIZE; j++) {
+           int k = Rand()*9.0 + 1.0;
+           game.instar += k;
+           game.state.galaxy[i][j].stars = k;
+       }
+    // Locate star bases in galaxy
+    for (i = 1; i <= game.inbase; i++) {
+       bool contflag;
+       do {
+           do w = randplace(GALSIZE);
+           while (game.state.galaxy[w.x][w.y].starbase);
+           contflag = false;
+           for (j = i-1; j > 0; j--) {
+               /* Improved placement algorithm to spread out bases */
+               double distq = square(w.x-game.state.baseq[j].x) + square(w.y-game.state.baseq[j].y);
+               if (distq < 6.0*(BASEMAX+1-game.inbase) && Rand() < 0.75) {
+                   contflag = true;
+                   if (idebug)
+                       prout("=== Abandoning base #%d at %d-%d", i, w.x, w.y);
+                   break;
+               }
+               else if (distq < 6.0 * (BASEMAX+1-game.inbase)) {
+                   if (idebug)
+                       prout("=== Saving base #%d, close to #%d", i, j);
+               }
+           }
+       } while (contflag);
+                       
+       game.state.baseq[i] = w;
+       game.state.galaxy[w.x][w.y].starbase = true;
+       game.state.chart[w.x][w.y].starbase = true;
+    }
+    // Position ordinary Klingon Battle Cruisers
+    krem = game.inkling;
+    klumper = 0.25*game.skill*(9.0-game.length)+1.0;
+    if (klumper > MAXKLQUAD) 
+       klumper = MAXKLQUAD;
+    do {
+       double r = Rand();
+       int klump = (1.0 - r*r)*klumper;
+       if (klump > krem)
+           klump = krem;
+       krem -= klump;
+       do w = randplace(GALSIZE);
+       while (game.state.galaxy[w.x][w.y].supernova ||
+               game.state.galaxy[w.x][w.y].klingons + klump > 9);
+       game.state.galaxy[w.x][w.y].klingons += klump;
+    } while (krem > 0);
+    // Position Klingon Commander Ships
+#ifdef ODEBUG
+    klumper = 1;
+#endif /* ODEBUG */
+    for (i = 1; i <= game.incom; i++) {
+       do {
+           do { /* IF debugging, put commanders by bases, always! */
+#ifdef ODEBUG
+               if (game.idebug && klumper <= game.inbase) {
+                   w = game.state.baseq[klumper];
+                   klumper++;
+               }
+               else
+#endif /* ODEBUG */
+                   w = randplace(GALSIZE);
+           }
+           while ((!game.state.galaxy[w.x][w.y].klingons && Rand() < 0.75)||
+                  game.state.galaxy[w.x][w.y].supernova||
+                  game.state.galaxy[w.x][w.y].klingons > 8);
+           // check for duplicate
+           for (j = 1; j < i; j++)
+               if (same(game.state.kcmdr[j], w))
+                   break;
+       } while (j < i);
+       game.state.galaxy[w.x][w.y].klingons++;
+       game.state.kcmdr[i] = w;
+    }
+    // Locate planets in galaxy
+    for (i = 0; i < game.inplan; i++) {
+       do w = randplace(GALSIZE); 
+       while (game.state.galaxy[w.x][w.y].planet != NOPLANET);
+       game.state.planets[i].w = w;
+       if ((game.options & OPTION_WORLDS) && i < NINHAB) {
+           game.state.planets[i].pclass = M;   // All inhabited planets are class M
+           game.state.planets[i].crystals = absent;
+           game.state.planets[i].known = known;
+           game.state.planets[i].inhabited = i;
+       } else {
+           game.state.planets[i].pclass = Rand()*3.0; // Planet class M N or O
+           game.state.planets[i].crystals = Rand()*1.5;                // 1 in 3 chance of crystals
+           game.state.planets[i].known = unknown;
+           game.state.planets[i].inhabited = UNINHABITED;
+       }
+       game.state.galaxy[w.x][w.y].planet = i;
+    }
+    // Locate Romulans
+    for (i = 1; i <= game.state.nromrem; i++) {
+       w = randplace(GALSIZE);
+       game.state.galaxy[w.x][w.y].romulans = 1;
+    }
+    // Locate the Super Commander
+    if (game.state.nscrem > 0) {
+       do w = randplace(GALSIZE);
+       while (game.state.galaxy[w.x][w.y].supernova || game.state.galaxy[w.x][w.y].klingons > 8);
+       game.state.kscmdr = w;
+       game.state.galaxy[w.x][w.y].klingons++;
+    }
+    // Place thing (in tournament game, thingx == -1, don't want one!)
+    if (thing.x != -1) {
+       thing = randplace(GALSIZE);
+    }
+    else
+       invalidate(thing);
+
+    skip(2);
+    game.state.snap = false;
+               
+    if (game.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."),
+             (game.inkling + game.incom + game.inscom));
+       prout(_("You have an initial allotment of %d stardates to complete"), (int)game.intime);
+       prout(_("your mission.  As you proceed you may be given more time."));
+       skip(1);
+       prout(_("You will have %d supporting starbases."), game.inbase);
+       proutn(_("Starbase locations-  "));
+    }
+    else {
+       prout(_("Stardate %d."), (int)game.state.date);
+       skip(1);
+       prout(_("%d Klingons."), game.inkling + game.incom + game.inscom);
+       prout(_("An unknown number of Romulans."));
+       if (game.state.nscrem)
+           prout(_("And one (GULP) Super-Commander."));
+       prout(_("%d stardates."),(int)game.intime);
+       proutn(_("%d starbases in "), game.inbase);
+    }
+    for (i = 1; i <= game.inbase; i++) {
+       proutn(cramlc(0, game.state.baseq[i]));
+       proutn("  ");
+    }
+    skip(2);
+    proutn(_("The Enterprise is currently in "));
+    proutn(cramlc(quadrant, game.quadrant));
+    proutn(" ");
+    proutn(cramlc(sector, game.sector));
+    skip(2);
+    prout(_("Good Luck!"));
+    if (game.state.nscrem)
+       prout(_("  YOU'LL NEED IT."));
+    waitfor();
+    newqad(false);
+    if (game.nenhere-iqhere-game.ithere)
+       game.shldup = true;
+    if (game.neutz)    // bad luck to start in a Romulan Neutral Zone
+       attack(false);
+}
+
+bool choose(bool needprompt) 
+/* choose your game type */
+{
+    for(;;) {
+       game.tourn = 0;
+       game.thawed = false;
+       game.skill = SKILL_NONE;
+       game.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) // Try again
+           continue;
+       if (isit("tournament")) {
+           while (scan() == IHEOL) {
+               proutn(_("Type in tournament number-"));
+           }
+           if (aaitem == 0) {
+               chew();
+               continue; // We don't want a blank entry
+           }
+           game.tourn = (int)aaitem;
+           thing.x = -1;
+           srand((unsigned int)(int)aaitem);
+           break;
+       }
+       if (isit("saved") || isit("frozen")) {
+           if (thaw())
+               continue;
+           chew();
+           if (*game.passwd==0)
+               continue;
+           if (!game.alldone)
+               game.thawed = true; // No plaque if not finished
+           report();
+           waitfor();
+           return true;
+       }
+       if (isit("regular"))
+           break;
+       proutn(_("What is \""));
+       proutn(citem);
+       prout("\"?");
+       chew();
+    }
+    while (game.length==0 || game.skill==SKILL_NONE) {
+       if (scan() == IHALPHA) {
+           if (isit("short"))
+               game.length = 1;
+           else if (isit("medium"))
+               game.length = 2;
+           else if (isit("long"))
+               game.length = 4;
+           else if (isit("novice"))
+               game.skill = SKILL_NOVICE;
+           else if (isit("fair"))
+               game.skill = SKILL_FAIR;
+           else if (isit("good"))
+               game.skill = SKILL_GOOD;
+           else if (isit("expert"))
+               game.skill = SKILL_EXPERT;
+           else if (isit("emeritus"))
+               game.skill = SKILL_EMERITUS;
+           else {
+               proutn(_("What is \""));
+               proutn(citem);
+               prout("\"?");
+           }
+       }
+       else {
+           chew();
+           if (game.length==0)
+               proutn(_("Would you like a Short, Medium, or Long game? "));
+           else if (game.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 style (plain, almy, fancy or just press enter): "));
+       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 | OPTION_WORLDS);
+       game.options |= OPTION_PLAIN;
+    } 
+    else if (isit("almy")) {
+       // Approximates Tom Almy's version.
+       game.options &=~ (OPTION_THINGY | OPTION_BLKHOLE | OPTION_BASE | OPTION_WORLDS);
+       game.options |= OPTION_ALMY;
+    }
+    else if (isit("fancy"))
+       /* do nothing */;
+    else if (strlen(citem)) {
+           proutn(_("What is \""));
+           proutn(citem);
+           prout("\"?");
+    }
+    setpassword();
+    if (strcmp(game.passwd, "debug")==0) {
+       idebug = true;
+       fputs("=== Debug mode enabled\n", stdout);
+    }
+
+    // Use parameters to generate initial values of things
+    game.damfac = 0.5 * game.skill;
+    game.state.rembase = 2.0 + Rand()*(BASEMAX-2.0);
+    game.inbase = game.state.rembase;
+    game.inplan = 0;
+    if (game.options & OPTION_PLANETS)
+       game.inplan += (MAXUNINHAB/2) + (MAXUNINHAB/2+1)*Rand();
+    if (game.options & OPTION_WORLDS)
+       game.inplan += NINHAB;
+    game.state.nromrem = game.inrom = (2.0+Rand())*game.skill;
+    game.state.nscrem = game.inscom = (game.skill > SKILL_FAIR ? 1 : 0);
+    game.state.remtime = 7.0 * game.length;
+    game.intime = game.state.remtime;
+    game.state.remkl = game.inkling = 2.0*game.intime*((game.skill+1 - 2*Rand())*game.skill*0.1+.15);
+    game.incom = game.skill + 0.0625*game.inkling*Rand();
+    game.state.remcom = min(10, game.incom);
+    game.incom = game.state.remcom;
+    game.state.remres = (game.inkling+4*game.incom)*game.intime;
+    game.inresor = game.state.remres;
+    if (game.inkling > 50) {
+       game.inbase = (game.state.rembase += 1);
+    }
+    return false;
+}
+
+coord dropin(feature iquad)
+/* drop a feature on a random dot in the current quadrant */
+{
+    coord w;
+    do w = randplace(QUADSIZE);
+    while (game.quad[w.x][w.y] != IHDOT);
+    game.quad[w.x][w.y] = iquad;
+    return w;
+}
+
+void newcnd(void)
+/* update our alert status */
+{
+    game.condition = green;
+    if (game.energy < 1000.0)
+       game.condition = yellow;
+    if (game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons || game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans)
+       game.condition = red;
+    if (!game.alive)
+       game.condition=dead;
+}
+
+coord newkling(int i)
+/* drop new Klingon into current quadrant */
+{
+    coord pi = dropin(IHK);
+    game.ks[i] = pi;
+    game.kdist[i] = game.kavgd[i] = distance(game.sector, pi);
+    game.kpower[i] = Rand()*150.0 +300.0 +25.0*game.skill;
+    return pi;
+}
+
+void newqad(bool shutup)
+/* set up a new state of quadrant, for when we enter or re-enter it */
+{
+    int i, j;
+    coord w;
+    struct quadrant *q;
+
+    game.justin = true;
+    invalidate(game.base);
+    game.klhere = 0;
+    game.comhere = false;
+    invalidate(game.plnet);
+    game.ishere = false;
+    game.irhere = 0;
+    game.iplnet = 0;
+    game.nenhere = 0;
+    game.neutz = false;
+    game.inorbit = false;
+    game.landed = false;
+    game.ientesc = false;
+    game.ithere = false;
+    iqhere = false;
+    iqengry = false;
+    game.iseenit = false;
+    if (game.iscate) {
+       // Attempt to escape Super-commander, so tbeam back!
+       game.iscate = false;
+       game.ientesc = true;
+    }
+    // Clear quadrant
+    for (i = 1; i <= QUADSIZE; i++)
+       for (j = 1; j <= QUADSIZE; j++)
+           game.quad[i][j] = IHDOT;
+    q = &game.state.galaxy[game.quadrant.x][game.quadrant.y];
+    // cope with supernova
+    if (q->supernova)
+       return;
+    game.klhere = q->klingons;
+    game.irhere = q->romulans;
+    game.nenhere = game.klhere + game.irhere;
+
+    // Position Starship
+    game.quad[game.sector.x][game.sector.y] = game.ship;
+
+    if (q->klingons) {
+       w.x = w.y = 0;  /* quiet a gcc warning */
+       // Position ordinary Klingons
+       for (i = 1; i <= game.klhere; i++)
+           w = newkling(i);
+       // If we need a commander, promote a Klingon
+       for (i = 1; i <= game.state.remcom; i++)
+           if (same(game.state.kcmdr[i], game.quadrant))
+               break;
+                       
+       if (i <= game.state.remcom) {
+           game.quad[w.x][w.y] = IHC;
+           game.kpower[game.klhere] = 950.0+400.0*Rand()+50.0*game.skill;
+           game.comhere = true;
+       }
+
+       // If we need a super-commander, promote a Klingon
+       if (same(game.quadrant, game.state.kscmdr)) {
+           game.quad[game.ks[1].x][game.ks[1].y] = IHS;
+           game.kpower[1] = 1175.0 + 400.0*Rand() + 125.0*game.skill;
+           game.iscate = (game.state.remkl > 1);
+           game.ishere = true;
+       }
+    }
+    // Put in Romulans if needed
+    for (i = game.klhere+1; i <= game.nenhere; i++) {
+       w = dropin(IHR);
+       game.ks[i] = w;
+       game.kdist[i] = game.kavgd[i] = distance(game.sector, w);
+       game.kpower[i] = Rand()*400.0 + 450.0 + 50.0*game.skill;
+    }
+    // If quadrant needs a starbase, put it in
+    if (q->starbase)
+       game.base = dropin(IHB);
+       
+    // If quadrant needs a planet, put it in
+    if (q->planet != NOPLANET) {
+       game.iplnet = q->planet;
+       if (game.state.planets[q->planet].inhabited == UNINHABITED)
+           game.plnet = dropin(IHP);
+       else
+           game.plnet = dropin(IHW);
+    }
+    // Check for condition
+    newcnd();
+    // And finally the stars
+    for (i = 1; i <= q->stars; i++) 
+       dropin(IHSTAR);
+
+    // Check for RNZ
+    if (game.irhere > 0 && game.klhere == 0) {
+       game.neutz = true;
+       if (!damaged(DRADIO)) {
+           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 (same(thing, game.quadrant)) {
+           w = dropin(IHQUEST);
+           thing = randplace(GALSIZE);
+           game.nenhere++;
+           iqhere = true;
+           game.ks[game.nenhere] = w;
+           game.kdist[game.nenhere] = game.kavgd[game.nenhere] =
+               distance(game.sector, w);
+           game.kpower[game.nenhere] = Rand()*6000.0 +500.0 +250.0*game.skill;
+           if (!damaged(DSRSENS)) {
+               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 ((game.skill < SKILL_GOOD && Rand() <= 0.02) ||   /* Lighten up if skill is low */
+           (game.skill == SKILL_GOOD && Rand() <= 0.05) ||
+           (game.skill > SKILL_GOOD && Rand() <= 0.08)
+           ) {
+           do {
+               game.tholian.x = Rand() > 0.5 ? QUADSIZE : 1;
+               game.tholian.y = Rand() > 0.5 ? QUADSIZE : 1;
+           } while (game.quad[game.tholian.x][game.tholian.y] != IHDOT);
+           game.quad[game.tholian.x][game.tholian.y] = IHT;
+           game.ithere = true;
+           game.nenhere++;
+           game.ks[game.nenhere] = game.tholian;
+           game.kdist[game.nenhere] = game.kavgd[game.nenhere] =
+               distance(game.sector, game.tholian);
+           game.kpower[game.nenhere] = Rand()*400.0 +100.0 +25.0*game.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';
+       }
+    }
+
+    sortklings();
+
+    // Put in a few black holes
+    for (i = 1; i <= 3; i++)
+       if (Rand() > 0.5) 
+           dropin(IHBLANK);
+
+    // Take out X's in corners if Tholian present
+    if (game.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 sortklings(void) 
+/* sort Klingons by distance from us */
+{
+    double t;
+    int j, k;
+    bool sw;
+
+    // The author liked bubble sort. So we will use it. :-(
+
+    if (game.nenhere-iqhere-game.ithere < 2)
+       return;
+
+    do {
+       sw = false;
+       for (j = 1; j < game.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.ks[j].x;
+               game.ks[j].x = game.ks[j+1].x;
+               game.ks[j+1].x = k;
+               k = game.ks[j].y;
+               game.ks[j].y = game.ks[j+1].y;
+               game.ks[j+1].y = k;
+               t = game.kpower[j];
+               game.kpower[j] = game.kpower[j+1];
+               game.kpower[j+1] = t;
+           }
+    } while (sw);
+}
+
+void setpassword(void)
+/* set the self-destruct password */
+{
+    if (game.options & OPTION_PLAIN) {
+       while (TRUE) {
+           chew();
+           proutn(_("Please type in a secret password- "));
+           scan();
+           strcpy(game.passwd, citem);
+           if (*game.passwd != 0)
+               break;
+       }
+    } else {
+       int i;
+        for(i=0;i<3;i++)
+           game.passwd[i]=(char)(97+(int)(Rand()*25));
+        game.passwd[3]=0;
+    }
+}
diff --git a/historic/c-version/src/sst.c b/historic/c-version/src/sst.c
new file mode 100644 (file)
index 0000000..c9bf9f4
--- /dev/null
@@ -0,0 +1,983 @@
+#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.
+
+   5. Half the quadrants now have inhabited planets, from which one 
+      cannot mine dilithium (there will still be the same additional number
+      of dilithium-bearing planets).  Torpedoing an inhabited world is *bad*.
+      There is BSD-Trek-like logic for Klingons to attack and enslave 
+      inhabited worlds, producing more ships (only is skill is 'good' or 
+      better). (Controlled by OPTION_WORLDS and turned off if game 
+      type is "plain" or "almy".)
+
+   6. User input is now logged so we can do regression testing.
+
+   7. More BSD-Trek features: You can now lose if your entire crew
+      dies in battle.  When abandoning ship in a game with inhabited
+      worlds enabled, they must have one in the quadrant to beam down
+      to; otherwise they die in space and this counts heavily against
+      your score.  Docking at a starbase replenishes your crew.
+
+   8. Still more BSD-Trek: we now have a weighted damage table.
+      Also, the nav subsystem (enabling automatic course
+      setting) can be damaged separately from the main computer (which
+      handles weapons targeting, ETA calculation, and self-destruct).
+*/
+
+/* the input queue */
+static char line[128], *linep = line;
+
+struct game game;
+coord thing;
+bool iqhere, iqengry;
+int iscore, iskill;    // Common PLAQ
+double aaitem;
+double perdate;
+char citem[12];
+int seed;              // the random-number seed
+bool idebug;           // debug mode
+FILE *logfp, *replayfp;
+
+char *systnames[NINHAB];
+char *device[NDEVICES];
+
+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   7
+       {"MOVE",        MOVE,           0},
+#define SHIELDS        8
+       {"SHIELDS",     SHIELDS,        0},
+#define DOCK   9
+       {"DOCK",        DOCK,           0},
+#define DAMAGES        10
+       {"DAMAGES",     DAMAGES,        0},
+#define CHART  11
+       {"CHART",       CHART,          0},
+#define IMPULSE        12
+       {"IMPULSE",     IMPULSE,        0},
+#define REST   13
+       {"REST",        REST,           0},
+#define WARP   14
+       {"WARP",        WARP,           0},
+#define SCORE  15
+       {"SCORE",       SCORE,          0},
+#define SENSORS        16
+       {"SENSORS",     SENSORS,        OPTION_PLANETS},
+#define ORBIT  17
+       {"ORBIT",       ORBIT,          OPTION_PLANETS},
+#define TRANSPORT      18
+       {"TRANSPORT",   TRANSPORT,      OPTION_PLANETS},
+#define MINE   19
+       {"MINE",        MINE,           OPTION_PLANETS},
+#define CRYSTALS       20
+       {"CRYSTALS",    CRYSTALS,       OPTION_PLANETS},
+#define SHUTTLE        21
+       {"SHUTTLE",     SHUTTLE,        OPTION_PLANETS},
+#define PLANETS        22
+       {"PLANETS",     PLANETS,        OPTION_PLANETS},
+#define REPORT 23
+       {"REPORT",      REPORT,         0},
+#define COMPUTER       24
+       {"COMPUTER",    COMPUTER,       0},
+#define COMMANDS       25
+       {"COMMANDS",    COMMANDS,       0},
+#define EMEXIT 26
+       {"EMEXIT",      EMEXIT,         0},
+#define PROBE  27
+       {"PROBE",       PROBE,          OPTION_PROBE},
+#define SAVE   28
+       {"SAVE",        SAVE,           0},
+       {"FREEZE",      SAVE,           0},
+#define ABANDON        30
+       {"ABANDON",     ABANDON,        0},
+#define DESTRUCT       31
+       {"DESTRUCT",    DESTRUCT,       0},
+#define DEATHRAY       32
+       {"DEATHRAY",    DEATHRAY,       0},
+#define DEBUGCMD       33
+       {"DEBUG",       DEBUGCMD,       0},
+#define MAYDAY 34
+       {"MAYDAY",      MAYDAY,         0},
+       //{"SOS",               MAYDAY,         0},
+       //{"CALL",      MAYDAY,         0},
+#define QUIT   35
+       {"QUIT",        QUIT,           0},
+#define HELP   36
+       {"HELP",        HELP,           0},
+#define SEED   37
+       {"SEED",        SEED,           0},
+#ifdef BSD_BUG_FOR_BUG
+#define VISUAL 38
+       {"VISUAL",      VISUAL,         0},
+#endif
+};
+
+#define NUMCOMMANDS    ARRAY_SIZE(commands)
+#define ACCEPT(i)      (!commands[i].option || (commands[i].option & game.options))
+
+static void listCommands(void) 
+/* generate a list of legal commands */
+{
+    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)
+/* browse on-line help */
+{
+    int i, j;
+    char cmdbuf[32], *cp;
+    char linebuf[132];
+    FILE *fp;
+    /* Give help on commands */
+    int key;
+    key = scan();
+    for(;;) {
+       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);
+       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"));
+        proutn(_("   computer. You need to find "));
+        proutn(DOC_NAME);
+        prout(_(" and put it in the"));
+        proutn(_("   current directory or to "));
+        proutn(SSTDOC);
+        prout(".\"");
+       /*
+        * 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)) {
+       char *eol;
+       if (strstr(linebuf, "******"))
+           break;
+       if ((eol = strpbrk(linebuf, "\r\n")))
+           *eol = 0;
+       prout(linebuf);
+    }
+    fclose(fp);
+}
+
+static void makemoves(void)
+/* command-interpretation loop */
+{
+    int key, i, v = 0;
+    bool hitme;
+    clrscr();
+    setwnd(message_window);
+    for(;;) { /* command loop */
+       drawmaps(1);
+       for(;;)  { /* get a command */
+           hitme = false;
+           game.justin = false;
+           game.optime = 0.0;
+           i = -1;
+           chew();
+           setwnd(prompt_window);
+           clrscr();
+           proutn("COMMAND> ");
+           if (scan() == IHEOL) {
+               if (game.options & OPTION_CURSES)
+                   makechart();
+               continue;
+           }
+           game.ididit = false;
+           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();
+           break;
+       case STATUS:                 // status
+           status(0);
+           break;
+       case REQUEST:                   // status request 
+           request();
+           break;
+       case LRSCAN:                    // lrscan
+           lrscan();
+           break;
+       case PHASERS:                   // phasers
+           phasers();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case TORPEDO:                   // photon torpedoes
+           torps();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case MOVE:                      // move
+           warp(false);
+           break;
+       case SHIELDS:                   // shields
+           doshield(false);
+           if (game.ididit) {
+               hitme = true;
+               game.shldchg = false;
+           }
+           break;
+       case DOCK:                      // dock
+           dock(true);
+           if (game.ididit)
+               attack(false);          
+           break;
+       case DAMAGES:                   // damages
+           damagereport();
+           break;
+       case CHART:                     // chart
+           makechart();
+           break;
+       case IMPULSE:                   // impulse
+           impulse();
+           break;
+       case REST:                      // rest
+           wait();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case WARP:                      // warp
+           setwarp();
+           break;
+       case SCORE:                     // score
+           score();
+           break;
+       case SENSORS:                   // sensors
+           sensor();
+           break;
+       case ORBIT:                     // orbit
+           orbit();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case TRANSPORT:                 // transport "beam"
+           beam();
+           break;
+       case MINE:                      // mine
+           mine();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case CRYSTALS:                  // crystals
+           usecrystals();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case SHUTTLE:                   // shuttle
+           shuttle();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case PLANETS:                   // Planet list
+           survey();
+           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 (game.ididit)
+               hitme = true;
+           break;
+       case ABANDON:                   // Abandon Ship
+           abandon();
+           break;
+       case DESTRUCT:                  // Self Destruct
+           selfdestruct();
+           break;
+       case SAVE:                      // Save Game
+           freeze(false);
+           clrscr();
+           if (game.skill > SKILL_GOOD)
+               prout(_("WARNING--Saved games produce no plaques!"));
+           break;
+       case DEATHRAY:                  // Try a desparation measure
+           deathray();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case DEBUGCMD:                  // What do we want for debug???
+           debugme();
+           break;
+       case MAYDAY:                    // Call for help
+           mayday();
+           if (game.ididit)
+               hitme = true;
+           break;
+       case QUIT:
+           game.alldone = true;                // quit the game
+           break;
+       case HELP:
+           helpme();                   // get help
+           break;
+       case SEED:                      // set random-number seed
+           key = scan();
+           if (key == IHREAL)
+               seed = (int)aaitem;
+           break;
+#ifdef BSD_BUG_FOR_BUG
+       case VISUAL:
+           visual();                   // perform visual scan
+           break;
+#endif
+       }
+       commandhook(commands[i].name, false);
+       for (;;) {
+           if (game.alldone)
+               break;          // Game has ended
+           if (game.optime != 0.0) {
+               events();
+               if (game.alldone)
+                   break;      // Events did us in
+           }
+           if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) { // Galaxy went Nova!
+               atover(false);
+               continue;
+           }
+           if (hitme && !game.justin) {
+               attack(true);
+               if (game.alldone)
+                   break;
+               if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) {    // went NOVA! 
+                   atover(false);
+                   hitme = true;
+                   continue;
+               }
+           }
+           break;
+       }
+       if (game.alldone)
+           break;
+    }
+    if (idebug)
+       prout("=== Ending");
+}
+
+
+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;
+
+    seed = (int)time(NULL);
+    while ((option = getopt(argc, argv, "r:tx")) != -1) {
+       switch (option) {
+       case 'r':
+           replayfp = fopen(optarg, "r");
+           if (replayfp == NULL) {
+               fprintf(stderr, "sst: can't open replay file %s\n", optarg);
+               exit(1);
+           }
+           if (fscanf(replayfp, "seed %d\n", &seed) != 1) {
+               fprintf(stderr, "sst: replay file %s is ill-formed\n", optarg);
+               exit(1);
+           }
+           /* FALL THROUGH */
+       case 't':
+           game.options |= OPTION_TTY;
+           game.options &=~ OPTION_CURSES;
+           break;
+       case 'x':
+           idebug = true;
+           break;
+       default:
+           fprintf(stderr, "usage: sst [-t] [-x] [startcommand...].\n");
+           exit(0);
+       }
+    }
+    /* where to save the input in case of bugs */
+    logfp = fopen("/usr/tmp/sst-input.log", "w");
+    if (logfp) {
+       setlinebuf(logfp);
+       fprintf(logfp, "seed %d\n", seed);
+    }
+    srand(seed);
+
+    iostart();
+
+    line[0] = '\0';
+    for (i = optind; i < argc;  i++) {
+       strcat(line, argv[i]);
+       strcat(line, " ");
+    }
+    for(;;) { /* Play a game */
+       setwnd(fullscreen_window);
+       clrscr();
+       prelim();
+       setup(line[0] == '\0');
+       if (game.alldone) {
+           score();
+           game.alldone = false;
+       }
+       else
+           makemoves();
+       skip(1);
+       stars();
+       skip(1);
+
+       if (game.tourn && game.alldone) {
+           proutn(_("Do you want your score recorded?"));
+           if (ja() == true) {
+               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(feature i) 
+/* print the name of an enemy */
+{
+    /* 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;
+    case IHW: s = _("Inhabited World"); break;
+    default: s = "Unknown??"; break;
+    }
+    proutn(s);
+}
+
+char *cramlc(enum loctype key, coord w)
+/* name a location */
+{
+    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", w.x, w.y);
+    return buf;
+}
+
+void crmena(bool stars, feature enemy, enum loctype key, coord w) 
+/* print an enemy and his location */
+{
+    if (stars)
+       proutn("***");
+    cramen(enemy);
+    proutn(_(" at "));
+    proutn(cramlc(key, w));
+}
+
+void crmshp(void)
+/* print our ship name */
+{
+    char *s;
+    switch (game.ship) {
+    case IHE: s = _("Enterprise"); break;
+    case IHF: s = _("Faerie Queene"); break;
+    default:  s = "Ship???"; break;
+    }
+    proutn(s);
+}
+
+void stars(void)
+/* print a line of stars */
+{
+    prouts("******************************************************");
+    skip(1);
+}
+
+double expran(double avrage) 
+{
+    return -avrage*log(1e-7 + Rand());
+}
+
+double Rand(void) 
+{
+    return rand()/(1.0 + (double)RAND_MAX);
+}
+
+coord randplace(int size)
+/* choose a random location */ 
+{
+    coord w;
+    w.x = Rand()*(size*1.0) + 1.0;
+    w.y = Rand()*(size*1.0) + 1.0;
+    return w;
+}
+
+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;
+    }
+    i = 0;
+    // try a number
+    if (sscanf(linep, "%lf%n", &aaitem, &i) > 0) {
+       // 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;
+}
+
+bool ja(void)
+/* yes-or-no confirmation */
+{
+    chew();
+    for(;;) {
+       scan();
+       chew();
+       if (*citem == 'y')
+           return true;
+       if (*citem == 'n')
+           return false;
+       proutn(_("Please answer with \"y\" or \"n\": "));
+    }
+}
+
+void huh(void)
+/* complain about unparseable input */
+{
+    chew();
+    skip(1);
+    prout(_("Beg your pardon, Captain?"));
+}
+
+bool isit(char *s) 
+/* compares s to citem and returns true if it matches to the length of s */
+{
+    return strncasecmp(s, citem, max(1, strlen(citem))) == 0;
+}
+
+void debugme(void)
+/* access to the internals for debugging */
+{
+    proutn("Reset levels? ");
+    if (ja() == true) {
+       if (game.energy < game.inenrg)
+           game.energy = game.inenrg;
+       game.shield = game.inshld;
+       game.torps = game.intorps;
+       game.lsupres = game.inlsr;
+    }
+    proutn("Reset damage? ");
+    if (ja() == true) {
+       int i;
+       for (i=0; i < NDEVICES; i++) 
+           if (game.damage[i] > 0.0) 
+               game.damage[i] = 0.0;
+    }
+    proutn("Toggle debug flag? ");
+    if (ja() == true) {
+       idebug = !idebug;
+       if (idebug)
+           prout("Debug output ON");       
+       else
+           prout("Debug output OFF");
+    }
+    proutn("Cause selective damage? ");
+    if (ja() == true) {
+       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() == true) {
+       event *ev;
+       coord w;
+       int i;
+       for (i = 1; i < NEVENTS; i++) {
+           int key;
+           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;
+           case FDSPROB: proutn("Probe Move      "); break;
+           case FDISTR:  proutn("Distress Call   "); break;
+           case FENSLV:  proutn("Enlavement      "); break;
+           case FREPRO:  proutn("Klingon Build   "); break;
+           }
+           if (is_scheduled(i)) {
+               proutn("%.2f", scheduled(i)-game.state.date);
+               if (i == FENSLV || i == FREPRO) {
+                   ev = findevent(i);
+                   proutn(" in %d-%d", ev->quadrant.x,ev->quadrant.y);
+               }
+           } else
+               proutn("never");
+           proutn("? ");
+           chew();
+           key = scan();
+           if (key == 'n') {
+               unschedule(i);
+               chew();
+           } else if (key == IHREAL) {
+               ev = schedule(i, aaitem);
+               if (i == FENSLV || i == FREPRO) {
+                   chew();
+                   proutn("In quadrant- ");
+                   key = scan();
+                   /* IHEOL says to leave coordinates as they are */
+                   if (key != IHEOL) {
+                       if (key != IHREAL) {
+                           prout("Event %d canceled, no x coordinate.", i);
+                           unschedule(i);
+                           continue;
+                       }
+                       w.x = (int)aaitem;
+                       key = scan();
+                       if (key != IHREAL) {
+                           prout("Event %d canceled, no y coordinate.", i);
+                           unschedule(i);
+                           continue;
+                       }
+                       w.y = (int)aaitem;
+                       ev->quadrant = w;
+                   }
+               }
+           }
+       }
+       chew();
+    }
+    proutn("Induce supernova here? ");
+    if (ja() == true) {
+       game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova = true;
+       atover(true);
+    }
+}
diff --git a/historic/c-version/src/sst.h b/historic/c-version/src/sst.h
new file mode 100644 (file)
index 0000000..dce01e0
--- /dev/null
@@ -0,0 +1,446 @@
+#ifndef __SST_H__
+
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <libintl.h>
+#include <curses.h>
+#include <stdbool.h>
+
+#ifdef DATA_DIR
+#define SSTDOC DATA_DIR"/"DOC_NAME
+#else
+#define SSTDOC DOC_NAME
+#endif
+
+#define _(str) gettext(str)
+
+#define min(x, y)      ((x)<(y)?(x):(y))
+#define max(x, y)      ((x)>(y)?(x):(y))
+
+#define PHASEFAC       2.0
+#define GALSIZE                8
+#define NINHAB         (GALSIZE * GALSIZE / 2)
+#define MAXUNINHAB     10
+#define PLNETMAX       (NINHAB + MAXUNINHAB)
+#define QUADSIZE       10
+#define BASEMAX                (GALSIZE * GALSIZE / 12)
+#define MAXKLGAME      127
+#define MAXKLQUAD      9
+
+/*
+ * 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)
+
+typedef struct {int x; int y;} coord;
+
+#define square(i)              ((i)*(i))
+#define same(c1, c2)           ((c1.x == c2.x) && (c1.y == c2.y))
+#define distance(c1, c2)       sqrt(square(c1.x - c2.x) + square(c1.y - c2.y))
+#define invalidate(w)          w.x = w.y = 0
+#define is_valid(w)            (w.x != 0 && w.y != 0)
+
+typedef struct {
+    coord w;
+    enum {destroyed= -1, M=0, N=1, O=2} pclass;
+    int inhabited;     /* if NZ, an index into a name array */
+#define UNINHABITED    -1
+    enum {mined=-1, present=0, absent=1} crystals; /* has crystals */
+    enum {unknown, known, shuttle_down} known;
+} planet;
+
+typedef enum {
+    IHR = 'R',
+    IHK = 'K',
+    IHC = 'C',
+    IHS = 'S',
+    IHSTAR = '*',
+    IHP = 'P',
+    IHW = '@',
+    IHB = 'B',
+    IHBLANK = ' ',
+    IHDOT = '.',
+    IHQUEST = '?',
+    IHE = 'E',
+    IHF = 'F',
+    IHT = 'T',
+    IHWEB = '#',
+    IHMATER0 = '-',
+    IHMATER1 = 'o',
+    IHMATER2 = '0',
+} feature;
+
+typedef struct {
+    bool snap;                 // snapshot taken
+    int crew,                  // crew complement
+#define FULLCREW       428     /* BSD Trek was 387, that's wrong */
+       remkl,                  // remaining klingons
+       remcom,                 // remaining commanders
+       nscrem,                 // remaining super commanders
+       rembase,                // remaining bases
+       starkl,                 // destroyed stars
+       basekl,                 // destroyed bases
+       nromrem,                // Romulans remaining
+       nplankl,                // destroyed uninhabited planets
+       nworldkl;               // destroyed inhabited planets
+    planet planets[PLNETMAX];  // Planet information
+    double date,               // stardate
+       remres,                 // remaining resources
+       remtime;                // remaining time
+    coord baseq[BASEMAX+1];    // Base quadrant coordinates
+    coord kcmdr[QUADSIZE+1];   // Commander quadrant coordinates
+    coord kscmdr;              // Supercommander quadrant coordinates
+    struct quadrant {
+       int stars;
+       int planet;
+#define NOPLANET       -1
+       bool starbase;
+       int klingons;
+       int romulans;
+       bool supernova;
+       bool charted;
+       enum {secure, distressed, enslaved} status;
+    } galaxy[GALSIZE+1][GALSIZE+1];    // The Galaxy (subscript 0 not used)
+    struct page {
+       int stars;
+       bool starbase;
+       int klingons;
+    } chart[GALSIZE+1][GALSIZE+1];     // the starchart (subscript 0 not used)
+} snapshot;                            // Data that is snapshot
+
+/* 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_WORLDS  0x00000800      /* logic for inhabited worlds */
+#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 DNAVSYS        11
+#define DTRANSP 12
+#define DSHCTRL 13
+#define DDRAY   14
+#define DDSP    15
+#define NDEVICES (16)  // Number of devices
+
+#define damaged(dev)   (game.damage[dev] != 0.0)
+
+#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 FDISTR 9   // Emit distress call from an inhabited world 
+#define FENSLV 10  // Inhabited word is enslaved */
+#define FREPRO 11  // Klingons build a ship in an enslaved system
+#define NEVENTS (12)
+
+typedef struct {
+    double date;
+    coord quadrant;
+} event;
+
+/*
+ * abstract out the event handling -- underlying data structures will change
+ * when we implement stateful events
+ */
+extern event *unschedule(int);
+extern int is_scheduled(int);
+extern event *schedule(int, double);
+extern void postpone(int, double);
+extern double scheduled(int);
+#define findevent(evtype)      &game.future[evtype]
+
+#define SSTMAGIC       "SST2.0\n"
+
+#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
+
+struct game {
+    char magic[sizeof(SSTMAGIC)];
+    unsigned long options;
+    snapshot state;
+    snapshot snapsht;
+    feature 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
+    event future[NEVENTS];     // future events
+    char passwd[10];           // Self Destruct password
+    coord ks[(QUADSIZE+1)*(QUADSIZE+1)];       // enemy sector locations
+    coord quadrant, sector;    // where we are
+    coord tholian;             // coordinates of Tholian
+    coord base;                        // position of base in current quadrant
+    coord battle;              // base coordinates being attacked
+    coord plnet;               // location of planet in quadrant
+    coord probec;      // current probe quadrant
+    bool gamewon,      // Finished!
+       ididit,         // action taken -- allows enemy to attack
+       alive,          // we are alive (not killed)
+       justin,         // just entered quadrant
+       shldup,         // shields are up
+       shldchg,        // shield is changing (affects efficiency)
+       comhere,        // commander here
+       ishere,         // super-commander in quadrant
+       iscate,         // super commander is here
+       ientesc,        // attempted escape from supercommander
+       ithere,         // Tholian is here 
+       resting,        // rest time
+       icraft,         // Kirk in Galileo
+       landed,         // party on planet (true), on ship (false)
+       alldone,        // game is now finished
+       neutz,          // Romulan Neutral Zone
+       isarmed,        // probe is armed
+       inorbit,        // orbiting a planet
+       imine,          // mining
+       icrystl,        // dilithium crystals aboard
+       iseenit,        // seen base attack report
+       thawed;         // thawed game
+    enum {
+       green,
+       yellow,
+       red,
+       docked,
+       dead,
+    } condition;               // condition (red/yellow/green/docked)
+    enum {
+       onship,
+       offship,
+       removed,
+    } iscraft;         // 'onship' if craft on ship, 'removed' if out of game
+    enum {
+       SKILL_NONE,
+       SKILL_NOVICE,
+       SKILL_FAIR,
+       SKILL_GOOD,
+       SKILL_EXPERT,
+       SKILL_EMERITUS,
+    } skill;           // skill level
+    int inkling,       // initial number of klingons
+       inbase,         // initial number of bases
+       incom,          // initial number of commanders
+       inscom,         // initial number of commanders
+       inrom,          // initial number of commanders
+       instar,         // initial stars
+       intorps,        // initial/max torpedoes
+       torps,          // number of torpedoes
+       ship,           // ship type -- 'E' is Enterprise
+       abandoned,      // count of crew abandoned in space
+       length,         // length of game
+       klhere,         // klingons here
+       casual,         // causalties
+       nhelp,          // calls for help
+       nkinks,         // count of energy-barrier crossings
+       iplnet,         // planet # in quadrant
+       inplan,         // initial planets
+       nenhere,        // number of enemies in quadrant
+       irhere,         // Romulans in quadrant
+       isatb,          // =2 if super commander is attacking base
+       tourn,          // tournament number
+       proben,         // number of moves for probe
+       nprobes;        // number of probes available
+    double inresor,    // initial resources
+       intime,         // initial time
+       inenrg,         // initial/max energy
+       inshld,         // initial/max shield
+       inlsr,          // initial life support resources
+       indate,         // initial date
+       energy,         // energy level
+       shield,         // shield level
+       warpfac,        // warp speed
+       wfacsq,         // squared warp factor
+       lsupres,        // life support reserves
+       dist,           // movement distance
+       direc,          // movement direction
+       optime,         // time taken by current operation
+       docfac,         // repair factor when docking (constant?)
+       damfac,         // damage factor
+       lastchart,      // time star chart was last updated
+       cryprob,        // probability that crystal will work
+       probex,         // location of probe
+       probey,         //
+       probeinx,       // probe x,y increment
+       probeiny,       //
+       height;         // height of orbit around planet
+};
+extern struct game game;
+
+/* the following global state doesn't need to be saved */
+extern char *device[NDEVICES];
+extern char *systnames[NINHAB];
+extern int iscore, iskill; // Common PLAQ
+extern double perdate;
+extern double aaitem;
+extern char citem[12];
+extern int seed;
+extern bool idebug;
+extern FILE *logfp, *replayfp;
+
+/* the Space Thingy's global state should *not* be saved! */
+extern coord thing;
+extern bool 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, FCREW
+} FINTYPE ;
+
+enum loctype {neither, quadrant, sector};
+
+/* Function prototypes */
+extern void prelim(void);
+extern void attack(bool);
+extern bool choose(bool);
+extern void setup(bool);
+extern void score(void);
+extern void atover(bool);
+extern void srscan(void);
+extern void lrscan(void);
+extern void phasers(void);
+extern void torps(void);
+extern void warp(bool);
+extern void doshield(bool);
+extern void dock(bool);
+extern void damagereport(void);
+extern void chart(void);
+extern void rechart(void);
+extern void impulse(void);
+extern void wait(void);
+extern void setwarp(void);
+extern void events(void);
+extern void report(void);
+extern void eta(void);
+extern void mayday(void);
+extern void abandon(void);
+extern void finish(FINTYPE);
+extern void selfdestruct(void);
+extern void kaboom(void);
+extern void freeze(bool);
+extern bool thaw(void);
+extern void plaque(void);
+extern int scan(void);
+extern void status(int req);
+extern void request(void);
+#define IHEOL (0)
+#define IHALPHA (1)
+#define IHREAL (2)
+extern void chew(void);
+extern void chew2(void);
+extern void skip(int);
+extern void prout(const char *, ...) __attribute__((format(printf, 1, 2)));
+extern void proutn(const char *, ...) __attribute__((format(printf, 1, 2)));
+extern void prouts(const char *, ...) __attribute__((format(printf, 1, 2)));
+extern void prstat(const char *txt, const char *fmt, ...)
+       __attribute__((format(printf, 2, 3)));
+extern void stars(void);
+extern void newqad(bool);
+extern bool ja(void);
+extern void cramen(feature);
+extern void crmshp(void);
+extern char *cramlc(enum loctype, coord w);
+extern double expran(double);
+extern double Rand(void);
+extern coord randplace(int);
+extern coord dropin(feature);
+extern void newcnd(void);
+extern void sortklings(void);
+extern void imove(bool);
+extern void ram(bool, feature, coord);
+extern void crmena(bool, feature, enum loctype, coord w);
+extern void deadkl(coord, feature, coord);
+extern void timwrp(void);
+extern void moveklings(void);
+extern void torpedo(double, double, coord, double *, int, int);
+extern void huh(void);
+extern void announce(void);
+extern void nova(coord);
+extern void supernova(bool, coord *);
+extern void supercommander(void);
+extern void hittem(double *);
+extern bool isit(char *);
+extern void survey(void);
+extern void orbit(void);
+extern void sensor(void);
+extern void drawmaps(int);
+extern void beam(void);
+extern void mine(void);
+extern void usecrystals(void);
+extern void shuttle(void);
+extern void deathray(void);
+extern void debugme(void);
+extern void attackreport(bool);
+extern void movetholian(void);
+extern void probe(void);
+extern void iostart(void);
+extern void setwnd(WINDOW *);
+extern void warble(void);
+extern void boom(coord);
+extern void tracktorpedo(coord, int, int, int, int);
+extern void cgetline(char *, int);
+extern void waitfor(void);
+extern void setpassword(void);
+extern void commandhook(char *, bool);
+extern void makechart(void);
+extern coord newkling(int);
+#ifdef BSD_BUG_FOR_BUG
+extern void visual(void);
+#endif
+
+extern WINDOW *curwnd;
+extern WINDOW *fullscreen_window;
+extern WINDOW *srscan_window;
+extern WINDOW *report_window;
+extern WINDOW *lrscan_window;
+extern WINDOW *message_window;
+extern WINDOW *prompt_window;
+
+extern void clreol(void);
+extern void clrscr(void);
+extern void textcolor(int);
+extern void highvideo(void);
+
+enum COLORS {
+   DEFAULT,
+   BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY,
+   DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
+};
+
+#endif
diff --git a/historic/c-version/src/sstlinux.c b/historic/c-version/src/sstlinux.c
new file mode 100644 (file)
index 0000000..422c305
--- /dev/null
@@ -0,0 +1,30 @@
+#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/historic/c-version/src/sstlinux.h b/historic/c-version/src/sstlinux.h
new file mode 100644 (file)
index 0000000..c241f12
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef __SSTLINUX_H
+#define __SSTLINUX_H
+
+void sound(unsigned int);
+void nosound(void);
+
+#define delay(x) usleep(x*1000)
+
+#endif
diff --git a/historic/c-version/sst.spec b/historic/c-version/sst.spec
new file mode 100644 (file)
index 0000000..445f133
--- /dev/null
@@ -0,0 +1,49 @@
+Name: sst
+Version: 2.0
+Release: 1
+URL: http://sst.berlios.de
+Source0: %{name}-%{version}.tar.gz
+License: GPL
+Group: Games
+Summary: the classic game of Super Star Trek
+BuildRoot: %{_tmppath}/%{name}-root
+#Freshmeat-Name: strek
+
+%description
+Save the Federation from the invading Klingons!  Visit exotic planets and
+strip-mine them for dilithium!  Encounter mysterious space thingies!
+The classic Super Star Trek game from the days of slow teletypes, reloaded.
+
+%prep
+%setup -q
+
+%build
+make %{?_smp_mflags} all sst-doc.html
+
+%install
+[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
+mkdir -p "$RPM_BUILD_ROOT"%{_bindir}
+mkdir -p "$RPM_BUILD_ROOT"%{_mandir}/man6/
+cp sst "$RPM_BUILD_ROOT"%{_bindir}
+cp sst.6 "$RPM_BUILD_ROOT"%{_mandir}/man6/
+mkdir -p "$RPM_BUILD_ROOT"%{_defaultdocdir}/sst/
+cp sst.doc "$RPM_BUILD_ROOT"%{_defaultdocdir}/sst/
+cp sst-doc.html "$RPM_BUILD_ROOT"%{_defaultdocdir}/sst/index.html
+
+%clean
+[ "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
+
+%files
+%doc README COPYING
+%defattr(-,root,root,-)
+%{_mandir}/man6/sst.6*
+%{_bindir}/sst
+%{_defaultdocdir}/sst/sst.doc
+%{_defaultdocdir}/sst/index.html
+
+%changelog
+
+* Thu Apr 14 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.0-1
+- First release under new management.
+
+
diff --git a/historic/mayfield.basic b/historic/mayfield.basic
new file mode 100644 (file)
index 0000000..052da0b
--- /dev/null
@@ -0,0 +1,643 @@
+REM  Extracted from HP tape image 16-Nov-2003 by Pete Turnbull
+
+1  REM ****  HP BASIC PROGRAM LIBRARY  ******************************
+2  REM
+3  REM       STTR1: STAR TREK
+4  REM
+5  REM       36243  REV B  --  10/73
+6  REM
+7  REM ****  CONTRIBUTED PROGRAM  ***********************************
+100  REM *****************************************************************
+110  REM ***                                                           ***
+120  REM ***     STAR TREK: BY MIKE MAYFIELD, CENTERLINE ENGINEERING   ***
+130  REM ***                                                           ***
+140  REM ***        TOTAL INTERACTION GAME - ORIG. 20 OCT 1972
+150  REM ***                                                           ***
+160  REM *****************************************************************
+170  GOSUB 5460
+180  PRINT "                          STAR TREK "
+190  PRINT "DO YOU WANT INSTRUCTIONS (THEY'RE LONG!)";
+200  INPUT A$
+210  IF A$ <> "YES" THEN 230
+220  GOSUB 5820
+230  REM *****  PROGRAM STARTS HERE *****
+240  Z$="                                                                      "
+250  GOSUB 5460
+260  DIM G[8,8],C[9,2],K[3,3],N[3],Z[8,8]
+270  DIM C$[6],D$[72],E$[24],A$[3],Q$[72],R$[72],S$[48]
+280  DIM Z$[72]
+290  T0=T=INT(RND(1)*20+20)*100
+300  T9=30
+310  D0=0
+320  E0=E=3000
+330  P0=P=10
+340  S9=200
+350  S=H8=0
+360  DEF FND(D)=SQR((K[I,1]-S1)^2+(K[I,2]-S2)^2)
+370  Q1=INT(RND(1)*8+1)
+380  Q2=INT(RND(1)*8+1)
+390  S1=INT(RND(1)*8+1)
+400  S2=INT(RND(1)*8+1)
+410  T7=TIM(0)+60*TIM(1)
+420  C[2,1]=C[3,1]=C[4,1]=C[4,2]=C[5,2]=C[6,2]=-1
+430  C[1,1]=C[3,2]=C[5,1]=C[7,2]=C[9,1]=0
+440  C[1,2]=C[2,2]=C[6,1]=C[7,1]=C[8,1]=C[8,2]=C[9,2]=1
+450  MAT D=ZER
+460  D$="WARP ENGINESS.R. SENSORSL.R. SENSORSPHASER CNTRL"
+470  D$[49]="PHOTON TUBESDAMAGE CNTRL"
+480  E$="SHIELD CNTRLCOMPUTER"
+490  B9=K9=0
+500  FOR I=1 TO 8
+510  FOR J=1 TO 8
+520  R1=RND(1)
+530  IF R1>.98 THEN 580
+540  IF R1>.95 THEN 610
+550  IF R1>.8 THEN 640
+560  K3=0
+570  GOTO 660
+580  K3=3
+590  K9=K9+3
+600  GOTO 660
+610  K3=2
+620  K9=K9+2
+630  GOTO 660
+640  K3=1
+650  K9=K9+1
+660  R1=RND(1)
+670  IF R1>.96 THEN 700
+680  B3=0
+690  GOTO 720
+700  B3=1
+710  B9=B9+1
+720  S3=INT(RND(1)*8+1)
+730  G[I,J]=K3*100+B3*10+S3
+740  Z[I,J]=0
+750  NEXT J
+760  NEXT I
+770  K7=K9
+775  IF B9 <= 0 OR K9 <= 0 THEN 490
+780  PRINT "YOU MUST DESTROY"K9;" KLINGONS IN"T9;" STARDATES WITH"B9;" STARBASES"
+810  K3=B3=S3=0
+820  IF Q1<1 OR Q1>8 OR Q2<1 OR Q2>8 THEN 920
+830  X=G[Q1,Q2]*.01
+840  K3=INT(X)
+850  B3=INT((X-K3)*10)
+860  S3=G[Q1,Q2]-INT(G[Q1,Q2]*.1)*10
+870  IF K3=0 THEN 910
+880  IF S>200 THEN 910
+890  PRINT "COMBAT AREA      CONDITION RED"
+900  PRINT "   SHIELDS DANGEROUSLY LOW"
+910  MAT K=ZER
+920  FOR I=1 TO 3
+930  K[I,3]=0
+940  NEXT I
+950  Q$=Z$
+960  R$=Z$
+970  S$=Z$[1,48]
+980  A$="<*>"
+990  Z1=S1
+1000  Z2=S2
+1010  GOSUB 5510
+1020  FOR I=1 TO K3
+1030  GOSUB 5380
+1040  A$="+++"
+1050  Z1=R1
+1060  Z2=R2
+1070  GOSUB 5510
+1080  K[I,1]=R1
+1090  K[I,2]=R2
+1100  K[I,3]=S9
+1110  NEXT I
+1120  FOR I=1 TO B3
+1130  GOSUB 5380
+1140  A$=">!<"
+1150  Z1=R1
+1160  Z2=R2
+1170  GOSUB 5510
+1180  NEXT I
+1190  FOR I=1 TO S3
+1200  GOSUB 5380
+1210  A$=" * "
+1220  Z1=R1
+1230  Z2=R2
+1240  GOSUB 5510
+1250  NEXT I
+1260  GOSUB 4120
+1270  PRINT "COMMAND:";
+1280  INPUT A
+1290  GOTO A+1 OF 1410,1260,2330,2530,2800,3460,3560,4630
+1300  PRINT
+1310  PRINT "   0 = SET COURSE"
+1320  PRINT "   1 = SHORT RANGE SENSOR SCAN"
+1330  PRINT "   2 = LONG RANGE SENSOR SCAN"
+1340  PRINT "   3 = FIRE PHASERS"
+1350  PRINT "   4 = FIRE PHOTON TORPEDOES"
+1360  PRINT "   5 = SHIELD CONTROL"
+1370  PRINT "   6 = DAMAGE CONTROL REPORT"
+1380  PRINT "   7 = CALL ON LIBRARY COMPUTER"
+1390  PRINT
+1400  GOTO 1270
+1410  PRINT "COURSE (1-9):";
+1420  INPUT C1
+1430  IF C1=0 THEN 1270
+1440  IF C1<1 OR C1 >= 9 THEN 1410
+1450  PRINT "WARP FACTOR (0-8):";
+1460  INPUT W1
+1470  IF W1<0 OR W1>8 THEN 1410
+1480  IF D[1] >= 0 OR W1 <= .2 THEN 1510
+1490  PRINT "WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .2"
+1500  GOTO 1410
+1510  IF K3 <= 0 THEN 1560
+1520  GOSUB 3790
+1530  IF K3 <= 0 THEN 1560
+1540  IF S<0 THEN 4000
+1550  GOTO 1610
+1560  IF E>0 THEN 1610
+1570  IF S<1 THEN 3920
+1580  PRINT "YOU HAVE"E" UNITS OF ENERGY"
+1590  PRINT "SUGGEST YOU GET SOME FROM YOUR SHIELDS WHICH HAVE"S" UNITS LEFT"
+1600  GOTO 1270
+1610  FOR I=1 TO 8
+1620  IF D[I] >= 0 THEN 1640
+1630  D[I]=D[I]+1
+1640  NEXT I
+1650  IF RND(1)>.2 THEN 1810
+1660  R1=INT(RND(1)*8+1)
+1670  IF RND(1) >= .5 THEN 1750
+1680  D[R1]=D[R1]-(RND(1)*5+1)
+1690  PRINT
+1700  PRINT "DAMAGE CONTROL REPORT:";
+1710  GOSUB 5610
+1720  PRINT " DAMAGED"
+1730  PRINT
+1740  GOTO 1810
+1750  D[R1]=D[R1]+(RND(1)*5+1)
+1760  PRINT
+1770  PRINT "DAMAGE CONTROL REPORT:";
+1780  GOSUB 5610
+1790  PRINT " STATE OF REPAIR IMPROVED"
+1800  PRINT
+1810  N=INT(W1*8)
+1820  A$="   "
+1830  Z1=S1
+1840  Z2=S2
+1850  GOSUB 5510
+1870  X=S1
+1880  Y=S2
+1885  C2=INT(C1)
+1890  X1=C[C2,1]+(C[C2+1,1]-C[C2,1])*(C1-C2)
+1900  X2=C[C2,2]+(C[C2+1,2]-C[C2,2])*(C1-C2)
+1910  FOR I=1 TO N
+1920  S1=S1+X1
+1930  S2=S2+X2
+1940  IF S1<.5 OR S1 >= 8.5 OR S2<.5 OR S2 >= 8.5 THEN 2170
+1950  A$="   "
+1960  Z1=S1
+1970  Z2=S2
+1980  GOSUB 5680
+1990  IF Z3 <> 0 THEN 2070
+2030  PRINT  USING 5370;S1,S2
+2040  S1=S1-X1
+2050  S2=S2-X2
+2060  GOTO 2080
+2070  NEXT I
+2080  A$="<*>"
+2083  S1=INT(S1+.5)
+2086  S2=INT(S2+.5)
+2090  Z1=S1
+2100  Z2=S2
+2110  GOSUB 5510
+2120  E=E-N+5
+2130  IF W1<1 THEN 2150
+2140  T=T+1
+2150  IF T>T0+T9 THEN 3970
+2160  GOTO 1260
+2170  X=Q1*8+X+X1*N
+2180  Y=Q2*8+Y+X2*N
+2190  Q1=INT(X/8)
+2200  Q2=INT(Y/8)
+2210  S1=INT(X-Q1*8+.5)
+2220  S2=INT(Y-Q2*8+.5)
+2230  IF S1 <> 0 THEN 2260
+2240  Q1=Q1-1
+2250  S1=8
+2260  IF S2 <> 0 THEN 2290
+2270  Q2=Q2-1
+2280  S2=8
+2290  T=T+1
+2300  E=E-N+5
+2310  IF T>T0+T9 THEN 3970
+2320  GOTO 810
+2330  IF D[3] >= 0 THEN 2370
+2340  PRINT "LONG RANGE SENSORS ARE INOPERABLE"
+2350  IMAGE  "LONG RANGE SENSOR SCAN FOR QUADRANT",D,",",D
+2360  GOTO 1270
+2370  PRINT  USING 2350;Q1,Q2
+2380  PRINT  USING 2520
+2390  FOR I=Q1-1 TO Q1+1
+2400  MAT N=ZER
+2410  FOR J=Q2-1 TO Q2+1
+2420  IF I<1 OR I>8 OR J<1 OR J>8 THEN 2460
+2430  N[J-Q2+2]=G[I,J]
+2440  IF D[7]<0 THEN 2460
+2450  Z[I,J]=G[I,J]
+2460  NEXT J
+2470  PRINT  USING 2510;N[1],N[2],N[3]
+2480  PRINT  USING 2520
+2490  NEXT I
+2500  GOTO 1270
+2510  IMAGE  ": ",3(3D," :")
+2520  IMAGE  "-----------------"
+2530  IF K3 <= 0 THEN 3670
+2540  IF D[4] >= 0 THEN 2570
+2550  PRINT "PHASER CONTROL IS DISABLED"
+2560  GOTO 1270
+2570  IF D[7] >= 0 THEN 2590
+2580  PRINT " COMPUTER FAILURE HAMPERS ACCURACY"
+2590  PRINT "PHASERS LOCKED ON TARGET.  ENERGY AVAILABLE="E
+2600  PRINT "NUMBER OF UNITS TO FIRE:";
+2610  INPUT X
+2620  IF X <= 0 THEN 1270
+2630  IF E-X<0 THEN 2570
+2640  E=E-X
+2650  GOSUB 3790
+2660  IF D[7] >= 0 THEN 2680
+2670  X=X*RND(1)
+2680  FOR I=1 TO 3
+2690  IF K[I,3] <= 0 THEN 2770
+2700  H=(X/K3/FND(0))*(2*RND(1))
+2710  K[I,3]=K[I,3]-H
+2720  PRINT  USING 2730;H,K[I,1],K[I,2],K[I,3]
+2730  IMAGE  4D," UNIT HIT ON KLINGON AT SECTOR ",D,",",D,"   (",3D," LEFT)"
+2740  IF K[I,3]>0 THEN 2770
+2750  GOSUB 3690
+2760  IF K9 <= 0 THEN 4040
+2770  NEXT I
+2780  IF E<0 THEN 4000
+2790  GOTO 1270
+2800  IF D[5] >= 0 THEN 2830
+2810  PRINT "PHOTON TUBES ARE NOT OPERATIONAL"
+2820  GOTO 1270
+2830  IF P>0 THEN 2860
+2840  PRINT "ALL PHOTON TORPEDOES EXPENDED"
+2850  GOTO 1270
+2860  PRINT "TORPEDO COURSE (1-9):";
+2870  INPUT C1
+2880  IF C1=0 THEN 1270
+2890  IF C1<1 OR C1 >= 9 THEN 2860
+2895  C2=INT(C1)
+2900  X1=C[C2,1]+(C[C2+1,1]-C[C2,1])*(C1-C2)
+2910  X2=C[C2,2]+(C[C2+1,2]-C[C2,2])*(C1-C2)
+2920  X=S1
+2930  Y=S2
+2940  P=P-1
+2950  PRINT "TORPEDO TRACK:"
+2960  X=X+X1
+2970  Y=Y+X2
+2980  IF X<.5 OR X >= 8.5 OR Y<.5 OR Y >= 8.5 THEN 3420
+2990  PRINT  USING 3000;X,Y
+3000  IMAGE  15X,D,",",D
+3010  A$="   "
+3020  Z1=X
+3030  Z2=Y
+3040  GOSUB 5680
+3050  IF Z3=0 THEN 3070
+3060  GOTO 2960
+3070  A$="+++"
+3080  Z1=X
+3090  Z2=Y
+3100  GOSUB 5680
+3110  IF Z3=0 THEN 3220
+3120  PRINT "*** KLINGON DESTROYED ***"
+3130  K3=K3-1
+3140  K9=K9-1
+3150  IF K9 <= 0 THEN 4040
+3160  FOR I=1 TO 3
+3170  IF INT(X+.5) <> K[I,1] THEN 3190
+3180  IF INT(Y+.5)=K[I,2] THEN 3200
+3190  NEXT I
+3200  K[I,3]=0
+3210  GOTO 3360
+3220  A$=" * "
+3230  Z1=X
+3240  Z2=Y
+3250  GOSUB 5680
+3260  IF Z3=0 THEN 3290
+3270  PRINT "YOU CAN'T DESTROY STARS SILLY"
+3280  GOTO 3420
+3290  A$=">!<"
+3300  Z1=X
+3310  Z2=Y
+3320  GOSUB 5680
+3330  IF Z3=0 THEN 2960
+3340  PRINT "*** STAR BASE DESTROYED ***  .......CONGRATULATIONS"
+3350  B3=B3-1
+3360  A$="   "
+3370  Z1=INT(X+.5)
+3380  Z2=INT(Y+.5)
+3390  GOSUB 5510
+3400  G[Q1,Q2]=K3*100+B3*10+S3
+3410  GOTO 3430
+3420  PRINT "TORPEDO MISSED"
+3430  GOSUB 3790
+3440  IF E<0 THEN 4000
+3450  GOTO 1270
+3460  IF D[7] >= 0 THEN 3490
+3470  PRINT "SHIELD CONTROL IS NON-OPERATIONAL"
+3480  GOTO 1270
+3490  PRINT "ENERGY AVAILABLE ="E+S"   NUMBER OF UNITS TO SHIELDS:";
+3500  INPUT X
+3510  IF X <= 0 THEN 1270
+3520  IF E+S-X<0 THEN 3490
+3530  E=E+S-X
+3540  S=X
+3550  GOTO 1270
+3560  IF D[6] >= 0 THEN 3590
+3570  PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE"
+3580  GOTO 1270
+3590  PRINT
+3600  PRINT "DEVICE        STATE OF REPAIR"
+3610  FOR R1=1 TO 8
+3620  GOSUB 5610
+3630  PRINT "",D[R1]
+3640  NEXT R1
+3650  PRINT
+3660  GOTO 1270
+3670  PRINT "SHORT RANGE SENSORS REPORT NO KLINGONS IN THIS QUADRANT"
+3680  GOTO 1270
+3690  PRINT  USING 3700;K[I,1],K[I,2]
+3700  IMAGE  "KLINGON AT SECTOR ",D,",",D," DESTROYED ****"
+3710  K3=K3-1
+3720  K9=K9-1
+3730  A$="   "
+3740  Z1=K[I,1]
+3750  Z2=K[I,2]
+3760  GOSUB 5510
+3770  G[Q1,Q2]=K3*100+B3*10+S3
+3780  RETURN
+3790  IF C$ <> "DOCKED" THEN 3820
+3800  PRINT "STAR BASE SHIELDS PROTECT THE ENTERPRISE"
+3810  RETURN
+3820  IF K3 <= 0 THEN 3910
+3830  FOR I=1 TO 3
+3840  IF K[I,3] <= 0 THEN 3900
+3850  H=(K[I,3]/FND(0))*(2*RND(1))
+3860  S=S-H
+3870  PRINT  USING 3880;H,K[I,1],K[I,2],S
+3880  IMAGE  4D," UNIT HIT ON ENTERPRISE AT SECTOR ",D,",",D,"   (",4D," LEFT)"
+3890  IF S<0 THEN 4000
+3900  NEXT I
+3910  RETURN
+3920  PRINT "THE ENTERPRISE IS DEAD IN SPACE.  IF YOU SURVIVE ALL IMPENDING"
+3930  PRINT "ATTACK YOU WILL BE DEMOTED TO THE RANK OF PRIVATE"
+3940  IF K3 <= 0 THEN 4020
+3950  GOSUB 3790
+3960  GOTO 3940
+3970  PRINT
+3980  PRINT "IT IS STARDATE"T
+3990  GOTO 4020
+4000  PRINT
+4010  PRINT "THE ENTERPRISE HAS BEEN DESTROYED.  THE FEDERATION WILL BE CONQUERED"
+4020  PRINT "THERE ARE STILL"K9" KLINGON BATTLE CRUISERS"
+4030  GOTO 230
+4040  PRINT
+4050  PRINT "THE LAST KLINGON BATTLE CRUISER IN THE GALAXY HAS BEEN DESTROYED"
+4060  PRINT "THE FEDERATION HAS BEEN SAVED !!!"
+4070  PRINT
+4080  PRINT "YOUR EFFICIENCY RATING ="((K7/(T-T0))*1000)
+4090  T1=TIM(0)+TIM(1)*60
+4100  PRINT "YOUR ACTUAL TIME OF MISSION ="INT((((T1-T7)*.4)-T7)*100)" MINUTES"
+4110  GOTO 230
+4120  FOR I=S1-1 TO S1+1
+4130  FOR J=S2-1 TO S2+1
+4140  IF I<1 OR I>8 OR J<1 OR J>8 THEN 4200
+4150  A$=">!<"
+4160  Z1=I
+4170  Z2=J
+4180  GOSUB 5680
+4190  IF Z3=1 THEN 4240
+4200  NEXT J
+4210  NEXT I
+4220  D0=0
+4230  GOTO 4310
+4240  D0=1
+4250  C$="DOCKED"
+4260  E=3000
+4270  P=10
+4280  PRINT "SHIELDS DROPPED FOR DOCKING PURPOSES"
+4290  S=0
+4300  GOTO 4380
+4310  IF K3>0 THEN 4350
+4320  IF E<E0*.1 THEN 4370
+4330  C$="GREEN"
+4340  GOTO 4380
+4350  C$="RED"
+4360  GOTO 4380
+4370  C$="YELLOW"
+4380  IF D[2] >= 0 THEN 4430
+4390  PRINT
+4400  PRINT "*** SHORT RANGE SENSORS ARE OUT ***"
+4410  PRINT
+4420  GOTO 4530
+4430  PRINT  USING 4540
+4440  PRINT  USING 4550;Q$[1,3],Q$[4,6],Q$[7,9],Q$[10,12],Q$[13,15],Q$[16,18],Q$[19,21],Q$[22,24]
+4450  PRINT  USING 4560;Q$[25,27],Q$[28,30],Q$[31,33],Q$[34,36],Q$[37,39],Q$[40,42],Q$[43,45],Q$[46,48],T
+4460  PRINT  USING 4570;Q$[49,51],Q$[52,54],Q$[55,57],Q$[58,60],Q$[61,63],Q$[64,66],Q$[67,69],Q$[70,72],C$
+4470  PRINT  USING 4580;R$[1,3],R$[4,6],R$[7,9],R$[10,12],R$[13,15],R$[16,18],R$[19,21],R$[22,24],Q1,Q2
+4480  PRINT  USING 4590;R$[25,27],R$[28,30],R$[31,33],R$[34,36],R$[37,39],R$[40,42],R$[43,45],R$[46,48],S1,S2
+4490  PRINT  USING 4600;R$[49,51],R$[52,54],R$[55,57],R$[58,60],R$[61,63],R$[64,66],R$[67,69],R$[70,72],E
+4500  PRINT  USING 4610;S$[1,3],S$[4,6],S$[7,9],S$[10,12],S$[13,15],S$[16,18],S$[19,21],S$[22,24],P
+4510  PRINT  USING 4620;S$[25,27],S$[28,30],S$[31,33],S$[34,36],S$[37,39],S$[40,42],S$[43,45],S$[46,48],S
+4520  PRINT  USING 4540
+4530  RETURN 
+4540  IMAGE  "---------------------------------"
+4550  IMAGE  8(X,3A)
+4560  IMAGE  8(X,3A),8X,"STARDATE",8X,5D
+4570  IMAGE  8(X,3A),8X,"CONDITION",8X,6A
+4580  IMAGE  8(X,3A),8X,"QUADRANT",9X,D,",",D
+4590  IMAGE  8(X,3A),8X,"SECTOR",11X,D,",",D
+4600  IMAGE  8(X,3A),8X,"ENERGY",9X,6D
+4610  IMAGE  8(X,3A),8X,"PHOTON TORPEDOES",3D
+4620  IMAGE  8(X,3A),8X,"SHIELDS",8X,6D
+4630  IF D[8] >= 0 THEN 4660
+4640  PRINT "COMPUTER DISABLED"
+4650  GOTO 1270
+4660  PRINT "COMPUTER ACTIVE AND AWAITING COMMAND";
+4670  INPUT A
+4680  GOTO A+1 OF 4740,4830,4880
+4690  PRINT "FUNCTIONS AVAILABLE FROM COMPUTER"
+4700  PRINT "   0 = CUMULATIVE GALACTIC RECORD"
+4710  PRINT "   1 = STATUS REPORT"
+4720  PRINT "   2 = PHOTON TORPEDO DATA"
+4730  GOTO 4660
+4740  PRINT  USING 4750;Q1,Q2
+4750  IMAGE  "COMPUTER RECORD OF GALAXY FOR QUADRANT ",D,",",D
+4760  PRINT  USING 5330
+4770  PRINT  USING 5360
+4780  FOR I=1 TO 8
+4790  PRINT  USING 5350;I,Z[I,1],Z[I,2],Z[I,3],Z[I,4],Z[I,5],Z[I,6],Z[I,7],Z[I,8]
+4800  PRINT  USING 5360
+4810  NEXT I
+4820  GOTO 1270
+4830  PRINT "\012   STATUS REPORT\012"
+4840  PRINT "NUMBER OF KLINGONS LEFT ="K9
+4850  PRINT "NUMBER OF STARDATES LEFT ="(T0+T9)-T
+4860  PRINT "NUMBER OF STARBASES LEFT ="B9
+4870  GOTO 3560
+4880  PRINT 
+4890  H8=0
+4900  FOR I=1 TO 3
+4910  IF K[I,3] <= 0 THEN 5260
+4920  C1=S1
+4930  A=S2
+4940  W1=K[I,1]
+4950  X=K[I,2]
+4960  GOTO 5010
+4970  PRINT  USING 4980;Q1,Q2,S1,S2
+4980  IMAGE  "YOU ARE AT QUADRANT ( ",D,",",D," )  SECTOR ( ",D,",",D," )"
+4990  PRINT "SHIP'S & TARGET'S COORDINATES ARE";
+5000  INPUT C1,A,W1,X
+5010  X=X-A
+5020  A=C1-W1
+5030  IF X<0 THEN 5130
+5040  IF A<0 THEN 5190
+5050  IF X>0 THEN 5070
+5060  IF A=0 THEN 5150
+5070  C1=1
+5080  IF ABS(A) <= ABS(X) THEN 5110
+5090  PRINT "DIRECTION ="C1+(((ABS(A)-ABS(X))+ABS(A))/ABS(A))
+5100  GOTO 5240
+5110  PRINT "DIRECTION ="C1+(ABS(A)/ABS(X))
+5120  GOTO 5240
+5130  IF A>0 THEN 5170
+5140  IF X=0 THEN 5190
+5150  C1=5
+5160  GOTO 5080
+5170  C1=3
+5180  GOTO 5200
+5190  C1=7
+5200  IF ABS(A) >= ABS(X) THEN 5230
+5210  PRINT "DIRECTION ="C1+(((ABS(X)-ABS(A))+ABS(X))/ABS(X))
+5220  GOTO 5240
+5230  PRINT "DIRECTION ="C1+(ABS(X)/ABS(A))
+5240  PRINT "DISTANCE ="(SQR(X^2+A^2))
+5250  IF H8=1 THEN 5320
+5260  NEXT I
+5270  H8=0
+5280  PRINT "DO YOU WANT TO USE THE CALCULATOR";
+5290  INPUT A$
+5300  IF A$="YES" THEN 4970
+5310  IF A$ <> "NO" THEN 5280
+5320  GOTO 1270
+5330  IMAGE  "     1     2     3     4     5     6     7     8"
+5340  IMAGE  "---------------------------------------------------"
+5350  IMAGE  D,8(3X,3D)
+5360  IMAGE  "   ----- ----- ----- ----- ----- ----- ----- -----"
+5370  IMAGE  " WARP ENGINES SHUTDOWN AT SECTOR ",D,",",D," DUE TO BAD NAVIGATION"
+5380  R1=INT(RND(1)*8+1)
+5390  R2=INT(RND(1)*8+1)
+5400  A$="   "
+5410  Z1=R1
+5420  Z2=R2
+5430  GOSUB 5680
+5440  IF Z3=0 THEN 5380
+5450  RETURN
+5460  FOR I=1 TO 11
+5470  PRINT
+5480  NEXT I
+5490  PRINT
+5500  RETURN
+5510  REM ******  INSERTION IN STRING ARRAY FOR QUADRANT ******
+5520  S8=Z1*24+Z2*3-26
+5530  IF S8>72 THEN 5560
+5540  Q$[S8,S8+2]=A$
+5550  GOTO 5600
+5560  IF S8>144 THEN 5590
+5570  R$[S8-72,S8-70]=A$
+5580  GOTO 5600
+5590  S$[S8-144,S8-142]=A$
+5600  RETURN
+5610  REM ****  PRINTS DEVICE NAME FROM ARRAY *****
+5620  S8=R1*12-11
+5630  IF S8>72 THEN 5660
+5640  PRINT D$[S8,S8+11];
+5650  GOTO 5670
+5660  PRINT E$[S8-72,S8-61];
+5670  RETURN
+5680  REM *******  STRING COMPARISON IN QUADRANT ARRAY **********
+5683  Z1=INT(Z1+.5)
+5686  Z2=INT(Z2+.5)
+5690  S8=Z1*24+Z2*3-26
+5700  Z3=0
+5710  IF S8>72 THEN 5750
+5720  IF Q$[S8,S8+2] <> A$ THEN 5810
+5730  Z3=1
+5740  GOTO 5810
+5750  IF S8>144 THEN 5790
+5760  IF R$[S8-72,S8-70] <> A$ THEN 5810
+5770  Z3=1
+5780  GOTO 5810
+5790  IF S$[S8-144,S8-142] <> A$ THEN 5810
+5800  Z3=1
+5810  RETURN
+5820  PRINT "     INSTRUCTIONS:"
+5830  PRINT "<*> = ENTERPRISE"
+5840  PRINT "+++ = KLINGON"
+5850  PRINT ">!< = STARBASE"
+5860  PRINT " *  = STAR"
+5870  PRINT "COMMAND 0 = WARP ENGINE CONTROL"
+5880  PRINT "  'COURSE' IS IN A CIRCULAR NUMERICAL          4  3  2"
+5890  PRINT "  VECTOR ARRANGEMENT AS SHOWN.                  \ ^ /"
+5900  PRINT "  INTERGER AND REAL VALUES MAY BE                \^/"
+5910  PRINT "  USED.  THEREFORE COURSE 1.5 IS              5 ----- 1"
+5920  PRINT "  HALF WAY BETWEEN 1 AND 2.                      /^\"
+5930  PRINT "                                                / ^ \"
+5940  PRINT "  A VECTOR OF 9 IS UNDEFINED, BUT              6  7  8"
+5950  PRINT "  VALUES MAY APPROACH 9."
+5960  PRINT "                                               COURSE"
+5970  PRINT "  ONE 'WARP FACTOR' IS THE SIZE OF"
+5980  PRINT "  ONE QUADRANT.  THEREFORE TO GET"
+5990  PRINT "  FROM QUADRANT 6,5 TO 5,5 YOU WOULD"
+6000  PRINT "  USE COURSE 3, WARP FACTOR 1"
+6010  PRINT "COMMAND 1 = SHORT RANGE SENSOR SCAN"
+6020  PRINT "  PRINTS THE QUADRANT YOU ARE CURRENTLY IN, INCLUDING"
+6030  PRINT "  STARS, KLINGONS, STARBASES, AND THE ENTERPRISE; ALONG"
+6040  PRINT "  WITH OTHER PERTINATE INFORMATION."
+6050  PRINT "COMMAND 2 = LONG RANGE SENSOR SCAN"
+6060  PRINT "  SHOWS CONDITIONS IN SPACE FOR ONE QUADRANT ON EACH SIDE"
+6070  PRINT "  OF THE ENTERPRISE IN THE MIDDLE OF THE SCAN.  THE SCAN"
+6080  PRINT "  IS CODED IN THE FORM XXX, WHERE THE UNITS DIGIT IS THE"
+6090  PRINT "  NUMBER OF STARS, THE TENS DIGIT IS THE NUMBER OF STAR-"
+6100  PRINT "  BASES, THE HUNDREDS DIGIT IS THE NUMBER OF KLINGONS."
+6110  PRINT "COMMAND 3 = PHASER CONTROL"
+6120  PRINT "  ALLOWS YOU TO DESTROY THE KLINGONS BY HITTING HIM WITH"
+6130  PRINT "  SUITABLY LARGE NUMBERS OF ENERGY UNITS TO DEPLETE HIS "
+6140  PRINT "  SHIELD POWER.  KEEP IN MIND THAT WHEN YOU SHOOT AT"
+6150  PRINT "  HIM, HE GONNA DO IT TO YOU TOO."
+6160  PRINT "COMMAND 4 = PHOTON TORPEDO CONTROL"
+6170  PRINT "  COURSE IS THE SAME AS USED IN WARP ENGINE CONTROL"
+6180  PRINT "  IF YOU HIT THE KLINGON, HE IS DESTROYED AND CANNOT FIRE"
+6190  PRINT "  BACK AT YOU.  IF YOU MISS, HE WILL SHOOT HIS PHASERS AT"
+6200  PRINT "  YOU."
+6210  PRINT "   NOTE: THE LIBRARY COMPUTER (COMMAND 7) HAS AN OPTION"
+6220  PRINT "   TO COMPUTE TORPEDO TRAJECTORY FOR YOU (OPTION 2)."
+6230  PRINT "COMMAND 5 = SHIELD CONTROL"
+6240  PRINT "  DEFINES NUMBER OF ENERGY UNITS TO BE ASSIGNED TO SHIELDS"
+6250  PRINT "  ENERGY IS TAKEN FROM TOTAL SHIP'S ENERGY."
+6260  PRINT "COMMAND 6 = DAMAGE CONTROL REPORT"
+6270  PRINT "  GIVES STATE OF REPAIRS OF ALL DEVICES.  A STATE OF REPAIR"
+6280  PRINT "  LESS THAN ZERO SHOWS THAT THAT DEVICE IS TEMPORARALY"
+6290  PRINT "  DAMAGED."
+6300  PRINT "COMMAND 7 = LIBRARY COMPUTER"
+6310  PRINT "  THE LIBRARY COMPUTER CONTAINS THREE OPTIONS:"
+6320  PRINT "    OPTION 0 = CUMULATIVE GALACTIC RECORD"
+6330  PRINT "     SHOWS COMPUTER MEMORY OF THE RESULTS OF ALL PREVIOUS"
+6340  PRINT "     LONG RANGE SENSOR SCANS"
+6350  PRINT "    OPTION 1 = STATUS REPORT"
+6360  PRINT "     SHOWS NUMBER OF KLINGONS, STARDATES AND STARBASES"
+6370  PRINT "     LEFT."
+6380  PRINT "    OPTION 2 = PHOTON TORPEDO DATA"
+6390  PRINT "     GIVES TRAJECTORY AND DISTANCE BETWEEN THE ENTERPRISE"
+6400  PRINT "     AND ALL KLINGONS IN YOUR QUADRANT"
+6410  RETURN
+6420  END
diff --git a/www/historic/UT-Trek.basic b/www/historic/UT-Trek.basic
deleted file mode 100644 (file)
index 452bf0a..0000000
+++ /dev/null
@@ -1,1192 +0,0 @@
-1  PRINT "U. OF TEXAS STAR TREK GAME BY GRADY HICKS AND JIM KORP."
-2  PRINT "GENERAL IDEA STOLEN FROM PENN. U. BY HICKS."
-3  PRINT "VASTLY IMPROVED, AND ADAPTED TO TAURUS BY KORP, 5 APRIL 73."
-4  GOSUB 9980
-5  PRINT "   BE CAREFUL AND HAVE A GOOD TIME."
-6  PRINT
-7  PRINT
-8  X8=RND(0)
-9  DIM Q$(10)
-10  DIM G(8,8),Q(8,8),D(8),K(9,3),N(3)
-11  DIM C$(20)
-12  GOSUB 8050
-13  PRINT "   TO PLAY SHORT VERSION, TYPE 1 ---"
-14  PRINT "   TO PLAY REGULAR VERSION, TYPE 2:";
-15  INPUT V
-16  IF V = 1 THEN 20
-17  IF V = 2 THEN 20
-18  PRINT
-19  GOTO 13
-20  T0=INT(RND(0)*20+20)*100
-21  T=T0
-22  T9=40
-23  E0=3000
-24  E=3000
-25  P0=10
-26  P=10
-27  S9=200
-29  GOSUB 8200
-30  DEF FNO(F)=SQR((K(F,1)-S1)^2+(K(F,2)-S2)^2)
-32  Q1=INT(RND(0)*8+1)
-34  Q2=INT(RND(0)*8+1)
-35  F=1
-40  FOR I=1 TO 7
-42  D(I)=0
-44  NEXT I
-62  S1=INT(RND(0)*8+1)
-64  S2=INT(RND(0)*8+1)
-65  DIM F$(12)
-66  DIM N$(15)
-72  REM: SET UP GALAXY
-75  B9=0
-76  LET E4=W3=A9=C5=0
-77  Z$="DOWN"
-80  K9=0
-85  FOR I=1 TO 8
-90  FOR J=1 TO 8
-91  R=RND(0)*64
-95  IF V=2 THEN 150
-100  T9=20
-
-110  IF R>=.28 THEN 114
-111  K3=4
-112  GOTO 135
-114  IF R>=1.78 THEN 118
-115  K3=3
-116  GOTO 135
-118  IF R>=5.28  THEN 122
-119  K3=2
-120  GOTO 135
-122  IF R>=9.28 THEN 130
-123  K3=1
-124  GOTO 135
-130  K3=0
-135  K9=K9+K3
-145  GOTO 206
-150  REM: DETERMINE NUMBER OF KLINGONS, BASES AND STARS.
-152  IF R>=.01 THEN 156
-153  K3=9
-154  GOTO 195
-156  IF R>=.10 THEN 160
-157  K3=8
-158  GOTO 195
-160  IF R>=.30 THEN 164
-161  K3=7
-162  GOTO 195
-164  IF R>=.80 THEN 168
-165  K3=6
-166  GOTO 195
-168  IF R>=1.25 THEN 172
-169  K3=5
-170  GOTO 195
-172  IF R>=2.00 THEN 176
-173  K3=4
-174  GOTO 195
-176  IF R>=5.28 THEN 180
-177  K3=3
-178  GOTO 195
-180  IF R>=8.28 THEN 183
-181  K3=2
-182  GOTO 195
-183  IF R>=13.28 THEN 190
-184  K3=1
-185  GOTO 195
-190  K3=0
-195  K9=K9+K3
-200  B3=RND(0)
-202  IF B3<=.97 THEN 206
-204  B3=1
-205  GOTO 221
-206  B3=0
-221  B9=B9+B3
-230  S3=INT(RND(0)*8+1)
-235  G(I,J)=K3*100+B3*10+S3
-250  NEXT J
-260  NEXT I
-265  K0=K9
-270  IF B9>0 THEN 285
-271  I=INT(RND(0)*8+1)
-272  J=INT(RND(0)*8+1)
-275  G(I,J)=G(I,J)+10
-276  B9=1
-285  LET P2=1
-294  PRINT
-295  PRINT "   PLEASE TYPE A SECRET PASSWORD:";
-296  INPUT X$
-297  PRINT
-298  LET N1=N9=N7=A7=0
-300  REM: DETERMINE KLINGON COMMANDER
-302  IF A9<>0 THEN 320
-304  R1=INT(RND(0)*8+1)
-306  R2=INT(RND(0)*8+1)
-308  C2=R1
-310  C3=R2
-312  G(C2,C3)=G(C2,C3)+100
-314  K9=K9+1
-315  K0=K9
-316  A9=A9+1
-320  REM: CONTINUE
-399  GOTO 9045
-400  REM: SET UP QUADRANT
-405  K3=B3=S3=0
-410  IF Q1<1 THEN 500
-420  IF Q1>8 THEN 500
-430  IF Q2<1 THEN 500
-440  IF Q2>8 THEN 500
-450  X=G(Q1,Q2)/99.999
-460  K3=INT(X)
-470  B3=INT((X-K3)*10.0)
-480  S3=G(Q1,Q2)-INT(G(Q1,Q2)*.1)*10
-490  'MAT K=ZER
-491  FOR I=1 TO 8
-492  FOR J=1 TO 8
-493  Q(I,J)=0
-494  NEXT J
-495  NEXT I
-500  FOR I=1 TO 8
-510  FOR J=1 TO 8
-520  Q(I,J)=0
-530  NEXT J
-540  NEXT I
-545  IF N1<>1 THEN 550
-548  Q(S1,S2)=5
-549  GOTO 560
-550  Q(S1,S2)=1
-560  FOR I=1 TO K3
-570  GOSUB 9000
-580  Q(R1,R2)=2
-590  K(I,1)=R1
-591  K(I,2)=R2
-593  K(I,3)=S9
-600  NEXT I
-601  IF Q1<>C2 THEN 610
-602  IF Q2<>C3 THEN 610
-603  K(I,3)=800
-605  Q(K(I,1),K(I,2))=6
-610  FOR I=1 TO B3
-620  GOSUB 9000
-630  Q(R1,R2)=3
-640  NEXT I
-650  FOR I=1 TO S3
-660  GOSUB 9000
-670  Q(R1,R2)=4
-680  NEXT I
-690  A=-1
-691  IF P2=1 THEN 700
-693  GOSUB 5000
-694  IF E<=0 THEN 5200
-699  GOTO 955
-700  REM: SHORT RANGE SENSOR SCAN
-702  P2=P2+1
-705  LET T8=S1-1
-706  LET U=S1+1
-707  LET M=S2-1
-708  LET N=S2+1
-709  IF T8>=1 THEN 711
-710  T8=1
-711  IF U<=8 THEN 713
-712  U=8
-713  IF M>=1 THEN 715
-714  M=1
-715  IF N<=8 THEN 720
-716  N=8
-720  FOR I=T8 TO U
-725  FOR J=M TO N
-735  IF Q(I,J)<>3 THEN 740
-736  C$="DOCKED"
-737  GOSUB 7700
-739  GOTO 801
-740  NEXT J
-745  NEXT I
-770  IF K3>0 THEN 790
-775  IF E<E0*.1 THEN 800
-780  C$="GREEN"
-785  GOTO 801
-790  C$="RED"
-795  GOTO 801
-800  C$="YELLOW"
-801  IF A<0 THEN 803
-802  GOTO 804
-803  GOSUB 5000
-804  IF E<=0 THEN 5200
-805  IF D(2) >= 0 THEN 830
-815  PRINT "SHORT RANGE SENSORS ARE OUT "
-820  PRINT
-825  GOTO 955
-830  PRINT "----------------------"
-835  FOR I=1 TO 8
-836  FOR J=1 TO 8
-838  PRINT Q$(Q(I,J)+1);" ";
-840  NEXT J
-841  PRINT "   ";
-845  GOSUB 854
-847  NEXT I
-848  PRINT "--------------------------"
-849  GOTO 955
-854  IF I>1 THEN 859
-855  PRINT "STARDATE         "T
-856  GOTO 900
-859  IF I>2 THEN 864
-860  PRINT "CONDITION        "C$
-861  GOTO 900
-864  IF I>3 THEN 869
-865  PRINT "QUADRANT         "Q1;"-"Q2
-866  GOTO 900
-869  IF I>4 THEN 874
-870  PRINT "SECTOR           "S1;"-"S2
-871  GOTO 900
-874  IF I>5 THEN 879
-875  PRINT "ENERGY           "E
-876  GOTO 900
-879  IF I>6 THEN 884
-880  PRINT "PHOTON TORPEDOES "P
-881  GOTO 900
-884  IF I>7 THEN 890
-885  PRINT "KLINGONS LEFT    "K9
-886  GOTO 900
-890  PRINT "ENERGY SHIELDS   "Z$
-900  RETURN
-955  IF N9<>1 THEN 959
-956  GOSUB  7950
-957  IF N7=1 THEN 3582
-958  N9=2
-959  PRINT "COMMAND:";
-960  INPUT A
-961  IF C$<>"DOCKED" THEN 964
-962  GOSUB 7700
-964  GOTO 7100
-974  PRINT
-975  PRINT "   0 = SET COURSE"
-980  PRINT "   1 = SHORT RANGE SENSOR SCAN"
-985  PRINT "   2 = LONG RANGE SENSOR SCAN"
-990  PRINT "   3 = FIRE PHASERS"
-995  PRINT "   4 = FIRE PHOTON TORPEDOES"
-1000  PRINT "   5 = DAMAGE CONTROL REPORT"
-1005  PRINT "   6 = SELF-DESTRUCT"
-1006  PRINT "   7 = ABANDON SHIP"
-1007  PRINT "   8 = ACTIVATE ENERGY SHIELDS"
-1008  PRINT "   9 = DEACTIVATE ENERGY SHIELDS"
-1009  PRINT "   10 = FIRE EXPERIMENTAL DEATH RAY"
-1018  IF H6=1 THEN 9946
-1019  PRINT
-1020  GOTO 955
-1030  REM: WARP DRIVE
-1035  C$="MOVING"
-1040  PRINT "COURSE (1-8.9999):";
-1050  INPUT C1
-1060  IF C1=0 THEN 955
-1070  IF C1<1 THEN 959
-1080  IF C1>= 9 THEN 1040
-1090  PRINT "WARP FACTOR (0-12):";
-1100  INPUT W1
-1110  IF W1<0 THEN 959
-1120  IF W1>12 THEN 959
-1130  IF W1<=.25 THEN 1163
-1140  IF D(1) >= 0 THEN 1163
-1150  PRINT "WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .25"
-1160  GOTO 1040
-1163  GOTO 7500
-1164  E=E-C5
-1165  IF E<=0 THEN 5200
-1168  IF W1=12 THEN 3500
-1170  REM: THIS IS A CONTINUE CARD
-1180  GOSUB 5000
-1185  IF N9=1 THEN 955
-1190  IF E <=0 THEN 5230
-1200  FOR I=1 TO 7
-1215  IF D(I)=0 THEN 1230
-1220  D(I)=D(I)+2
-1222  IF D(I)<0 THEN 1230
-1225  D(I)=0
-1230  NEXT I
-1240  IF RND(0)>.20 THEN 1320
-1250  R1=INT(RND(0)*7+1)
-1260  IF RND(0)>.5 THEN 1300
-1270  D(R1)=D(R1)-(RND(0)*5+1)
-1280  PRINT "*** SPACE STORM, ";
-1281  GOSUB 6000
-1283  PRINT F$" DAMAGED ***"
-1290  GOTO 1320
-1300  FOR I=R1 TO 7
-1301  IF D(I)<0 THEN 1307
-1302  NEXT I
-1303  FOR I=1 TO R1-1
-1304  IF D(I)<0 THEN 1307
-1305  NEXT I
-1306  GOTO 1320
-1307  R1=I
-1308  D(I)=D(I)+RND(0)*5+1
-1309  IF D(I)<=0 THEN 1311
-1310  D(I)=0
-1311  PRINT "*** TEMPORARY TRUCE, ";
-1312  GOSUB 6000
-1313  PRINT F$" STATE OF REPAIR IMPROVED ***"
-1320  N=INT(W1*8)
-1322  E=E-N-N+5
-1324  T=T+1
-1326  Q(S1,S2)=0
-1327  X=S1
-1328  Y=S2
-1330  IF T>T0+T9 THEN 5200
-1340  GOSUB 3460
-1350  FOR I=1 TO N
-1352  S1=S1+X1
-1354  S2=S2+X2
-1356  X3=INT(S1+.5)
-1357  Y3=INT(S2+.5)
-1370  IF S1<.5 THEN 1480
-1375  IF S2<.5 THEN 1480
-1380  IF S1>=8.5 THEN 1480
-1385  IF S2>=8.5 THEN 1480
-1388  IF Q(X3,Y3)<>0 THEN 1392
-1390  NEXT I
-1391  GOTO 1460
-1392  LET Z5=Q(X3,Y3)
-1393  IF Z5=6 THEN 6300
-1394  IF Z5<>2 THEN 1405
-1400  GOTO 6300
-1405  PRINT
-1406  GOSUB 7900
-1407  PRINT N$;"BLOCKED BY OBJECT AT SECTOR"S1;"-"S2
-1408  S1=S1-X1
-1410  S2=S2-X2
-1460  S1=INT(S1+.5)
-1465  S2=INT(S2+.5)
-1467  Q(S1,S2)=A5
-1470  GOTO 955
-1480  Q1=INT(Q1+W1*X1+(X-.5)/8)
-1481  Q2=INT(Q2+W1*X2+(Y-.5)/8)
-1482  IF Q1>=1 THEN 1485
-1483  Q1=1
-1484  Z2=1
-1485  IF Q1<=8 THEN 1488
-1486  Q1=8
-1487  Z2=1
-1488  IF Q2>=1 THEN 1491
-1489  Q2=1
-1490  Z2=1
-1491  IF Q2<=8 THEN 1494
-1492  Q2=8
-1493  Z2=1
-1494  IF Z2<>1 THEN 1497
-1496  GOSUB 8970
-1497  PRINT
-1498  IF G(Q1,Q2)>999 THEN 7650
-1499  Z2=0
-1500  S1=INT(RND(0)*8+1)
-1510  S2=INT(RND(0)*8+1)
-1550  GOTO 400
-1600  REM: LONG RANGE SENSOR SCAN
-1610  IF D(3) >= 0 THEN 1640
-1620  PRINT "LONG RANGE SENSORS ARE INOPERABLE"
-1625  PRINT
-1630  GOTO 955
-1640  PRINT "LONG RANGE SENSOR SCAN FOR QUADRANT"Q1","Q2
-1645  PRINT "----------------- '"
-1660  FOR I=Q1-1 TO Q1+1
-1670  N(1)=N(2)=N(3)=0
-1680  FOR J=Q2-1 TO Q2+1
-1690  IF I<1 THEN 1740
-1700  IF I>8 THEN 1740
-1710  IF J<1 THEN 1740
-1720  IF J>8 THEN 1740
-1730  N(J-Q2+2)=G(I,J)
-1740  NEXT J
-1750  PRINT ":"N(1);":"N(2);":"N(3)
-1760  PRINT "------------------- '"
-1770  NEXT I
-1775  PRINT
-1780  GOTO 955
-1800  REM: PHASER CONTROL
-1810  IF D(4) >= 0 THEN 1832
-1820  PRINT "PHASER CONTROL IS DISABLED"
-1825  PRINT
-1830  GOTO 955
-1832  IF C5=0 THEN 1840
-1834  PRINT "YOU MUST LOWER YOUR ENERGY SHIELDS TO FIRE."
-1836  PRINT
-1837  GOTO 959
-1840  PRINT "PHASERS LOCKED ON TARGET.  ENERGY AVAILABLE = "E
-1850  PRINT "NUMBER OF UNITS TO FIRE:";
-1860  INPUT X
-1870  IF X <= 0 THEN 955
-1880  IF E-X<0 THEN 1840
-1890  E=E-X
-1895  IF K3=0 THEN 2010
-1898  W2=K3
-1900  FOR I=1 TO 9
-1910  IF K(I,3) <= 0 THEN 1990
-1929  H=(X)/(FNO(I))*(3.0+RND(0))
-1930  K(I,3)=K(I,3)-(H/W2)
-1940  PRINT H/W2;"UNIT HIT ON KLINGON AT SECTOR"K(I,1);"-"K(I,2)
-1950  PRINT "("K(I,3);"LEFT)"
-1960  IF K(I,3)>0 THEN 1990
-1970  GOSUB 4500
-1980  IF K9 <= 0 THEN 5300
-1990  NEXT I
-1995  IF K3<=0 THEN 2020
-2000  GOSUB 5000
-2010  IF E <= 0 THEN 5250
-2020  GOTO 955
-3000  REM: PHOTON TORPEDOES
-3010  IF D(5) >= 0 THEN 3040
-3020  PRINT "PHOTON TUBES ARE NOT OPERATIONAL"
-3025  PRINT
-3030  GOTO 955
-3040  IF P>0 THEN 3062
-3050  PRINT "ALL PHOTON TORPEDOES EXPENDED"
-3060  GOTO 955
-3062  IF C5=0 THEN 3068
-3064  PRINT "YOU MUST LOWER YOUR ENERGY SHIELDS TO FIRE."
-3066  PRINT
-3067  GOTO 959
-3068  PRINT "DO YOU WISH TO FIRE A SPREAD:";
-3069  INPUT M$
-3070  PRINT "TORPEDO COURSE (1-8.9999):";
-3080  INPUT C1
-3090  IF C1=0 THEN 955
-3100  IF C1<1 THEN 3070
-3110  IF C1>=9 THEN 3070
-3111  IF P<3 THEN 3120
-3116  IF M$="YES" THEN 6500
-3120  GOSUB 3460
-3130  X=S1
-3132  Y=S2
-3134  P=P-1
-3140  PRINT "TORPEDO TRACK:";
-3150  X=X+X1
-3155  Y=Y+X2
-3160  IF X<.5 THEN 3422
-3165  IF Y<.5 THEN 3422
-3170  IF X>=8.5 THEN 3422
-3175  IF Y>=8.5 THEN 3422
-3200  PRINT X;"-"Y;
-3202  X5=INT(X+.5)
-3204  Y5=INT(Y+.5)
-3210  IF Q(X5,Y5)<>0 THEN 3230
-3220  GOTO 3150
-3230  LET F7=Q(X5,Y5)
-3236  IF F7=1 THEN 3150
-3237  IF F7=2 THEN 3244
-3238  IF F7=3 THEN 3301
-3239  IF F7=4 THEN 3323
-3240  IF F7=6 THEN 3244
-3244  PRINT
-3245  PRINT "*** KLINGON DESTROYED ***"
-3250  K3=K3-1
-3255  K9=K9-1
-3260  IF K9<=0 THEN 5300
-3271  FOR I=1 TO 9
-3272  IF K(I,1)<>X5 THEN 3275
-3273  IF K(I,2)<>Y5 THEN 3275
-3274  GOTO 3400
-3275  NEXT I
-3301  Q(X5,Y5)=0
-3310  PRINT
-3311  PRINT "*** STARBASE DESTROYED ... CONGRATULATIONS ***"
-3313  B3=B3-1
-3315  GOTO 3410
-3323  Q(X5,Y5)=0
-3334  PRINT
-3335  PRINT "***STAR DESTROYED***"
-3340  S3=S3-1
-3345  IF S3>=0 THEN 3410
-3347  S3=0
-3350  GOTO 3410
-3400  K(I,3)=0
-3401  Q(X5,Y5)=0
-3410  G(Q1,Q2)=K3*100+B3*10+S3
-3420  GOTO 3430
-3422  PRINT
-3425  PRINT "TORPEDO MISSED"
-3430  IF E4=0 THEN 3439
-3432  E4=E4+1
-3433  IF E4>3.5 THEN 3438
-3435  GOTO 6520
-3438  IF K3<=0 THEN 3445
-3439  GOSUB 5000
-3440  IF E <= 0 THEN 5230
-3445  E4=0
-3450  GOTO 955
-3460  X2=COS((C1-1)*.785398)
-3470  X1=-SIN((C1-1)*.785398)
-3480  RETURN
-3500  W9=RND(0)
-3502  IF T>T0+15 THEN 3510
-3504  PRINT "WARP 12 CANNOT BE USED UNTIL STARDATE"T0+16
-3506  GOTO 1040
-3510  PRINT "SPEED APPROACHING WARP 12."
-3520  PRINT "ENGINES OPERATING ABOVE DANGER LEVEL."
-3530  PRINT "ALL SAFETY DEVICES DISFUNCTIONAL."
-3540  PRINT "CRITICAL OVERHEATING--SPONTANEOUS IMPLOSION IMMINENT."
-3570  IF W9>.40 THEN 3600
-3575  FOR I=1 TO 2
-3576  PRINT "*****************************************************"
-3577  NEXT I
-3578  GOSUB 7900
-3580  PRINT "*** ENTROPY OF"N$;"MAXIMIZED **************"
-3582  GOSUB 9980
-3583  PRINT "  YOU ATE THAT ONE."
-3584  GOTO 9992
-3600  IF W9>.55 THEN 3700
-3610  PRINT
-3620  PRINT " YOU ARE TRAVELLING BACK IN TIME."
-3630  T=T-6
-3640  PRINT "*** STARDATE ="T+1
-3650  GOTO 1170
-3700  IF W9>.60 THEN 3800
-3710  PRINT
-3720  PRINT " YOU ARE TRAVELLING BACK IN TIME."
-3730  T=T-11
-3740  PRINT "*** STARDATE ="T+1
-3750  GOTO 1170
-3800  IF W9>.70 THEN 3900
-3810  PRINT
-3820  PRINT " YOU ARE TRAVELLING FORWARD IN TIME."
-3830  T=T+5
-3840  IF T>T0+T9 THEN 5200
-3850  PRINT "*** STARDATE ="T
-3860  GOTO 1170
-3900  PRINT
-3910  PRINT "NUCLEAR REACTOR CHAIN REACTION QUENCHED."
-3920  PRINT "*** TIME PORTAL MISSED ***"
-3930  GOTO 1170
-4000  REM: DAMAGE CONTROL REPORT
-4010  IF D(6) >= 0 THEN 4040
-4020  PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE"
-4025  PRINT
-4030  GOTO 955
-4040  PRINT
-4050  PRINT "DEVICE         STATE OF REPAIR"
-4060  FOR I=1 TO 7
-4065  R5=I-.5
-4066  GOSUB 6000
-4070  PRINT F$,D(I)
-4080  NEXT I
-4090  PRINT
-4100  GOTO 955
-4200  REM:
-4500  PRINT "*** KLINGON AT SECTOR"K(I,1);"-"K(I,2);"DESTROYED."
-4510  K3=K3-1
-4520  K9=K9-1
-4530  Q(K(I,1),K(I,2))=0
-4540  G(Q1,Q2)=K3*100+B3*10+S3
-4550  RETURN
-5000  REM: KLINGON ATTACK
-5002  GOSUB 7900
-5003  IF K3<=0 THEN 5110
-5005  IF C$ <> "DOCKED" THEN 5017
-5010  PRINT "STARBASE SHIELDS PROTECT THE"N$
-5012  RETURN
-5017  IF C5=0 THEN 5022
-5018  PRINT "** KLINGONS ATTACK-- ENERGY SHIELDS PROTECT"N$
-5020  GOTO 5110
-5022  IF K3*150<E THEN 5049
-5023  IF N1<>0 THEN 5049
-5024  PRINT
-5025  PRINT "   KLINGON COMMANDER TO ENTERPRISE---"
-5026  PRINT "AS YOU WELL KNOW, YOU ARE DANGEROUSLY LOW ON ENERGY"
-5027  PRINT "AND WILL PROBABLY BE DESTROYED BY MY NEXT ATTACK."
-5028  PRINT "AS AN OFFICER AND GENTLEMAN, I OFFER YOU A CHANCE TO"
-5029  PRINT "SAVE YOURSELF AND YOUR CREW----"
-5032  PRINT "    DO YOU SURRENDER:";
-5033  INPUT S$
-5034  IF S$<>"YES" THEN 5049
-5035  A7=1
-5036  N9=1
-5038  GOTO 5110
-5049  PRINT
-5050  FOR I=1 TO 9
-5051  IF K(I,3) <= 0 THEN 5100
-5060  H=(K(I,3)/FNO(I))*(2+RND(0))
-5070  E=E-H
-5075  GOSUB 7900
-5080  PRINT H;"UNIT HIT ON"N$;"FROM KLINGON, SECTOR "K(I,1);"-"K(I,2)
-5082  IF H<=180 THEN 5090
-5083  R5=INT(RND(0)*7+1)
-5084  D(R5)=D(R5)-(RND(0)*5+1)
-5085  PRINT "*** CRITICAL HIT,";
-5086  GOSUB 6000
-5087  PRINT F$" DAMAGED ***"
-5090  PRINT "("E;"LEFT)"
-5100  NEXT I
-5105  PRINT
-5110  RETURN
-5200  REM: LOSE
-5210  GOSUB 9985
-5220  PRINT "IT IS STARDATE"T
-5230  PRINT
-5250  GOSUB 7900
-5255  PRINT "THE"N$;"HAS BEEN DESTROYED."
-5260  PRINT "THERE ARE STILL"K9;"KLINGON BATTLE CRUISERS."
-5270  PRINT "THE FEDERATION WILL BE CONQUERED."
-5280  PRINT "YOU ARE DEAD, YOU INCOMPETENT FOOL."
-5290  GOTO 9992
-5300  REM: WIN
-5310  GOSUB 9985
-5320  PRINT "IT IS STARDATE"T
-5330  PRINT "THE LAST KLINGON BATTLE CRUISER IN THE GALAXY HAS BEEN"
-5331  PRINT "DESTROYED."
-5340  PRINT "THE FEDERATION HAS BEEN SAVED."
-5350  PRINT "YOU HAVE BEEN PROMOTED TO COMMODORE EMERITUS."
-5355  IF N1<>0 THEN 5380
-5360  PRINT K0;"KLINGONS IN"T-T0;"YEARS.  RATING="INT(K0/(T-T0)*1000)
-5370  GOTO 9992
-5380  PRINT K0;"KLINGONS IN"T-T0;"YEARS."
-5382  IF A7=5 THEN 5392
-5385  PRINT "ENTERPRISE CAPTURED."
-5390  PRINT "RATING ="INT(K0/(T-T0)*1000-1000)
-5391  GOTO 9992
-5392  PRINT "ENTERPRISE DESTROYED INTENTIONALLY."
-5393  PRINT "RATING ="INT(K0/(T-T0)*1000-500)
-5395  GOTO 9992
-6000  REM: SELECT DAMAGED DEVICE
-6002  IF A+1<>1 THEN 6010
-6004  R5=R1
-6010  IF R5>1 THEN 6040
-6020  F$="WARP ENGINES"
-6030  GOTO 8000
-6040  IF R5>2 THEN 6070
-6050  F$="S.R. SENSORS"
-6060  GOTO 8000
-6070  IF R5>3 THEN 6090
-6075  F$="L.R. SENSORS"
-6080  GOTO 8000
-6090  IF R5>4 THEN 6100
-6093  F$="PHASER CNTRL"
-6097  GOTO 8000
-6100  IF R5>5 THEN 6110
-6103  F$="PHOTON TUBES"
-6107  GOTO 8000
-6110  IF R5>6 THEN 6115
-6111  F$="DAMAGE CNTRL"
-6112  GOTO 8000
-6115  F$="ENERGY SHLDS"
-6118  GOTO 8000
-6300  REM: RAMMING KLINGON
-6301  PRINT
-6302  Q(S1,S2)=0
-6304  K3=K3-1
-6305  K9=K9-1
-6310  Z$="DOWN"
-6318  FOR I=1 TO 9
-6320  IF K(I,1)<>X3 THEN 6330
-6322  IF K(I,2)<>Y3 THEN 6330
-6323  Z6=K(I,1)
-6324  Z7=K(I,2)
-6325  GOTO 6360
-6330  NEXT I
-6360  K(I,3)=0
-6362  GOSUB 7900
-6363  Q(X3,Y3)=A5
-6365  GOTO 6370
-6370  G(Q1,Q2)=K3*100+B3*10+S3
-6380  PRINT "*** EMERGENCY ALERT ***"
-6381  PRINT "*** COLLISION IMMINENT ***"
-6382  GOSUB 9980
-6383  GOSUB 7900
-6384  PRINT N$;"RAMS KLINGON AT SECTOR"Z6;"-"Z7
-6385  PRINT "*** KLINGON DESTROYED,"N$;"HEAVILY DAMAGED. ***"
-6386  FOR I=1 TO 7
-6387  D(I)=D(I)-(RND(0)*4+1)
-6388  NEXT I
-6389  C5=0
-6390  E=E-500
-6391  IF K9<=0 THEN 5300
-6395  IF E<=0 THEN 5230
-6396  S1=Z6
-6397  S2=Z7
-6398  A=2
-6399  GOTO 4040
-6500  REM: TORPEDO SPREAD FORMATION
-6507  PRINT "SPREAD ANGLE (0.05-0.30):";
-6508  INPUT E5
-6509  IF E5=0 THEN 959
-6510  IF E5<0.05 THEN 6507
-6511  IF E5>0.30 THEN 6507
-6515  E4=1
-6520  PRINT "NUMBER"E4;
-6522  IF E4>1.5 THEN 6530
-6524  C1=C1-E5
-6525  GOTO 3120
-6530  C1=C1+E5
-6535  GOTO 3120
-7100  REM: COMMAND LINK
-7105  IF A+1 = 1 THEN 1030
-7106  IF A+1 = 2 THEN 700
-7107  IF A+1 = 3 THEN 1600
-7108  IF A+1 = 4 THEN 1800
-7109  IF A+1 = 5 THEN 3000
-7110  IF A+1 = 6 THEN 4000
-7111  IF A+1 = 7 THEN 8100
-7112  IF A+1 = 8 THEN 7400
-7113  IF A+1 = 9 THEN 7800
-7114  IF A+1 = 10 THEN 7850
-7115  IF A+1 = 11 THEN 7200
-7125  GOTO 974
-7200  REM: DEATH RAY
-7202  IF T>T0+18 THEN 7208
-7204  PRINT " DEATH RAY CANNOT BE USED UNTIL STARDATE"T0+19
-7205  PRINT
-7206  GOTO 959
-7208  IF W3<.05 THEN 7215
-7210  PRINT " DEATH RAY PERMANENTLY OUT OF ORDER."
-7212  PRINT
-7214  GOTO 959
-7215  IF C5=0 THEN 7225
-7220  PRINT " YOU MUST LOWER YOUR SHIELDS TO FIRE."
-7222  PRINT
-7223  GOTO 959
-7225  W3=RND(0)
-7227  PRINT
-7228  IF W3>.35 THEN 7260
-7230  PRINT " *ANTI-MATTER OVERLOAD."
-7231  PRINT " TEMPORARY PSUEDO-STARS CREATED FROM ENERGY."
-7232  FOR I=1 TO 8
-7233  FOR J=1 TO 8
-7235  IF Q(I,J)<>0 THEN 7240
-7238  Q(I,J)=4
-7240  NEXT J
-7241  NEXT I
-7245  PRINT
-7247  GOTO 830
-7260  IF W3>.50 THEN 7280
-7263  PRINT "*** DEATH RAY BACKFIRES ***"
-7265  PRINT "*** BETTER LUCK NEXT TIME ***"
-7270  GOTO 3575
-7280  IF W3>.60 THEN 7310
-7283  PRINT "*** DEATH RAY ANNIHILATES ALL KLINGONS IN QUADRANT"Q1;"-"Q2
-7285  K9=K9-K3
-7286  IF K9<=0 THEN 5300
-7287  FOR I=1 TO 8
-7288  FOR J=1 TO 8
-7289  IF Q(I,J)<>6 THEN 7292
-7290  Q(I,J)=0
-7292  IF Q(I,J)<>2 THEN 7294
-7293  Q(I,J)=0
-7294  NEXT J
-7295  NEXT I
-7296  K3=0
-7298  G(Q1,Q2)=INT(B3*10+S3)
-7300  GOTO 959
-7310  IF W3>.75 THEN 7325
-7312  PRINT "*THERMAL REACTOR ENERGY DRAIN."
-7314  E=E-(.95*E)
-7316  PRINT .95*E"UNITS OF ENERGY BURNED."
-7320  GOTO 7283
-7325  IF W3>.95 THEN 7350
-7328  PRINT "*MATTER/ANTI-MATTER TRANSFORMATION."
-7330  IF K3>0 THEN 7334
-7332  GOTO 7231
-7334  PRINT "KLINGONS HIT BY MAIN BEAM DUPLICATED."
-7335  P8=K3
-7338  FOR I=1 TO P8
-7339  IF K3>8 THEN 7345
-7341  K3=K3+1
-7342  K9=K9+1
-7344  NEXT I
-7345  G(Q1,Q2)=K3*100+B3*10+S3
-7346  P2=1
-7349  GOTO 1500
-7350  PRINT "*** DEATH RAY GOES CRAZY ***"
-7352  PRINT "*** DESTROYS EVERY KLINGON IN THE GALAXY ***"
-7353  PRINT "*** ALSO DESTROYS ENTERPRISE ***"
-7354  A7=N1=5
-7360  GOTO 5300
-7400  REM: ABANDON SHIP
-7401  IF N1=0 THEN 7404
-7402  PRINT "THE FAIRIE QUEENE CANNOT BE ABANDONED."
-7403  GOTO 959
-7404  PRINT
-7405  IF A7<>1 THEN 7420
-7410  PRINT "** YOU MAY NOT ABANDON SHIP AFTER YOU HAVE BEEN "
-7411  PRINT "ASKED TO SURRENDER."
-7415  PRINT
-7416  GOTO 959
-7420  PRINT "*** ABANDON SHIP ***"
-7421  PRINT "*** ABANDON SHIP ***"
-7425  PRINT
-7426  PRINT "SERIES ENTER-BLITZ INITIATED."
-7429  PRINT "FAIL-SAFE AUTO-OVERRIDE INSERTED."
-7433  PRINT "ENTERPRISE COMMANDER AND CREW ESCAPE IN SHUTTLE CRAFT."
-7435  PRINT
-7440  PRINT "*** ENTERPRISE REDUCED TO SUB-ATOMIC PARTICLES ***"
-7441  PRINT
-7445  A7=5
-7446  N1=1
-7448  N9=1
-7450  GOTO 955
-7500  REM: SUPERNOVA
-7501  IF V=2 THEN 7506
-7502  IF RND(0)>.15 THEN 7600
-7504  GOTO 7508
-7506  IF RND(0)>.10 THEN 7600
-7508  Z3=INT(RND(0)*8+1)
-7510  Z4=INT(RND(0)*8+1)
-7515  IF G(Z3,Z4)>999 THEN 7600
-7520  S4=G(Z3,Z4)-INT(G(Z3,Z4)*.1)*10
-7525  IF S4<=0 THEN 7600
-7530  PRINT
-7535  PRINT "*************************************************"
-7540  PRINT "********* SUPERNOVA IN QUADRANT"Z3;"-"Z4
-7542  PRINT "ALL MATTER IN THIS QUADRANT CONVERTED TO ENERGY."
-7543  IF Q1<>Z3 THEN 7575
-7544  IF Q2<>Z4 THEN 7575
-7545  PRINT
-7546  GOSUB 7900
-7548  PRINT "UNFORTUNATELY, THE"N$;"WAS IN THIS QUADRANT."
-7550  GOTO 3582
-7575  PRINT "FROM NOW ON, ANY VESSEL STOPPING IN THIS QUADRANT"
-7576  PRINT "WILL BE TOTALLY ENERGIZED."
-7577  PRINT "*************************************************"
-7579  PRINT
-7580  K4=INT(G(Z3,Z4)/99.99)
-7582  B4=INT((G(Z3,Z4)/99.99-K4)*10.0)
-7584 B9=B9-B4
-7585  K9=K9-K4
-7590  G(Z3,Z4)=INT(1000.0)
-7600  GOTO 1164
-7650  REM: STARSHIP ENCOUNTERS OLD SUPERNOVA
-7655  PRINT "*** HEY STUPID.  YOU WERE WARNED NOT TO STOP IN A"
-7656  PRINT "QUADRANT WHERE A SUPERNOVA HAD OCCURRED."
-7660  GOTO 8992
-7700  REM: VARIABLE RESUPPLY
-7701  IF N1=1 THEN 7710
-7703  E=3000
-7705  P=10
-7708  GOTO 7720
-7710  E=1500
-7715  P=5
-7720  A7=0
-7730  RETURN
-7800  REM: ACTIVATE ENERGY SHIELDS
-7802  IF D(7)>=0 THEN 7808
-7804  PRINT "ENERGY SHIELDS DISABLED."
-7806  GOTO 959
-7808  IF C5=0 THEN 7818
-7810  PRINT "ENERGY SHIELDS ALREADY ACTIVATED."
-7811  PRINT
-7812  GOTO 959
-7818  PRINT
-7819  PRINT "ENERGY SHIELDS ACTIVATED."
-7820  PRINT
-7822  C5=200
-7824  Z$="UP"
-7825  E=E-C5
-7826  IF E<=0 THEN 5200
-7828  GOSUB 5000
-7830  GOTO 959
-7850  REM: DEACTIVATE ENERGY SHIELDS
-7855  PRINT
-7860  PRINT "ENERGY SHIELDS DEACTIVATED."
-7863  PRINT
-7865  C5=0
-7868  Z$="DOWN"
-7870  GOSUB 5000
-7875  GOTO 955
-7900  REM: DETERMINE NAME
-7905  IF N1<>1 THEN 7915
-7908  A5=5
-7910  N$=" FAIRIE QUEENE "
-7912  GOTO 7920
-7915  N$=" ENTERPRISE "
-7918  A5=1
-7920  RETURN
-7950  REM: CHANGING OF THE GUARD AT BUCKINGHAM PALACE
-7951  PRINT
-7952  FOR I=1 TO 8
-7955  FOR J=1 TO 8
-7957  K3=INT(G(I,J)/99.99)
-7958  B3=INT((G(I,J)/99.99-K3)*10.0)
-7960  IF B3>0 THEN 7978
-7961  NEXT J
-7962  NEXT I
-7963  PRINT " YOU HAVE BEEN TAKEN TO KLINGON HEADQUARTERS."
-7964  PRINT "IF YOU HAD A STARBASE, YOU WOULD BE REPATRIATED"
-7965  PRINT "AND GIVEN A NEW STARSHIP TO COMMAND."
-7966  PRINT "SINCE YOU HAVE NO STARBASE, YOU WILL BE MERCILESSLY"
-7967  PRINT "TORTURED TO DEATH BY THE ARCHFIEND,"
-7968  PRINT "CECIL DYBOWSKI, SCOURGE OF THE UNIVERSE."
-7970  N7=1
-7975  GOTO 8000
-7978  N9=2
-7979  T=T+1
-7980  Q1=I
-7981  Q2=J
-7982  E=1500
-7983  P=5
-7984 N1=1
-7985  PRINT "YOU HAVE BEEN SENT BACK TO STARFLEET COMMAND."
-7987  PRINT "YOU ARE NOW IN COMMAND OF A NEW STARSHIP,"
-7988  PRINT "   THE FAIRIE QUEENE,"
-7989  PRINT "WHICH LOOKS LIKE /Q/ ON THE SCAN."
-7990  PRINT
-7992  PRINT "   YE FAIRIE QUEENE IS CURRENTLY IN QUADRANT"Q1;"-"Q2
-7994  PRINT "TRY TO BE MORE CAREFUL THIS TIME."
-7995  FOR I=1 TO 7
-7996  D(I)=0
-7997  NEXT I
-7998  PRINT
-7999  GOTO 1500
-8000  RETURN
-8050  Q$(1)="."
-8051  Q$(2)="E"
-8052  Q$(3)="K"
-8053  Q$(4)="B"
-8054  Q$(5)="*"
-8055  Q$(6)="Q"
-8056  Q$(7)="C"
-8060  RETURN
-8100  REM: SELF-DESTRUCT
-8105  PRINT
-8110  PRINT "SERIES ENTER-BLITZ INITIATED."
-8115  PRINT "IN TEN SECONDS THIS VESSEL WILL SELF-DESTRUCT."
-8116  PRINT "10"
-8117  PRINT "   9"
-8118  PRINT "      8"
-8119  PRINT "         7"
-8120  PRINT "            6"
-8122  PRINT
-8123  PRINT "T MINUS 5 SECONDS AND HOLDING."
-8124  PRINT "FAIL-SAFE MECHANISM ENGAGED.  ONLY THE COMMANDER OF"
-8125  PRINT "THE STARSHIP CAN OVERRIDE WITH HIS SECRET PASSWORD."
-8126  PRINT "SCIENCE OFFICER HICKS HAS ALREADY ENTERED HIS CORRECT"
-8127  PRINT "COUNTER-PASSWORD."
-8128  PRINT "TO CONTINUE SERIES ENTER-BLITZ, TYPE YOUR "
-8129  PRINT "SECRET PASSWORD:";
-8130  INPUT V$
-8135  IF V$<>X$ THEN 8150
-8139  PRINT
-8140  PRINT "               4"
-8141  PRINT "                  3"
-8142  PRINT "                     2"
-8143  PRINT "                        1"
-8145  GOTO 3575
-8150  PRINT
-8151  PRINT "SERIES ENTER-BLITZ TERMINATED."
-8155  PRINT
-8160  GOTO 955
-8200  REM: RANDOMIZE
-8205  PRINT
-8206  PRINT "   TYPE A WIERD NUMBER BETWEEN 0.0 AND 1.0 :";
-8207  INPUT E6
-8208  E9=RND(E6)
-8210  RETURN
-8970  REM: LEAVING GALAXY
-8975  IF F>2 THEN 8990
-8980  PRINT
-8981  PRINT "STARSHIP ENCOUNTERS END OF GALAXY."
-8982  PRINT
-8983  PRINT "FOOLISH MORTAL, YOU HAVE ATTEMPTED TO VENTURE OUT OF THE"
-8984  PRINT "GALAXY INTO SUB-SPACE.  ON THE THIRD TIME YOU TRY THIS,"
-8985  PRINT "THE LIVING GOD, KORP, WILL DESTROY YOU."
-8987  F=F+1
-8988  GOTO 8995
-8990  PRINT
-8991  PRINT "YOU HAVE DARED TO ENTER SUB-SPACE A THIRD TIME."
-8992  PRINT "FOR THIS, ************ YOU DIE ****************"
-8993  GOTO 3575
-8995  RETURN
-9000  REM: RANDOM NUMBER GENERATOR
-9010  R1=INT(RND(0)*8+1)
-9020  R2=INT(RND(0)*8+1)
-9030  IF Q(R1,R2) <> 0 THEN 9010
-9040  RETURN
-9045  PRINT
-9050  PRINT "ORDERS:  STARDATE = "T
-9060  PRINT
-9070  PRINT "   AS COMMANDER OF THE UNITED STARSHIP ENTERPRISE,"
-9080  PRINT "YOUR MISSION IS TO RID THE GALAXY OF THE DEADLY"
-9090  PRINT "KLINGON MENACE.  TO DO THIS, YOU MUST DESTROY THE "
-9100  PRINT "KLINGON INVASION FORCE OF "K9"BATTLE CRUISERS."
-9110  PRINT "YOU HAVE"T9;"SOLAR YEARS TO COMPLETE YOUR MISSION."
-9120  PRINT "(I.E. UNTIL STARDATE"T0+T9;")."
-9125  PRINT
-9130  IF B9 > 1 THEN 9133
-9131  PRINT "   YOU WILL HAVE ONE SUPPORTING STARBASE."
-9132  GOTO 9140
-9133  PRINT "   YOU WILL HAVE"B9"SUPPORTING STARBASES."
-9140  PRINT "WHEN THE ENTERPRISE DOCKS AT ONE (IS POSITIONED"
-9150  PRINT "NEXT TO ONE) IT IS RESUPPLIED WITH ENERGY AND"
-9160  PRINT "PHOTON TORPEDOES."
-9161  PRINT "THE ENTERPRISE IS CURRENTLY IN"
-9162  PRINT "QUADRANT"Q1"-"Q2"SECTOR"S1"-"S2
-9163  PRINT "DO YOU NEED FURTHER INSTRUCTIONS (REVISED 18 APRIL 73)";
-9164  INPUT A$
-9166  PRINT
-9170  IF A$<>"YES" THEN 400
-9175  GOSUB 9980
-9180  PRINT "   THE GALAXY IS DIVIDED INTO 64 QUADRANTS WITH"
-9190  PRINT "THE FOLLOWING COORDINATES:"
-9200  PRINT " Y--   1   2   3   4   5   6   7   8   '"
-9210  PRINT "   --------------------------------- X"
-9220  FOR I=1 TO 8
-9230  PRINT " ' :   :   :   :   :   :   :   :   :  "I
-9240  PRINT "   --------------------------------- '"
-9250  NEXT I
-9260  PRINT
-9270  PRINT
-9280  PRINT
-9300  PRINT "EACH QUADRANT IS SIMILARLY DIVIDED INTO 64 SECTORS."
-9310  GOSUB 9980
-9320  PRINT "::: DEVICES :::"
-9330  PRINT
-9340  PRINT "WARP ENGINES: "
-9350  PRINT
-9360  PRINT "COURSE = A REAL NUMBER FROM 1 TO 8.99999."
-9370  PRINT "NUMBERS INDICATE DIRECTION STARTING AT THE RIGHT AND"
-9380  PRINT "GOING COUNTER CLOCKWISE:"
-9390  PRINT
-9400  PRINT "        3"
-9410  PRINT "      4   2"
-9420  PRINT "         /"
-9430  PRINT "    5---*---1"
-9440  PRINT "       /"
-9450  PRINT "      6   8"
-9460  PRINT "        7"
-9470  PRINT
-9480  PRINT "WARP FACTOR = A REAL NUMBER FROM 0 TO 12."
-9490  PRINT "DISTANCE TRAVELED = INTEGER (WARP FACTOR) QUADRANTS:"
-9500  PRINT "   WARP .2 = THE ENTERPRISE TRAVELS 1 SECTOR."
-9510  PRINT "        .5 =                        4 SECTORS."
-9520  PRINT "         1 =                        1 QUADRANT."
-9530  PRINT "         2 =                        2 QUADRANTS."
-9535  PRINT
-9540  PRINT
-9550  PRINT "FOR EXAMPLE, IF YOU TRAVEL FROM:"
-9560  PRINT "QUADRANT 1 - 1, SECTOR 1 - 1, IN DIRECTION 1 AT WARP 2"
-9570  PRINT "YOU WOULD STOP AT"
-9580  PRINT "QUADRANT 1 - 3, SECTOR 1 - 1 IN THE NEXT STARDATE."
-9590  PRINT
-9591  PRINT " WHEN YOU CHANGE QUADRANTS, HOWEVER, THE POSITIONS OF"
-9592  PRINT "ALL OBJECTS IN THE NEW QUADRANT (INCLUDING THE ENTERPRISE)"
-9593  PRINT "ARE RANDOMIZED TO SIMULATE 3-D TRAVEL."
-9599  PRINT
-9600  PRINT "*** NOTE:  EVERY USE OF THE WARP ENGINES TAKES ONE"
-9610  PRINT "STARDATE.  IF THE ENTERPRISE IS BLOCKED BY SOMETHING"
-9620  PRINT "DURING INTRA-QUADRANT TRAVEL IT WILL STOP IN FRONT"
-9630  PRINT "OF IT (AND WASTE A STARDATE) ***"
-9631  PRINT
-9632  PRINT "***NOTE: THERE IS A TIME PORTAL AVAILABLE BY TRAVELLING"
-9633  PRINT "AT WARP 12.  YOU MAY BE CARRIED EITHER FORWARD OR"
-9634  PRINT "BACKWARD IN TIME, BUT THERE IS ALSO A .40 PROBABILITY"
-9635  PRINT "THAT YOU WILL BE DESTROYED IN A NUCLEAR IMPLOSION."
-9636  PRINT "A WARP FACTOR OF 12 MAY ONLY BE USED AFTER 15 SOLAR YEARS."
-9637  PRINT
-9638  PRINT "***NOTE:  IF THE ENTERPRISE RAMS A KLINGON VESSEL, EITHER"
-9639  PRINT "DELIBERATELY OR ACCIDENTLY, THE KLINGON WILL BE"
-9640  PRINT "DESTROYED AND THE ENTERPRISE HEAVILY DAMAGED."
-9649  GOSUB 9980
-9650  PRINT "SHORT RANGE SENSORS:"
-9660  PRINT
-9670  PRINT "   THE SHORT RANGE SENSORS OF THE ENTERPRISE DISPLAY"
-9680  PRINT "A DETAILED VIEW OF THE QUADRANT IT IS CURRENTLY IN."
-9690  PRINT "THE ENTERPRISE LOOKS LIKE /E/ ON THE SCREEN."
-9700  PRINT "KLINGON BATTLE CRUISERS LOOK LIKE /K/ ON THE SCREEN."
-9710  PRINT "STARBASES LOOK LIKE /B/ AND STARS LOOK LIKE * ."
-9715  PRINT "THE KLINGONS MAY HAVE A POWERFUL COMMAND SHIP, /C/."
-9720  PRINT
-9723  PRINT "***NOTE: DOCKING IS A TWO STEP PROCEDURE--FIRST YOU"
-9724  PRINT "MUST MOVE ADJACENT TO THE BASE.  THEN CONDUCT A "
-9725  PRINT "SHORT RANGE SCAN."
-9726  PRINT "WHILE DOCKED, STARBASE SHIELDS PROTECT THE STARSHIP."
-9729  PRINT
-9730  PRINT "***NOTE: CONDITION YELLOW MEANS YOU ARE DANGEROUSLY"
-9731  PRINT "LOW ON ENERGY AND SHOULD MAKE FOR A BASE POSTHASTE."
-9735  GOSUB 9980
-9736  PRINT "EXPERIMENTAL DEATH RAY"
-9737  PRINT
-9738  PRINT "   THE EXPERIMENTAL DEATH RAY, AS ITS NAME IMPLIES,"
-9739  PRINT "IS UNPREDICTABLE.  HOWEVER, ONE CAN CERTAINLY PREDICT"
-9740  PRINT "THAT, IN A GIVEN SITUATION, IT WILL DO WHATEVER IT"
-9741  PRINT "DAMN WELL PLEASES.  THERE IS A GOOD PROBABILITY THAT IT"
-9742  PRINT "WILL DESTROY MANY KLINGONS, BUT THERE COULD BE SOME"
-9743  PRINT "INTERESTING SIDE EFFECTS.  IT CAN PROBABLY ONLY BE"
-9744  PRINT "FIRED ONCE, BUT YOU NEVER KNOW.  IT CANNOT BE USED UNTIL"
-9745  PRINT "18 SOLAR YEARS HAVE PASSED."
-9757  GOSUB 9980
-9758  PRINT "LONG RANGE SENSORS:"
-9759  PRINT
-9760  PRINT "   THE LONG RANGE SENSORS OF THE ENTERPRISE DISPLAY"
-9770  PRINT "THE NUMBER OF OBJECTS IN THE 9 CLOSEST QUADRANTS,"
-9771  PRINT "WITH THE ENTERPRISE IN THE CENTRAL ONE."
-9780  PRINT "EACH DIGIT OF THE NUMBER IN EACH BOX MEANS SOMETHING:"
-9790  PRINT "   THE ONES DIGIT REPRESENTS THE NUMBER OF STARS."
-9800  PRINT "       TENS                                STARBASES."
-9810  PRINT "      HUNDREDS                             KLINGONS."
-9812  PRINT "      THOUSANDS                            SUPERNOVA."
-9820  PRINT "FOR EXAMPLE:"
-9830  PRINT "319 MEANS  3 KLINGONS, 1 STARBASE, AND 9 STARS."
-9840  PRINT "206 MEANS 2 KLINGONS, 0 STARBASES, AND 6 STARS."
-9850  PRINT "7 MEANS 0 KLINGONS, 0 STARBASES, AND 7 STARS."
-9860  GOSUB 9980
-9861  PRINT "ENERGY SHIELDS:"
-9862  PRINT
-9863  PRINT "   WHILE THE ENERGY SHIELDS OF A STARSHIP ARE ACTIVATED,"
-9864  PRINT "KLINGON ATTACKS ARE NULLIFIED.  EVERY TIME YOU MOVE WITH"
-9865  PRINT "YOUR SHIELDS UP, 200 UNITS OF ENERGY ARE USED."
-9866  PRINT "ALSO, SHIELD ACTIVATION ITSELF REQUIRES 200 UNITS."
-9867  PRINT "NOTE: YOU MUST LOWER YOUR SHIELDS TO ATTACK."
-9869  GOSUB 9980
-9870  PRINT "PHASERS:"
-9880  PRINT
-9890  PRINT "   ANY PORTION OF THE ENERGY AVAILABLE CAN BE FIRED."
-9900  PRINT "THE BATTLE COMPUTER DIVIDES THIS AMOUNT AMONG THE"
-9901  PRINT "KLINGON CRUISERS IN THE QUADRANT AND DETERMINES"
-9902  PRINT "THE VARIOUS DIRECTIONS OF FIRE.  THE EFFECTIVENESS"
-9903  PRINT "OF A HIT DEPENDS MOSTLY ON THE DISTANCE TO THE"
-9904  PRINT "TARGET.  A KLINGON BATTLE CRUISER STARTS WITH"S9
-9905  PRINT "UNITS OF ENERGY.  IT CAN FIRE AN AMOUNT EQUAL TO"
-9906  PRINT "WHATEVER ENERGY IT HAS LEFT."
-9907  PRINT
-9908  PRINT
-9909  PRINT "PHOTON TORPEDOES:"
-9910  PRINT
-9911  PRINT "   INITIALLY THE ENTERPRISE HAS"P0"PHOTON TORPEDOES."
-9912  PRINT "ONE TORPEDO DESTROYS WHATEVER IT HITS.  THE RANGE"
-9913  PRINT "OF PHOTON TORPEDOES (LIKE PHASERS) IS LIMITED TO"
-9914  PRINT "THE CURRENT QUADRANT.  THE COURSE OF A PHOTON TORPEDO"
-9915  PRINT "IS SET THE SAME WAY AS THAT OF THE ENTERPRISE."
-9916  PRINT "YOU MAY, IF YOU WISH, FIRE A SPREAD OF THREE TORPEDOES"
-9917  PRINT "AT ONCE.  THERE IS A TIME LAG IN LAUNCHING THEM, THE ONE"
-9918  PRINT "WITH THE LOWEST NUMERICAL COURSE BEING FIRED FIRST."
-9919  PRINT "FOR EXAMPLE, A TORPEDO COURSE OF 3.49 WITH A SPREAD"
-9920  PRINT "ANGLE OF 0.24 WOULD FIRE TORPEDOES AT DIRECTIONS"
-9921  PRINT "3.25, 3.49, AND 3.73 ."
-9924  GOSUB 9980
-9925  PRINT "DAMAGE CONTROL REPORT:"
-9926  PRINT "   THE DAMAGE CONTROL REPORT LISTS THE MAIN DEVICES AND"
-9927  PRINT "THEIR STATE OF REPAIR.  A NEGATIVE STATE OF REPAIR"
-9928  PRINT "INDICATES A DISABLES DEVICE.  DEVICES CAN BE DAMAGED OR"
-9929  PRINT "REPAIRED BY A SPACE STORM OR TRUCE, RESPECTIVELY."
-9930  PRINT "ALSO, DAMAGED DEVICES ARE REPAIRED 2 UNITS EVERY STARDATE."
-9935  GOSUB 9980
-9940  PRINT "COMMANDS:"
-9941  PRINT
-9942  H6=1
-9944  GOTO 975
-9946  H6=H6+1
-9952  GOSUB 9980
-9953  PRINT "P.S.--SAVE THIS COPY OF INSTRUCTIONS, SO THAT NEXT"
-9954  PRINT "TIME YOU WILL NOT NEED ADDITIONAL INSTRUCIONS AND"
-9955  PRINT "CAN PROCEED IMMEDIATELY TO PLAY."
-9956  PRINT
-9957  PRINT
-9960  GOSUB 9980
-9961  PRINT "WHEN YOU ARE READY TO CONTINUE, TYPE 9:";
-9962  INPUT X
-9963  GOSUB 9980
-9965  GOTO 400
-9980  REM
-9985  FOR I=1 TO 3
-9986  PRINT
-9990  NEXT I
-9991  RETURN
-9992  PRINT
-9993  PRINT
-9994  PRINT "  DO YOU WISH TO PLAY AGAIN:";
-9995  INPUT A$
-9996  IF A$ ="YES" THEN 5
-9997  PRINT
-9998  PRINT "  ** AVE ATQUE VALE **"
-9999  END
diff --git a/www/historic/mayfield.basic b/www/historic/mayfield.basic
deleted file mode 100644 (file)
index 052da0b..0000000
+++ /dev/null
@@ -1,643 +0,0 @@
-REM  Extracted from HP tape image 16-Nov-2003 by Pete Turnbull
-
-1  REM ****  HP BASIC PROGRAM LIBRARY  ******************************
-2  REM
-3  REM       STTR1: STAR TREK
-4  REM
-5  REM       36243  REV B  --  10/73
-6  REM
-7  REM ****  CONTRIBUTED PROGRAM  ***********************************
-100  REM *****************************************************************
-110  REM ***                                                           ***
-120  REM ***     STAR TREK: BY MIKE MAYFIELD, CENTERLINE ENGINEERING   ***
-130  REM ***                                                           ***
-140  REM ***        TOTAL INTERACTION GAME - ORIG. 20 OCT 1972
-150  REM ***                                                           ***
-160  REM *****************************************************************
-170  GOSUB 5460
-180  PRINT "                          STAR TREK "
-190  PRINT "DO YOU WANT INSTRUCTIONS (THEY'RE LONG!)";
-200  INPUT A$
-210  IF A$ <> "YES" THEN 230
-220  GOSUB 5820
-230  REM *****  PROGRAM STARTS HERE *****
-240  Z$="                                                                      "
-250  GOSUB 5460
-260  DIM G[8,8],C[9,2],K[3,3],N[3],Z[8,8]
-270  DIM C$[6],D$[72],E$[24],A$[3],Q$[72],R$[72],S$[48]
-280  DIM Z$[72]
-290  T0=T=INT(RND(1)*20+20)*100
-300  T9=30
-310  D0=0
-320  E0=E=3000
-330  P0=P=10
-340  S9=200
-350  S=H8=0
-360  DEF FND(D)=SQR((K[I,1]-S1)^2+(K[I,2]-S2)^2)
-370  Q1=INT(RND(1)*8+1)
-380  Q2=INT(RND(1)*8+1)
-390  S1=INT(RND(1)*8+1)
-400  S2=INT(RND(1)*8+1)
-410  T7=TIM(0)+60*TIM(1)
-420  C[2,1]=C[3,1]=C[4,1]=C[4,2]=C[5,2]=C[6,2]=-1
-430  C[1,1]=C[3,2]=C[5,1]=C[7,2]=C[9,1]=0
-440  C[1,2]=C[2,2]=C[6,1]=C[7,1]=C[8,1]=C[8,2]=C[9,2]=1
-450  MAT D=ZER
-460  D$="WARP ENGINESS.R. SENSORSL.R. SENSORSPHASER CNTRL"
-470  D$[49]="PHOTON TUBESDAMAGE CNTRL"
-480  E$="SHIELD CNTRLCOMPUTER"
-490  B9=K9=0
-500  FOR I=1 TO 8
-510  FOR J=1 TO 8
-520  R1=RND(1)
-530  IF R1>.98 THEN 580
-540  IF R1>.95 THEN 610
-550  IF R1>.8 THEN 640
-560  K3=0
-570  GOTO 660
-580  K3=3
-590  K9=K9+3
-600  GOTO 660
-610  K3=2
-620  K9=K9+2
-630  GOTO 660
-640  K3=1
-650  K9=K9+1
-660  R1=RND(1)
-670  IF R1>.96 THEN 700
-680  B3=0
-690  GOTO 720
-700  B3=1
-710  B9=B9+1
-720  S3=INT(RND(1)*8+1)
-730  G[I,J]=K3*100+B3*10+S3
-740  Z[I,J]=0
-750  NEXT J
-760  NEXT I
-770  K7=K9
-775  IF B9 <= 0 OR K9 <= 0 THEN 490
-780  PRINT "YOU MUST DESTROY"K9;" KLINGONS IN"T9;" STARDATES WITH"B9;" STARBASES"
-810  K3=B3=S3=0
-820  IF Q1<1 OR Q1>8 OR Q2<1 OR Q2>8 THEN 920
-830  X=G[Q1,Q2]*.01
-840  K3=INT(X)
-850  B3=INT((X-K3)*10)
-860  S3=G[Q1,Q2]-INT(G[Q1,Q2]*.1)*10
-870  IF K3=0 THEN 910
-880  IF S>200 THEN 910
-890  PRINT "COMBAT AREA      CONDITION RED"
-900  PRINT "   SHIELDS DANGEROUSLY LOW"
-910  MAT K=ZER
-920  FOR I=1 TO 3
-930  K[I,3]=0
-940  NEXT I
-950  Q$=Z$
-960  R$=Z$
-970  S$=Z$[1,48]
-980  A$="<*>"
-990  Z1=S1
-1000  Z2=S2
-1010  GOSUB 5510
-1020  FOR I=1 TO K3
-1030  GOSUB 5380
-1040  A$="+++"
-1050  Z1=R1
-1060  Z2=R2
-1070  GOSUB 5510
-1080  K[I,1]=R1
-1090  K[I,2]=R2
-1100  K[I,3]=S9
-1110  NEXT I
-1120  FOR I=1 TO B3
-1130  GOSUB 5380
-1140  A$=">!<"
-1150  Z1=R1
-1160  Z2=R2
-1170  GOSUB 5510
-1180  NEXT I
-1190  FOR I=1 TO S3
-1200  GOSUB 5380
-1210  A$=" * "
-1220  Z1=R1
-1230  Z2=R2
-1240  GOSUB 5510
-1250  NEXT I
-1260  GOSUB 4120
-1270  PRINT "COMMAND:";
-1280  INPUT A
-1290  GOTO A+1 OF 1410,1260,2330,2530,2800,3460,3560,4630
-1300  PRINT
-1310  PRINT "   0 = SET COURSE"
-1320  PRINT "   1 = SHORT RANGE SENSOR SCAN"
-1330  PRINT "   2 = LONG RANGE SENSOR SCAN"
-1340  PRINT "   3 = FIRE PHASERS"
-1350  PRINT "   4 = FIRE PHOTON TORPEDOES"
-1360  PRINT "   5 = SHIELD CONTROL"
-1370  PRINT "   6 = DAMAGE CONTROL REPORT"
-1380  PRINT "   7 = CALL ON LIBRARY COMPUTER"
-1390  PRINT
-1400  GOTO 1270
-1410  PRINT "COURSE (1-9):";
-1420  INPUT C1
-1430  IF C1=0 THEN 1270
-1440  IF C1<1 OR C1 >= 9 THEN 1410
-1450  PRINT "WARP FACTOR (0-8):";
-1460  INPUT W1
-1470  IF W1<0 OR W1>8 THEN 1410
-1480  IF D[1] >= 0 OR W1 <= .2 THEN 1510
-1490  PRINT "WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .2"
-1500  GOTO 1410
-1510  IF K3 <= 0 THEN 1560
-1520  GOSUB 3790
-1530  IF K3 <= 0 THEN 1560
-1540  IF S<0 THEN 4000
-1550  GOTO 1610
-1560  IF E>0 THEN 1610
-1570  IF S<1 THEN 3920
-1580  PRINT "YOU HAVE"E" UNITS OF ENERGY"
-1590  PRINT "SUGGEST YOU GET SOME FROM YOUR SHIELDS WHICH HAVE"S" UNITS LEFT"
-1600  GOTO 1270
-1610  FOR I=1 TO 8
-1620  IF D[I] >= 0 THEN 1640
-1630  D[I]=D[I]+1
-1640  NEXT I
-1650  IF RND(1)>.2 THEN 1810
-1660  R1=INT(RND(1)*8+1)
-1670  IF RND(1) >= .5 THEN 1750
-1680  D[R1]=D[R1]-(RND(1)*5+1)
-1690  PRINT
-1700  PRINT "DAMAGE CONTROL REPORT:";
-1710  GOSUB 5610
-1720  PRINT " DAMAGED"
-1730  PRINT
-1740  GOTO 1810
-1750  D[R1]=D[R1]+(RND(1)*5+1)
-1760  PRINT
-1770  PRINT "DAMAGE CONTROL REPORT:";
-1780  GOSUB 5610
-1790  PRINT " STATE OF REPAIR IMPROVED"
-1800  PRINT
-1810  N=INT(W1*8)
-1820  A$="   "
-1830  Z1=S1
-1840  Z2=S2
-1850  GOSUB 5510
-1870  X=S1
-1880  Y=S2
-1885  C2=INT(C1)
-1890  X1=C[C2,1]+(C[C2+1,1]-C[C2,1])*(C1-C2)
-1900  X2=C[C2,2]+(C[C2+1,2]-C[C2,2])*(C1-C2)
-1910  FOR I=1 TO N
-1920  S1=S1+X1
-1930  S2=S2+X2
-1940  IF S1<.5 OR S1 >= 8.5 OR S2<.5 OR S2 >= 8.5 THEN 2170
-1950  A$="   "
-1960  Z1=S1
-1970  Z2=S2
-1980  GOSUB 5680
-1990  IF Z3 <> 0 THEN 2070
-2030  PRINT  USING 5370;S1,S2
-2040  S1=S1-X1
-2050  S2=S2-X2
-2060  GOTO 2080
-2070  NEXT I
-2080  A$="<*>"
-2083  S1=INT(S1+.5)
-2086  S2=INT(S2+.5)
-2090  Z1=S1
-2100  Z2=S2
-2110  GOSUB 5510
-2120  E=E-N+5
-2130  IF W1<1 THEN 2150
-2140  T=T+1
-2150  IF T>T0+T9 THEN 3970
-2160  GOTO 1260
-2170  X=Q1*8+X+X1*N
-2180  Y=Q2*8+Y+X2*N
-2190  Q1=INT(X/8)
-2200  Q2=INT(Y/8)
-2210  S1=INT(X-Q1*8+.5)
-2220  S2=INT(Y-Q2*8+.5)
-2230  IF S1 <> 0 THEN 2260
-2240  Q1=Q1-1
-2250  S1=8
-2260  IF S2 <> 0 THEN 2290
-2270  Q2=Q2-1
-2280  S2=8
-2290  T=T+1
-2300  E=E-N+5
-2310  IF T>T0+T9 THEN 3970
-2320  GOTO 810
-2330  IF D[3] >= 0 THEN 2370
-2340  PRINT "LONG RANGE SENSORS ARE INOPERABLE"
-2350  IMAGE  "LONG RANGE SENSOR SCAN FOR QUADRANT",D,",",D
-2360  GOTO 1270
-2370  PRINT  USING 2350;Q1,Q2
-2380  PRINT  USING 2520
-2390  FOR I=Q1-1 TO Q1+1
-2400  MAT N=ZER
-2410  FOR J=Q2-1 TO Q2+1
-2420  IF I<1 OR I>8 OR J<1 OR J>8 THEN 2460
-2430  N[J-Q2+2]=G[I,J]
-2440  IF D[7]<0 THEN 2460
-2450  Z[I,J]=G[I,J]
-2460  NEXT J
-2470  PRINT  USING 2510;N[1],N[2],N[3]
-2480  PRINT  USING 2520
-2490  NEXT I
-2500  GOTO 1270
-2510  IMAGE  ": ",3(3D," :")
-2520  IMAGE  "-----------------"
-2530  IF K3 <= 0 THEN 3670
-2540  IF D[4] >= 0 THEN 2570
-2550  PRINT "PHASER CONTROL IS DISABLED"
-2560  GOTO 1270
-2570  IF D[7] >= 0 THEN 2590
-2580  PRINT " COMPUTER FAILURE HAMPERS ACCURACY"
-2590  PRINT "PHASERS LOCKED ON TARGET.  ENERGY AVAILABLE="E
-2600  PRINT "NUMBER OF UNITS TO FIRE:";
-2610  INPUT X
-2620  IF X <= 0 THEN 1270
-2630  IF E-X<0 THEN 2570
-2640  E=E-X
-2650  GOSUB 3790
-2660  IF D[7] >= 0 THEN 2680
-2670  X=X*RND(1)
-2680  FOR I=1 TO 3
-2690  IF K[I,3] <= 0 THEN 2770
-2700  H=(X/K3/FND(0))*(2*RND(1))
-2710  K[I,3]=K[I,3]-H
-2720  PRINT  USING 2730;H,K[I,1],K[I,2],K[I,3]
-2730  IMAGE  4D," UNIT HIT ON KLINGON AT SECTOR ",D,",",D,"   (",3D," LEFT)"
-2740  IF K[I,3]>0 THEN 2770
-2750  GOSUB 3690
-2760  IF K9 <= 0 THEN 4040
-2770  NEXT I
-2780  IF E<0 THEN 4000
-2790  GOTO 1270
-2800  IF D[5] >= 0 THEN 2830
-2810  PRINT "PHOTON TUBES ARE NOT OPERATIONAL"
-2820  GOTO 1270
-2830  IF P>0 THEN 2860
-2840  PRINT "ALL PHOTON TORPEDOES EXPENDED"
-2850  GOTO 1270
-2860  PRINT "TORPEDO COURSE (1-9):";
-2870  INPUT C1
-2880  IF C1=0 THEN 1270
-2890  IF C1<1 OR C1 >= 9 THEN 2860
-2895  C2=INT(C1)
-2900  X1=C[C2,1]+(C[C2+1,1]-C[C2,1])*(C1-C2)
-2910  X2=C[C2,2]+(C[C2+1,2]-C[C2,2])*(C1-C2)
-2920  X=S1
-2930  Y=S2
-2940  P=P-1
-2950  PRINT "TORPEDO TRACK:"
-2960  X=X+X1
-2970  Y=Y+X2
-2980  IF X<.5 OR X >= 8.5 OR Y<.5 OR Y >= 8.5 THEN 3420
-2990  PRINT  USING 3000;X,Y
-3000  IMAGE  15X,D,",",D
-3010  A$="   "
-3020  Z1=X
-3030  Z2=Y
-3040  GOSUB 5680
-3050  IF Z3=0 THEN 3070
-3060  GOTO 2960
-3070  A$="+++"
-3080  Z1=X
-3090  Z2=Y
-3100  GOSUB 5680
-3110  IF Z3=0 THEN 3220
-3120  PRINT "*** KLINGON DESTROYED ***"
-3130  K3=K3-1
-3140  K9=K9-1
-3150  IF K9 <= 0 THEN 4040
-3160  FOR I=1 TO 3
-3170  IF INT(X+.5) <> K[I,1] THEN 3190
-3180  IF INT(Y+.5)=K[I,2] THEN 3200
-3190  NEXT I
-3200  K[I,3]=0
-3210  GOTO 3360
-3220  A$=" * "
-3230  Z1=X
-3240  Z2=Y
-3250  GOSUB 5680
-3260  IF Z3=0 THEN 3290
-3270  PRINT "YOU CAN'T DESTROY STARS SILLY"
-3280  GOTO 3420
-3290  A$=">!<"
-3300  Z1=X
-3310  Z2=Y
-3320  GOSUB 5680
-3330  IF Z3=0 THEN 2960
-3340  PRINT "*** STAR BASE DESTROYED ***  .......CONGRATULATIONS"
-3350  B3=B3-1
-3360  A$="   "
-3370  Z1=INT(X+.5)
-3380  Z2=INT(Y+.5)
-3390  GOSUB 5510
-3400  G[Q1,Q2]=K3*100+B3*10+S3
-3410  GOTO 3430
-3420  PRINT "TORPEDO MISSED"
-3430  GOSUB 3790
-3440  IF E<0 THEN 4000
-3450  GOTO 1270
-3460  IF D[7] >= 0 THEN 3490
-3470  PRINT "SHIELD CONTROL IS NON-OPERATIONAL"
-3480  GOTO 1270
-3490  PRINT "ENERGY AVAILABLE ="E+S"   NUMBER OF UNITS TO SHIELDS:";
-3500  INPUT X
-3510  IF X <= 0 THEN 1270
-3520  IF E+S-X<0 THEN 3490
-3530  E=E+S-X
-3540  S=X
-3550  GOTO 1270
-3560  IF D[6] >= 0 THEN 3590
-3570  PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE"
-3580  GOTO 1270
-3590  PRINT
-3600  PRINT "DEVICE        STATE OF REPAIR"
-3610  FOR R1=1 TO 8
-3620  GOSUB 5610
-3630  PRINT "",D[R1]
-3640  NEXT R1
-3650  PRINT
-3660  GOTO 1270
-3670  PRINT "SHORT RANGE SENSORS REPORT NO KLINGONS IN THIS QUADRANT"
-3680  GOTO 1270
-3690  PRINT  USING 3700;K[I,1],K[I,2]
-3700  IMAGE  "KLINGON AT SECTOR ",D,",",D," DESTROYED ****"
-3710  K3=K3-1
-3720  K9=K9-1
-3730  A$="   "
-3740  Z1=K[I,1]
-3750  Z2=K[I,2]
-3760  GOSUB 5510
-3770  G[Q1,Q2]=K3*100+B3*10+S3
-3780  RETURN
-3790  IF C$ <> "DOCKED" THEN 3820
-3800  PRINT "STAR BASE SHIELDS PROTECT THE ENTERPRISE"
-3810  RETURN
-3820  IF K3 <= 0 THEN 3910
-3830  FOR I=1 TO 3
-3840  IF K[I,3] <= 0 THEN 3900
-3850  H=(K[I,3]/FND(0))*(2*RND(1))
-3860  S=S-H
-3870  PRINT  USING 3880;H,K[I,1],K[I,2],S
-3880  IMAGE  4D," UNIT HIT ON ENTERPRISE AT SECTOR ",D,",",D,"   (",4D," LEFT)"
-3890  IF S<0 THEN 4000
-3900  NEXT I
-3910  RETURN
-3920  PRINT "THE ENTERPRISE IS DEAD IN SPACE.  IF YOU SURVIVE ALL IMPENDING"
-3930  PRINT "ATTACK YOU WILL BE DEMOTED TO THE RANK OF PRIVATE"
-3940  IF K3 <= 0 THEN 4020
-3950  GOSUB 3790
-3960  GOTO 3940
-3970  PRINT
-3980  PRINT "IT IS STARDATE"T
-3990  GOTO 4020
-4000  PRINT
-4010  PRINT "THE ENTERPRISE HAS BEEN DESTROYED.  THE FEDERATION WILL BE CONQUERED"
-4020  PRINT "THERE ARE STILL"K9" KLINGON BATTLE CRUISERS"
-4030  GOTO 230
-4040  PRINT
-4050  PRINT "THE LAST KLINGON BATTLE CRUISER IN THE GALAXY HAS BEEN DESTROYED"
-4060  PRINT "THE FEDERATION HAS BEEN SAVED !!!"
-4070  PRINT
-4080  PRINT "YOUR EFFICIENCY RATING ="((K7/(T-T0))*1000)
-4090  T1=TIM(0)+TIM(1)*60
-4100  PRINT "YOUR ACTUAL TIME OF MISSION ="INT((((T1-T7)*.4)-T7)*100)" MINUTES"
-4110  GOTO 230
-4120  FOR I=S1-1 TO S1+1
-4130  FOR J=S2-1 TO S2+1
-4140  IF I<1 OR I>8 OR J<1 OR J>8 THEN 4200
-4150  A$=">!<"
-4160  Z1=I
-4170  Z2=J
-4180  GOSUB 5680
-4190  IF Z3=1 THEN 4240
-4200  NEXT J
-4210  NEXT I
-4220  D0=0
-4230  GOTO 4310
-4240  D0=1
-4250  C$="DOCKED"
-4260  E=3000
-4270  P=10
-4280  PRINT "SHIELDS DROPPED FOR DOCKING PURPOSES"
-4290  S=0
-4300  GOTO 4380
-4310  IF K3>0 THEN 4350
-4320  IF E<E0*.1 THEN 4370
-4330  C$="GREEN"
-4340  GOTO 4380
-4350  C$="RED"
-4360  GOTO 4380
-4370  C$="YELLOW"
-4380  IF D[2] >= 0 THEN 4430
-4390  PRINT
-4400  PRINT "*** SHORT RANGE SENSORS ARE OUT ***"
-4410  PRINT
-4420  GOTO 4530
-4430  PRINT  USING 4540
-4440  PRINT  USING 4550;Q$[1,3],Q$[4,6],Q$[7,9],Q$[10,12],Q$[13,15],Q$[16,18],Q$[19,21],Q$[22,24]
-4450  PRINT  USING 4560;Q$[25,27],Q$[28,30],Q$[31,33],Q$[34,36],Q$[37,39],Q$[40,42],Q$[43,45],Q$[46,48],T
-4460  PRINT  USING 4570;Q$[49,51],Q$[52,54],Q$[55,57],Q$[58,60],Q$[61,63],Q$[64,66],Q$[67,69],Q$[70,72],C$
-4470  PRINT  USING 4580;R$[1,3],R$[4,6],R$[7,9],R$[10,12],R$[13,15],R$[16,18],R$[19,21],R$[22,24],Q1,Q2
-4480  PRINT  USING 4590;R$[25,27],R$[28,30],R$[31,33],R$[34,36],R$[37,39],R$[40,42],R$[43,45],R$[46,48],S1,S2
-4490  PRINT  USING 4600;R$[49,51],R$[52,54],R$[55,57],R$[58,60],R$[61,63],R$[64,66],R$[67,69],R$[70,72],E
-4500  PRINT  USING 4610;S$[1,3],S$[4,6],S$[7,9],S$[10,12],S$[13,15],S$[16,18],S$[19,21],S$[22,24],P
-4510  PRINT  USING 4620;S$[25,27],S$[28,30],S$[31,33],S$[34,36],S$[37,39],S$[40,42],S$[43,45],S$[46,48],S
-4520  PRINT  USING 4540
-4530  RETURN 
-4540  IMAGE  "---------------------------------"
-4550  IMAGE  8(X,3A)
-4560  IMAGE  8(X,3A),8X,"STARDATE",8X,5D
-4570  IMAGE  8(X,3A),8X,"CONDITION",8X,6A
-4580  IMAGE  8(X,3A),8X,"QUADRANT",9X,D,",",D
-4590  IMAGE  8(X,3A),8X,"SECTOR",11X,D,",",D
-4600  IMAGE  8(X,3A),8X,"ENERGY",9X,6D
-4610  IMAGE  8(X,3A),8X,"PHOTON TORPEDOES",3D
-4620  IMAGE  8(X,3A),8X,"SHIELDS",8X,6D
-4630  IF D[8] >= 0 THEN 4660
-4640  PRINT "COMPUTER DISABLED"
-4650  GOTO 1270
-4660  PRINT "COMPUTER ACTIVE AND AWAITING COMMAND";
-4670  INPUT A
-4680  GOTO A+1 OF 4740,4830,4880
-4690  PRINT "FUNCTIONS AVAILABLE FROM COMPUTER"
-4700  PRINT "   0 = CUMULATIVE GALACTIC RECORD"
-4710  PRINT "   1 = STATUS REPORT"
-4720  PRINT "   2 = PHOTON TORPEDO DATA"
-4730  GOTO 4660
-4740  PRINT  USING 4750;Q1,Q2
-4750  IMAGE  "COMPUTER RECORD OF GALAXY FOR QUADRANT ",D,",",D
-4760  PRINT  USING 5330
-4770  PRINT  USING 5360
-4780  FOR I=1 TO 8
-4790  PRINT  USING 5350;I,Z[I,1],Z[I,2],Z[I,3],Z[I,4],Z[I,5],Z[I,6],Z[I,7],Z[I,8]
-4800  PRINT  USING 5360
-4810  NEXT I
-4820  GOTO 1270
-4830  PRINT "\012   STATUS REPORT\012"
-4840  PRINT "NUMBER OF KLINGONS LEFT ="K9
-4850  PRINT "NUMBER OF STARDATES LEFT ="(T0+T9)-T
-4860  PRINT "NUMBER OF STARBASES LEFT ="B9
-4870  GOTO 3560
-4880  PRINT 
-4890  H8=0
-4900  FOR I=1 TO 3
-4910  IF K[I,3] <= 0 THEN 5260
-4920  C1=S1
-4930  A=S2
-4940  W1=K[I,1]
-4950  X=K[I,2]
-4960  GOTO 5010
-4970  PRINT  USING 4980;Q1,Q2,S1,S2
-4980  IMAGE  "YOU ARE AT QUADRANT ( ",D,",",D," )  SECTOR ( ",D,",",D," )"
-4990  PRINT "SHIP'S & TARGET'S COORDINATES ARE";
-5000  INPUT C1,A,W1,X
-5010  X=X-A
-5020  A=C1-W1
-5030  IF X<0 THEN 5130
-5040  IF A<0 THEN 5190
-5050  IF X>0 THEN 5070
-5060  IF A=0 THEN 5150
-5070  C1=1
-5080  IF ABS(A) <= ABS(X) THEN 5110
-5090  PRINT "DIRECTION ="C1+(((ABS(A)-ABS(X))+ABS(A))/ABS(A))
-5100  GOTO 5240
-5110  PRINT "DIRECTION ="C1+(ABS(A)/ABS(X))
-5120  GOTO 5240
-5130  IF A>0 THEN 5170
-5140  IF X=0 THEN 5190
-5150  C1=5
-5160  GOTO 5080
-5170  C1=3
-5180  GOTO 5200
-5190  C1=7
-5200  IF ABS(A) >= ABS(X) THEN 5230
-5210  PRINT "DIRECTION ="C1+(((ABS(X)-ABS(A))+ABS(X))/ABS(X))
-5220  GOTO 5240
-5230  PRINT "DIRECTION ="C1+(ABS(X)/ABS(A))
-5240  PRINT "DISTANCE ="(SQR(X^2+A^2))
-5250  IF H8=1 THEN 5320
-5260  NEXT I
-5270  H8=0
-5280  PRINT "DO YOU WANT TO USE THE CALCULATOR";
-5290  INPUT A$
-5300  IF A$="YES" THEN 4970
-5310  IF A$ <> "NO" THEN 5280
-5320  GOTO 1270
-5330  IMAGE  "     1     2     3     4     5     6     7     8"
-5340  IMAGE  "---------------------------------------------------"
-5350  IMAGE  D,8(3X,3D)
-5360  IMAGE  "   ----- ----- ----- ----- ----- ----- ----- -----"
-5370  IMAGE  " WARP ENGINES SHUTDOWN AT SECTOR ",D,",",D," DUE TO BAD NAVIGATION"
-5380  R1=INT(RND(1)*8+1)
-5390  R2=INT(RND(1)*8+1)
-5400  A$="   "
-5410  Z1=R1
-5420  Z2=R2
-5430  GOSUB 5680
-5440  IF Z3=0 THEN 5380
-5450  RETURN
-5460  FOR I=1 TO 11
-5470  PRINT
-5480  NEXT I
-5490  PRINT
-5500  RETURN
-5510  REM ******  INSERTION IN STRING ARRAY FOR QUADRANT ******
-5520  S8=Z1*24+Z2*3-26
-5530  IF S8>72 THEN 5560
-5540  Q$[S8,S8+2]=A$
-5550  GOTO 5600
-5560  IF S8>144 THEN 5590
-5570  R$[S8-72,S8-70]=A$
-5580  GOTO 5600
-5590  S$[S8-144,S8-142]=A$
-5600  RETURN
-5610  REM ****  PRINTS DEVICE NAME FROM ARRAY *****
-5620  S8=R1*12-11
-5630  IF S8>72 THEN 5660
-5640  PRINT D$[S8,S8+11];
-5650  GOTO 5670
-5660  PRINT E$[S8-72,S8-61];
-5670  RETURN
-5680  REM *******  STRING COMPARISON IN QUADRANT ARRAY **********
-5683  Z1=INT(Z1+.5)
-5686  Z2=INT(Z2+.5)
-5690  S8=Z1*24+Z2*3-26
-5700  Z3=0
-5710  IF S8>72 THEN 5750
-5720  IF Q$[S8,S8+2] <> A$ THEN 5810
-5730  Z3=1
-5740  GOTO 5810
-5750  IF S8>144 THEN 5790
-5760  IF R$[S8-72,S8-70] <> A$ THEN 5810
-5770  Z3=1
-5780  GOTO 5810
-5790  IF S$[S8-144,S8-142] <> A$ THEN 5810
-5800  Z3=1
-5810  RETURN
-5820  PRINT "     INSTRUCTIONS:"
-5830  PRINT "<*> = ENTERPRISE"
-5840  PRINT "+++ = KLINGON"
-5850  PRINT ">!< = STARBASE"
-5860  PRINT " *  = STAR"
-5870  PRINT "COMMAND 0 = WARP ENGINE CONTROL"
-5880  PRINT "  'COURSE' IS IN A CIRCULAR NUMERICAL          4  3  2"
-5890  PRINT "  VECTOR ARRANGEMENT AS SHOWN.                  \ ^ /"
-5900  PRINT "  INTERGER AND REAL VALUES MAY BE                \^/"
-5910  PRINT "  USED.  THEREFORE COURSE 1.5 IS              5 ----- 1"
-5920  PRINT "  HALF WAY BETWEEN 1 AND 2.                      /^\"
-5930  PRINT "                                                / ^ \"
-5940  PRINT "  A VECTOR OF 9 IS UNDEFINED, BUT              6  7  8"
-5950  PRINT "  VALUES MAY APPROACH 9."
-5960  PRINT "                                               COURSE"
-5970  PRINT "  ONE 'WARP FACTOR' IS THE SIZE OF"
-5980  PRINT "  ONE QUADRANT.  THEREFORE TO GET"
-5990  PRINT "  FROM QUADRANT 6,5 TO 5,5 YOU WOULD"
-6000  PRINT "  USE COURSE 3, WARP FACTOR 1"
-6010  PRINT "COMMAND 1 = SHORT RANGE SENSOR SCAN"
-6020  PRINT "  PRINTS THE QUADRANT YOU ARE CURRENTLY IN, INCLUDING"
-6030  PRINT "  STARS, KLINGONS, STARBASES, AND THE ENTERPRISE; ALONG"
-6040  PRINT "  WITH OTHER PERTINATE INFORMATION."
-6050  PRINT "COMMAND 2 = LONG RANGE SENSOR SCAN"
-6060  PRINT "  SHOWS CONDITIONS IN SPACE FOR ONE QUADRANT ON EACH SIDE"
-6070  PRINT "  OF THE ENTERPRISE IN THE MIDDLE OF THE SCAN.  THE SCAN"
-6080  PRINT "  IS CODED IN THE FORM XXX, WHERE THE UNITS DIGIT IS THE"
-6090  PRINT "  NUMBER OF STARS, THE TENS DIGIT IS THE NUMBER OF STAR-"
-6100  PRINT "  BASES, THE HUNDREDS DIGIT IS THE NUMBER OF KLINGONS."
-6110  PRINT "COMMAND 3 = PHASER CONTROL"
-6120  PRINT "  ALLOWS YOU TO DESTROY THE KLINGONS BY HITTING HIM WITH"
-6130  PRINT "  SUITABLY LARGE NUMBERS OF ENERGY UNITS TO DEPLETE HIS "
-6140  PRINT "  SHIELD POWER.  KEEP IN MIND THAT WHEN YOU SHOOT AT"
-6150  PRINT "  HIM, HE GONNA DO IT TO YOU TOO."
-6160  PRINT "COMMAND 4 = PHOTON TORPEDO CONTROL"
-6170  PRINT "  COURSE IS THE SAME AS USED IN WARP ENGINE CONTROL"
-6180  PRINT "  IF YOU HIT THE KLINGON, HE IS DESTROYED AND CANNOT FIRE"
-6190  PRINT "  BACK AT YOU.  IF YOU MISS, HE WILL SHOOT HIS PHASERS AT"
-6200  PRINT "  YOU."
-6210  PRINT "   NOTE: THE LIBRARY COMPUTER (COMMAND 7) HAS AN OPTION"
-6220  PRINT "   TO COMPUTE TORPEDO TRAJECTORY FOR YOU (OPTION 2)."
-6230  PRINT "COMMAND 5 = SHIELD CONTROL"
-6240  PRINT "  DEFINES NUMBER OF ENERGY UNITS TO BE ASSIGNED TO SHIELDS"
-6250  PRINT "  ENERGY IS TAKEN FROM TOTAL SHIP'S ENERGY."
-6260  PRINT "COMMAND 6 = DAMAGE CONTROL REPORT"
-6270  PRINT "  GIVES STATE OF REPAIRS OF ALL DEVICES.  A STATE OF REPAIR"
-6280  PRINT "  LESS THAN ZERO SHOWS THAT THAT DEVICE IS TEMPORARALY"
-6290  PRINT "  DAMAGED."
-6300  PRINT "COMMAND 7 = LIBRARY COMPUTER"
-6310  PRINT "  THE LIBRARY COMPUTER CONTAINS THREE OPTIONS:"
-6320  PRINT "    OPTION 0 = CUMULATIVE GALACTIC RECORD"
-6330  PRINT "     SHOWS COMPUTER MEMORY OF THE RESULTS OF ALL PREVIOUS"
-6340  PRINT "     LONG RANGE SENSOR SCANS"
-6350  PRINT "    OPTION 1 = STATUS REPORT"
-6360  PRINT "     SHOWS NUMBER OF KLINGONS, STARDATES AND STARBASES"
-6370  PRINT "     LEFT."
-6380  PRINT "    OPTION 2 = PHOTON TORPEDO DATA"
-6390  PRINT "     GIVES TRAJECTORY AND DISTANCE BETWEEN THE ENTERPRISE"
-6400  PRINT "     AND ALL KLINGONS IN YOUR QUADRANT"
-6410  RETURN
-6420  END