summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosip Rodin <jrodin@jagor.srce.hr>1999-06-06 21:01:50 +0200
committerJosip Rodin <jrodin@jagor.srce.hr>1999-06-06 21:01:50 +0200
commit81cc1f8628fe001323a2a501b800b6d89462f3cd (patch)
tree616e4be21d0a347e972742c57e6897270a42bfc7
Import lrzsz_0.12.21.orig.tar.gz
[dgit import orig lrzsz_0.12.21.orig.tar.gz]
-rw-r--r--ABOUT-NLS225
-rw-r--r--AUTHORS5
-rw-r--r--COMPATABILITY25
-rw-r--r--COPYING340
-rw-r--r--CVS/Entries45
-rw-r--r--CVS/Repository1
-rw-r--r--CVS/Root1
-rw-r--r--ChangeLog1286
-rw-r--r--INSTALL236
-rw-r--r--Makefile.am78
-rw-r--r--Makefile.in464
-rw-r--r--NEWS247
-rw-r--r--README39
-rw-r--r--README-alpha6
-rw-r--r--README.cvs16
-rw-r--r--README.gettext57
-rw-r--r--README.isdn4linux9
-rw-r--r--README.systems29
-rw-r--r--README.tests19
-rw-r--r--Specfile.in84
-rw-r--r--THANKS5
-rw-r--r--TODO13
-rw-r--r--acconfig.h76
-rw-r--r--acinclude.m495
-rw-r--r--aclocal.m4719
-rw-r--r--beos-runpiped.c60
-rwxr-xr-xbuildrpm21
-rwxr-xr-xcheck.lrzsz793
-rwxr-xr-xconfig.guess600
-rw-r--r--config.h.in344
-rwxr-xr-xconfig.sub867
-rwxr-xr-xconfigure5329
-rw-r--r--configure.in281
-rw-r--r--debian/CVS/Entries1
-rw-r--r--debian/CVS/Repository1
-rw-r--r--debian/CVS/Root1
-rwxr-xr-xfastcheck.beos71
-rwxr-xr-xfastcheck.sh72
-rwxr-xr-xinstall-sh238
-rw-r--r--intl/CVS/Entries24
-rw-r--r--intl/CVS/Repository1
-rw-r--r--intl/CVS/Root1
-rw-r--r--intl/ChangeLog1022
-rw-r--r--intl/Makefile.in214
-rw-r--r--intl/VERSION1
-rw-r--r--intl/bindtextdom.c199
-rw-r--r--intl/cat-compat.c262
-rw-r--r--intl/dcgettext.c593
-rw-r--r--intl/dgettext.c59
-rw-r--r--intl/explodename.c181
-rw-r--r--intl/finddomain.c189
-rw-r--r--intl/gettext.c70
-rw-r--r--intl/gettext.h105
-rw-r--r--intl/gettextP.h73
-rw-r--r--intl/hash-string.h63
-rw-r--r--intl/intl-compat.c76
-rw-r--r--intl/l10nflist.c409
-rw-r--r--intl/libgettext.h182
-rw-r--r--intl/linux-msg.sed100
-rw-r--r--intl/loadinfo.h58
-rw-r--r--intl/loadmsgcat.c199
-rw-r--r--intl/localealias.c378
-rw-r--r--intl/po2tbl.sed.in102
-rw-r--r--intl/textdomain.c106
-rw-r--r--intl/xopen-msg.sed104
-rw-r--r--lib/CVS/Entries28
-rw-r--r--lib/CVS/Repository1
-rw-r--r--lib/CVS/Root1
-rw-r--r--lib/Makefile.am15
-rw-r--r--lib/Makefile.in403
-rw-r--r--lib/alloca.c499
-rw-r--r--lib/ansi2knr.136
-rw-r--r--lib/ansi2knr.c568
-rw-r--r--lib/error.c210
-rw-r--r--lib/error.h65
-rw-r--r--lib/getopt.c770
-rw-r--r--lib/getopt.h129
-rw-r--r--lib/getopt1.c180
-rw-r--r--lib/long-options.c83
-rw-r--r--lib/long-options.h10
-rw-r--r--lib/mkdir.c97
-rw-r--r--lib/mktime.c529
-rw-r--r--lib/stpcpy.c32
-rw-r--r--lib/strdup.c39
-rw-r--r--lib/strerror.c22
-rw-r--r--lib/strftime.c891
-rw-r--r--lib/strpbrk.c39
-rw-r--r--lib/strstr.c44
-rw-r--r--lib/strtol.c362
-rw-r--r--lib/strtoul.c22
-rw-r--r--lib/vasprintf.c194
-rw-r--r--lib/xstrtol.c180
-rw-r--r--lib/xstrtol.h66
-rw-r--r--lib/xstrtoul.c2
-rw-r--r--lib/xstrtoul.h7
-rw-r--r--man/CVS/Entries5
-rw-r--r--man/CVS/Repository1
-rw-r--r--man/CVS/Root1
-rw-r--r--man/Makefile.am3
-rw-r--r--man/Makefile.in247
-rw-r--r--man/lrz.1514
-rw-r--r--man/lsz.1688
-rwxr-xr-xmissing134
-rwxr-xr-xmkinstalldirs34
-rw-r--r--po/CVS/Entries9
-rw-r--r--po/CVS/Repository1
-rw-r--r--po/CVS/Root1
-rw-r--r--po/ChangeLog147
-rw-r--r--po/Makefile.in.in247
-rw-r--r--po/POTFILES.in6
-rw-r--r--po/cat-id-tbl.c233
-rw-r--r--po/de.gmobin0 -> 20972 bytes
-rw-r--r--po/de.po812
-rw-r--r--po/lrzsz.pot694
-rw-r--r--po/stamp-cat-id1
-rw-r--r--rpmrc5
-rw-r--r--src/CVS/Entries21
-rw-r--r--src/CVS/Repository1
-rw-r--r--src/CVS/Root1
-rw-r--r--src/Makefile.am39
-rw-r--r--src/Makefile.in439
-rw-r--r--src/ansi2knr.136
-rw-r--r--src/ansi2knr.c568
-rw-r--r--src/canit.c46
-rw-r--r--src/crctab.c140
-rw-r--r--src/lrz.c2314
-rwxr-xr-xsrc/lrzszbug.in245
-rw-r--r--src/lsyslog.c81
-rw-r--r--src/lsz.c2493
-rw-r--r--src/protname.c41
-rw-r--r--src/rbsb.c506
-rw-r--r--src/tcp.c169
-rw-r--r--src/timing.c186
-rw-r--r--src/timing.h1
-rw-r--r--src/zglobal.h463
-rw-r--r--src/zm.c982
-rw-r--r--src/zmodem.h142
-rw-r--r--src/zperr.c113
-rw-r--r--src/zreadline.c136
-rw-r--r--stamp-h.in1
-rw-r--r--systype.in211
-rw-r--r--testsuite/CVS/Entries5
-rw-r--r--testsuite/CVS/Repository1
-rw-r--r--testsuite/CVS/Root1
-rw-r--r--testsuite/Makefile.am13
-rw-r--r--testsuite/Makefile.in246
-rw-r--r--testsuite/config/CVS/Entries2
-rw-r--r--testsuite/config/CVS/Repository1
-rw-r--r--testsuite/config/CVS/Root1
-rw-r--r--testsuite/config/unix.exp8
-rw-r--r--testsuite/lib/CVS/Entries2
-rw-r--r--testsuite/lib/CVS/Repository1
-rw-r--r--testsuite/lib/CVS/Root1
-rw-r--r--testsuite/lib/lrzsz.exp364
-rw-r--r--testsuite/lrzsz/CVS/Entries18
-rw-r--r--testsuite/lrzsz/CVS/Repository1
-rw-r--r--testsuite/lrzsz/CVS/Root1
-rw-r--r--testsuite/lrzsz/abuse.exp13
-rw-r--r--testsuite/lrzsz/command.exp75
-rw-r--r--testsuite/lrzsz/compatability.exp68
-rw-r--r--testsuite/lrzsz/crc.exp245
-rw-r--r--testsuite/lrzsz/manage.exp121
-rw-r--r--testsuite/lrzsz/newer.exp130
-rw-r--r--testsuite/lrzsz/null.exp32
-rw-r--r--testsuite/lrzsz/path.exp21
-rw-r--r--testsuite/lrzsz/resume.exp9
-rw-r--r--testsuite/lrzsz/timing.exp20
-rw-r--r--testsuite/lrzsz/uppercase.exp19
-rw-r--r--testsuite/lrzsz/window.exp14
-rw-r--r--testsuite/lrzsz/xmodem.exp14
-rw-r--r--testsuite/lrzsz/ymodem.exp9
-rw-r--r--testsuite/lrzsz/zmodem-crc16.exp9
-rw-r--r--testsuite/lrzsz/zmodem-escape.exp12
-rw-r--r--testsuite/lrzsz/zmodem.exp33
174 files changed, 37762 insertions, 0 deletions
diff --git a/ABOUT-NLS b/ABOUT-NLS
new file mode 100644
index 0000000..dacb8b1
--- /dev/null
+++ b/ABOUT-NLS
@@ -0,0 +1,225 @@
+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 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 at translations should 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.
+
+One advise in advance
+=====================
+
+ 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 or message inheritance) 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'.
+
+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 provides
+usable `catgets' (if using this is selected by the installer) or
+`gettext' functions. If neither is available, the GNU `gettext' own
+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 --with-catgets
+ ./configure --disable-nls
+
+will respectively bypass any pre-existing `catgets' or `gettext' to use
+the internationalizing routines provided within this package, enable
+the use of the `catgets' functions (if found on the locale system), 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 be not what is 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.
+
+ By default the configuration process will not test for the `catgets'
+function and therefore they will not be used. The reasons are already
+given above: the emulation on top of `catgets' cannot provide all the
+extensions provided by the GNU `gettext' library. If you nevertheless
+want to use the `catgets' functions use
+
+ ./configure --with-catgets
+
+to enable the test for `catgets' (this causes no harm if `catgets' is
+not available on your system). If you really select this option we
+would like to hear about the reasons because we cannot think of any
+good one ourself.
+
+ Internationalized packages have usually 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.
+
+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
+ISO 639 `LL' two-letter code prior to using the programs in the
+package. For example, let's suppose that you speak German. At the
+shell prompt, merely execute `setenv LANG de' (in `csh'),
+`export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This
+can be done from your `.login' or `.profile' file, once and for all.
+
+ An operating system might already offer message localization for
+many of its programs, while other programs have been installed locally
+with the full capabilities of GNU `gettext'. Just using `gettext'
+extended syntax for `LANG' would break proper localization of already
+available operating system programs. In this case, users should set
+both `LANGUAGE' and `LANG' variables in their environment, as programs
+using GNU `gettext' give preference to `LANGUAGE'. For example, some
+Swedish users would rather read translations in German than English for
+when Swedish is not available. This is easily accomplished by setting
+`LANGUAGE' to `sv:de' while leaving `LANG' to `sv'.
+
+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, courtesy of Linux
+International. You may reach your translation team at the address
+`LL@li.org', replacing LL by the two-letter ISO 639 code for your
+language. Language codes are *not* the same as the country codes given
+in ISO 3166. The following translation teams exist, as of August 1997:
+
+ Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en',
+ Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian
+ `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja',
+ Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish
+ `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es',
+ Swedish `sv', and Turkish `tr'.
+
+For example, you may reach the Chinese translation team by writing to
+`zh@li.org'.
+
+ 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.
+
+Available Packages
+==================
+
+ Languages are not equally supported in all packages. The following
+matrix shows the current state of internationalization, as of August
+1997. The matrix shows, in regard of each package, for which languages
+PO files have been submitted to translation coordination.
+
+ Ready PO files cs da de en es fi fr it ja ko nl no pl pt sl sv
+ .-------------------------------------------------.
+ bash | [] [] [] | 3
+ bison | [] [] [] | 3
+ clisp | [] [] [] [] | 4
+ cpio | [] [] [] [] [] | 5
+ diffutils | [] [] [] [] [] | 5
+ enscript | [] [] [] [] [] [] | 6
+ fileutils | [] [] [] [] [] [] [] [] [] [] | 10
+ findutils | [] [] [] [] [] [] [] [] | 8
+ flex | [] [] [] [] | 4
+ gcal | [] [] [] [] [] | 5
+ gettext | [] [] [] [] [] [] [] [] [] [] | 11
+ grep | [] [] [] [] [] [] [] [] [] | 9
+ hello | [] [] [] [] [] [] [] [] [] [] | 10
+ id-utils | [] [] [] | 3
+ indent | [] [] [] [] | 4
+ libc | [] [] [] [] [] [] [] | 7
+ m4 | [] [] [] [] [] | 5
+ make | [] [] [] [] [] [] | 6
+ music | [] [] | 2
+ ptx | [] [] [] [] [] [] [] [] | 8
+ recode | [] [] [] [] [] [] [] [] [] | 9
+ sh-utils | [] [] [] [] [] [] [] | 7
+ sharutils | [] [] [] [] [] | 5
+ tar | [] [] [] [] [] [] [] [] [] [] | 10
+ texinfo | [] | 1
+ textutils | [] [] [] [] [] [] [] [] [] | 9
+ wdiff | [] [] [] [] [] [] [] [] | 8
+ `-------------------------------------------------'
+ 16 languages cs da de en es fi fr it ja ko nl no pl pt sl sv
+ 27 packages 3 2 24 1 17 1 26 2 1 11 20 9 19 7 7 17 167
+
+ 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 August 1997 seems to be old, you may fetch a more recent copy of
+this `ABOUT-NLS' file on most GNU archive sites.
+
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..d648cc7
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,5 @@
+Chuck Forsberg: original rz and sz programs (Public domain version)
+Matt Porter <porter+@osu.edu>: Modification for versions 0.10 und 0.11
+mblack@csihq.com: Modifications for version 0.12a
+Uwe Ohse <uwe@ohse.de>: Modifications for 0.12b und 0.12.*
+
diff --git a/COMPATABILITY b/COMPATABILITY
new file mode 100644
index 0000000..94ffb7c
--- /dev/null
+++ b/COMPATABILITY
@@ -0,0 +1,25 @@
+ZModem standard:
+ lrzsz is compatible with standard zmodem as long as you don't use
+ certain options:
+ -8 is incompatible with the standard, but should work with most
+ DOS/Atari/Amiga ZModems. It's a common extension, but a dangerous
+ one. Do not use it unless you know that the receiver can handle it.
+ -S is incompatible with certain ZModems which use the TIMESYNC bit
+ for other purposes (timesync is a protocol extension by Peter
+ Mandrella, read timesync.doc for more information). The default
+ is to disable timesync, you must use the `S' option to enable it.
+
+
+Calling conventions:
+ lrzsz is not fully compatible with older UNIX ZModems:
+ - PUBDIR (/var/spool/uucppublic) is normally disabled. If you like
+ public writable directories please use:
+ configure --enable-pubdir=/var/spool/uucppublic
+ - lrz defaults to restricted mode, in which the sender must not upload
+ any files outside the working directory or PUBDIR (if pubdir is
+ enabled). With the old version you had to set SHELL=rsh.
+ For more information read the SECURITY paragraph in lrz.1.
+ - lrz: remote command execution is disabled. To enable it use -C (but
+ be careful - the sender might delete all your files).
+ - lrz: does not set executable bits for any files it received under
+ a restricted shell.
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..60549be
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/CVS/Entries b/CVS/Entries
new file mode 100644
index 0000000..05f3535
--- /dev/null
+++ b/CVS/Entries
@@ -0,0 +1,45 @@
+/ABOUT-NLS/1.1.1.3/Sun Apr 26 13:22:30 1998/-ko/
+/AUTHORS/1.2/Sun Aug 22 18:51:20 1999/-ko/
+/COMPATABILITY/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/COPYING/1.1.1.2/Sun Apr 26 13:22:21 1998/-ko/
+/ChangeLog/1.20/Sun Aug 22 18:51:20 1999/-ko/
+/INSTALL/1.3/Fri Apr 9 21:23:35 1999/-ko/
+/Makefile.am/1.11/Sat Feb 6 22:02:31 1999/-ko/
+/Makefile.in/1.14/Sun Aug 22 19:59:08 1999/-ko/
+/NEWS/1.5/Wed Dec 30 17:20:33 1998/-ko/
+/README/1.4/Wed Dec 30 17:20:33 1998/-ko/
+/README-alpha/1.2/Sun Apr 26 13:26:15 1998/-ko/
+/README.cvs/1.3/Wed Dec 30 17:20:33 1998/-ko/
+/README.gettext/1.2/Wed Dec 30 17:20:34 1998/-ko/
+/README.isdn4linux/1.1/Wed Jul 8 15:46:11 1998/-ko/
+/README.systems/1.2/Sun Aug 22 19:59:08 1999/-ko/
+/README.tests/1.2/Wed Dec 30 17:20:34 1998/-ko/
+/Specfile.in/1.2/Wed Dec 30 17:20:34 1998/-ko/
+/THANKS/1.1.1.1/Sun Apr 26 13:22:31 1998/-ko/
+/TODO/1.2/Wed Dec 30 17:20:35 1998/-ko/
+/acconfig.h/1.6/Sun Aug 22 19:59:08 1999/-ko/
+/acinclude.m4/1.4/Sun Aug 22 19:59:08 1999/-ko/
+/aclocal.m4/1.9/Sun Aug 22 19:59:08 1999/-ko/
+/beos-runpiped.c/1.1/Tue Dec 29 09:39:10 1998/-ko/
+/buildrpm/1.1/Mon Dec 21 23:21:08 1998/-ko/
+/check.lrzsz/1.6/Sun Aug 22 19:01:20 1999/-ko/
+/config.guess/1.1.1.2/Sun Apr 26 13:20:59 1998/-ko/
+/config.h.in/1.13/Sun Aug 22 19:59:08 1999/-ko/
+/config.sub/1.1.1.2/Sun Apr 26 13:20:59 1998/-ko/
+/configure/1.18/Sun Aug 22 19:59:08 1999/-ko/
+/configure.in/1.16/Sun Aug 22 19:59:09 1999/-ko/
+/fastcheck.beos/1.1/Wed Dec 30 11:21:48 1998/-ko/
+/fastcheck.sh/1.1/Tue Dec 29 09:36:32 1998/-ko/
+/install-sh/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/missing/1.1.1.1/Sun Apr 26 13:22:23 1998/-ko/
+/mkinstalldirs/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/rpmrc/1.1/Mon Dec 21 23:21:09 1998/-ko/
+/stamp-h.in/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/systype.in/1.8/Wed Dec 30 10:33:37 1998/-ko/
+D/debian////
+D/intl////
+D/lib////
+D/man////
+D/po////
+D/src////
+D/testsuite////
diff --git a/CVS/Repository b/CVS/Repository
new file mode 100644
index 0000000..292099c
--- /dev/null
+++ b/CVS/Repository
@@ -0,0 +1 @@
+lrzsz
diff --git a/CVS/Root b/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..233715c
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,1286 @@
+1998-06-15 Uwe Ohse <uwe@ohse.de>
+
+ * src/rbsb.c (io_mode), case 1:
+ disable IEXTEN, from Usman Muzaffar <usman@thynne.psych.nwu.edu>.
+
+1998-06-15 Uwe Ohse <uwe@ohse.de>
+
+ * src/lsz.c: Transfering 0 byte files with Zmodem made lsz crash.
+
+1998-06-03 Uwe Ohse <uwe@ohse.de>
+
+ * update to automake-1.4, autoconf-2.13.
+
+ * configure.in:
+ - version number set to 0.12.21
+ - Threw out explicit AC_LINK_FILES statement in configure.in.
+
+1998-03-21 Uwe Ohse <uwe@ohse.de>
+ * configure.in, aclocal.m4: check for socklen_t.
+ * check.lrzsz: threw out tcp inband checks.
+ * src/lrz.c: threw out tcp inband stuff (--tcp). The only
+ user doesn't need it anymore.
+ changed static SEGMENTS buffer to dynamic allocation.
+ make some global variables static.
+ * src/lsz.c: threw out tcp inband stuff (--tcp). The only
+ user doesn't need it anymore.
+ allocate receive-buffer dynamically.
+ * src/tcp.c: change a size_t to socklen_t.
+ * zm.c: prototype for zsendline_s.
+
+1998-02-06 Uwe Ohse <uwe@ohse.de>
+
+ * debian/*
+ * Makefile.am:
+ * configure.in:
+ removed support for debian, on mail from
+ Josip Rodin <joy@cibalia.gkvk.hr>.
+
+1998-12-29 Uwe Ohse <uwe@ohse.de>
+
+ * src/lrz.c: removed stpcpy call.
+ got rid of warnings on solaris (isXXXXX treating
+ arguments as signed, size_t is not of "long" size).
+
+ * src/lsz.c: removed stpcpy calls.
+ got rid of warnings on solaris (isXXXXX treating
+ arguments as signed, size_t is not of "long" size).
+ (wcs): has another argument "filename on remote
+ site".
+ (wcsend): if no timezone variable was found the printf was
+ called with to few arguments for the format.
+ (send_pseudo): removed major/minor security problem (major,
+ though nobody used that code, so it in fact was minor),
+ stupid usage of /tmp.
+ damned, i thought i had done that _long_ ago?
+
+ * src/lsyslog.c (lsyslog): special code for varargs.
+
+ * src/zm.c: threw out prototype for zsendline_s().
+
+ * src/rbsb.c: moved getspeed() and speeds table
+ upwards.
+
+ * systype.in: realname can be given on the command line.
+
+ * configure.in: use LOG_USER in case LOG_UUCP is undefined.
+ check for libnsl (slowlaris).
+
+ * README.tests: new
+
+ * Makefile.am: support for fastcheck, fastcheck-beos,
+ "make success".
+
+ * beos-runpiped.c: new file.
+
+1998-12-28 Uwe Ohse <uwe@ohse.de>
+
+ * src/canit.c: new file.
+
+ * src/zglobal.h: canit() prototype.
+ declare "struct termios;" before including termios.h
+ on svr3, to get rid of warnings.
+
+ * src/lsz.c (canit): deleted.
+ (everythere): replaced invocation of canit() with
+ canit(fd).
+
+ * src/lrz.c (canit): deleted.
+ (everythere): replaced invocation of canit() with
+ canit(fd).
+
+ * src/Makefile.am: added -DLOCALEDIR=... to DEFS
+
+ * acconfig.h: threw out LOCALEDIR. Gives redefinition
+ warnings in intl directory.
+
+ * configure.in: --enable-syslog=LOG_UUCP is now
+ default.
+
+ * src/tcp.c (tcp_connect): get rid of "signed/unsigned"
+ warning and "array subscript is of type char" warning
+ on isspace().
+
+1998-12-27 Uwe Ohse <uwe@ohse.de>
+
+ * Makefile.am: distribute systype.in
+
+ * acinclude.m4: new macro lrzsz_HEADER_SYS_SELECT
+ (can sys/time.h and sys/select.h both be used)
+
+ * acconfig.h: define SYS_TIME_WITHOUT_SYS_SELECT
+
+ * check.lrzsz: check for emacs sources slightly
+ changed to work ...
+
+ * configure.in: create "systype" script, use
+ lrzsz_HEADER_SYS_SELECT
+
+ * lib/Makefile.am: use ansi2knr.
+
+ * lib/ansi2knr.c:
+ * src/ansi2knr.c: updated to automake-1.3 version,
+ implemented workaround for automake stupidity.
+
+ * src/lrz.c (do_crc_check): changed formatting.
+
+ * src/zglobal.h: use SYS_TIME_WITHOUT_SYS_SELECT.
+
+ * zperr.c: provide K&R style function definitions.
+
+1998-12-23 Uwe Ohse <uwe@ohse.de>
+
+ * src/rbsb.c (rdchk): the read() version3
+ was buggy, didn't return 0 on EWOULDBLOCK.
+ That's a really long-standing problem ...
+
+ * src/tcp.c: include arpa/inet.h only if it exists.
+
+ * src/zglobal.h: include <socket.h> on BeOS to get
+ fd_set.
+
+1998-12-22 Uwe Ohse <uwe@ohse.de>
+
+ * src/lsz.c (main): got rid of CPU and OS.
+ (usage): got rid of CPU and OS.
+
+ * src/lrz.c (main): got rid of CPU and OS.
+ (usage): got rid of CPU and OS.
+
+ * acconfig.h: got rid of CPU and OS.
+
+ * configure.in: don't call AC_CANONICAL_HOST
+ anymore.
+
+1998-12-21 Uwe Ohse <uwe@ohse.de>
+
+ * configure.in: PUBDIR was handled incorrectly.
+ Thanks to Stanislav Brabec <utx@k332.feld.cvut.cz>.
+
+ * buildrpm, Specfile.in, rpmrc: new files.
+
+ * Makefile.am: support rpm stuff.
+
+ * src/lsz.c (main): start_blklen by default is not
+ longer then framlength (except if luser personally
+ decides to use both -4/-8 and -l).
+ (getzrxinit): minor cleanup.
+ (getzrxinit): test for S_ISCHR was reversed.
+ Thanks to Nick Rossi <voyager@eskimo.com>.
+
+ * src/lrz.c (main): use umask().
+
+1998-10-22 Uwe Ohse <uwe@ohse.de>
+
+ * src/lrz.c (procheader): removed warnings about unused
+ variable e (used only if #ifdef ENABLE_SYSLOG).
+
+ * src/lsyslog.c (lsyslog): removed warnings about unused
+ arguments if not defined ENABLE_SYSLOG.
+
+1998-08-18 Uwe Ohse <uwe@ohse.de>
+
+ * src/lsz.c (wcputsec): don't say "Ymodem" if running as
+ Xmodem.
+
+ * changed version number to 0.12.20.
+
+ * src/lsz.c (getzrxinit): throw out purgeline() again.
+ This causes selftest to break, and also other zmodems.
+ Slightly modified the logic to resend a zrqinit.
+ (getnak): Slightly modified the logic to resend a zrqinit.
+ Maybe the real solution is to throw out the resending
+ of ZRQINITs ... as omen doesn't do it, too, although
+ it's documented in the protocol.
+
+1998-07-25 Uwe Ohse <uwe@ohse.de>
+
+ * src/lsz.c (getzrxinit): calling purgeline() at start
+ solves Stefan Glasers problems (internal connect zmodem,
+ slow startup with other zmodems). Also: don't send a
+ second ZRQINIT directly after the first one.
+ (getnak): don't send a second ZRQINIT directly after
+ the first one.
+
+1998-07-08 Uwe Ohse <uwe@ohse.de>
+
+ * README.isdn4linux: new file.
+
+1998-03-13 Uwe Ohse <uwe@ohse.de>
+
+ * src/tcp.c: #define INADDR_NONE if it is undefined
+
+1998-01-18 Uwe Ohse <uwe@ohse.de>
+
+ * src/lrz.c (show_version): new function.
+ (main) call parse_long_options() with only 4 arguments.
+ didn't wrap all mmap-specifics in #ifdef HAVE_MMAP.
+
+ * src/lsz.c (show_version): new function.
+ (main) call parse_long_options() with only 4 arguments.
+ didn't wrap all mmap-specifics in #ifdef HAVE_MMAP.
+
+ * configure.in: vasprintf should not only be checked for
+ but replaced of needed.
+
+ * lib/long-options.c
+ * lib/long-options.h
+ new versions with only 4 arguments.
+
+1998-01-03 Philippe De Muyter <phdm@macqel.be>
+
+ * src/lsz.c (zfilbuf): Look ahead for one char, to set eof_seen early
+ and to avoid yielding 0 at the end of file.
+
+1997-12-14 Uwe Ohse <uwe@ohse.de>
+
+ * src/lrz.c (do_crc_check): removed warnings.
+ (procheader): removed warnings.
+ (procheader): stupic bug: "&~1024" should have been "&~1023" to
+ get block start aligned to whole kilobytes.
+ global: moved DO_SYSLOG definition, renamed it to DO_SYSLOG_FNAME,
+ replaced some lsyslog-Calls with new macro DO_SYSLOG.
+
+ * src/lsz.c (struct long_option): --immediate-command should have
+ used shortopt `i', but used `c'.
+
+ applied patch from Philippe De Muyter <phdm@macqel.be>, original date
+ 1997-11-20:
+ * aclocal.m4 (LRZSZ_TYPE_SPEED_T): Really look for speed_t, not $1.
+ * acconfig.h (speed_t): New define slot; replaces LRZSZ_TYPE_SPEED_T.
+
+1997-12-13 Uwe Ohse <uwe@ohse.de>
+
+ * src/lsz.c: new option --check-crc (implement ZMCRC option),
+ use ZMCRC if --resume is given twice.
+ (getzrxinit) Oops. Canseek was set incorrectly if S_ISREG
+ was defined.
+ (zsendfile): ZCRC-Code needed debugging. munmap added.
+
+ * src/lrz.c: new option --check-crc (implement ZMCRC option),
+ use ZMCRC if --resume is given twice.
+ (procheader) implement ZMCRC.
+ (do_crc_check) new function.
+
+1997-12-09 Uwe Ohse <uwe@ohse.de>
+
+ * src/lrz.c (procheader): implement --newer and --newer-or-longer
+ option, which Chuck Forsberg must have forgotten to implement in
+ rz (sz did know about them).
+ implement a --junk-path option - junks the paths of the files,
+ removing directory part of a file name.
+ (main): implement command line switches for the options.
+
+1997-12-08 Uwe Ohse <uwe@ohse.de>
+
+ * src/lrz.c (main): oops. --rename included Zctlesc ...
+ catch SIGPIPE.
+ (global): new variable skip_if_not_found.
+ (procheader): use "r+" fopen()-mode if "skip_if_not_found" is set.
+ if fopen() fails tell that to syslog.
+ (tryz): set skip_of_not_found if ZF1_ZMSKNOLOC is received (this
+ fixes the "--overwrite-or-skip" option)
+ don't use "Zctlesc = TESCCTL & Rxhdr[ZF0];", use "|=" instead.
+
+ * src/lsz.c (main): catch SIGPIPE,SIGHUP.
+ (global): new variable/option "--no-unixmode". This is needed to
+ check the "keep-uppercase" option.
+ (getzrxinit): call "zsendline_init" to reinitialize escape table
+ if receiver told us to escape control chars (fixes "rz --escape").
+
+1997-12-07 Uwe Ohse <uwe@ohse.de>
+
+ * src/zm.c (zsda32): crashed if sending packet with 0 bytes data.
+
+1997-11-07 Uwe Ohse <uwe@ohse.de>
+
+ * configure.in: changed version number to 0.12.18.
+
+ * src/zm.c: remove #include <syslog.h>
+ (zgethdr): removed warnings.
+ (noxrd7,tgeth1, zgethex): reordered to help
+ gcc inline them.
+
+ * src/lsz.c (main): removed unused variable `s'.
+
+ * src/zglobal.h: remove define for syslog().
+
+ * src/zm.c (printout_blocksizes):
+ * src/lrz.c (wcreceive): (DO_SYSLOG): (rzfile):
+ * src/lsz.c (DO_SYSLOG): (wcs):
+ use lsyslog instead of syslog.
+
+ * src/Makefile.am (lsz_SOURCES and lrz_SOURCES): include lsyslog.c.
+
+ * configure.in (AC_CHECK_FUNCS): check for vasprintf.c
+ (elsewhere): changed tirka.gun.de hacks to tirka.ohse.de.
+
+ * lib/Makefile.am (EXTRA_DIST): include vasprintf.c
+
+ * src/lsyslog.c (lsyslog): new file.
+
+Sun Sep 14 08:07:52 MET DST 1997
+
+ * Makefile.am: add lrzszbug to DISTCLEAN_FILES
+
+ * src/zreadline.c (readline):
+ optimize for calling from READLINE_PF.
+ get rid of some vprintf.
+ rename to readline_internal (should only be called
+ from READLINE_PF).
+
+ * src/zglobal.h: rename readline to readline_internal.
+
+ * src/zm.c (noxrd7): use READLINE_PF, not readline.
+ (zgethdr) likewise.
+ (zrhhdr): likewise.
+
+ * src/lrz.c (wcrxpn): use READLINE_PF, not readline.
+ (wcgetsec): likewise.
+ (ackbibi): likewise.
+ (global) (main): implement --tcp-server and --tcp-client addr:port.
+
+ * src/lsz.c (getnak): use READLINE_PF, not readline.
+ (wctx): likewise.
+ (wcputsec): likewise.
+ (zsendfile): likewise.
+ (zsendfdata): likewise.
+ (global) (main): implement --tcp-server and --tcp-client addr:port.
+
+ * src/tcp.c: fix some byteorder problems.
+ (tcp_connect): accept hostnames.
+
+
+Sat Sep 13 20:04:56 MET DST 1997
+
+ * src/zmodem.h: #ifdef out some declarations already found in
+ zglobal.h.
+
+ * acinclude.m4: new macro LRZSZ_ERRNO_DECL, checks for declaration
+ of errno, taken from taylor uucp.
+
+ * configure.in: use LRZSZ_ERRNO_DECL
+
+ * src/lrz.c: remove lots of egcs -Wparanoia warnings.
+ zrdata needs new parameter. Rxcount isn't global anymore.
+ many int or long -> signed or size_t changes.
+
+ * src/zm.c: zrdata get's new argument, pointer to size_t to
+ store number of bytes read into.
+ Remove Not8bit, wasn't used.
+ remove lots of egcs -Wparanoia warnings.
+ zgethdr gets a new argument, pointer to size_t.
+ Remove global variable Rxpos.
+
+ * rbsb.c:
+ remove lots of egcs -Wparanoia warnings.
+ sendbrk sends break now in posix termios mode, too.
+
+ * src/lsz.c: remove lots of egcs -Wparanoia warnings.
+ many int or long -> signed or size_t changes.
+ Rxcount and Rxpos removed.
+
+ * src/zreadline.c: remove egcs -Wparanoia warnings.
+
+Mon Sep 1 00:02:27 MET DST 1997
+
+ * src/lrzszbug.in: new script.
+
+ * src/Makefile.am: distribute lrzszbug.in
+
+ * configure.in: generate lrzszbug.
+
+Sun Aug 31 18:00:00 MET DST 1997
+
+ * Release 0.12.17
+
+Sat Aug 23 22:54:12 MET DST 1997
+
+ * src/lrz.c (closeit): use S_ISREG instead of (mode&S_IFMT)==...
+ if possible. (closeit) removed unused variable
+
+ * src/rbsb.c (Fromcu): deal with major(), minor() and makedev ...
+ dev_t might not be a simple type of the system (or, worse, the
+ compiler).
+
+ * src/tcp.c (tcp_server): change len to size_t.
+ (tcp_server): remove unused variable namelen.
+ (tcp_accept): change namelen to size_t.
+ (global): include "error.h", <ctype.h>, <stdlib.h>, <stdio.h>.
+ (tcp_accept): remove unused variable newsock.
+ (tcp_connect): rename variable sin to s_in.
+
+ * src/lsz.c (wcs): use S_ISxxx instead of (mode & S_IFxxx)==...)
+ if possible. (getzrxinit) same. (countem) also.
+
+ * src/Makefile.am: don't uses LOCALEDIR, OS, CPU anymore
+
+ * configure.in: AC_DEFINEs_UNQUOTED LOCALEDIR, OS, CPU.
+ Bugfix: PUBDIR should be AC_DEFINEd_UNQUOTED, not AC_DEFINEd.
+
+ * src/zm.c (zsendline_s): last_esc was not initialized.
+
+Sun Jun 1 09:52:45 MET DST 1997 Uwe Ohse <uwe@ohse.de>
+
+ * updated COPYING
+
+ * man/Makefile.am: added manual pages to EXTRA_DIST as automake
+ doesn't automagically distribute them anymore.
+
+ * src/zglobal.h: new macro vchar() (put a char onto stderr),
+ new macro vstring() (put a string onto ...).
+ prototype for vstringf().
+ remove prototype for cucheck().
+
+ * src/zperr.c: new function vstringf() (vfile without "Verbose > 2"
+ check).
+
+ * src/lrz.c: use vchar/vstring/vstringf instead of writing
+ to stderr.
+ implement tcp mode code.
+ don't restrict setgid anymore, too many people had problems
+ with this ...
+
+ * src/zreadline.c: use vchar/vstring/vstringf instead of writing
+ to stderr.
+
+ * src/zm.c: use vchar/vstring/vstringf instead of writing
+ to stderr. made zsendline_s receive a _const_ char *.
+
+ * src/rbsb.c: use vchar/vstring/vstringf instead of writing
+ to stderr. remove unused function cucheck().
+
+ * src/lsz.c: removed NEW_ERROR define, delete old code, NEW_ERROR
+ is now certainly stable enough.
+ most places: use vchar/vstring/vstringf instead of writing
+ to stderr.
+ New options -4/-5 for try4k/start4k. 4k blocksize gives somewhat
+ better benchmark results than 1k and 10% better results than 8k
+ on my dual processor system (don't wonder: 4k is a pagesize, and
+ using more than 4k makes pipe writes block. doesn't matter in
+ real life :-)).
+ implement tcp mode code.
+ don't restrict setgid anymore, too many people had problems
+ with this ...
+
+ * src/tcp.c: new file.
+
+ * configure.in: change version to 0.12.17. fiddled around to
+ get it properly running with automake-1.1p.
+
+ * lib/Makefile.am: add LIBOBJS to libzmodem_a_DEPENDENCIES (don't
+ know why automake-1.1p needs this, but anyway).
+
+
+Wed May 21 16:49:51 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
+
+ * src/zglobal.h (termios.h): Do not include that file unconditionally !
+ (USE_TERMIOS): Do not define that unconditionally !
+
+Tue Mar 25 01:21:07 MET 1997
+
+ * lib/Makefile.am: add "libzmodem_a_DEPENDENCIES = @ALLOCA@"
+
+Mon Mar 24 08:01:14 MET 1997
+
+ * Release 0.12.16
+
+ * Makefile.am: check -> check-local
+
+Sat Mar 15 08:26:39 MET 1997
+
+ * src/zglobal.h: provide prototypes for zsdat32.
+
+ * src/zm.c (zsdata): doesn't call zsdat32() anymore.
+ (zsdat32): not static anymore.
+
+ * src/lsz.c (ZSDATA): new macro. calls zsdata or
+ zsdata32.
+ (sendzsinit) (zsendfile) (zsendfdata) (zsendcmd):
+ replaced zsdata with ZSDATA.
+
+Thu Mar 13 07:54:07 MET 1997
+
+ * src/lsz.c(main):
+ * src/lrz.c(main): don't run setuid or setgid.
+ call_zsendline_init().
+
+ * src/zm.c (zsendline_init): don't takes a parameter anymore, uses
+ sourcefile-static variable.
+ (zsendline): don't call zsendline_init anymore.
+ (zsendline_s): new function (faster blockmode version of zsendline)
+ (zsda32): used zsendline_s()
+
+ * src/zglobal.h: provide prototype for zsendline_init().
+
+Mon Mar 10 23:13:59 MET 1997 Uwe Ohse <uwe@tirka.gun.de>
+
+ * updated to gettext-0.10.27
+
+ * updated to automake-1.1l (especially Makefiles and configure.in)
+
+ * check.lrzsz: small fixes.
+
+Sun Mar 9 10:29:39 MET 1997 Uwe Ohse
+
+ * src/lrz.c: Warnings and #ifdef O_SYNC around O_SYNC-Code.
+
+Sun Feb 2 12:52:01 MET 1997 Uwe Ohse <uwe@tirka.gun.de>
+
+ * Release 0.12.15
+
+ * src/lrz.c (procheader): xmodem didn't work on m68k-hp-hpux9.00,
+ compiled with gcc. procheader got "" as filename if using
+ xmodem, and does this:
+ char *p=name+1+strlen(name).
+ certainly not ok :-)
+
+Sat Feb 1 19:55:08 MET 1997 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lrz.c (procheader): change mode of received file
+ to O_SYNC if o_sync is set.
+ (main): set o_sync if --o-sync (or --o_sync) is given.
+ (global): new variable static int o_sync.
+ (usage): new option --o-sync.
+
+ * src/rbsb.c:
+ * src/timing.c:
+ * src/zglobal.h: don't use #elif anymore (didn't know
+ that pre ansi systems don't understand it).
+
+ * src/timing.h:
+ * src/lrz.c:
+ * src/lsz.c:
+ * src/zm.c:
+ * src/zglobal.h: use __P in prototypes.
+
+ * src/zglobal.h:
+ include varargs.h instead of stdarg.h ifndef __STDC__
+
+ * src/zperr.c:
+ #define VA_START(x,y) to va_start(x,y) (__STDC__) or
+ va_start(x) (!__STDC__).
+
+ * src/rbsb.c: made it compile with hpux bundled compiler.
+ purgeline(fd) -> purgeline (int fd).
+ int rdchk(int fd) ->
+ int
+ rdcheck(int fd)
+
+Fri Jan 31 01:01:47 MET 1997 Uwe Ohse <uwe@tirka.gun.de>
+
+ * lib/alloca.c (xmalloc): de-ANSI-fy.
+
+ * lib/Makefile.am: turn off ansi2knr
+
+ * src/ansi2knr.c: include newer version from fileutils-3.16
+
+Sun Jan 19 09:03:54 1997 Philippe De Muyter <phdm@mac_tst>
+
+ * src/zglobal.h (LONG_MAX): If everything else failed,
+ include limits.h.
+
+ * intl/l10nflist.c:
+ * intl/explodename.c
+ include <sys/types.h>
+
+Tue Jan 7 07:33:55 MET 1997 Uwe Ohse <uwe@tirka.gun.de>
+
+ * configure.in: change version to 0.12.14
+
+ * src/lrz.c (procheader): Overwrite "waiting to receive"
+ with spaces.
+ "file exists, skipped" -> "file exists, skipped: filename",
+ print it if: "Verbose > 2" -> "Verbose".
+ (Glenn Burkhardt <glenn@aoi.ultranet.com>)
+
+Sat Jan 4 10:12:56 1997 Uwe Ohse <uwe@tirka.gun.de>
+
+ * configure.in: check for libsocket (contains syslog() under
+ SCO).
+ don't use AC_FUNC_STRFTIME (sets "LIBS=-lintl $libs", and
+ this doesn't interact well with the intl/libintl.a and
+ the ud_GNU_GETTEXT), do AC_REPLACE_FUNC(strftime).
+
+ * lib/strftime.c: new file (taken from fileutils-3.14).
+ I did *not* include multibyte character support (== including
+ wchar.h == AC_CHECK_HEADER(wchar.h)), as timesync doesn't
+ need multibyte characters.
+
+ * src/timing.c (timing): throw out "goto doit". Forgot it
+ a long time ago.
+
+ * src/zglobal.h: include sys/select.h after including
+ sys/time.h (sys/select.h needs struct timeval).
+ make "char checked;" an unsigned char.
+ remove extern int readline_readnum; not needed.
+
+ * src/rbsb.c: make "char checked;" an unsigned char.
+ (to get rid of warnings on systems where
+ readcheck reads).
+
+ * src/lsz.c (zsendfdata): remove #ifndef linux
+ around "XOFF | 0200".
+ (wcs): cast pid_t to unsigned long before using
+ it in printf. (HPUX).
+ (wcsend): remove #ifdef HAVE_STRFTIME - we know
+ that we have strftime.
+
+ * src/lrz.c (procheader): oops, alloca(strlen(name+5))
+ should have been alloca(strlen(name)+5);
+ -> crash on HP9000/712, HPUX 9.07, PA-Risc.
+
+ * removed forgotten strace from check.lrzsz (did you ever
+ wonder why zmodem8k was slower in `make check'?)
+
+ * src/zm.c:
+ zsbh32,zsda32,zrdat32,zrbhdr32,zrhhdr,zputhex,zgethex,
+ zgeth1: had static prototype, but were not defined
+ as static. Now prototype and function are static.
+
+
+Thu Jan 2 22:59:44 1997 Uwe Ohse <uwe@tirka.gun.de>
+
+ * configure.in:
+ + AC_C_INLINE (cleanup, was called from aclocal.m4)
+ + AC_TYPE_OFF_T (cleanup, was called from aclocal.m4)
+ - AC_FUNC_UTIME_NULL (not really needed)
+ + check for strings.h (was done before in aclocal.m4)
+ + call AC_FUNC_STRFTIME
+ + check for vprintf (not done before, used in error.c)
+
+ * src/lsz.c: #ifdef HAVE_SELECT around call to select().
+
+ * src/timing.c: don't include limits.h,unistd.h: already
+ done from zglobal.h.
+
+ * src/zm.c:
+ * src/zreadline.c:
+ don't include unistd.h, already done from zglobal.h.
+
+Wed Jan 1 17:18:34 1997 Uwe Ohse <uwe@tirka.gun.de>
+
+ * Release 0.12.13
+
+ * updated gettext to 0.10.26.
+
+ * took out purgeline() call in zsendfile (didn't help).
+
+ * check.lrzsz: splitted resume directory into two parts.
+
+ * configure.in: call AC_AIX, AC_MINIX.
+
+Wed Dec 18 22:44:55 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lsz.c: start_blklen changed to 0.
+ (chkinvoc): don't change blklen to 1024 for YMODEM.
+ [use -k if you want better performance, worse
+ interoperatibility]
+ (main): if start_blklen is 0 after processing arguments
+ change it to 1024 (zmodem) or 128 (x/y).
+ (zsendfile): call purgeline() once - hopefully fixed
+ stefan glasers problem.
+
+ * configure.in: remove AC_C_CROSS
+
+Sat Nov 9 16:34:09 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lrz.c (long_options): --with-crc doesn't require an
+ argument.
+ (main): shortopts-string given to getopt() wasn't up-to-date.
+
+Tue Nov 5 00:05:36 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lsz.c (zsendfdata): moved SIGINT-activation to the beginning
+ of the file's transfer (no need to activate if before every
+ write).
+
+ * src/zm.c (bttyout): removed.
+ (zgethdr): don't call bttyout, write directly to stderr.
+
+Thu Oct 10 15:31:54 1996 Philippe De Muyter <phdm@info.ucl.ac.be>
+
+ * configure.in: Replace mktime if needed.
+
+ * lib/Makefile.am (EXTRA_DIST): Distribute mktime.c
+
+ * lib/mktime.c: new file, replacement function for mktime().
+
+Mon Oct 7 22:57:09 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lsz.c (usage):
+ * src/lrz.c (usage): updated help text.
+
+ * configure.in (VERSION): changed to 0.12.11
+
+ * src/lrz.c (main):
+ * src/lsz.c (main): "rshell" is another name for a restricted shell.
+
+Sun Oct 6 20:45:20 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lrz.c (wcreceive): changed calls to timing().
+ (rzfiles): dito.
+ (rzfile): dito. implement --stop-at TIME.
+ (main): recognize --stop-at and parse argument.
+ (usage): document --stop-at.
+
+ * src/lsz.c (wcs): changed call to timing().
+ (wcs): dito.
+ (zsendfdata): implement --stop-at TIME. changed call to timing(),
+ threw out calls to time():
+ (main): recognize --stop-at and parse argument.
+ (usage): document --stop-at.
+
+ * src/timing.c (timing): now gets another parameter time_t *now, to
+ be filled with the "now" time (to reduce number of system call if
+ using --min-bps or --stop-at).
+
+ * src/timing.h (timing): changed prototype for timing() (optional
+ parameter time_t *now);
+
+Thu Oct 3 09:22:26 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lrz.c (tryz): don't return FALSE to early if getting to many
+ ZRQINITs.
+
+ * src/lsz.c (main): tell library to interrupt system calls if we get an
+ SIGALRM (stupid BSD people - why did they make restarting systems
+ calls the *default*)?
+
+ * configure.in (ALL_LINGUAS): check for siginterrupt().
+
+ * src/lrz.c (ecgetsec): read at max 1000 bytes after we got an bad
+ header. (was endless loop, if sender didn't time out).
+
+ * src/lrz.c (main):
+ * src/lsz.c (main): new option --delay-startup N: makes program sleep
+ for N seconds before sarting transactions (for debugging).
+
+ * lib/Makefile.am (zmodem_SOURCES): remove duplicate zmodem_SOURCES
+ line.
+
+Wed Sep 18 20:27:00 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lsz.c (wcs): #ifdef HAVE_MMAP around dont_mmap_this.
+
+Wed Sep 18 18:36:40 1996 Philippe De Muyter <phdm@info.ucl.ac.be>
+
+ * lib/Makefile.am (EXTRA_DIST): distribute stpcpy.c.
+
+ * src/lrz.c, src/lsz.c: declare stpcpy if not STRICT_PROTOTYPES.
+
+ * src/lrz.c (DEFBYTL): declaration removed from here.
+
+ * src/zglobal.h (DEFBYTL): declaration moved here.
+
+ * src/lsz.c (wcs): enclose dont_mmap_this in #ifdef HAVE_MMAP;
+ initialize bytes_total to DEFBYTL if file is a pipe;
+ use bytes_sent, not bytes_total for final statistics.
+ (calc_blklen): best_bytes and transmitted made unsigned long, not long.
+ (countem): use DEFBYTL as filesize for "-".
+
+Tue Sep 17 23:50:34 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lrz.c (main): enable SIGINT code.
+
+ * src/lsz.c: whole file: enable SIGINT code.
+
+Sat Sep 14 10:02:41 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * configure.in (VERSION): change to 0.12.10
+
+ * src/lrz.c (wcreceive): unlink Pathname only if not NULL.
+
+ * src/lsz.c (getzrxinit): resend ZRQINIT if we don't get a
+ ZRINIT. This is needed to ensure that a receiver which
+ starts up late, looses ZRQINIT and doesn't send a ZRINIT
+ by default gets the ZRQINIT it needs. [resending ZRQINIT
+ is documented in zmodem.doc, but unix zmodem doesn't do
+ it. Well, this is not the only missing feature.]
+ (getnak): resend ZRQINIT if getting a timeout.
+ (zrqinits_sent): new variable. counts number of sent zrqinits.
+ Need to do this because unix rz cancels transmission if getting
+ more than 5 ZRQINITS.
+
+Thu Sep 5 21:22:32 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lsz.c (wcsend): use stpcpy instead of strcpy + strcat.
+
+ * src/lrz.c (procheader): use stpcpy instead of strcpy + strlen.
+
+ * lib/stpcpy.c: new file.
+
+ * configure.in: Replace strtol, strpbrk, stpcpy if needed.
+
+ * check.lrzsz: Redirect all error messages to $testdir/error.log.
+ Modified to avoid 'cp -f', dd conv=notrunc, /dev/zero.
+ Typo : management, not managment.
+ (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+ * configure.in: check for mode_t, replace strtoul if needed.
+ (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+ * src/rbsb.c: Do not include fcntl.h twice.
+ (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+ * src/lrz.c (long_options):
+ * src/lsz.c (long_options): fix typo (restriced -> restricted)
+ (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+ * intl/l10nflist.c, intl/explodename.c (stdlib.h): Include
+ sys/types.h and define NULL for size_t-less or missing stdlib.h.
+ (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+Wed Sep 4 20:21:56 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/zglobal.h: include <sys/select.h> if it exists.
+ (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+ * configure.in: check for sys/select.h
+ (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+ * src/lsz.c (getinsync): clearerr(input_f) is a bad idea
+ if (input_f == NULL).
+
+Tue Sep 3 21:55:30 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lsz.c (wcs): oops, use name where oname should have
+ been printed in error message. if sending file "-" treat
+ it special.
+ (main): replace `0' with io_mode_fd, set io_mode_fd to
+ 1 if sending file "-".
+ (wctx): replace `0' with io_mode_fd.
+ (zsendfdata): rdchk(io_fd) instead of rdchk(0).
+
+Sun Sep 1 10:12:42 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * configure.in (VERSION): changed to 0.12.9
+
+ * man/lrz.1: documetn --rename, --min-bps, --min-bps-time.
+
+ * man/lsz.1: document --turbo, --rename, --min-bps,
+ --min-bps-time.
+
+ * src/lsz.c (main): support -m/--min-bps and -M/min-bps-time
+ options.
+ (wctxpn): added missing error messages.
+ (zsendfile): added missing error messages.
+ (zsendfdata): support --min-bps and --min-bps-time.
+ (usage): document --min-bps and --min-bps-time.
+
+ * src/lrz.c (main): support -m/--min-bps M option.
+ (rzfile): support --min-bps-Option, --min-bps-time.
+ (main): support --min-bps-time/-M option.
+ (rzfiles): does print error messages to syslog (rzfiles did
+ just say "error", rzfiles can tell *what* error happened).
+ (usage): document min-bps and min-bps-time. document --error.
+
+Wed Aug 28 11:23:01 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/zreadline.c: include errno.h
+
+ * src/zglobal.h: include limits.h (_POSIX_PATH_MAX).
+ Fixed misspelled HAVE_TERMIO_H to HAVE_TERMIOS_H.
+ changed long Locmode, long Locbit to extern.
+
+ * po/de.po:
+ * src/lrz.c (usage):
+ * src/lsz.c (usage): add --rename option.
+
+Tue Aug 27 10:53:43 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * Release 0.12.8
+
+ * src/lsz.c (main): do a select/read-loop after calling purgeline()
+ to get rid of really anything already in the queue.
+
+ * configure.in (VERSION): changed to 0.12.8
+
+ * src/lrz.c (rzfile): added missing error message.
+ (rzfile): buffer packets we received out-of-sync, and try to
+ reuse them later.
+
+ * src/lsz.c: (whole file): renamed flags.
+ (main): new option -E --rename: change name if target exists.
+ (long_options): new option --rename.
+
+ * src/lrz.c: (whole file) renamed flags.
+ (procheader): implement ZF1_ZMCHNG (change name if target exists).
+ (main): new option -E --rename: change name if target exists.
+ (long_options): new option --rename.
+ (procheader): fix --append-Option (ZF1_ZMAPND). Will now work
+ even on binary files (why not send wtmp?).
+
+ * src/zmodem.h (ZF1_ZMCHNG): new flag. change filename if
+ destination exists.
+ Some flags renamed (prefixed with ZFn etc).
+ changed some octal numbers to hex.
+
+ * src/lsz.c (main): setup readline to read up to 128 bytes.
+
+ * src/zreadline.c (readline): minimal timeout now 1 second if
+ timeout-variable is 1.
+
+ * src/zreadline.c (readline): if Verbose > 9 dump up to 48
+ bytes direct after read().
+
+ * src/lsz.c (main): call purgeline to get rid of junk on
+ the line.
+
+ * check.lrzsz: use source files for resume test.
+
+Sun Aug 25 11:11:17 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/zm.c (zsendline_init): if turbo_escape is set:
+ do not escape ^P, 0200|^P,015,0215.
+
+ * src/lsz.c (main): recognize -T aka --turbo, sets variable
+ turbo_escape.
+
+ * src/zm.c: new variable turbo_escape.
+
+ * src/lsz.c (calc_blklen): calculated with *full* last block, causing
+ to choose smaller block sizes if last block not full.
+
+ * src/zreadline.c (readline): print strerror(errno) if read
+ returned -1 bytes and Verbose > 5.
+
+Sat Aug 24 16:39:41 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/rbsb.c (from_cu): debug messages deleted.
+
+Fri Aug 23 14:32:51 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lsz.c (usage1): usage1 is static, had static prototype,
+ but was not made static.
+
+ * src/lrz.c (procheader): case result of strdup because we
+ might not have a prototype for it.
+
+ * lib/alloca.c: provide xmalloc.
+
+ * configure.in: use GCC-CFlags only if using gcc (did a test
+ with lcc ...).
+
+Thu Aug 22 19:48:16 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * Release 0.12.7
+
+ * configure.in (VERSION): changed to 0.12.7
+
+Tue Aug 13 00:00:27 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * check.lrzsz: accepts third parameter (x,y,z,z8,sz-r,rz-r,abuse),
+ to do one test.
+
+ * src/timing.c (timing): DST_NONE might be undefined.
+
+ * src/lsz.c: do not include unistd.h, limits.h.
+ (wcsend): dynamically alloca tmp and pa variables (PATH_MAX).
+ (wctxpn): dito.
+
+ * src/zglobal.h: get alloca.
+
+
+Mon Aug 12 21:46:09 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lrz.c (procheader): dynamically allocate Pathname-String
+ (PATH_MAX may be variable).
+ (wcreceive): dynamically allocate Pathname.
+
+ * configure.in: check for sys/param.h
+
+ * src/rbsb.c: don't include sys/stat.h, sys/types.h
+
+ * src/lsz.c:
+ * src/lrz.c: don't include time-includes.
+ do not include sys/stat.h, unistd.h
+
+ * src/zglobal.h: include time-includes.
+ include sys/stat.h, sys/types.h
+ #define PATH_MAX if needed.
+
+Sun Aug 11 07:39:37 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/lrz.c (rzfile): instead of sending ZACK flush XON flush
+ send (ZACK | 0x80) to remote. This removes on write operation.
+
+ * src/zm.c (zshhdr): use a mask of 0x7f for frametype (see change
+ to lrz.c above).
+
+ * configure.in (VERSION): increased version number to 0.12.6
+
+ * src/lsz.c: buffersize, use_mmap: new variables.
+ (long_options): add --bufsize aka -B option.
+ (wcs): added support for variable buffer size (input file).
+ (zsendfdata): use mmap only if use_mmap != 0.
+ (usage): show -B option.
+
+ * po/de.po: added translation for -B option.
+
+ * src/lrz.c (usage): show -B option.
+
+ * man/lsz.1:
+ * man/lrz.1: documented -B option.
+
+ * src/lsz.c:
+ * src/lrz.c: added extern declarations for time(), strerror()
+ and strstr(), if not STRICT_PROTOTYPES. (phdm@info.ucl.ac.be)
+
+ * src/lrz.c: (procheader): use variable size FILE buffer.
+ buffersize: new variable
+ (main): added -B-Option to set buffersize.
+ (long_options): new option --bufsize aka -B.
+
+ * acconfig.h: #undef STRICT PROTOTYPES
+
+ * configure.in: remove AC_PROG_LN_S (not used anymore).
+ moved "test $prefix = NONE && prefix=/usr" to local part
+ (if host == tirka.gun.de). (phdm@info.ucl.ac.be)
+ if -Wstrict-prototypes in CFLAGS then
+ AC_DEFINES(STRICT_PROTOTYPES).
+
+ * src/Makefile.am (install-exec-local): used ln, not ln -s.
+ don't use -f option to ln (unportable). (phdm@info.ucl.ac.be)
+
+ * check.lrzsz (z_test_files): try mknod if mkfifo failed.
+ (phdm@info.ucl.ac.be)
+
+ * src/rbsb.c: sys/types.h and sys/stat.h included twice.
+ (phdm@info.ucl.ac.be)
+
+ * config.guess, config.sub: replaced by autoconf-2.10 version.
+ (phdm@info.ucl.ac.be)
+
+Tue Aug 6 11:16:12 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/zm.c (count_blk) (printout_blocksizes): neuer Code.
+ wenn DEBUG_BLOCKSIZE definiert ist und gcc verwendet wird,
+ wird am Ende der Übertragung eine Statistik der Blockgrößen
+ mit syslog(LOG_DEBUG) ausgegeben.
+
+ * src/zglobal.h (CANBREAK): nun hier definiert.
+ (USE_SGTTY,USE_*TERMIO*): nun hier definiert, includes finden
+ hier statt.
+
+ * src/rbsb.c: einen Teil der Includes nach zglobal.h verlegt
+ (lrz.c benötigt CANBREAK).
+ (sendbrk): #define CANBREAK nach zglobal.h verlagert.
+
+Sat Aug 3 16:14:47 1996 Uwe Ohse
+
+ * configure.in: change version number to 0.12.5
+ * Release 0.12.5
+
+Wed Jul 24 13:14:45 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * configure.in: AC_REPLACE_GNU_GETOPT missing.
+
+Tue Jul 23 16:20:06 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/rbsb.c (rdchk): f should have been fd.
+
+ * src/zperr.c: include errno.h
+
+Fri Jul 5 15:51:51 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * configure.in: AC_DEFINE(HAVE_STRERROR,1)
+
+ * acconfig.h: #undef HAVE_STRERROR
+
+Thu Jun 20 16:42:26 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * src/Makefile.am (uninstall-local) (install-exec-local):
+ new targets, creating symlinks from l[rs]z to
+ l[rs][bx].
+
+Sat Jun 15 08:13:41 1996 Uwe Ohse
+
+ * changed version number to 0.12.4
+
+Thu Jun 13 08:25:22 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * oh, i should have written this in english. Sorry.
+
+ * check.lrzsz: neue Tests, ob recovery funktioniert.
+
+ * lsz.c: wenn sender keine Konvertierungsoptionen
+ (ZCBIN, ZCNL oder ZCRESUME), sondern das Feld
+ auf 0 läßt, wird nun ZCBIN angenommen. Und schon
+ funktioniert die `-r'-Logik in procheader().
+
+ * zm.c (zdlread): weite Teile werden nun ge-inline-d.
+ Das spart in etwa drei Funktionsaufrufe pro
+ 4 gelesene Bytes.
+
+ * src/lrz.c (procheader): oops, setvbuf wurde nur bei
+ der ersten Datei aufgerufen.
+
+ * src/lrz.c (usage):
+ * src/lsz.c (usage): In der Usage-Zeile wurden nicht alle
+ Optionen ausgegeben. Es waren ohnehin ohnehin zu viele,
+ deshalb wird [options] geschrieben.
+
+ * check.lrzsz: Behandlung von /pub/gnu/emacs-*.tar.gz war
+ falsch (der Fall, daß sie nicht da waren, wurde nicht
+ abgefangen).
+ Wenn ZMODEM-Test fehlschlug wurde am Ende ausgegeben, daß
+ XMODEM nicht funktioniert.
+
+Sun Jun 9 07:43:32 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * Prototypendeklaration für gettimeofday aus timing.c entfernt,
+ kollidiert mit Solaris oder HP/UX. Sollte ohnehin überflüssig
+ sein.
+
+Sat Jun 8 23:56:42 1996 Uwe Ohse
+
+ * configure.in: Versionsnummer auf 0.12.3 erhöht.
+ AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
+ wird nun aufgerufen.
+
+ * zm.c,lsz.c: Variable Zmodem, irrtümlich am Mittwoch
+ verkannt (sie bedeutete nicht "wir benutzen Zmodem",
+ sondern "ZModem-Request erhalten") und entfernt, ist
+ nun wieder eingebaut als zmodem_requested.
+ * lrz.c: Zmodem -> zmodem_requested.
+
+Thu Jun 6 12:03:24 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ all files:
+ * use automake.
+ * go away from flat directory.
+ * internationalized.
+ * de-localized.
+ * cleaned up.
+ * added syslog support.
+ * added termios support.
+ short: everything changed.
+
+Mon Jun 3 08:06:52 1996 Uwe Ohse <uwe@tirka.gun.de>
+
+ * lsz.c (countem): replaced access(,04) with access(,R_OK).
+ protoized function.
+ (usage): protoized, added parameter ("describe failure").
+ (chkinvok), (chartest), (zsendcmd), (bttyout), (saybibi),
+ (getinsync), (canit), (zsendfdata), (zperr),
+
+ * lrz.c (bttyout): moved to zm.c
+
+ * lsz.c: include unistd.h, define R_OK if undefined.
+
+ * Makefile.in (MOSTLYCLEANFILES): added lint target.
+
+ * timing.c (timing): got rid of a warning.
+
+ * configure.in: added missing AC_ARG_PROGRAM
+
+----------------------------------------------------------------------
+Original lrzsz CHANGES file:
+----------------------------------------------------------------------
+0.10 - 4-15-94
+--------------
+ Made a bunch of changes to the last public domain rzsz release to
+make progress reports look pretty under various communications packages.
+Most mods are to lrz.c and lsz.c to give only a reasonable amount of
+information while a transfer occurs.
+
+0.11 - 4-17-94
+--------------
+ Whoops. Changed the location of 'rzlog' (the logfile) to /var/adm
+instead of /tmp to meet the requirements of the Linux FSSTD. Also fixed the
+Makefile so it uses relative links we don't confuse oddly configured
+systems. Included the GNU General Public License for convenience.
+
+To Do
+-----
+ Tk interface for progress reporting under X11.
+
+
+Matt Porter <porter+@osu.edu>
+
+
+
+0.11 to 0.12a
+-------------
+- disabled log file code in rz.c and sz.c
+- added timing code / transfer rate calculation to rz.c and sz.c
+ (new code in timing.c)
+
+
+0.12b - 5-26-96 to 6-2-96 Uwe Ohse <uwe@tirka.gun.de>
+
+- lrz.c: Restricted mode now defaults to 1. To turn off restricted
+ mode use -U. Use -R to disable creation of directories and
+ invisible files.
+ If $ZMODEM_RESTRICTED is found Restricted mode defaults to 2
+ (no creation of directories and invisible files), but can still
+ be reset through -U (whoever gives the options is also able
+ to set/unset environment variables).
+ Turning of restricted mode is impossible if running under
+ a restricted shell.
+ Remote command execution is disabled in restricted mode.
+- lsz.c: Restricted mode is turned on if running under a restricted
+ shell, or -R is given, or $ZMODEM_RESTRICTED is set.
+ With -U restricted mode is turned off unless running under a
+ restricted shell.
+- lrz.c: exitcode in main() was not initialized.
+- lsz.c: missing break statement after -r option added (sz). -r implied
+ -q, this is certainly not needed.
+- lsz.c: threw out TXBSIZE-code (stdio can do that better - without
+ TXBSIZE the benchmarks give better results). Only lossage:
+ can't seek on pipes anymore (but that didn't work with large buffers
+ and long delays or really fast lines anyway).
+- lsz.c: use mmap if possible.
+- lrz.c: zmputs used to write a string in single byte writes. Changed
+ that ...
+- lrz.c, lsz.c: now recognize x- or y-modem-mode even if named lsb or lsx
+ (instead of sb or sx).
+ ### TODO: make that work with program_transform_name.
+- lrz.c: increased HOWMANY to 8192 (255, if NFGVMIN is not defined)
+- lrz.c: added a missing error message.
+- lrz.c, lsz.c: reenabled timeout code, can be disabled with the
+ -O option.
+- lsz.c, lrz.c: added timesync protocol extension by Peter Mandrella
+ (can be totally disabled with configure --disable-timesync). if lrz is
+ called with -S it will request a timesync packet and complain about
+ larger differences if -v is given, if -S is given twice it will set
+ the system time to the senders time (if running under root, oh well).
+ lsz recognizes timesync protocoll only if -S is given
+ (so timesync is normally disabled and doesn't introduce any
+ incompatabilities)
+- lrz.c: added crash recovery (this is a really simple extension to the
+ receivers file opening code). Both lrz and lsz no have a -r switch
+ to request resume of a former transfer.
+- lrz.c: used putc to write the data to disk. changed that to fwrite.
+- lrz.c: now removes the received file if fclose() failed.
+- lrz.c/lsz.c: reduced number of outputs to stderr (progress/BPS-rate was
+ printed far too often and reduced the performance).
+- lrz.c/lsz.c: added option -O: "disable timeout/SIGALRM handling".
+ This should increase performance significantly, and, on the other
+ hand, makes l[sr]z wait forever (until it is interrupted/killed).
+ Anyway: Even without -O performance is good enough. 280KB/sec
+ through TCP/IP (localhost). -O gives about 290KB/sec.
+- lrz.c/lsz.c: implemented 8K blocksize (give lsz the -8 option to use
+ it - it defaults to traditional 1K).
+- lrz.c: reduced calls to readline() (too many function calls - now
+ uses a macro call in zm.c).
+- lsz.c: Option -c (sending commands to remote) disabled in
+ restricted mode.
+- lsz.c, lrz.c: PUBDIR is now optional (i don't trust public writable
+ directories).
+- lrz.c, lsz.c: threw out substr() - strstr is available since ages.
+- changed error recovery mode: old didn't ever increase block
+ sizes. new one gets far better performance if transmission is
+ bad for only a short time.
+- lrz.c, lsz.c: off_t is long long under FreeBSD, can't be printed
+ with %ld.
+- updated manpages.
+
+- almost all Files: autoconf'd them.
+
+- Makefile.in: largely rewritten, now mostly conforms to the
+ GNU standards (mostly: i don't know what i've forgotten).
+
+- updated version number to 0.12b
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..0f5c1e1
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,236 @@
+To install:
+
+0) if you are uncommon with configuration and installation of GNU/autoconf'd
+ software please read to generic install text at the end of this file.
+1) configure the package, possibly with
+ CFLAGS=-O2 ./configure
+ Use the following options if you need to:
+ --disble-timesync
+ this saves a few bytes. The timesync protocol allows to set the
+ receivers system time to the sender's time (see option S in
+ the manual pages). Including timesync support doesn't introduce
+ any incompatabilites (but *using* timesync does).
+ --enable-pubdir=/var/spool/uucppublic
+ if you want support for a public writeable directory.
+ --enable-syslog[=[[FACILITY,]level]]
+ to include syslog support. Not much will be written to syslog,
+ just one line per file.
+ Default facility is LOG_UUCP, but you can change that to whatever
+ your syslog.h supports.
+ Level defaults to "default", meaning syslog is on by default,
+ but is can be forced ("force"), meaning users will not be
+ allowed to turn it off, and it can be "optional", meaning users
+ have to turn it on for every transmission.
+ Example:
+ --enable-syslog=LOG_LOCAL0,force
+ every filetransfer will be logged to LOG_LOCAL0.
+ --enable-syslog=default and --enable-syslog
+ every filetransfer will be logged to LOG_UUCP, unless
+ the user turns this off with the "--syslog=off" runtime
+ option of lsz and lrz.
+ --enable-syslog=optional
+ no filetransfer will be logged, but syslogging can be
+ enabled with the "--syslog" runtime option of lsz and lrz.
+ --disable-mkdir
+ if rz shall never create directories (this option is only included
+ because disbaling the directory creation was possible with the
+ original sources).
+ --prefix=/usr/local
+ to install the programs and documentation under /usr/local instead
+ of /usr (default).
+ --program-transform-name=s/l//
+ to install the programs and manual pages under the traditional
+ names (sz, sz.1 instead of lsz, lsz.1).
+2) make
+ (please contact uwe@ohse.de if there are any problems.)
+3) make check
+ will perform a selftest, sending some files in the distribution
+ through a named pipe.
+ ("make vcheck" will do the same as "make check" does, but prints
+ a progress report)
+4) please read COMPATABILITY
+5) make install
+ if everything is ok.
+
+-------------------- generic GNU INSTALL text -----------------------------
+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, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ 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 at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' 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. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+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 supports 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' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+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 host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+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.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..d7c5a79
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,78 @@
+SUBDIRS = lib intl src po man testsuite
+EXTRA_DIST = check.lrzsz COMPATABILITY README.cvs README.isdn4linux \
+ README.gettext rpmrc buildrpm systype.in fastcheck.sh README.tests \
+ beos-runpiped.c fastcheck.beos
+noinst_SCRIPTS=systype
+PR=@PACKAGE@-@VERSION@
+CLEAN_FILES=fastcheck.done
+
+oldcheck-local:
+ QUIET=-q $(srcdir)/check.lrzsz $(srcdir) `pwd`
+
+fastcheck:
+ if [ x`uname -s` = xBeOS ] ; then make fastcheck-beos ; else \
+ $(srcdir)/fastcheck.sh $(srcdir) `pwd` ; fi
+
+fastcheck-beos: beos-runpiped
+ $(srcdir)/fastcheck.beos $(srcdir) `pwd`
+
+beos-runpiped: beos-runpiped.c
+ $(CC) -o $@ $<
+
+success: fastcheck
+ sh systype | mail uwe-generic-counter@ohse.de
+
+vcheck:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd`
+vcheck-%:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` $(subst vcheck-,,$@)
+check-%:
+ QUIET=-q $(srcdir)/check.lrzsz $(srcdir) `pwd` $(subst check-,,$@)
+vcheck-x:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` x
+vcheck-y:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` y
+vcheck-z:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` z
+vcheck-z8:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` z8
+vcheck-sz-r:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` sz-r
+vcheck-rz-r:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` rz-r
+vcheck-turbo:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` turbo
+vcheck-error:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` error
+vcheck-manag vcheck-manage:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` manage
+vcheck-zm-rz:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` zm-rz
+vcheck-zm-sz:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` zm-sz
+vcheck-orig-rz:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` orig-rz
+vcheck-orig-sz:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` orig-sz
+vcheck-orig-kombi:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` orig-kombi
+vcheck-abuse:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` abuse
+vcheck-startup:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` startup
+vcheck-tmp:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` tmp
+
+# Tag before making distribution. Also, don't make a distribution if
+# checks fail. Also, make sure the NEWS file is up-to-date.
+cvs-dist:
+ @if sed 1q NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
+ echo "NEWS not updated; not releasing" 1>&2; \
+ exit 1; \
+ fi
+ cvs tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
+ $(MAKE) dist
+
+rpm: $(PR).tar.gz Specfile
+ $(srcdir)/buildrpm $(srcdir)
+
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..ed719d7
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,464 @@
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = .
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+DATADIRNAME = @DATADIRNAME@
+ENABLE_TIMESYNC = @ENABLE_TIMESYNC@
+GENCAT = @GENCAT@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+PACKAGE = @PACKAGE@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+U = @U@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+l = @l@
+
+SUBDIRS = lib intl src po man testsuite
+EXTRA_DIST = check.lrzsz COMPATABILITY README.cvs README.isdn4linux README.gettext rpmrc buildrpm systype.in fastcheck.sh README.tests beos-runpiped.c fastcheck.beos
+
+noinst_SCRIPTS = systype
+PR = @PACKAGE@-@VERSION@
+CLEAN_FILES = fastcheck.done
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = Specfile systype
+SCRIPTS = $(noinst_SCRIPTS)
+
+DIST_COMMON = README ./stamp-h.in ABOUT-NLS AUTHORS COPYING ChangeLog \
+INSTALL Makefile.am Makefile.in NEWS Specfile.in THANKS TODO acconfig.h \
+acinclude.m4 aclocal.m4 config.guess config.h.in configure configure.in \
+install-sh missing mkinstalldirs systype.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+$(ACLOCAL_M4): configure.in acinclude.m4
+ cd $(srcdir) && $(ACLOCAL)
+
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+config.h: stamp-h
+ @if test ! -f $@; then \
+ rm -f stamp-h; \
+ $(MAKE) stamp-h; \
+ else :; fi
+stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > stamp-h 2> /dev/null
+$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/stamp-h.in; \
+ $(MAKE) $(srcdir)/stamp-h.in; \
+ else :; fi
+$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h
+
+maintainer-clean-hdr:
+Specfile: $(top_builddir)/config.status Specfile.in
+ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+systype: $(top_builddir)/config.status systype.in
+ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+@SET_MAKE@
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ rev="$$subdir $$rev"; \
+ test "$$subdir" = "." && dot_seen=yes; \
+ done; \
+ test "$$dot_seen" = "no" && rev=". $$rev"; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ dc_install_base=`cd $(distdir)/=inst && pwd`; \
+ cd $(distdir)/=build \
+ && ../configure --with-included-gettext --srcdir=.. --prefix=$$dc_install_base \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) dist
+ -rm -rf $(distdir)
+ @banner="$(distdir).tar.gz is ready for distribution"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"
+dist: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+dist-all: distdir
+ -chmod -R a+r $(distdir)
+ GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
+ -rm -rf $(distdir)
+distdir: $(DISTFILES)
+ -rm -rf $(distdir)
+ mkdir $(distdir)
+ -chmod 777 $(distdir)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ chmod 777 $(distdir)/$$subdir; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
+ done
+info-am:
+info: info-recursive
+dvi-am:
+dvi: dvi-recursive
+check-am: all-am
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am:
+install-exec: install-exec-recursive
+
+install-data-am:
+install-data: install-data-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am:
+uninstall: uninstall-recursive
+all-am: Makefile $(SCRIPTS) config.h
+all-redirect: all-recursive-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
+
+mostlyclean: mostlyclean-recursive
+
+clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
+
+clean: clean-recursive
+
+distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
+
+distclean: distclean-recursive
+ -rm -f config.status
+
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
+ maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f config.status
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+install-data-recursive uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
+dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
+install-exec-am install-exec install-data-am install-data install-am \
+install uninstall-am uninstall all-redirect all-am all installdirs-am \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+oldcheck-local:
+ QUIET=-q $(srcdir)/check.lrzsz $(srcdir) `pwd`
+
+fastcheck:
+ if [ x`uname -s` = xBeOS ] ; then make fastcheck-beos ; else \
+ $(srcdir)/fastcheck.sh $(srcdir) `pwd` ; fi
+
+fastcheck-beos: beos-runpiped
+ $(srcdir)/fastcheck.beos $(srcdir) `pwd`
+
+beos-runpiped: beos-runpiped.c
+ $(CC) -o $@ $<
+
+success: fastcheck
+ sh systype | mail uwe-generic-counter@ohse.de
+
+vcheck:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd`
+vcheck-%:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` $(subst vcheck-,,$@)
+check-%:
+ QUIET=-q $(srcdir)/check.lrzsz $(srcdir) `pwd` $(subst check-,,$@)
+vcheck-x:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` x
+vcheck-y:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` y
+vcheck-z:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` z
+vcheck-z8:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` z8
+vcheck-sz-r:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` sz-r
+vcheck-rz-r:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` rz-r
+vcheck-turbo:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` turbo
+vcheck-error:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` error
+vcheck-manag vcheck-manage:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` manage
+vcheck-zm-rz:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` zm-rz
+vcheck-zm-sz:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` zm-sz
+vcheck-orig-rz:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` orig-rz
+vcheck-orig-sz:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` orig-sz
+vcheck-orig-kombi:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` orig-kombi
+vcheck-abuse:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` abuse
+vcheck-startup:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` startup
+vcheck-tmp:
+ $(srcdir)/check.lrzsz $(srcdir) `pwd` tmp
+
+# Tag before making distribution. Also, don't make a distribution if
+# checks fail. Also, make sure the NEWS file is up-to-date.
+cvs-dist:
+ @if sed 1q NEWS | grep -e "$(VERSION)" > /dev/null; then :; else \
+ echo "NEWS not updated; not releasing" 1>&2; \
+ exit 1; \
+ fi
+ cvs tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
+ $(MAKE) dist
+
+rpm: $(PR).tar.gz Specfile
+ $(srcdir)/buildrpm $(srcdir)
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..4119b16
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,247 @@
+Version 0.12.20 - December 1998, Uwe Ohse
+
+* works on BeOS and stone-aged SCO (sco-3.2v4.2)
+
+* pubdir-"feature" works again.
+
+* "make rpm" creates a rpm file.
+
+* "optimal blklen calculation" was too aggressive, it
+ now does nothing if the user demands fixed blklens.
+
+* various smaller and medium bug fixes.
+
+* a more or less important security bug is fixed (stupid
+ use of /tmp in a piece of code which is rarely used).
+
+* lrz uses umask to make files unreadable which receiving
+ them.
+
+* "sh systype | mail uwe-generic-counter@ohse.de"
+ sends a success report with a description of the
+ system type.
+
+* --enable-syslog is now default
+
+Version 0.12.19 - January 1998, Uwe Ohse
+
+* 0.12.18 was broken, lsz crashed if receiver found an CRC error.
+
+* lrz options "--rename" and "--escape" didn't work.
+
+* lrz didn't implement senders "overwrite-or-skip" option.
+
+* added dejagnu testsuite. Maybe you need a dejagnu snapshot to
+ use it.
+
+Version 0.12.18 - November 1997, Uwe Ohse
+
+* syslog output now includes user name.
+
+* new script lrzszbug, to be used for bugreports (untested)
+
+* lots of compiler warnings (egcs -Wparanoia [many -W]) removed.
+
+* new options --tcp-server and --tcp-client ADDRESS:PORT for
+ both programs.
+
+Version 0.12.17 - August 1997, Uwe Ohse
+
+* internal cleanup.
+
+* portability enhancements by (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+* lsz has a new option "--tcp" (no shortopt implemented). lsz transmits
+ one file over normal stdin/stdout (a control file), then opens a
+ tcp connection to transmit all other files. [this should help you,
+ Peter]
+ That _might_ be useful if your telnetd is really stupid.
+
+ (was _not_put on ftp/http server)
+
+Version 0.12.16 - March 1997, Uwe Ohse
+
+* major performance improvement (less CPU time needed - don't expect
+ faster transfers over slow lines). `make vcheck' now show about 50%
+ more throughput.
+
+* updated to gettext-0.12.27 and automake-1.1l
+ (automake-1.1l bug: AC_SUBST in AM_PATH_PROG_WITH_TEST leads
+ to a "$1=@$1@" line in Makefile.in. I hacked around it in
+ /usr/share/aclocal/gettext.m4)
+
+* minor bug fix.
+
+Version 0.12.15 - Februar 1997, Uwe Ohse
+
+* should now compile with pre-ANSI-compilers (tested with HPUX
+ bundled compiler - what a bad program. shame on HP).
+
+* new option --o-sync for lrz, open output file in synchronous write
+ mode (for those poor systems losing interrupts if update locks
+ interrupts too long).
+
+Version 0.12.14 - Januar 1997, Uwe Ohse
+
+* compiles cleaner on SCO, HPUX (even with the native compiler).
+
+* improved error reporting (i think there are still possibilities for
+ further improvements, if anybody case spare time :-)).
+
+Version 0.12.13 - Januar 1997, Uwe Ohse
+
+* no user visible changes
+
+Version 0.12.12 - December 1996, Uwe Ohse
+
+* lrx and lrb (aka lsz --x/ymodem) now default to 128 byte
+ block length (to fix interoperatability problems with
+ some Xmodems [USR courier flash upload]).
+
+* lrz didn't recognize every short option.
+
+* minor performance tweaks.
+
+* replace mktime() if needed.
+
+* updated to autoconf 2.12.
+
+Version 0.12.11 - October 1996, Uwe Ohse
+
+* lrzsz now has a home page, http://www.csl-gmbh.net/~uwe/lrzsz.html.
+ it still needs some work (oh well, it's "under construction" :-).
+
+* lsz/lrz recognize "rshell" as another name for the restricted
+ shell.
+
+* new option --stop-at HH:MM (stop transmission at HH:MM), and
+ --stop-at +N (stop in N seconds).
+
+* don't hang on BSD machines after getting a timeout (SIGALRM).
+ Stupid BSD people ...
+
+* rb (Y-Modem receive): read at max 1000 bytes after getting a
+ bad header, before giving up.
+
+* new option --delay-startup N: wait N seconds before doing
+ anything (debugging aid).
+
+* Interrupt signal handling turned on under linux (i still don't
+ know why it was turned off).
+
+* better handling of "sz -", by Philippe De Muyter.
+
+
+Version 0.12.10 - September 1996, Uwe Ohse
+
+* lsz resends init string if it doesn't receive rz's init.
+
+* improved "make check". (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+* `sz -' should work again (but i cannot test it). Anyway, this will not
+ work if sz cannot read from stdout.
+
+* portability enhancements by (Philippe De Muyter <phdm@info.ucl.ac.be>)
+
+
+Version 0.12.9 - September 1996, Uwe Ohse
+
+* new options --min-bps N and --min-bps-time M: If BPS rate falls under N
+ for at least M seconds (default: 120) transmission will be stopped.
+
+* added some missing error messages.
+
+* updated manual pages.
+
+
+Version 0.12.8 - August 1996, Uwe Ohse
+
+* bug fixes.
+
+* sz and rz now know about a new option:
+ -E, --rename: change name if target exists.
+
+* new option -T, --turbo for sz: sz doesn't escape 4 special characters
+ if this option is given (this should not make problems with any
+ rz, but could be problematic on certain links where this characters
+ have to be escaped).
+
+* debugged blocksize calculation.
+
+* -+, --append option fixed.
+
+
+Version 0.12.7 - August 1996, Uwe Ohse
+
+* portability enhancements. compiles and runs under hurd.
+
+
+Version 0.12.6 - August 1996, Uwe Ohse
+
+* some portability enhancements (phdm@info.ucl.ac.be)
+* sz and rz now have a new option -B NNN. NNN stands for the
+ size of the disk buffer to use (in Bytes). NNN == auto buffers
+ the whole file. Use it if you get crc errors while accessing
+ the disk.
+
+
+Version 0.12.5 - August 1996, Uwe Ohse
+
+* some portability enhancements (getopt.c)
+* install creates symlinks from l[rs]z to l[rs][bx]
+
+
+Version 0.12.4 - June 1996, Uwe Ohse
+
+* some bug fixes
+
+* `rz -r' should now really work
+
+* `make check' and `make vcheck' now try to check crash recovery
+
+
+Version 0.12.3 - June 1996, Uwe Ohse
+
+* just a few bugfixes.
+
+
+Version 0.12.2 - June 1996, by Uwe Ohse
+
+* German translation
+
+* internationalized
+
+* went away from flat directory structure
+
+* added termios support
+
+* added syslog support
+
+* turned to automake
+
+* lrz want give received files execution permission if running under
+ rsh.
+
+
+New in lrzsz-0.12b:
+
+- lrz: remote command execution is disabled per default. This
+ fixes a major security hole.
+- lrz now defaults to restricted mode.
+- lrz has a more restricted mode in which creation of directories
+ and invisible files is not allowed. See lrz.1 for more information.
+- rz and sz now recognize x- or y-modem-mode even if named lsb or lsx
+ (instead of sb or sx).
+- timeout code is enabled again, can be turned of with the -O option.
+- PUBDIR is now optional. configure with --enable-pubdir=/path if you
+ really want a public writeable directory (i don't, so the default
+ is no such directory).
+- turned to GNU autoconf.
+- added timesync protocol extension by Peter Mandrella. See timesync.doc
+ and the man pages for more information.
+- added crash recovery (this is a really simple extension to the
+ receivers file opening code). Both lrz and lsz no have a -r switch
+ to request resume of a former transfer.
+- many major and minor performance hacks.
+- new: 8K blocksize (a common extension in the DOS world). Turn on
+ with the -8 option to lsz (lrz handles this automatically).
diff --git a/README b/README
new file mode 100644
index 0000000..12b62c4
--- /dev/null
+++ b/README
@@ -0,0 +1,39 @@
+lrzsz is a X/Y/ZModem package built from the public-domain version of
+Chuck Forsberg´s rzsz package. This package contains NO code from later
+releases of rzsz which would preclude it from being released under the
+GPL.
+It has been heavily modified by me and others.
+
+Please note that credit should be given to Chuck Forsberg (rzsz) and Stephen
+Satchell/Satchell Evaluations (crc routines) for this package. Any later
+modifications were minor and merely introduced to increase performance,
+reliability or compatability.
+
+There is a mailing list for lrzsz: <uwe-lrzsz@bulkmail.ohse.de>.
+To subscribe send a mail to <uwe-lrzsz-subscribe@bulkmail.ohse.de>.
+
+I prefer to get bug reports sent using the `lrzszbug' shell script which
+you can find in the `src' subdirectory (this script is not installed together
+with the programs because i don't expect many bug reports). Nethertheless
+you can still send bug reports to <bugs@bulkmail.ohse.de> as normal
+electronic mails. Bugs received at this address may be forwarded to the
+mailing list.
+
+Please read:
+- INSTALL for installation instructions
+- NEWS for a list of major changes between the releases
+- ChangeLog for the list of minor changes.
+- AUTHORS and THANKS to see whom to thank for this package.
+- README.cvs for informations about CVS access to the lrzsz sources.
+- README.tests for information about how to do a self test
+- README.systems for a list of systems lrzsz has been compiled
+ and passed a simple self test under.
+
+In case you want to report a successful build:
+ make success
+or
+ make fastcheck && \
+ sh systype | mail uwe-generic-counter@ohse.de
+"sh systype" alone shows what data this script sends.
+
+Uwe Ohse
diff --git a/README-alpha b/README-alpha
new file mode 100644
index 0000000..13ecb3f
--- /dev/null
+++ b/README-alpha
@@ -0,0 +1,6 @@
+This is a test release of lrzsz.
+Please do not send reports about this release to any newsgroup.
+
+You might want to try to "lrzszbug" script in the source directory.
+
+Please send comments and problems to uwe@ohse.de.
diff --git a/README.cvs b/README.cvs
new file mode 100644
index 0000000..ac185b6
--- /dev/null
+++ b/README.cvs
@@ -0,0 +1,16 @@
+You can access the lrzsz sources through CVS, using something like
+ export CVSROOT=:pserver:cvsread@tirka.ohse.de:/var/cvs-pub
+ cvs login
+ use `cvsread' as password
+ cvs checkout lrzsz
+
+But you'll need the same automake version as i use (use finger to
+find which one i'm using at the moment:
+ finger uwe-tool-versions@tirka.ohse.de
+). The same might be true für autoconf and gettext.
+Automake _will_ be run because CVS garbles the timestamp of the files
+it checks out. You'll have to live with that.
+
+Tar archives and diffs of the cvs trees and are also available. See
+ ftp://tirka.ohse.de/uwe/cvs-trees
+They share the same problems, though.
diff --git a/README.gettext b/README.gettext
new file mode 100644
index 0000000..7759b7b
--- /dev/null
+++ b/README.gettext
@@ -0,0 +1,57 @@
+In case you see a dump of your environment after running configure
+or config.status you might want to either:
+- downgrade to gettext-0.10.32 (maybe 33 or 34 will work too, but
+ i didn' test them)
+- upgrade to a newer autoconf version (there is none at the moment
+ of this writing - Oct 1998 - and i suspect this state will not
+ change soon)
+- patch your /usr/lib/acgeneral.m4 (see below).
+In any case you should rerun "aclocal" afterwards and
+"configure" again.
+
+Sorry for the trouble.
+--------------------------------------------------------------------
+
+This little patch solves a problem i found using gettext-0.10.35.
+For some reason AM_GNU_GETTEXT (serial 5) calls
+AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
+with both variables being empty (at least on my redhat-5.1
+system).
+This gives an config.status script like this one:
+ ac_sources=" "
+ ac_dests=" "
+
+ srcdir=$ac_given_srcdir
+ while test -n "$ac_sources"; do
+ set $ac_dests; ac_dest=$1; shift; ac_dests=$*
+ set $ac_sources; ac_source=$1; shift; ac_sources=$*
+
+"set ; ac_source=$1; shift; ac_sources=$*" produces some not
+so nice looking output ...
+
+I think the right fix is something like that, but maybe Ulrich might want
+to try something else since autoconf seems to be basically unmaintained.
+
+don't forget to rebuild your frozen m4 files:
+ cd /usr/lib/autoconf
+ m4 -F autoconf.m4f autoconf.m4
+ m4 -F autoheader.m4f autoheader.m4
+
+Regards, Uwe
+---------------------------------------------------------
+> --- acgeneral.m4.old Fri Oct 9 19:42:32 1998
+> +++ acgeneral.m4 Fri Oct 9 19:43:43 1998
+> @@ -2289,7 +2289,7 @@
+> [EOF
+>
+> cat >> $CONFIG_STATUS <<EOF
+> -ac_sources="$1"
+> +ac_sources=`echo "$1" | sed 's/^ *$//'`
+> ac_dests="$2"
+> EOF
+>
+---------------------------------------------------------
+Well, i sent this to the gettext maintainer some months
+ago, but never got an answer ....
+
+
diff --git a/README.isdn4linux b/README.isdn4linux
new file mode 100644
index 0000000..e8483b4
--- /dev/null
+++ b/README.isdn4linux
@@ -0,0 +1,9 @@
+There is a problem with isdn4linux: lsz seems to stop the transmission
+after sending some kilobytes.
+I've been told that the packet size used in the X.75i protocol defaults
+to a too high value which is outside the specification. Workaround:
+initialize isdn4linux with "AT&B1024" (some boards can deal with higher
+values, maxbe up to 2000 Bytes).
+
+Thanks to Andreas Romeyke <andreas_romeyke@l2.maus.de> and Frank Thieme
+<frank_thieme@l2.maus.de>.
diff --git a/README.systems b/README.systems
new file mode 100644
index 0000000..e5e0d57
--- /dev/null
+++ b/README.systems
@@ -0,0 +1,29 @@
+A list of systems lrzsz has been compiled under and has
+passed a simple self test:
+
+version os version arch chip cc ccversion who (if not me)
+0.12.20 beos 4.0 i386 pentium gcc 2.9-beos-980929
+0.12.20 bsd.os 2.1 i386 unknown gcc 2.7.2
+0.12.20 bsd.os 3.1 i386 unknown gcc 2.7.2.1
+0.12.20 hpux 9.00 unknown m68k cc unknown
+0.12.20 hpux 9.00 unknown m68k gcc 2.8.0
+0.12.20 linux 2.0.33 i386 pentium gcc 2.7.2.1
+0.12.20 linux 2.0.35 i386 pentium gcc 2.7.2.3 zerox=???
+0.12.20 linux 2.0.36 i386 pentium gcc 2.7.2.1
+0.12.20 linux 2.0.36 i386 pentium gcc 2.7.2.3
+0.12.20 linux 2.0.36 i386 ppro gcc 2.7.2.3 lg
+0.12.20 linux 2.1.131 i386 pentium gcc 2.7.2.3
+0.12.20 linux 2.2.11 i386 pentium gcc egcs-2.91.66
+0.12.20 linux 2.2.5 i386 ppro gcc egcs-2.91.66
+0.12.20 linux 2.2.9 i386 pentium gcc egcs-2.91.66
+0.12.20 osf 4.0 unknown alpha gcc 2.8.1 ke
+0.12.20 sco 3.2v4.2 unknown pentium gcc 2.5.7
+0.12.20 sunos 5.5.1 sparc sun4u gcc 2.7.2.1
+0.12.20 sunos 5.6 sparc sun4u gcc 2.8.1
+0.12.21rc linux 2.2.11 i386 pentium gcc egcs-2.91.66
+0.12.21rc sunos 5.6 sparc sun4u gcc egcs-2.91.66
+
+you can contribute to this list: "make success"
+
+See http://tirka.ohse.de/cgi-bin/swfeedback?package=lrzsz
+for a more up to date list.
diff --git a/README.tests b/README.tests
new file mode 100644
index 0000000..dce4fc7
--- /dev/null
+++ b/README.tests
@@ -0,0 +1,19 @@
+From "ease of use" onwards:
+
+"make fastcheck"
+ will do a simple self check, sending lsz, lrz, lsz.c and lrz.c
+ over a named pipe.
+ This test just covers basic zmodem functionality, and it's
+ the only one which will work under BeOS: All other tests
+ need "real" named pipes, /pipe under BeOS simply hasn't
+ the right semantics.
+
+"make vcheck" and "make oldcheck-local"
+ will do a fast check of the most important features.
+ "vcheck" gives some more output, especially CPS-rates.
+
+"make check"
+ will do a _long_ regression test.
+ Some tests need special programs (omen.sz, omen.rz, zmtx, zmrx).
+ Some might only work on my system.
+ In any case you'll need dejagnu for this.
diff --git a/Specfile.in b/Specfile.in
new file mode 100644
index 0000000..6b9748c
--- /dev/null
+++ b/Specfile.in
@@ -0,0 +1,84 @@
+Summary: lzrz - sz, rz, and friends
+Name: @PACKAGE@
+Version: @VERSION@
+Release: 0
+Copyright: GPL
+Group: Applications/Communications
+Source: ftp://ftp.ohse.de/uwe/releases/@PACKAGE_VERSION@.tar.gz
+BuildRoot: /var/tmp/lrzsz-root
+Summary(de): lzrz - sz, rz und Co.
+Summary(fr): lzrz - sz, rz, et consorts
+Summary(tr): Modem protokolleri
+
+%description
+This collection of commands can be used to download and upload
+files using the Z, X, and Y protocols. Many terminal programs
+(like minicom) make use of these programs to transfer files.
+
+%description -l de
+Diese Sammlung von Befehlen läßt sich zum Herunter- und
+Aufwärtsladen von Dateien anhand der Z-, X- und Y-Protokolle benutzen.
+Viele Terminalprogramme (wie Minicom) setzen diese Programme für die
+Übertragung von Dateien ein.
+
+%description -l fr
+Cet ensemble de commande sert à télécharger des fichiers en utilisant
+les protocoles Z, X et Y. De nombreux programmes de terminal (comme
+minicom) utilisent ces programmes pour transférer les fichiers.
+
+%description -l tr
+Bu komutlar topluluðu Z, X ve Y protokollerini kullanarak dosya aktarýmý
+için kullanýlabilir. Pek çok uç birim programý (örneðin minicom) dosya
+taþýmak için bu programlarý kullanýr.
+
+%prep
+%setup
+
+%build
+CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --program-transform-name=s/l//
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make prefix=$RPM_BUILD_ROOT/usr install
+
+strip $RPM_BUILD_ROOT/usr/bin/{rb,rx,rz,sb,sx,sz}
+
+%files
+%defattr(-,root,root)
+%doc AUTHORS COMPATABILITY ChangeLog NEWS README README.gettext TODO THANKS README.cvs README.isdn4linux README.systems README.tests
+/usr/bin/sz
+/usr/bin/sb
+/usr/bin/sx
+/usr/bin/rz
+/usr/bin/rb
+/usr/bin/rx
+/usr/man/man1/sz.1
+/usr/man/man1/rz.1
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%changelog
+* Mon Dec 21 1998 Uwe Ohse <uwe@ohse.de>
+- stole redhats specfile and hacked it.
+ Redhat people: "Upgraded to 0.12.14 and changed makefiles so
+ gettext isnt built." is that kind of problem the author would
+ have liked to know.
+
+* Sun Aug 16 1998 Jeff Johnson <jbj@redhat.com>
+- build root
+
+* Thu May 07 1998 Prospector System <bugs@redhat.com>
+- translations modified for de, fr, tr
+
+* Tue Oct 21 1997 Donnie Barnes <djb@redhat.com>
+- spec file cleanups
+
+* Thu Jul 10 1997 Erik Troan <ewt@redhat.com>
+- built against glibc
+
+* Wed Mar 5 1997 msf@redhat.com <Michael Fulbright>
+- Upgraded to 0.12.14 and changed makefiles so gettext isnt built.
+
diff --git a/THANKS b/THANKS
new file mode 100644
index 0000000..712effb
--- /dev/null
+++ b/THANKS
@@ -0,0 +1,5 @@
+There are undoubtly more people to thank, but here's a start:
+
+Philippe De Muyter <phdm@info.ucl.ac.be>
+Glenn Burkhardt <glenn@aoi.ultranet.com>
+Philip Cox <phil@yucc.yorku.ca>
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..b03075b
--- /dev/null
+++ b/TODO
@@ -0,0 +1,13 @@
+- make argv[0]-recognition of X/YModem work with program_name_transform.
+- look into VMIN code: how to determine if it's usable (it isn't unter
+ FreeBSD and NetBSD (might have changed) and possibly many other
+ system), and what is the max value?
+ Anyway - we don't *need* it. It just reduces system load (but that's
+ not a real problem - zmodem over a ISDN/modem link is not much load).
+- provide a way to not use any CRC check (for those people who
+ a) think that lrzsz is to slow for their serial lines, or b) think
+ that their transmission lines are safe. Oh well, some people don't
+ learn without having pain).
+- improve error reporting.
+- clean up Output in verbose mode. (document what's printed if
+ verbose is `n')
diff --git a/acconfig.h b/acconfig.h
new file mode 100644
index 0000000..e1a6ad9
--- /dev/null
+++ b/acconfig.h
@@ -0,0 +1,76 @@
+/* define this if you have a reliable ftime function */
+#undef HAVE_FTIME
+
+/* define this if you have the timezone variable */
+#undef HAVE_TIMEZONE_VAR
+
+/* Define to 1 if NLS is requested. */
+#undef ENABLE_NLS
+
+/* Define as 1 if you have catgets and don't want to use GNU gettext. */
+#undef HAVE_CATGETS
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext. */
+#undef HAVE_GETTEXT
+
+/* Define if your locale.h file contains LC_MESSAGES. */
+#undef HAVE_LC_MESSAGES
+
+/* Define to the name of the distribution. */
+#undef PACKAGE
+
+/* The concatenation of the strings PACKAGE, "-", and VERSION. */
+#undef PACKAGE_VERSION
+
+/* Define to the version of the distribution. */
+#undef VERSION
+
+/* Define to 1 if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define to 1 if your utime() takes struct utimbuf as second argument */
+#undef HAVE_STRUCT_UTIMBUF
+
+/* Define to 1 if ANSI function prototypes are usable. */
+#undef PROTOTYPES
+
+/* Define to LOG_xxx (a syslog facility) if syslog() shall be used */
+#undef ENABLE_SYSLOG
+
+/* Define to 1 if syslogging shall be forced */
+#undef ENABLE_SYSLOG_FORCE
+
+/* Define to 1 if syslogging shall be default */
+#undef ENABLE_SYSLOG_DEFAULT
+
+/* Define to 1 if lrz shall create directories if needed */
+#undef ENABLE_MKDIR
+
+/* Define to public writable directory if you want this. Leave out the "'s */
+#undef PUBDIR
+
+/* Define to 1 if you want support for the timesync protocol */
+#undef ENABLE_TIMESYNC
+
+/* define to 1. we have a replacement function for it. */
+#undef HAVE_STRERROR
+
+/* define to 1 if you want strict ANSI prototypes. will remove some
+ extern x(); declarations. */
+#undef STRICT_PROTOTYPES
+
+/* where the localedata hides */
+/* #undef LOCALEDIR */
+
+/* do your system libraries declare errno? */
+#undef HAVE_ERRNO_DECLARATION
+
+/* define to type of speed_t (long?) */
+#undef speed_t
+
+/* define this if you headers conflict */
+#undef SYS_TIME_WITHOUT_SYS_SELECT
+
+/* define to type of socklen_t (int?) */
+#undef socklen_t
+
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..d6cca61
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,95 @@
+dnl AC_REPLACE_GNU_GETOPT
+AC_DEFUN(AC_REPLACE_GNU_GETOPT,
+[AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
+AC_SUBST(LIBOBJS)dnl
+])
+
+dnl
+dnl taken from taylor uucp
+AC_DEFUN(LRZSZ_ERRNO_DECL,[
+AC_MSG_CHECKING(for errno declaration)
+AC_CACHE_VAL(lrzsz_cv_decl_errno,
+[AC_TRY_COMPILE([#include <errno.h>], [int i = errno; errno = 1;],
+lrzsz_cv_decl_errno=yes, lrzsz_cv_decl_errno=no)])
+AC_MSG_RESULT($lrzsz_cv_decl_errno)
+if test $lrzsz_cv_decl_errno = yes; then
+ AC_DEFINE([HAVE_ERRNO_DECLARATION])
+fi
+])
+
+dnl for ease of use
+AC_DEFUN([LRZSZ_HEADERS_TERM_IO],[
+AC_CHECK_HEADERS(termios.h sys/termios.h termio.h sys/termio.h sgtty.h)dnl
+])
+
+dnl LRZSZ_TYPE_SPEED_T
+AC_DEFUN(LRZSZ_TYPE_SPEED_T,[
+AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([LRZSZ_HEADERS_TERM_IO])dnl
+AC_MSG_CHECKING(for speed_t)
+AC_CACHE_VAL(ac_cv_type_speed_t,
+[AC_EGREP_CPP(speed_t, [#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#else
+#if defined(HAVE_SYS_TERMIOS_H)
+#include <sys/termios.h>
+#else
+#if defined(HAVE_TERMIO_H)
+#include <termio.h>
+#else
+#if defined(HAVE_SYS_TERMIO_H)
+#include <sys/termio.h>
+#else
+#if defined(HAVE_SGTTY_H)
+#include <sgtty.h>
+#else
+#error neither termio.h nor sgtty.h found. Cannot continue. */
+#endif
+#endif
+#endif
+#endif
+#endif
+], ac_cv_type_speed_t=yes, ac_cv_type_speed_t=no)])dnl
+AC_MSG_RESULT($ac_cv_type_speed_t)
+if test $ac_cv_type_speed_t = no; then
+ AC_DEFINE([speed_t],long)
+fi
+])
+
+AC_DEFUN(lrzsz_HEADER_SYS_SELECT,
+[AC_CACHE_CHECK([whether sys/time.h and sys/select.h may both be included],
+ lrzsz_cv_header_sys_select,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/select.h>],
+[struct tm *tp;], lrzsz_cv_header_sys_select=yes, lrzsz_cv_header_sys_select=no)])
+if test $lrzsz_cv_header_sys_select = no; then
+ AC_DEFINE(SYS_TIME_WITHOUT_SYS_SELECT)
+fi
+])
+
+AC_DEFUN(UO_TYPE_SOCKLEN_T,[
+AC_CACHE_CHECK([for socklen_t],ac_cv_type_socklen_t,
+ [AC_TRY_COMPILE([
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+ ],[socklen_t x=0;return x;]
+ ,ac_cv_type_socklen_t=yes,ac_cv_type_socklen_t=no)]
+)
+if test $ac_cv_type_socklen_t = no; then
+cat >> confdefs.h <<\EOF
+#define socklen_t int
+EOF
+ AC_DEFINE([socklen_t],int)
+fi
+]) dnl DEFUN
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..e721fa7
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,719 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4a
+
+dnl Copyright (C) 1994, 1995-8, 1999 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 This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl AC_REPLACE_GNU_GETOPT
+AC_DEFUN(AC_REPLACE_GNU_GETOPT,
+[AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
+AC_SUBST(LIBOBJS)dnl
+])
+
+dnl
+dnl taken from taylor uucp
+AC_DEFUN(LRZSZ_ERRNO_DECL,[
+AC_MSG_CHECKING(for errno declaration)
+AC_CACHE_VAL(lrzsz_cv_decl_errno,
+[AC_TRY_COMPILE([#include <errno.h>], [int i = errno; errno = 1;],
+lrzsz_cv_decl_errno=yes, lrzsz_cv_decl_errno=no)])
+AC_MSG_RESULT($lrzsz_cv_decl_errno)
+if test $lrzsz_cv_decl_errno = yes; then
+ AC_DEFINE([HAVE_ERRNO_DECLARATION])
+fi
+])
+
+dnl for ease of use
+AC_DEFUN([LRZSZ_HEADERS_TERM_IO],[
+AC_CHECK_HEADERS(termios.h sys/termios.h termio.h sys/termio.h sgtty.h)dnl
+])
+
+dnl LRZSZ_TYPE_SPEED_T
+AC_DEFUN(LRZSZ_TYPE_SPEED_T,[
+AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_REQUIRE([LRZSZ_HEADERS_TERM_IO])dnl
+AC_MSG_CHECKING(for speed_t)
+AC_CACHE_VAL(ac_cv_type_speed_t,
+[AC_EGREP_CPP(speed_t, [#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#else
+#if defined(HAVE_SYS_TERMIOS_H)
+#include <sys/termios.h>
+#else
+#if defined(HAVE_TERMIO_H)
+#include <termio.h>
+#else
+#if defined(HAVE_SYS_TERMIO_H)
+#include <sys/termio.h>
+#else
+#if defined(HAVE_SGTTY_H)
+#include <sgtty.h>
+#else
+#error neither termio.h nor sgtty.h found. Cannot continue. */
+#endif
+#endif
+#endif
+#endif
+#endif
+], ac_cv_type_speed_t=yes, ac_cv_type_speed_t=no)])dnl
+AC_MSG_RESULT($ac_cv_type_speed_t)
+if test $ac_cv_type_speed_t = no; then
+ AC_DEFINE([speed_t],long)
+fi
+])
+
+AC_DEFUN(lrzsz_HEADER_SYS_SELECT,
+[AC_CACHE_CHECK([whether sys/time.h and sys/select.h may both be included],
+ lrzsz_cv_header_sys_select,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/select.h>],
+[struct tm *tp;], lrzsz_cv_header_sys_select=yes, lrzsz_cv_header_sys_select=no)])
+if test $lrzsz_cv_header_sys_select = no; then
+ AC_DEFINE(SYS_TIME_WITHOUT_SYS_SELECT)
+fi
+])
+
+AC_DEFUN(UO_TYPE_SOCKLEN_T,[
+AC_CACHE_CHECK([for socklen_t],ac_cv_type_socklen_t,
+ [AC_TRY_COMPILE([
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+ ],[socklen_t x=0;return x;]
+ ,ac_cv_type_socklen_t=yes,ac_cv_type_socklen_t=no)]
+)
+if test $ac_cv_type_socklen_t = no; then
+cat >> confdefs.h <<\EOF
+#define socklen_t int
+EOF
+ AC_DEFINE([socklen_t],int)
+fi
+]) dnl DEFUN
+
+# Do all the work for Automake. This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN(AM_INIT_AUTOMAKE,
+[AC_REQUIRE([AC_PROG_INSTALL])
+dnl We require 2.13 because we rely on SHELL being computed by configure.
+AC_PREREQ([2.13])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN(AM_SANITY_CHECK,
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "[$]*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "[$]*" != "X $srcdir/configure conftestfile" \
+ && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "[$]2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN(AM_MISSING_PROG,
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+ $1=$2
+ AC_MSG_RESULT(found)
+else
+ $1="$3/missing $2"
+ AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file.
+
+AC_DEFUN(AM_CONFIG_HEADER,
+[AC_PREREQ([2.12])
+AC_CONFIG_HEADER([$1])
+dnl When config.status generates a header, we must update the stamp-h file.
+dnl This file resides in the same directory as the config header
+dnl that is generated. We must strip everything past the first ":",
+dnl and everything past the last "/".
+AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
+ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
+<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
+<<am_indx=1
+for am_file in <<$1>>; do
+ case " <<$>>CONFIG_HEADERS " in
+ *" <<$>>am_file "*<<)>>
+ echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
+ ;;
+ esac
+ am_indx=`expr "<<$>>am_indx" + 1`
+done<<>>dnl>>)
+changequote([,]))])
+
+
+# serial 1
+
+AC_DEFUN(AM_C_PROTOTYPES,
+[AC_REQUIRE([AM_PROG_CC_STDC])
+AC_REQUIRE([AC_PROG_CPP])
+AC_MSG_CHECKING([for function prototypes])
+if test "$am_cv_prog_cc_stdc" != no; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
+ U= ANSI2KNR=
+else
+ AC_MSG_RESULT(no)
+ U=_ ANSI2KNR=./ansi2knr
+ # Ensure some checks needed by ansi2knr itself.
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS(string.h)
+fi
+AC_SUBST(U)dnl
+AC_SUBST(ANSI2KNR)dnl
+])
+
+
+# serial 1
+
+# @defmac AC_PROG_CC_STDC
+# @maindex PROG_CC_STDC
+# @ovindex CC
+# If the C compiler in not in ANSI C mode by default, try to add an option
+# to output variable @code{CC} to make it so. This macro tries various
+# options that select ANSI C on some system or another. It considers the
+# compiler to be in ANSI C mode if it handles function prototypes correctly.
+#
+# If you use this macro, you should check after calling it whether the C
+# compiler has been set to accept ANSI C; if not, the shell variable
+# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
+# code in ANSI C, you can make an un-ANSIfied copy of it by using the
+# program @code{ansi2knr}, which comes with Ghostscript.
+# @end defmac
+
+AC_DEFUN(AM_PROG_CC_STDC,
+[AC_REQUIRE([AC_PROG_CC])
+AC_BEFORE([$0], [AC_C_INLINE])
+AC_BEFORE([$0], [AC_C_CONST])
+dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
+dnl a magic option to avoid problems with ANSI preprocessor commands
+dnl like #elif.
+dnl FIXME: can't do this because then AC_AIX won't work due to a
+dnl circular dependency.
+dnl AC_BEFORE([$0], [AC_PROG_CPP])
+AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
+AC_CACHE_VAL(am_cv_prog_cc_stdc,
+[am_cv_prog_cc_stdc=no
+ac_save_CC="$CC"
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_TRY_COMPILE(
+[#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+], [
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+],
+[am_cv_prog_cc_stdc="$ac_arg"; break])
+done
+CC="$ac_save_CC"
+])
+if test -z "$am_cv_prog_cc_stdc"; then
+ AC_MSG_RESULT([none needed])
+else
+ AC_MSG_RESULT($am_cv_prog_cc_stdc)
+fi
+case "x$am_cv_prog_cc_stdc" in
+ x|xno) ;;
+ *) CC="$CC $am_cv_prog_cc_stdc" ;;
+esac
+])
+
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 5
+
+AC_DEFUN(AM_WITH_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)
+
+ USE_INCLUDED_LIBINTL=no
+
+ dnl If we use NLS figure out what method
+ if test "$USE_NLS" = "yes"; then
+ AC_DEFINE(ENABLE_NLS)
+ 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 gettext or catgets are available (in this order) we
+ dnl use this. Else we have to fall back to GNU NLS library.
+ dnl catgets is only used if permitted by option --with-catgets.
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+ CATOBJEXT=NONE
+
+ AC_CHECK_HEADER(libintl.h,
+ [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
+ [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
+ gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
+
+ if test "$gt_cv_func_gettext_libc" != "yes"; then
+ AC_CHECK_LIB(intl, bindtextdomain,
+ [AC_CACHE_CHECK([for gettext in libintl],
+ gt_cv_func_gettext_libintl,
+ [AC_CHECK_LIB(intl, gettext,
+ gt_cv_func_gettext_libintl=yes,
+ gt_cv_func_gettext_libintl=no)],
+ gt_cv_func_gettext_libintl=no)])
+ fi
+
+ if test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$gt_cv_func_gettext_libintl" = "yes"; then
+ AC_DEFINE(HAVE_GETTEXT)
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+ if test "$MSGFMT" != "no"; then
+ AC_CHECK_FUNCS(dcgettext)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr],
+ [CATOBJEXT=.gmo
+ DATADIRNAME=share],
+ [CATOBJEXT=.mo
+ DATADIRNAME=lib])
+ INSTOBJEXT=.mo
+ fi
+ fi
+ ])
+
+ if test "$CATOBJEXT" = "NONE"; then
+ AC_MSG_CHECKING([whether catgets can be used])
+ AC_ARG_WITH(catgets,
+ [ --with-catgets use catgets functions if available],
+ nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
+ AC_MSG_RESULT($nls_cv_use_catgets)
+
+ if test "$nls_cv_use_catgets" = "yes"; then
+ dnl No gettext in C library. Try catgets next.
+ AC_CHECK_LIB(i, main)
+ AC_CHECK_FUNC(catgets,
+ [AC_DEFINE(HAVE_CATGETS)
+ INTLOBJS="\$(CATOBJS)"
+ AC_PATH_PROG(GENCAT, gencat, no)dnl
+ if test "$GENCAT" != "no"; then
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
+ if test "$GMSGFMT" = "no"; then
+ AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
+ fi
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.cat
+ INSTOBJEXT=.cat
+ DATADIRNAME=lib
+ INTLDEPS='$(top_builddir)/intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi])
+ fi
+ fi
+
+ if test "$CATOBJEXT" = "NONE"; then
+ dnl Neither gettext nor catgets in included in the C library.
+ dnl Fall back on 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.
+ INTLOBJS="\$(GETTOBJS)"
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ AC_SUBST(MSGFMT)
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.gmo
+ INSTOBJEXT=.mo
+ DATADIRNAME=share
+ INTLDEPS='$(top_builddir)/intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+
+ 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 /dev/null 2> /dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT(
+ [found xgettext program is not GNU xgettext; ignore it])
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+ else
+ DATADIRNAME=share
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+ AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
+ AC_OUTPUT_COMMANDS(
+ [case "$CONFIG_FILES" in *po/Makefile.in*)
+ sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
+ esac])
+
+
+ # If this is used in GNU gettext we have to set USE_NLS to `yes'
+ # because some of the sources are only built for this goal.
+ if test "$PACKAGE" = gettext; then
+ USE_NLS=yes
+ USE_INCLUDED_LIBINTL=yes
+ fi
+
+ dnl These rules are solely for the distribution goal. While doing this
+ dnl we only have to keep exactly one list of the available catalogs
+ dnl in configure.in.
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST(USE_INCLUDED_LIBINTL)
+ AC_SUBST(CATALOGS)
+ AC_SUBST(CATOBJEXT)
+ AC_SUBST(DATADIRNAME)
+ AC_SUBST(GMOFILES)
+ AC_SUBST(INSTOBJEXT)
+ AC_SUBST(INTLDEPS)
+ AC_SUBST(INTLLIBS)
+ AC_SUBST(INTLOBJS)
+ AC_SUBST(POFILES)
+ AC_SUBST(POSUB)
+ ])
+
+AC_DEFUN(AM_GNU_GETTEXT,
+ [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AC_PROG_CC])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([AC_C_INLINE])dnl
+ AC_REQUIRE([AC_TYPE_OFF_T])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+ AC_REQUIRE([AC_FUNC_MMAP])dnl
+
+ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h sys/param.h])
+ AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
+strdup __argz_count __argz_stringify __argz_next])
+
+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ AC_CHECK_FUNCS(stpcpy)
+ fi
+ if test "${ac_cv_func_stpcpy}" = "yes"; then
+ AC_DEFINE(HAVE_STPCPY)
+ fi
+
+ AM_LC_MESSAGES
+ AM_WITH_NLS
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ AC_MSG_CHECKING(for catalogs to be installed)
+ NEW_LINGUAS=
+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ AC_MSG_RESULT($LINGUAS)
+ fi
+
+ dnl Construct list of names of catalog files to be constructed.
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ dnl The reference to <locale.h> in the installed <libintl.h> file
+ dnl must be resolved because we cannot expect the users of this
+ dnl to define HAVE_LOCALE_H.
+ if test $ac_cv_header_locale_h = yes; then
+ INCLUDE_LOCALE_H="#include <locale.h>"
+ else
+ INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>. Take care yourself. */"
+ fi
+ AC_SUBST(INCLUDE_LOCALE_H)
+
+ dnl Determine which catalog format we have (if any is needed)
+ dnl For now we know about two different formats:
+ dnl Linux libc-5 and the normal X/Open format
+ test -d intl || mkdir intl
+ if test "$CATOBJEXT" = ".cat"; then
+ AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
+
+ dnl Transform the SED scripts while copying because some dumb SEDs
+ dnl cannot handle comments.
+ sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
+ fi
+ dnl po2tbl.sed is always needed.
+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
+
+ dnl In the intl/Makefile.in we have a special dependency which makes
+ dnl only sense for gettext. We comment this out for non-gettext
+ dnl packages.
+ if test "$PACKAGE" = "gettext"; then
+ GT_NO="#NO#"
+ GT_YES=
+ else
+ GT_NO=
+ GT_YES="#YES#"
+ fi
+ AC_SUBST(GT_NO)
+ AC_SUBST(GT_YES)
+
+ 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 is.
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+ AC_SUBST(MKINSTALLDIRS)
+
+ dnl *** For now the libtool support in intl/Makefile is not for real.
+ l=
+ AC_SUBST(l)
+
+ dnl Generate list of files to be processed by xgettext which will
+ dnl be included in po/Makefile.
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+ ])
+
+# Search path for a program which passes the given test.
+# Ulrich Drepper <drepper@cygnus.com>, 1996.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+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,
+[# 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.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in ifelse([$5], , $PATH, [$5]); do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if [$3]; then
+ ac_cv_path_$1="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ 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 -n "[$]$1"; then
+ AC_MSG_RESULT([$]$1)
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+AC_DEFUN(AM_LC_MESSAGES,
+ [if test $ac_cv_header_locale_h = yes; then
+ AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+ [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ AC_DEFINE(HAVE_LC_MESSAGES)
+ fi
+ fi])
+
diff --git a/beos-runpiped.c b/beos-runpiped.c
new file mode 100644
index 0000000..2bc8eef
--- /dev/null
+++ b/beos-runpiped.c
@@ -0,0 +1,60 @@
+#include <fcntl.h>
+#include <unistd.h>
+#include <be/kernel/OS.h>
+
+int main(int argc, char **argv)
+{
+ int pid,fd1,fd2;
+ sem_id sem1,sem2;
+ sem1=create_sem(1,"piperun");
+ sem2=create_sem(1,"piperun");
+ if (sem1<B_NO_ERROR ||sem2<B_NO_ERROR) {
+ perror("create_sem");
+ exit(1);
+ }
+ acquire_sem(sem1);
+ acquire_sem(sem2);
+ pid=fork();
+ if (pid==0) {
+ fd1=open("/pipe/1",O_WRONLY|O_CREAT,0666);
+ if (fd1==-1) {
+ perror("writer: /pipe/1");
+ _exit(1);
+ }
+ release_sem(sem1);
+ /* wait for other side to open the pipe 1 */
+ acquire_sem(sem2);
+ /* wait for creation of pipe 2 */
+ acquire_sem(sem1);
+ fd2=open("/pipe/2",O_RDONLY);
+ if (fd2==-1) {
+ perror("/pipe/2");
+ _exit(1);
+ }
+ release_sem(sem2);
+ dup2(fd2,0);
+ dup2(fd1,1);
+ system(argv[2]);
+
+ _exit(1);
+ }
+ acquire_sem(sem1);
+ fd1=open("/pipe/1",O_RDONLY);
+ release_sem(sem2);
+ if (fd1==-1) {
+ perror("/pipe/1");
+ exit(1);
+ }
+ fd2=open("/pipe/2",O_WRONLY|O_CREAT,0666);
+ if (fd2==-1) {
+ perror("writer: /pipe/2");
+ exit(1);
+ }
+ release_sem(sem1);
+ /* wait for child to open ... */
+ acquire_sem(sem2);
+ dup2(fd1,0);
+ dup2(fd2,1);
+ system(argv[1]);
+ exit(0);
+}
diff --git a/buildrpm b/buildrpm
new file mode 100755
index 0000000..cfd28f7
--- /dev/null
+++ b/buildrpm
@@ -0,0 +1,21 @@
+#! /bin/sh
+set -x
+srcdir=$1
+
+arch=`rpm --showrc --rcfile $srcdir/rpmrc | awk '/^build arch/ {print $4}'`
+if test "x$arch" = "x" ; then
+ echo "cannot determinate architecture" >&2
+ exit 1
+fi
+mkdir $arch 2>/dev/null
+didmkdir=$?
+rpm -ba --rcfile $srcdir/rpmrc Specfile
+ec=$?
+if test $ec ; then
+ mv $arch/* .
+ ec=$?
+fi
+if test $didmkdir ; then
+ rmdir $arch
+fi
+exit $ec
diff --git a/check.lrzsz b/check.lrzsz
new file mode 100755
index 0000000..61efbed
--- /dev/null
+++ b/check.lrzsz
@@ -0,0 +1,793 @@
+#! /bin/sh
+
+testdir="testdir.lrzsz"
+srcdir="$1"
+if test $srcdir = . ; then
+ srcdir=`pwd`
+fi
+if test $srcdir = .. ; then
+ srcdir=`pwd`/..
+fi
+objdir="$2"
+if test $objdir = . ; then
+ objdir=`pwd`
+fi
+
+if test "x$3" = x ; then
+ mode=all
+else
+ mode=$3
+fi
+
+#SZBUFSIZE="-B 524288"
+RZBUFSIZE="-B 524288"
+
+SZ="$objdir/src/lsz"
+RZ="$objdir/src/lrz"
+
+echo checking with srcdir = $1 and objdir = $2
+
+# z_test_files: files to test zmodem with.
+# z8_test_files: files to test zmodem-8k with. Optional.
+# y_test_files: files to test ymodem with.
+# x_test_files: files to test xmodem with. Must be ascii, as we need the
+# ascii mode to remove the padding ^Zs.
+
+# generate list of testfiles
+z_test_files=""
+for i in $srcdir/src/l?z.c ; do
+ z_test_files="$z_test_files $i"
+ x_test_files="$x_test_files $i"
+done
+for i in $objdir/src/l?z ; do
+ z_test_files="$z_test_files $i"
+ y_test_files="$y_test_files $i"
+done
+rm -f $objdir/null1 $objdir/null2
+touch $objdir/null1 $objdir/null2
+x_test_files="$objdir/null1 $x_test_files"
+y_test_files="$objdir/null1 $y_test_files"
+z_test_files="$objdir/null1 $objdir/null2 $z_test_files"
+for i in /pub/gnu/emacs/emacs-2*.tar.gz ; do
+ if test -f "$i" ; then
+ z8_test_files="$z8_test_files $i"
+ z_test_files="$z_test_files $i"
+ fi
+done
+
+# change to tmp dir
+if test "x$TMPDIR" = x ; then
+ cd /tmp
+else
+ cd $TMPDIR || cd /tmp
+fi
+
+rm -rf $testdir
+mkdir $testdir
+exec 5>$testdir/error.log
+(mkfifo $testdir/pipe || mknod $testdir/pipe p) 2>&5
+
+# test zmodem
+if test "$mode" = all -o "$mode" = z ; then
+ echo "testing ZMODEM"
+ mkdir $testdir/zmodem
+ failed=0
+ ($SZ -q $SZBUFSIZE $z_test_files ) <$testdir/pipe | \
+ (cd $testdir/zmodem ; echo "123" >null1 ; exec $RZ -y $RZBUFSIZE $QUIET >>../pipe )
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodem 2>&5
+ if test $failed = 1 ; then
+ echo "ZMODEM test failed"
+ any_failure="$any_failure ZMODEM"
+ fi
+fi
+# test zmodem framlen
+if test "$mode" = f ; then
+ echo "testing ZMODEMframlen"
+ mkdir $testdir/zmodem
+ failed=0
+ ($SZ -q $SZBUFSIZE -l 128 $z_test_files ) <$testdir/pipe | \
+ (cd $testdir/zmodem ; exec $RZ $RZBUFSIZE $QUIET >>../pipe )
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodem 2>&5
+ if test $failed = 1 ; then
+ echo "ZMODEM test failed"
+ any_failure="$any_failure ZMODEM"
+ fi
+fi
+
+# test zmodem-4k
+if test "$mode" = all -o "$mode" = z4 ; then
+ echo "testing ZMODEM4K"
+ mkdir $testdir/zmodem4k
+ failed=0
+ ($SZ -q4 $SZBUFSIZE $z_test_files ) <$testdir/pipe | \
+ (cd $testdir/zmodem4k ; exec $RZ $RZBUFSIZE $QUIET >>../pipe )
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem4k/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem4k/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodem4k 2>&5
+ if test $failed = 1 ; then
+ echo "ZMODEM4k test failed"
+ any_failure="$any_failure ZMODEM4k"
+ fi
+fi
+
+# test zmodem8k
+if test "$mode" = all -o "$mode" = z8 ; then
+ # we test this only if we have something really large, because this is
+ # we only case we can expect any differences
+ if test "x$z8_test_files" = x ; then
+ :
+ else
+ echo "testing ZMODEM8K"
+ mkdir $testdir/zmodem8k
+ failed=0
+ $SZ -q8OT $SZBUFSIZE $z8_test_files <$testdir/pipe | \
+ (cd $testdir/zmodem8k ; $RZ -O $RZBUFSIZE $QUIET >>../pipe )
+ for i in $z8_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem8k/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem8k/$bn
+ else
+ failed=1
+ fi
+ done
+ if test $failed = 1 ; then
+ echo "ZMODEM8k test failed"
+ any_failure="$any_failure ZMODEM8k"
+ fi
+ rmdir $testdir/zmodem8k 2>&5
+ fi
+fi
+
+if test "$mode" = all -o "$mode" = z8N ; then
+ # we test this only if we have something really large, because this is
+ # we only case we can expect any differences
+ if test "x$z8_test_files" = x ; then
+ :
+ else
+ echo "testing ZMODEM8K-NULL"
+ mkdir $testdir/zmodem8k-NULL
+ $SZ -q8OT $SZBUFSIZE $z8_test_files <$testdir/pipe | \
+ (cd $testdir/zmodem8k-NULL ; $RZ -DO $RZBUFSIZE $QUIET >>../pipe )
+ rmdir $testdir/zmodem8k-NULL 2>&5
+ fi
+fi
+
+# out-of-band tcp
+if test "$mode" = tcpo ; then
+ echo "testing ZMODEMtcpo"
+ mkdir $testdir/zmodemtcpo
+ failed=0
+ $SZ --tcp-server -q $SZBUFSIZE $z_test_files | \
+ perl -e '$|=1; while(<>) {if (/^connect with .* "(.*)"/) {print $1 . "\n";}}' |
+ ( cd $testdir/zmodemtcpo ; xargs -l1 $RZ $RZBUFSIZE -vv --tcp-client )
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodemtcpo/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodemtcpo/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodemtcpo 2>&5
+ if test $failed = 1 ; then
+ echo "ZMODEMtcpo test failed"
+ any_failure="$any_failure ZMODEMtcpo"
+ fi
+fi
+
+if test "$mode" = error ; then
+ # we test this only if we have something really large, because this is
+ # we only case we can expect any differences
+ if test "x$y_test_files" = x ; then
+ :
+ else
+ echo "testing error, lsz"
+ mkdir $testdir/error.lsz
+ failed=0
+ # strace -vs 128 -o out $SZ -8 -vvvvvvvv $SZBUFSIZE $y_test_files <$testdir/pipe | \
+ $SZ -8q $SZBUFSIZE $y_test_files <$testdir/pipe | \
+ (cd $testdir/error.lsz ; $RZ --errors 32768 $RZBUFSIZE $QUIET >>../pipe 2>/dev/null)
+ for i in $y_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/error.lsz/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/error.lsz/$bn
+ else
+ failed=1
+ fi
+ done
+ if test $failed = 1 ; then
+ echo "error test failed"
+ any_failure="$any_failure error.lsz"
+ fi
+ rmdir $testdir/error.lsz 2>&5
+
+ # omen zmodem has a really bad error behaviour. it gets so slow
+ # that you wouldn't believe it ...
+ echo "testing error, omen.sz"
+ mkdir $testdir/error.omen
+ failed=0
+ omen.sz $y_test_files <$testdir/pipe | \
+ (cd $testdir/error.omen ; $RZ -vvv --errors 32768 $RZBUFSIZE $QUIET >>../pipe 2>/tmp/out2)
+ for i in $y_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/error.omen/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/error.omen/$bn
+ else
+ failed=1
+ fi
+ done
+ if test $failed = 1 ; then
+ echo "error.omen test failed"
+ any_failure="$any_failure error.omen"
+ fi
+ rmdir $testdir/error.omen 2>&5
+
+ echo "testing error, zm.sz"
+ mkdir $testdir/error.zm
+ failed=0
+ zmtx $y_test_files <$testdir/pipe | \
+ (cd $testdir/error.zm ; $RZ -vvv --errors 32768 $RZBUFSIZE $QUIET >>../pipe 2>/tmp/out2)
+ for i in $y_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/error.zm/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/error.zm/$bn
+ else
+ failed=1
+ fi
+ done
+ if test $failed = 1 ; then
+ echo "error.zm test failed"
+ any_failure="$any_failure error.zm"
+ fi
+ rmdir $testdir/error.zm 2>&5
+ fi
+fi
+
+
+# test ymodem
+if test "$mode" = all -o "$mode" = y ; then
+ echo "testing YMODEM"
+ mkdir $testdir/ymodem
+ failed=0
+ $SZ --ymodem -q $y_test_files <$testdir/pipe | \
+ (cd $testdir/ymodem ; $RZ $QUIET --ymodem >>../pipe)
+ for i in $y_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/ymodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/ymodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/ymodem 2>&5
+ if test $failed = 1 ; then
+ echo "YMODEM test failed"
+ any_failure="$any_failure YMODEM"
+ fi
+fi
+
+if test "$mode" = all -o "$mode" = x ; then
+ echo "testing XMODEM"
+ mkdir $testdir/xmodem
+ failed=0
+ for i in $x_test_files; do
+ bn=`basename $i`
+ $SZ --xmodem -qa $i <$testdir/pipe | \
+ (cd $testdir/xmodem ; $RZ $QUIET -a --xmodem $bn >>../pipe)
+ cmp $i $testdir/xmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/xmodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/xmodem 2>&5
+ if test $failed = 1 ; then
+ echo "XMODEM test failed"
+ any_failure="$any_failure XMODEM"
+ fi
+fi
+
+if test "$mode" = all -o "$mode" = manage ; then
+ echo "testing file management, appending"
+ mkdir $testdir/manag.append
+ failed=0
+ $SZ -q --append $srcdir/src/lsz.c $srcdir/src/lsz.c <$testdir/pipe | \
+ (cd $testdir/manag.append ; $RZ $QUIET >>../pipe)
+ rm -f $testdir/manag.append/compare
+ cp $srcdir/src/lsz.c $testdir/manag.append/compare
+ cat $srcdir/src/lsz.c >>$testdir/manag.append/compare
+ cmp $testdir/manag.append/compare $testdir/manag.append/lsz.c
+ if test $? -eq 0 ; then
+ rm -f $testdir/manag.append/lsz.c
+ rm -f $testdir/manag.append/compare
+ else
+ failed=1
+ fi
+ rmdir $testdir/manag.append 2>&5
+ if test $failed = 1 ; then
+ echo "management/append test failed"
+ any_failure="$any_failure manag.append"
+ fi
+
+ echo "testing file management, renaming"
+ mkdir $testdir/manag.rename
+ failed=0
+ rm -f $testdir/manag.rename/lsz.c
+ cp $srcdir/src/lsz.c $testdir/manag.rename/
+ $SZ -q --rename $srcdir/src/lsz.c $srcdir/src/lsz.c <$testdir/pipe | \
+ (cd $testdir/manag.rename ; $RZ $QUIET >>../pipe)
+ cmp $testdir/manag.rename/lsz.c $srcdir/src/lsz.c
+ if test $? -ne 0 ; then
+ failed=1
+ else
+ cmp $testdir/manag.rename/lsz.c.0 $srcdir/src/lsz.c
+ if test $? -ne 0 ; then
+ failed=1
+ else
+ cmp $testdir/manag.rename/lsz.c.1 $srcdir/src/lsz.c
+ if test $? -ne 0 ; then
+ failed=1
+ fi
+ fi
+ fi
+ if test $failed -eq 0 ; then
+ rm -f $testdir/manag.rename/lsz.c
+ rm -f $testdir/manag.rename/lsz.c.0
+ rm -f $testdir/manag.rename/lsz.c.1
+ fi
+ rmdir $testdir/manag.rename 2>&5
+ if test $failed = 1 ; then
+ echo "management/rename test failed"
+ any_failure="$any_failure manag.rename"
+ fi
+fi
+
+
+# resume -r
+if test "$mode" = all -o "$mode" = sz-r ; then
+ mkdir $testdir/resume-s
+ echo "testing ZMODEM resume (sz -r)"
+ dd if=$srcdir/src/Makefile.in of=$testdir/resume-s/lsz.c bs=256 count=5 2>&5
+ ($SZ -rq $srcdir/src/lsz.c) <$testdir/pipe | \
+ (cd $testdir/resume-s ; $RZ $QUIET >>../pipe )
+ echo "differences are normal:" >&5
+ if cmp $srcdir/src/lsz.c $testdir/resume-s/lsz.c >&5 ; then
+ echo "receiver did not resume, but file is ok"
+ any_failure="$any_failure ZMODEM-resume/sz"
+ else
+ dd if=$srcdir/src/lsz.c of=$testdir/resume-s/lsz.c1 bs=256 count=5 2>&5
+ dd if=$testdir/resume-s/lsz.c bs=256 skip=5 >>$testdir/resume-s/lsz.c1 2>&5
+ if cmp $srcdir/src/lsz.c $testdir/resume-s/lsz.c1 ; then
+ :
+ rm -f $testdir/resume-s/lsz.c
+ rm -f $testdir/resume-s/lsz.c1
+ rmdir $testdir/resume-s 2>&5
+ else
+ echo "sender resumed, but files differ. This is really bad"
+ any_failure="$any_failure ZMODEM-resume/sz"
+ fi
+ fi
+fi
+
+if test "$mode" = all -o "$mode" = rz-r ; then
+ echo "testing ZMODEM resume (rz -r)"
+ mkdir $testdir/resume-r 2>&5
+ dd if=$srcdir/src/Makefile.in of=$testdir/resume-r/lsz.c bs=256 count=5 2>&5
+ ($SZ -q $srcdir/src/lsz.c) <$testdir/pipe | \
+ (cd $testdir/resume-r ; $RZ -r $QUIET >>../pipe )
+ echo "differences are normal:" >&5
+ if cmp $srcdir/src/lsz.c $testdir/resume-r/lsz.c >&5 ; then
+ echo "receiver did not resume, but file is ok"
+ any_failure="$any_failure ZMODEM-resume/rz"
+ else
+ dd if=$srcdir/src/lsz.c of=$testdir/resume-r/lsz.c1 bs=256 count=5 2>&5
+ dd if=$testdir/resume-r/lsz.c bs=256 skip=5 >>$testdir/resume-r/lsz.c1 2>&5
+ if cmp $srcdir/src/lsz.c $testdir/resume-r/lsz.c1 ; then
+ :
+ rm -f $testdir/resume-r/lsz.c
+ rm -f $testdir/resume-r/lsz.c1
+ rmdir $testdir/resume-r 2>&5
+ else
+ echo "sender resumed, but files differ. This is really bad"
+ any_failure="$any_failure ZMODEM-resume/rz"
+ fi
+ fi
+fi
+
+# test lsz -> original rz
+if test "$mode" = orig-rz ; then
+ echo "testing ZMODEM"
+ mkdir $testdir/zmodem
+ failed=0
+ ($SZ -q $SZBUFSIZE $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/zmodem ; exec omen.rz $QUIET >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodem 2>&5
+ if test $failed = 1 ; then
+ echo "orig-rz test failed"
+ any_failure="$any_failure orig-rz"
+ fi
+fi
+
+
+# test original sz -> lrz
+if test "$mode" = orig-sz ; then
+ echo "testing ZMODEM"
+ mkdir $testdir/zmodem
+ failed=0
+ (omen.sz $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/zmodem ; exec $RZ >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodem 2>&5
+ if test $failed = 1 ; then
+ echo "orig-sz test failed"
+ any_failure="$any_failure orig-sz"
+ fi
+fi
+
+# test original sz -> lrz
+if test "$mode" = orig-kombi ; then
+ echo "testing ZMODEM"
+ mkdir $testdir/zmodem
+ failed=0
+ (omen.sz $y_test_files ;
+ sleep 1;
+ cd $testdir/zmodem;
+ echo 
+ exec omen.rz ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/zmodem ;
+ $RZ ;
+ rm -f * ;
+ sleep 3 ;
+ $SZ $y_test_files ) >>$testdir/pipe
+ for i in $y_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodem 2>&5
+ if test $failed = 1 ; then
+ echo "orig-kombi test failed"
+ any_failure="$any_failure orig-kombi"
+ fi
+fi
+
+# test lsz -> zm rz (zxrx)
+if test "$mode" = zm-rz ; then
+ echo "testing ZMODEM"
+ mkdir $testdir/zmodem
+ failed=0
+ ($SZ -q $SZBUFSIZE $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/zmodem ; exec zmrx $QUIET >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodem 2>&5
+ if test $failed = 1 ; then
+ echo "orig-rz test failed"
+ any_failure="$any_failure zm-rz"
+ fi
+fi
+
+# test zm sz (zmtx) -> lrz
+if test "$mode" = zm-sz ; then
+ echo "testing ZMODEM"
+ mkdir $testdir/zmodem
+ failed=0
+ (zmtx $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/zmodem ; exec $RZ >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/zmodem 2>&5
+ if test $failed = 1 ; then
+ echo "orig-sz test failed"
+ any_failure="$any_failure zm-sz"
+ fi
+fi
+
+# test turbo mode lsz -> zmrx, omen.rz, lrz
+if test "$mode" = turbo ; then
+ echo "testing turbo -> zmrx"
+ mkdir $testdir/turbo.zmrx
+ failed=0
+ ($SZ -qT $SZBUFSIZE $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/turbo.zmrx ; exec zmrx >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/turbo.zmrx/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/turbo.zmrx/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/turbo.zmrx 2>&5
+ if test $failed = 1 ; then
+ echo "turbo-zmrx test failed"
+ any_failure="$any_failure turbo-zmrx"
+ fi
+
+ echo "testing turbo -> omen.rz"
+ mkdir $testdir/turbo.omen.rz
+ failed=0
+ ($SZ -qT $SZBUFSIZE $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/turbo.omen.rz ; exec omen.rz >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/turbo.omen.rz/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/turbo.omen.rz/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/turbo.omen.rz 2>&5
+ if test $failed = 1 ; then
+ echo "turbo-omen.rz test failed"
+ any_failure="$any_failure turbo-omen.rz"
+ fi
+
+ echo "testing turbo -> lrz"
+ mkdir $testdir/turbo.lrz
+ failed=0
+ ($SZ -qT $SZBUFSIZE $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/turbo.lrz ; exec lrz >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/turbo.lrz/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/turbo.lrz/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/turbo.omen.rz 2>&5
+ if test $failed = 1 ; then
+ echo "turbo-lrz test failed"
+ any_failure="$any_failure turbo-lrz"
+ fi
+fi
+
+#
+# startup timing checks
+#
+# test lsz -> zm rz (zxrx)
+if test "$mode" = startup ; then
+
+ echo "testing lsz -> zm rz. lsz sleeps 10 seconds"
+ mkdir $testdir/startup.1
+ failed=0
+ ($SZ --delay-startup 10 -q $SZBUFSIZE $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/startup.1 ; exec zmrx $QUIET >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/startup.1/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/startup.1/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/startup.1 2>&5
+ if test $failed = 1 ; then
+ echo "zm-rz startup-timing test failed"
+ any_failure="$any_failure zm-rz-startup-timing"
+ fi
+
+ echo "testing lsz -> omen.rz. lsz sleeps 10 seconds"
+ mkdir $testdir/startup.2
+ failed=0
+ ($SZ --delay-startup 10 -q $SZBUFSIZE $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/startup.2 ; exec omen.rz $QUIET >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/startup.2/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/startup.2/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/startup.2 2>&5
+ if test $failed = 1 ; then
+ echo "omen.rz startup-timing test failed"
+ any_failure="$any_failure omen-rz-startup-timing"
+ fi
+
+ echo "testing lsz -> lrz. lsz sleeps 10 seconds"
+ mkdir $testdir/startup.3
+ failed=0
+ ($SZ --delay-startup 10 -q $SZBUFSIZE $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/startup.3 ; exec $RZ $QUIET >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/startup.3/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/startup.3/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/startup.3 2>&5
+ if test $failed = 1 ; then
+ echo "lrz startup-timing test failed"
+ any_failure="$any_failure lrz-startup-timing"
+ fi
+
+ echo "testing zmtx -> lrz. lrz sleeps 10 seconds"
+ mkdir $testdir/startup.4
+ failed=0
+ (zmtx $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/startup.4 ; exec $RZ --delay-startup 10 $QUIET >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/startup.4/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/startup.4/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/startup.4 2>&5
+ if test $failed = 1 ; then
+ echo "zmtx startup-timing test failed"
+ any_failure="$any_failure zmtx-startup-timing"
+ fi
+
+ echo "testing omen.sz -> lrz. lrz sleeps 10 seconds"
+ mkdir $testdir/startup.5
+ failed=0
+ (omen.sz $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/startup.5 ; exec $RZ --delay-startup 10 $QUIET >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/startup.5/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/startup.5/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/startup.5 2>&5
+ if test $failed = 1 ; then
+ echo "omen.sz startup-timing test failed"
+ any_failure="$any_failure omen.sz-startup-timing"
+ fi
+
+ echo "testing lsz -> lrz. lrz sleeps 10 seconds"
+ mkdir $testdir/startup.6
+ failed=0
+ ($SZ -q $z_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/startup.6 ; exec $RZ --delay-startup 10 $QUIET >>../pipe)
+ for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/startup.6/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/startup.6/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/startup.6 2>&5
+ if test $failed = 1 ; then
+ echo "lsz startup-timing test failed"
+ any_failure="$any_failure lsz-startup-timing"
+ fi
+fi
+
+if test "$mode" = stop-at ; then
+ echo "testing lsz -> lrz. lsz stops after 10 seconds"
+ mkdir $testdir/stop-at
+ failed=0
+ ($SZ --stop-at +10 $z8_test_files ) 2>/dev/null <$testdir/pipe | \
+ (cd $testdir/stop-at ; exec $RZ $QUIET >>../pipe)
+ for i in $z8_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/stop-at/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/stop-at/$bn
+ else
+ failed=1
+ fi
+ done
+ rmdir $testdir/stop-at 2>&5
+ if test $failed = 1 ; then
+ echo "stop-at test failed"
+ any_failure="$any_failure stop-at"
+ fi
+fi
+
+if test "x$any_failure" = x ; then
+ :
+else
+ echo "the following tests failed:"
+ echo $any_failure
+ echo "have a look into `pwd`/$testdir"
+ exit 1
+fi
+
+echo "All tests OK."
+if test "$mode" = all -o "$mode" = abuse ; then
+ echo
+ echo "going to tests misuse. Errors are ok, hangs are not!"
+
+ echo
+ echo "both sides sending:"
+ $SZ -q $z_test_files <$testdir/pipe | \
+ ($SZ $z_test_files >>$testdir/pipe )
+
+ echo
+ echo "both sides receiving:"
+ $RZ -q <$testdir/pipe | \
+ ( $RZ >>$testdir/pipe )
+fi
+
+rm -rf $testdir
+rm -f $objdir/null1 $objdir/null2
+exit 0
+
diff --git a/config.guess b/config.guess
new file mode 100755
index 0000000..d8c2470
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,600 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+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
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ # 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 alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ Pyramid*:OSx*:*:*)
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ sun4*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:4*:UMIPS)
+ echo mips-mips-riscos4sysv
+ exit 0 ;;
+ mips:*:5*:RISCos)
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88100 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i[34]86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[3478]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;;
+ 9000/8?? ) HP_ARCH=hppa1.0 ;;
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*C90:*:*:*)
+ echo c90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo i386-unknown-cygwin32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin32
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us.
+ ld_help_string=`ld --help 2>&1`
+ if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
+ echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
+ echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
+ echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
+ echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
+ echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
+ elif test "${UNAME_MACHINE}" = "alpha" ; then
+ echo alpha-unknown-linux ; exit 0
+ else
+ # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us
+ # useful --help. Gcc wants to distinguish between linuxoldld and linuxaout.
+ test ! -d /usr/lib/ldscripts/. \
+ && echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0
+ # Determine whether the default compiler is a.out or elf
+ cat >dummy.c <<EOF
+main(argc, argv)
+int argc;
+char *argv[];
+{
+#ifdef __ELF__
+ printf ("%s-unknown-linux\n", argv[1]);
+#else
+ printf ("%s-unknown-linuxaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i[34]86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i[34]86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-unknown-sysv32
+ fi
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-unknown-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M680[234]0:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
+ uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3 && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m680[234]0:LynxOS:2.[23]*:*)
+ echo m68k-lynx-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i[34]86:LynxOS:2.[23]*:*)
+ echo i386-lynx-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.[23]*:*)
+ echo sparc-lynx-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.[23]*:*)
+ echo rs6000-lynx-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ R3000:*System_V*:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3");
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-unknown-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..b78a5cc
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,344 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+#undef _ALL_SOURCE
+#endif
+
+/* Define if using alloca.c. */
+#undef C_ALLOCA
+
+/* Define to empty if the keyword does not work. */
+#undef const
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define if your struct stat has st_rdev. */
+#undef HAVE_ST_RDEV
+
+/* Define as __inline if that's what the C compiler calls it. */
+#undef inline
+
+/* Define if on MINIX. */
+#undef _MINIX
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef mode_t
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+#undef off_t
+
+/* Define if the system does not provide POSIX.1 features except
+ with this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define if you need to in order for stat and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Define as the return type of signal handlers (int or void). */
+#undef RETSIGTYPE
+
+/* Define if the setvbuf function takes the buffering type as its second
+ argument and the buffer pointer as the third, as on System V
+ before release 3. */
+#undef SETVBUF_REVERSED
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+#undef size_t
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define if your <sys/time.h> declares struct tm. */
+#undef TM_IN_SYS_TIME
+
+/* define this if you have a reliable ftime function */
+#undef HAVE_FTIME
+
+/* define this if you have the timezone variable */
+#undef HAVE_TIMEZONE_VAR
+
+/* Define to 1 if NLS is requested. */
+#undef ENABLE_NLS
+
+/* Define as 1 if you have catgets and don't want to use GNU gettext. */
+#undef HAVE_CATGETS
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext. */
+#undef HAVE_GETTEXT
+
+/* Define if your locale.h file contains LC_MESSAGES. */
+#undef HAVE_LC_MESSAGES
+
+/* Define to the name of the distribution. */
+#undef PACKAGE
+
+/* The concatenation of the strings PACKAGE, "-", and VERSION. */
+#undef PACKAGE_VERSION
+
+/* Define to the version of the distribution. */
+#undef VERSION
+
+/* Define to 1 if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define to 1 if your utime() takes struct utimbuf as second argument */
+#undef HAVE_STRUCT_UTIMBUF
+
+/* Define to LOG_xxx (a syslog facility) if syslog() shall be used */
+#undef ENABLE_SYSLOG
+
+/* Define to 1 if syslogging shall be forced */
+#undef ENABLE_SYSLOG_FORCE
+
+/* Define to 1 if syslogging shall be default */
+#undef ENABLE_SYSLOG_DEFAULT
+
+/* Define to 1 if lrz shall create directories if needed */
+#undef ENABLE_MKDIR
+
+/* Define to public writable directory if you want this. Leave out the "'s */
+#undef PUBDIR
+
+/* Define to 1 if you want support for the timesync protocol */
+#undef ENABLE_TIMESYNC
+
+/* define to 1. we have a replacement function for it. */
+#undef HAVE_STRERROR
+
+/* define to 1 if you want strict ANSI prototypes. will remove some
+ extern x(); declarations. */
+#undef STRICT_PROTOTYPES
+
+/* where the localedata hides */
+/* #undef LOCALEDIR */
+
+/* do your system libraries declare errno? */
+#undef HAVE_ERRNO_DECLARATION
+
+/* define to type of speed_t (long?) */
+#undef speed_t
+
+/* define this if you headers conflict */
+#undef SYS_TIME_WITHOUT_SYS_SELECT
+
+/* define to type of socklen_t (int?) */
+#undef socklen_t
+
+/* Define if you have the __argz_count function. */
+#undef HAVE___ARGZ_COUNT
+
+/* Define if you have the __argz_next function. */
+#undef HAVE___ARGZ_NEXT
+
+/* Define if you have the __argz_stringify function. */
+#undef HAVE___ARGZ_STRINGIFY
+
+/* Define if you have the dcgettext function. */
+#undef HAVE_DCGETTEXT
+
+/* Define if you have the getcwd function. */
+#undef HAVE_GETCWD
+
+/* Define if you have the getpagesize function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the gettimeofday function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define if you have the memcpy function. */
+#undef HAVE_MEMCPY
+
+/* Define if you have the mkdir function. */
+#undef HAVE_MKDIR
+
+/* Define if you have the mktime function. */
+#undef HAVE_MKTIME
+
+/* Define if you have the munmap function. */
+#undef HAVE_MUNMAP
+
+/* Define if you have the putenv function. */
+#undef HAVE_PUTENV
+
+/* Define if you have the rdchk function. */
+#undef HAVE_RDCHK
+
+/* Define if you have the select function. */
+#undef HAVE_SELECT
+
+/* Define if you have the setenv function. */
+#undef HAVE_SETENV
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the settimeofday function. */
+#undef HAVE_SETTIMEOFDAY
+
+/* Define if you have the siginterrupt function. */
+#undef HAVE_SIGINTERRUPT
+
+/* Define if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the strchr function. */
+#undef HAVE_STRCHR
+
+/* Define if you have the strdup function. */
+#undef HAVE_STRDUP
+
+/* Define if you have the strerror function. */
+#undef HAVE_STRERROR
+
+/* Define if you have the strftime function. */
+#undef HAVE_STRFTIME
+
+/* Define if you have the strpbrk function. */
+#undef HAVE_STRPBRK
+
+/* Define if you have the strstr function. */
+#undef HAVE_STRSTR
+
+/* Define if you have the strtol function. */
+#undef HAVE_STRTOL
+
+/* Define if you have the strtoul function. */
+#undef HAVE_STRTOUL
+
+/* Define if you have the syslog function. */
+#undef HAVE_SYSLOG
+
+/* Define if you have the times function. */
+#undef HAVE_TIMES
+
+/* Define if you have the utime function. */
+#undef HAVE_UTIME
+
+/* Define if you have the vasprintf function. */
+#undef HAVE_VASPRINTF
+
+/* Define if you have the vprintf function. */
+#undef HAVE_VPRINTF
+
+/* Define if you have the <argz.h> header file. */
+#undef HAVE_ARGZ_H
+
+/* Define if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
+/* Define if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <nl_types.h> header file. */
+#undef HAVE_NL_TYPES_H
+
+/* Define if you have the <sgtty.h> header file. */
+#undef HAVE_SGTTY_H
+
+/* Define if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
+/* Define if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/syslog.h> header file. */
+#undef HAVE_SYS_SYSLOG_H
+
+/* Define if you have the <sys/termio.h> header file. */
+#undef HAVE_SYS_TERMIO_H
+
+/* Define if you have the <sys/termios.h> header file. */
+#undef HAVE_SYS_TERMIOS_H
+
+/* Define if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <sys/times.h> header file. */
+#undef HAVE_SYS_TIMES_H
+
+/* Define if you have the <syslog.h> header file. */
+#undef HAVE_SYSLOG_H
+
+/* Define if you have the <termio.h> header file. */
+#undef HAVE_TERMIO_H
+
+/* Define if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
+/* Define if you have the be library (-lbe). */
+#undef HAVE_LIBBE
+
+/* Define if you have the i library (-li). */
+#undef HAVE_LIBI
+
+/* Define if you have the nsl library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define if you have the socket library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if compiler has function prototypes */
+#undef PROTOTYPES
+
diff --git a/config.sub b/config.sub
new file mode 100755
index 0000000..e67a800
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,867 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS (if any).
+basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+if [ $basic_machine != $1 ]
+then os=`echo $1 | sed 's/.*-/-/'`
+else os=; fi
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
+ | arme[lb] | pyramid \
+ | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
+ | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
+ | powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
+ | pdp11 | mips64el | mips64orion | mips64orionel \
+ | sparc)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+ | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
+ | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
+ | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+ | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
+ | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigados)
+ basic_machine=m68k-cbm
+ os=-amigados
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[345]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ os=-sysv32
+ ;;
+ i[345]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ os=-sysv4
+ ;;
+ i[345]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ os=-sysv
+ ;;
+ i[345]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | p6)
+ # We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
+ basic_machine=i586-intel
+ ;;
+ pentium-* | p5-* | p6-*)
+ # We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ k5)
+ # We don't have specific support for AMD's K5 yet, so just call it a Pentium
+ basic_machine=i586-amd
+ ;;
+ nexen)
+ # We don't have specific support for Nexgen yet, so just call it a Pentium
+ basic_machine=i586-nexgen
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ mips)
+ basic_machine=mips-mips
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -unixware* | svr4*)
+ os=-sysv4
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
+ | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
+ | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* )
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigados
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -lynxos*)
+ vendor=lynx
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxworks*)
+ vendor=wrs
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/configure b/configure
new file mode 100755
index 0000000..cc586d5
--- /dev/null
+++ b/configure
@@ -0,0 +1,5329 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+--disable-timesync exclude support for timesync protocol"
+ac_help="$ac_help
+--enable-pubdir=/path include support for a public writeable directory"
+ac_help="$ac_help
+--disable-mkdir disable support for creating directories (lrz)"
+ac_help="$ac_help
+--enable-syslog=FACILITY,{force,default,optional} include syslogsupport"
+ac_help="$ac_help
+ --disable-nls do not use Native Language Support"
+ac_help="$ac_help
+ --with-included-gettext use the GNU gettext library included here"
+ac_help="$ac_help
+ --with-catgets use catgets functions if available"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=src/crctab.c
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:570: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:623: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "$*" != "X $srcdir/configure conftestfile" \
+ && test "$*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+ fi
+
+ test "$2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:680: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+
+PACKAGE=lrzsz
+
+VERSION=0.12.21rc
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
+echo "configure:727: checking for working aclocal" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (aclocal --version) < /dev/null > /dev/null 2>&1; then
+ ACLOCAL=aclocal
+ echo "$ac_t""found" 1>&6
+else
+ ACLOCAL="$missing_dir/missing aclocal"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
+echo "configure:740: checking for working autoconf" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+ AUTOCONF=autoconf
+ echo "$ac_t""found" 1>&6
+else
+ AUTOCONF="$missing_dir/missing autoconf"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working automake""... $ac_c" 1>&6
+echo "configure:753: checking for working automake" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (automake --version) < /dev/null > /dev/null 2>&1; then
+ AUTOMAKE=automake
+ echo "$ac_t""found" 1>&6
+else
+ AUTOMAKE="$missing_dir/missing automake"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
+echo "configure:766: checking for working autoheader" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+ AUTOHEADER=autoheader
+ echo "$ac_t""found" 1>&6
+else
+ AUTOHEADER="$missing_dir/missing autoheader"
+ echo "$ac_t""missing" 1>&6
+fi
+
+echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
+echo "configure:779: checking for working makeinfo" >&5
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf. Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+ MAKEINFO=makeinfo
+ echo "$ac_t""found" 1>&6
+else
+ MAKEINFO="$missing_dir/missing makeinfo"
+ echo "$ac_t""missing" 1>&6
+fi
+
+
+
+
+
+
+
+
+
+PACKAGE_VERSION="$PACKAGE-$VERSION"
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+cat >> confdefs.h <<EOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+EOF
+
+
+
+
+
+ALL_LINGUAS="de"
+
+
+
+
+case $VERSION in
+ [0-9]*.[0-9]*.[0-9]*) README_ALPHA="README-alpha";;
+ *) README_ALPHA=;;
+esac
+
+
+# Check whether --enable-timesync or --disable-timesync was given.
+if test "${enable_timesync+set}" = set; then
+ enableval="$enable_timesync"
+ if test "$enableval" = "no" ; then
+ :
+ else
+ cat >> confdefs.h <<\EOF
+#define ENABLE_TIMESYNC 1
+EOF
+
+ fi
+else
+ cat >> confdefs.h <<\EOF
+#define ENABLE_TIMESYNC 1
+EOF
+
+fi
+
+
+# Check whether --enable-pubdir or --disable-pubdir was given.
+if test "${enable_pubdir+set}" = set; then
+ enableval="$enable_pubdir"
+ if test "$enableval" = "no" ; then
+ :
+ else
+ cat >> confdefs.h <<EOF
+#define PUBDIR "$enableval"
+EOF
+
+ fi
+fi
+
+# Check whether --enable-mkdir or --disable-mkdir was given.
+if test "${enable_mkdir+set}" = set; then
+ enableval="$enable_mkdir"
+ if test "$enableval" = "no" ; then
+ :
+ else
+ cat >> confdefs.h <<\EOF
+#define ENABLE_MKDIR 1
+EOF
+
+ fi
+else
+ cat >> confdefs.h <<\EOF
+#define ENABLE_MKDIR 1
+EOF
+
+fi
+
+# Check whether --enable-syslog or --disable-syslog was given.
+if test "${enable_syslog+set}" = set; then
+ enableval="$enable_syslog"
+
+ if test "$enableval" = "no" ; then
+ :
+ else
+ case "$enableval" in
+ *,*)
+ level=`echo $enableval|sed -e 's/^.*,//'`
+ fac=`echo $enableval|sed -e 's/,.*$//'`
+ cat >> confdefs.h <<EOF
+#define ENABLE_SYSLOG $fac
+EOF
+
+ ;;
+ *)
+ lookup_facility=LOG_UUCP
+ level="$enableval"
+ ;;
+ esac
+ if test "$level" = "force" ; then
+ cat >> confdefs.h <<\EOF
+#define ENABLE_SYSLOG_FORCE 1
+EOF
+
+ else
+ if test "$level" = "optional" ; then
+ :
+ else
+ cat >> confdefs.h <<\EOF
+#define ENABLE_SYSLOG_DEFAULT 1
+EOF
+
+ fi
+ fi
+ fi
+else
+
+ cat >> confdefs.h <<\EOF
+#define ENABLE_SYSLOG_DEFAULT 1
+EOF
+
+ lookup_facility=LOG_UUCP
+
+fi
+
+
+if test "x$CFLAGS" = x ; then old_cflags_empty=1; fi
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:930: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:960: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1011: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1043: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 1054 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:1059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1085: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1090: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1099: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1118: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1150: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1165 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1171: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1182 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1188: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1199 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1205: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+if test "x$GCC" = xyes ; then
+ if test "x$old_cflags_empty" = x1 ; then
+ if test "x$_CFLAGS_OWG" != x ; then
+ # each environment should contain at least one helpful hack :-)
+ CFLAGS="$_CFLAGS_OWG"
+ fi
+ fi
+fi
+if test $ac_cv_prog_gcc = yes; then
+ echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
+echo "configure:1239: checking whether ${CC-cc} needs -traditional" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_pattern="Autoconf.*'x'"
+ cat > conftest.$ac_ext <<EOF
+#line 1245 "configure"
+#include "confdefs.h"
+#include <sgtty.h>
+Autoconf TIOCGETP
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "$ac_pattern" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_prog_gcc_traditional=yes
+else
+ rm -rf conftest*
+ ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+ if test $ac_cv_prog_gcc_traditional = no; then
+ cat > conftest.$ac_ext <<EOF
+#line 1263 "configure"
+#include "confdefs.h"
+#include <termio.h>
+Autoconf TCGETA
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "$ac_pattern" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
+ if test $ac_cv_prog_gcc_traditional = yes; then
+ CC="$CC -traditional"
+ fi
+fi
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1287: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+echo "configure:1315: checking for POSIXized ISC" >&5
+if test -d /etc/conf/kconfig.d &&
+ grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
+then
+ echo "$ac_t""yes" 1>&6
+ ISC=yes # If later tests want to check for ISC.
+ cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+ if test "$GCC" = yes; then
+ CC="$CC -posix"
+ else
+ CC="$CC -Xp"
+ fi
+else
+ echo "$ac_t""no" 1>&6
+ ISC=
+fi
+
+echo $ac_n "checking for AIX""... $ac_c" 1>&6
+echo "configure:1336: checking for AIX" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1338 "configure"
+#include "confdefs.h"
+#ifdef _AIX
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ rm -rf conftest*
+ echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+#define _ALL_SOURCE 1
+EOF
+
+else
+ rm -rf conftest*
+ echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+
+ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
+echo "configure:1361: checking for minix/config.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1366 "configure"
+#include "confdefs.h"
+#include <minix/config.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ MINIX=yes
+else
+ echo "$ac_t""no" 1>&6
+MINIX=
+fi
+
+if test "$MINIX" = yes; then
+ cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _POSIX_1_SOURCE 2
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _MINIX 1
+EOF
+
+fi
+
+
+
+
+echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
+echo "configure:1412: checking for ${CC-cc} option to accept ANSI C" >&5
+if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ am_cv_prog_cc_stdc=no
+ac_save_CC="$CC"
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ cat > conftest.$ac_ext <<EOF
+#line 1428 "configure"
+#include "confdefs.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+
+int main() {
+
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+
+; return 0; }
+EOF
+if { (eval echo configure:1465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ am_cv_prog_cc_stdc="$ac_arg"; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+CC="$ac_save_CC"
+
+fi
+
+if test -z "$am_cv_prog_cc_stdc"; then
+ echo "$ac_t""none needed" 1>&6
+else
+ echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6
+fi
+case "x$am_cv_prog_cc_stdc" in
+ x|xno) ;;
+ *) CC="$CC $am_cv_prog_cc_stdc" ;;
+esac
+
+
+
+echo $ac_n "checking for function prototypes""... $ac_c" 1>&6
+echo "configure:1491: checking for function prototypes" >&5
+if test "$am_cv_prog_cc_stdc" != no; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define PROTOTYPES 1
+EOF
+
+ U= ANSI2KNR=
+else
+ echo "$ac_t""no" 1>&6
+ U=_ ANSI2KNR=./ansi2knr
+ # Ensure some checks needed by ansi2knr itself.
+ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1504: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1509 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1534 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1552 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1573 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+ for ac_hdr in string.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1611: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1616 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1621: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1650: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1655 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1725: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 1732 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:1739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+
+if test `hostname` = tirka.ohse.de -a "$cross_compiling" = no ; then
+ test $prefix = NONE && prefix=/usr
+ if test -z "$CFLAGS" ; then
+ case "$CC" in
+ *gcc*)
+ CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
+ # -Wnested_externs entfernt wegen dcgettext()
+ CFLAGS="$CFLAGS -Wpointer-arith -Wcast-qual -Wcast-align"
+ CFLAGS="$CFLAGS -Winline -Wwrite-strings -Wshadow -Wmissing-braces"
+ CFLAGS="$CFLAGS -Wcomments -fforce-mem -fforce-addr -O2 -m486 -pipe"
+ CFLAGS="$CFLAGS -malign-loops=2 -malign-jumps=2 -malign-functions=2 -g3"
+ ;;
+ esac
+ fi
+fi
+case "$CFLAGS" in
+*-Wstrict-prototypes*)
+ cat >> confdefs.h <<\EOF
+#define STRICT_PROTOTYPES 1
+EOF
+
+ ;;
+esac
+
+echo $ac_n "checking for syslog in -lsocket""... $ac_c" 1>&6
+echo "configure:1790: checking for syslog in -lsocket" >&5
+ac_lib_var=`echo socket'_'syslog | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1798 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char syslog();
+
+int main() {
+syslog()
+; return 0; }
+EOF
+if { (eval echo configure:1809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for syslog in -lbe""... $ac_c" 1>&6
+echo "configure:1837: checking for syslog in -lbe" >&5
+ac_lib_var=`echo be'_'syslog | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lbe $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1845 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char syslog();
+
+int main() {
+syslog()
+; return 0; }
+EOF
+if { (eval echo configure:1856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo be | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lbe $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:1884: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1892 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:1903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1932: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1937 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1962 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1980 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2001 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:2012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+for ac_hdr in fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h sys/times.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2039: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2044 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2049: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+for ac_hdr in termios.h sys/termios.h termio.h sys/termio.h sgtty.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2080: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2085 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in termios.h sys/termios.h termio.h sys/termio.h sgtty.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2120: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2125 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2130: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/mman.h utime.h syslog.h sys/syslog.h sys/param.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2160: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2165 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2170: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/select.h strings.h arpa/inet.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2200: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2205 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2210: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:2238: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2243 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_size_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+ cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+echo $ac_n "checking for mode_t""... $ac_c" 1>&6
+echo "configure:2271: checking for mode_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2276 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_mode_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_mode_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_mode_t" 1>&6
+if test $ac_cv_type_mode_t = no; then
+ cat >> confdefs.h <<\EOF
+#define mode_t int
+EOF
+
+fi
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:2304: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2309 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_off_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+ cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+
+echo $ac_n "checking for speed_t""... $ac_c" 1>&6
+echo "configure:2338: checking for speed_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_speed_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2343 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#else
+#if defined(HAVE_SYS_TERMIOS_H)
+#include <sys/termios.h>
+#else
+#if defined(HAVE_TERMIO_H)
+#include <termio.h>
+#else
+#if defined(HAVE_SYS_TERMIO_H)
+#include <sys/termio.h>
+#else
+#if defined(HAVE_SGTTY_H)
+#include <sgtty.h>
+#else
+#error neither termio.h nor sgtty.h found. Cannot continue. */
+#endif
+#endif
+#endif
+#endif
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "speed_t" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_speed_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_speed_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_speed_t" 1>&6
+if test $ac_cv_type_speed_t = no; then
+ cat >> confdefs.h <<\EOF
+#define speed_t long
+EOF
+
+fi
+
+echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
+echo "configure:2393: checking for st_rdev in struct stat" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2398 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+int main() {
+struct stat s; s.st_rdev;
+; return 0; }
+EOF
+if { (eval echo configure:2406: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_st_rdev=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_struct_st_rdev=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6
+if test $ac_cv_struct_st_rdev = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ST_RDEV 1
+EOF
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:2427: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2432 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:2441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+ cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
+echo "configure:2463: checking for socklen_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2468 "configure"
+#include "confdefs.h"
+
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+
+int main() {
+socklen_t x=0;return x;
+
+; return 0; }
+EOF
+if { (eval echo configure:2484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_socklen_t=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_socklen_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_socklen_t" 1>&6
+if test $ac_cv_type_socklen_t = no; then
+cat >> confdefs.h <<\EOF
+#define socklen_t int
+EOF
+ cat >> confdefs.h <<\EOF
+#define socklen_t int
+EOF
+
+fi
+
+echo $ac_n "checking whether sys/time.h and sys/select.h may both be included""... $ac_c" 1>&6
+echo "configure:2509: checking whether sys/time.h and sys/select.h may both be included" >&5
+if eval "test \"`echo '$''{'lrzsz_cv_header_sys_select'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2514 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/select.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:2523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ lrzsz_cv_header_sys_select=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lrzsz_cv_header_sys_select=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lrzsz_cv_header_sys_select" 1>&6
+if test $lrzsz_cv_header_sys_select = no; then
+ cat >> confdefs.h <<\EOF
+#define SYS_TIME_WITHOUT_SYS_SELECT 1
+EOF
+
+fi
+
+echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+echo "configure:2544: checking whether struct tm is in sys/time.h or time.h" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2549 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <time.h>
+int main() {
+struct tm *tp; tp->tm_sec;
+; return 0; }
+EOF
+if { (eval echo configure:2557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_tm=time.h
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_tm" 1>&6
+if test $ac_cv_struct_tm = sys/time.h; then
+ cat >> confdefs.h <<\EOF
+#define TM_IN_SYS_TIME 1
+EOF
+
+fi
+
+
+echo $ac_n "checking for errno declaration""... $ac_c" 1>&6
+echo "configure:2579: checking for errno declaration" >&5
+if eval "test \"`echo '$''{'lrzsz_cv_decl_errno'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2584 "configure"
+#include "confdefs.h"
+#include <errno.h>
+int main() {
+int i = errno; errno = 1;
+; return 0; }
+EOF
+if { (eval echo configure:2591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ lrzsz_cv_decl_errno=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ lrzsz_cv_decl_errno=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$lrzsz_cv_decl_errno" 1>&6
+if test $lrzsz_cv_decl_errno = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ERRNO_DECLARATION 1
+EOF
+
+fi
+
+
+if test $cross_compiling = no ; then
+ echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6
+echo "configure:2614: checking whether setvbuf arguments are reversed" >&5
+if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2622 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+/* If setvbuf has the reversed format, exit 0. */
+main () {
+ /* This call has the arguments reversed.
+ A reversed system may check and see that the address of main
+ is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */
+ if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0)
+ exit(1);
+ putc('\r', stdout);
+ exit(0); /* Non-reversed systems segv here. */
+}
+EOF
+if { (eval echo configure:2636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_setvbuf_reversed=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_setvbuf_reversed=no
+fi
+rm -fr conftest*
+fi
+
+rm -f core core.* *.core
+fi
+
+echo "$ac_t""$ac_cv_func_setvbuf_reversed" 1>&6
+if test $ac_cv_func_setvbuf_reversed = yes; then
+ cat >> confdefs.h <<\EOF
+#define SETVBUF_REVERSED 1
+EOF
+
+fi
+
+fi
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:2661: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2666 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:2683: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2705: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2710 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2715: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2744: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2749 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:2797: checking for working mmap" >&5
+if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_mmap_fixed_mapped=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2805 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ back from the file, nor mmap's back from the file at a different
+ address. (There have been systems where private was not correctly
+ implemented like the infamous i386 svr4.0, and systems where the
+ VM page cache was not coherent with the filesystem buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ propogated back to all the places they're supposed to be.
+
+ Grep wants private fixed already mapped.
+ The main things grep needs to know about mmap are:
+ * does it exist and is it safe to write into the mmap'd area
+ * how to use it (BSD variants) */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure have sys/param.h. */
+# ifndef HAVE_SYS_PARAM_H
+# define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+# define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
+
+ pagesize = getpagesize();
+
+ /*
+ * First, make a file with some known garbage in it.
+ */
+ data = malloc(pagesize);
+ if (!data)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand();
+ umask(0);
+ fd = creat("conftestmmap", 0600);
+ if (fd < 0)
+ exit(1);
+ if (write(fd, data, pagesize) != pagesize)
+ exit(1);
+ close(fd);
+
+ /*
+ * Next, try to mmap the file at a fixed address which
+ * already has something else allocated at it. If we can,
+ * also make sure that we see the same garbage.
+ */
+ fd = open("conftestmmap", O_RDWR);
+ if (fd < 0)
+ exit(1);
+ data2 = malloc(2 * pagesize);
+ if (!data2)
+ exit(1);
+ data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+ if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ exit(1);
+
+ /*
+ * Finally, make sure that changes to the mapped area
+ * do not percolate back to the file as seen by read().
+ * (This is a bug on some variants of i386 svr4.0.)
+ */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = malloc(pagesize);
+ if (!data3)
+ exit(1);
+ if (read(fd, data3, pagesize) != pagesize)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ exit(1);
+ close(fd);
+ unlink("conftestmmap");
+ exit(0);
+}
+
+EOF
+if { (eval echo configure:2945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_mmap_fixed_mapped=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MMAP 1
+EOF
+
+fi
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:2970: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2975 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:2982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_header_alloca_h=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:3003: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3008 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:3036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_func_alloca_works=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+ # that cause trouble. Some versions do not even contain alloca or
+ # contain a buggy version. If you still want to use their alloca,
+ # use ar to extract alloca.o from them instead of compiling alloca.c.
+ ALLOCA=alloca.${ac_objext}
+ cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:3068: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3073 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "webecray" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_os_cray=yes
+else
+ rm -rf conftest*
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3098: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3103 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+ break
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:3153: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_stack_direction=0
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3161 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+ exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:3180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_stack_direction=1
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+cat > conftest.$ac_ext <<EOF
+#line 3202 "configure"
+#include "confdefs.h"
+#include <utime.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "struct.*utimbuf" >/dev/null 2>&1; then
+ rm -rf conftest*
+ cat >> confdefs.h <<\EOF
+#define HAVE_STRUCT_UTIMBUF 1
+EOF
+
+fi
+rm -f conftest*
+
+
+for ac_func in gettimeofday settimeofday
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3220: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3225 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in strchr memcpy select vprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3275: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3280 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in times rdchk utime syslog siginterrupt
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3330: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3335 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in mkdir mktime strerror strstr strdup strtoul strtol strpbrk
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3385: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3390 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
+
+
+for ac_func in stpcpy strftime vasprintf
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3442: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3447 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
+fi
+done
+
+
+
+echo $ac_n "checking for getopt_long""... $ac_c" 1>&6
+echo "configure:3498: checking for getopt_long" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3503 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char getopt_long(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char getopt_long();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_getopt_long) || defined (__stub___getopt_long)
+choke me
+#else
+getopt_long();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_getopt_long=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_getopt_long=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'getopt_long`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS getopt1.o getopt.o"
+fi
+
+
+
+cat >> confdefs.h <<\EOF
+#define HAVE_STRERROR 1
+EOF
+
+
+
+
+echo $ac_n "checking for ftime""... $ac_c" 1>&6
+echo "configure:3556: checking for ftime" >&5
+if eval "test \"`echo '$''{'ac_cv_func_ftime'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3561 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char ftime(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char ftime();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_ftime) || defined (__stub___ftime)
+choke me
+#else
+ftime();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_ftime=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_ftime=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'ftime`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking that ftime works correctly""... $ac_c" 1>&6
+echo "configure:3599: checking that ftime works correctly" >&5
+if eval "test \"`echo '$''{'lrzsz_cv_sys_ftime_ok'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ lrzsz_cv_sys_ftime_ok=runtime
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3607 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <sys/timeb.h>
+#include <stdio.h>
+main ()
+{
+ struct timeb s, slast;
+ int c = 0;
+ ftime (&slast);
+ while (c < 10)
+ {
+ ftime (&s);
+ if (s.time < slast.time
+ || (s.time == slast.time && s.millitm < slast.millitm)) {
+ fprintf(stderr,"s: %ld, %ld, slast: %ld, %ld\n",
+ s.time,s.millitm, slast.time,slast.millitm);
+ exit (1);
+ }
+ if (s.time != slast.time)
+ ++c;
+ slast.time = s.time;
+ slast.millitm = s.millitm;
+ }
+ exit (0);
+}
+
+EOF
+if { (eval echo configure:3636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ lrzsz_cv_sys_ftime_ok=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ lrzsz_cv_sys_ftime_ok=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+case $lrzsz_cv_sys_ftime_ok in
+yes) cat >> confdefs.h <<\EOF
+#define HAVE_FTIME 1
+EOF
+ echo "$ac_t""yes" 1>&6 ;;
+no) echo "$ac_t""no" 1>&6
+ echo "configure: warning: ftime seems to be buggy" 1>&2 ;;
+runtime) cat >> confdefs.h <<\EOF
+#define HAVE_FTIME 1
+EOF
+
+ echo "$ac_t""will check at run time" 1>&6 ;;
+esac
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking for timezone variable""... $ac_c" 1>&6
+echo "configure:3670: checking for timezone variable" >&5
+if eval "test \"`echo '$''{'libquark_cv_var_timezone'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+cat > conftest.$ac_ext <<EOF
+#line 3676 "configure"
+#include "confdefs.h"
+#include <time.h>
+int main() {
+return(int)(timezone/2);
+; return 0; }
+EOF
+if { (eval echo configure:3683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ libquark_cv_var_timezone=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ libquark_cv_var_timezone=no
+fi
+rm -f conftest*
+
+fi
+
+if test $libquark_cv_var_timezone = yes ; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_TIMEZONE_VAR 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+if test "x$lookup_facility" = x ; then
+ :
+else
+ echo $ac_n "checking for $lookup_facility""... $ac_c" 1>&6
+echo "configure:3709: checking for $lookup_facility" >&5
+ if eval "test \"`echo '$''{'lrzsz_cv_lookup_facility'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+ cat > conftest.$ac_ext <<EOF
+#line 3715 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#else
+#include <sys/syslog.h>
+#endif
+#ifdef $lookup_facility
+ihave$lookup_facility
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "ihave$lookup_facility" >/dev/null 2>&1; then
+ rm -rf conftest*
+ lrzsz_cv_lookup_facility=yes
+else
+ rm -rf conftest*
+ lrzsz_cv_lookup_facility=no
+fi
+rm -f conftest*
+
+
+fi
+
+ if test $lrzsz_cv_lookup_facility = yes ; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<EOF
+#define ENABLE_SYSLOG $lookup_facility
+EOF
+
+ else
+ cat >> confdefs.h <<\EOF
+#define ENABLE_SYSLOG LOG_USER
+EOF
+
+ echo "$ac_t""no" 1>&6
+ fi
+fi
+
+
+
+
+
+
+
+ for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h sys/param.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3767: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3772 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
+strdup __argz_count __argz_stringify __argz_next
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3807: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3812 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ for ac_func in stpcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3864: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3869 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ fi
+ if test "${ac_cv_func_stpcpy}" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_STPCPY 1
+EOF
+
+ fi
+
+ if test $ac_cv_header_locale_h = yes; then
+ echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
+echo "configure:3926: checking for LC_MESSAGES" >&5
+if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3931 "configure"
+#include "confdefs.h"
+#include <locale.h>
+int main() {
+return LC_MESSAGES
+; return 0; }
+EOF
+if { (eval echo configure:3938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ am_cv_val_LC_MESSAGES=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ am_cv_val_LC_MESSAGES=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_LC_MESSAGES 1
+EOF
+
+ fi
+ fi
+ echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
+echo "configure:3959: checking whether NLS is requested" >&5
+ # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval="$enable_nls"
+ USE_NLS=$enableval
+else
+ USE_NLS=yes
+fi
+
+ echo "$ac_t""$USE_NLS" 1>&6
+
+
+ USE_INCLUDED_LIBINTL=no
+
+ if test "$USE_NLS" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define ENABLE_NLS 1
+EOF
+
+ echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
+echo "configure:3979: checking whether included gettext is requested" >&5
+ # Check whether --with-included-gettext or --without-included-gettext was given.
+if test "${with_included_gettext+set}" = set; then
+ withval="$with_included_gettext"
+ nls_cv_force_use_gnu_gettext=$withval
+else
+ nls_cv_force_use_gnu_gettext=no
+fi
+
+ echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+ CATOBJEXT=NONE
+
+ ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
+echo "configure:3998: checking for libintl.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4003 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
+echo "configure:4025: checking for gettext in libc" >&5
+if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4030 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:4037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ gt_cv_func_gettext_libc=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ gt_cv_func_gettext_libc=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
+
+ if test "$gt_cv_func_gettext_libc" != "yes"; then
+ echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
+echo "configure:4053: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lintl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4061 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char bindtextdomain();
+
+int main() {
+bindtextdomain()
+; return 0; }
+EOF
+if { (eval echo configure:4072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
+echo "configure:4088: checking for gettext in libintl" >&5
+if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6
+echo "configure:4093: checking for gettext in -lintl" >&5
+ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lintl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4101 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gettext();
+
+int main() {
+gettext()
+; return 0; }
+EOF
+if { (eval echo configure:4112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ gt_cv_func_gettext_libintl=yes
+else
+ echo "$ac_t""no" 1>&6
+gt_cv_func_gettext_libintl=no
+fi
+
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ if test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$gt_cv_func_gettext_libintl" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_GETTEXT 1
+EOF
+
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4151: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ if test "$MSGFMT" != "no"; then
+ for ac_func in dcgettext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4185: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4190 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4240: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4276: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ cat > conftest.$ac_ext <<EOF
+#line 4308 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr
+; return 0; }
+EOF
+if { (eval echo configure:4316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ CATOBJEXT=.gmo
+ DATADIRNAME=share
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
+fi
+rm -f conftest*
+ INSTOBJEXT=.mo
+ fi
+ fi
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ if test "$CATOBJEXT" = "NONE"; then
+ echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6
+echo "configure:4339: checking whether catgets can be used" >&5
+ # Check whether --with-catgets or --without-catgets was given.
+if test "${with_catgets+set}" = set; then
+ withval="$with_catgets"
+ nls_cv_use_catgets=$withval
+else
+ nls_cv_use_catgets=no
+fi
+
+ echo "$ac_t""$nls_cv_use_catgets" 1>&6
+
+ if test "$nls_cv_use_catgets" = "yes"; then
+ echo $ac_n "checking for main in -li""... $ac_c" 1>&6
+echo "configure:4352: checking for main in -li" >&5
+ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-li $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4360 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:4367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo i | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-li $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ echo $ac_n "checking for catgets""... $ac_c" 1>&6
+echo "configure:4395: checking for catgets" >&5
+if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4400 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char catgets(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char catgets();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_catgets) || defined (__stub___catgets)
+choke me
+#else
+catgets();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_catgets=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_catgets=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'catgets`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_CATGETS 1
+EOF
+
+ INTLOBJS="\$(CATOBJS)"
+ # Extract the first word of "gencat", so it can be a program name with args.
+set dummy gencat; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4445: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GENCAT" in
+ /*)
+ ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GENCAT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no"
+ ;;
+esac
+fi
+GENCAT="$ac_cv_path_GENCAT"
+if test -n "$GENCAT"; then
+ echo "$ac_t""$GENCAT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ if test "$GENCAT" != "no"; then
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4481: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test "$GMSGFMT" = "no"; then
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4518: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4553: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.cat
+ INSTOBJEXT=.cat
+ DATADIRNAME=lib
+ INTLDEPS='$(top_builddir)/intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+ fi
+
+ if test "$CATOBJEXT" = "NONE"; then
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ INTLOBJS="\$(GETTOBJS)"
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4611: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4645: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:4681: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.gmo
+ INSTOBJEXT=.mo
+ DATADIRNAME=share
+ INTLDEPS='$(top_builddir)/intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+
+ if test "$XGETTEXT" != ":"; then
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+ else
+ DATADIRNAME=share
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+
+
+
+
+ # If this is used in GNU gettext we have to set USE_NLS to `yes'
+ # because some of the sources are only built for this goal.
+ if test "$PACKAGE" = gettext; then
+ USE_NLS=yes
+ USE_INCLUDED_LIBINTL=yes
+ fi
+
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
+echo "configure:4774: checking for catalogs to be installed" >&5
+ NEW_LINGUAS=
+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ echo "$ac_t""$LINGUAS" 1>&6
+ fi
+
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ if test $ac_cv_header_locale_h = yes; then
+ INCLUDE_LOCALE_H="#include <locale.h>"
+ else
+ INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>. Take care yourself. */"
+ fi
+
+
+ test -d intl || mkdir intl
+ if test "$CATOBJEXT" = ".cat"; then
+ ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
+echo "configure:4802: checking for linux/version.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4807 "configure"
+#include "confdefs.h"
+#include <linux/version.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ msgformat=linux
+else
+ echo "$ac_t""no" 1>&6
+msgformat=xopen
+fi
+
+
+ sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
+ fi
+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
+
+ if test "$PACKAGE" = "gettext"; then
+ GT_NO="#NO#"
+ GT_YES=
+ else
+ GT_NO=
+ GT_YES="#YES#"
+ fi
+
+
+
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+
+
+ l=
+
+
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+
+
+cat >> confdefs.h <<EOF
+#define LOCALEDIR "$prefix/$DATADIRNAME"
+EOF
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile intl/Makefile lib/Makefile testsuite/Makefile \
+man/Makefile po/Makefile.in src/Makefile Specfile systype \
+src/lrzszbug config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@PACKAGE_VERSION@%$PACKAGE_VERSION%g
+s%@ENABLE_TIMESYNC@%$ENABLE_TIMESYNC%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@RANLIB@%$RANLIB%g
+s%@U@%$U%g
+s%@ANSI2KNR@%$ANSI2KNR%g
+s%@ALLOCA@%$ALLOCA%g
+s%@LIBOBJS@%$LIBOBJS%g
+s%@USE_NLS@%$USE_NLS%g
+s%@MSGFMT@%$MSGFMT%g
+s%@GMSGFMT@%$GMSGFMT%g
+s%@XGETTEXT@%$XGETTEXT%g
+s%@GENCAT@%$GENCAT%g
+s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g
+s%@CATALOGS@%$CATALOGS%g
+s%@CATOBJEXT@%$CATOBJEXT%g
+s%@DATADIRNAME@%$DATADIRNAME%g
+s%@GMOFILES@%$GMOFILES%g
+s%@INSTOBJEXT@%$INSTOBJEXT%g
+s%@INTLDEPS@%$INTLDEPS%g
+s%@INTLLIBS@%$INTLLIBS%g
+s%@INTLOBJS@%$INTLOBJS%g
+s%@POFILES@%$POFILES%g
+s%@POSUB@%$POSUB%g
+s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g
+s%@GT_NO@%$GT_NO%g
+s%@GT_YES@%$GT_YES%g
+s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
+s%@l@%$l%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile intl/Makefile lib/Makefile testsuite/Makefile \
+man/Makefile po/Makefile.in src/Makefile Specfile systype \
+src/lrzszbug"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+ac_sources="$nls_cv_header_libgt"
+ac_dests="$nls_cv_header_intl"
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+srcdir=$ac_given_srcdir
+while test -n "$ac_sources"; do
+ set $ac_dests; ac_dest=$1; shift; ac_dests=$*
+ set $ac_sources; ac_source=$1; shift; ac_sources=$*
+
+ echo "linking $srcdir/$ac_source to $ac_dest"
+
+ if test ! -r $srcdir/$ac_source; then
+ { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
+ fi
+ rm -f $ac_dest
+
+ # Make relative symlinks.
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
+ # The dest file is in a subdirectory.
+ test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
+ ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dest_dir_suffix.
+ ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dest_dir_suffix= ac_dots=
+ fi
+
+ case "$srcdir" in
+ [/$]*) ac_rel_source="$srcdir/$ac_source" ;;
+ *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
+ esac
+
+ # Make a symlink if possible; otherwise try a hard link.
+ if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
+ ln $srcdir/$ac_source $ac_dest; then :
+ else
+ { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
+ fi
+done
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+case "$CONFIG_FILES" in *po/Makefile.in*)
+ sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
+ esac
+sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile;
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..e7aef76
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,281 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(src/crctab.c)
+AM_INIT_AUTOMAKE(lrzsz, 0.12.21rc)
+AM_CONFIG_HEADER(config.h)
+
+
+dnl AC_C_CROSS is in AC_PROG_CC since 2.12
+AC_PREREQ(2.12)
+
+PACKAGE_VERSION="$PACKAGE-$VERSION"
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
+AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "$PACKAGE_VERSION")
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+AC_SUBST(PACKAGE_VERSION)
+
+ALL_LINGUAS="de"
+
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+
+changequote(,)dnl
+case $VERSION in
+ [0-9]*.[0-9]*.[0-9]*) README_ALPHA="README-alpha";;
+ *) README_ALPHA=;;
+esac
+changequote([, ])dnl
+
+
+AC_ARG_ENABLE(timesync,
+ [--disable-timesync exclude support for timesync protocol],
+ [if test "$enableval" = "no" ; then
+ :
+ else
+ AC_DEFINE(ENABLE_TIMESYNC)
+ fi],
+ [AC_DEFINE(ENABLE_TIMESYNC)])
+AC_SUBST(ENABLE_TIMESYNC)
+AC_ARG_ENABLE(pubdir,
+ [--enable-pubdir=/path include support for a public writeable directory],
+ [if test "$enableval" = "no" ; then
+ :
+ else
+ AC_DEFINE_UNQUOTED(PUBDIR,"$enableval")
+ fi])
+AC_ARG_ENABLE(mkdir,
+ [--disable-mkdir disable support for creating directories (lrz)],
+ [if test "$enableval" = "no" ; then
+ :
+ else
+ AC_DEFINE(ENABLE_MKDIR)
+ fi],
+ [AC_DEFINE(ENABLE_MKDIR)])
+AC_ARG_ENABLE(syslog,
+ [--enable-syslog=FACILITY,{force,default,optional} include syslogsupport],
+ [
+ if test "$enableval" = "no" ; then
+ :
+ else
+ case "$enableval" in
+ *,*)
+ level=`echo $enableval|sed -e 's/^.*,//'`
+ fac=`echo $enableval|sed -e 's/,.*$//'`
+ AC_DEFINE_UNQUOTED(ENABLE_SYSLOG,$fac)
+ ;;
+ *)
+ lookup_facility=LOG_UUCP
+ level="$enableval"
+ ;;
+ esac
+ if test "$level" = "force" ; then
+ AC_DEFINE(ENABLE_SYSLOG_FORCE)
+ else
+ if test "$level" = "optional" ; then
+ :
+ else
+ AC_DEFINE(ENABLE_SYSLOG_DEFAULT)
+ fi
+ fi
+ fi],[
+ AC_DEFINE(ENABLE_SYSLOG_DEFAULT)
+ lookup_facility=LOG_UUCP
+ ])
+
+if test "x$CFLAGS" = x ; then old_cflags_empty=1; fi
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CPP
+if test "x$GCC" = xyes ; then
+ if test "x$old_cflags_empty" = x1 ; then
+ if test "x$_CFLAGS_OWG" != x ; then
+ # each environment should contain at least one helpful hack :-)
+ CFLAGS="$_CFLAGS_OWG"
+ fi
+ fi
+fi
+AC_PROG_GCC_TRADITIONAL
+dnl AC_PROG_INSTALL included in AM_INIT_AUTOMAKE
+dnl AC_PROG_MAKE_SET included in AM_INIT_AUTOMAKE
+AC_PROG_RANLIB
+AC_ISC_POSIX
+AC_AIX
+AC_MINIX
+AM_C_PROTOTYPES
+AC_C_CONST
+AC_C_INLINE
+
+if test `hostname` = tirka.ohse.de -a "$cross_compiling" = no ; then
+ test $prefix = NONE && prefix=/usr
+ if test -z "$CFLAGS" ; then
+ case "$CC" in
+ *gcc*)
+ CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes"
+ # -Wnested_externs entfernt wegen dcgettext()
+ CFLAGS="$CFLAGS -Wpointer-arith -Wcast-qual -Wcast-align"
+ CFLAGS="$CFLAGS -Winline -Wwrite-strings -Wshadow -Wmissing-braces"
+ CFLAGS="$CFLAGS -Wcomments -fforce-mem -fforce-addr -O2 -m486 -pipe"
+ CFLAGS="$CFLAGS -malign-loops=2 -malign-jumps=2 -malign-functions=2 -g3"
+ ;;
+ esac
+ fi
+fi
+case "$CFLAGS" in
+*-Wstrict-prototypes*)
+ AC_DEFINE(STRICT_PROTOTYPES)
+ ;;
+esac
+
+dnl Checks for libraries.
+dnl SCO needs this.
+AC_CHECK_LIB(socket,syslog,,,)
+dnl BeOS needs this
+AC_CHECK_LIB(be,syslog,,,)
+dnl slowlartis needs this
+AC_CHECK_LIB(nsl,gethostbyname,,,)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h sys/times.h)
+LRZSZ_HEADERS_TERM_IO
+AC_CHECK_HEADERS(termios.h sys/termios.h termio.h sys/termio.h sgtty.h)
+AC_CHECK_HEADERS(sys/mman.h utime.h syslog.h sys/syslog.h sys/param.h)
+AC_CHECK_HEADERS(sys/select.h strings.h arpa/inet.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+LRZSZ_TYPE_SPEED_T
+AC_STRUCT_ST_RDEV
+AC_HEADER_TIME
+UO_TYPE_SOCKLEN_T
+lrzsz_HEADER_SYS_SELECT
+AC_STRUCT_TM
+LRZSZ_ERRNO_DECL
+
+dnl Checks for library functions.
+if test $cross_compiling = no ; then
+ AC_FUNC_SETVBUF_REVERSED
+fi
+AC_TYPE_SIGNAL
+dnl suggested by autoscan, but not really needed.
+dnl AC_FUNC_UTIME_NULL
+AC_FUNC_MMAP
+AC_FUNC_ALLOCA
+AC_EGREP_HEADER([struct.*utimbuf], utime.h, AC_DEFINE(HAVE_STRUCT_UTIMBUF))
+
+AC_CHECK_FUNCS(gettimeofday settimeofday)
+AC_CHECK_FUNCS(strchr memcpy select vprintf)
+AC_CHECK_FUNCS(times rdchk utime syslog siginterrupt)
+AC_REPLACE_FUNCS(mkdir mktime strerror strstr strdup strtoul strtol strpbrk)
+AC_REPLACE_FUNCS(stpcpy strftime vasprintf)
+
+AC_REPLACE_GNU_GETOPT
+
+dnl for lib/error.c
+AC_DEFINE(HAVE_STRERROR)
+
+
+dnl special tests
+
+dnl this is taken from taylor uucp.
+dnl Check for the SCO buggy ftime; the code can cope with the bug,
+dnl though it would prefer not to, so if we're cross-configuring we
+dnl accept that ftime exists.
+AC_CHECK_FUNC(ftime,
+[AC_MSG_CHECKING(that ftime works correctly)
+AC_CACHE_VAL(lrzsz_cv_sys_ftime_ok,
+[AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/timeb.h>
+#include <stdio.h>
+main ()
+{
+ struct timeb s, slast;
+ int c = 0;
+ ftime (&slast);
+ while (c < 10)
+ {
+ ftime (&s);
+ if (s.time < slast.time
+ || (s.time == slast.time && s.millitm < slast.millitm)) {
+ fprintf(stderr,"s: %ld, %ld, slast: %ld, %ld\n",
+ s.time,s.millitm, slast.time,slast.millitm);
+ exit (1);
+ }
+ if (s.time != slast.time)
+ ++c;
+ slast.time = s.time;
+ slast.millitm = s.millitm;
+ }
+ exit (0);
+}
+],
+lrzsz_cv_sys_ftime_ok=yes,
+lrzsz_cv_sys_ftime_ok=no,
+lrzsz_cv_sys_ftime_ok=runtime)])
+case $lrzsz_cv_sys_ftime_ok in
+yes) AC_DEFINE(HAVE_FTIME) AC_MSG_RESULT(yes) ;;
+no) AC_MSG_RESULT(no)
+ AC_MSG_WARN(ftime seems to be buggy) ;;
+runtime) AC_DEFINE(HAVE_FTIME)
+ AC_MSG_RESULT(will check at run time) ;;
+esac
+])
+
+dnl
+AC_MSG_CHECKING([for timezone variable])
+AC_CACHE_VAL(libquark_cv_var_timezone,[
+AC_TRY_LINK([#include <time.h>],[return(int)(timezone/2);],
+ [libquark_cv_var_timezone=yes],
+ [libquark_cv_var_timezone=no])
+])
+if test $libquark_cv_var_timezone = yes ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TIMEZONE_VAR)
+else
+ AC_MSG_RESULT(no)
+fi
+if test "x$lookup_facility" = x ; then
+ :
+else
+ AC_MSG_CHECKING([for $lookup_facility])
+ AC_CACHE_VAL(lrzsz_cv_lookup_facility,[
+ AC_EGREP_CPP(ihave$lookup_facility, [
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#else
+#include <sys/syslog.h>
+#endif
+#ifdef $lookup_facility
+ihave$lookup_facility
+#endif
+ ], lrzsz_cv_lookup_facility=yes, lrzsz_cv_lookup_facility=no)
+ ])
+ if test $lrzsz_cv_lookup_facility = yes ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE_UNQUOTED(ENABLE_SYSLOG,$lookup_facility)
+ else
+ AC_DEFINE(ENABLE_SYSLOG,LOG_USER)
+ AC_MSG_RESULT(no)
+ fi
+fi
+
+
+AC_SUBST(CFLAGS)
+AC_SUBST(LDFLAGS)
+AC_SUBST(LIBS)
+
+AM_GNU_GETTEXT
+
+AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME")
+dnl AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
+
+AC_OUTPUT([Makefile intl/Makefile lib/Makefile testsuite/Makefile \
+man/Makefile po/Makefile.in src/Makefile Specfile systype \
+src/lrzszbug],
+[sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile;
+test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
diff --git a/debian/CVS/Entries b/debian/CVS/Entries
new file mode 100644
index 0000000..1784810
--- /dev/null
+++ b/debian/CVS/Entries
@@ -0,0 +1 @@
+D
diff --git a/debian/CVS/Repository b/debian/CVS/Repository
new file mode 100644
index 0000000..d2ab3c1
--- /dev/null
+++ b/debian/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/debian
diff --git a/debian/CVS/Root b/debian/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/debian/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/fastcheck.beos b/fastcheck.beos
new file mode 100755
index 0000000..43f4dc0
--- /dev/null
+++ b/fastcheck.beos
@@ -0,0 +1,71 @@
+#! /bin/sh
+
+srcdir="$1"
+if test $srcdir = . ; then
+ srcdir=`pwd`
+fi
+if test $srcdir = .. ; then
+ srcdir=`pwd`/..
+fi
+objdir="$2"
+if test $objdir = . ; then
+ objdir=`pwd`
+fi
+testdir=$objdir/fastcheck.lrzsz
+
+SZ="$objdir/src/lsz"
+RZ="$objdir/src/lrz"
+
+echo checking with srcdir = $1 and objdir = $2
+
+z_test_files=""
+for i in $srcdir/src/l?z.c ; do
+ z_test_files="$z_test_files $i"
+done
+for i in $objdir/src/l?z ; do
+ z_test_files="$z_test_files $i"
+done
+
+# change to tmp dir
+if test "x$TMPDIR" = x ; then
+ if test "x$TMP" = x ; then
+ cd /tmp
+ else
+ cd $TMP || cd /tmp
+ fi
+else
+ cd $TMPDIR || cd /tmp
+fi
+
+rm -rf $testdir
+mkdir $testdir
+exec 5>$testdir/error.log
+(mkfifo $testdir/pipe || mknod $testdir/pipe p) 2>&5
+
+mkdir $testdir/zmodem
+failed=0
+$objdir/beos-runpiped "$SZ -q $z_test_files" "cd $testdir/zmodem ; exec $RZ $QUIET"
+for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+done
+rm -rf $testdir
+
+if test "x$failed" = x0 ; then
+ :
+else
+ echo "the test failed." >&2
+ echo "use 'make check' or 'make vcheck' for a more detailed test" >&2
+ touch $objdir/fastcheck.failed
+ exit 1
+fi
+
+
+touch $objdir/fastcheck.ok
+exit 0
+
diff --git a/fastcheck.sh b/fastcheck.sh
new file mode 100755
index 0000000..dd1a8f9
--- /dev/null
+++ b/fastcheck.sh
@@ -0,0 +1,72 @@
+#! /bin/sh
+
+srcdir="$1"
+if test $srcdir = . ; then
+ srcdir=`pwd`
+fi
+if test $srcdir = .. ; then
+ srcdir=`pwd`/..
+fi
+objdir="$2"
+if test $objdir = . ; then
+ objdir=`pwd`
+fi
+testdir=$objdir/fastcheck.lrzsz
+
+SZ="$objdir/src/lsz"
+RZ="$objdir/src/lrz"
+
+echo checking with srcdir = $1 and objdir = $2
+
+z_test_files=""
+for i in $srcdir/src/l?z.c ; do
+ z_test_files="$z_test_files $i"
+done
+for i in $objdir/src/l?z ; do
+ z_test_files="$z_test_files $i"
+done
+
+# change to tmp dir
+if test "x$TMPDIR" = x ; then
+ if test "x$TMP" = x ; then
+ cd /tmp
+ else
+ cd $TMP || cd /tmp
+ fi
+else
+ cd $TMPDIR || cd /tmp
+fi
+
+rm -rf $testdir
+mkdir $testdir
+exec 5>$testdir/error.log
+(mkfifo $testdir/pipe || mknod $testdir/pipe p) 2>&5
+
+mkdir $testdir/zmodem
+failed=0
+($SZ -q $z_test_files ) <$testdir/pipe | \
+ (cd $testdir/zmodem ; exec $RZ $QUIET >>../pipe )
+for i in $z_test_files ; do
+ bn=`basename $i`
+ cmp $i $testdir/zmodem/$bn
+ if test $? -eq 0 ; then
+ rm -f $testdir/zmodem/$bn
+ else
+ failed=1
+ fi
+done
+rm -rf $testdir
+
+if test "x$failed" = x0 ; then
+ :
+else
+ echo "the test failed." >&2
+ echo "use 'make check' or 'make vcheck' for a more detailed test" >&2
+ touch $objdir/fastcheck.failed
+ exit 1
+fi
+
+
+touch $objdir/fastcheck.ok
+exit 0
+
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..ab74c88
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,238 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# 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.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+tranformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/intl/CVS/Entries b/intl/CVS/Entries
new file mode 100644
index 0000000..e649134
--- /dev/null
+++ b/intl/CVS/Entries
@@ -0,0 +1,24 @@
+/ChangeLog/1.1.1.3/Sun Apr 26 13:22:35 1998/-ko/
+/Makefile.in/1.1.1.3/Sun Apr 26 13:22:35 1998/-ko/
+/VERSION/1.1.1.3/Sun Apr 26 13:22:37 1998/-ko/
+/bindtextdom.c/1.1.1.3/Sun Apr 26 13:22:36 1998/-ko/
+/cat-compat.c/1.1.1.2/Sun Apr 26 13:22:37 1998/-ko/
+/dcgettext.c/1.1.1.3/Sun Apr 26 13:22:36 1998/-ko/
+/dgettext.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/explodename.c/1.1.1.5/Sun Apr 26 13:22:37 1998/-ko/
+/finddomain.c/1.1.1.3/Sun Apr 26 13:22:36 1998/-ko/
+/gettext.c/1.1.1.2/Sun Apr 26 13:22:36 1998/-ko/
+/gettext.h/1.1.1.2/Sun Apr 26 13:22:35 1998/-ko/
+/gettextP.h/1.1.1.2/Sun Apr 26 13:22:35 1998/-ko/
+/hash-string.h/1.1.1.2/Sun Apr 26 13:22:36 1998/-ko/
+/intl-compat.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/l10nflist.c/1.1.1.5/Sun Apr 26 13:22:37 1998/-ko/
+/libgettext.h/1.1.1.3/Sun Apr 26 13:22:36 1998/-ko/
+/linux-msg.sed/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/loadinfo.h/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/loadmsgcat.c/1.1.1.2/Sun Apr 26 13:22:37 1998/-ko/
+/localealias.c/1.1.1.3/Sun Apr 26 13:22:37 1998/-ko/
+/po2tbl.sed.in/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/textdomain.c/1.1.1.3/Sun Apr 26 13:22:37 1998/-ko/
+/xopen-msg.sed/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+D
diff --git a/intl/CVS/Repository b/intl/CVS/Repository
new file mode 100644
index 0000000..714d5d1
--- /dev/null
+++ b/intl/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/intl
diff --git a/intl/CVS/Root b/intl/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/intl/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/intl/ChangeLog b/intl/ChangeLog
new file mode 100644
index 0000000..ecff6f6
--- /dev/null
+++ b/intl/ChangeLog
@@ -0,0 +1,1022 @@
+1997-09-06 02:10 Ulrich Drepper <drepper@cygnus.com>
+
+ * intlh.inst.in: Reformat copyright.
+
+1997-08-19 15:22 Ulrich Drepper <drepper@cygnus.com>
+
+ * dcgettext.c (DCGETTEXT): Remove wrong comment.
+
+1997-08-16 00:13 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.in (install-data): Don't change directory to install.
+
+1997-08-01 14:30 Ulrich Drepper <drepper@cygnus.com>
+
+ * cat-compat.c: Fix copyright.
+
+ * localealias.c: Don't define strchr unless !HAVE_STRCHR.
+
+ * loadmsgcat.c: Update copyright. Fix typos.
+
+ * l10nflist.c: Don't define strchr unless !HAVE_STRCHR.
+ (_nl_make_l10nflist): Handle sponsor and revision correctly.
+
+ * gettext.c: Update copyright.
+ * gettext.h: Likewise.
+ * hash-string.h: Likewise.
+
+ * finddomain.c: Remoave dead code. Define strchr only if
+ !HAVE_STRCHR.
+
+ * explodename.c: Include <sys/types.h>.
+
+ * explodename.c: Reformat copyright text.
+ (_nl_explode_name): Fix typo.
+
+ * dcgettext.c: Define and use __set_errno.
+ (guess_category_value): Don't use setlocale if HAVE_LC_MESSAGES is
+ not defined.
+
+ * bindtextdom.c: Pretty printing.
+
+1997-05-01 02:25 Ulrich Drepper <drepper@cygnus.com>
+
+ * dcgettext.c (guess_category_value): Don't depend on
+ HAVE_LC_MESSAGES. We don't need the macro here.
+ Patch by Bruno Haible <haible@ilog.fr>.
+
+ * cat-compat.c (textdomain): DoN't refer to HAVE_SETLOCALE_NULL
+ macro. Instead use HAVE_LOCALE_NULL and define it when using
+ glibc, as in dcgettext.c.
+ Patch by Bruno Haible <haible@ilog.fr>.
+
+ * Makefile.in (CPPFLAGS): New variable. Reported by Franc,ois
+ Pinard.
+
+Mon Mar 10 06:51:17 1997 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.in: Implement handling of libtool.
+
+ * gettextP.h: Change data structures for use of generic lowlevel
+ i18n file handling.
+
+Wed Dec 4 20:21:18 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * textdomain.c: Put parentheses around arguments of memcpy macro
+ definition.
+ * localealias.c: Likewise.
+ * l10nflist.c: Likewise.
+ * finddomain.c: Likewise.
+ * bindtextdom.c: Likewise.
+ Reported by Thomas Esken.
+
+Mon Nov 25 22:57:51 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * textdomain.c: Move definition of `memcpy` macro to right
+ position.
+
+Fri Nov 22 04:01:58 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * finddomain.c [!HAVE_STRING_H && !_LIBC]: Define memcpy using
+ bcopy if not already defined. Reported by Thomas Esken.
+ * bindtextdom.c: Likewise.
+ * l10nflist.c: Likewise.
+ * localealias.c: Likewise.
+ * textdomain.c: Likewise.
+
+Tue Oct 29 11:10:27 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.in (libdir): Change to use exec_prefix instead of
+ prefix. Reported by Knut-HåvardAksnes <etokna@eto.ericsson.se>.
+
+Sat Aug 31 03:07:09 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * l10nflist.c (_nl_normalize_codeset): We convert to lower case,
+ so don't prepend uppercase `ISO' for only numeric arg.
+
+Fri Jul 19 00:15:46 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * l10nflist.c: Move inclusion of argz.h, ctype.h, stdlib.h after
+ definition of _GNU_SOURCE. Patch by Roland McGrath.
+
+ * Makefile.in (uninstall): Fix another bug with `for' loop and
+ empty arguments. Patch by Jim Meyering. Correct name os
+ uninstalled files: no intl- prefix anymore.
+
+ * Makefile.in (install-data): Again work around shells which
+ cannot handle mpty for list. Reported by Jim Meyering.
+
+Sat Jul 13 18:11:35 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.in (install): Split goal. Now depend on install-exec
+ and install-data.
+ (install-exec, install-data): New goals. Created from former
+ install goal.
+ Reported by Karl Berry.
+
+Sat Jun 22 04:58:14 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.in (MKINSTALLDIRS): New variable. Path to
+ mkinstalldirs script.
+ (install): use MKINSTALLDIRS variable or if the script is not present
+ try to find it in the $top_scrdir).
+
+Wed Jun 19 02:56:56 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * l10nflist.c: Linux libc *partly* includes the argz_* functions.
+ Grr. Work around by renaming the static version and use macros
+ for renaming.
+
+Tue Jun 18 20:11:17 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * l10nflist.c: Correct presence test macros of __argz_* functions.
+
+ * l10nflist.c: Include <argz.h> based on test of it instead when
+ __argz_* functions are available.
+ Reported by Andreas Schwab.
+
+Thu Jun 13 15:17:44 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * explodename.c, l10nflist.c: Define NULL for dumb systems.
+
+Tue Jun 11 17:05:13 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * intlh.inst.in, libgettext.h (dcgettext): Rename local variable
+ result to __result to prevent name clash.
+
+ * l10nflist.c, localealias.c, dcgettext.c: Define _GNU_SOURCE to
+ get prototype for stpcpy and strcasecmp.
+
+ * intlh.inst.in, libgettext.h: Move declaration of
+ `_nl_msg_cat_cntr' outside __extension__ block to prevent warning
+ from gcc's -Wnested-extern option.
+
+Fri Jun 7 01:58:00 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.in (install): Remove comment.
+
+Thu Jun 6 17:28:17 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.in (install): Work around for another Buglix stupidity.
+ Always use an `else' close for `if's. Reported by Nelson Beebe.
+
+ * Makefile.in (intlh.inst): Correct typo in phony rule.
+ Reported by Nelson Beebe.
+
+Thu Jun 6 01:49:52 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * dcgettext.c (read_alias_file): Rename variable alloca_list to
+ block_list as the macro calls assume.
+ Patch by Eric Backus.
+
+ * localealias.c [!HAVE_ALLOCA]: Define alloca as macro using
+ malloc.
+ (read_alias_file): Rename varriabe alloca_list to block_list as the
+ macro calls assume.
+ Patch by Eric Backus.
+
+ * l10nflist.c: Correct conditional for <argz.h> inclusion.
+ Reported by Roland McGrath.
+
+ * Makefile.in (all): Depend on all-@USE_INCLUDED_LIBINTL@, not
+ all-@USE_NLS@.
+
+ * Makefile.in (install): intlh.inst comes from local dir, not
+ $(srcdir).
+
+ * Makefile.in (intlh.inst): Special handling of this goal. If
+ used in gettext, this is really a rul to construct this file. If
+ used in any other package it is defined as a .PHONY rule with
+ empty body.
+
+ * finddomain.c: Extract locale file information handling into
+ l10nfile.c. Rename local stpcpy__ function to stpcpy.
+
+ * dcgettext.c (stpcpy): Add local definition.
+
+ * l10nflist.c: Solve some portability problems. Patches partly by
+ Thomas Esken. Add local definition of stpcpy.
+
+Tue Jun 4 02:47:49 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * intlh.inst.in: Don't depend including <locale.h> on
+ HAVE_LOCALE_H. Instead configure must rewrite this fiile
+ depending on the result of the configure run.
+
+ * Makefile.in (install): libintl.inst is now called intlh.inst.
+ Add rules for updating intlh.inst from intlh.inst.in.
+
+ * libintl.inst: Renamed to intlh.inst.in.
+
+ * localealias.c, dcgettext.c [__GNUC__]: Define HAVE_ALLOCA to 1
+ because gcc has __buitlin_alloca.
+ Reported by Roland McGrath.
+
+Mon Jun 3 00:32:16 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * Makefile.in (installcheck): New goal to fulfill needs of
+ automake's distcheck.
+
+ * Makefile.in (install): Reorder commands so that VERSION is
+ found.
+
+ * Makefile.in (gettextsrcdir): Now use subdirectory intl/ in
+ @datadir@/gettext.
+ (COMSRCS): Add l10nfile.c.
+ (OBJECTS): Add l10nfile.o.
+ (DISTFILES): Rename to DISTFILE.normal. Remove $(DISTFILES.common).
+ (DISTFILE.gettext): Remove $(DISTFILES.common).
+ (all-gettext): Remove goal.
+ (install): If $(PACKAGE) = gettext install, otherwose do nothing. No
+ package but gettext itself should install libintl.h + headers.
+ (dist): Extend goal to work for gettext, too.
+ (dist-gettext): Remove goal.
+
+ * dcgettext.c [!HAVE_ALLOCA]: Define macro alloca by using malloc.
+
+Sun Jun 2 17:33:06 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * loadmsgcat.c (_nl_load_domain): Parameter is now comes from
+ find_l10nfile.
+
+Sat Jun 1 02:23:03 1996 Ulrich Drepper <drepper@cygnus.com>
+
+ * l10nflist.c (__argz_next): Add definition.
+
+ * dcgettext.c [!HAVE_ALLOCA]: Add code for handling missing alloca
+ code. Use new l10nfile handling.
+
+ * localealias.c [!HAVE_ALLOCA]: Add code for handling missing
+ alloca code.
+
+ * l10nflist.c: Initial revision.
+
+Tue Apr 2 18:51:18 1996 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (all-gettext): New goal. Same as all-yes.
+
+Thu Mar 28 23:01:22 1996 Karl Eichwalder <ke@ke.central.de>
+
+ * Makefile.in (gettextsrcdir): Define using @datadir@.
+
+Tue Mar 26 12:39:14 1996 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c: Include <ctype.h>. Reported by Roland McGrath.
+
+Sat Mar 23 02:00:35 1996 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c (stpcpy): Rename to stpcpy__ to prevent clashing
+ with external declaration.
+
+Sat Mar 2 00:47:09 1996 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (all-no): Rename from all_no.
+
+Sat Feb 17 00:25:59 1996 Ulrich Drepper <drepper@myware>
+
+ * gettextP.h [loaded_domain]: Array `successor' must now contain up
+ to 63 elements (because of codeset name normalization).
+
+ * finddomain.c: Implement codeset name normalization.
+
+Thu Feb 15 04:39:09 1996 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (all): Define to `all-@USE_NLS@'.
+ (all-yes, all_no): New goals. `all-no' is noop, `all-yes'
+ is former all.
+
+Mon Jan 15 21:46:01 1996 Howard Gayle <howard@hal.com>
+
+ * localealias.c (alias_compare): Increment string pointers in loop
+ of strcasecmp replacement.
+
+Fri Dec 29 21:16:34 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (install-src): Who commented this goal out ? :-)
+
+Fri Dec 29 15:08:16 1995 Ulrich Drepper <drepper@myware>
+
+ * dcgettext.c (DCGETTEXT): Save `errno'. Failing system calls
+ should not effect it because a missing catalog is no error.
+ Reported by Harald K<o:>nig <koenig@tat.physik.uni-tuebingen.de>.
+
+Tue Dec 19 22:09:13 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (Makefile): Explicitly use $(SHELL) for running
+ shell scripts.
+
+Fri Dec 15 17:34:59 1995 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Makefile.in (install-src): Only install library and header when
+ we use the own implementation. Don't do it when using the
+ system's gettext or catgets functions.
+
+ * dcgettext.c (find_msg): Must not swap domain->hash_size here.
+
+Sat Dec 9 16:24:37 1995 Ulrich Drepper <drepper@myware>
+
+ * localealias.c, libintl.inst, libgettext.h, hash-string.h,
+ gettextP.h, finddomain.c, dcgettext.c, cat-compat.c:
+ Use PARAMS instead of __P. Suggested by Roland McGrath.
+
+Tue Dec 5 11:39:14 1995 Larry Schwimmer <rosebud@cyclone.stanford.edu>
+
+ * libgettext.h: Use `#if !defined (_LIBINTL_H)' instead of `#if
+ !_LIBINTL_H' because Solaris defines _LIBINTL_H as empty.
+
+Mon Dec 4 15:42:07 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (install-src):
+ Install libintl.inst instead of libintl.h.install.
+
+Sat Dec 2 22:51:38 1995 Marcus Daniels <marcus@sysc.pdx.edu>
+
+ * cat-compat.c (textdomain):
+ Reverse order in which files are tried you load. First
+ try local file, when this failed absolute path.
+
+Wed Nov 29 02:03:53 1995 Nelson H. F. Beebe <beebe@math.utah.edu>
+
+ * cat-compat.c (bindtextdomain): Add missing { }.
+
+Sun Nov 26 18:21:41 1995 Ulrich Drepper <drepper@myware>
+
+ * libintl.inst: Add missing __P definition. Reported by Nelson Beebe.
+
+ * Makefile.in:
+ Add dummy `all' and `dvi' goals. Reported by Tom Tromey.
+
+Sat Nov 25 16:12:01 1995 Franc,ois Pinard <pinard@iro.umontreal.ca>
+
+ * hash-string.h: Capitalize arguments of macros.
+
+Sat Nov 25 12:01:36 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (DISTFILES): Prevent files names longer than 13
+ characters. libintl.h.glibc->libintl.glibc,
+ libintl.h.install->libintl.inst. Reported by Joshua R. Poulson.
+
+Sat Nov 25 11:31:12 1995 Eric Backus <ericb@lsid.hp.com>
+
+ * dcgettext.c: Fix bug in preprocessor conditionals.
+
+Sat Nov 25 02:35:27 1995 Nelson H. F. Beebe <beebe@math.utah.edu>
+
+ * libgettext.h: Solaris cc does not understand
+ #if !SYMBOL1 && !SYMBOL2. Sad but true.
+
+Thu Nov 23 16:22:14 1995 Ulrich Drepper <drepper@myware>
+
+ * hash-string.h (hash_string):
+ Fix for machine with >32 bit `unsigned long's.
+
+ * dcgettext.c (DCGETTEXT):
+ Fix horrible bug in loop for alternative translation.
+
+Thu Nov 23 01:45:29 1995 Ulrich Drepper <drepper@myware>
+
+ * po2tbl.sed.in, linux-msg.sed, xopen-msg.sed:
+ Some further simplifications in message number generation.
+
+Mon Nov 20 21:08:43 1995 Ulrich Drepper <drepper@myware>
+
+ * libintl.h.glibc: Use __const instead of const in prototypes.
+
+ * Makefile.in (install-src):
+ Install libintl.h.install instead of libintl.h. This
+ is a stripped-down version. Suggested by Peter Miller.
+
+ * libintl.h.install, libintl.h.glibc: Initial revision.
+
+ * localealias.c (_nl_expand_alias, read_alias_file):
+ Protect prototypes in type casts by __P.
+
+Tue Nov 14 16:43:58 1995 Ulrich Drepper <drepper@myware>
+
+ * hash-string.h: Correct prototype for hash_string.
+
+Sun Nov 12 12:42:30 1995 Ulrich Drepper <drepper@myware>
+
+ * hash-string.h (hash_string): Add prototype.
+
+ * gettextP.h: Fix copyright.
+ (SWAP): Add prototype.
+
+Wed Nov 8 22:56:33 1995 Ulrich Drepper <drepper@myware>
+
+ * localealias.c (read_alias_file): Forgot sizeof.
+ Avoid calling *printf function. This introduces a big overhead.
+ Patch by Roland McGrath.
+
+Tue Nov 7 14:21:08 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c, cat-compat.c: Wrong indentation in #if for stpcpy.
+
+ * finddomain.c (stpcpy):
+ Define substitution function local. The macro was to flaky.
+
+ * cat-compat.c: Fix typo.
+
+ * xopen-msg.sed, linux-msg.sed:
+ While bringing message number to right place only accept digits.
+
+ * linux-msg.sed, xopen-msg.sed: Now that the counter does not have
+ leading 0s we don't need to remove them. Reported by Marcus
+ Daniels.
+
+ * Makefile.in (../po/cat-id-tbl.o): Use $(top_srdir) in
+ dependency. Reported by Marcus Daniels.
+
+ * cat-compat.c: (stpcpy) [!_LIBC && !HAVE_STPCPY]: Define replacement.
+ Generally cleanup using #if instead of #ifndef.
+
+ * Makefile.in: Correct typos in comment. By Franc,ois Pinard.
+
+Mon Nov 6 00:27:02 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (install-src): Don't install libintl.h and libintl.a
+ if we use an available gettext implementation.
+
+Sun Nov 5 22:02:08 1995 Ulrich Drepper <drepper@myware>
+
+ * libgettext.h: Fix typo: HAVE_CATGETTS -> HAVE_CATGETS. Reported
+ by Franc,ois Pinard.
+
+ * libgettext.h: Use #if instead of #ifdef/#ifndef.
+
+ * finddomain.c:
+ Comments describing what has to be done should start with FIXME.
+
+Sun Nov 5 19:38:01 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (DISTFILES): Split. Use DISTFILES with normal meaning.
+ DISTFILES.common names the files common to both dist goals.
+ DISTFILES.gettext are the files only distributed in GNU gettext.
+
+Sun Nov 5 17:32:54 1995 Ulrich Drepper <drepper@myware>
+
+ * dcgettext.c (DCGETTEXT): Correct searching in derived locales.
+ This was necessary since a change in _nl_find_msg several weeks
+ ago. I really don't know this is still not fixed.
+
+Sun Nov 5 12:43:12 1995 Ulrich Drepper <drepper@myware>
+
+ * loadmsgcat.c (_nl_load_domain): Test for FILENAME == NULL. This
+ might mark a special condition.
+
+ * finddomain.c (make_entry_rec): Don't make illegal entry as decided.
+
+ * Makefile.in (dist): Suppress error message when ln failed.
+ Get files from $(srcdir) explicitly.
+
+ * libgettext.h (gettext_const): Rename to gettext_noop.
+
+Fri Nov 3 07:36:50 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c (make_entry_rec):
+ Protect against wrong locale names by testing mask.
+
+ * libgettext.h (gettext_const): Add macro definition.
+ Capitalize macro arguments.
+
+Thu Nov 2 23:15:51 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c (_nl_find_domain):
+ Test for pointer != NULL before accessing value.
+ Reported by Tom Tromey.
+
+ * gettext.c (NULL):
+ Define as (void*)0 instad of 0. Reported by Franc,ois Pinard.
+
+Mon Oct 30 21:28:52 1995 Ulrich Drepper <drepper@myware>
+
+ * po2tbl.sed.in: Serious typo bug fixed by Jim Meyering.
+
+Sat Oct 28 23:20:47 1995 Ulrich Drepper <drepper@myware>
+
+ * libgettext.h: Disable dcgettext optimization for Solaris 2.3.
+
+ * localealias.c (alias_compare):
+ Peter Miller reported that tolower in some systems is
+ even dumber than I thought. Protect call by `isupper'.
+
+Fri Oct 27 22:22:51 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (libdir, includedir): New variables.
+ (install-src): Install libintl.a and libintl.h in correct dirs.
+
+Fri Oct 27 22:07:29 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (SOURCES): Fix typo: intrl.compat.c -> intl-compat.c.
+
+ * po2tbl.sed.in: Patch for buggy SEDs by Christian von Roques.
+
+ * localealias.c:
+ Fix typo and superflous test. Reported by Christian von Roques.
+
+Fri Oct 6 11:52:05 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c (_nl_find_domain):
+ Correct some remainder from the pre-CEN syntax. Now
+ we don't have a constant number of successors anymore.
+
+Wed Sep 27 21:41:13 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (DISTFILES): Add libintl.h.glibc.
+
+ * Makefile.in (dist-libc): Add goal for packing sources for glibc.
+ (COMSRCS, COMHDRS): Splitted to separate sources shared with glibc.
+
+ * loadmsgcat.c: Forget to continue #if line.
+
+ * localealias.c:
+ [_LIBC]: Rename strcasecmp to __strcasecmp to keep ANSI C name
+ space clean.
+
+ * dcgettext.c, finddomain.c: Better comment to last change.
+
+ * loadmsgcat.c:
+ [_LIBC]: Rename fstat, open, close, read, mmap, and munmap to
+ __fstat, __open, __close, __read, __mmap, and __munmap resp
+ to keep ANSI C name space clean.
+
+ * finddomain.c:
+ [_LIBC]: Rename stpcpy to __stpcpy to keep ANSI C name space clean.
+
+ * dcgettext.c:
+ [_LIBC]: Rename getced and stpcpy to __getcwd and __stpcpy resp to
+ keep ANSI C name space clean.
+
+ * libgettext.h:
+ Include sys/types.h for those old SysV systems out there.
+ Reported by Francesco Potorti`.
+
+ * loadmsgcat.c (use_mmap): Define if compiled for glibc.
+
+ * bindtextdom.c: Include all those standard headers
+ unconditionally if _LIBC is defined.
+
+ * finddomain.c: Fix 2 times defiend -> defined.
+
+ * textdomain.c: Include libintl.h instead of libgettext.h when
+ compiling for glibc. Include all those standard headers
+ unconditionally if _LIBC is defined.
+
+ * localealias.c, loadmsgcat.c: Prepare to be compiled in glibc.
+
+ * gettext.c:
+ Include libintl.h instead of libgettext.h when compiling for glibc.
+ Get NULL from stddef.h if we compile for glibc.
+
+ * finddomain.c: Include libintl.h instead of libgettext.h when
+ compiling for glibc. Include all those standard headers
+ unconditionally if _LIBC is defined.
+
+ * dcgettext.c: Include all those standard headers unconditionally
+ if _LIBC is defined.
+
+ * dgettext.c: If compiled in glibc include libintl.h instead of
+ libgettext.h.
+ (locale.h): Don't rely on HAVE_LOCALE_H when compiling for glibc.
+
+ * dcgettext.c: If compiled in glibc include libintl.h instead of
+ libgettext.h.
+ (getcwd): Don't rely on HAVE_GETCWD when compiling for glibc.
+
+ * bindtextdom.c:
+ If compiled in glibc include libintl.h instead of libgettext.h.
+
+Mon Sep 25 22:23:06 1995 Ulrich Drepper <drepper@myware>
+
+ * localealias.c (_nl_expand_alias): Don't call bsearch if NMAP <= 0.
+ Reported by Marcus Daniels.
+
+ * cat-compat.c (bindtextdomain):
+ String used in putenv must not be recycled.
+ Reported by Marcus Daniels.
+
+ * libgettext.h (__USE_GNU_GETTEXT):
+ Additional symbol to signal that we use GNU gettext
+ library.
+
+ * cat-compat.c (bindtextdomain):
+ Fix bug with the strange stpcpy replacement.
+ Reported by Nelson Beebe.
+
+Sat Sep 23 08:23:51 1995 Ulrich Drepper <drepper@myware>
+
+ * cat-compat.c: Include <string.h> for stpcpy prototype.
+
+ * localealias.c (read_alias_file):
+ While expand strdup code temporary variable `cp' hided
+ higher level variable with same name. Rename to `tp'.
+
+ * textdomain.c (textdomain):
+ Avoid warning by using temporary variable in strdup code.
+
+ * finddomain.c (_nl_find_domain): Remove unused variable `application'.
+
+Thu Sep 21 15:51:44 1995 Ulrich Drepper <drepper@myware>
+
+ * localealias.c (alias_compare):
+ Use strcasecmp() only if available. Else use
+ implementation in place.
+
+ * intl-compat.c:
+ Wrapper functions now call *__ functions instead of __*.
+
+ * libgettext.h: Declare prototypes for *__ functions instead for __*.
+
+ * cat-compat.c, loadmsgcat.c:
+ Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
+ of the standard libc and so prevent libintl.a from being used
+ standalone.
+
+ * bindtextdom.c:
+ Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
+ of the standard libc and so prevent libintl.a from being used
+ standalone.
+ Rename to bindtextdomain__ if not used in GNU C Library.
+
+ * dgettext.c:
+ Rename function to dgettext__ if not used in GNU C Library.
+
+ * gettext.c:
+ Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
+ of the standard libc and so prevent libintl.a from being used
+ standalone.
+ Functions now called gettext__ if not used in GNU C Library.
+
+ * dcgettext.c, localealias.c, textdomain.c, finddomain.c:
+ Don't use xmalloc, xstrdup, and stpcpy. These functions are not part
+ of the standard libc and so prevent libintl.a from being used
+ standalone.
+
+Sun Sep 17 23:14:49 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c: Correct some bugs in handling of CEN standard
+ locale definitions.
+
+Thu Sep 7 01:49:28 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c: Implement CEN syntax.
+
+ * gettextP.h (loaded_domain): Extend number of successors to 31.
+
+Sat Aug 19 19:25:29 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (aliaspath): Remove path to X11 locale dir.
+
+ * Makefile.in: Make install-src depend on install. This helps
+ gettext to install the sources and other packages can use the
+ install goal.
+
+Sat Aug 19 15:19:33 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (uninstall): Remove stuff installed by install-src.
+
+Tue Aug 15 13:13:53 1995 Ulrich Drepper <drepper@myware>
+
+ * VERSION.in: Initial revision.
+
+ * Makefile.in (DISTFILES):
+ Add VERSION file. This is not necessary for gettext, but
+ for other packages using this library.
+
+Tue Aug 15 06:16:44 1995 Ulrich Drepper <drepper@myware>
+
+ * gettextP.h (_nl_find_domain):
+ New prototype after changing search strategy.
+
+ * finddomain.c (_nl_find_domain):
+ We now try only to find a specified catalog. Fall back to other
+ catalogs listed in the locale list is now done in __dcgettext.
+
+ * dcgettext.c (__dcgettext):
+ Now we provide message fall back even to different languages.
+ I.e. if a message is not available in one language all the other
+ in the locale list a tried. Formerly fall back was only possible
+ within one language. Implemented by moving one loop from
+ _nl_find_domain to here.
+
+Mon Aug 14 23:45:50 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (gettextsrcdir):
+ Directory where source of GNU gettext library are made
+ available.
+ (INSTALL, INSTALL_DATA): Programs used for installing sources.
+ (gettext-src): New. Rule to install GNU gettext sources for use in
+ gettextize shell script.
+
+Sun Aug 13 14:40:48 1995 Ulrich Drepper <drepper@myware>
+
+ * loadmsgcat.c (_nl_load_domain):
+ Use mmap for loading only when munmap function is
+ also available.
+
+ * Makefile.in (install): Depend on `all' goal.
+
+Wed Aug 9 11:04:33 1995 Ulrich Drepper <drepper@myware>
+
+ * localealias.c (read_alias_file):
+ Do not overwrite '\n' when terminating alias value string.
+
+ * localealias.c (read_alias_file):
+ Handle long lines. Ignore the rest not fitting in
+ the buffer after the initial `fgets' call.
+
+Wed Aug 9 00:54:29 1995 Ulrich Drepper <drepper@myware>
+
+ * gettextP.h (_nl_load_domain):
+ Add prototype, replacing prototype for _nl_load_msg_cat.
+
+ * finddomain.c (_nl_find_domain):
+ Remove unneeded variable filename and filename_len.
+ (expand_alias): Remove prototype because functions does not
+ exist anymore.
+
+ * localealias.c (read_alias_file):
+ Change type of fname_len parameter to int.
+ (xmalloc): Add prototype.
+
+ * loadmsgcat.c: Better prototypes for xmalloc.
+
+Tue Aug 8 22:30:39 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c (_nl_find_domain):
+ Allow alias name to be constructed from the four components.
+
+ * Makefile.in (aliaspath): New variable. Set to preliminary value.
+ (SOURCES): Add localealias.c.
+ (OBJECTS): Add localealias.o.
+
+ * gettextP.h: Add prototype for _nl_expand_alias.
+
+ * finddomain.c: Aliasing handled in intl/localealias.c.
+
+ * localealias.c: Aliasing for locale names.
+
+ * bindtextdom.c: Better prototypes for xmalloc and xstrdup.
+
+Mon Aug 7 23:47:42 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (DISTFILES): gettext.perl is now found in misc/.
+
+ * cat-compat.c (bindtextdomain):
+ Correct implementation. dirname parameter was not used.
+ Reported by Marcus Daniels.
+
+ * gettextP.h (loaded_domain):
+ New fields `successor' and `decided' for oo, lazy
+ message handling implementation.
+
+ * dcgettext.c:
+ Adopt for oo, lazy message handliing.
+ Now we can inherit translations from less specific locales.
+ (find_msg): New function.
+
+ * loadmsgcat.c, finddomain.c:
+ Complete rewrite. Implement oo, lazy message handling :-).
+ We now have an additional environment variable `LANGUAGE' with
+ a higher priority than LC_ALL for the LC_MESSAGE locale.
+ Here we can set a colon separated list of specifications each
+ of the form `language[_territory[.codeset]][@modifier]'.
+
+Sat Aug 5 09:55:42 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c (unistd.h):
+ Include to get _PC_PATH_MAX defined on system having it.
+
+Fri Aug 4 22:42:00 1995 Ulrich Drepper <drepper@myware>
+
+ * finddomain.c (stpcpy): Include prototype.
+
+ * Makefile.in (dist): Remove `copying instead' message.
+
+Wed Aug 2 18:52:03 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (ID, TAGS): Do not use $^.
+
+Tue Aug 1 20:07:11 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (TAGS, ID): Use $^ as command argument.
+ (TAGS): Give etags -o option t write to current directory,
+ not $(srcdir).
+ (ID): Use $(srcdir) instead os $(top_srcdir)/src.
+ (distclean): Remove ID.
+
+Sun Jul 30 11:51:46 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (gnulocaledir):
+ New variable, always using share/ for data directory.
+ (DEFS): Add GNULOCALEDIR, used in finddomain.c.
+
+ * finddomain.c (_nl_default_dirname):
+ Set to GNULOCALEDIR, because it always has to point
+ to the directory where GNU gettext Library writes it to.
+
+ * intl-compat.c (textdomain, bindtextdomain):
+ Undefine macros before function definition.
+
+Sat Jul 22 01:10:02 1995 Ulrich Drepper <drepper@myware>
+
+ * libgettext.h (_LIBINTL_H):
+ Protect definition in case where this file is included as
+ libgettext.h on Solaris machines. Add comment about this.
+
+Wed Jul 19 02:36:42 1995 Ulrich Drepper <drepper@myware>
+
+ * intl-compat.c (textdomain): Correct typo.
+
+Wed Jul 19 01:51:35 1995 Ulrich Drepper <drepper@myware>
+
+ * dcgettext.c (dcgettext): Function now called __dcgettext.
+
+ * dgettext.c (dgettext): Now called __dgettext and calls
+ __dcgettext.
+
+ * gettext.c (gettext):
+ Function now called __gettext and calls __dgettext.
+
+ * textdomain.c (textdomain): Function now called __textdomain.
+
+ * bindtextdom.c (bindtextdomain): Function now called
+ __bindtextdomain.
+
+ * intl-compat.c: Initial revision.
+
+ * Makefile.in (SOURCES): Add intl-compat.c.
+ (OBJECTS): We always compile the GNU gettext library functions.
+ OBJECTS contains all objects but cat-compat.o, ../po/cat-if-tbl.o,
+ and intl-compat.o.
+ (GETTOBJS): Contains now only intl-compat.o.
+
+ * libgettext.h:
+ Re-include protection matches dualistic character of libgettext.h.
+ For all functions in GNU gettext library define __ counter part.
+
+ * finddomain.c (strchr): Define as index if not found in C library.
+ (_nl_find_domain): For relative paths paste / in between.
+
+Tue Jul 18 16:37:45 1995 Ulrich Drepper <drepper@myware>
+
+ * loadmsgcat.c, finddomain.c: Add inclusion of sys/types.h.
+
+ * xopen-msg.sed: Fix bug with `msgstr ""' lines.
+ A little bit better comments.
+
+Tue Jul 18 01:18:27 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in:
+ po-mode.el, makelinks, combine-sh are now found in ../misc.
+
+ * po-mode.el, makelinks, combine-sh, elisp-comp:
+ Moved to ../misc/.
+
+ * libgettext.h, gettextP.h, gettext.h: Uniform test for __STDC__.
+
+Sun Jul 16 22:33:02 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (INSTALL, INSTALL_DATA): New variables.
+ (install-data, uninstall): Install/uninstall .elc file.
+
+ * po-mode.el (Installation comment):
+ Add .pox as possible extension of .po files.
+
+Sun Jul 16 13:23:27 1995 Ulrich Drepper <drepper@myware>
+
+ * elisp-comp: Complete new version by Franc,ois: This does not
+ fail when not compiling in the source directory.
+
+Sun Jul 16 00:12:17 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (../po/cat-id-tbl.o):
+ Use $(MAKE) instead of make for recursive make.
+
+ * Makefile.in (.el.elc): Use $(SHELL) instead of /bin/sh.
+ (install-exec): Add missing dummy goal.
+ (install-data, uninstall): @ in multi-line shell command at
+ beginning, not in front of echo. Reported by Eric Backus.
+
+Sat Jul 15 00:21:28 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (DISTFILES):
+ Rename libgettext.perl to gettext.perl to fit in 14 chars
+ file systems.
+
+ * gettext.perl:
+ Rename to gettext.perl to fit in 14 chars file systems.
+
+Thu Jul 13 23:17:20 1995 Ulrich Drepper <drepper@myware>
+
+ * cat-compat.c: If !STDC_HEADERS try to include malloc.h.
+
+Thu Jul 13 20:55:02 1995 Ulrich Drepper <drepper@myware>
+
+ * po2tbl.sed.in: Pretty printing.
+
+ * linux-msg.sed, xopen-msg.sed:
+ Correct bugs with handling substitute flags in branches.
+
+ * hash-string.h (hash_string):
+ Old K&R compilers don't under stand `unsigned char'.
+
+ * gettext.h (nls_uint32):
+ Some old K&R compilers (eg HP) don't understand `unsigned int'.
+
+ * cat-compat.c (msg_to_cat_id): De-ANSI-fy prototypes.
+
+Thu Jul 13 01:34:33 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (ELCFILES): New variable.
+ (DISTFILES): Add elisp-comp.
+ Add implicit rule for .el -> .elc compilation.
+ (install-data): install $ELCFILES
+ (clean): renamed po-to-tbl and po-to-msg to po2tbl and po2msg resp.
+
+ * elisp-comp: Initial revision
+
+Wed Jul 12 16:14:52 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in:
+ cat-id-tbl.c is now found in po/. This enables us to use an identical
+ intl/ directory in all packages.
+
+ * dcgettext.c (dcgettext): hashing does not work for table size <= 2.
+
+ * textdomain.c: fix typo (#if def -> #if defined)
+
+Tue Jul 11 18:44:43 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in (stamp-cat-id): use top_srcdir to address source files
+ (DISTFILES,distclean): move tupdate.perl to src/
+
+ * po-to-tbl.sed.in:
+ add additional jump to clear change flag to recognize multiline strings
+
+Tue Jul 11 01:32:50 1995 Ulrich Drepper <drepper@myware>
+
+ * textdomain.c: Protect inclusion of stdlib.h and string.h.
+
+ * loadmsgcat.c: Protect inclusion of stdlib.h.
+
+ * libgettext.h: Protect inclusion of locale.h.
+ Allow use in C++ programs.
+ Define NULL is not happened already.
+
+ * Makefile.in (DISTFILES): ship po-to-tbl.sed.in instead of
+ po-to-tbl.sed.
+ (distclean): remove po-to-tbl.sed and tupdate.perl.
+
+ * tupdate.perl.in: Substitute Perl path even in exec line.
+ Don't include entries without translation from old .po file.
+
+Tue Jul 4 00:41:51 1995 Ulrich Drepper <drepper@myware>
+
+ * tupdate.perl.in: use "Updated: " in msgid "".
+
+ * cat-compat.c: Fix typo (LOCALDIR -> LOCALEDIR).
+ Define getenv if !__STDC__.
+
+ * bindtextdom.c: Protect stdlib.h and string.h inclusion.
+ Define free if !__STDC__.
+
+ * finddomain.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
+ Define free if !__STDC__.
+
+ * cat-compat.c: Change DEF_MSG_DOM_DIR to LOCALEDIR.
+
+Mon Jul 3 23:56:30 1995 Ulrich Drepper <drepper@myware>
+
+ * Makefile.in: Use LOCALEDIR instead of DEF_MSG_DOM_DIR.
+ Remove unneeded $(srcdir) from Makefile.in dependency.
+
+ * makelinks: Add copyright and short description.
+
+ * po-mode.el: Last version for 0.7.
+
+ * tupdate.perl.in: Fix die message.
+
+ * dcgettext.c: Protect include of string.h.
+
+ * gettext.c: Protect include of stdlib.h and further tries to get NULL.
+
+ * finddomain.c: Some corrections in includes.
+
+ * Makefile.in (INCLUDES): Prune list correct path to Makefile.in.
+
+ * po-to-tbl.sed: Adopt for new .po file format.
+
+ * linux-msg.sed, xopen-msg.sed: Adopt for new .po file format.
+
+Sun Jul 2 23:55:03 1995 Ulrich Drepper <drepper@myware>
+
+ * tupdate.perl.in: Complete rewrite for new .po file format.
+
+Sun Jul 2 02:06:50 1995 Ulrich Drepper <drepper@myware>
+
+ * First official release. This directory contains all the code
+ needed to internationalize own packages. It provides functions
+ which allow to use the X/Open catgets function with an interface
+ like the Uniforum gettext function. For system which does not
+ have neither of those a complete implementation is provided.
diff --git a/intl/Makefile.in b/intl/Makefile.in
new file mode 100644
index 0000000..a41fb57
--- /dev/null
+++ b/intl/Makefile.in
@@ -0,0 +1,214 @@
+# Makefile for directory with message catalog handling in GNU NLS Utilities.
+# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = ..
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+transform = @program_transform_name@
+libdir = $(exec_prefix)/lib
+includedir = $(prefix)/include
+datadir = $(prefix)/@DATADIRNAME@
+localedir = $(datadir)/locale
+gnulocaledir = $(prefix)/share/locale
+gettextsrcdir = @datadir@/gettext/intl
+aliaspath = $(localedir):.
+subdir = intl
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+
+l = @l@
+
+AR = ar
+CC = @CC@
+LIBTOOL = @LIBTOOL@
+RANLIB = @RANLIB@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
+-DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@
+CPPFLAGS = @CPPFLAGS@
+CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+HEADERS = $(COMHDRS) libgettext.h loadinfo.h
+COMHDRS = gettext.h gettextP.h hash-string.h
+SOURCES = $(COMSRCS) intl-compat.c cat-compat.c
+COMSRCS = bindtextdom.c dcgettext.c dgettext.c gettext.c \
+finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c \
+explodename.c
+OBJECTS = @INTLOBJS@ bindtextdom.$lo dcgettext.$lo dgettext.$lo gettext.$lo \
+finddomain.$lo loadmsgcat.$lo localealias.$lo textdomain.$lo l10nflist.$lo \
+explodename.$lo
+CATOBJS = cat-compat.$lo ../po/cat-id-tbl.$lo
+GETTOBJS = intl-compat.$lo
+DISTFILES.common = ChangeLog Makefile.in linux-msg.sed po2tbl.sed.in \
+xopen-msg.sed $(HEADERS) $(SOURCES)
+DISTFILES.normal = VERSION
+DISTFILES.gettext = libintl.glibc intlh.inst.in
+
+.SUFFIXES:
+.SUFFIXES: .c .o .lo
+.c.o:
+ $(COMPILE) $<
+.c.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) $<
+
+INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
+
+all: all-@USE_INCLUDED_LIBINTL@
+
+all-yes: libintl.$la intlh.inst
+all-no:
+
+libintl.a: $(OBJECTS)
+ rm -f $@
+ $(AR) cru $@ $(OBJECTS)
+ $(RANLIB) $@
+
+libintl.la: $(OBJECTS)
+ $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \
+ -version-info 1:0 -rpath $(libdir)
+
+../po/cat-id-tbl.$lo: ../po/cat-id-tbl.c $(top_srcdir)/po/$(PACKAGE).pot
+ cd ../po && $(MAKE) cat-id-tbl.$lo
+
+check: all
+
+# This installation goal is only used in GNU gettext. Packages which
+# only use the library should use install instead.
+
+# We must not install the libintl.h/libintl.a files if we are on a
+# system which has the gettext() function in its C library or in a
+# separate library or use the catgets interface. A special case is
+# where configure found a previously installed GNU gettext library.
+# If you want to use the one which comes with this version of the
+# package, you have to use `configure --with-included-gettext'.
+install: install-exec install-data
+install-exec: all
+ if test "$(PACKAGE)" = "gettext" \
+ && test '@INTLOBJS@' = '$(GETTOBJS)'; then \
+ if test -r $(MKINSTALLDIRS); then \
+ $(MKINSTALLDIRS) $(libdir) $(includedir); \
+ else \
+ $(top_srcdir)/mkinstalldirs $(libdir) $(includedir); \
+ fi; \
+ $(INSTALL_DATA) intlh.inst $(includedir)/libintl.h; \
+ $(INSTALL_DATA) libintl.a $(libdir)/libintl.a; \
+ else \
+ : ; \
+ fi
+install-data: all
+ if test "$(PACKAGE)" = "gettext"; then \
+ if test -r $(MKINSTALLDIRS); then \
+ $(MKINSTALLDIRS) $(gettextsrcdir); \
+ else \
+ $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+ fi; \
+ $(INSTALL_DATA) VERSION $(gettextsrcdir)/VERSION; \
+ dists="$(DISTFILES.common)"; \
+ for file in $$dists; do \
+ $(INSTALL_DATA) $(srcdir)/$$file $(gettextsrcdir)/$$file; \
+ done; \
+ else \
+ : ; \
+ fi
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+ dists="$(DISTFILES.common)"; \
+ for file in $$dists; do \
+ rm -f $(gettextsrcdir)/$$file; \
+ done
+
+info dvi:
+
+$(OBJECTS): ../config.h libgettext.h
+bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
+dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
+
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES)
+ here=`pwd`; cd $(srcdir) && etags -o $$here/TAGS $(HEADERS) $(SOURCES)
+
+id: ID
+
+ID: $(HEADERS) $(SOURCES)
+ here=`pwd`; cd $(srcdir) && mkid -f$$here/ID $(HEADERS) $(SOURCES)
+
+
+mostlyclean:
+ rm -f *.a *.o *.lo core core.*
+
+clean: mostlyclean
+
+distclean: clean
+ rm -f Makefile ID TAGS po2msg.sed po2tbl.sed libintl.h
+
+maintainer-clean: distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+
+# GNU gettext needs not contain the file `VERSION' but contains some
+# other files which should not be distributed in other packages.
+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: Makefile $(DISTFILES)
+ if test "$(PACKAGE)" = gettext; then \
+ additional="$(DISTFILES.gettext)"; \
+ else \
+ additional="$(DISTFILES.normal)"; \
+ fi; \
+ for file in $(DISTFILES.common) $$additional; do \
+ ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+ || cp -p $(srcdir)/$$file $(distdir); \
+ done
+
+dist-libc:
+ tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc
+
+Makefile: Makefile.in ../config.status
+ cd .. \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+# The dependency for intlh.inst is different in gettext and all other
+# packages. Because we cannot you GNU make features we have to solve
+# the problem while rewriting Makefile.in.
+@GT_YES@intlh.inst: intlh.inst.in ../config.status
+@GT_YES@ cd .. \
+@GT_YES@ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
+@GT_YES@ $(SHELL) ./config.status
+@GT_NO@.PHONY: intlh.inst
+@GT_NO@intlh.inst:
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/intl/VERSION b/intl/VERSION
new file mode 100644
index 0000000..d31950a
--- /dev/null
+++ b/intl/VERSION
@@ -0,0 +1 @@
+GNU gettext library from gettext-0.10.32
diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
new file mode 100644
index 0000000..9fcb8d9
--- /dev/null
+++ b/intl/bindtextdom.c
@@ -0,0 +1,199 @@
+/* Implementation of the bindtextdomain(3) function
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#else
+# ifdef HAVE_MALLOC_H
+# include <malloc.h>
+# else
+void free ();
+# endif
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+#include "gettext.h"
+#include "gettextP.h"
+
+/* @@ end of prolog @@ */
+
+/* Contains the default location of the message catalogs. */
+extern const char _nl_default_dirname[];
+
+/* List with bindings of specific domains. */
+extern struct binding *_nl_domain_bindings;
+
+
+/* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+ code is also used in GNU C Library where the names have a __
+ prefix. So we have to make a difference here. */
+#ifdef _LIBC
+# define BINDTEXTDOMAIN __bindtextdomain
+# define strdup(str) __strdup (str)
+#else
+# define BINDTEXTDOMAIN bindtextdomain__
+#endif
+
+/* Specify that the DOMAINNAME message catalog will be found
+ in DIRNAME rather than in the system locale data base. */
+char *
+BINDTEXTDOMAIN (domainname, dirname)
+ const char *domainname;
+ const char *dirname;
+{
+ struct binding *binding;
+
+ /* Some sanity checks. */
+ if (domainname == NULL || domainname[0] == '\0')
+ return NULL;
+
+ for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
+ {
+ int compare = strcmp (domainname, binding->domainname);
+ if (compare == 0)
+ /* We found it! */
+ break;
+ if (compare < 0)
+ {
+ /* It is not in the list. */
+ binding = NULL;
+ break;
+ }
+ }
+
+ if (dirname == NULL)
+ /* The current binding has be to returned. */
+ return binding == NULL ? (char *) _nl_default_dirname : binding->dirname;
+
+ if (binding != NULL)
+ {
+ /* The domain is already bound. If the new value and the old
+ one are equal we simply do nothing. Otherwise replace the
+ old binding. */
+ if (strcmp (dirname, binding->dirname) != 0)
+ {
+ char *new_dirname;
+
+ if (strcmp (dirname, _nl_default_dirname) == 0)
+ new_dirname = (char *) _nl_default_dirname;
+ else
+ {
+#if defined _LIBC || defined HAVE_STRDUP
+ new_dirname = strdup (dirname);
+ if (new_dirname == NULL)
+ return NULL;
+#else
+ size_t len = strlen (dirname) + 1;
+ new_dirname = (char *) malloc (len);
+ if (new_dirname == NULL)
+ return NULL;
+
+ memcpy (new_dirname, dirname, len);
+#endif
+ }
+
+ if (binding->dirname != _nl_default_dirname)
+ free (binding->dirname);
+
+ binding->dirname = new_dirname;
+ }
+ }
+ else
+ {
+ /* We have to create a new binding. */
+ size_t len;
+ struct binding *new_binding =
+ (struct binding *) malloc (sizeof (*new_binding));
+
+ if (new_binding == NULL)
+ return NULL;
+
+#if defined _LIBC || defined HAVE_STRDUP
+ new_binding->domainname = strdup (domainname);
+ if (new_binding->domainname == NULL)
+ return NULL;
+#else
+ len = strlen (domainname) + 1;
+ new_binding->domainname = (char *) malloc (len);
+ if (new_binding->domainname == NULL)
+ return NULL;
+ memcpy (new_binding->domainname, domainname, len);
+#endif
+
+ if (strcmp (dirname, _nl_default_dirname) == 0)
+ new_binding->dirname = (char *) _nl_default_dirname;
+ else
+ {
+#if defined _LIBC || defined HAVE_STRDUP
+ new_binding->dirname = strdup (dirname);
+ if (new_binding->dirname == NULL)
+ return NULL;
+#else
+ len = strlen (dirname) + 1;
+ new_binding->dirname = (char *) malloc (len);
+ if (new_binding->dirname == NULL)
+ return NULL;
+ memcpy (new_binding->dirname, dirname, len);
+#endif
+ }
+
+ /* Now enqueue it. */
+ if (_nl_domain_bindings == NULL
+ || strcmp (domainname, _nl_domain_bindings->domainname) < 0)
+ {
+ new_binding->next = _nl_domain_bindings;
+ _nl_domain_bindings = new_binding;
+ }
+ else
+ {
+ binding = _nl_domain_bindings;
+ while (binding->next != NULL
+ && strcmp (domainname, binding->next->domainname) > 0)
+ binding = binding->next;
+
+ new_binding->next = binding->next;
+ binding->next = new_binding;
+ }
+
+ binding = new_binding;
+ }
+
+ return binding->dirname;
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library. */
+weak_alias (__bindtextdomain, bindtextdomain);
+#endif
diff --git a/intl/cat-compat.c b/intl/cat-compat.c
new file mode 100644
index 0000000..867d901
--- /dev/null
+++ b/intl/cat-compat.c
@@ -0,0 +1,262 @@
+/* Compatibility code for gettext-using-catgets interface.
+ Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else
+char *getenv ();
+# ifdef HAVE_MALLOC_H
+# include <malloc.h>
+# endif
+#endif
+
+#ifdef HAVE_NL_TYPES_H
+# include <nl_types.h>
+#endif
+
+#include "libgettext.h"
+
+/* @@ end of prolog @@ */
+
+/* XPG3 defines the result of `setlocale (category, NULL)' as:
+ ``Directs `setlocale()' to query `category' and return the current
+ setting of `local'.''
+ However it does not specify the exact format. And even worse: POSIX
+ defines this not at all. So we can use this feature only on selected
+ system (e.g. those using GNU C Library). */
+#ifdef _LIBC
+# define HAVE_LOCALE_NULL
+#endif
+
+/* The catalog descriptor. */
+static nl_catd catalog = (nl_catd) -1;
+
+/* Name of the default catalog. */
+static const char default_catalog_name[] = "messages";
+
+/* Name of currently used catalog. */
+static const char *catalog_name = default_catalog_name;
+
+/* Get ID for given string. If not found return -1. */
+static int msg_to_cat_id PARAMS ((const char *msg));
+
+/* Substitution for systems lacking this function in their C library. */
+#if !_LIBC && !HAVE_STPCPY
+static char *stpcpy PARAMS ((char *dest, const char *src));
+#endif
+
+
+/* Set currently used domain/catalog. */
+char *
+textdomain (domainname)
+ const char *domainname;
+{
+ nl_catd new_catalog;
+ char *new_name;
+ size_t new_name_len;
+ char *lang;
+
+#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES \
+ && defined HAVE_LOCALE_NULL
+ lang = setlocale (LC_MESSAGES, NULL);
+#else
+ lang = getenv ("LC_ALL");
+ if (lang == NULL || lang[0] == '\0')
+ {
+ lang = getenv ("LC_MESSAGES");
+ if (lang == NULL || lang[0] == '\0')
+ lang = getenv ("LANG");
+ }
+#endif
+ if (lang == NULL || lang[0] == '\0')
+ lang = "C";
+
+ /* See whether name of currently used domain is asked. */
+ if (domainname == NULL)
+ return (char *) catalog_name;
+
+ if (domainname[0] == '\0')
+ domainname = default_catalog_name;
+
+ /* Compute length of added path element. */
+ new_name_len = sizeof (LOCALEDIR) - 1 + 1 + strlen (lang)
+ + sizeof ("/LC_MESSAGES/") - 1 + sizeof (PACKAGE) - 1
+ + sizeof (".cat");
+
+ new_name = (char *) malloc (new_name_len);
+ if (new_name == NULL)
+ return NULL;
+
+ strcpy (new_name, PACKAGE);
+ new_catalog = catopen (new_name, 0);
+
+ if (new_catalog == (nl_catd) -1)
+ {
+ /* NLSPATH search didn't work, try absolute path */
+ sprintf (new_name, "%s/%s/LC_MESSAGES/%s.cat", LOCALEDIR, lang,
+ PACKAGE);
+ new_catalog = catopen (new_name, 0);
+
+ if (new_catalog == (nl_catd) -1)
+ {
+ free (new_name);
+ return (char *) catalog_name;
+ }
+ }
+
+ /* Close old catalog. */
+ if (catalog != (nl_catd) -1)
+ catclose (catalog);
+ if (catalog_name != default_catalog_name)
+ free ((char *) catalog_name);
+
+ catalog = new_catalog;
+ catalog_name = new_name;
+
+ return (char *) catalog_name;
+}
+
+char *
+bindtextdomain (domainname, dirname)
+ const char *domainname;
+ const char *dirname;
+{
+#if HAVE_SETENV || HAVE_PUTENV
+ char *old_val, *new_val, *cp;
+ size_t new_val_len;
+
+ /* This does not make much sense here but to be compatible do it. */
+ if (domainname == NULL)
+ return NULL;
+
+ /* Compute length of added path element. If we use setenv we don't need
+ the first byts for NLSPATH=, but why complicate the code for this
+ peanuts. */
+ new_val_len = sizeof ("NLSPATH=") - 1 + strlen (dirname)
+ + sizeof ("/%L/LC_MESSAGES/%N.cat");
+
+ old_val = getenv ("NLSPATH");
+ if (old_val == NULL || old_val[0] == '\0')
+ {
+ old_val = NULL;
+ new_val_len += 1 + sizeof (LOCALEDIR) - 1
+ + sizeof ("/%L/LC_MESSAGES/%N.cat");
+ }
+ else
+ new_val_len += strlen (old_val);
+
+ new_val = (char *) malloc (new_val_len);
+ if (new_val == NULL)
+ return NULL;
+
+# if HAVE_SETENV
+ cp = new_val;
+# else
+ cp = stpcpy (new_val, "NLSPATH=");
+# endif
+
+ cp = stpcpy (cp, dirname);
+ cp = stpcpy (cp, "/%L/LC_MESSAGES/%N.cat:");
+
+ if (old_val == NULL)
+ {
+# if __STDC__
+ stpcpy (cp, LOCALEDIR "/%L/LC_MESSAGES/%N.cat");
+# else
+
+ cp = stpcpy (cp, LOCALEDIR);
+ stpcpy (cp, "/%L/LC_MESSAGES/%N.cat");
+# endif
+ }
+ else
+ stpcpy (cp, old_val);
+
+# if HAVE_SETENV
+ setenv ("NLSPATH", new_val, 1);
+ free (new_val);
+# else
+ putenv (new_val);
+ /* Do *not* free the environment entry we just entered. It is used
+ from now on. */
+# endif
+
+#endif
+
+ return (char *) domainname;
+}
+
+#undef gettext
+char *
+gettext (msg)
+ const char *msg;
+{
+ int msgid;
+
+ if (msg == NULL || catalog == (nl_catd) -1)
+ return (char *) msg;
+
+ /* Get the message from the catalog. We always use set number 1.
+ The message ID is computed by the function `msg_to_cat_id'
+ which works on the table generated by `po-to-tbl'. */
+ msgid = msg_to_cat_id (msg);
+ if (msgid == -1)
+ return (char *) msg;
+
+ return catgets (catalog, 1, msgid, (char *) msg);
+}
+
+/* Look through the table `_msg_tbl' which has `_msg_tbl_length' entries
+ for the one equal to msg. If it is found return the ID. In case when
+ the string is not found return -1. */
+static int
+msg_to_cat_id (msg)
+ const char *msg;
+{
+ int cnt;
+
+ for (cnt = 0; cnt < _msg_tbl_length; ++cnt)
+ if (strcmp (msg, _msg_tbl[cnt]._msg) == 0)
+ return _msg_tbl[cnt]._msg_number;
+
+ return -1;
+}
+
+
+/* @@ begin of epilog @@ */
+
+/* We don't want libintl.a to depend on any other library. So we
+ avoid the non-standard function stpcpy. In GNU C Library this
+ function is available, though. Also allow the symbol HAVE_STPCPY
+ to be defined. */
+#if !_LIBC && !HAVE_STPCPY
+static char *
+stpcpy (dest, src)
+ char *dest;
+ const char *src;
+{
+ while ((*dest++ = *src++) != '\0')
+ /* Do nothing. */ ;
+ return dest - 1;
+}
+#endif
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
new file mode 100644
index 0000000..a316bfd
--- /dev/null
+++ b/intl/dcgettext.c
@@ -0,0 +1,593 @@
+/* Implementation of the dcgettext(3) function
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+# define HAVE_ALLOCA 1
+#else
+# if defined HAVE_ALLOCA_H || defined _LIBC
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca
+char *alloca ();
+# endif
+# endif
+# endif
+#endif
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+#ifndef __set_errno
+# define __set_errno(val) errno = (val)
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#else
+char *getenv ();
+# ifdef HAVE_MALLOC_H
+# include <malloc.h>
+# else
+void free ();
+# endif
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+# endif
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+#if !HAVE_STRCHR && !defined _LIBC
+# ifndef strchr
+# define strchr index
+# endif
+#endif
+
+#if defined HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+#endif
+
+#include "gettext.h"
+#include "gettextP.h"
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+#include "hash-string.h"
+
+/* @@ end of prolog @@ */
+
+#ifdef _LIBC
+/* Rename the non ANSI C functions. This is required by the standard
+ because some ANSI C functions will require linking with this object
+ file and the name space must not be polluted. */
+# define getcwd __getcwd
+# define stpcpy __stpcpy
+#else
+# if !defined HAVE_GETCWD
+char *getwd ();
+# define getcwd(buf, max) getwd (buf)
+# else
+char *getcwd ();
+# endif
+# ifndef HAVE_STPCPY
+static char *stpcpy PARAMS ((char *dest, const char *src));
+# endif
+#endif
+
+/* Amount to increase buffer size by in each try. */
+#define PATH_INCR 32
+
+/* The following is from pathmax.h. */
+/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
+ PATH_MAX but might cause redefinition warnings when sys/param.h is
+ later included (as on MORE/BSD 4.3). */
+#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__))
+# include <limits.h>
+#endif
+
+#ifndef _POSIX_PATH_MAX
+# define _POSIX_PATH_MAX 255
+#endif
+
+#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
+# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
+#endif
+
+/* Don't include sys/param.h if it already has been. */
+#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN)
+# include <sys/param.h>
+#endif
+
+#if !defined(PATH_MAX) && defined(MAXPATHLEN)
+# define PATH_MAX MAXPATHLEN
+#endif
+
+#ifndef PATH_MAX
+# define PATH_MAX _POSIX_PATH_MAX
+#endif
+
+/* XPG3 defines the result of `setlocale (category, NULL)' as:
+ ``Directs `setlocale()' to query `category' and return the current
+ setting of `local'.''
+ However it does not specify the exact format. And even worse: POSIX
+ defines this not at all. So we can use this feature only on selected
+ system (e.g. those using GNU C Library). */
+#ifdef _LIBC
+# define HAVE_LOCALE_NULL
+#endif
+
+/* Name of the default domain used for gettext(3) prior any call to
+ textdomain(3). The default value for this is "messages". */
+const char _nl_default_default_domain[] = "messages";
+
+/* Value used as the default domain for gettext(3). */
+const char *_nl_current_default_domain = _nl_default_default_domain;
+
+/* Contains the default location of the message catalogs. */
+const char _nl_default_dirname[] = GNULOCALEDIR;
+
+/* List with bindings of specific domains created by bindtextdomain()
+ calls. */
+struct binding *_nl_domain_bindings;
+
+/* Prototypes for local functions. */
+static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
+ const char *msgid));
+static const char *category_to_name PARAMS ((int category));
+static const char *guess_category_value PARAMS ((int category,
+ const char *categoryname));
+
+
+/* For those loosing systems which don't have `alloca' we have to add
+ some additional code emulating it. */
+#ifdef HAVE_ALLOCA
+/* Nothing has to be done. */
+# define ADD_BLOCK(list, address) /* nothing */
+# define FREE_BLOCKS(list) /* nothing */
+#else
+struct block_list
+{
+ void *address;
+ struct block_list *next;
+};
+# define ADD_BLOCK(list, addr) \
+ do { \
+ struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
+ /* If we cannot get a free block we cannot add the new element to \
+ the list. */ \
+ if (newp != NULL) { \
+ newp->address = (addr); \
+ newp->next = (list); \
+ (list) = newp; \
+ } \
+ } while (0)
+# define FREE_BLOCKS(list) \
+ do { \
+ while (list != NULL) { \
+ struct block_list *old = list; \
+ list = list->next; \
+ free (old); \
+ } \
+ } while (0)
+# undef alloca
+# define alloca(size) (malloc (size))
+#endif /* have alloca */
+
+
+/* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+ code is also used in GNU C Library where the names have a __
+ prefix. So we have to make a difference here. */
+#ifdef _LIBC
+# define DCGETTEXT __dcgettext
+#else
+# define DCGETTEXT dcgettext__
+#endif
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+ locale. */
+char *
+DCGETTEXT (domainname, msgid, category)
+ const char *domainname;
+ const char *msgid;
+ int category;
+{
+#ifndef HAVE_ALLOCA
+ struct block_list *block_list = NULL;
+#endif
+ struct loaded_l10nfile *domain;
+ struct binding *binding;
+ const char *categoryname;
+ const char *categoryvalue;
+ char *dirname, *xdomainname;
+ char *single_locale;
+ char *retval;
+ int saved_errno = errno;
+
+ /* If no real MSGID is given return NULL. */
+ if (msgid == NULL)
+ return NULL;
+
+ /* If DOMAINNAME is NULL, we are interested in the default domain. If
+ CATEGORY is not LC_MESSAGES this might not make much sense but the
+ defintion left this undefined. */
+ if (domainname == NULL)
+ domainname = _nl_current_default_domain;
+
+ /* First find matching binding. */
+ for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next)
+ {
+ int compare = strcmp (domainname, binding->domainname);
+ if (compare == 0)
+ /* We found it! */
+ break;
+ if (compare < 0)
+ {
+ /* It is not in the list. */
+ binding = NULL;
+ break;
+ }
+ }
+
+ if (binding == NULL)
+ dirname = (char *) _nl_default_dirname;
+ else if (binding->dirname[0] == '/')
+ dirname = binding->dirname;
+ else
+ {
+ /* We have a relative path. Make it absolute now. */
+ size_t dirname_len = strlen (binding->dirname) + 1;
+ size_t path_max;
+ char *ret;
+
+ path_max = (unsigned) PATH_MAX;
+ path_max += 2; /* The getcwd docs say to do this. */
+
+ dirname = (char *) alloca (path_max + dirname_len);
+ ADD_BLOCK (block_list, dirname);
+
+ __set_errno (0);
+ while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
+ {
+ path_max += PATH_INCR;
+ dirname = (char *) alloca (path_max + dirname_len);
+ ADD_BLOCK (block_list, dirname);
+ __set_errno (0);
+ }
+
+ if (ret == NULL)
+ {
+ /* We cannot get the current working directory. Don't signal an
+ error but simply return the default string. */
+ FREE_BLOCKS (block_list);
+ __set_errno (saved_errno);
+ return (char *) msgid;
+ }
+
+ stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname);
+ }
+
+ /* Now determine the symbolic name of CATEGORY and its value. */
+ categoryname = category_to_name (category);
+ categoryvalue = guess_category_value (category, categoryname);
+
+ xdomainname = (char *) alloca (strlen (categoryname)
+ + strlen (domainname) + 5);
+ ADD_BLOCK (block_list, xdomainname);
+
+ stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"),
+ domainname),
+ ".mo");
+
+ /* Creating working area. */
+ single_locale = (char *) alloca (strlen (categoryvalue) + 1);
+ ADD_BLOCK (block_list, single_locale);
+
+
+ /* Search for the given string. This is a loop because we perhaps
+ got an ordered list of languages to consider for th translation. */
+ while (1)
+ {
+ /* Make CATEGORYVALUE point to the next element of the list. */
+ while (categoryvalue[0] != '\0' && categoryvalue[0] == ':')
+ ++categoryvalue;
+ if (categoryvalue[0] == '\0')
+ {
+ /* The whole contents of CATEGORYVALUE has been searched but
+ no valid entry has been found. We solve this situation
+ by implicitly appending a "C" entry, i.e. no translation
+ will take place. */
+ single_locale[0] = 'C';
+ single_locale[1] = '\0';
+ }
+ else
+ {
+ char *cp = single_locale;
+ while (categoryvalue[0] != '\0' && categoryvalue[0] != ':')
+ *cp++ = *categoryvalue++;
+ *cp = '\0';
+ }
+
+ /* If the current locale value is C (or POSIX) we don't load a
+ domain. Return the MSGID. */
+ if (strcmp (single_locale, "C") == 0
+ || strcmp (single_locale, "POSIX") == 0)
+ {
+ FREE_BLOCKS (block_list);
+ __set_errno (saved_errno);
+ return (char *) msgid;
+ }
+
+
+ /* Find structure describing the message catalog matching the
+ DOMAINNAME and CATEGORY. */
+ domain = _nl_find_domain (dirname, single_locale, xdomainname);
+
+ if (domain != NULL)
+ {
+ retval = find_msg (domain, msgid);
+
+ if (retval == NULL)
+ {
+ int cnt;
+
+ for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
+ {
+ retval = find_msg (domain->successor[cnt], msgid);
+
+ if (retval != NULL)
+ break;
+ }
+ }
+
+ if (retval != NULL)
+ {
+ FREE_BLOCKS (block_list);
+ __set_errno (saved_errno);
+ return retval;
+ }
+ }
+ }
+ /* NOTREACHED */
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library. */
+weak_alias (__dcgettext, dcgettext);
+#endif
+
+
+static char *
+find_msg (domain_file, msgid)
+ struct loaded_l10nfile *domain_file;
+ const char *msgid;
+{
+ size_t top, act, bottom;
+ struct loaded_domain *domain;
+
+ if (domain_file->decided == 0)
+ _nl_load_domain (domain_file);
+
+ if (domain_file->data == NULL)
+ return NULL;
+
+ domain = (struct loaded_domain *) domain_file->data;
+
+ /* Locate the MSGID and its translation. */
+ if (domain->hash_size > 2 && domain->hash_tab != NULL)
+ {
+ /* Use the hashing table. */
+ nls_uint32 len = strlen (msgid);
+ nls_uint32 hash_val = hash_string (msgid);
+ nls_uint32 idx = hash_val % domain->hash_size;
+ nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
+ nls_uint32 nstr = W (domain->must_swap, domain->hash_tab[idx]);
+
+ if (nstr == 0)
+ /* Hash table entry is empty. */
+ return NULL;
+
+ if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
+ && strcmp (msgid,
+ domain->data + W (domain->must_swap,
+ domain->orig_tab[nstr - 1].offset)) == 0)
+ return (char *) domain->data + W (domain->must_swap,
+ domain->trans_tab[nstr - 1].offset);
+
+ while (1)
+ {
+ if (idx >= domain->hash_size - incr)
+ idx -= domain->hash_size - incr;
+ else
+ idx += incr;
+
+ nstr = W (domain->must_swap, domain->hash_tab[idx]);
+ if (nstr == 0)
+ /* Hash table entry is empty. */
+ return NULL;
+
+ if (W (domain->must_swap, domain->orig_tab[nstr - 1].length) == len
+ && strcmp (msgid,
+ domain->data + W (domain->must_swap,
+ domain->orig_tab[nstr - 1].offset))
+ == 0)
+ return (char *) domain->data
+ + W (domain->must_swap, domain->trans_tab[nstr - 1].offset);
+ }
+ /* NOTREACHED */
+ }
+
+ /* Now we try the default method: binary search in the sorted
+ array of messages. */
+ bottom = 0;
+ top = domain->nstrings;
+ while (bottom < top)
+ {
+ int cmp_val;
+
+ act = (bottom + top) / 2;
+ cmp_val = strcmp (msgid, domain->data
+ + W (domain->must_swap,
+ domain->orig_tab[act].offset));
+ if (cmp_val < 0)
+ top = act;
+ else if (cmp_val > 0)
+ bottom = act + 1;
+ else
+ break;
+ }
+
+ /* If an translation is found return this. */
+ return bottom >= top ? NULL : (char *) domain->data
+ + W (domain->must_swap,
+ domain->trans_tab[act].offset);
+}
+
+
+/* Return string representation of locale CATEGORY. */
+static const char *
+category_to_name (category)
+ int category;
+{
+ const char *retval;
+
+ switch (category)
+ {
+#ifdef LC_COLLATE
+ case LC_COLLATE:
+ retval = "LC_COLLATE";
+ break;
+#endif
+#ifdef LC_CTYPE
+ case LC_CTYPE:
+ retval = "LC_CTYPE";
+ break;
+#endif
+#ifdef LC_MONETARY
+ case LC_MONETARY:
+ retval = "LC_MONETARY";
+ break;
+#endif
+#ifdef LC_NUMERIC
+ case LC_NUMERIC:
+ retval = "LC_NUMERIC";
+ break;
+#endif
+#ifdef LC_TIME
+ case LC_TIME:
+ retval = "LC_TIME";
+ break;
+#endif
+#ifdef LC_MESSAGES
+ case LC_MESSAGES:
+ retval = "LC_MESSAGES";
+ break;
+#endif
+#ifdef LC_RESPONSE
+ case LC_RESPONSE:
+ retval = "LC_RESPONSE";
+ break;
+#endif
+#ifdef LC_ALL
+ case LC_ALL:
+ /* This might not make sense but is perhaps better than any other
+ value. */
+ retval = "LC_ALL";
+ break;
+#endif
+ default:
+ /* If you have a better idea for a default value let me know. */
+ retval = "LC_XXX";
+ }
+
+ return retval;
+}
+
+/* Guess value of current locale from value of the environment variables. */
+static const char *
+guess_category_value (category, categoryname)
+ int category;
+ const char *categoryname;
+{
+ const char *retval;
+
+ /* The highest priority value is the `LANGUAGE' environment
+ variable. This is a GNU extension. */
+ retval = getenv ("LANGUAGE");
+ if (retval != NULL && retval[0] != '\0')
+ return retval;
+
+ /* `LANGUAGE' is not set. So we have to proceed with the POSIX
+ methods of looking to `LC_ALL', `LC_xxx', and `LANG'. On some
+ systems this can be done by the `setlocale' function itself. */
+#if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
+ return setlocale (category, NULL);
+#else
+ /* Setting of LC_ALL overwrites all other. */
+ retval = getenv ("LC_ALL");
+ if (retval != NULL && retval[0] != '\0')
+ return retval;
+
+ /* Next comes the name of the desired category. */
+ retval = getenv (categoryname);
+ if (retval != NULL && retval[0] != '\0')
+ return retval;
+
+ /* Last possibility is the LANG environment variable. */
+ retval = getenv ("LANG");
+ if (retval != NULL && retval[0] != '\0')
+ return retval;
+
+ /* We use C as the default domain. POSIX says this is implementation
+ defined. */
+ return "C";
+#endif
+}
+
+/* @@ begin of epilog @@ */
+
+/* We don't want libintl.a to depend on any other library. So we
+ avoid the non-standard function stpcpy. In GNU C Library this
+ function is available, though. Also allow the symbol HAVE_STPCPY
+ to be defined. */
+#if !_LIBC && !HAVE_STPCPY
+static char *
+stpcpy (dest, src)
+ char *dest;
+ const char *src;
+{
+ while ((*dest++ = *src++) != '\0')
+ /* Do nothing. */ ;
+ return dest - 1;
+}
+#endif
diff --git a/intl/dgettext.c b/intl/dgettext.c
new file mode 100644
index 0000000..2fde677
--- /dev/null
+++ b/intl/dgettext.c
@@ -0,0 +1,59 @@
+/* dgettext.c -- implementation of the dgettext(3) function
+ Copyright (C) 1995 Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined HAVE_LOCALE_H || defined _LIBC
+# include <locale.h>
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+
+/* @@ end of prolog @@ */
+
+/* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+ code is also used in GNU C Library where the names have a __
+ prefix. So we have to make a difference here. */
+#ifdef _LIBC
+# define DGETTEXT __dgettext
+# define DCGETTEXT __dcgettext
+#else
+# define DGETTEXT dgettext__
+# define DCGETTEXT dcgettext__
+#endif
+
+/* Look up MSGID in the DOMAINNAME message catalog of the current
+ LC_MESSAGES locale. */
+char *
+DGETTEXT (domainname, msgid)
+ const char *domainname;
+ const char *msgid;
+{
+ return DCGETTEXT (domainname, msgid, LC_MESSAGES);
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library. */
+weak_alias (__dgettext, dgettext);
+#endif
diff --git a/intl/explodename.c b/intl/explodename.c
new file mode 100644
index 0000000..37c46e9
--- /dev/null
+++ b/intl/explodename.c
@@ -0,0 +1,181 @@
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "loadinfo.h"
+
+/* On some strange systems still no definition of NULL is found. Sigh! */
+#ifndef NULL
+# if defined __STDC__ && __STDC__
+# define NULL ((void *) 0)
+# else
+# define NULL 0
+# endif
+#endif
+
+/* @@ end of prolog @@ */
+
+int
+_nl_explode_name (name, language, modifier, territory, codeset,
+ normalized_codeset, special, sponsor, revision)
+ char *name;
+ const char **language;
+ const char **modifier;
+ const char **territory;
+ const char **codeset;
+ const char **normalized_codeset;
+ const char **special;
+ const char **sponsor;
+ const char **revision;
+{
+ enum { undecided, xpg, cen } syntax;
+ char *cp;
+ int mask;
+
+ *modifier = NULL;
+ *territory = NULL;
+ *codeset = NULL;
+ *normalized_codeset = NULL;
+ *special = NULL;
+ *sponsor = NULL;
+ *revision = NULL;
+
+ /* Now we determine the single parts of the locale name. First
+ look for the language. Termination symbols are `_' and `@' if
+ we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
+ mask = 0;
+ syntax = undecided;
+ *language = cp = name;
+ while (cp[0] != '\0' && cp[0] != '_' && cp[0] != '@'
+ && cp[0] != '+' && cp[0] != ',')
+ ++cp;
+
+ if (*language == cp)
+ /* This does not make sense: language has to be specified. Use
+ this entry as it is without exploding. Perhaps it is an alias. */
+ cp = strchr (*language, '\0');
+ else if (cp[0] == '_')
+ {
+ /* Next is the territory. */
+ cp[0] = '\0';
+ *territory = ++cp;
+
+ while (cp[0] != '\0' && cp[0] != '.' && cp[0] != '@'
+ && cp[0] != '+' && cp[0] != ',' && cp[0] != '_')
+ ++cp;
+
+ mask |= TERRITORY;
+
+ if (cp[0] == '.')
+ {
+ /* Next is the codeset. */
+ syntax = xpg;
+ cp[0] = '\0';
+ *codeset = ++cp;
+
+ while (cp[0] != '\0' && cp[0] != '@')
+ ++cp;
+
+ mask |= XPG_CODESET;
+
+ if (*codeset != cp && (*codeset)[0] != '\0')
+ {
+ *normalized_codeset = _nl_normalize_codeset (*codeset,
+ cp - *codeset);
+ if (strcmp (*codeset, *normalized_codeset) == 0)
+ free ((char *) *normalized_codeset);
+ else
+ mask |= XPG_NORM_CODESET;
+ }
+ }
+ }
+
+ if (cp[0] == '@' || (syntax != xpg && cp[0] == '+'))
+ {
+ /* Next is the modifier. */
+ syntax = cp[0] == '@' ? xpg : cen;
+ cp[0] = '\0';
+ *modifier = ++cp;
+
+ while (syntax == cen && cp[0] != '\0' && cp[0] != '+'
+ && cp[0] != ',' && cp[0] != '_')
+ ++cp;
+
+ mask |= XPG_MODIFIER | CEN_AUDIENCE;
+ }
+
+ if (syntax != xpg && (cp[0] == '+' || cp[0] == ',' || cp[0] == '_'))
+ {
+ syntax = cen;
+
+ if (cp[0] == '+')
+ {
+ /* Next is special application (CEN syntax). */
+ cp[0] = '\0';
+ *special = ++cp;
+
+ while (cp[0] != '\0' && cp[0] != ',' && cp[0] != '_')
+ ++cp;
+
+ mask |= CEN_SPECIAL;
+ }
+
+ if (cp[0] == ',')
+ {
+ /* Next is sponsor (CEN syntax). */
+ cp[0] = '\0';
+ *sponsor = ++cp;
+
+ while (cp[0] != '\0' && cp[0] != '_')
+ ++cp;
+
+ mask |= CEN_SPONSOR;
+ }
+
+ if (cp[0] == '_')
+ {
+ /* Next is revision (CEN syntax). */
+ cp[0] = '\0';
+ *revision = ++cp;
+
+ mask |= CEN_REVISION;
+ }
+ }
+
+ /* For CEN syntax values it might be important to have the
+ separator character in the file name, not for XPG syntax. */
+ if (syntax == xpg)
+ {
+ if (*territory != NULL && (*territory)[0] == '\0')
+ mask &= ~TERRITORY;
+
+ if (*codeset != NULL && (*codeset)[0] == '\0')
+ mask &= ~XPG_CODESET;
+
+ if (*modifier != NULL && (*modifier)[0] == '\0')
+ mask &= ~XPG_MODIFIER;
+ }
+
+ return mask;
+}
diff --git a/intl/finddomain.c b/intl/finddomain.c
new file mode 100644
index 0000000..ec85d4d
--- /dev/null
+++ b/intl/finddomain.c
@@ -0,0 +1,189 @@
+/* Handle list of needed message catalogs
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#else
+# ifdef HAVE_MALLOC_H
+# include <malloc.h>
+# else
+void free ();
+# endif
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+#if !HAVE_STRCHR && !defined _LIBC
+# ifndef strchr
+# define strchr index
+# endif
+#endif
+
+#if defined HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+#endif
+
+#include "gettext.h"
+#include "gettextP.h"
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+
+/* @@ end of prolog @@ */
+/* List of already loaded domains. */
+static struct loaded_l10nfile *_nl_loaded_domains;
+
+
+/* Return a data structure describing the message catalog described by
+ the DOMAINNAME and CATEGORY parameters with respect to the currently
+ established bindings. */
+struct loaded_l10nfile *
+_nl_find_domain (dirname, locale, domainname)
+ const char *dirname;
+ char *locale;
+ const char *domainname;
+{
+ struct loaded_l10nfile *retval;
+ const char *language;
+ const char *modifier;
+ const char *territory;
+ const char *codeset;
+ const char *normalized_codeset;
+ const char *special;
+ const char *sponsor;
+ const char *revision;
+ const char *alias_value;
+ int mask;
+
+ /* LOCALE can consist of up to four recognized parts for the XPG syntax:
+
+ language[_territory[.codeset]][@modifier]
+
+ and six parts for the CEN syntax:
+
+ language[_territory][+audience][+special][,[sponsor][_revision]]
+
+ Beside the first all of them are allowed to be missing. If the
+ full specified locale is not found, the less specific one are
+ looked for. The various part will be stripped of according to
+ the following order:
+ (1) revision
+ (2) sponsor
+ (3) special
+ (4) codeset
+ (5) normalized codeset
+ (6) territory
+ (7) audience/modifier
+ */
+
+ /* If we have already tested for this locale entry there has to
+ be one data set in the list of loaded domains. */
+ retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
+ strlen (dirname) + 1, 0, locale, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, domainname, 0);
+ if (retval != NULL)
+ {
+ /* We know something about this locale. */
+ int cnt;
+
+ if (retval->decided == 0)
+ _nl_load_domain (retval);
+
+ if (retval->data != NULL)
+ return retval;
+
+ for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
+ {
+ if (retval->successor[cnt]->decided == 0)
+ _nl_load_domain (retval->successor[cnt]);
+
+ if (retval->successor[cnt]->data != NULL)
+ break;
+ }
+ return cnt >= 0 ? retval : NULL;
+ /* NOTREACHED */
+ }
+
+ /* See whether the locale value is an alias. If yes its value
+ *overwrites* the alias name. No test for the original value is
+ done. */
+ alias_value = _nl_expand_alias (locale);
+ if (alias_value != NULL)
+ {
+ size_t len = strlen (alias_value) + 1;
+ locale = (char *) malloc (len);
+ if (locale == NULL)
+ return NULL;
+
+ memcpy (locale, alias_value, len);
+ }
+
+ /* Now we determine the single parts of the locale name. First
+ look for the language. Termination symbols are `_' and `@' if
+ we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */
+ mask = _nl_explode_name (locale, &language, &modifier, &territory,
+ &codeset, &normalized_codeset, &special,
+ &sponsor, &revision);
+
+ /* Create all possible locale entries which might be interested in
+ generalization. */
+ retval = _nl_make_l10nflist (&_nl_loaded_domains, dirname,
+ strlen (dirname) + 1, mask, language, territory,
+ codeset, normalized_codeset, modifier, special,
+ sponsor, revision, domainname, 1);
+ if (retval == NULL)
+ /* This means we are out of core. */
+ return NULL;
+
+ if (retval->decided == 0)
+ _nl_load_domain (retval);
+ if (retval->data == NULL)
+ {
+ int cnt;
+ for (cnt = 0; retval->successor[cnt] != NULL; ++cnt)
+ {
+ if (retval->successor[cnt]->decided == 0)
+ _nl_load_domain (retval->successor[cnt]);
+ if (retval->successor[cnt]->data != NULL)
+ break;
+ }
+ }
+
+ /* The room for an alias was dynamically allocated. Free it now. */
+ if (alias_value != NULL)
+ free (locale);
+
+ return retval;
+}
diff --git a/intl/gettext.c b/intl/gettext.c
new file mode 100644
index 0000000..1336d21
--- /dev/null
+++ b/intl/gettext.c
@@ -0,0 +1,70 @@
+/* Implementation of gettext(3) function
+ Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define __need_NULL
+# include <stddef.h>
+#else
+# ifdef STDC_HEADERS
+# include <stdlib.h> /* Just for NULL. */
+# else
+# ifdef HAVE_STRING_H
+# include <string.h>
+# else
+# define NULL ((void *) 0)
+# endif
+# endif
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+
+/* @@ end of prolog @@ */
+
+/* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+ code is also used in GNU C Library where the names have a __
+ prefix. So we have to make a difference here. */
+#ifdef _LIBC
+# define GETTEXT __gettext
+# define DGETTEXT __dgettext
+#else
+# define GETTEXT gettext__
+# define DGETTEXT dgettext__
+#endif
+
+/* Look up MSGID in the current default message catalog for the current
+ LC_MESSAGES locale. If not found, returns MSGID itself (the default
+ text). */
+char *
+GETTEXT (msgid)
+ const char *msgid;
+{
+ return DGETTEXT (NULL, msgid);
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library. */
+weak_alias (__gettext, gettext);
+#endif
diff --git a/intl/gettext.h b/intl/gettext.h
new file mode 100644
index 0000000..6b4b9e3
--- /dev/null
+++ b/intl/gettext.h
@@ -0,0 +1,105 @@
+/* Internal header for GNU gettext internationalization functions
+ Copyright (C) 1995, 1997 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 Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _GETTEXT_H
+#define _GETTEXT_H 1
+
+#include <stdio.h>
+
+#if HAVE_LIMITS_H || _LIBC
+# include <limits.h>
+#endif
+
+/* @@ end of prolog @@ */
+
+/* The magic number of the GNU message catalog format. */
+#define _MAGIC 0x950412de
+#define _MAGIC_SWAPPED 0xde120495
+
+/* Revision number of the currently used .mo (binary) file format. */
+#define MO_REVISION_NUMBER 0
+
+/* The following contortions are an attempt to use the C preprocessor
+ to determine an unsigned integral type that is 32 bits wide. An
+ alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
+ doing that would require that the configure script compile and *run*
+ the resulting executable. Locally running cross-compiled executables
+ is usually not possible. */
+
+#if __STDC__
+# define UINT_MAX_32_BITS 4294967295U
+#else
+# define UINT_MAX_32_BITS 0xFFFFFFFF
+#endif
+
+/* If UINT_MAX isn't defined, assume it's a 32-bit type.
+ This should be valid for all systems GNU cares about because
+ that doesn't include 16-bit systems, and only modern systems
+ (that certainly have <limits.h>) have 64+-bit integral types. */
+
+#ifndef UINT_MAX
+# define UINT_MAX UINT_MAX_32_BITS
+#endif
+
+#if UINT_MAX == UINT_MAX_32_BITS
+typedef unsigned nls_uint32;
+#else
+# if USHRT_MAX == UINT_MAX_32_BITS
+typedef unsigned short nls_uint32;
+# else
+# if ULONG_MAX == UINT_MAX_32_BITS
+typedef unsigned long nls_uint32;
+# else
+ /* The following line is intended to throw an error. Using #error is
+ not portable enough. */
+ "Cannot determine unsigned 32-bit data type."
+# endif
+# endif
+#endif
+
+
+/* Header for binary .mo file format. */
+struct mo_file_header
+{
+ /* The magic number. */
+ nls_uint32 magic;
+ /* The revision number of the file format. */
+ nls_uint32 revision;
+ /* The number of strings pairs. */
+ nls_uint32 nstrings;
+ /* Offset of table with start offsets of original strings. */
+ nls_uint32 orig_tab_offset;
+ /* Offset of table with start offsets of translation strings. */
+ nls_uint32 trans_tab_offset;
+ /* Size of hashing table. */
+ nls_uint32 hash_tab_size;
+ /* Offset of first hashing entry. */
+ nls_uint32 hash_tab_offset;
+};
+
+struct string_desc
+{
+ /* Length of addressed string. */
+ nls_uint32 length;
+ /* Offset of string in file. */
+ nls_uint32 offset;
+};
+
+/* @@ begin of epilog @@ */
+
+#endif /* gettext.h */
diff --git a/intl/gettextP.h b/intl/gettextP.h
new file mode 100644
index 0000000..bb8d552
--- /dev/null
+++ b/intl/gettextP.h
@@ -0,0 +1,73 @@
+/* Header describing internals of gettext library
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _GETTEXTP_H
+#define _GETTEXTP_H
+
+#include "loadinfo.h"
+
+/* @@ end of prolog @@ */
+
+#ifndef PARAMS
+# if __STDC__
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+#ifndef W
+# define W(flag, data) ((flag) ? SWAP (data) : (data))
+#endif
+
+
+static nls_uint32 SWAP PARAMS ((nls_uint32 i));
+
+static inline nls_uint32
+SWAP (i)
+ nls_uint32 i;
+{
+ return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
+}
+
+
+struct loaded_domain
+{
+ const char *data;
+ int must_swap;
+ nls_uint32 nstrings;
+ struct string_desc *orig_tab;
+ struct string_desc *trans_tab;
+ nls_uint32 hash_size;
+ nls_uint32 *hash_tab;
+};
+
+struct binding
+{
+ struct binding *next;
+ char *domainname;
+ char *dirname;
+};
+
+struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
+ char *__locale,
+ const char *__domainname));
+void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain));
+
+/* @@ begin of epilog @@ */
+
+#endif /* gettextP.h */
diff --git a/intl/hash-string.h b/intl/hash-string.h
new file mode 100644
index 0000000..e66e841
--- /dev/null
+++ b/intl/hash-string.h
@@ -0,0 +1,63 @@
+/* Implements a string hashing function.
+ Copyright (C) 1995, 1997 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 Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_VALUES_H
+# include <values.h>
+#endif
+
+/* @@ end of prolog @@ */
+
+#ifndef PARAMS
+# if __STDC__
+# define PARAMS(Args) Args
+# else
+# define PARAMS(Args) ()
+# endif
+#endif
+
+/* We assume to have `unsigned long int' value with at least 32 bits. */
+#define HASHWORDBITS 32
+
+
+/* Defines the so called `hashpjw' function by P.J. Weinberger
+ [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
+ 1986, 1987 Bell Telephone Laboratories, Inc.] */
+static unsigned long hash_string PARAMS ((const char *__str_param));
+
+static inline unsigned long
+hash_string (str_param)
+ const char *str_param;
+{
+ unsigned long int hval, g;
+ const char *str = str_param;
+
+ /* Compute the hash value for the given string. */
+ hval = 0;
+ while (*str != '\0')
+ {
+ hval <<= 4;
+ hval += (unsigned long) *str++;
+ g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4));
+ if (g != 0)
+ {
+ hval ^= g >> (HASHWORDBITS - 8);
+ hval ^= g;
+ }
+ }
+ return hval;
+}
diff --git a/intl/intl-compat.c b/intl/intl-compat.c
new file mode 100644
index 0000000..503efa0
--- /dev/null
+++ b/intl/intl-compat.c
@@ -0,0 +1,76 @@
+/* intl-compat.c - Stub functions to call gettext functions from GNU gettext
+ Library.
+ Copyright (C) 1995 Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libgettext.h"
+
+/* @@ end of prolog @@ */
+
+
+#undef gettext
+#undef dgettext
+#undef dcgettext
+#undef textdomain
+#undef bindtextdomain
+
+
+char *
+bindtextdomain (domainname, dirname)
+ const char *domainname;
+ const char *dirname;
+{
+ return bindtextdomain__ (domainname, dirname);
+}
+
+
+char *
+dcgettext (domainname, msgid, category)
+ const char *domainname;
+ const char *msgid;
+ int category;
+{
+ return dcgettext__ (domainname, msgid, category);
+}
+
+
+char *
+dgettext (domainname, msgid)
+ const char *domainname;
+ const char *msgid;
+{
+ return dgettext__ (domainname, msgid);
+}
+
+
+char *
+gettext (msgid)
+ const char *msgid;
+{
+ return gettext__ (msgid);
+}
+
+
+char *
+textdomain (domainname)
+ const char *domainname;
+{
+ return textdomain__ (domainname);
+}
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
new file mode 100644
index 0000000..4e2bc13
--- /dev/null
+++ b/intl/l10nflist.c
@@ -0,0 +1,409 @@
+/* Handle list of needed message catalogs
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+#if defined HAVE_STRING_H || defined _LIBC
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+# endif
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+#if !HAVE_STRCHR && !defined _LIBC
+# ifndef strchr
+# define strchr index
+# endif
+#endif
+
+#if defined _LIBC || defined HAVE_ARGZ_H
+# include <argz.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#endif
+
+#include "loadinfo.h"
+
+/* On some strange systems still no definition of NULL is found. Sigh! */
+#ifndef NULL
+# if defined __STDC__ && __STDC__
+# define NULL ((void *) 0)
+# else
+# define NULL 0
+# endif
+#endif
+
+/* @@ end of prolog @@ */
+
+#ifdef _LIBC
+/* Rename the non ANSI C functions. This is required by the standard
+ because some ANSI C functions will require linking with this object
+ file and the name space must not be polluted. */
+# define stpcpy(dest, src) __stpcpy(dest, src)
+#else
+# ifndef HAVE_STPCPY
+static char *stpcpy PARAMS ((char *dest, const char *src));
+# endif
+#endif
+
+/* Define function which are usually not available. */
+
+#if !defined _LIBC && !defined HAVE___ARGZ_COUNT
+/* Returns the number of strings in ARGZ. */
+static size_t argz_count__ PARAMS ((const char *argz, size_t len));
+
+static size_t
+argz_count__ (argz, len)
+ const char *argz;
+ size_t len;
+{
+ size_t count = 0;
+ while (len > 0)
+ {
+ size_t part_len = strlen (argz);
+ argz += part_len + 1;
+ len -= part_len + 1;
+ count++;
+ }
+ return count;
+}
+# undef __argz_count
+# define __argz_count(argz, len) argz_count__ (argz, len)
+#endif /* !_LIBC && !HAVE___ARGZ_COUNT */
+
+#if !defined _LIBC && !defined HAVE___ARGZ_STRINGIFY
+/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
+ except the last into the character SEP. */
+static void argz_stringify__ PARAMS ((char *argz, size_t len, int sep));
+
+static void
+argz_stringify__ (argz, len, sep)
+ char *argz;
+ size_t len;
+ int sep;
+{
+ while (len > 0)
+ {
+ size_t part_len = strlen (argz);
+ argz += part_len;
+ len -= part_len + 1;
+ if (len > 0)
+ *argz++ = sep;
+ }
+}
+# undef __argz_stringify
+# define __argz_stringify(argz, len, sep) argz_stringify__ (argz, len, sep)
+#endif /* !_LIBC && !HAVE___ARGZ_STRINGIFY */
+
+#if !defined _LIBC && !defined HAVE___ARGZ_NEXT
+static char *argz_next__ PARAMS ((char *argz, size_t argz_len,
+ const char *entry));
+
+static char *
+argz_next__ (argz, argz_len, entry)
+ char *argz;
+ size_t argz_len;
+ const char *entry;
+{
+ if (entry)
+ {
+ if (entry < argz + argz_len)
+ entry = strchr (entry, '\0') + 1;
+
+ return entry >= argz + argz_len ? NULL : (char *) entry;
+ }
+ else
+ if (argz_len > 0)
+ return argz;
+ else
+ return 0;
+}
+# undef __argz_next
+# define __argz_next(argz, len, entry) argz_next__ (argz, len, entry)
+#endif /* !_LIBC && !HAVE___ARGZ_NEXT */
+
+
+/* Return number of bits set in X. */
+static int pop PARAMS ((int x));
+
+static inline int
+pop (x)
+ int x;
+{
+ /* We assume that no more than 16 bits are used. */
+ x = ((x & ~0x5555) >> 1) + (x & 0x5555);
+ x = ((x & ~0x3333) >> 2) + (x & 0x3333);
+ x = ((x >> 4) + x) & 0x0f0f;
+ x = ((x >> 8) + x) & 0xff;
+
+ return x;
+}
+
+
+struct loaded_l10nfile *
+_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
+ territory, codeset, normalized_codeset, modifier, special,
+ sponsor, revision, filename, do_allocate)
+ struct loaded_l10nfile **l10nfile_list;
+ const char *dirlist;
+ size_t dirlist_len;
+ int mask;
+ const char *language;
+ const char *territory;
+ const char *codeset;
+ const char *normalized_codeset;
+ const char *modifier;
+ const char *special;
+ const char *sponsor;
+ const char *revision;
+ const char *filename;
+ int do_allocate;
+{
+ char *abs_filename;
+ struct loaded_l10nfile *last = NULL;
+ struct loaded_l10nfile *retval;
+ char *cp;
+ size_t entries;
+ int cnt;
+
+ /* Allocate room for the full file name. */
+ abs_filename = (char *) malloc (dirlist_len
+ + strlen (language)
+ + ((mask & TERRITORY) != 0
+ ? strlen (territory) + 1 : 0)
+ + ((mask & XPG_CODESET) != 0
+ ? strlen (codeset) + 1 : 0)
+ + ((mask & XPG_NORM_CODESET) != 0
+ ? strlen (normalized_codeset) + 1 : 0)
+ + (((mask & XPG_MODIFIER) != 0
+ || (mask & CEN_AUDIENCE) != 0)
+ ? strlen (modifier) + 1 : 0)
+ + ((mask & CEN_SPECIAL) != 0
+ ? strlen (special) + 1 : 0)
+ + (((mask & CEN_SPONSOR) != 0
+ || (mask & CEN_REVISION) != 0)
+ ? (1 + ((mask & CEN_SPONSOR) != 0
+ ? strlen (sponsor) + 1 : 0)
+ + ((mask & CEN_REVISION) != 0
+ ? strlen (revision) + 1 : 0)) : 0)
+ + 1 + strlen (filename) + 1);
+
+ if (abs_filename == NULL)
+ return NULL;
+
+ retval = NULL;
+ last = NULL;
+
+ /* Construct file name. */
+ memcpy (abs_filename, dirlist, dirlist_len);
+ __argz_stringify (abs_filename, dirlist_len, ':');
+ cp = abs_filename + (dirlist_len - 1);
+ *cp++ = '/';
+ cp = stpcpy (cp, language);
+
+ if ((mask & TERRITORY) != 0)
+ {
+ *cp++ = '_';
+ cp = stpcpy (cp, territory);
+ }
+ if ((mask & XPG_CODESET) != 0)
+ {
+ *cp++ = '.';
+ cp = stpcpy (cp, codeset);
+ }
+ if ((mask & XPG_NORM_CODESET) != 0)
+ {
+ *cp++ = '.';
+ cp = stpcpy (cp, normalized_codeset);
+ }
+ if ((mask & (XPG_MODIFIER | CEN_AUDIENCE)) != 0)
+ {
+ /* This component can be part of both syntaces but has different
+ leading characters. For CEN we use `+', else `@'. */
+ *cp++ = (mask & CEN_AUDIENCE) != 0 ? '+' : '@';
+ cp = stpcpy (cp, modifier);
+ }
+ if ((mask & CEN_SPECIAL) != 0)
+ {
+ *cp++ = '+';
+ cp = stpcpy (cp, special);
+ }
+ if ((mask & (CEN_SPONSOR | CEN_REVISION)) != 0)
+ {
+ *cp++ = ',';
+ if ((mask & CEN_SPONSOR) != 0)
+ cp = stpcpy (cp, sponsor);
+ if ((mask & CEN_REVISION) != 0)
+ {
+ *cp++ = '_';
+ cp = stpcpy (cp, revision);
+ }
+ }
+
+ *cp++ = '/';
+ stpcpy (cp, filename);
+
+ /* Look in list of already loaded domains whether it is already
+ available. */
+ last = NULL;
+ for (retval = *l10nfile_list; retval != NULL; retval = retval->next)
+ if (retval->filename != NULL)
+ {
+ int compare = strcmp (retval->filename, abs_filename);
+ if (compare == 0)
+ /* We found it! */
+ break;
+ if (compare < 0)
+ {
+ /* It's not in the list. */
+ retval = NULL;
+ break;
+ }
+
+ last = retval;
+ }
+
+ if (retval != NULL || do_allocate == 0)
+ {
+ free (abs_filename);
+ return retval;
+ }
+
+ retval = (struct loaded_l10nfile *)
+ malloc (sizeof (*retval) + (__argz_count (dirlist, dirlist_len)
+ * (1 << pop (mask))
+ * sizeof (struct loaded_l10nfile *)));
+ if (retval == NULL)
+ return NULL;
+
+ retval->filename = abs_filename;
+ retval->decided = (__argz_count (dirlist, dirlist_len) != 1
+ || ((mask & XPG_CODESET) != 0
+ && (mask & XPG_NORM_CODESET) != 0));
+ retval->data = NULL;
+
+ if (last == NULL)
+ {
+ retval->next = *l10nfile_list;
+ *l10nfile_list = retval;
+ }
+ else
+ {
+ retval->next = last->next;
+ last->next = retval;
+ }
+
+ entries = 0;
+ /* If the DIRLIST is a real list the RETVAL entry corresponds not to
+ a real file. So we have to use the DIRLIST separation mechanism
+ of the inner loop. */
+ cnt = __argz_count (dirlist, dirlist_len) == 1 ? mask - 1 : mask;
+ for (; cnt >= 0; --cnt)
+ if ((cnt & ~mask) == 0
+ && ((cnt & CEN_SPECIFIC) == 0 || (cnt & XPG_SPECIFIC) == 0)
+ && ((cnt & XPG_CODESET) == 0 || (cnt & XPG_NORM_CODESET) == 0))
+ {
+ /* Iterate over all elements of the DIRLIST. */
+ char *dir = NULL;
+
+ while ((dir = __argz_next ((char *) dirlist, dirlist_len, dir))
+ != NULL)
+ retval->successor[entries++]
+ = _nl_make_l10nflist (l10nfile_list, dir, strlen (dir) + 1, cnt,
+ language, territory, codeset,
+ normalized_codeset, modifier, special,
+ sponsor, revision, filename, 1);
+ }
+ retval->successor[entries] = NULL;
+
+ return retval;
+}
+
+/* Normalize codeset name. There is no standard for the codeset
+ names. Normalization allows the user to use any of the common
+ names. */
+const char *
+_nl_normalize_codeset (codeset, name_len)
+ const char *codeset;
+ size_t name_len;
+{
+ int len = 0;
+ int only_digit = 1;
+ char *retval;
+ char *wp;
+ size_t cnt;
+
+ for (cnt = 0; cnt < name_len; ++cnt)
+ if (isalnum (codeset[cnt]))
+ {
+ ++len;
+
+ if (isalpha (codeset[cnt]))
+ only_digit = 0;
+ }
+
+ retval = (char *) malloc ((only_digit ? 3 : 0) + len + 1);
+
+ if (retval != NULL)
+ {
+ if (only_digit)
+ wp = stpcpy (retval, "iso");
+ else
+ wp = retval;
+
+ for (cnt = 0; cnt < name_len; ++cnt)
+ if (isalpha (codeset[cnt]))
+ *wp++ = tolower (codeset[cnt]);
+ else if (isdigit (codeset[cnt]))
+ *wp++ = codeset[cnt];
+
+ *wp = '\0';
+ }
+
+ return (const char *) retval;
+}
+
+
+/* @@ begin of epilog @@ */
+
+/* We don't want libintl.a to depend on any other library. So we
+ avoid the non-standard function stpcpy. In GNU C Library this
+ function is available, though. Also allow the symbol HAVE_STPCPY
+ to be defined. */
+#if !_LIBC && !HAVE_STPCPY
+static char *
+stpcpy (dest, src)
+ char *dest;
+ const char *src;
+{
+ while ((*dest++ = *src++) != '\0')
+ /* Do nothing. */ ;
+ return dest - 1;
+}
+#endif
diff --git a/intl/libgettext.h b/intl/libgettext.h
new file mode 100644
index 0000000..0d4de4d
--- /dev/null
+++ b/intl/libgettext.h
@@ -0,0 +1,182 @@
+/* Message catalogs for internationalization.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Because on some systems (e.g. Solaris) we sometimes have to include
+ the systems libintl.h as well as this file we have more complex
+ include protection above. But the systems header might perhaps also
+ define _LIBINTL_H and therefore we have to protect the definition here. */
+
+#if !defined (_LIBINTL_H) || !defined (_LIBGETTEXT_H)
+#if !defined (_LIBINTL_H)
+# define _LIBINTL_H 1
+#endif
+#define _LIBGETTEXT_H 1
+
+/* We define an additional symbol to signal that we use the GNU
+ implementation of gettext. */
+#define __USE_GNU_GETTEXT 1
+
+#include <sys/types.h>
+
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* @@ end of prolog @@ */
+
+#ifndef PARAMS
+# if __STDC__
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+#ifndef NULL
+# if !defined __cplusplus || defined __GNUC__
+# define NULL ((void *) 0)
+# else
+# define NULL (0)
+# endif
+#endif
+
+#if !HAVE_LC_MESSAGES
+/* This value determines the behaviour of the gettext() and dgettext()
+ function. But some system does not have this defined. Define it
+ to a default value. */
+# define LC_MESSAGES (-1)
+#endif
+
+
+/* Declarations for gettext-using-catgets interface. Derived from
+ Jim Meyering's libintl.h. */
+struct _msg_ent
+{
+ const char *_msg;
+ int _msg_number;
+};
+
+
+#if HAVE_CATGETS
+/* These two variables are defined in the automatically by po-to-tbl.sed
+ generated file `cat-id-tbl.c'. */
+extern const struct _msg_ent _msg_tbl[];
+extern int _msg_tbl_length;
+#endif
+
+
+/* For automatical extraction of messages sometimes no real
+ translation is needed. Instead the string itself is the result. */
+#define gettext_noop(Str) (Str)
+
+/* Look up MSGID in the current default message catalog for the current
+ LC_MESSAGES locale. If not found, returns MSGID itself (the default
+ text). */
+extern char *gettext PARAMS ((const char *__msgid));
+extern char *gettext__ PARAMS ((const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current
+ LC_MESSAGES locale. */
+extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
+extern char *dgettext__ PARAMS ((const char *__domainname,
+ const char *__msgid));
+
+/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
+ locale. */
+extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
+ int __category));
+extern char *dcgettext__ PARAMS ((const char *__domainname,
+ const char *__msgid, int __category));
+
+
+/* Set the current default message catalog to DOMAINNAME.
+ If DOMAINNAME is null, return the current default.
+ If DOMAINNAME is "", reset to the default of "messages". */
+extern char *textdomain PARAMS ((const char *__domainname));
+extern char *textdomain__ PARAMS ((const char *__domainname));
+
+/* Specify that the DOMAINNAME message catalog will be found
+ in DIRNAME rather than in the system locale data base. */
+extern char *bindtextdomain PARAMS ((const char *__domainname,
+ const char *__dirname));
+extern char *bindtextdomain__ PARAMS ((const char *__domainname,
+ const char *__dirname));
+
+#if ENABLE_NLS
+
+/* Solaris 2.3 has the gettext function but dcgettext is missing.
+ So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
+ has dcgettext. */
+# if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
+
+# define gettext(Msgid) \
+ dgettext (NULL, Msgid)
+
+# define dgettext(Domainname, Msgid) \
+ dcgettext (Domainname, Msgid, LC_MESSAGES)
+
+# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
+/* This global variable is defined in loadmsgcat.c. We need a sign,
+ whether a new catalog was loaded, which can be associated with all
+ translations. */
+extern int _nl_msg_cat_cntr;
+
+# define dcgettext(Domainname, Msgid, Category) \
+ (__extension__ \
+ ({ \
+ char *__result; \
+ if (__builtin_constant_p (Msgid)) \
+ { \
+ static char *__translation__; \
+ static int __catalog_counter__; \
+ if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
+ { \
+ __translation__ = \
+ dcgettext__ (Domainname, Msgid, Category); \
+ __catalog_counter__ = _nl_msg_cat_cntr; \
+ } \
+ __result = __translation__; \
+ } \
+ else \
+ __result = dcgettext__ (Domainname, Msgid, Category); \
+ __result; \
+ }))
+# endif
+# endif
+
+#else
+
+# define gettext(Msgid) (Msgid)
+# define dgettext(Domainname, Msgid) (Msgid)
+# define dcgettext(Domainname, Msgid, Category) (Msgid)
+# define textdomain(Domainname) while (0) /* nothing */
+# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
+
+#endif
+
+/* @@ begin of epilog @@ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/intl/linux-msg.sed b/intl/linux-msg.sed
new file mode 100644
index 0000000..5918e72
--- /dev/null
+++ b/intl/linux-msg.sed
@@ -0,0 +1,100 @@
+# po2msg.sed - Convert Uniforum style .po file to Linux style .msg file
+# Copyright (C) 1995 Free Software Foundation, Inc.
+# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#
+# The first directive in the .msg should be the definition of the
+# message set number. We use always set number 1.
+#
+1 {
+ i\
+$set 1 # Automatically created by po2msg.sed
+ h
+ s/.*/0/
+ x
+}
+#
+# Mitch's old catalog format does not allow comments.
+#
+# We copy the original message as a comment into the .msg file.
+#
+/^msgid/ {
+ s/msgid[ ]*"//
+#
+# This does not work now with the new format.
+# /"$/! {
+# s/\\$//
+# s/$/ ... (more lines following)"/
+# }
+ x
+# The following nice solution is by
+# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+ td
+# Increment a decimal number in pattern space.
+# First hide trailing `9' digits.
+ :d
+ s/9\(_*\)$/_\1/
+ td
+# Assure at least one digit is available.
+ s/^\(_*\)$/0\1/
+# Increment the last digit.
+ s/8\(_*\)$/9\1/
+ s/7\(_*\)$/8\1/
+ s/6\(_*\)$/7\1/
+ s/5\(_*\)$/6\1/
+ s/4\(_*\)$/5\1/
+ s/3\(_*\)$/4\1/
+ s/2\(_*\)$/3\1/
+ s/1\(_*\)$/2\1/
+ s/0\(_*\)$/1\1/
+# Convert the hidden `9' digits to `0's.
+ s/_/0/g
+ x
+ G
+ s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p
+}
+#
+# The .msg file contains, other then the .po file, only the translations
+# but each given a unique ID. Starting from 1 and incrementing by 1 for
+# each message we assign them to the messages.
+# It is important that the .po file used to generate the cat-id-tbl.c file
+# (with po-to-tbl) is the same as the one used here. (At least the order
+# of declarations must not be changed.)
+#
+/^msgstr/ {
+ s/msgstr[ ]*"\(.*\)"/# \1/
+# Clear substitution flag.
+ tb
+# Append the next line.
+ :b
+ N
+# Look whether second part is continuation line.
+ s/\(.*\n\)"\(.*\)"/\1\2/
+# Yes, then branch.
+ ta
+ P
+ D
+# Note that D includes a jump to the start!!
+# We found a continuation line. But before printing insert '\'.
+ :a
+ s/\(.*\)\(\n.*\)/\1\\\2/
+ P
+# We cannot use D here.
+ s/.*\n\(.*\)/\1/
+ tb
+}
+d
diff --git a/intl/loadinfo.h b/intl/loadinfo.h
new file mode 100644
index 0000000..c67c2eb
--- /dev/null
+++ b/intl/loadinfo.h
@@ -0,0 +1,58 @@
+#ifndef PARAMS
+# if __STDC__
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+/* Encoding of locale name parts. */
+#define CEN_REVISION 1
+#define CEN_SPONSOR 2
+#define CEN_SPECIAL 4
+#define XPG_NORM_CODESET 8
+#define XPG_CODESET 16
+#define TERRITORY 32
+#define CEN_AUDIENCE 64
+#define XPG_MODIFIER 128
+
+#define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
+#define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
+
+
+struct loaded_l10nfile
+{
+ const char *filename;
+ int decided;
+
+ const void *data;
+
+ struct loaded_l10nfile *next;
+ struct loaded_l10nfile *successor[1];
+};
+
+
+extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
+ size_t name_len));
+
+extern struct loaded_l10nfile *
+_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
+ const char *dirlist, size_t dirlist_len, int mask,
+ const char *language, const char *territory,
+ const char *codeset,
+ const char *normalized_codeset,
+ const char *modifier, const char *special,
+ const char *sponsor, const char *revision,
+ const char *filename, int do_allocate));
+
+
+extern const char *_nl_expand_alias PARAMS ((const char *name));
+
+extern int _nl_explode_name PARAMS ((char *name, const char **language,
+ const char **modifier,
+ const char **territory,
+ const char **codeset,
+ const char **normalized_codeset,
+ const char **special,
+ const char **sponsor,
+ const char **revision));
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
new file mode 100644
index 0000000..73e90a9
--- /dev/null
+++ b/intl/loadmsgcat.c
@@ -0,0 +1,199 @@
+/* Load needed message catalogs
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#endif
+
+#if defined HAVE_UNISTD_H || defined _LIBC
+# include <unistd.h>
+#endif
+
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC
+# include <sys/mman.h>
+#endif
+
+#include "gettext.h"
+#include "gettextP.h"
+
+/* @@ end of prolog @@ */
+
+#ifdef _LIBC
+/* Rename the non ISO C functions. This is required by the standard
+ because some ISO C functions will require linking with this object
+ file and the name space must not be polluted. */
+# define fstat __fstat
+# define open __open
+# define close __close
+# define read __read
+# define mmap __mmap
+# define munmap __munmap
+#endif
+
+/* We need a sign, whether a new catalog was loaded, which can be associated
+ with all translations. This is important if the translations are
+ cached by one of GCC's features. */
+int _nl_msg_cat_cntr = 0;
+
+
+/* Load the message catalogs specified by FILENAME. If it is no valid
+ message catalog do nothing. */
+void
+_nl_load_domain (domain_file)
+ struct loaded_l10nfile *domain_file;
+{
+ int fd;
+ struct stat st;
+ struct mo_file_header *data = (struct mo_file_header *) -1;
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+ || defined _LIBC
+ int use_mmap = 0;
+#endif
+ struct loaded_domain *domain;
+
+ domain_file->decided = 1;
+ domain_file->data = NULL;
+
+ /* If the record does not represent a valid locale the FILENAME
+ might be NULL. This can happen when according to the given
+ specification the locale file name is different for XPG and CEN
+ syntax. */
+ if (domain_file->filename == NULL)
+ return;
+
+ /* Try to open the addressed file. */
+ fd = open (domain_file->filename, O_RDONLY);
+ if (fd == -1)
+ return;
+
+ /* We must know about the size of the file. */
+ if (fstat (fd, &st) != 0
+ && st.st_size < (off_t) sizeof (struct mo_file_header))
+ {
+ /* Something went wrong. */
+ close (fd);
+ return;
+ }
+
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+ || defined _LIBC
+ /* Now we are ready to load the file. If mmap() is available we try
+ this first. If not available or it failed we try to load it. */
+ data = (struct mo_file_header *) mmap (NULL, st.st_size, PROT_READ,
+ MAP_PRIVATE, fd, 0);
+
+ if (data != (struct mo_file_header *) -1)
+ {
+ /* mmap() call was successful. */
+ close (fd);
+ use_mmap = 1;
+ }
+#endif
+
+ /* If the data is not yet available (i.e. mmap'ed) we try to load
+ it manually. */
+ if (data == (struct mo_file_header *) -1)
+ {
+ off_t to_read;
+ char *read_ptr;
+
+ data = (struct mo_file_header *) malloc (st.st_size);
+ if (data == NULL)
+ return;
+
+ to_read = st.st_size;
+ read_ptr = (char *) data;
+ do
+ {
+ long int nb = (long int) read (fd, read_ptr, to_read);
+ if (nb == -1)
+ {
+ close (fd);
+ return;
+ }
+
+ read_ptr += nb;
+ to_read -= nb;
+ }
+ while (to_read > 0);
+
+ close (fd);
+ }
+
+ /* Using the magic number we can test whether it really is a message
+ catalog file. */
+ if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED)
+ {
+ /* The magic number is wrong: not a message catalog file. */
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+ || defined _LIBC
+ if (use_mmap)
+ munmap ((caddr_t) data, st.st_size);
+ else
+#endif
+ free (data);
+ return;
+ }
+
+ domain_file->data
+ = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
+ if (domain_file->data == NULL)
+ return;
+
+ domain = (struct loaded_domain *) domain_file->data;
+ domain->data = (char *) data;
+ domain->must_swap = data->magic != _MAGIC;
+
+ /* Fill in the information about the available tables. */
+ switch (W (domain->must_swap, data->revision))
+ {
+ case 0:
+ domain->nstrings = W (domain->must_swap, data->nstrings);
+ domain->orig_tab = (struct string_desc *)
+ ((char *) data + W (domain->must_swap, data->orig_tab_offset));
+ domain->trans_tab = (struct string_desc *)
+ ((char *) data + W (domain->must_swap, data->trans_tab_offset));
+ domain->hash_size = W (domain->must_swap, data->hash_tab_size);
+ domain->hash_tab = (nls_uint32 *)
+ ((char *) data + W (domain->must_swap, data->hash_tab_offset));
+ break;
+ default:
+ /* This is an illegal revision. */
+#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
+ || defined _LIBC
+ if (use_mmap)
+ munmap ((caddr_t) data, st.st_size);
+ else
+#endif
+ free (data);
+ free (domain);
+ domain_file->data = NULL;
+ return;
+ }
+
+ /* Show that one domain is changed. This might make some cached
+ translations invalid. */
+ ++_nl_msg_cat_cntr;
+}
diff --git a/intl/localealias.c b/intl/localealias.c
new file mode 100644
index 0000000..00d9194
--- /dev/null
+++ b/intl/localealias.c
@@ -0,0 +1,378 @@
+/* Handle aliases for locale names
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+# define HAVE_ALLOCA 1
+#else
+# if defined HAVE_ALLOCA_H || defined _LIBC
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca
+char *alloca ();
+# endif
+# endif
+# endif
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#else
+char *getenv ();
+# ifdef HAVE_MALLOC_H
+# include <malloc.h>
+# else
+void free ();
+# endif
+#endif
+
+#if defined HAVE_STRING_H || defined _LIBC
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+# endif
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+#if !HAVE_STRCHR && !defined _LIBC
+# ifndef strchr
+# define strchr index
+# endif
+#endif
+
+#include "gettext.h"
+#include "gettextP.h"
+
+/* @@ end of prolog @@ */
+
+#ifdef _LIBC
+/* Rename the non ANSI C functions. This is required by the standard
+ because some ANSI C functions will require linking with this object
+ file and the name space must not be polluted. */
+# define strcasecmp __strcasecmp
+#endif
+
+
+/* For those loosing systems which don't have `alloca' we have to add
+ some additional code emulating it. */
+#ifdef HAVE_ALLOCA
+/* Nothing has to be done. */
+# define ADD_BLOCK(list, address) /* nothing */
+# define FREE_BLOCKS(list) /* nothing */
+#else
+struct block_list
+{
+ void *address;
+ struct block_list *next;
+};
+# define ADD_BLOCK(list, addr) \
+ do { \
+ struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
+ /* If we cannot get a free block we cannot add the new element to \
+ the list. */ \
+ if (newp != NULL) { \
+ newp->address = (addr); \
+ newp->next = (list); \
+ (list) = newp; \
+ } \
+ } while (0)
+# define FREE_BLOCKS(list) \
+ do { \
+ while (list != NULL) { \
+ struct block_list *old = list; \
+ list = list->next; \
+ free (old); \
+ } \
+ } while (0)
+# undef alloca
+# define alloca(size) (malloc (size))
+#endif /* have alloca */
+
+
+struct alias_map
+{
+ const char *alias;
+ const char *value;
+};
+
+
+static struct alias_map *map;
+static size_t nmap = 0;
+static size_t maxmap = 0;
+
+
+/* Prototypes for local functions. */
+static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
+static void extend_alias_table PARAMS ((void));
+static int alias_compare PARAMS ((const struct alias_map *map1,
+ const struct alias_map *map2));
+
+
+const char *
+_nl_expand_alias (name)
+ const char *name;
+{
+ static const char *locale_alias_path = LOCALE_ALIAS_PATH;
+ struct alias_map *retval;
+ size_t added;
+
+ do
+ {
+ struct alias_map item;
+
+ item.alias = name;
+
+ if (nmap > 0)
+ retval = (struct alias_map *) bsearch (&item, map, nmap,
+ sizeof (struct alias_map),
+ (int (*) PARAMS ((const void *,
+ const void *))
+ ) alias_compare);
+ else
+ retval = NULL;
+
+ /* We really found an alias. Return the value. */
+ if (retval != NULL)
+ return retval->value;
+
+ /* Perhaps we can find another alias file. */
+ added = 0;
+ while (added == 0 && locale_alias_path[0] != '\0')
+ {
+ const char *start;
+
+ while (locale_alias_path[0] == ':')
+ ++locale_alias_path;
+ start = locale_alias_path;
+
+ while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':')
+ ++locale_alias_path;
+
+ if (start < locale_alias_path)
+ added = read_alias_file (start, locale_alias_path - start);
+ }
+ }
+ while (added != 0);
+
+ return NULL;
+}
+
+
+static size_t
+read_alias_file (fname, fname_len)
+ const char *fname;
+ int fname_len;
+{
+#ifndef HAVE_ALLOCA
+ struct block_list *block_list = NULL;
+#endif
+ FILE *fp;
+ char *full_fname;
+ size_t added;
+ static const char aliasfile[] = "/locale.alias";
+
+ full_fname = (char *) alloca (fname_len + sizeof aliasfile);
+ ADD_BLOCK (block_list, full_fname);
+ memcpy (full_fname, fname, fname_len);
+ memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
+
+ fp = fopen (full_fname, "r");
+ if (fp == NULL)
+ {
+ FREE_BLOCKS (block_list);
+ return 0;
+ }
+
+ added = 0;
+ while (!feof (fp))
+ {
+ /* It is a reasonable approach to use a fix buffer here because
+ a) we are only interested in the first two fields
+ b) these fields must be usable as file names and so must not
+ be that long
+ */
+ char buf[BUFSIZ];
+ char *alias;
+ char *value;
+ char *cp;
+
+ if (fgets (buf, BUFSIZ, fp) == NULL)
+ /* EOF reached. */
+ break;
+
+ cp = buf;
+ /* Ignore leading white space. */
+ while (isspace (cp[0]))
+ ++cp;
+
+ /* A leading '#' signals a comment line. */
+ if (cp[0] != '\0' && cp[0] != '#')
+ {
+ alias = cp++;
+ while (cp[0] != '\0' && !isspace (cp[0]))
+ ++cp;
+ /* Terminate alias name. */
+ if (cp[0] != '\0')
+ *cp++ = '\0';
+
+ /* Now look for the beginning of the value. */
+ while (isspace (cp[0]))
+ ++cp;
+
+ if (cp[0] != '\0')
+ {
+ char *tp;
+ size_t len;
+
+ value = cp++;
+ while (cp[0] != '\0' && !isspace (cp[0]))
+ ++cp;
+ /* Terminate value. */
+ if (cp[0] == '\n')
+ {
+ /* This has to be done to make the following test
+ for the end of line possible. We are looking for
+ the terminating '\n' which do not overwrite here. */
+ *cp++ = '\0';
+ *cp = '\n';
+ }
+ else if (cp[0] != '\0')
+ *cp++ = '\0';
+
+ if (nmap >= maxmap)
+ extend_alias_table ();
+
+ /* We cannot depend on strdup available in the libc. Sigh! */
+ len = strlen (alias) + 1;
+ tp = (char *) malloc (len);
+ if (tp == NULL)
+ {
+ FREE_BLOCKS (block_list);
+ return added;
+ }
+ memcpy (tp, alias, len);
+ map[nmap].alias = tp;
+
+ len = strlen (value) + 1;
+ tp = (char *) malloc (len);
+ if (tp == NULL)
+ {
+ FREE_BLOCKS (block_list);
+ return added;
+ }
+ memcpy (tp, value, len);
+ map[nmap].value = tp;
+
+ ++nmap;
+ ++added;
+ }
+ }
+
+ /* Possibly not the whole line fits into the buffer. Ignore
+ the rest of the line. */
+ while (strchr (cp, '\n') == NULL)
+ {
+ cp = buf;
+ if (fgets (buf, BUFSIZ, fp) == NULL)
+ /* Make sure the inner loop will be left. The outer loop
+ will exit at the `feof' test. */
+ *cp = '\n';
+ }
+ }
+
+ /* Should we test for ferror()? I think we have to silently ignore
+ errors. --drepper */
+ fclose (fp);
+
+ if (added > 0)
+ qsort (map, nmap, sizeof (struct alias_map),
+ (int (*) PARAMS ((const void *, const void *))) alias_compare);
+
+ FREE_BLOCKS (block_list);
+ return added;
+}
+
+
+static void
+extend_alias_table ()
+{
+ size_t new_size;
+ struct alias_map *new_map;
+
+ new_size = maxmap == 0 ? 100 : 2 * maxmap;
+ new_map = (struct alias_map *) malloc (new_size
+ * sizeof (struct alias_map));
+ if (new_map == NULL)
+ /* Simply don't extend: we don't have any more core. */
+ return;
+
+ memcpy (new_map, map, nmap * sizeof (struct alias_map));
+
+ if (maxmap != 0)
+ free (map);
+
+ map = new_map;
+ maxmap = new_size;
+}
+
+
+static int
+alias_compare (map1, map2)
+ const struct alias_map *map1;
+ const struct alias_map *map2;
+{
+#if defined _LIBC || defined HAVE_STRCASECMP
+ return strcasecmp (map1->alias, map2->alias);
+#else
+ const unsigned char *p1 = (const unsigned char *) map1->alias;
+ const unsigned char *p2 = (const unsigned char *) map2->alias;
+ unsigned char c1, c2;
+
+ if (p1 == p2)
+ return 0;
+
+ do
+ {
+ /* I know this seems to be odd but the tolower() function in
+ some systems libc cannot handle nonalpha characters. */
+ c1 = isupper (*p1) ? tolower (*p1) : *p1;
+ c2 = isupper (*p2) ? tolower (*p2) : *p2;
+ if (c1 == '\0')
+ break;
+ ++p1;
+ ++p2;
+ }
+ while (c1 == c2);
+
+ return c1 - c2;
+#endif
+}
diff --git a/intl/po2tbl.sed.in b/intl/po2tbl.sed.in
new file mode 100644
index 0000000..b3bcca4
--- /dev/null
+++ b/intl/po2tbl.sed.in
@@ -0,0 +1,102 @@
+# po2tbl.sed - Convert Uniforum style .po file to lookup table for catgets
+# Copyright (C) 1995 Free Software Foundation, Inc.
+# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+1 {
+ i\
+/* Automatically generated by po2tbl.sed from @PACKAGE NAME@.pot. */\
+\
+#if HAVE_CONFIG_H\
+# include <config.h>\
+#endif\
+\
+#include "libgettext.h"\
+\
+const struct _msg_ent _msg_tbl[] = {
+ h
+ s/.*/0/
+ x
+}
+#
+# Write msgid entries in C array form.
+#
+/^msgid/ {
+ s/msgid[ ]*\(".*"\)/ {\1/
+ tb
+# Append the next line
+ :b
+ N
+# Look whether second part is continuation line.
+ s/\(.*\)"\(\n\)"\(.*"\)/\1\2\3/
+# Yes, then branch.
+ ta
+# Because we assume that the input file correctly formed the line
+# just read cannot be again be a msgid line. So it's safe to ignore
+# it.
+ s/\(.*\)\n.*/\1/
+ bc
+# We found a continuation line. But before printing insert '\'.
+ :a
+ s/\(.*\)\(\n.*\)/\1\\\2/
+ P
+# We cannot use D here.
+ s/.*\n\(.*\)/\1/
+# Some buggy seds do not clear the `successful substitution since last ``t'''
+# flag on `N', so we do a `t' here to clear it.
+ tb
+# Not reached
+ :c
+ x
+# The following nice solution is by
+# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+ td
+# Increment a decimal number in pattern space.
+# First hide trailing `9' digits.
+ :d
+ s/9\(_*\)$/_\1/
+ td
+# Assure at least one digit is available.
+ s/^\(_*\)$/0\1/
+# Increment the last digit.
+ s/8\(_*\)$/9\1/
+ s/7\(_*\)$/8\1/
+ s/6\(_*\)$/7\1/
+ s/5\(_*\)$/6\1/
+ s/4\(_*\)$/5\1/
+ s/3\(_*\)$/4\1/
+ s/2\(_*\)$/3\1/
+ s/1\(_*\)$/2\1/
+ s/0\(_*\)$/1\1/
+# Convert the hidden `9' digits to `0's.
+ s/_/0/g
+ x
+ G
+ s/\(.*\)\n\([0-9]*\)/\1, \2},/
+ s/\(.*\)"$/\1/
+ p
+}
+#
+# Last line.
+#
+$ {
+ i\
+};\
+
+ g
+ s/0*\(.*\)/int _msg_tbl_length = \1;/p
+}
+d
diff --git a/intl/textdomain.c b/intl/textdomain.c
new file mode 100644
index 0000000..55d9340
--- /dev/null
+++ b/intl/textdomain.c
@@ -0,0 +1,106 @@
+/* Implementation of the textdomain(3) function
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if defined STDC_HEADERS || defined _LIBC
+# include <stdlib.h>
+#endif
+
+#if defined STDC_HEADERS || defined HAVE_STRING_H || defined _LIBC
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef memcpy
+# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
+# endif
+#endif
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "libgettext.h"
+#endif
+
+/* @@ end of prolog @@ */
+
+/* Name of the default text domain. */
+extern const char _nl_default_default_domain[];
+
+/* Default text domain in which entries for gettext(3) are to be found. */
+extern const char *_nl_current_default_domain;
+
+
+/* Names for the libintl functions are a problem. They must not clash
+ with existing names and they should follow ANSI C. But this source
+ code is also used in GNU C Library where the names have a __
+ prefix. So we have to make a difference here. */
+#ifdef _LIBC
+# define TEXTDOMAIN __textdomain
+# define strdup(str) __strdup (str)
+#else
+# define TEXTDOMAIN textdomain__
+#endif
+
+/* Set the current default message catalog to DOMAINNAME.
+ If DOMAINNAME is null, return the current default.
+ If DOMAINNAME is "", reset to the default of "messages". */
+char *
+TEXTDOMAIN (domainname)
+ const char *domainname;
+{
+ char *old;
+
+ /* A NULL pointer requests the current setting. */
+ if (domainname == NULL)
+ return (char *) _nl_current_default_domain;
+
+ old = (char *) _nl_current_default_domain;
+
+ /* If domain name is the null string set to default domain "messages". */
+ if (domainname[0] == '\0'
+ || strcmp (domainname, _nl_default_default_domain) == 0)
+ _nl_current_default_domain = _nl_default_default_domain;
+ else
+ {
+ /* If the following malloc fails `_nl_current_default_domain'
+ will be NULL. This value will be returned and so signals we
+ are out of core. */
+#if defined _LIBC || defined HAVE_STRDUP
+ _nl_current_default_domain = strdup (domainname);
+#else
+ size_t len = strlen (domainname) + 1;
+ char *cp = (char *) malloc (len);
+ if (cp != NULL)
+ memcpy (cp, domainname, len);
+ _nl_current_default_domain = cp;
+#endif
+ }
+
+ if (old != _nl_default_default_domain)
+ free (old);
+
+ return (char *) _nl_current_default_domain;
+}
+
+#ifdef _LIBC
+/* Alias for function name in GNU C Library. */
+weak_alias (__textdomain, textdomain);
+#endif
diff --git a/intl/xopen-msg.sed b/intl/xopen-msg.sed
new file mode 100644
index 0000000..b19c0bb
--- /dev/null
+++ b/intl/xopen-msg.sed
@@ -0,0 +1,104 @@
+# po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file
+# Copyright (C) 1995 Free Software Foundation, Inc.
+# Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+#
+# The first directive in the .msg should be the definition of the
+# message set number. We use always set number 1.
+#
+1 {
+ i\
+$set 1 # Automatically created by po2msg.sed
+ h
+ s/.*/0/
+ x
+}
+#
+# We copy all comments into the .msg file. Perhaps they can help.
+#
+/^#/ s/^#[ ]*/$ /p
+#
+# We copy the original message as a comment into the .msg file.
+#
+/^msgid/ {
+# Does not work now
+# /"$/! {
+# s/\\$//
+# s/$/ ... (more lines following)"/
+# }
+ s/^msgid[ ]*"\(.*\)"$/$ Original Message: \1/
+ p
+}
+#
+# The .msg file contains, other then the .po file, only the translations
+# but each given a unique ID. Starting from 1 and incrementing by 1 for
+# each message we assign them to the messages.
+# It is important that the .po file used to generate the cat-id-tbl.c file
+# (with po-to-tbl) is the same as the one used here. (At least the order
+# of declarations must not be changed.)
+#
+/^msgstr/ {
+ s/msgstr[ ]*"\(.*\)"/\1/
+ x
+# The following nice solution is by
+# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
+ td
+# Increment a decimal number in pattern space.
+# First hide trailing `9' digits.
+ :d
+ s/9\(_*\)$/_\1/
+ td
+# Assure at least one digit is available.
+ s/^\(_*\)$/0\1/
+# Increment the last digit.
+ s/8\(_*\)$/9\1/
+ s/7\(_*\)$/8\1/
+ s/6\(_*\)$/7\1/
+ s/5\(_*\)$/6\1/
+ s/4\(_*\)$/5\1/
+ s/3\(_*\)$/4\1/
+ s/2\(_*\)$/3\1/
+ s/1\(_*\)$/2\1/
+ s/0\(_*\)$/1\1/
+# Convert the hidden `9' digits to `0's.
+ s/_/0/g
+ x
+# Bring the line in the format `<number> <message>'
+ G
+ s/^[^\n]*$/& /
+ s/\(.*\)\n\([0-9]*\)/\2 \1/
+# Clear flag from last substitution.
+ tb
+# Append the next line.
+ :b
+ N
+# Look whether second part is a continuation line.
+ s/\(.*\n\)"\(.*\)"/\1\2/
+# Yes, then branch.
+ ta
+ P
+ D
+# Note that `D' includes a jump to the start!!
+# We found a continuation line. But before printing insert '\'.
+ :a
+ s/\(.*\)\(\n.*\)/\1\\\2/
+ P
+# We cannot use the sed command `D' here
+ s/.*\n\(.*\)/\1/
+ tb
+}
+d
diff --git a/lib/CVS/Entries b/lib/CVS/Entries
new file mode 100644
index 0000000..900d74b
--- /dev/null
+++ b/lib/CVS/Entries
@@ -0,0 +1,28 @@
+/Makefile.am/1.3/Sun Aug 22 18:51:21 1999/-ko/
+/Makefile.in/1.8/Sun Aug 22 18:51:21 1999/-ko/
+/alloca.c/1.1.1.5/Sun Apr 26 13:22:23 1998/-ko/
+/ansi2knr.1/1.2/Sun Dec 27 14:29:31 1998/-ko/
+/ansi2knr.c/1.5/Sun Dec 27 16:09:19 1998/-ko/
+/error.c/1.2/Sun Aug 22 18:51:21 1999/-ko/
+/error.h/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/getopt.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/getopt.h/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/getopt1.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/long-options.c/1.2/Sun Aug 22 18:51:21 1999/-ko/
+/long-options.h/1.1.1.2/Sun Apr 26 13:22:35 1998/-ko/
+/mkdir.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/mktime.c/1.1.1.1/Sun Apr 26 13:21:43 1998/-ko/
+/stpcpy.c/1.1.1.1/Sun Apr 26 13:21:36 1998/-ko/
+/strdup.c/1.1.1.2/Sun Apr 26 13:22:34 1998/-ko/
+/strerror.c/1.2/Sun Aug 22 19:59:09 1999/-ko/
+/strftime.c/1.1.1.1/Sun Apr 26 13:21:59 1998/-ko/
+/strpbrk.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/strstr.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/strtol.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/strtoul.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/vasprintf.c/1.1.1.1/Sun Apr 26 13:22:35 1998/-ko/
+/xstrtol.c/1.2/Sun Aug 22 18:51:21 1999/-ko/
+/xstrtol.h/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/xstrtoul.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/xstrtoul.h/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+D
diff --git a/lib/CVS/Repository b/lib/CVS/Repository
new file mode 100644
index 0000000..9c63a17
--- /dev/null
+++ b/lib/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/lib
diff --git a/lib/CVS/Root b/lib/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/lib/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/lib/Makefile.am b/lib/Makefile.am
new file mode 100644
index 0000000..04b392c
--- /dev/null
+++ b/lib/Makefile.am
@@ -0,0 +1,15 @@
+noinst_LIBRARIES=libzmodem.a
+CFLAGS=@CFLAGS@
+AUTOMAKE_OPTIONS=ansi2knr
+
+EXTRA_DIST = alloca.c ansi2knr.1 ansi2knr.c \
+ getopt.c getopt1.c mkdir.c mktime.c \
+ strdup.c strerror.c strstr.c strpbrk.c strtol.c strtoul.c stpcpy.c \
+ strftime.c vasprintf.c
+
+libzmodem_a_SOURCES = long-options.c xstrtol.c xstrtoul.c error.c
+libzmodem_a_LIBADD = @LIBOBJS@ @ALLOCA@
+libzmodem_a_DEPENDENCIES = @ALLOCA@ @LIBOBJS@
+
+noinst_HEADERS = getopt.h long-options.h xstrtol.h xstrtoul.h error.h
+
diff --git a/lib/Makefile.in b/lib/Makefile.in
new file mode 100644
index 0000000..ca86128
--- /dev/null
+++ b/lib/Makefile.in
@@ -0,0 +1,403 @@
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CPP = @CPP@
+DATADIRNAME = @DATADIRNAME@
+ENABLE_TIMESYNC = @ENABLE_TIMESYNC@
+GENCAT = @GENCAT@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+PACKAGE = @PACKAGE@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+U = @U@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+l = @l@
+
+noinst_LIBRARIES = libzmodem.a
+CFLAGS = @CFLAGS@
+AUTOMAKE_OPTIONS = ansi2knr
+
+EXTRA_DIST = alloca.c ansi2knr.1 ansi2knr.c getopt.c getopt1.c mkdir.c mktime.c strdup.c strerror.c strstr.c strpbrk.c strtol.c strtoul.c stpcpy.c strftime.c vasprintf.c
+
+
+libzmodem_a_SOURCES = long-options.c xstrtol.c xstrtoul.c error.c
+libzmodem_a_LIBADD = @LIBOBJS@ @ALLOCA@
+libzmodem_a_DEPENDENCIES = @ALLOCA@ @LIBOBJS@
+
+noinst_HEADERS = getopt.h long-options.h xstrtol.h xstrtoul.h error.h
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+ANSI2KNR = @ANSI2KNR@
+libzmodem_a_OBJECTS = long-options$U.o xstrtol$U.o xstrtoul$U.o \
+error$U.o
+AR = ar
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = Makefile.am Makefile.in alloca.c ansi2knr.1 ansi2knr.c \
+getopt.c getopt1.c mkdir.c mktime.c stpcpy.c strdup.c strerror.c \
+strftime.c strpbrk.c strstr.c strtol.c strtoul.c vasprintf.c
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+DEP_FILES = .deps/alloca.P .deps/error.P .deps/getopt.P .deps/getopt1.P \
+.deps/long-options.P .deps/mkdir.P .deps/mktime.P .deps/stpcpy.P \
+.deps/strdup.P .deps/strerror.P .deps/strftime.P .deps/strpbrk.P \
+.deps/strstr.P .deps/strtol.P .deps/strtoul.P .deps/vasprintf.P \
+.deps/xstrtol.P .deps/xstrtoul.P
+SOURCES = $(libzmodem_a_SOURCES)
+OBJECTS = $(libzmodem_a_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-noinstLIBRARIES:
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+
+distclean-noinstLIBRARIES:
+
+maintainer-clean-noinstLIBRARIES:
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+mostlyclean-krextra:
+
+clean-krextra:
+ -rm -f ansi2knr
+
+distclean-krextra:
+
+maintainer-clean-krextra:
+ansi2knr: ansi2knr.o
+ $(LINK) ansi2knr.o $(LIBS)
+ansi2knr.o: $(CONFIG_HEADER)
+
+
+mostlyclean-kr:
+ -rm -f *_.c
+
+clean-kr:
+
+distclean-kr:
+
+maintainer-clean-kr:
+
+libzmodem.a: $(libzmodem_a_OBJECTS) $(libzmodem_a_DEPENDENCIES)
+ -rm -f libzmodem.a
+ $(AR) cru libzmodem.a $(libzmodem_a_OBJECTS) $(libzmodem_a_LIBADD)
+ $(RANLIB) libzmodem.a
+alloca_.c: alloca.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/alloca.c; then echo $(srcdir)/alloca.c; else echo alloca.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > alloca_.c
+error_.c: error.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/error.c; then echo $(srcdir)/error.c; else echo error.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > error_.c
+getopt_.c: getopt.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c
+getopt1_.c: getopt1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt1_.c
+long-options_.c: long-options.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/long-options.c; then echo $(srcdir)/long-options.c; else echo long-options.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > long-options_.c
+mkdir_.c: mkdir.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mkdir.c; then echo $(srcdir)/mkdir.c; else echo mkdir.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > mkdir_.c
+mktime_.c: mktime.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mktime.c; then echo $(srcdir)/mktime.c; else echo mktime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > mktime_.c
+stpcpy_.c: stpcpy.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stpcpy.c; then echo $(srcdir)/stpcpy.c; else echo stpcpy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > stpcpy_.c
+strdup_.c: strdup.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strdup.c; then echo $(srcdir)/strdup.c; else echo strdup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strdup_.c
+strerror_.c: strerror.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strerror.c; then echo $(srcdir)/strerror.c; else echo strerror.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strerror_.c
+strftime_.c: strftime.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strftime.c; then echo $(srcdir)/strftime.c; else echo strftime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strftime_.c
+strpbrk_.c: strpbrk.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strpbrk.c; then echo $(srcdir)/strpbrk.c; else echo strpbrk.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strpbrk_.c
+strstr_.c: strstr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strstr.c; then echo $(srcdir)/strstr.c; else echo strstr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strstr_.c
+strtol_.c: strtol.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strtol.c; then echo $(srcdir)/strtol.c; else echo strtol.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strtol_.c
+strtoul_.c: strtoul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strtoul.c; then echo $(srcdir)/strtoul.c; else echo strtoul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strtoul_.c
+vasprintf_.c: vasprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vasprintf.c; then echo $(srcdir)/vasprintf.c; else echo vasprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > vasprintf_.c
+xstrtol_.c: xstrtol.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrtol.c; then echo $(srcdir)/xstrtol.c; else echo xstrtol.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrtol_.c
+xstrtoul_.c: xstrtoul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xstrtoul.c; then echo $(srcdir)/xstrtoul.c; else echo xstrtoul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > xstrtoul_.c
+alloca_.o error_.o getopt_.o getopt1_.o long-options_.o mkdir_.o \
+mktime_.o stpcpy_.o strdup_.o strerror_.o strftime_.o strpbrk_.o \
+strstr_.o strtol_.o strtoul_.o vasprintf_.o xstrtol_.o xstrtoul_.o : \
+$(ANSI2KNR)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = lib
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu lib/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+ -rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+ @echo '$(COMPILE) -c $<'; \
+ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+ @-cp .deps/$(*F).pp .deps/$(*F).P; \
+ tr ' ' '\012' < .deps/$(*F).pp \
+ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+ >> .deps/$(*F).P; \
+ rm .deps/$(*F).pp
+
+%.lo: %.c
+ @echo '$(LTCOMPILE) -c $<'; \
+ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
+ < .deps/$(*F).pp > .deps/$(*F).P; \
+ tr ' ' '\012' < .deps/$(*F).pp \
+ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+ >> .deps/$(*F).P; \
+ rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile $(ANSI2KNR) $(LIBRARIES) $(HEADERS)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
+ mostlyclean-krextra mostlyclean-kr mostlyclean-tags \
+ mostlyclean-depend mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-noinstLIBRARIES clean-compile clean-krextra clean-kr \
+ clean-tags clean-depend clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-noinstLIBRARIES distclean-compile \
+ distclean-krextra distclean-kr distclean-tags \
+ distclean-depend distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
+ maintainer-clean-compile maintainer-clean-krextra \
+ maintainer-clean-kr maintainer-clean-tags \
+ maintainer-clean-depend maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
+clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-krextra distclean-krextra \
+clean-krextra maintainer-clean-krextra mostlyclean-kr distclean-kr \
+clean-kr maintainer-clean-kr tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir mostlyclean-depend \
+distclean-depend clean-depend maintainer-clean-depend info-am info \
+dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
+install-exec install-data-am install-data install-am install \
+uninstall-am uninstall all-redirect all-am all installdirs \
+mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lib/alloca.c b/lib/alloca.c
new file mode 100644
index 0000000..43294a5
--- /dev/null
+++ b/lib/alloca.c
@@ -0,0 +1,499 @@
+/* alloca.c -- allocate automatically reclaimed memory
+ (Mostly) portable public-domain implementation -- D A Gwyn
+
+ This implementation of the PWB library alloca function,
+ which is used to allocate space off the run-time stack so
+ that it is automatically reclaimed upon procedure exit,
+ was inspired by discussions with J. Q. Johnson of Cornell.
+ J.Otto Tennant <jot@cray.com> contributed the Cray support.
+
+ There are some preprocessor constants that can
+ be defined when compiling for your specific system, for
+ improved efficiency; however, the defaults should be okay.
+
+ The general concept of this implementation is to keep
+ track of all alloca-allocated blocks, and reclaim any
+ that are found to be deeper in the stack than the current
+ invocation. This heuristic does not reclaim storage as
+ soon as it becomes invalid, but it will do so eventually.
+
+ As a special case, alloca(0) reclaims storage without
+ allocating any. It is a good idea to use alloca(0) in
+ your main control loop, etc. to force garbage collection. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* If compiling with GCC, this file's not needed. */
+#ifndef alloca
+
+#ifdef emacs
+#ifdef static
+/* actually, only want this if static is defined as ""
+ -- this is for usg, in which emacs must undefine static
+ in order to make unexec workable
+ */
+#ifndef STACK_DIRECTION
+you
+lose
+-- must know STACK_DIRECTION at compile-time
+#endif /* STACK_DIRECTION undefined */
+#endif /* static */
+#endif /* emacs */
+
+/* If your stack is a linked list of frames, you have to
+ provide an "address metric" ADDRESS_FUNCTION macro. */
+
+#if defined (CRAY) && defined (CRAY_STACKSEG_END)
+long i00afunc ();
+#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
+#else
+#define ADDRESS_FUNCTION(arg) &(arg)
+#endif
+
+#if __STDC__
+typedef void *pointer;
+#else
+typedef char *pointer;
+#endif
+
+#define NULL 0
+
+/* Different portions of Emacs need to call different versions of
+ malloc. The Emacs executable needs alloca to call xmalloc, because
+ ordinary malloc isn't protected from input signals. On the other
+ hand, the utilities in lib-src need alloca to call malloc; some of
+ them are very simple, and don't have an xmalloc routine.
+
+ Non-Emacs programs expect this to call use xmalloc.
+
+ Callers below should use malloc. */
+
+#ifndef emacs
+#if 0
+#define malloc xmalloc
+extern pointer xmalloc ();
+#else
+static void *
+xmalloc(s)
+ unsigned long s;
+{
+ void *p=(void *)malloc(s);
+ if (!p) {
+ const char *meld="out of memory in alloca\n";
+ write(2,meld,strlen(meld));
+ exit(1);
+ }
+ return p;
+}
+#define malloc xmalloc
+#endif
+#endif
+
+/* Define STACK_DIRECTION if you know the direction of stack
+ growth for your system; otherwise it will be automatically
+ deduced at run-time.
+
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+
+#ifndef STACK_DIRECTION
+#define STACK_DIRECTION 0 /* Direction unknown. */
+#endif
+
+#if STACK_DIRECTION != 0
+
+#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
+
+#else /* STACK_DIRECTION == 0; need run-time code. */
+
+static int stack_dir; /* 1 or -1 once known. */
+#define STACK_DIR stack_dir
+
+static void
+find_stack_direction ()
+{
+ static char *addr = NULL; /* Address of first `dummy', once known. */
+ auto char dummy; /* To get stack address. */
+
+ if (addr == NULL)
+ { /* Initial entry. */
+ addr = ADDRESS_FUNCTION (dummy);
+
+ find_stack_direction (); /* Recurse once. */
+ }
+ else
+ {
+ /* Second entry. */
+ if (ADDRESS_FUNCTION (dummy) > addr)
+ stack_dir = 1; /* Stack grew upward. */
+ else
+ stack_dir = -1; /* Stack grew downward. */
+ }
+}
+
+#endif /* STACK_DIRECTION == 0 */
+
+/* An "alloca header" is used to:
+ (a) chain together all alloca'ed blocks;
+ (b) keep track of stack depth.
+
+ It is very important that sizeof(header) agree with malloc
+ alignment chunk size. The following default should work okay. */
+
+#ifndef ALIGN_SIZE
+#define ALIGN_SIZE sizeof(double)
+#endif
+
+typedef union hdr
+{
+ char align[ALIGN_SIZE]; /* To force sizeof(header). */
+ struct
+ {
+ union hdr *next; /* For chaining headers. */
+ char *deep; /* For stack depth measure. */
+ } h;
+} header;
+
+static header *last_alloca_header = NULL; /* -> last alloca header. */
+
+
+/* Return a pointer to at least SIZE bytes of storage,
+ which will be automatically reclaimed upon exit from
+ the procedure that called alloca. Originally, this space
+ was supposed to be taken from the current stack frame of the
+ caller, but that method cannot be made to work for some
+ implementations of C, for example under Gould's UTX/32. */
+
+pointer
+alloca (size)
+ unsigned size;
+{
+ auto char probe; /* Probes stack depth: */
+ register char *depth = ADDRESS_FUNCTION (probe);
+
+#if STACK_DIRECTION == 0
+ if (STACK_DIR == 0) /* Unknown growth direction. */
+ find_stack_direction ();
+#endif
+
+ /* Reclaim garbage, defined as all alloca'd storage that
+ was allocated from deeper in the stack than currently. */
+
+ {
+ register header *hp; /* Traverses linked list. */
+
+ for (hp = last_alloca_header; hp != NULL;)
+ if ((STACK_DIR > 0 && hp->h.deep > depth)
+ || (STACK_DIR < 0 && hp->h.deep < depth))
+ {
+ register header *np = hp->h.next;
+
+ free ((pointer) hp); /* Collect garbage. */
+
+ hp = np; /* -> next header. */
+ }
+ else
+ break; /* Rest are not deeper. */
+
+ last_alloca_header = hp; /* -> last valid storage. */
+ }
+
+ if (size == 0)
+ return NULL; /* No allocation required. */
+
+ /* Allocate combined header + user data storage. */
+
+ {
+ register pointer new = malloc (sizeof (header) + size);
+ /* Address of header. */
+
+ ((header *) new)->h.next = last_alloca_header;
+ ((header *) new)->h.deep = depth;
+
+ last_alloca_header = (header *) new;
+
+ /* User storage begins just after header. */
+
+ return (pointer) ((char *) new + sizeof (header));
+ }
+}
+
+/* brute force hack around glibc-2.0.4 together with lcc
+ (need -D_BSD_SOURCE for u_long, but then get "alloca.h",
+ which #defines alloca to be __alloca). -- uwe
+ */
+pointer __alloca (size) unsigned size;
+{ return alloca(size); }
+
+#if defined (CRAY) && defined (CRAY_STACKSEG_END)
+
+#ifdef DEBUG_I00AFUNC
+#include <stdio.h>
+#endif
+
+#ifndef CRAY_STACK
+#define CRAY_STACK
+#ifndef CRAY2
+/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
+struct stack_control_header
+ {
+ long shgrow:32; /* Number of times stack has grown. */
+ long shaseg:32; /* Size of increments to stack. */
+ long shhwm:32; /* High water mark of stack. */
+ long shsize:32; /* Current size of stack (all segments). */
+ };
+
+/* The stack segment linkage control information occurs at
+ the high-address end of a stack segment. (The stack
+ grows from low addresses to high addresses.) The initial
+ part of the stack segment linkage control information is
+ 0200 (octal) words. This provides for register storage
+ for the routine which overflows the stack. */
+
+struct stack_segment_linkage
+ {
+ long ss[0200]; /* 0200 overflow words. */
+ long sssize:32; /* Number of words in this segment. */
+ long ssbase:32; /* Offset to stack base. */
+ long:32;
+ long sspseg:32; /* Offset to linkage control of previous
+ segment of stack. */
+ long:32;
+ long sstcpt:32; /* Pointer to task common address block. */
+ long sscsnm; /* Private control structure number for
+ microtasking. */
+ long ssusr1; /* Reserved for user. */
+ long ssusr2; /* Reserved for user. */
+ long sstpid; /* Process ID for pid based multi-tasking. */
+ long ssgvup; /* Pointer to multitasking thread giveup. */
+ long sscray[7]; /* Reserved for Cray Research. */
+ long ssa0;
+ long ssa1;
+ long ssa2;
+ long ssa3;
+ long ssa4;
+ long ssa5;
+ long ssa6;
+ long ssa7;
+ long sss0;
+ long sss1;
+ long sss2;
+ long sss3;
+ long sss4;
+ long sss5;
+ long sss6;
+ long sss7;
+ };
+
+#else /* CRAY2 */
+/* The following structure defines the vector of words
+ returned by the STKSTAT library routine. */
+struct stk_stat
+ {
+ long now; /* Current total stack size. */
+ long maxc; /* Amount of contiguous space which would
+ be required to satisfy the maximum
+ stack demand to date. */
+ long high_water; /* Stack high-water mark. */
+ long overflows; /* Number of stack overflow ($STKOFEN) calls. */
+ long hits; /* Number of internal buffer hits. */
+ long extends; /* Number of block extensions. */
+ long stko_mallocs; /* Block allocations by $STKOFEN. */
+ long underflows; /* Number of stack underflow calls ($STKRETN). */
+ long stko_free; /* Number of deallocations by $STKRETN. */
+ long stkm_free; /* Number of deallocations by $STKMRET. */
+ long segments; /* Current number of stack segments. */
+ long maxs; /* Maximum number of stack segments so far. */
+ long pad_size; /* Stack pad size. */
+ long current_address; /* Current stack segment address. */
+ long current_size; /* Current stack segment size. This
+ number is actually corrupted by STKSTAT to
+ include the fifteen word trailer area. */
+ long initial_address; /* Address of initial segment. */
+ long initial_size; /* Size of initial segment. */
+ };
+
+/* The following structure describes the data structure which trails
+ any stack segment. I think that the description in 'asdef' is
+ out of date. I only describe the parts that I am sure about. */
+
+struct stk_trailer
+ {
+ long this_address; /* Address of this block. */
+ long this_size; /* Size of this block (does not include
+ this trailer). */
+ long unknown2;
+ long unknown3;
+ long link; /* Address of trailer block of previous
+ segment. */
+ long unknown5;
+ long unknown6;
+ long unknown7;
+ long unknown8;
+ long unknown9;
+ long unknown10;
+ long unknown11;
+ long unknown12;
+ long unknown13;
+ long unknown14;
+ };
+
+#endif /* CRAY2 */
+#endif /* not CRAY_STACK */
+
+#ifdef CRAY2
+/* Determine a "stack measure" for an arbitrary ADDRESS.
+ I doubt that "lint" will like this much. */
+
+static long
+i00afunc (long *address)
+{
+ struct stk_stat status;
+ struct stk_trailer *trailer;
+ long *block, size;
+ long result = 0;
+
+ /* We want to iterate through all of the segments. The first
+ step is to get the stack status structure. We could do this
+ more quickly and more directly, perhaps, by referencing the
+ $LM00 common block, but I know that this works. */
+
+ STKSTAT (&status);
+
+ /* Set up the iteration. */
+
+ trailer = (struct stk_trailer *) (status.current_address
+ + status.current_size
+ - 15);
+
+ /* There must be at least one stack segment. Therefore it is
+ a fatal error if "trailer" is null. */
+
+ if (trailer == 0)
+ abort ();
+
+ /* Discard segments that do not contain our argument address. */
+
+ while (trailer != 0)
+ {
+ block = (long *) trailer->this_address;
+ size = trailer->this_size;
+ if (block == 0 || size == 0)
+ abort ();
+ trailer = (struct stk_trailer *) trailer->link;
+ if ((block <= address) && (address < (block + size)))
+ break;
+ }
+
+ /* Set the result to the offset in this segment and add the sizes
+ of all predecessor segments. */
+
+ result = address - block;
+
+ if (trailer == 0)
+ {
+ return result;
+ }
+
+ do
+ {
+ if (trailer->this_size <= 0)
+ abort ();
+ result += trailer->this_size;
+ trailer = (struct stk_trailer *) trailer->link;
+ }
+ while (trailer != 0);
+
+ /* We are done. Note that if you present a bogus address (one
+ not in any segment), you will get a different number back, formed
+ from subtracting the address of the first block. This is probably
+ not what you want. */
+
+ return (result);
+}
+
+#else /* not CRAY2 */
+/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
+ Determine the number of the cell within the stack,
+ given the address of the cell. The purpose of this
+ routine is to linearize, in some sense, stack addresses
+ for alloca. */
+
+static long
+i00afunc (long address)
+{
+ long stkl = 0;
+
+ long size, pseg, this_segment, stack;
+ long result = 0;
+
+ struct stack_segment_linkage *ssptr;
+
+ /* Register B67 contains the address of the end of the
+ current stack segment. If you (as a subprogram) store
+ your registers on the stack and find that you are past
+ the contents of B67, you have overflowed the segment.
+
+ B67 also points to the stack segment linkage control
+ area, which is what we are really interested in. */
+
+ stkl = CRAY_STACKSEG_END ();
+ ssptr = (struct stack_segment_linkage *) stkl;
+
+ /* If one subtracts 'size' from the end of the segment,
+ one has the address of the first word of the segment.
+
+ If this is not the first segment, 'pseg' will be
+ nonzero. */
+
+ pseg = ssptr->sspseg;
+ size = ssptr->sssize;
+
+ this_segment = stkl - size;
+
+ /* It is possible that calling this routine itself caused
+ a stack overflow. Discard stack segments which do not
+ contain the target address. */
+
+ while (!(this_segment <= address && address <= stkl))
+ {
+#ifdef DEBUG_I00AFUNC
+ fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
+#endif
+ if (pseg == 0)
+ break;
+ stkl = stkl - pseg;
+ ssptr = (struct stack_segment_linkage *) stkl;
+ size = ssptr->sssize;
+ pseg = ssptr->sspseg;
+ this_segment = stkl - size;
+ }
+
+ result = address - this_segment;
+
+ /* If you subtract pseg from the current end of the stack,
+ you get the address of the previous stack segment's end.
+ This seems a little convoluted to me, but I'll bet you save
+ a cycle somewhere. */
+
+ while (pseg != 0)
+ {
+#ifdef DEBUG_I00AFUNC
+ fprintf (stderr, "%011o %011o\n", pseg, size);
+#endif
+ stkl = stkl - pseg;
+ ssptr = (struct stack_segment_linkage *) stkl;
+ size = ssptr->sssize;
+ pseg = ssptr->sspseg;
+ result += size;
+ }
+ return (result);
+}
+
+#endif /* not CRAY2 */
+#endif /* CRAY */
+
+#endif /* no alloca */
diff --git a/lib/ansi2knr.1 b/lib/ansi2knr.1
new file mode 100644
index 0000000..f9ee5a6
--- /dev/null
+++ b/lib/ansi2knr.1
@@ -0,0 +1,36 @@
+.TH ANSI2KNR 1 "19 Jan 1996"
+.SH NAME
+ansi2knr \- convert ANSI C to Kernighan & Ritchie C
+.SH SYNOPSIS
+.I ansi2knr
+[--varargs] input_file [output_file]
+.SH DESCRIPTION
+If no output_file is supplied, output goes to stdout.
+.br
+There are no error messages.
+.sp
+.I ansi2knr
+recognizes function definitions by seeing a non-keyword identifier at the left
+margin, followed by a left parenthesis, with a right parenthesis as the last
+character on the line, and with a left brace as the first token on the
+following line (ignoring possible intervening comments). It will recognize a
+multi-line header provided that no intervening line ends with a left or right
+brace or a semicolon. These algorithms ignore whitespace and comments, except
+that the function name must be the first thing on the line.
+.sp
+The following constructs will confuse it:
+.br
+ - Any other construct that starts at the left margin and follows the
+above syntax (such as a macro or function call).
+.br
+ - Some macros that tinker with the syntax of the function header.
+.sp
+The --varargs switch is obsolete, and is recognized only for
+backwards compatibility. The present version of
+.I ansi2knr
+will always attempt to convert a ... argument to va_alist and va_dcl.
+.SH AUTHOR
+L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
+continues to maintain the current version; most of the code in the current
+version is his work. ansi2knr also includes contributions by Francois
+Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
diff --git a/lib/ansi2knr.c b/lib/ansi2knr.c
new file mode 100644
index 0000000..62146c0
--- /dev/null
+++ b/lib/ansi2knr.c
@@ -0,0 +1,568 @@
+/* Copyright (C) 1989, 1997 Aladdin Enterprises. All rights reserved. */
+
+/* hacked up by uo to get around automake-1.3-problem */
+
+/*$Id: ansi2knr.c,v 1.4 1998/12/27 14:58:37 uwe Exp $*/
+/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
+
+/*
+ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY. No author or distributor accepts responsibility to anyone for the
+consequences of using it or for whether it serves any particular purpose or
+works at all, unless he says so in writing. Refer to the GNU General Public
+License (the "GPL") for full details.
+
+Everyone is granted permission to copy, modify and redistribute ansi2knr,
+but only under the conditions described in the GPL. A copy of this license
+is supposed to have been given to you along with ansi2knr so you can know
+your rights and responsibilities. It should be in a file named COPYLEFT,
+or, if there is no file named COPYLEFT, a file named COPYING. Among other
+things, the copyright notice and this notice must be preserved on all
+copies.
+
+We explicitly state here what we believe is already implied by the GPL: if
+the ansi2knr program is distributed as a separate set of sources and a
+separate executable file which are aggregated on a storage medium together
+with another program, this in itself does not bring the other program under
+the GPL, nor does the mere fact that such a program or the procedures for
+constructing it invoke the ansi2knr executable bring any other part of the
+program under the GPL.
+*/
+
+/*
+ * ----- not valid at the moment -- uwe ------
+ * Usage:
+ ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
+ * --filename provides the file name for the #line directive in the output,
+ * overriding input_file (if present).
+ * If no input_file is supplied, input is read from stdin.
+ * If no output_file is supplied, output goes to stdout.
+ * There are no error messages.
+ *
+ * ansi2knr recognizes function definitions by seeing a non-keyword
+ * identifier at the left margin, followed by a left parenthesis,
+ * with a right parenthesis as the last character on the line,
+ * and with a left brace as the first token on the following line
+ * (ignoring possible intervening comments).
+ * It will recognize a multi-line header provided that no intervening
+ * line ends with a left or right brace or a semicolon.
+ * These algorithms ignore whitespace and comments, except that
+ * the function name must be the first thing on the line.
+ * The following constructs will confuse it:
+ * - Any other construct that starts at the left margin and
+ * follows the above syntax (such as a macro or function call).
+ * - Some macros that tinker with the syntax of the function header.
+ */
+
+/*
+ * The original and principal author of ansi2knr is L. Peter Deutsch
+ * <ghost@aladdin.com>. Other authors are noted in the change history
+ * that follows (in reverse chronological order):
+ lpd 97-12-08 made input_file optional; only closes input and/or
+ output file if not stdin or stdout respectively; prints
+ usage message on stderr rather than stdout; adds
+ --filename switch (changes suggested by
+ <ceder@lysator.liu.se>)
+ lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
+ compilers that don't understand void, as suggested by
+ Tom Lane
+ lpd 96-01-15 changed to require that the first non-comment token
+ on the line following a function header be a left brace,
+ to reduce sensitivity to macros, as suggested by Tom Lane
+ <tgl@sss.pgh.pa.us>
+ lpd 95-06-22 removed #ifndefs whose sole purpose was to define
+ undefined preprocessor symbols as 0; changed all #ifdefs
+ for configuration symbols to #ifs
+ lpd 95-04-05 changed copyright notice to make it clear that
+ including ansi2knr in a program does not bring the entire
+ program under the GPL
+ lpd 94-12-18 added conditionals for systems where ctype macros
+ don't handle 8-bit characters properly, suggested by
+ Francois Pinard <pinard@iro.umontreal.ca>;
+ removed --varargs switch (this is now the default)
+ lpd 94-10-10 removed CONFIG_BROKETS conditional
+ lpd 94-07-16 added some conditionals to help GNU `configure',
+ suggested by Francois Pinard <pinard@iro.umontreal.ca>;
+ properly erase prototype args in function parameters,
+ contributed by Jim Avera <jima@netcom.com>;
+ correct error in writeblanks (it shouldn't erase EOLs)
+ lpd 89-xx-xx original version
+ */
+
+/* Most of the conditionals here are to make ansi2knr work with */
+/* or without the GNU configure machinery. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_CONFIG_H
+
+/*
+ For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
+ This will define HAVE_CONFIG_H and so, activate the following lines.
+ */
+
+# if STDC_HEADERS || HAVE_STRING_H
+# include <string.h>
+# else
+# include <strings.h>
+# endif
+
+#else /* not HAVE_CONFIG_H */
+
+/* Otherwise do it the hard way */
+
+# ifdef BSD
+# include <strings.h>
+# else
+# ifdef VMS
+ extern int strlen(), strncmp();
+# else
+# include <string.h>
+# endif
+# endif
+
+#endif /* not HAVE_CONFIG_H */
+
+#if STDC_HEADERS
+# include <stdlib.h>
+#else
+/*
+ malloc and free should be declared in stdlib.h,
+ but if you've got a K&R compiler, they probably aren't.
+ */
+# ifdef MSDOS
+# include <malloc.h>
+# else
+# ifdef VMS
+ extern char *malloc();
+ extern void free();
+# else
+ extern char *malloc();
+ extern int free();
+# endif
+# endif
+
+#endif
+
+/*
+ * The ctype macros don't always handle 8-bit characters correctly.
+ * Compensate for this here.
+ */
+#ifdef isascii
+# undef HAVE_ISASCII /* just in case */
+# define HAVE_ISASCII 1
+#else
+#endif
+#if STDC_HEADERS || !HAVE_ISASCII
+# define is_ascii(c) 1
+#else
+# define is_ascii(c) isascii(c)
+#endif
+
+#define is_space(c) (is_ascii(c) && isspace(c))
+#define is_alpha(c) (is_ascii(c) && isalpha(c))
+#define is_alnum(c) (is_ascii(c) && isalnum(c))
+
+/* Scanning macros */
+#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
+#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
+
+/* Forward references */
+char *skipspace();
+int writeblanks();
+int test1();
+int convert1();
+
+/* The main program */
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{ FILE *in = stdin;
+ FILE *out = stdout;
+ char *filename = 0;
+#define bufsize 5000 /* arbitrary size */
+ char *buf;
+ char *line;
+ char *more;
+ char *usage =
+ "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
+ /*
+ * In previous versions, ansi2knr recognized a --varargs switch.
+ * If this switch was supplied, ansi2knr would attempt to convert
+ * a ... argument to va_alist and va_dcl; if this switch was not
+ * supplied, ansi2knr would simply drop any such arguments.
+ * Now, ansi2knr always does this conversion, and we only
+ * check for this switch for backward compatibility.
+ */
+ int convert_varargs = 0;
+
+ while ( argc > 1 && argv[1][0] == '-' ) {
+ if ( !strcmp(argv[1], "--varargs") ) {
+ convert_varargs = 1;
+ argc--;
+ argv++;
+ continue;
+ }
+ if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
+ filename = argv[2];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
+ fprintf(stderr, usage);
+ exit(1);
+ }
+ switch ( argc )
+ {
+ default:
+ fprintf(stderr, usage);
+ exit(0);
+ case 2:
+ out = fopen(argv[1], "w");
+ if ( out == NULL ) {
+ fprintf(stderr, "Cannot open output file %s\n", argv[2]);
+ exit(1);
+ }
+ /* falls through */
+ case 1:
+ break;
+ }
+ if ( filename )
+ fprintf(out, "#line 1 \"%s\"\n", filename);
+ buf = malloc(bufsize);
+ line = buf;
+ while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
+ {
+test: line += strlen(line);
+ switch ( test1(buf) )
+ {
+ case 2: /* a function header */
+ convert1(buf, out, 1, convert_varargs);
+ break;
+ case 1: /* a function */
+ /* Check for a { at the start of the next line. */
+ more = ++line;
+f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
+ goto wl;
+ if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
+ goto wl;
+ switch ( *skipspace(more, 1) )
+ {
+ case '{':
+ /* Definitely a function header. */
+ convert1(buf, out, 0, convert_varargs);
+ fputs(more, out);
+ break;
+ case 0:
+ /* The next line was blank or a comment: */
+ /* keep scanning for a non-comment. */
+ line += strlen(line);
+ goto f;
+ default:
+ /* buf isn't a function header, but */
+ /* more might be. */
+ fputs(buf, out);
+ strcpy(buf, more);
+ line = buf;
+ goto test;
+ }
+ break;
+ case -1: /* maybe the start of a function */
+ if ( line != buf + (bufsize - 1) ) /* overflow check */
+ continue;
+ /* falls through */
+ default: /* not a function */
+wl: fputs(buf, out);
+ break;
+ }
+ line = buf;
+ }
+ if ( line != buf )
+ fputs(buf, out);
+ free(buf);
+ if ( out != stdout )
+ fclose(out);
+ if ( in != stdin )
+ fclose(in);
+ return 0;
+}
+
+/* Skip over space and comments, in either direction. */
+char *
+skipspace(p, dir)
+ register char *p;
+ register int dir; /* 1 for forward, -1 for backward */
+{ for ( ; ; )
+ { while ( is_space(*p) )
+ p += dir;
+ if ( !(*p == '/' && p[dir] == '*') )
+ break;
+ p += dir; p += dir;
+ while ( !(*p == '*' && p[dir] == '/') )
+ { if ( *p == 0 )
+ return p; /* multi-line comment?? */
+ p += dir;
+ }
+ p += dir; p += dir;
+ }
+ return p;
+}
+
+/*
+ * Write blanks over part of a string.
+ * Don't overwrite end-of-line characters.
+ */
+int
+writeblanks(start, end)
+ char *start;
+ char *end;
+{ char *p;
+ for ( p = start; p < end; p++ )
+ if ( *p != '\r' && *p != '\n' )
+ *p = ' ';
+ return 0;
+}
+
+/*
+ * Test whether the string in buf is a function definition.
+ * The string may contain and/or end with a newline.
+ * Return as follows:
+ * 0 - definitely not a function definition;
+ * 1 - definitely a function definition;
+ * 2 - definitely a function prototype (NOT USED);
+ * -1 - may be the beginning of a function definition,
+ * append another line and look again.
+ * The reason we don't attempt to convert function prototypes is that
+ * Ghostscript's declaration-generating macros look too much like
+ * prototypes, and confuse the algorithms.
+ */
+int
+test1(buf)
+ char *buf;
+{ register char *p = buf;
+ char *bend;
+ char *endfn;
+ int contin;
+
+ if ( !isidfirstchar(*p) )
+ return 0; /* no name at left margin */
+ bend = skipspace(buf + strlen(buf) - 1, -1);
+ switch ( *bend )
+ {
+ case ';': contin = 0 /*2*/; break;
+ case ')': contin = 1; break;
+ case '{': return 0; /* not a function */
+ case '}': return 0; /* not a function */
+ default: contin = -1;
+ }
+ while ( isidchar(*p) )
+ p++;
+ endfn = p;
+ p = skipspace(p, 1);
+ if ( *p++ != '(' )
+ return 0; /* not a function */
+ p = skipspace(p, 1);
+ if ( *p == ')' )
+ return 0; /* no parameters */
+ /* Check that the apparent function name isn't a keyword. */
+ /* We only need to check for keywords that could be followed */
+ /* by a left parenthesis (which, unfortunately, is most of them). */
+ { static char *words[] =
+ { "asm", "auto", "case", "char", "const", "double",
+ "extern", "float", "for", "if", "int", "long",
+ "register", "return", "short", "signed", "sizeof",
+ "static", "switch", "typedef", "unsigned",
+ "void", "volatile", "while", 0
+ };
+ char **key = words;
+ char *kp;
+ int len = endfn - buf;
+
+ while ( (kp = *key) != 0 )
+ { if ( strlen(kp) == len && !strncmp(kp, buf, len) )
+ return 0; /* name is a keyword */
+ key++;
+ }
+ }
+ return contin;
+}
+
+/* Convert a recognized function definition or header to K&R syntax. */
+int
+convert1(buf, out, header, convert_varargs)
+ char *buf;
+ FILE *out;
+ int header; /* Boolean */
+ int convert_varargs; /* Boolean */
+{ char *endfn;
+ register char *p;
+ /*
+ * The breaks table contains pointers to the beginning and end
+ * of each argument.
+ */
+ char **breaks;
+ unsigned num_breaks = 2; /* for testing */
+ char **btop;
+ char **bp;
+ char **ap;
+ char *vararg = 0;
+
+ /* Pre-ANSI implementations don't agree on whether strchr */
+ /* is called strchr or index, so we open-code it here. */
+ for ( endfn = buf; *(endfn++) != '('; )
+ ;
+top: p = endfn;
+ breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
+ if ( breaks == 0 )
+ { /* Couldn't allocate break table, give up */
+ fprintf(stderr, "Unable to allocate break table!\n");
+ fputs(buf, out);
+ return -1;
+ }
+ btop = breaks + num_breaks * 2 - 2;
+ bp = breaks;
+ /* Parse the argument list */
+ do
+ { int level = 0;
+ char *lp = NULL;
+ char *rp;
+ char *end = NULL;
+
+ if ( bp >= btop )
+ { /* Filled up break table. */
+ /* Allocate a bigger one and start over. */
+ free((char *)breaks);
+ num_breaks <<= 1;
+ goto top;
+ }
+ *bp++ = p;
+ /* Find the end of the argument */
+ for ( ; end == NULL; p++ )
+ { switch(*p)
+ {
+ case ',':
+ if ( !level ) end = p;
+ break;
+ case '(':
+ if ( !level ) lp = p;
+ level++;
+ break;
+ case ')':
+ if ( --level < 0 ) end = p;
+ else rp = p;
+ break;
+ case '/':
+ p = skipspace(p, 1) - 1;
+ break;
+ default:
+ ;
+ }
+ }
+ /* Erase any embedded prototype parameters. */
+ if ( lp )
+ writeblanks(lp + 1, rp);
+ p--; /* back up over terminator */
+ /* Find the name being declared. */
+ /* This is complicated because of procedure and */
+ /* array modifiers. */
+ for ( ; ; )
+ { p = skipspace(p - 1, -1);
+ switch ( *p )
+ {
+ case ']': /* skip array dimension(s) */
+ case ')': /* skip procedure args OR name */
+ { int level = 1;
+ while ( level )
+ switch ( *--p )
+ {
+ case ']': case ')': level++; break;
+ case '[': case '(': level--; break;
+ case '/': p = skipspace(p, -1) + 1; break;
+ default: ;
+ }
+ }
+ if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
+ { /* We found the name being declared */
+ while ( !isidfirstchar(*p) )
+ p = skipspace(p, 1) + 1;
+ goto found;
+ }
+ break;
+ default:
+ goto found;
+ }
+ }
+found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
+ { if ( convert_varargs )
+ { *bp++ = "va_alist";
+ vararg = p-2;
+ }
+ else
+ { p++;
+ if ( bp == breaks + 1 ) /* sole argument */
+ writeblanks(breaks[0], p);
+ else
+ writeblanks(bp[-1] - 1, p);
+ bp--;
+ }
+ }
+ else
+ { while ( isidchar(*p) ) p--;
+ *bp++ = p+1;
+ }
+ p = end;
+ }
+ while ( *p++ == ',' );
+ *bp = p;
+ /* Make a special check for 'void' arglist */
+ if ( bp == breaks+2 )
+ { p = skipspace(breaks[0], 1);
+ if ( !strncmp(p, "void", 4) )
+ { p = skipspace(p+4, 1);
+ if ( p == breaks[2] - 1 )
+ { bp = breaks; /* yup, pretend arglist is empty */
+ writeblanks(breaks[0], p + 1);
+ }
+ }
+ }
+ /* Put out the function name and left parenthesis. */
+ p = buf;
+ while ( p != endfn ) putc(*p, out), p++;
+ /* Put out the declaration. */
+ if ( header )
+ { fputs(");", out);
+ for ( p = breaks[0]; *p; p++ )
+ if ( *p == '\r' || *p == '\n' )
+ putc(*p, out);
+ }
+ else
+ { for ( ap = breaks+1; ap < bp; ap += 2 )
+ { p = *ap;
+ while ( isidchar(*p) )
+ putc(*p, out), p++;
+ if ( ap < bp - 1 )
+ fputs(", ", out);
+ }
+ fputs(") ", out);
+ /* Put out the argument declarations */
+ for ( ap = breaks+2; ap <= bp; ap += 2 )
+ (*ap)[-1] = ';';
+ if ( vararg != 0 )
+ { *vararg = 0;
+ fputs(breaks[0], out); /* any prior args */
+ fputs("va_dcl", out); /* the final arg */
+ fputs(bp[0], out);
+ }
+ else
+ fputs(breaks[0], out);
+ }
+ free((char *)breaks);
+ return 0;
+}
diff --git a/lib/error.c b/lib/error.c
new file mode 100644
index 0000000..8b96b91
--- /dev/null
+++ b/lib/error.c
@@ -0,0 +1,210 @@
+/* error.c -- error handler for noninteractive utilities
+ Copyright (C) 1990, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC || defined(__cplusplus)
+# if __STDC__ || defined(__cplusplus)
+# include <stdarg.h>
+# define VA_START(args, lastarg) va_start(args, lastarg)
+# else
+# include <varargs.h>
+# define VA_START(args, lastarg) va_start(args)
+# endif
+#else
+# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
+# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
+#endif
+
+#if STDC_HEADERS || _LIBC
+# include <stdlib.h>
+# include <string.h>
+#else
+void exit ();
+#endif
+
+#ifndef _
+# define _(String) String
+#endif
+
+/* If NULL, error will flush stdout, then print on stderr the program
+ name, a colon and a space. Otherwise, error will call this
+ function without parameters instead. */
+void (*error_print_progname) (
+#if __STDC__ - 0
+ void
+#endif
+ );
+
+/* This variable is incremented each time `error' is called. */
+unsigned int error_message_count;
+
+#ifdef _LIBC
+/* In the GNU C library, there is a predefined variable for this. */
+
+# define program_name program_invocation_name
+# include <errno.h>
+
+#else
+
+/* The calling program should define program_name and set it to the
+ name of the executing program. */
+extern char *program_name;
+
+# if HAVE_STRERROR
+# ifndef strerror /* On some systems, strerror is a macro */
+char *strerror ();
+# endif
+# else
+static char *
+private_strerror (errnum)
+ int errnum;
+{
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+
+ if (errnum > 0 && errnum <= sys_nerr)
+ return sys_errlist[errnum];
+ return _("Unknown system error");
+}
+# define strerror private_strerror
+# endif /* HAVE_STRERROR */
+#endif /* _LIBC */
+
+/* Print the program name and error message MESSAGE, which is a printf-style
+ format string with optional args.
+ If ERRNUM is nonzero, print its corresponding system error message.
+ Exit with status STATUS if it is nonzero. */
+/* VARARGS */
+
+void
+#if defined(VA_START) && __STDC__
+error (int status, int errnum, const char *message, ...)
+#else
+error (status, errnum, message, va_alist)
+ int status;
+ int errnum;
+ char *message;
+ va_dcl
+#endif
+{
+#if defined(VA_START)
+ va_list args;
+#endif
+
+ if (error_print_progname)
+ (*error_print_progname) ();
+ else
+ {
+ fflush (stdout);
+ fprintf (stderr, "%s: ", program_name);
+ }
+
+#if defined(VA_START)
+ VA_START(args, message);
+# if HAVE_VPRINTF || _LIBC
+ vfprintf (stderr, message, args);
+# else
+ _doprnt (message, args, stderr);
+# endif
+ va_end (args);
+#else
+ fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
+#endif
+
+ ++error_message_count;
+ if (errnum)
+ fprintf (stderr, ": %s", strerror (errnum));
+ putc ('\n', stderr);
+ fflush (stderr);
+ if (status)
+ exit (status);
+}
+
+/* Sometimes we want to have at most one error per line. This
+ variable controls whether this mode is selected or not. */
+int error_one_per_line;
+
+void
+#if defined(VA_START) && __STDC__
+error_at_line (int status, int errnum, const char *file_name,
+ unsigned int line_number, const char *message, ...)
+#else
+error_at_line (status, errnum, file_name, line_number, message, va_alist)
+ int status;
+ int errnum;
+ const char *file_name;
+ unsigned int line_number;
+ char *message;
+ va_dcl
+#endif
+{
+#ifdef VA_START
+ va_list args;
+#endif
+
+ if (error_one_per_line)
+ {
+ static const char *old_file_name;
+ static unsigned int old_line_number;
+
+ if (old_line_number == line_number &&
+ (file_name == old_file_name || !strcmp (old_file_name, file_name)))
+ /* Simply return and print nothing. */
+ return;
+
+ old_file_name = file_name;
+ old_line_number = line_number;
+ }
+
+ if (error_print_progname)
+ (*error_print_progname) ();
+ else
+ {
+ fflush (stdout);
+ fprintf (stderr, "%s:", program_name);
+ }
+
+ if (file_name != NULL)
+ fprintf (stderr, "%s:%d: ", file_name, line_number);
+
+#ifdef VA_START
+ VA_START (args, message);
+# if HAVE_VPRINTF || _LIBC
+ vfprintf (stderr, message, args);
+# else
+ _doprnt (message, args, stderr);
+# endif
+ va_end (args);
+#else
+ fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
+#endif
+
+ ++error_message_count;
+ if (errnum)
+ fprintf (stderr, ": %s", strerror (errnum));
+ putc ('\n', stderr);
+ fflush (stderr);
+ if (status)
+ exit (status);
+}
diff --git a/lib/error.h b/lib/error.h
new file mode 100644
index 0000000..3439f37
--- /dev/null
+++ b/lib/error.h
@@ -0,0 +1,65 @@
+/* error.h -- declaration for error-reporting function
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef _error_h_
+#define _error_h_
+
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+# define __attribute__(Spec) /* empty */
+# endif
+/* The __-protected variants of `format' and `printf' attributes
+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __format__ format
+# define __printf__ printf
+# endif
+#endif
+
+#if defined (__STDC__) && __STDC__
+
+/* Print a message with `fprintf (stderr, FORMAT, ...)';
+ if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+ If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
+
+extern void error (int status, int errnum, const char *format, ...)
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+
+extern void error_at_line (int status, int errnum, const char *fname,
+ unsigned int lineno, const char *format, ...)
+ __attribute__ ((__format__ (__printf__, 5, 6)));
+
+/* If NULL, error will flush stdout, then print on stderr the program
+ name, a colon and a space. Otherwise, error will call this
+ function without parameters instead. */
+extern void (*error_print_progname) (void);
+
+#else
+void error ();
+void error_at_line ();
+extern void (*error_print_progname) ();
+#endif
+
+/* This variable is incremented each time `error' is called. */
+extern unsigned int error_message_count;
+
+/* Sometimes we want to have at most one error per line. This
+ variable controls whether this mode is selected or not. */
+extern int error_one_per_line;
+
+#endif /* _error_h_ */
diff --git a/lib/getopt.c b/lib/getopt.c
new file mode 100644
index 0000000..8bcf559
--- /dev/null
+++ b/lib/getopt.c
@@ -0,0 +1,770 @@
+/* Getopt for GNU.
+ NOTE: getopt is now part of the C library, so if you don't know what
+ "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
+ before changing it!
+
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95
+ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+ Ditto for AIX 3.2 and <stdlib.h>. */
+#ifndef _NO_PROTO
+#define _NO_PROTO
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#if !defined (__STDC__) || !__STDC__
+/* This is a separate conditional since some stdc systems
+ reject `defined (const)'. */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+ actually compiling the library itself. This code is part of the GNU C
+ Library, but also included in many other GNU distributions. Compiling
+ and linking in this code is a waste when using the GNU C library
+ (especially if it is a shared library). Rather than having every GNU
+ program understand `configure --with-gnu-libc' and omit the object files,
+ it is simpler to just do this in the source for each such file. */
+
+#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+
+
+/* This needs to come after some library #include
+ to get __GNU_LIBRARY__ defined. */
+#ifdef __GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+ contain conflicting prototypes for getopt. */
+#include <stdlib.h>
+#endif /* GNU C library. */
+
+#ifndef _
+/* This is for other GNU distributions with internationalized messages.
+ When compiling libc, the _ macro is predefined. */
+#ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+# define _(msgid) gettext (msgid)
+#else
+# define _(msgid) (msgid)
+#endif
+#endif
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+ but it behaves differently for the user, since it allows the user
+ to intersperse the options with the other arguments.
+
+ As `getopt' works, it permutes the elements of ARGV so that,
+ when it is done, all the options precede everything else. Thus
+ all application programs are extended to handle flexible argument order.
+
+ Setting the environment variable POSIXLY_CORRECT disables permutation.
+ Then the behavior is completely standard.
+
+ GNU application programs can use a third alternative mode in which
+ they can distinguish the relative order of options and other arguments. */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+ When `getopt' finds an option that takes an argument,
+ the argument value is returned here.
+ Also, when `ordering' is RETURN_IN_ORDER,
+ each non-option ARGV-element is returned here. */
+
+char *optarg = NULL;
+
+/* Index in ARGV of the next element to be scanned.
+ This is used for communication to and from the caller
+ and for communication between successive calls to `getopt'.
+
+ On entry to `getopt', zero means this is the first call; initialize.
+
+ When `getopt' returns EOF, this is the index of the first of the
+ non-option elements that the caller should itself scan.
+
+ Otherwise, `optind' communicates from one call to the next
+ how much of ARGV has been scanned so far. */
+
+/* XXX 1003.2 says this must be 1 before any call. */
+int optind = 0;
+
+/* The next char to be scanned in the option-element
+ in which the last option character we returned was found.
+ This allows us to pick up the scan where we left off.
+
+ If this is zero, or a null string, it means resume the scan
+ by advancing to the next ARGV-element. */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+ for unrecognized options. */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+ This must be initialized on some systems to avoid linking in the
+ system's own getopt implementation. */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+ If the caller did not specify anything,
+ the default is REQUIRE_ORDER if the environment variable
+ POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+ REQUIRE_ORDER means don't recognize them as options;
+ stop option processing when the first non-option is seen.
+ This is what Unix does.
+ This mode of operation is selected by either setting the environment
+ variable POSIXLY_CORRECT, or using `+' as the first character
+ of the list of option characters.
+
+ PERMUTE is the default. We permute the contents of ARGV as we scan,
+ so that eventually all the non-options are at the end. This allows options
+ to be given in any order, even with programs that were not written to
+ expect this.
+
+ RETURN_IN_ORDER is an option available to programs that were written
+ to expect options and other ARGV-elements in any order and that care about
+ the ordering of the two. We describe each non-option ARGV-element
+ as if it were the argument of an option with character code 1.
+ Using `-' as the first character of the list of option characters
+ selects this mode of operation.
+
+ The special argument `--' forces an end of option-scanning regardless
+ of the value of `ordering'. In the case of RETURN_IN_ORDER, only
+ `--' can cause `getopt' to return EOF with `optind' != ARGC. */
+
+static enum
+{
+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+/* Value of POSIXLY_CORRECT environment variable. */
+static char *posixly_correct;
+
+#ifdef __GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+ because there are many ways it can cause trouble.
+ On some systems, it contains special magic macros that don't work
+ in GCC. */
+#include <string.h>
+#define my_index strchr
+#else
+
+/* Avoid depending on library functions or files
+ whose names are inconsistent. */
+
+char *getenv ();
+
+static char *
+my_index (str, chr)
+ const char *str;
+ int chr;
+{
+ while (*str)
+ {
+ if (*str == chr)
+ return (char *) str;
+ str++;
+ }
+ return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+ If not using GCC, it is ok not to declare it. */
+#ifdef __GNUC__
+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+ That was relevant to code that was here before. */
+#if !defined (__STDC__) || !__STDC__
+/* gcc with -traditional declares the built-in strlen to return int,
+ and has done so at least since version 2.4.5. -- rms. */
+extern int strlen (const char *);
+#endif /* not __STDC__ */
+#endif /* __GNUC__ */
+
+#endif /* not __GNU_LIBRARY__ */
+
+/* Handle permutation of arguments. */
+
+/* Describe the part of ARGV that contains non-options that have
+ been skipped. `first_nonopt' is the index in ARGV of the first of them;
+ `last_nonopt' is the index after the last of them. */
+
+static int first_nonopt;
+static int last_nonopt;
+
+/* Exchange two adjacent subsequences of ARGV.
+ One subsequence is elements [first_nonopt,last_nonopt)
+ which contains all the non-options that have been skipped so far.
+ The other is elements [last_nonopt,optind), which contains all
+ the options processed since those non-options were skipped.
+
+ `first_nonopt' and `last_nonopt' are relocated so that they describe
+ the new indices of the non-options in ARGV after they are moved. */
+
+static void
+exchange (argv)
+ char **argv;
+{
+ int bottom = first_nonopt;
+ int middle = last_nonopt;
+ int top = optind;
+ char *tem;
+
+ /* Exchange the shorter segment with the far end of the longer segment.
+ That puts the shorter segment into the right place.
+ It leaves the longer segment in the right place overall,
+ but it consists of two parts that need to be swapped next. */
+
+ while (top > middle && middle > bottom)
+ {
+ if (top - middle > middle - bottom)
+ {
+ /* Bottom segment is the short one. */
+ int len = middle - bottom;
+ register int i;
+
+ /* Swap it with the top part of the top segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[top - (middle - bottom) + i];
+ argv[top - (middle - bottom) + i] = tem;
+ }
+ /* Exclude the moved bottom segment from further swapping. */
+ top -= len;
+ }
+ else
+ {
+ /* Top segment is the short one. */
+ int len = top - middle;
+ register int i;
+
+ /* Swap it with the bottom part of the bottom segment. */
+ for (i = 0; i < len; i++)
+ {
+ tem = argv[bottom + i];
+ argv[bottom + i] = argv[middle + i];
+ argv[middle + i] = tem;
+ }
+ /* Exclude the moved top segment from further swapping. */
+ bottom += len;
+ }
+ }
+
+ /* Update records for the slots the non-options now occupy. */
+
+ first_nonopt += (optind - last_nonopt);
+ last_nonopt = optind;
+}
+
+/* Initialize the internal data when the first call is made. */
+
+static const char *
+_getopt_initialize (optstring)
+ const char *optstring;
+{
+ /* Start processing options with ARGV-element 1 (since ARGV-element 0
+ is the program name); the sequence of previously skipped
+ non-option ARGV-elements is empty. */
+
+ first_nonopt = last_nonopt = optind = 1;
+
+ nextchar = NULL;
+
+ posixly_correct = getenv ("POSIXLY_CORRECT");
+
+ /* Determine how to handle the ordering of options and nonoptions. */
+
+ if (optstring[0] == '-')
+ {
+ ordering = RETURN_IN_ORDER;
+ ++optstring;
+ }
+ else if (optstring[0] == '+')
+ {
+ ordering = REQUIRE_ORDER;
+ ++optstring;
+ }
+ else if (posixly_correct != NULL)
+ ordering = REQUIRE_ORDER;
+ else
+ ordering = PERMUTE;
+
+ return optstring;
+}
+
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+ given in OPTSTRING.
+
+ If an element of ARGV starts with '-', and is not exactly "-" or "--",
+ then it is an option element. The characters of this element
+ (aside from the initial '-') are option characters. If `getopt'
+ is called repeatedly, it returns successively each of the option characters
+ from each of the option elements.
+
+ If `getopt' finds another option character, it returns that character,
+ updating `optind' and `nextchar' so that the next call to `getopt' can
+ resume the scan with the following option character or ARGV-element.
+
+ If there are no more option characters, `getopt' returns `EOF'.
+ Then `optind' is the index in ARGV of the first ARGV-element
+ that is not an option. (The ARGV-elements have been permuted
+ so that those that are not options now come last.)
+
+ OPTSTRING is a string containing the legitimate option characters.
+ If an option character is seen that is not listed in OPTSTRING,
+ return '?' after printing an error message. If you set `opterr' to
+ zero, the error message is suppressed but we still return '?'.
+
+ If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+ so the following text in the same ARGV-element, or the text of the following
+ ARGV-element, is returned in `optarg'. Two colons mean an option that
+ wants an optional arg; if there is text in the current ARGV-element,
+ it is returned in `optarg', otherwise `optarg' is set to zero.
+
+ If OPTSTRING starts with `-' or `+', it requests different methods of
+ handling the non-option ARGV-elements.
+ See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+ Long-named options begin with `--' instead of `-'.
+ Their names may be abbreviated as long as the abbreviation is unique
+ or is an exact match for some defined option. If they have an
+ argument, it follows the option name in the same ARGV-element, separated
+ from the option name by a `=', or else the in next ARGV-element.
+ When `getopt' finds a long-named option, it returns 0 if that option's
+ `flag' field is nonzero, the value of the option's `val' field
+ if the `flag' field is zero.
+
+ The elements of ARGV aren't really const, because we permute them.
+ But we pretend they're const in the prototype to be compatible
+ with other systems.
+
+ LONGOPTS is a vector of `struct option' terminated by an
+ element containing a name which is zero.
+
+ LONGIND returns the index in LONGOPT of the long-named option found.
+ It is only valid when a long-named option has been found by the most
+ recent call.
+
+ If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+ long-named options. */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+ int argc;
+ char *const *argv;
+ const char *optstring;
+ const struct option *longopts;
+ int *longind;
+ int long_only;
+{
+ optarg = NULL;
+
+ if (optind == 0)
+ {
+ optstring = _getopt_initialize (optstring);
+ optind = 1; /* Don't scan ARGV[0], the program name. */
+ }
+
+ if (nextchar == NULL || *nextchar == '\0')
+ {
+ /* Advance to the next ARGV-element. */
+
+ if (ordering == PERMUTE)
+ {
+ /* If we have just processed some options following some non-options,
+ exchange them so that the options come first. */
+
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (last_nonopt != optind)
+ first_nonopt = optind;
+
+ /* Skip any additional non-options
+ and extend the range of non-options previously skipped. */
+
+ while (optind < argc
+ && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
+ optind++;
+ last_nonopt = optind;
+ }
+
+ /* The special ARGV-element `--' means premature end of options.
+ Skip it like a null option,
+ then exchange with previous non-options as if it were an option,
+ then skip everything else like a non-option. */
+
+ if (optind != argc && !strcmp (argv[optind], "--"))
+ {
+ optind++;
+
+ if (first_nonopt != last_nonopt && last_nonopt != optind)
+ exchange ((char **) argv);
+ else if (first_nonopt == last_nonopt)
+ first_nonopt = optind;
+ last_nonopt = argc;
+
+ optind = argc;
+ }
+
+ /* If we have done all the ARGV-elements, stop the scan
+ and back over any non-options that we skipped and permuted. */
+
+ if (optind == argc)
+ {
+ /* Set the next-arg-index to point at the non-options
+ that we previously skipped, so the caller will digest them. */
+ if (first_nonopt != last_nonopt)
+ optind = first_nonopt;
+ return EOF;
+ }
+
+ /* If we have come to a non-option and did not permute it,
+ either stop the scan or describe it to the caller and pass it by. */
+
+ if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
+ {
+ if (ordering == REQUIRE_ORDER)
+ return EOF;
+ optarg = argv[optind++];
+ return 1;
+ }
+
+ /* We have found another option-ARGV-element.
+ Skip the initial punctuation. */
+
+ nextchar = (argv[optind] + 1
+ + (longopts != NULL && argv[optind][1] == '-'));
+ }
+
+ /* Decode the current option-ARGV-element. */
+
+ /* Check whether the ARGV-element is a long option.
+
+ If long_only and the ARGV-element has the form "-f", where f is
+ a valid short option, don't consider it an abbreviated form of
+ a long option that starts with f. Otherwise there would be no
+ way to give the -f short option.
+
+ On the other hand, if there's a long option "fubar" and
+ the ARGV-element is "-fu", do consider that an abbreviation of
+ the long option, just like "--fu", and not "-f" with arg "u".
+
+ This distinction seems to be the most useful approach. */
+
+ if (longopts != NULL
+ && (argv[optind][1] == '-'
+ || (long_only && (argv[optind][2]
+ || !my_index (optstring, argv[optind][1])))))
+ {
+ char *nameend;
+ const struct option *p;
+ const struct option *pfound = NULL;
+ int exact = 0;
+ int ambig = 0;
+ int indfound;
+ int option_index;
+
+ for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+ /* Do nothing. */ ;
+
+#ifdef lint
+ indfound = 0; /* Avoid spurious compiler warning. */
+#endif
+
+ /* Test all long options for either exact match
+ or abbreviated matches. */
+ for (p = longopts, option_index = 0; p->name; p++, option_index++)
+ if (!strncmp (p->name, nextchar, nameend - nextchar))
+ {
+ if (nameend - nextchar == strlen (p->name))
+ {
+ /* Exact match found. */
+ pfound = p;
+ indfound = option_index;
+ exact = 1;
+ break;
+ }
+ else if (pfound == NULL)
+ {
+ /* First nonexact match found. */
+ pfound = p;
+ indfound = option_index;
+ }
+ else
+ /* Second or later nonexact match found. */
+ ambig = 1;
+ }
+
+ if (ambig && !exact)
+ {
+ if (opterr)
+ fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+ argv[0], argv[optind]);
+ nextchar += strlen (nextchar);
+ optind++;
+ return '?';
+ }
+
+ if (pfound != NULL)
+ {
+ option_index = indfound;
+ optind++;
+ if (*nameend)
+ {
+ /* Don't test has_arg with >, because some C compilers don't
+ allow it to be used on enums. */
+ if (pfound->has_arg)
+ optarg = nameend + 1;
+ else
+ {
+ if (opterr)
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ _("%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ _("%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+
+ nextchar += strlen (nextchar);
+ return '?';
+ }
+ }
+ else if (pfound->has_arg == 1)
+ {
+ if (optind < argc)
+ optarg = argv[optind++];
+ else
+ {
+ if (opterr)
+ fprintf (stderr,
+ _("%s: option `%s' requires an argument\n"),
+ argv[0], argv[optind - 1]);
+ nextchar += strlen (nextchar);
+ return optstring[0] == ':' ? ':' : '?';
+ }
+ }
+ nextchar += strlen (nextchar);
+ if (longind != NULL)
+ *longind = option_index;
+ if (pfound->flag)
+ {
+ *(pfound->flag) = pfound->val;
+ return 0;
+ }
+ return pfound->val;
+ }
+
+ /* Can't find it as a long option. If this is not getopt_long_only,
+ or the option starts with '--' or is not a valid short
+ option, then it's an error.
+ Otherwise interpret it as a short option. */
+ if (!long_only || argv[optind][1] == '-'
+ || my_index (optstring, *nextchar) == NULL)
+ {
+ if (opterr)
+ {
+ if (argv[optind][1] == '-')
+ /* --option */
+ fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+ argv[0], nextchar);
+ else
+ /* +option or -option */
+ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+ argv[0], argv[optind][0], nextchar);
+ }
+ nextchar = (char *) "";
+ optind++;
+ return '?';
+ }
+ }
+
+ /* Look at and handle the next short option-character. */
+
+ {
+ char c = *nextchar++;
+ char *temp = my_index (optstring, c);
+
+ /* Increment `optind' when we start to process its last character. */
+ if (*nextchar == '\0')
+ ++optind;
+
+ if (temp == NULL || c == ':')
+ {
+ if (opterr)
+ {
+ if (posixly_correct)
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr, _("%s: illegal option -- %c\n"),
+ argv[0], c);
+ else
+ fprintf (stderr, _("%s: invalid option -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ return '?';
+ }
+ if (temp[1] == ':')
+ {
+ if (temp[2] == ':')
+ {
+ /* This is an option that accepts an argument optionally. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ optind++;
+ }
+ else
+ optarg = NULL;
+ nextchar = NULL;
+ }
+ else
+ {
+ /* This is an option that requires an argument. */
+ if (*nextchar != '\0')
+ {
+ optarg = nextchar;
+ /* If we end this ARGV-element by taking the rest as an arg,
+ we must advance to the next element now. */
+ optind++;
+ }
+ else if (optind == argc)
+ {
+ if (opterr)
+ {
+ /* 1003.2 specifies the format of this message. */
+ fprintf (stderr,
+ _("%s: option requires an argument -- %c\n"),
+ argv[0], c);
+ }
+ optopt = c;
+ if (optstring[0] == ':')
+ c = ':';
+ else
+ c = '?';
+ }
+ else
+ /* We already incremented `optind' once;
+ increment it again when taking next ARGV-elt as argument. */
+ optarg = argv[optind++];
+ nextchar = NULL;
+ }
+ }
+ return c;
+ }
+}
+
+int
+getopt (argc, argv, optstring)
+ int argc;
+ char *const *argv;
+ const char *optstring;
+{
+ return _getopt_internal (argc, argv, optstring,
+ (const struct option *) 0,
+ (int *) 0,
+ 0);
+}
+
+#endif /* _LIBC or not __GNU_LIBRARY__. */
+
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+ the above definition of `getopt'. */
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ int c;
+ int digit_optind = 0;
+
+ while (1)
+ {
+ int this_option_optind = optind ? optind : 1;
+
+ c = getopt (argc, argv, "abc:d:0123456789");
+ if (c == EOF)
+ break;
+
+ switch (c)
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
+ }
+
+ if (optind < argc)
+ {
+ printf ("non-option ARGV-elements: ");
+ while (optind < argc)
+ printf ("%s ", argv[optind++]);
+ printf ("\n");
+ }
+
+ exit (0);
+}
+
+#endif /* TEST */
diff --git a/lib/getopt.h b/lib/getopt.h
new file mode 100644
index 0000000..4ac33b7
--- /dev/null
+++ b/lib/getopt.h
@@ -0,0 +1,129 @@
+/* Declarations for getopt.
+ Copyright (C) 1989, 90, 91, 92, 93, 94 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#ifndef _GETOPT_H
+#define _GETOPT_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+ When `getopt' finds an option that takes an argument,
+ the argument value is returned here.
+ Also, when `ordering' is RETURN_IN_ORDER,
+ each non-option ARGV-element is returned here. */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+ This is used for communication to and from the caller
+ and for communication between successive calls to `getopt'.
+
+ On entry to `getopt', zero means this is the first call; initialize.
+
+ When `getopt' returns EOF, this is the index of the first of the
+ non-option elements that the caller should itself scan.
+
+ Otherwise, `optind' communicates from one call to the next
+ how much of ARGV has been scanned so far. */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+ for unrecognized options. */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized. */
+
+extern int optopt;
+
+/* Describe the long-named options requested by the application.
+ The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+ of `struct option' terminated by an element containing a name which is
+ zero.
+
+ The field `has_arg' is:
+ no_argument (or 0) if the option does not take an argument,
+ required_argument (or 1) if the option requires an argument,
+ optional_argument (or 2) if the option takes an optional argument.
+
+ If the field `flag' is not NULL, it points to a variable that is set
+ to the value given in the field `val' when the option is found, but
+ left unchanged if the option is not found.
+
+ To have a long-named option do something other than set an `int' to
+ a compiled-in constant, such as set a value from `optarg', set the
+ option's `flag' field to zero and its `val' field to a nonzero
+ value (the equivalent single-letter option character, if there is
+ one). For long options that have a zero `flag' field, `getopt'
+ returns the contents of the `val' field. */
+
+struct option
+{
+#if defined (__STDC__) && __STDC__
+ const char *name;
+#else
+ char *name;
+#endif
+ /* has_arg can't be an enum because some compilers complain about
+ type mismatches in all the code that assumes it is an int. */
+ int has_arg;
+ int *flag;
+ int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'. */
+
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+#if defined (__STDC__) && __STDC__
+#ifdef __GNU_LIBRARY__
+/* Many other libraries have conflicting prototypes for getopt, with
+ differences in the consts, in stdlib.h. To avoid compilation
+ errors, only prototype getopt for the GNU C library. */
+extern int getopt (int argc, char *const *argv, const char *shortopts);
+#else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+#endif /* __GNU_LIBRARY__ */
+extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+ const struct option *longopts, int *longind);
+extern int getopt_long_only (int argc, char *const *argv,
+ const char *shortopts,
+ const struct option *longopts, int *longind);
+
+/* Internal only. Users should not call this directly. */
+extern int _getopt_internal (int argc, char *const *argv,
+ const char *shortopts,
+ const struct option *longopts, int *longind,
+ int long_only);
+#else /* not __STDC__ */
+extern int getopt ();
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GETOPT_H */
diff --git a/lib/getopt1.c b/lib/getopt1.c
new file mode 100644
index 0000000..4580211
--- /dev/null
+++ b/lib/getopt1.c
@@ -0,0 +1,180 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
+ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "getopt.h"
+
+#if !defined (__STDC__) || !__STDC__
+/* This is a separate conditional since some stdc systems
+ reject `defined (const)'. */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+ actually compiling the library itself. This code is part of the GNU C
+ Library, but also included in many other GNU distributions. Compiling
+ and linking in this code is a waste when using the GNU C library
+ (especially if it is a shared library). Rather than having every GNU
+ program understand `configure --with-gnu-libc' and omit the object files,
+ it is simpler to just do this in the source for each such file. */
+
+#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+
+
+/* This needs to come after some library #include
+ to get __GNU_LIBRARY__ defined. */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#else
+char *getenv ();
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+ int argc;
+ char *const *argv;
+ const char *options;
+ const struct option *long_options;
+ int *opt_index;
+{
+ return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+ If an option that starts with '-' (not '--') doesn't match a long option,
+ but does match a short option, it is parsed as a short option
+ instead. */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+ int argc;
+ char *const *argv;
+ const char *options;
+ const struct option *long_options;
+ int *opt_index;
+{
+ return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+
+#endif /* _LIBC or not __GNU_LIBRARY__. */
+
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ int c;
+ int digit_optind = 0;
+
+ while (1)
+ {
+ int this_option_optind = optind ? optind : 1;
+ int option_index = 0;
+ static struct option long_options[] =
+ {
+ {"add", 1, 0, 0},
+ {"append", 0, 0, 0},
+ {"delete", 1, 0, 0},
+ {"verbose", 0, 0, 0},
+ {"create", 0, 0, 0},
+ {"file", 1, 0, 0},
+ {0, 0, 0, 0}
+ };
+
+ c = getopt_long (argc, argv, "abc:d:0123456789",
+ long_options, &option_index);
+ if (c == EOF)
+ break;
+
+ switch (c)
+ {
+ case 0:
+ printf ("option %s", long_options[option_index].name);
+ if (optarg)
+ printf (" with arg %s", optarg);
+ printf ("\n");
+ break;
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (digit_optind != 0 && digit_optind != this_option_optind)
+ printf ("digits occur in two different argv-elements.\n");
+ digit_optind = this_option_optind;
+ printf ("option %c\n", c);
+ break;
+
+ case 'a':
+ printf ("option a\n");
+ break;
+
+ case 'b':
+ printf ("option b\n");
+ break;
+
+ case 'c':
+ printf ("option c with value `%s'\n", optarg);
+ break;
+
+ case 'd':
+ printf ("option d with value `%s'\n", optarg);
+ break;
+
+ case '?':
+ break;
+
+ default:
+ printf ("?? getopt returned character code 0%o ??\n", c);
+ }
+ }
+
+ if (optind < argc)
+ {
+ printf ("non-option ARGV-elements: ");
+ while (optind < argc)
+ printf ("%s ", argv[optind++]);
+ printf ("\n");
+ }
+
+ exit (0);
+}
+
+#endif /* TEST */
diff --git a/lib/long-options.c b/lib/long-options.c
new file mode 100644
index 0000000..fe069fd
--- /dev/null
+++ b/lib/long-options.c
@@ -0,0 +1,83 @@
+/* Utility to accept --help and --version options as unobtrusively as possible.
+ Copyright (C) 1993, 1994 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Jim Meyering (meyering@comco.com) */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <getopt.h>
+#include "long-options.h"
+
+static struct option const long_options[] =
+{
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+};
+
+/* Process long options --help and --version, but only if argc == 2.
+ Be careful not to gobble up `--'. */
+#ifdef __cplusplus
+void parse_long_options (int argc, char **argv,
+ void (*version)(void), void (*usage)(int))
+#else
+void
+parse_long_options (argc, argv,version, usage)
+ int argc;
+ char **argv;
+ void (*version)();
+ void (*usage)();
+#endif
+{
+ int c;
+ int saved_opterr;
+ int saved_optind;
+
+ saved_opterr = opterr;
+ saved_optind = optind;
+
+ /* Don't print an error message for unrecognized options. */
+ opterr = 0;
+
+ if (argc == 2
+ && (c = getopt_long (argc, argv, "+", long_options, (int *) 0)) != EOF)
+ {
+ switch (c)
+ {
+ case 'h':
+ (*usage) (0);
+
+ case 'v':
+ (*version) ();
+ /* printf ("%s (%s) %s\n", command_name, package, version_string); */
+ exit (0);
+
+ default:
+ /* Don't process any other long-named options. */
+ break;
+ }
+ }
+
+ /* Restore previous value. */
+ opterr = saved_opterr;
+
+ /* Restore optind in case it has advanced past a leading `--'. */
+ optind = saved_optind;
+}
diff --git a/lib/long-options.h b/lib/long-options.h
new file mode 100644
index 0000000..14459cd
--- /dev/null
+++ b/lib/long-options.h
@@ -0,0 +1,10 @@
+#undef __P
+#if defined (__STDC__) && __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+
+void parse_long_options __P ((int _argc, char **_argv,
+ void (*_version) (void),
+ void (*_usage) (int)));
diff --git a/lib/mkdir.c b/lib/mkdir.c
new file mode 100644
index 0000000..efde52e
--- /dev/null
+++ b/lib/mkdir.c
@@ -0,0 +1,97 @@
+/* mkdir.c -- BSD compatible make directory function for System V
+ Copyright (C) 1988, 1990 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#ifdef STAT_MACROS_BROKEN
+#undef S_ISDIR
+#endif
+
+#if !defined(S_ISDIR) && defined(S_IFDIR)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+
+/* mkdir adapted from GNU tar. */
+
+/* Make directory DPATH, with permission mode DMODE.
+
+ Written by Robert Rother, Mariah Corporation, August 1985
+ (sdcsvax!rmr or rmr@uscd). If you want it, it's yours.
+
+ Severely hacked over by John Gilmore to make a 4.2BSD compatible
+ subroutine. 11Mar86; hoptoad!gnu
+
+ Modified by rmtodd@uokmax 6-28-87 -- when making an already existing dir,
+ subroutine didn't return EEXIST. It does now. */
+
+int
+mkdir (dpath, dmode)
+ char *dpath;
+ int dmode;
+{
+ int cpid, status;
+ struct stat statbuf;
+
+ if (stat (dpath, &statbuf) == 0)
+ {
+ errno = EEXIST; /* stat worked, so it already exists. */
+ return -1;
+ }
+
+ /* If stat fails for a reason other than non-existence, return error. */
+ if (errno != ENOENT)
+ return -1;
+
+ cpid = fork ();
+ switch (cpid)
+ {
+ case -1: /* Cannot fork. */
+ return -1; /* errno is already set. */
+
+ case 0: /* Child process. */
+ /* Cheap hack to set mode of new directory. Since this child
+ process is going away anyway, we zap its umask.
+ This won't suffice to set SUID, SGID, etc. on this
+ directory, so the parent process calls chmod afterward. */
+ status = umask (0); /* Get current umask. */
+ umask (status | (0777 & ~dmode)); /* Set for mkdir. */
+ execl ("/bin/mkdir", "mkdir", dpath, (char *) 0);
+ _exit (1);
+
+ default: /* Parent process. */
+ /* Wait for kid to finish. */
+ while (wait (&status) != cpid)
+ /* Do nothing. */ ;
+
+ if (status & 0xFFFF)
+ {
+ /* /bin/mkdir failed. */
+ errno = EIO;
+ return -1;
+ }
+ return chmod (dpath, dmode);
+ }
+}
diff --git a/lib/mktime.c b/lib/mktime.c
new file mode 100644
index 0000000..d7ce693
--- /dev/null
+++ b/lib/mktime.c
@@ -0,0 +1,529 @@
+/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Contributed by Noel Cragg (noel@cs.oberlin.edu), with fixes by
+ Michael E. Calwas (calwas@ttd.teradyne.com) and
+ Wade Hampton (tasi029@tmn.com).
+
+
+NOTE: The canonical source of this file is maintained with the GNU C Library.
+Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Define this to have a standalone program to test this implementation of
+ mktime. */
+/* #define DEBUG */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sys/types.h> /* Some systems define `time_t' here. */
+#include <time.h>
+
+
+#ifndef __isleap
+/* Nonzero if YEAR is a leap year (every 4 years,
+ except every 100th isn't, and every 400th is). */
+#define __isleap(year) \
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+#endif
+
+#ifndef __P
+#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif /* GCC. */
+#endif /* Not __P. */
+
+/* How many days are in each month. */
+const unsigned short int __mon_lengths[2][12] =
+ {
+ /* Normal years. */
+ { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+ /* Leap years. */
+ { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+ };
+
+
+static int times_through_search; /* This library routine should never
+ hang -- make sure we always return
+ when we're searching for a value */
+
+
+#ifdef DEBUG
+
+#include <stdio.h>
+#include <ctype.h>
+
+int debugging_enabled = 0;
+
+/* Print the values in a `struct tm'. */
+static void
+printtm (it)
+ struct tm *it;
+{
+ printf ("%02d/%02d/%04d %02d:%02d:%02d (%s) yday:%03d dst:%d gmtoffset:%ld",
+ it->tm_mon + 1,
+ it->tm_mday,
+ it->tm_year + 1900,
+ it->tm_hour,
+ it->tm_min,
+ it->tm_sec,
+ it->tm_zone,
+ it->tm_yday,
+ it->tm_isdst,
+ it->tm_gmtoff);
+}
+#endif
+
+
+static time_t
+dist_tm (t1, t2)
+ struct tm *t1;
+ struct tm *t2;
+{
+ time_t distance = 0;
+ unsigned long int v1, v2;
+ int diff_flag = 0;
+
+ v1 = v2 = 0;
+
+#define doit(x, secs) \
+ v1 += t1->x * secs; \
+ v2 += t2->x * secs; \
+ if (!diff_flag) \
+ { \
+ if (t1->x < t2->x) \
+ diff_flag = -1; \
+ else if (t1->x > t2->x) \
+ diff_flag = 1; \
+ }
+
+ doit (tm_year, 31536000); /* Okay, not all years have 365 days. */
+ doit (tm_mon, 2592000); /* Okay, not all months have 30 days. */
+ doit (tm_mday, 86400);
+ doit (tm_hour, 3600);
+ doit (tm_min, 60);
+ doit (tm_sec, 1);
+
+#undef doit
+
+ /* We should also make sure that the sign of DISTANCE is correct -- if
+ DIFF_FLAG is positive, the distance should be positive and vice versa. */
+
+ distance = (v1 > v2) ? (v1 - v2) : (v2 - v1);
+ if (diff_flag < 0)
+ distance = -distance;
+
+ if (times_through_search > 20) /* Arbitrary # of calls, but makes sure we
+ never hang if there's a problem with
+ this algorithm. */
+ {
+ distance = diff_flag;
+ }
+
+ /* We need this DIFF_FLAG business because it is forseeable that the
+ distance may be zero when, in actuality, the two structures are
+ different. This is usually the case when the dates are 366 days apart
+ and one of the years is a leap year. */
+
+ if (distance == 0 && diff_flag)
+ distance = 86400 * diff_flag;
+
+ return distance;
+}
+
+
+/* MKTIME converts the values in a struct tm to a time_t. The values
+ in tm_wday and tm_yday are ignored; other values can be put outside
+ of legal ranges since they will be normalized. This routine takes
+ care of that normalization. */
+
+void
+do_normalization (tmptr)
+ struct tm *tmptr;
+{
+
+#define normalize(foo,x,y,bar); \
+ while (tmptr->foo < x) \
+ { \
+ tmptr->bar--; \
+ tmptr->foo = (y - (x - tmptr->foo) + 1); \
+ } \
+ while (tmptr->foo > y) \
+ { \
+ tmptr->foo = (x + (tmptr->foo - y) - 1); \
+ tmptr->bar++; \
+ }
+
+ normalize (tm_sec, 0, 59, tm_min);
+ normalize (tm_min, 0, 59, tm_hour);
+ normalize (tm_hour, 0, 23, tm_mday);
+
+ /* Do the month first, so day range can be found. */
+ normalize (tm_mon, 0, 11, tm_year);
+
+ /* Since the day range modifies the month, we should be careful how
+ we reference the array of month lengths -- it is possible that
+ the month will go negative, hence the modulo...
+
+ Also, tm_year is the year - 1900, so we have to 1900 to have it
+ work correctly. */
+
+ normalize (tm_mday, 1,
+ __mon_lengths[__isleap (tmptr->tm_year + 1900)]
+ [((tmptr->tm_mon < 0)
+ ? (12 + (tmptr->tm_mon % 12))
+ : (tmptr->tm_mon % 12)) ],
+ tm_mon);
+
+ /* Do the month again, because the day may have pushed it out of range. */
+ normalize (tm_mon, 0, 11, tm_year);
+
+ /* Do the day again, because the month may have changed the range. */
+ normalize (tm_mday, 1,
+ __mon_lengths[__isleap (tmptr->tm_year + 1900)]
+ [((tmptr->tm_mon < 0)
+ ? (12 + (tmptr->tm_mon % 12))
+ : (tmptr->tm_mon % 12)) ],
+ tm_mon);
+
+#ifdef DEBUG
+ if (debugging_enabled)
+ {
+ printf (" After normalizing:\n ");
+ printtm (tmptr);
+ putchar ('\n');
+ }
+#endif
+
+}
+
+
+/* Here's where the work gets done. */
+
+#define BAD_STRUCT_TM ((time_t) -1)
+
+time_t
+__mktime_internal (timeptr, producer)
+ struct tm *timeptr;
+ struct tm *(*producer) __P ((const time_t *, struct tm *));
+{
+ struct tm our_tm; /* our working space */
+ struct tm *me = &our_tm; /* a pointer to the above */
+ time_t result; /* the value we return */
+
+ *me = *timeptr; /* copy the struct tm that was passed
+ in by the caller */
+
+
+ /***************************/
+ /* Normalize the structure */
+ /***************************/
+
+ /* This routine assumes that the value of TM_ISDST is -1, 0, or 1.
+ If the user didn't pass it in that way, fix it. */
+
+ if (me->tm_isdst > 0)
+ me->tm_isdst = 1;
+ else if (me->tm_isdst < 0)
+ me->tm_isdst = -1;
+
+ do_normalization (me);
+
+ /* Get out of here if it's not possible to represent this struct.
+ If any of the values in the normalized struct tm are negative,
+ our algorithms won't work. Luckily, we only need to check the
+ year at this point; normalization guarantees that all values will
+ be in correct ranges EXCEPT the year. */
+
+ if (me->tm_year < 0)
+ return BAD_STRUCT_TM;
+
+ /*************************************************/
+ /* Find the appropriate time_t for the structure */
+ /*************************************************/
+
+ /* Modified b-search -- make intelligent guesses as to where the
+ time might lie along the timeline, assuming that our target time
+ lies a linear distance (w/o considering time jumps of a
+ particular region).
+
+ Assume that time does not fluctuate at all along the timeline --
+ e.g., assume that a day will always take 86400 seconds, etc. --
+ and come up with a hypothetical value for the time_t
+ representation of the struct tm TARGET, in relation to the guess
+ variable -- it should be pretty close!
+
+ After testing this, the maximum number of iterations that I had
+ on any number that I tried was 3! Not bad.
+
+ The reason this is not a subroutine is that we will modify some
+ fields in the struct tm (yday and mday). I've never felt good
+ about side-effects when writing structured code... */
+
+ {
+ struct tm *guess_tm;
+ struct tm guess_struct;
+ time_t guess = 0;
+ time_t distance = 0;
+ time_t last_distance = 0;
+
+ times_through_search = 0;
+
+ do
+ {
+ guess += distance;
+
+ times_through_search++;
+
+ guess_tm = (*producer) (&guess, &guess_struct);
+
+#ifdef DEBUG
+ if (debugging_enabled)
+ {
+ printf (" Guessing time_t == %d\n ", (int) guess);
+ printtm (guess_tm);
+ putchar ('\n');
+ }
+#endif
+
+ /* How far is our guess from the desired struct tm? */
+ distance = dist_tm (me, guess_tm);
+
+ /* Handle periods of time where a period of time is skipped.
+ For example, 2:15 3 April 1994 does not exist, because DST
+ is in effect. The distance function will alternately
+ return values of 3600 and -3600, because it doesn't know
+ that the requested time doesn't exist. In these situations
+ (even if the skip is not exactly an hour) the distances
+ returned will be the same, but alternating in sign. We
+ want the later time, so check to see that the distance is
+ oscillating and we've chosen the correct of the two
+ possibilities.
+
+ Useful: 3 Apr 94 765356300, 30 Oct 94 783496000 */
+
+ if ((distance == -last_distance) && (distance < last_distance))
+ {
+ /* If the caller specified that the DST flag was off, it's
+ not possible to represent this time. */
+ if (me->tm_isdst == 0)
+ {
+#ifdef DEBUG
+ printf (" Distance is oscillating -- dst flag nixes struct!\n");
+#endif
+ return BAD_STRUCT_TM;
+ }
+
+#ifdef DEBUG
+ printf (" Distance is oscillating -- chose the later time.\n");
+#endif
+ distance = 0;
+ }
+
+ if ((distance == 0) && (me->tm_isdst != -1)
+ && (me->tm_isdst != guess_tm->tm_isdst))
+ {
+ /* If we're in this code, we've got the right time but the
+ wrong daylight savings flag. We need to move away from
+ the time that we have and approach the other time from
+ the other direction. That is, if I've requested the
+ non-DST version of a time and I get the DST version
+ instead, I want to put us forward in time and search
+ backwards to get the other time. I checked all of the
+ configuration files for the tz package -- no entry
+ saves more than two hours, so I think we'll be safe by
+ moving 24 hours in one direction. IF THE AMOUNT OF
+ TIME SAVED IN THE CONFIGURATION FILES CHANGES, THIS
+ VALUE MAY NEED TO BE ADJUSTED. Luckily, we can never
+ have more than one level of overlaps, or this would
+ never work. */
+
+#define SKIP_VALUE 86400
+
+ if (guess_tm->tm_isdst == 0)
+ /* we got the later one, but want the earlier one */
+ distance = -SKIP_VALUE;
+ else
+ distance = SKIP_VALUE;
+
+#ifdef DEBUG
+ printf (" Got the right time, wrong DST value -- adjusting\n");
+#endif
+ }
+
+ last_distance = distance;
+
+ } while (distance != 0);
+
+ /* Check to see that the dst flag matches */
+
+ if (me->tm_isdst != -1)
+ {
+ if (me->tm_isdst != guess_tm->tm_isdst)
+ {
+#ifdef DEBUG
+ printf (" DST flag doesn't match! FIXME?\n");
+#endif
+ return BAD_STRUCT_TM;
+ }
+ }
+
+ result = guess; /* Success! */
+
+ /* On successful completion, the values of tm_wday and tm_yday
+ have to be set appropriately. */
+
+ /* me->tm_yday = guess_tm->tm_yday;
+ me->tm_mday = guess_tm->tm_mday; */
+
+ *me = *guess_tm;
+ }
+
+ /* Update the caller's version of the structure */
+
+ *timeptr = *me;
+
+ return result;
+}
+
+#if ! HAVE_LOCALTIME_R && ! defined (localtime_r)
+#ifdef _LIBC
+#define localtime_r __localtime_r
+#else
+/* Approximate localtime_r as best we can in its absence. */
+#define localtime_r my_localtime_r /* Avoid clash with system localtime_r. */
+static struct tm *
+localtime_r (t, tp)
+ const time_t *t;
+ struct tm *tp;
+{
+ struct tm *l = localtime (t);
+ if (! l)
+ return 0;
+ *tp = *l;
+ return tp;
+}
+#endif /* ! _LIBC */
+#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
+
+time_t
+#ifdef DEBUG /* make it work even if the system's
+ libc has it's own mktime routine */
+my_mktime (timeptr)
+#else
+mktime (timeptr)
+#endif
+ struct tm *timeptr;
+{
+ return __mktime_internal (timeptr, localtime_r);
+}
+
+#ifdef weak_alias
+weak_alias (mktime, timelocal)
+#endif
+
+#ifdef DEBUG
+void
+main (argc, argv)
+ int argc;
+ char *argv[];
+{
+ int time;
+ int result_time;
+ struct tm *tmptr;
+
+ if (argc == 1)
+ {
+ long q;
+
+ printf ("starting long test...\n");
+
+ for (q = 10000000; q < 1000000000; q += 599)
+ {
+ struct tm *tm = localtime ((time_t *) &q);
+ if ((q % 10000) == 0) { printf ("%ld\n", q); fflush (stdout); }
+ if (q != my_mktime (tm))
+ { printf ("failed for %ld\n", q); fflush (stdout); }
+ }
+
+ printf ("test finished\n");
+
+ exit (0);
+ }
+
+ if (argc != 2)
+ {
+ printf ("wrong # of args\n");
+ exit (0);
+ }
+
+ debugging_enabled = 1; /* We want to see the info */
+
+ ++argv;
+ time = atoi (*argv);
+
+ tmptr = localtime ((time_t *) &time);
+ printf ("Localtime tells us that a time_t of %d represents\n ", time);
+ printtm (tmptr);
+ putchar ('\n');
+
+ printf (" Given localtime's return val, mktime returns %d which is\n ",
+ (int) my_mktime (tmptr));
+ printtm (tmptr);
+ putchar ('\n');
+
+#if 0
+ tmptr->tm_sec -= 20;
+ tmptr->tm_min -= 20;
+ tmptr->tm_hour -= 20;
+ tmptr->tm_mday -= 20;
+ tmptr->tm_mon -= 20;
+ tmptr->tm_year -= 20;
+ tmptr->tm_gmtoff -= 20000; /* This has no effect! */
+ tmptr->tm_zone = NULL; /* Nor does this! */
+ tmptr->tm_isdst = -1;
+#endif
+
+ tmptr->tm_hour += 1;
+ tmptr->tm_isdst = -1;
+
+ printf ("\n\nchanged ranges: ");
+ printtm (tmptr);
+ putchar ('\n');
+
+ result_time = my_mktime (tmptr);
+ printf ("\nmktime: %d\n", result_time);
+
+ tmptr->tm_isdst = 0;
+
+ printf ("\n\nchanged ranges: ");
+ printtm (tmptr);
+ putchar ('\n');
+
+ result_time = my_mktime (tmptr);
+ printf ("\nmktime: %d\n", result_time);
+}
+#endif /* DEBUG */
+
+
+/*
+Local Variables:
+compile-command: "gcc -g mktime.c -o mktime -DDEBUG"
+End:
+*/
+
diff --git a/lib/stpcpy.c b/lib/stpcpy.c
new file mode 100644
index 0000000..5ca0a2e
--- /dev/null
+++ b/lib/stpcpy.c
@@ -0,0 +1,32 @@
+/* stpcpy.c -- copy a string and return pointer to end of new string
+ Copyright (C) 1989, 1990 Free Software Foundation.
+
+ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
+
+char *
+stpcpy (dest, src)
+ char *dest;
+ const char *src;
+{
+ while ((*dest++ = *src++) != '\0')
+ /* Do nothing. */ ;
+ return dest - 1;
+}
diff --git a/lib/strdup.c b/lib/strdup.c
new file mode 100644
index 0000000..fccb645
--- /dev/null
+++ b/lib/strdup.c
@@ -0,0 +1,39 @@
+/* strdup.c : replacement function for missing strdup(). */
+/*
+ Copyright (C) 1996 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ Contact: uwe@ohse.de, Uwe Ohse @ DU3 (mausnet)
+ Snail Mail (don't expect me to answer):
+ Uwe Ohse
+ Drosselstraße 2
+ 47055 Duisburg
+ Germany
+*/
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+char *strdup(const char *s)
+{
+ char *p;
+ size_t l=strlen(s)+1;
+ p=malloc(l);
+ if (!p)
+ return NULL;
+ return memcpy(p,s,l);
+}
diff --git a/lib/strerror.c b/lib/strerror.c
new file mode 100644
index 0000000..e2419e6
--- /dev/null
+++ b/lib/strerror.c
@@ -0,0 +1,22 @@
+/* strerror.c -- strerror() replacement
+ * Copyright (C) 1996 Uwe Ohse
+ *
+ * This has been placed in the public domain: do with it what you want.
+ *
+ * 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.
+ *
+ */
+
+char *
+strerror(int num)
+{
+ extern char *sys_errlist[];
+ extern int sys_nerr;
+
+ if (num < 0 || num > sys_nerr)
+ return "Unknown system error / illegal error number";
+
+ return sys_errlist[num];
+}
diff --git a/lib/strftime.c b/lib/strftime.c
new file mode 100644
index 0000000..7d0ebba
--- /dev/null
+++ b/lib/strftime.c
@@ -0,0 +1,891 @@
+/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+
+ NOTE: The canonical source of this file is maintained with the GNU C
+ Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define HAVE_LIMITS_H 1
+# define HAVE_MBLEN 1
+# define HAVE_MBRLEN 1
+# define HAVE_STRUCT_ERA_ENTRY 1
+# define HAVE_TM_GMTOFF 1
+# define HAVE_TM_ZONE 1
+# define MULTIBYTE_IS_FORMAT_SAFE 1
+# define STDC_HEADERS 1
+# include <ansidecl.h>
+# include "../locale/localeinfo.h"
+#endif
+
+#include <sys/types.h> /* Some systems define `time_t' here. */
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_TZNAME
+extern char *tzname[];
+#endif
+
+/* Do multibyte processing if multibytes are supported, unless
+ multibyte sequences are safe in formats. Multibyte sequences are
+ safe if they cannot contain byte sequences that look like format
+ conversion specifications. The GNU C Library uses UTF8 multibyte
+ encoding, which is safe for formats, but strftime.c can be used
+ with other C libraries that use unsafe encodings. */
+#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
+
+#if DO_MULTIBYTE
+# if HAVE_MBRLEN
+# include <wchar.h>
+# else
+ /* Simulate mbrlen with mblen as best we can. */
+# define mbstate_t int
+# define mbrlen(s, n, ps) mblen (s, n)
+# define mbsinit(ps) (*(ps) == 0)
+# endif
+ static const mbstate_t mbstate_zero;
+#endif
+
+#if HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#if STDC_HEADERS
+# include <stddef.h>
+# include <stdlib.h>
+# include <string.h>
+#else
+# define memcpy(d, s, n) bcopy (s, d, n)
+#endif
+
+#ifndef __P
+#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif /* GCC. */
+#endif /* Not __P. */
+
+#ifndef PTR
+#ifdef __STDC__
+#define PTR void *
+#else
+#define PTR char *
+#endif
+#endif
+
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
+
+#define TYPE_SIGNED(t) ((t) -1 < 0)
+
+/* Bound on length of the string representing an integer value of type t.
+ Subtract one for the sign bit if t is signed;
+ 302 / 1000 is log10 (2) rounded up;
+ add one for integer division truncation;
+ add one more for a minus sign if t is signed. */
+#define INT_STRLEN_BOUND(t) \
+ ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 100 + 1 + TYPE_SIGNED (t))
+
+#define TM_YEAR_BASE 1900
+
+#ifndef __isleap
+/* Nonzero if YEAR is a leap year (every 4 years,
+ except every 100th isn't, and every 400th is). */
+#define __isleap(year) \
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+#endif
+
+
+#ifdef _LIBC
+# define gmtime_r __gmtime_r
+# define localtime_r __localtime_r
+#else
+# if ! HAVE_LOCALTIME_R
+# if ! HAVE_TM_GMTOFF
+/* Approximate gmtime_r as best we can in its absence. */
+#define gmtime_r my_gmtime_r
+static struct tm *gmtime_r __P ((const time_t *, struct tm *));
+static struct tm *
+gmtime_r (t, tp)
+ const time_t *t;
+ struct tm *tp;
+{
+ struct tm *l = gmtime (t);
+ if (! l)
+ return 0;
+ *tp = *l;
+ return tp;
+}
+# endif /* ! HAVE_TM_GMTOFF */
+
+/* Approximate localtime_r as best we can in its absence. */
+#define localtime_r my_localtime_r
+static struct tm *localtime_r __P ((const time_t *, struct tm *));
+static struct tm *
+localtime_r (t, tp)
+ const time_t *t;
+ struct tm *tp;
+{
+ struct tm *l = localtime (t);
+ if (! l)
+ return 0;
+ *tp = *l;
+ return tp;
+}
+# endif /* ! HAVE_LOCALTIME_R */
+#endif /* ! defined (_LIBC) */
+
+
+#define add(n, f) \
+ do \
+ { \
+ i += (n); \
+ if (i >= maxsize) \
+ return 0; \
+ else \
+ if (p) \
+ { \
+ f; \
+ p += (n); \
+ } \
+ } while (0)
+#define cpy(n, s) add ((n), memcpy((PTR) p, (PTR) (s), (n)))
+
+#if ! HAVE_TM_GMTOFF
+/* Yield the difference between *A and *B,
+ measured in seconds, ignoring leap seconds. */
+static int tm_diff __P ((const struct tm *, const struct tm *));
+static int
+tm_diff (a, b)
+ const struct tm *a;
+ const struct tm *b;
+{
+ /* Compute intervening leap days correctly even if year is negative.
+ Take care to avoid int overflow in leap day calculations,
+ but it's OK to assume that A and B are close to each other. */
+ int a4 = (a->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (a->tm_year & 3);
+ int b4 = (b->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (b->tm_year & 3);
+ int a100 = a4 / 25 - (a4 % 25 < 0);
+ int b100 = b4 / 25 - (b4 % 25 < 0);
+ int a400 = a100 >> 2;
+ int b400 = b100 >> 2;
+ int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
+ int years = a->tm_year - b->tm_year;
+ int days = (365 * years + intervening_leap_days
+ + (a->tm_yday - b->tm_yday));
+ return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+ + (a->tm_min - b->tm_min))
+ + (a->tm_sec - b->tm_sec));
+}
+#endif /* ! HAVE_TM_GMTOFF */
+
+
+
+/* The number of days from the first day of the first ISO week of this
+ year to the year day YDAY with week day WDAY. ISO weeks start on
+ Monday; the first ISO week has the year's first Thursday. YDAY may
+ be as small as YDAY_MINIMUM. */
+#define ISO_WEEK_START_WDAY 1 /* Monday */
+#define ISO_WEEK1_WDAY 4 /* Thursday */
+#define YDAY_MINIMUM (-366)
+static int iso_week_days __P ((int, int));
+#ifdef __GNUC__
+inline
+#endif
+static int
+iso_week_days (yday, wday)
+ int yday;
+ int wday;
+{
+ /* Add enough to the first operand of % to make it nonnegative. */
+ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
+ return (yday
+ - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+ + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
+}
+
+
+#ifndef _NL_CURRENT
+static char const weekday_name[][10] =
+ {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"
+ };
+static char const month_name[][10] =
+ {
+ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"
+ };
+#endif
+
+/* Write information from TP into S according to the format
+ string FORMAT, writing no more that MAXSIZE characters
+ (including the terminating '\0') and returning number of
+ characters written. If S is NULL, nothing will be written
+ anywhere, so to determine how many characters would be
+ written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
+size_t
+strftime (s, maxsize, format, tp)
+ char *s;
+ size_t maxsize;
+ const char *format;
+ register const struct tm *tp;
+{
+ int hour12 = tp->tm_hour;
+#ifdef _NL_CURRENT
+ const char *const a_wkday = _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday);
+ const char *const f_wkday = _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday);
+ const char *const a_month = _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon);
+ const char *const f_month = _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon);
+ const char *const ampm = _NL_CURRENT (LC_TIME,
+ hour12 > 11 ? PM_STR : AM_STR);
+ size_t aw_len = strlen (a_wkday);
+ size_t am_len = strlen (a_month);
+ size_t ap_len = strlen (ampm);
+#else
+ const char *const f_wkday = weekday_name[tp->tm_wday];
+ const char *const f_month = month_name[tp->tm_mon];
+ const char *const a_wkday = f_wkday;
+ const char *const a_month = f_month;
+ const char *const ampm = "AMPM" + 2 * (hour12 > 11);
+ size_t aw_len = 3;
+ size_t am_len = 3;
+ size_t ap_len = 2;
+#endif
+ size_t wkday_len = strlen (f_wkday);
+ size_t month_len = strlen (f_month);
+ const char *zone;
+ size_t zonelen;
+ register size_t i = 0;
+ register char *p = s;
+ register const char *f;
+
+ zone = 0;
+#if HAVE_TM_ZONE
+ zone = (const char *) tp->tm_zone;
+#endif
+#if HAVE_TZNAME
+ if (!(zone && *zone) && tp->tm_isdst >= 0)
+ zone = tzname[tp->tm_isdst];
+#endif
+ if (! zone)
+ zone = ""; /* POSIX.2 requires the empty string here. */
+
+ zonelen = strlen (zone);
+
+ if (hour12 > 12)
+ hour12 -= 12;
+ else
+ if (hour12 == 0) hour12 = 12;
+
+ for (f = format; *f != '\0'; ++f)
+ {
+ int pad; /* Padding for number ('-', '_', or 0). */
+ int modifier; /* Field modifier ('E', 'O', or 0). */
+ int digits; /* Max digits for numeric format. */
+ int number_value; /* Numeric value to be printed. */
+ int negative_number; /* 1 if the number is negative. */
+ const char *subfmt;
+ char *bufp;
+ char buf[1 + (sizeof (int) < sizeof (time_t)
+ ? INT_STRLEN_BOUND (time_t)
+ : INT_STRLEN_BOUND (int))];
+
+#if DO_MULTIBYTE
+
+ switch (*f)
+ {
+ case '%':
+ break;
+
+ case '\a': case '\b': case '\t': case '\n':
+ case '\v': case '\f': case '\r':
+ case ' ': case '!': case '"': case '#': case '&': case'\'':
+ case '(': case ')': case '*': case '+': case ',': case '-':
+ case '.': case '/': case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7': case '8': case '9':
+ case ':': case ';': case '<': case '=': case '>': case '?':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+ case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+ case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+ case 'Y': case 'Z': case '[': case'\\': case ']': case '^':
+ case '_': case 'a': case 'b': case 'c': case 'd': case 'e':
+ case 'f': case 'g': case 'h': case 'i': case 'j': case 'k':
+ case 'l': case 'm': case 'n': case 'o': case 'p': case 'q':
+ case 'r': case 's': case 't': case 'u': case 'v': case 'w':
+ case 'x': case 'y': case 'z': case '{': case '|': case '}':
+ case '~':
+ /* The C Standard requires these 98 characters (plus '%') to
+ be in the basic execution character set. None of these
+ characters can start a multibyte sequence, so they need
+ not be analyzed further. */
+ add (1, *p = *f);
+ continue;
+
+ default:
+ /* Copy this multibyte sequence until we reach its end, find
+ an error, or come back to the initial shift state. */
+ {
+ mbstate_t mbstate = mbstate_zero;
+ size_t len = 0;
+
+ do
+ {
+ size_t bytes = mbrlen (f + len, (size_t) -1, &mbstate);
+
+ if (bytes == 0)
+ break;
+
+ if (bytes == (size_t) -2 || bytes == (size_t) -1)
+ {
+ len++;
+ break;
+ }
+
+ len += bytes;
+ }
+ while (! mbsinit (&mbstate));
+
+ cpy (len, f);
+ continue;
+ }
+ }
+
+#else /* ! DO_MULTIBYTE */
+
+ /* Either multibyte encodings are not supported, or they are
+ safe for formats, so any non-'%' byte can be copied through. */
+ if (*f != '%')
+ {
+ add (1, *p = *f);
+ continue;
+ }
+
+#endif /* ! DO_MULTIBYTE */
+
+ /* Check for flags that can modify a number format. */
+ ++f;
+ switch (*f)
+ {
+ case '_':
+ case '-':
+ pad = *f++;
+ break;
+
+ default:
+ pad = 0;
+ break;
+ }
+
+ /* Check for modifiers. */
+ switch (*f)
+ {
+ case 'E':
+ case 'O':
+ modifier = *f++;
+ break;
+
+ default:
+ modifier = 0;
+ break;
+ }
+
+ /* Now do the specified format. */
+ switch (*f)
+ {
+#define DO_NUMBER(d, v) \
+ digits = d; number_value = v; goto do_number
+#define DO_NUMBER_SPACEPAD(d, v) \
+ digits = d; number_value = v; goto do_number_spacepad
+
+ case '%':
+ if (modifier != 0)
+ goto bad_format;
+ add (1, *p = *f);
+ break;
+
+ case 'a':
+ if (modifier != 0)
+ goto bad_format;
+ cpy (aw_len, a_wkday);
+ break;
+
+ case 'A':
+ if (modifier != 0)
+ goto bad_format;
+ cpy (wkday_len, f_wkday);
+ break;
+
+ case 'b':
+ case 'h': /* POSIX.2 extension. */
+ if (modifier != 0)
+ goto bad_format;
+ cpy (am_len, a_month);
+ break;
+
+ case 'B':
+ if (modifier != 0)
+ goto bad_format;
+ cpy (month_len, f_month);
+ break;
+
+ case 'c':
+ if (modifier == 'O')
+ goto bad_format;
+#ifdef _NL_CURRENT
+ if (! (modifier == 'E'
+ && *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT)) != '\0'))
+ subfmt = _NL_CURRENT (LC_TIME, D_T_FMT);
+#else
+ subfmt = "%a %b %e %H:%M:%S %Y";
+#endif
+
+ subformat:
+ {
+ size_t len = strftime (p, maxsize - i, subfmt, tp);
+ if (len == 0 && *subfmt)
+ return 0;
+ add (len, ;);
+ }
+ break;
+
+ case 'C': /* POSIX.2 extension. */
+ if (modifier == 'O')
+ goto bad_format;
+#if HAVE_STRUCT_ERA_ENTRY
+ if (modifier == 'E')
+ {
+ struct era_entry *era = _nl_get_era_entry (tp);
+ if (era)
+ {
+ size_t len = strlen (era->name_fmt);
+ cpy (len, era->name_fmt);
+ break;
+ }
+ }
+#endif
+ {
+ int year = tp->tm_year + TM_YEAR_BASE;
+ DO_NUMBER (1, year / 100 - (year % 100 < 0));
+ }
+
+ case 'x':
+ if (modifier == 'O')
+ goto bad_format;
+#ifdef _NL_CURRENT
+ if (! (modifier == 'E'
+ && *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_FMT)) != '\0'))
+ subfmt = _NL_CURRENT (LC_TIME, D_FMT);
+ goto subformat;
+#endif
+ /* Fall through. */
+ case 'D': /* POSIX.2 extension. */
+ if (modifier != 0)
+ goto bad_format;
+ subfmt = "%m/%d/%y";
+ goto subformat;
+
+ case 'd':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_mday);
+
+ case 'e': /* POSIX.2 extension. */
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER_SPACEPAD (2, tp->tm_mday);
+
+ /* All numeric formats set DIGITS and NUMBER_VALUE and then
+ jump to one of these two labels. */
+
+ do_number_spacepad:
+ /* Force `_' flag. */
+ pad = '_';
+
+ do_number:
+ /* Format the number according to the MODIFIER flag. */
+
+#ifdef _NL_CURRENT
+ if (modifier == 'O' && 0 <= number_value)
+ {
+ /* Get the locale specific alternate representation of
+ the number NUMBER_VALUE. If none exist NULL is returned. */
+ const char *cp = _nl_get_alt_digit (number_value);
+
+ if (cp != NULL)
+ {
+ size_t digitlen = strlen (cp);
+ if (digitlen != 0)
+ {
+ cpy (digitlen, cp);
+ break;
+ }
+ }
+ }
+#endif
+ {
+ unsigned int u = number_value;
+
+ bufp = buf + sizeof (buf);
+ negative_number = number_value < 0;
+
+ if (negative_number)
+ u = -u;
+
+ do
+ *--bufp = u % 10 + '0';
+ while ((u /= 10) != 0);
+ }
+
+ do_number_sign_and_padding:
+ if (negative_number)
+ *--bufp = '-';
+
+ if (pad != '-')
+ {
+ int padding = digits - (buf + sizeof (buf) - bufp);
+
+ if (pad == '_')
+ {
+ while (0 < padding--)
+ *--bufp = ' ';
+ }
+ else
+ {
+ bufp += negative_number;
+ while (0 < padding--)
+ *--bufp = '0';
+ if (negative_number)
+ *--bufp = '-';
+ }
+ }
+
+ cpy (buf + sizeof (buf) - bufp, bufp);
+ break;
+
+
+ case 'H':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_hour);
+
+ case 'I':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, hour12);
+
+ case 'k': /* GNU extension. */
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER_SPACEPAD (2, tp->tm_hour);
+
+ case 'l': /* GNU extension. */
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER_SPACEPAD (2, hour12);
+
+ case 'j':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (3, 1 + tp->tm_yday);
+
+ case 'M':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_min);
+
+ case 'm':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_mon + 1);
+
+ case 'n': /* POSIX.2 extension. */
+ add (1, *p = '\n');
+ break;
+
+ case 'p':
+ cpy (ap_len, ampm);
+ break;
+
+ case 'R': /* GNU extension. */
+ subfmt = "%H:%M";
+ goto subformat;
+
+ case 'r': /* POSIX.2 extension. */
+#ifdef _NL_CURRENT
+ if (*(subfmt = _NL_CURRENT (LC_TIME, T_FMT_AMPM)) == '\0')
+#endif
+ subfmt = "%I:%M:%S %p";
+ goto subformat;
+
+ case 'S':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_sec);
+
+ case 's': /* GNU extension. */
+ {
+ struct tm ltm;
+ time_t t;
+
+ ltm = *tp;
+ t = mktime (&ltm);
+
+ /* Generate string value for T using time_t arithmetic;
+ this works even if sizeof (long) < sizeof (time_t). */
+
+ bufp = buf + sizeof (buf);
+ negative_number = t < 0;
+
+ do
+ {
+ int d = t % 10;
+ t /= 10;
+
+ if (negative_number)
+ {
+ d = -d;
+
+ /* Adjust if division truncates to minus infinity. */
+ if (0 < -1 % 10 && d < 0)
+ {
+ t++;
+ d += 10;
+ }
+ }
+
+ *--bufp = d + '0';
+ }
+ while (t != 0);
+
+ digits = 1;
+ goto do_number_sign_and_padding;
+ }
+
+ case 'X':
+ if (modifier == 'O')
+ goto bad_format;
+#ifdef _NL_CURRENT
+ if (! (modifier == 'E'
+ && *(subfmt = _NL_CURRENT (LC_TIME, ERA_T_FMT)) != '\0'))
+ subfmt = _NL_CURRENT (LC_TIME, T_FMT);
+ goto subformat;
+#endif
+ /* Fall through. */
+ case 'T': /* POSIX.2 extension. */
+ subfmt = "%H:%M:%S";
+ goto subformat;
+
+ case 't': /* POSIX.2 extension. */
+ add (1, *p = '\t');
+ break;
+
+ case 'u': /* POSIX.2 extension. */
+ DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1);
+
+ case 'U':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, (tp->tm_yday - tp->tm_wday + 7) / 7);
+
+ case 'V':
+ case 'g': /* GNU extension. */
+ case 'G': /* GNU extension. */
+ if (modifier == 'E')
+ goto bad_format;
+ {
+ int year = tp->tm_year + TM_YEAR_BASE;
+ int days = iso_week_days (tp->tm_yday, tp->tm_wday);
+
+ if (days < 0)
+ {
+ /* This ISO week belongs to the previous year. */
+ year--;
+ days = iso_week_days (tp->tm_yday + (365 + __isleap (year)),
+ tp->tm_wday);
+ }
+ else
+ {
+ int d = iso_week_days (tp->tm_yday - (365 + __isleap (year)),
+ tp->tm_wday);
+ if (0 <= d)
+ {
+ /* This ISO week belongs to the next year. */
+ year++;
+ days = d;
+ }
+ }
+
+ switch (*f)
+ {
+ case 'g':
+ DO_NUMBER (2, (year % 100 + 100) % 100);
+
+ case 'G':
+ DO_NUMBER (1, year);
+
+ default:
+ DO_NUMBER (2, days / 7 + 1);
+ }
+ }
+
+ case 'W':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, (tp->tm_yday - (tp->tm_wday - 1 + 7) % 7 + 7) / 7);
+
+ case 'w':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (1, tp->tm_wday);
+
+ case 'Y':
+#if HAVE_STRUCT_ERA_ENTRY
+ if (modifier == 'E')
+ {
+ struct era_entry *era = _nl_get_era_entry (tp);
+ if (era)
+ {
+ subfmt = strchr (era->name_fmt, '\0') + 1;
+ goto subformat;
+ }
+ }
+#endif
+ if (modifier == 'O')
+ goto bad_format;
+ else
+ DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
+
+ case 'y':
+#if HAVE_STRUCT_ERA_ENTRY
+ if (modifier == 'E')
+ {
+ struct era_entry *era = _nl_get_era_entry (tp);
+ if (era)
+ {
+ int delta = tp->tm_year - era->start_date[0];
+ DO_NUMBER (1, (era->offset
+ + (era->direction == '-' ? -delta : delta)));
+ }
+ }
+#endif
+ DO_NUMBER (2, (tp->tm_year % 100 + 100) % 100);
+
+ case 'Z':
+ cpy (zonelen, zone);
+ break;
+
+ case 'z': /* GNU extension. */
+ if (tp->tm_isdst < 0)
+ break;
+
+ {
+ int diff;
+#if HAVE_TM_GMTOFF
+ diff = tp->tm_gmtoff;
+#else
+ struct tm gtm;
+ struct tm ltm;
+ time_t lt;
+
+ ltm = *tp;
+ lt = mktime (&ltm);
+
+ if (lt == (time_t) -1)
+ {
+ /* mktime returns -1 for errors, but -1 is also a
+ valid time_t value. Check whether an error really
+ occurred. */
+ struct tm tm;
+ localtime_r (&lt, &tm);
+
+ if ((ltm.tm_sec ^ tm.tm_sec)
+ | (ltm.tm_min ^ tm.tm_min)
+ | (ltm.tm_hour ^ tm.tm_hour)
+ | (ltm.tm_mday ^ tm.tm_mday)
+ | (ltm.tm_mon ^ tm.tm_mon)
+ | (ltm.tm_year ^ tm.tm_year))
+ break;
+ }
+
+ if (! gmtime_r (&lt, &gtm))
+ break;
+
+ diff = tm_diff (&ltm, &gtm);
+#endif
+
+ if (diff < 0)
+ {
+ add (1, *p = '-');
+ diff = -diff;
+ }
+ else
+ add (1, *p = '+');
+
+ diff /= 60;
+ DO_NUMBER (4, (diff / 60) * 100 + diff % 60);
+ }
+
+ case '\0': /* GNU extension: % at end of format. */
+ --f;
+ /* Fall through. */
+ default:
+ /* Unknown format; output the format, including the '%',
+ since this is most likely the right thing to do if a
+ multibyte string has been misparsed. */
+ bad_format:
+ {
+ int flen;
+ for (flen = 1; f[1 - flen] != '%'; flen++)
+ continue;
+ cpy (flen, &f[1 - flen]);
+ }
+ break;
+ }
+ }
+
+ if (p)
+ *p = '\0';
+ return i;
+}
diff --git a/lib/strpbrk.c b/lib/strpbrk.c
new file mode 100644
index 0000000..3e60201
--- /dev/null
+++ b/lib/strpbrk.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
+ NOTE: The canonical source of this file is maintained with the GNU C Library.
+ Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+ 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Find the first ocurrence in S of any character in ACCEPT. */
+char *
+strpbrk (s, accept)
+ register const char *s;
+ register const char *accept;
+{
+ while (*s != '\0')
+ {
+ const char *a = accept;
+ while (*a != '\0')
+ if (*a++ == *s)
+ return (char *) s;
+ ++s;
+ }
+
+ return 0;
+}
diff --git a/lib/strstr.c b/lib/strstr.c
new file mode 100644
index 0000000..16b748b
--- /dev/null
+++ b/lib/strstr.c
@@ -0,0 +1,44 @@
+/* strstr.c -- return the offset of one string within another
+ Copyright (C) 1989, 1990 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Written by Mike Rendell <michael@cs.mun.ca>. */
+
+/* Return the starting address of string S2 in S1;
+ return 0 if it is not found. */
+
+char *
+strstr (s1, s2)
+ char *s1;
+ char *s2;
+{
+ int i;
+ char *p1;
+ char *p2;
+ char *s = s1;
+
+ for (p2 = s2, i = 0; *s; p2 = s2, i++, s++)
+ {
+ for (p1 = s; *p1 && *p2 && *p1 == *p2; p1++, p2++)
+ ;
+ if (!*p2)
+ break;
+ }
+ if (!*p2)
+ return s1 + i;
+
+ return 0;
+}
diff --git a/lib/strtol.c b/lib/strtol.c
new file mode 100644
index 0000000..b2336a1
--- /dev/null
+++ b/lib/strtol.c
@@ -0,0 +1,362 @@
+/* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
+
+NOTE: The canonical source of this file is maintained with the GNU C Library.
+Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define USE_NUMBER_GROUPING
+# define STDC_HEADERS
+# define HAVE_LIMITS_H
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#ifdef STDC_HEADERS
+# include <stddef.h>
+# include <stdlib.h>
+#else
+# ifndef NULL
+# define NULL 0
+# endif
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+# include "../locale/localeinfo.h"
+#endif
+
+/* Nonzero if we are defining `strtoul' or `strtouq', operating on
+ unsigned integers. */
+#ifndef UNSIGNED
+# define UNSIGNED 0
+# define INT LONG int
+#else
+# define INT unsigned LONG int
+#endif
+
+/* Determine the name. */
+#if UNSIGNED
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol wcstouq
+# else
+# define strtol wcstoul
+# endif
+# else
+# ifdef QUAD
+# define strtol strtouq
+# else
+# define strtol strtoul
+# endif
+# endif
+#else
+# ifdef USE_WIDE_CHAR
+# ifdef QUAD
+# define strtol wcstoq
+# else
+# define strtol wcstol
+# endif
+# else
+# ifdef QUAD
+# define strtol strtoq
+# endif
+# endif
+#endif
+
+/* If QUAD is defined, we are defining `strtoq' or `strtouq',
+ operating on `long long int's. */
+#ifdef QUAD
+# define LONG long long
+# undef LONG_MIN
+# define LONG_MIN LONG_LONG_MIN
+# undef LONG_MAX
+# define LONG_MAX LONG_LONG_MAX
+# undef ULONG_MAX
+# define ULONG_MAX ULONG_LONG_MAX
+# if __GNUC__ == 2 && __GNUC_MINOR__ < 7
+ /* Work around gcc bug with using this constant. */
+ static const unsigned long long int maxquad = ULONG_LONG_MAX;
+# undef ULONG_MAX
+# define ULONG_MAX maxquad
+# endif
+#else
+# define LONG long
+
+#ifndef ULONG_MAX
+# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
+#endif
+#ifndef LONG_MAX
+# define LONG_MAX ((long int) (ULONG_MAX >> 1))
+#endif
+#endif
+
+#ifdef USE_WIDE_CHAR
+# include <wchar.h>
+# include <wctype.h>
+# define L_(ch) L##ch
+# define UCHAR_TYPE wint_t
+# define STRING_TYPE wchar_t
+# define ISSPACE(ch) iswspace (ch)
+# define ISALPHA(ch) iswalpha (ch)
+# define TOUPPER(ch) towupper (ch)
+#else
+# define L_(ch) ch
+# define UCHAR_TYPE unsigned char
+# define STRING_TYPE char
+# define ISSPACE(ch) isspace (ch)
+# define ISALPHA(ch) isalpha (ch)
+# define TOUPPER(ch) toupper (ch)
+#endif
+
+#ifdef __STDC__
+# define INTERNAL(x) INTERNAL1(x)
+# define INTERNAL1(x) __##x##_internal
+# define WEAKNAME(x) WEAKNAME1(x)
+# define WEAKNAME1(x) __##x
+#else
+# define INTERNAL(x) __/**/x/**/_internal
+# define WEAKNAME(x) __/**/x
+#endif
+
+#ifdef USE_NUMBER_GROUPING
+/* This file defines a function to check for correct grouping. */
+# include "grouping.h"
+#endif
+
+
+/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
+ If BASE is 0 the base is determined by the presence of a leading
+ zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
+ If BASE is < 2 or > 36, it is reset to 10.
+ If ENDPTR is not NULL, a pointer to the character after the last
+ one converted is stored in *ENDPTR. */
+
+INT
+INTERNAL (strtol) (nptr, endptr, base, group)
+ const STRING_TYPE *nptr;
+ STRING_TYPE **endptr;
+ int base;
+ int group;
+{
+ int negative;
+ register unsigned LONG int cutoff;
+ register unsigned int cutlim;
+ register unsigned LONG int i;
+ register const STRING_TYPE *s;
+ register UCHAR_TYPE c;
+ const STRING_TYPE *save, *end;
+ int overflow;
+
+#ifdef USE_NUMBER_GROUPING
+ /* The thousands character of the current locale. */
+ wchar_t thousands;
+ /* The numeric grouping specification of the current locale,
+ in the format described in <locale.h>. */
+ const char *grouping;
+
+ if (group)
+ {
+ grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
+ if (*grouping <= 0 || *grouping == CHAR_MAX)
+ grouping = NULL;
+ else
+ {
+ /* Figure out the thousands separator character. */
+ if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
+ strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
+ thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
+ if (thousands == L'\0')
+ grouping = NULL;
+ }
+ }
+ else
+ grouping = NULL;
+#endif
+
+ if (base < 0 || base == 1 || base > 36)
+ base = 10;
+
+ save = s = nptr;
+
+ /* Skip white space. */
+ while (ISSPACE (*s))
+ ++s;
+ if (*s == L_('\0'))
+ goto noconv;
+
+ /* Check for a sign. */
+ if (*s == L_('-'))
+ {
+ negative = 1;
+ ++s;
+ }
+ else if (*s == L_('+'))
+ {
+ negative = 0;
+ ++s;
+ }
+ else
+ negative = 0;
+
+ if (base == 16 && s[0] == L_('0') && TOUPPER (s[1]) == L_('X'))
+ s += 2;
+
+ /* If BASE is zero, figure it out ourselves. */
+ if (base == 0)
+ if (*s == L_('0'))
+ {
+ if (TOUPPER (s[1]) == L_('X'))
+ {
+ s += 2;
+ base = 16;
+ }
+ else
+ base = 8;
+ }
+ else
+ base = 10;
+
+ /* Save the pointer so we can check later if anything happened. */
+ save = s;
+
+#ifdef USE_NUMBER_GROUPING
+ if (group)
+ {
+ /* Find the end of the digit string and check its grouping. */
+ end = s;
+ for (c = *end; c != L_('\0'); c = *++end)
+ if (c != thousands && (c < L_('0') || c > L_('9'))
+ && (!ISALPHA (c) || TOUPPER (c) - L_('A') + 10 >= base))
+ break;
+ if (*s == thousands)
+ end = s;
+ else
+ end = correctly_grouped_prefix (s, end, thousands, grouping);
+ }
+ else
+#endif
+ end = NULL;
+
+ cutoff = ULONG_MAX / (unsigned LONG int) base;
+ cutlim = ULONG_MAX % (unsigned LONG int) base;
+
+ overflow = 0;
+ i = 0;
+ for (c = *s; c != L_('\0'); c = *++s)
+ {
+ if (s == end)
+ break;
+ if (c >= L_('0') && c <= L_('9'))
+ c -= L_('0');
+ else if (ISALPHA (c))
+ c = TOUPPER (c) - L_('A') + 10;
+ else
+ break;
+ if (c >= base)
+ break;
+ /* Check for overflow. */
+ if (i > cutoff || (i == cutoff && c > cutlim))
+ overflow = 1;
+ else
+ {
+ i *= (unsigned LONG int) base;
+ i += c;
+ }
+ }
+
+ /* Check if anything actually happened. */
+ if (s == save)
+ goto noconv;
+
+ /* Store in ENDPTR the address of one character
+ past the last character we converted. */
+ if (endptr != NULL)
+ *endptr = (STRING_TYPE *) s;
+
+#if !UNSIGNED
+ /* Check for a value that is within the range of
+ `unsigned LONG int', but outside the range of `LONG int'. */
+ if (overflow == 0
+ && i > (negative
+ ? -((unsigned LONG int) (LONG_MIN + 1)) + 1
+ : (unsigned LONG int) LONG_MAX))
+ overflow = 1;
+#endif
+
+ if (overflow)
+ {
+ errno = ERANGE;
+#if UNSIGNED
+ return ULONG_MAX;
+#else
+ return negative ? LONG_MIN : LONG_MAX;
+#endif
+ }
+
+ /* Return the result of the appropriate sign. */
+ return (negative ? -i : i);
+
+noconv:
+ /* We must handle a special case here: the base is 0 or 16 and the
+ first two characters and '0' and 'x', but the rest are no
+ hexadecimal digits. This is no error case. We return 0 and
+ ENDPTR points to the `x`. */
+ if (endptr != NULL)
+ if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
+ && save[-2] == L_('0'))
+ *endptr = (STRING_TYPE *) &save[-1];
+ else
+ /* There was no number to convert. */
+ *endptr = (STRING_TYPE *) nptr;
+
+ return 0L;
+}
+
+/* External user entry point. */
+
+#undef __P
+#if defined (__STDC__) && __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+
+/* Prototype. */
+INT strtol __P ((const STRING_TYPE *nptr, STRING_TYPE **endptr,
+ int base));
+
+
+INT
+strtol (nptr, endptr, base)
+ const STRING_TYPE *nptr;
+ STRING_TYPE **endptr;
+ int base;
+{
+ return INTERNAL (strtol) (nptr, endptr, base, 0);
+}
diff --git a/lib/strtoul.c b/lib/strtoul.c
new file mode 100644
index 0000000..c8a4e3d
--- /dev/null
+++ b/lib/strtoul.c
@@ -0,0 +1,22 @@
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+
+NOTE: The canonical source of this file is maintained with the GNU C Library.
+Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+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, 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#define UNSIGNED 1
+
+#include <strtol.c>
diff --git a/lib/vasprintf.c b/lib/vasprintf.c
new file mode 100644
index 0000000..86f4bf2
--- /dev/null
+++ b/lib/vasprintf.c
@@ -0,0 +1,194 @@
+/* Like vsprintf but provides a pointer to malloc'd storage, which must
+ be freed by the caller.
+ Copyright (C) 1994 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if __STDC__
+# include <stdarg.h>
+#else
+# include <varargs.h>
+#endif
+
+#ifdef TEST
+int global_total_width;
+#endif
+
+/* unsigned long strtoul (); */
+/* char *malloc (); */
+
+static int
+int_vasprintf (result, format, args)
+ char **result;
+ const char *format;
+ va_list *args;
+{
+ const char *p = format;
+ /* Add one to make sure that it is never zero, which might cause malloc
+ to return NULL. */
+ int total_width = strlen (format) + 1;
+ va_list ap;
+
+ memcpy (&ap, args, sizeof (va_list));
+
+ while (*p != '\0')
+ {
+ if (*p++ == '%')
+ {
+ while (strchr ("-+ #0", *p))
+ ++p;
+ if (*p == '*')
+ {
+ ++p;
+ total_width += abs (va_arg (ap, int));
+ }
+ else
+ total_width += strtoul (p, &p, 10);
+ if (*p == '.')
+ {
+ ++p;
+ if (*p == '*')
+ {
+ ++p;
+ total_width += abs (va_arg (ap, int));
+ }
+ else
+ total_width += strtoul (p, &p, 10);
+ }
+ while (strchr ("hlL", *p))
+ ++p;
+ /* Should be big enough for any format specifier except %s. */
+ total_width += 30;
+ switch (*p)
+ {
+ case 'd':
+ case 'i':
+ case 'o':
+ case 'u':
+ case 'x':
+ case 'X':
+ case 'c':
+ (void) va_arg (ap, int);
+ break;
+ case 'f':
+ case 'e':
+ case 'E':
+ case 'g':
+ case 'G':
+ (void) va_arg (ap, double);
+ break;
+ case 's':
+ total_width += strlen (va_arg (ap, char *));
+ break;
+ case 'p':
+ case 'n':
+ (void) va_arg (ap, char *);
+ break;
+ }
+ }
+ }
+#ifdef TEST
+ global_total_width = total_width;
+#endif
+ *result = malloc (total_width);
+ if (*result != NULL)
+ return vsprintf (*result, format, *args);
+ else
+ return 0;
+}
+
+int
+vasprintf (result, format, args)
+ char **result;
+ const char *format;
+ va_list args;
+{
+ return int_vasprintf (result, format, &args);
+}
+
+int
+asprintf
+#if __STDC__
+ (char **result, const char *format, ...)
+#else
+ (result, va_alist)
+ char **result;
+ va_dcl
+#endif
+{
+ va_list args;
+ int done;
+
+#if __STDC__
+ va_start (args, format);
+#else
+ char *format;
+ va_start (args);
+ format = va_arg (args, char *);
+#endif
+ done = vasprintf (result, format, args);
+ va_end (args);
+
+ return done;
+}
+
+#ifdef TEST
+void
+checkit
+#if __STDC__
+ (const char* format, ...)
+#else
+ (va_alist)
+ va_dcl
+#endif
+{
+ va_list args;
+ char *result;
+
+#if __STDC__
+ va_start (args, format);
+#else
+ char *format;
+ va_start (args);
+ format = va_arg (args, char *);
+#endif
+ vasprintf (&result, format, args);
+ if (strlen (result) < global_total_width)
+ printf ("PASS: ");
+ else
+ printf ("FAIL: ");
+ printf ("%d %s\n", global_total_width, result);
+}
+
+int
+main ()
+{
+ checkit ("%d", 0x12345678);
+ checkit ("%200d", 5);
+ checkit ("%.300d", 6);
+ checkit ("%100.150d", 7);
+ checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
+777777777777777777333333333333366666666666622222222222777777777777733333");
+ checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
+}
+#endif /* TEST */
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
new file mode 100644
index 0000000..d7b4b56
--- /dev/null
+++ b/lib/xstrtol.c
@@ -0,0 +1,180 @@
+/* A more useful interface to strtol.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Jim Meyering (meyering@na-net.ornl.gov) */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STRING_H
+# include <string.h>
+#else
+# include <strings.h>
+# ifndef strchr
+# define strchr index
+# endif
+#endif
+
+#define NDEBUG
+#include <assert.h>
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#if HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#ifndef ULONG_MAX
+# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
+#endif
+
+#ifndef LONG_MAX
+# define LONG_MAX ((long int) (ULONG_MAX >> 1))
+#endif
+
+#include "xstrtol.h"
+
+#define BKM_SCALE(x, scale_factor, error_return) \
+ do \
+ { \
+ if ((x) > (double) __ZLONG_MAX / (scale_factor)) \
+ return (error_return); \
+ (x) *= (scale_factor); \
+ } \
+ while (0)
+
+__unsigned long int __strtol ();
+
+/* FIXME: comment. */
+
+strtol_error
+#ifdef __cplusplus
+__xstrtol (const char *s, char **ptr, int base,
+ __unsigned long int *val, const char *valid_suffixes)
+#else
+__xstrtol (s, ptr, base, val, valid_suffixes)
+ const char *s;
+ char **ptr;
+ int base;
+ __unsigned long int *val;
+ const char *valid_suffixes;
+#endif
+{
+ char *t_ptr;
+ char **p;
+ __unsigned long int tmp;
+
+ assert (0 <= base && base <= 36);
+
+ p = (ptr ? ptr : &t_ptr);
+
+ errno = 0;
+ tmp = __strtol (s, p, base);
+ if (errno != 0)
+ return LONGINT_OVERFLOW;
+ if (*p == s)
+ return LONGINT_INVALID;
+ if (!valid_suffixes)
+ {
+ if (**p == '\0')
+ {
+ *val = tmp;
+ return LONGINT_OK;
+ }
+ else
+ return LONGINT_INVALID_SUFFIX_CHAR;
+ }
+
+ if (**p != '\0' && strchr (valid_suffixes, **p))
+ {
+ switch (**p)
+ {
+ case 'b':
+ BKM_SCALE (tmp, 512, LONGINT_OVERFLOW);
+ ++(*p);
+ break;
+
+ case 'c':
+ ++(*p);
+ break;
+
+ case 'B':
+ case 'k':
+ BKM_SCALE (tmp, 1024, LONGINT_OVERFLOW);
+ ++(*p);
+ break;
+
+ case 'm':
+ BKM_SCALE (tmp, 1024 * 1024, LONGINT_OVERFLOW);
+ ++(*p);
+ break;
+
+ case 'w':
+ BKM_SCALE (tmp, 2, LONGINT_OVERFLOW);
+ ++(*p);
+ break;
+
+ default:
+ return LONGINT_INVALID_SUFFIX_CHAR;
+ break;
+ }
+ }
+
+ *val = tmp;
+ return LONGINT_OK;
+}
+
+#ifdef TESTING_XSTRTO
+
+#include <stdio.h>
+#include "error.h"
+
+char *program_name;
+
+int
+main (int argc, char** argv)
+{
+ strtol_error s_err;
+ int i;
+
+ program_name = argv[0];
+ for (i=1; i<argc; i++)
+ {
+ char *p;
+ __unsigned long int val;
+
+ s_err = __xstrtol (argv[i], &p, 0, &val, "bckmw");
+ if (s_err == LONGINT_OK)
+ {
+ printf ("%s->%lu (%s)\n", argv[i], val, p);
+ }
+ else
+ {
+ STRTOL_FATAL_ERROR (argv[i], "arg", s_err);
+ }
+ }
+ exit (0);
+}
+#endif /* TESTING_XSTRTO */
diff --git a/lib/xstrtol.h b/lib/xstrtol.h
new file mode 100644
index 0000000..fd0c97f
--- /dev/null
+++ b/lib/xstrtol.h
@@ -0,0 +1,66 @@
+#ifndef _xstrtol_h_
+#define _xstrtol_h_ 1
+
+#if STRING_TO_UNSIGNED
+# define __xstrtol xstrtoul
+# define __strtol strtoul
+# define __unsigned unsigned
+# define __ZLONG_MAX ULONG_MAX
+#else
+# define __xstrtol xstrtol
+# define __strtol strtol
+# define __unsigned /* empty */
+# define __ZLONG_MAX LONG_MAX
+#endif
+
+#undef __P
+#if defined (__STDC__) && __STDC__
+#define __P(x) x
+#else
+#define __P(x) ()
+#endif
+
+enum strtol_error
+ {
+ LONGINT_OK, LONGINT_INVALID, LONGINT_INVALID_SUFFIX_CHAR, LONGINT_OVERFLOW
+ };
+typedef enum strtol_error strtol_error;
+
+strtol_error
+ __xstrtol __P ((const char *s, char **ptr, int base,
+ __unsigned long int *val, const char *valid_suffixes));
+
+#define _STRTOL_ERROR(exit_code, str, argument_type_string, err) \
+ do \
+ { \
+ switch ((err)) \
+ { \
+ case LONGINT_OK: \
+ abort (); \
+ \
+ case LONGINT_INVALID: \
+ error ((exit_code), 0, "invalid %s `%s'", \
+ (argument_type_string), (str)); \
+ break; \
+ \
+ case LONGINT_INVALID_SUFFIX_CHAR: \
+ error ((exit_code), 0, "invalid character following %s `%s'", \
+ (argument_type_string), (str)); \
+ break; \
+ \
+ case LONGINT_OVERFLOW: \
+ /* FIXME: make this message dependent on STRING_TO_UNSIGNED */\
+ error ((exit_code), 0, "%s `%s' larger than maximum long int",\
+ (argument_type_string), (str)); \
+ break; \
+ } \
+ } \
+ while (0)
+
+#define STRTOL_FATAL_ERROR(str, argument_type_string, err) \
+ _STRTOL_ERROR (2, str, argument_type_string, err)
+
+#define STRTOL_FAIL_WARN(str, argument_type_string, err) \
+ _STRTOL_ERROR (0, str, argument_type_string, err)
+
+#endif /* _xstrtol_h_ */
diff --git a/lib/xstrtoul.c b/lib/xstrtoul.c
new file mode 100644
index 0000000..8194c17
--- /dev/null
+++ b/lib/xstrtoul.c
@@ -0,0 +1,2 @@
+#define STRING_TO_UNSIGNED 1
+#include "xstrtol.c"
diff --git a/lib/xstrtoul.h b/lib/xstrtoul.h
new file mode 100644
index 0000000..8251c57
--- /dev/null
+++ b/lib/xstrtoul.h
@@ -0,0 +1,7 @@
+#ifndef _xstrtoul_h_
+#define _xstrtoul_h_ 1
+
+#define STRING_TO_UNSIGNED 1
+#include "xstrtol.h"
+
+#endif /* _xstrtoul_h_ */
diff --git a/man/CVS/Entries b/man/CVS/Entries
new file mode 100644
index 0000000..93a61ca
--- /dev/null
+++ b/man/CVS/Entries
@@ -0,0 +1,5 @@
+/Makefile.am/1.1.1.2/Sun Apr 26 13:22:29 1998/-ko/
+/Makefile.in/1.5/Thu Jun 3 15:43:15 1999/-ko/
+/lrz.1/1.1.1.6/Sun Apr 26 13:22:41 1998/-ko/
+/lsz.1/1.1.1.5/Sun Apr 26 13:22:41 1998/-ko/
+D
diff --git a/man/CVS/Repository b/man/CVS/Repository
new file mode 100644
index 0000000..40ef37f
--- /dev/null
+++ b/man/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/man
diff --git a/man/CVS/Root b/man/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/man/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..670c9c1
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,3 @@
+man_MANS = lrz.1 lsz.1
+EXTRA_DIST = lrz.1 lsz.1
+
diff --git a/man/Makefile.in b/man/Makefile.in
new file mode 100644
index 0000000..21bf1ad
--- /dev/null
+++ b/man/Makefile.in
@@ -0,0 +1,247 @@
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+DATADIRNAME = @DATADIRNAME@
+ENABLE_TIMESYNC = @ENABLE_TIMESYNC@
+GENCAT = @GENCAT@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+PACKAGE = @PACKAGE@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+U = @U@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+l = @l@
+
+man_MANS = lrz.1 lsz.1
+EXTRA_DIST = lrz.1 lsz.1
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+man1dir = $(mandir)/man1
+MANS = $(man_MANS)
+
+NROFF = nroff
+DIST_COMMON = Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+install-man1:
+ $(mkinstalldirs) $(DESTDIR)$(man1dir)
+ @list='$(man1_MANS)'; \
+ l2='$(man_MANS)'; for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
+ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
+ done
+
+uninstall-man1:
+ @list='$(man1_MANS)'; \
+ l2='$(man_MANS)'; for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
+ rm -f $(DESTDIR)$(man1dir)/$$inst; \
+ done
+install-man: $(MANS)
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-man1
+uninstall-man:
+ @$(NORMAL_UNINSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-man1
+tags: TAGS
+TAGS:
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = man
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu man/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am: install-man
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-man
+uninstall: uninstall-am
+all-am: Makefile $(MANS)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(mandir)/man1
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: install-man1 uninstall-man1 install-man uninstall-man tags \
+distdir info-am info dvi-am dvi check check-am installcheck-am \
+installcheck install-exec-am install-exec install-data-am install-data \
+install-am install uninstall-am uninstall all-redirect all-am all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/man/lrz.1 b/man/lrz.1
new file mode 100644
index 0000000..5df7748
--- /dev/null
+++ b/man/lrz.1
@@ -0,0 +1,514 @@
+'\"
+'\" Revision Level
+'\" Last Delta 04-22-88
+.TH RZ 1 OMEN
+.SH NAME
+rx, rb, rz \- XMODEM, YMODEM, ZMODEM (Batch) file receive
+.SH SYNOPSIS
+.B rz
+.RB [\- "\ +8abeOpqRtTuUvy" ]
+.br
+.B rb
+.RB [\- "\ +abqRtuUvy" ]
+.br
+.B rx
+.RB [\- "\ abceqRtuUv" ]
+.I file
+.br
+.RB [ \- ][ v ] rzCOMMAND
+.SH DESCRIPTION
+This program uses error correcting protocols to receive
+files over a dial-in serial port from a variety of programs running under
+PC-DOS, CP/M,
+.SM Unix,
+and other operating systems.
+It is invoked from a shell prompt
+manually, or automatically as a result of an
+"sz file ..." command given to the calling program.
+
+While
+.I rz
+is smart enough to be called from
+.I cu(1),
+very few versions of
+.I cu(1)
+are smart enough to allow
+.I rz
+to work properly.
+Unix flavors of Professional-YAM are available for such dial-out application.
+
+
+.B Rz
+(Receive ZMODEM)
+receives files with the ZMODEM batch protocol.
+Pathnames are supplied by the sending program,
+and directories are made if necessary (and possible).
+Normally, the
+"rz" command is automatically issued by the calling ZMODEM program,
+but some defective ZMODEM implementations may require starting
+.I rz
+the old fashioned way.
+
+
+.B Rb
+receives file(s) with YMODEM,
+accepting either standard 128 byte sectors or
+1024 byte sectors
+(YAM sb
+.B -k
+option).
+The user should determine when
+the 1024 byte block length
+actually improves throughput without causing lost data
+or even system crashes.
+
+If True YMODEM (Omen Technology trademark) file information (file length, etc.)
+is received,
+the file length controls the number of bytes written to
+the output dataset,
+and the modify time and file mode
+(iff non zero)
+are set accordingly.
+
+If no True YMODEM file information is received,
+slashes in the pathname are changed to underscore,
+and any trailing period in the pathname is eliminated.
+This conversion is useful for files received from CP/M systems.
+With YMODEM, each file name is converted to lower case
+unless it contains one or more lower case letters.
+
+
+.B Rx
+receives a single
+.I file
+with XMODEM or XMODEM-1k protocol.
+The user should determine when
+the 1024 byte block length
+actually improves throughput without causing problems.
+The user must supply the file name to both sending and receiving programs.
+Up to 1023 garbage characters may be added to the received file.
+
+
+.B Rz
+may be invoked as
+.B rzCOMMAND
+(with an optional leading \- as generated by login(1)).
+For each received file,
+.I rz
+will pipe the file to ``COMMAND filename''
+where filename is the name of the transmitted file
+with the file contents as standard input.
+
+Each file transfer is acknowledged when COMMAND exits with 0 status.
+A non zero exit status terminates transfers.
+
+A typical use for this form is
+.I rzrmail
+which calls rmail(1)
+to post mail to the user specified by the transmitted file name.
+For example, sending the file "caf" from a PC-DOS system to
+.I rzrmail
+on a
+.SM Unix
+system
+would result in the contents of the DOS file "caf" being mailed to user "caf".
+
+On some
+.SM Unix
+systems, the login directory must contain a link to
+COMMAND as login sets SHELL=rsh which disallows absolute
+pathnames.
+If invoked with a leading ``v'',
+.I rz
+will be verbose (see
+.B v
+option).
+The following entry works for
+.SM Unix
+SYS III/V:
+.ce
+rzrmail::5:1::/bin:/usr/local/rzrmail
+If the SHELL environment variable includes
+.I "rsh"
+,
+.I "rbash"
+or
+.I "rksh"
+(restricted shell),
+.I rz
+will not accept absolute pathnames
+or references to a parent directory,
+will not modify an existing file, and
+removes any files received in error.
+
+If
+.B rz
+is invoked with stdout and stderr to different datasets,
+Verbose is set to 2, causing frame by frame progress reports
+to stderr.
+This may be disabled with the
+.B q
+option.
+
+.SH OPTIONS
+The meanings of the available options are:
+.PP
+.PD 0
+.TP
+.B "-+, --append"
+append received data to an existing file (ZMODEM, ASCII only).
+.TP
+.B "-a, --ascii"
+Convert files to
+.SM Unix
+conventions by stripping carriage returns and all characters
+beginning with the first Control Z (CP/M end of file).
+.TP
+.B "-b, --binary"
+Binary
+(tell it like it is)
+file transfer override.
+.TP
+.B "-B NUMBER, --bufsize NUMBER"
+Buffer
+.B NUMBER
+bytes before writing to disk. Default ist 32768, which should be enough
+for most situations. If you have a slow machine or a bad disk interface
+or suffer from other hardware problems you might want to increase
+the buffersize.
+.B -1
+or
+.B auto
+use a buffer large enough to buffer the whole file. Be careful with this
+options - things normally get worse, not better, if the machine starts
+to swap.
+.TP
+.B "-c, --with-crc"
+XMODEM only. Use 16 bit CRC (normally a one byte checksum is used).
+.TP
+.B "-C, --allow-remote-commands"
+allow remote command execution (
+.B insecure
+). This allows the sender to execute an arbitrary command through
+.B system
+() or
+.B execl
+(). Default is to disable this feature (?). This option is ignored
+if running in restricted mode.
+.TP
+.B "-D, --null"
+Output file data to /dev/null; for testing.
+(Unix only)
+.TP
+.B "--delay-startup N"
+Wait
+.B N
+seconds before doing anything.
+.TP
+.B "-e, --escape"
+Force sender to escape all control characters;
+normally XON, XOFF, DLE, CR-@-CR, and Ctrl-X are escaped.
+.TP
+.B "-E, --rename"
+Rename incoming file if target filename already exists. The new file
+name will have a dot and a number (0..999) appended.
+.TP
+.B "-h, --help"
+give help screen.
+.TP
+.B "-m N, --min-bps N"
+Stop transmission if BPS-Rate (Bytes Per Second) falls below N for a
+certain time (see --min-bps-time option).
+.TP
+.B "-M N, --min-bps-time"
+Used together with --min-bps. Default is 120 (seconds).
+.TP
+.B "-O, --disable-timeouts"
+Disable read timeout handling code. This makes lrz hang if the
+sender does not send any more, but increases performance (a bit)
+and decreases system load (through reducing the number of system
+calls by about 50 percent).
+
+Use this option with care.
+.TP
+.B "--o-sync"
+Open output files in synchronous write mode. This may be useful if you
+experience errors due to lost interrupts if update (or bdflush or
+whoever this daemon is called on your system) writes the buffers to the
+disk.
+
+This option is ignored and a warning is printed if your systems
+doesn't support O_SYNC.
+.TP
+.B "-p, --protect"
+(ZMODEM) Protect: skip file if destination file exists.
+.TP
+.B "-q, --quiet"
+Quiet suppresses verbosity.
+.TP
+.B "-r, --resume"
+Crash recovery mode. lrz tries to resume interrupted file transfers.
+.TP
+.B "-R, --restricted"
+Enter more restricted mode. lrz will not create directories or files
+with a leading dot if this option is given twice.
+
+See
+.B SECURITY
+for mode information about restricted mode.
+.TP
+.B "-s HH:MM, --stop-at HH:MM"
+Stop transmission at
+.B HH
+hours,
+.B MM
+minutes. Another variant, using
+.B +N
+instead of
+.B HH:MM,
+stops transmission in
+.B N
+seconds.
+.TP
+.B "-S, --timesync"
+Request timesync packet from the sender. The sender sends its system time,
+causing lrz to complain about more then 60 seconds difference.
+
+Lrz tries to set the local system time to the remote time if this option
+is given twice (this fails if lrz is not run by root).
+
+This option makes lrz incompatible with certain other ZModems. Don't
+use it unless you know what you are doing.
+.TP
+.B "--syslog[=off]"
+turn syslogging on or off. the default is set at configure time.
+This option is ignored if no syslog support is compiled in.
+.TP
+.B "-t TIM, --timeout TIM"
+Change timeout to
+.I TIM
+tenths of seconds. This is ignored if timeout handling is turned of
+through the
+.B O
+option.
+.TP
+.B "--tcp-client ADDRESS:PORT"
+Act as a tcp/ip client: Connect to the given port.
+
+See
+.B "--tcp-server"
+for more information.
+
+.TP
+.B "--tcp-server"
+Act as a server: Open a socket, print out what to do, wait for connection.
+
+You will normally not want to use this option as lrzsz is the only
+zmodem which understands what to do (private extension). You might
+want to use this if you have to use zmodem (for which reason whatever),
+and cannot use the
+.B --tcp
+option of
+.I lsz
+(perhaps because your telnet doesn't allow to spawn a local program
+with stdin/stdout connected to the remote side).
+
+If you use this option you have to start
+.I lsz
+with the
+.B --tcp-client ADDRESS:PORT
+option.
+.I lrz will print the address and port on startup.
+
+Use of this option imposes a security risk, somebody else could connect
+to the port in between. See
+.B SECURITY
+for details.
+.TP
+.B "-U, --unrestrict"
+turn off restricted mode (this is not possible if running under
+a restricted shell).
+.TP
+.B "--version"
+prints out version number.
+.TP
+.B "-v, --verbose"
+Verbose
+causes a list of file
+names to be appended to stderr.
+More v's generate more output.
+.TP
+.B "-wN, --windowsize N"
+Set window size to N.
+.TP
+.B "-X, --xmodem"
+use XMODEM protocol.
+.TP
+.B "-y, --overwrite"
+Yes, clobber any existing files with the same name.
+.TP
+.B "--ymodem"
+use YMODEM protocol.
+.TP
+.B "-Z, --zmodem"
+use ZMODEM protocol.
+.PD
+.ne 6
+.SH SECURITY
+Contrary to the original ZMODEM lrz defaults to restricted mode. In
+restricted mode lrz will not accept absolute pathnames or references
+to a parent directory, will not modify an existing file, and
+removes any files received in error. Remote command execution is
+disabled.
+
+To use a more restricted mode set the environment variable
+.B ZMODEM_RESTRICTED
+or give the
+.B R
+option. This disables creation of subdirectories and invisible
+files.
+
+Restricted mode may be turned off with the
+.B U
+option, unless lrz runs under a restricted shell.
+
+.TP
+Use of the
+.B --tcp-client
+or
+.B --tcp-server
+options imposes a security risk, as somebody else could connect to
+the port before you do it, and grab your data. If there's strong
+demand for a more secure mode i might introduce some sort of
+password challenge.
+
+.SH ENVIRONMENT
+lrz uses the following environment variables:
+.TP
+.B SHELL
+lrz recognizes a restricted shell if this variable includes
+.I "rsh"
+or
+.I "rksh"
+\.
+.TP
+.B ZMODEM_RESTRICTED
+lrz enters the more restricted mode if the variable is set.
+.SH EXAMPLES
+.RE
+(Pro-YAM command)
+.RS
+.I <ALT-2>
+.br
+Pro-YAM Command:
+.I "sz *.h *.c"
+.br
+(This automatically invokes
+.I rz
+on the connected system.)
+.RE
+.SH SEE ALSO
+ZMODEM.DOC,
+YMODEM.DOC,
+Professional-YAM,
+crc(omen),
+sz(omen),
+usq(omen),
+undos(omen)
+
+Compile time options required
+for various operating systems are described in the
+source file.
+.SH NOTES
+Sending serial data to timesharing minicomputers
+at sustained high speeds
+has been known to cause lockups, system halts, kernel panics,
+and occasional antisocial behaviour.
+When experimenting with high speed input to a
+system, consider rebooting the system
+if the file transfers are not successful,
+especially if the personality of the system appears altered.
+
+The Unix "ulimit" parameter must be set high enough
+to permit large file transfers.
+
+The TTY input buffering on some systems may not allow long blocks
+or streaming input at high speed.
+You should suspect this problem when you
+can't send data to the Unix system at high speeds using ZMODEM,
+YMODEM-1k or XMODEM-1k,
+when YMODEM with 128 byte blocks works properly.
+If the system's tty line handling is really broken, the serial port
+or the entire system may not survive the onslaught of long bursts
+of high speed data.
+
+The DSZ or Pro-YAM
+.B "zmodem l"
+numeric parameter may be set to a value between 64 and 1024 to limit the
+burst length ("zmodem pl128").
+
+32 bit CRC code courtesy Gary S. Brown.
+Directory creation code from John Gilmore's PD TAR program.
+.SH BUGS
+Calling
+.I rz
+from most versions of cu(1) doesn't work because cu's receive process
+fights
+.I rz
+for characters from the modem.
+
+Programs that do not properly implement the specified file transfer protocol
+may cause
+.I sz
+to "hang" the port for a minute or two.
+Every reported instance of this problem has been corrected by using
+ZCOMM, Pro-YAM, or other program with a correct implementation
+of the specified protocol.
+
+Many programs claiming to support YMODEM only support XMODEM with 1k blocks,
+and they often don't get that quite right.
+
+Pathnames are restricted to 127 characters.
+In XMODEM single file mode, the pathname given on the command line
+is still processed as described above.
+The ASCII option\'s CR/LF to NL translation merely deletes CR\'s;
+undos(omen) performs a more intelligent translation.
+.SH "VMS VERSION"
+The VMS version does not set the file time.
+
+VMS C Standard I/O and RMS may interact to modify
+file contents unexpectedly.
+
+The VMS version does not support invocation as
+.B rzCOMMAND .
+The current VMS version does not support XMODEM, XMODEM-1k, or YMODEM.
+
+According to the VMS documentation,
+the buffered input routine used on the VMS version of
+.I rz
+introduces a delay
+of up to one second for each protocol transaction.
+This delay may be significant for very short files.
+Removing the "#define BUFREAD" line from rz.c will
+eliminate this delay at the expense of increased
+CPU utilization.
+
+The VMS version causes DCL to generate a random off the wall
+error message under some error conditions; this is a result of
+the incompatibility of the VMS "exit" function with the
+Unix/MSDOS standard.
+.SH "ZMODEM CAPABILITIES"
+.I Rz
+supports incoming ZMODEM binary (-b), ASCII (-a),
+protect (-p),
+clobber (-y),
+and append (-+)
+requests.
+The default is protect (-p) and binary (-b).
+
+The Unix versions support ZMODEM command execution.
+.SH FILES
+rz.c, crctab.c, rbsb.c, zm.c, zmodem.h Unix source files.
+
+rz.c, crctab.c, vrzsz.c, zm.c, zmodem.h, vmodem.h, vvmodem.c,
+VMS source files.
diff --git a/man/lsz.1 b/man/lsz.1
new file mode 100644
index 0000000..ddbcd9e
--- /dev/null
+++ b/man/lsz.1
@@ -0,0 +1,688 @@
+'\"
+'\" Revision Level
+'\" Last Delta 04-21-88
+.TH SZ 1 2.6.1996 lrzsz-0.12b
+.SH NAME
+sx, sb, sz \- XMODEM, YMODEM, ZMODEM file send
+.SH SYNOPSIS
+sz
+.RB [\- +8abdefkLlNnopqTtuvyY ]
+.I file ...
+.br
+sb
+.RB [\- adfkqtuv ]
+.I file ...
+.br
+sx
+.RB [\- akqtuv ]
+.I file
+.br
+sz
+.RB [\- oqtv ]
+.B "-c COMMAND"
+.br
+sz
+.RB [\- oqtv ]
+.B "-i COMMAND"
+.br
+sz -TT
+.SH DESCRIPTION
+.B Sz
+uses the ZMODEM, YMODEM or XMODEM error correcting protocol to send
+one or more files over a dial-in serial port to a variety of programs running under
+PC-DOS, CP/M, Unix, VMS, and other operating systems.
+
+While
+.I rz
+is smart enough to be called from
+.I cu(1),
+very few versions of
+.I cu(1)
+are smart enough to allow
+.I sz
+to work properly.
+Unix flavors of Professional-YAM are available for such dial-out application.
+
+
+.B Sz
+sends one or more files with ZMODEM protocol.
+
+ZMODEM
+greatly simplifies file transfers compared to XMODEM.
+In addition to a friendly user interface, ZMODEM
+provides Personal Computer and other users
+an efficient, accurate, and robust file transfer method.
+
+ZMODEM provides complete
+.B "END-TO-END"
+data integrity between application programs.
+ZMODEM's 32 bit CRC catches errors
+that sneak into even the most advanced networks.
+
+Advanced file management features include
+AutoDownload (Automatic file Download initiated without user intervention),
+Display of individual and total file lengths and transmission time estimates,
+Crash Recovery,
+selective file transfers,
+and preservation of
+exact file date and length.
+
+Output from another program may be piped to
+.B sz
+for transmission by denoting standard input with "-":
+.ce
+ls -l | sz -
+The program output is transmitted with the filename sPID.sz
+where PID is the process ID of the
+.B sz
+program.
+If the environment variable
+.B ONAME
+is set, that is used instead.
+In this case, the Unix command:
+.ce
+ls -l | ONAME=con sz -ay -
+will send a "file" to the PC-DOS console display.
+The
+.B -y
+option instructs the receiver to open the file for writing unconditionally.
+The
+.B -a
+option
+causes the receiver to convert Unix newlines to PC-DOS carriage returns
+and linefeeds.
+
+
+.B Sb
+batch sends one or more files with YMODEM or ZMODEM protocol.
+The initial ZMODEM initialization is not sent.
+When requested by the receiver,
+.B sb
+supports
+.B YMODEM-g
+with "cbreak" tty mode, XON/XOFF flow control,
+and interrupt character set to CAN (^X).
+.B YMODEM-g
+(Professional-YAM
+.B g
+option)
+increases throughput over error free channels
+(direct connection, X.PC, etc.)
+by not acknowledging each transmitted sector.
+
+On
+.SM Unix
+systems, additional information about the file is transmitted.
+If the receiving program uses this information,
+the transmitted file length controls the exact number of bytes written to
+the output dataset,
+and the modify time and file mode
+are set accordingly.
+
+
+.B Sx
+sends a single
+.I file
+with
+.B XMODEM
+or
+.B XMODEM-1k
+protocol
+(sometimes incorrectly called "ymodem").
+The user must supply the file name to both sending and receiving programs.
+
+If
+.B sz
+is invoked with $SHELL set and iff that variable contains the
+string
+.I "rsh"
+,
+.I "rbash"
+or
+.I "rksh"
+(restricted shell),
+.B sz
+operates in restricted mode.
+Restricted mode restricts pathnames to the current directory and
+PUBDIR (usually /usr/spool/uucppublic) and/or subdirectories
+thereof.
+
+
+The fourth form sends a single COMMAND to a ZMODEM receiver for execution.
+.B Sz
+exits with the COMMAND return value.
+If COMMAND includes spaces or characters special to the shell,
+it must be quoted.
+
+
+The fifth form sends a single COMMAND to a ZMODEM receiver for execution.
+.B Sz
+exits as soon as the receiver has correctly received the command,
+before it is executed.
+
+
+The sixth form (sz -TT)
+attempts to output all 256 code combinations to the terminal.
+In you are having difficulty sending files,
+this command lets you see which character codes are being
+eaten by the operating system.
+
+
+If
+.B sz
+is invoked with stdout and stderr to different datasets,
+Verbose is set to 2, causing frame by frame progress reports
+to stderr.
+This may be disabled with the
+.B q
+option.
+.PP
+The meanings of the available options are:
+.PP
+.PD 0
+.TP
+.B "-+, --append"
+Instruct the receiver to append transmitted data to an existing file
+(ZMODEM only).
+.TP
+.B "-2, --twostop"
+use two stop bits (if possible). Do not use this unless you know
+what you are doing.
+.TP
+.B "-8, --try-8k"
+Try to go up to 8KB blocksize. This is incompatible with standard zmodem,
+but a common extension in the bbs world. (ZMODEM only).
+.TP
+.B "--start-8k"
+Start with 8KB blocksize. Like --try-8k.
+.TP
+.B "-a, --ascii"
+Convert NL characters in the transmitted file to CR/LF.
+This is done by the sender for XMODEM and YMODEM, by the receiver
+for ZMODEM.
+.TP
+.B "-b, --binary"
+(ZMODEM) Binary override: transfer file without any translation.
+.TP
+.B "-B NUMBER, --bufsize NUMBER"
+Use a readbuffer of
+.B NUMBER
+bytes. Default ist 16384, which should be enough
+for most situations. If you have a slow machine or a bad disk interface
+or suffer from other hardware problems you might want to increase
+the buffersize.
+.B -1
+or
+.B auto
+use a buffer large enough to buffer the whole file. Be careful with this
+option - things normally get worse, not better, if the machine starts
+to swap.
+
+Using this option turns of memory mapping of the input file. This
+increases memory and cpu usage.
+.TP
+.B "-c COMMAND, --command COMMAND"
+Send COMMAND to the receiver for execution, return with COMMAND\'s exit status.
+.TP
+.B "-C N, --command-tries N"
+Retry to send command N times (default: 11).
+.TP
+.B "-d, --dot-to-slash"
+Change all instances of "." to "/" in the transmitted pathname.
+Thus, C.omenB0000 (which is unacceptable to MSDOS or CP/M)
+is transmitted as C/omenB0000.
+If the resultant filename has more than 8 characters in the stem,
+a "." is inserted to allow a total of eleven.
+
+This option enables the
+.B "--full-path"
+option.
+.TP
+.B "--delay-startup N"
+Wait
+.B N
+seconds before doing anything.
+.TP
+.B "-e, --escape"
+Escape all control characters;
+normally XON, XOFF, DLE, CR-@-CR, and Ctrl-X are escaped.
+.TP
+.B"-E, --rename"
+Force the sender to rename the new file if a file with the same
+name already exists.
+.TP
+.B "-f, --full-path"
+Send Full pathname.
+Normally directory prefixes are stripped from the transmitted
+filename.
+
+This is also turned on with to
+.B "--dot-to-slash"
+option.
+.TP
+.B "-h, --help"
+give help.
+.TP
+.B "-i COMMAND, --immediate-command COMMAND"
+Send COMMAND to the receiver for execution, return immediately
+upon the receiving program's successful recption of the command.
+.TP
+.B "-k, --1k"
+(XMODEM/YMODEM) Send files using 1024 byte blocks
+rather than the default 128 byte blocks.
+1024 byte packets speed file transfers at high bit rates.
+(ZMODEM streams the data for the best possible throughput.)
+.TP
+.B "-L N, --packetlen N"
+Use ZMODEM sub-packets of length N.
+A larger N (32 <= N <= 1024) gives slightly higher throughput,
+a smaller N speeds error recovery.
+The default is 128 below 300 baud, 256 above 300 baud, or 1024 above 2400 baud.
+.TP
+.B "-m N, --min-bps N"
+Stop transmission if BPS-Rate (Bytes Per Second) falls below N for a
+certain time (see --min-bps-time option).
+.TP
+.B "-M N, --min-bps-time"
+Used together with --min-bps. Default is 120 (seconds).
+.TP
+.B "-l N, --framelen N"
+Wait for the receiver to acknowledge correct data every
+.B N
+(32 <= N <= 1024)
+characters.
+This may be used to avoid network overrun when XOFF flow control is lacking.
+.TP
+.B "-n, --newer"
+(ZMODEM) Send each file if
+destination file does not exist.
+Overwrite destination file if
+source file is newer than the destination file.
+.TP
+.B "-N, --newer-or-longer"
+(ZMODEM) Send each file if
+destination file does not exist.
+Overwrite destination file if
+source file is newer or longer than the destination file.
+.TP
+.B "-o, --16-bit-crc"
+(ZMODEM) Disable automatic selection of 32 bit CRC.
+.TP
+.B "-O, --disable-timeouts"
+Disable read timeout handling. This makes lsz hang if the other side
+doesn't send anything, but increases performance (not much) and
+decreases system load (reduces number of system calls by about 50
+percent).
+
+Use this option with care.
+.TP
+.B "-p, --protect"
+(ZMODEM) Protect existing destination files by skipping transfer if the
+destination file exists.
+.TP
+.B "-q, --quiet"
+Quiet suppresses verbosity.
+.TP
+.B "-R, --restricted"
+Restricted mode: restricts pathnames to the current directory and
+PUBDIR (usually /usr/spool/uucppublic) and/or subdirectories
+thereof.
+.TP
+.B "-r, --resume"
+(ZMODEM) Resume interrupted file transfer.
+If the source file is longer than the destination file,
+the transfer commences at the offset in the source file that equals
+the length of the destination file.
+.TP
+.B "-s HH:MM, --stop-at HH:MM"
+Stop transmission at
+.B HH
+hours,
+.B MM
+minutes. Another variant, using
+.B +N
+instead of
+.B HH:MM,
+stops transmission in
+.B N
+seconds.
+.TP
+.B "-S, --timesync"
+enable timesync protocol support. See timesync.doc for further
+information.
+
+This option is incompatible with standard zmodem. Use it with care.
+.TP
+.B "--syslog[=off]"
+turn syslogging on or off. the default is set at configure time.
+This option is ignored if no syslog support is compiled in.
+.TP
+.B "-t TIM, --timeout TIM"
+Change timeout to
+.I TIM
+tenths of seconds.
+.TP
+.B "-T, --turbo"
+Do not escape certain characters (^P, ^P|0x80, telenet escape sequence
+[CR + @]). This improves performance by about 1 percent and shouldn't
+hurt in the normal case (but be careful - ^P might be useful if connected
+through a terminal server).
+.TP
+.B "--tcp"
+Try to initiate a TCP/IP connection. lsz will ask the receiving zmodem
+to open a TCP/IP connection. All handshaking (which address / port to
+use) will be done by the zmodem programs.
+
+You will normally not want to use this option as lrzsz is the only
+zmodem which understands what to do (private extension). You might
+want to use this option if the two programs are connected
+(stdin/out) over a slow or bad (not 8bit clean) network connection.
+
+Use of this option imposes a security risk, somebody else could connect
+to the port in between. See
+.B SECURITY
+for details.
+.TP
+.B "--tcp-client ADDRESS:PORT"
+Act as a tcp/ip client: Connect to the given port.
+
+See
+.B "--tcp-server"
+for more information.
+
+.TP
+.B "--tcp-server"
+Act as a server: Open a socket, print out what to do, wait for connection.
+
+You will normally not want to use this option as lrzsz is the only
+zmodem which understands what to do (private extension). You might
+want to use this if you have to use zmodem (for which reason whatever),
+and cannot use the
+.B --tcp
+option of
+.I lsz
+(perhaps because your telnet doesn't allow to spawn a local program
+with stdin/stdout connected to the remote side).
+
+If you use this option you have to start
+.I lsz
+with the
+.B --tcp-client ADDRESS:PORT
+option.
+.I lrz will print the address and port on startup.
+
+Use of this option imposes a security risk, somebody else could connect
+to the port in between. See
+.B SECURITY
+for details.
+
+.TP
+.B "-u"
+Unlink the file after successful transmission.
+.TP
+.B "-U, --unrestrict"
+Turn off restricted mode (this is not possible if running under a
+restricted shell).
+.TP
+.B "-w N, --windowsize N"
+Limit the transmit window size to N bytes (ZMODEM).
+.TP
+.B "-v, --verbose"
+Verbose output to stderr. More v's generate more output.
+.TP
+.B "-X, --xmodem"
+use XMODEM protocol.
+.TP
+.B "-y, --overwrite"
+Instruct a ZMODEM receiving program to overwrite any existing file
+with the same name.
+.TP
+.B "-Y, --overwrite-or-skip"
+Instruct a ZMODEM receiving program to overwrite any existing file
+with the same name,
+and to skip any source files that do have a file with the same
+pathname on the destination system.
+.TP
+.B "--ymodem"
+use ZMODEM protocol.
+.TP
+.B "-Z, --zmodem"
+use ZMODEM protocol.
+.PD
+.SH SECURITY
+Restricted mode restricts pathnames to the current directory
+and PUBDIR (usually /var/spool/uucppublic)
+and/or subdirectories thereof, and disables remote command
+execution.
+
+Restricted mode is entered if the
+.B R
+option is given or if lsz detects that it runs under a restricted
+shell or if the environment variable ZMODEM_RESTRICTED is found.
+
+Restricted mode can be turned of with the
+.B U
+option if not running under a restricted shell.
+
+.TP
+Use of the
+.B --tcp-client
+or
+.B --tcp-server
+options imposes a security risk, as somebody else could connect to
+the port before you do it, and grab your data. If there's strong
+demand for a more secure mode i might introduce some sort of
+password challenge.
+
+
+.SH ENVIRONMENT
+.TP
+.B ZNULLS
+may be used to specify the number of nulls to send before a ZDATA frame.
+.TP
+.B SHELL
+lsz recognizes a restricted shell if this variable includes
+.I "rsh"
+or
+.I "rksh"
+.TP
+.B ZMODEM_RESTRICTED
+lrz enters restricted mode if the variable is set.
+.TP
+.B TMPDIR
+If this environment variable is set its content is used as the
+directory to place in the answer file to a
+.B timesync
+request.
+.B TMP
+Used instead of TMPDIR if TMPDIR is not set. If neither TMPDIR nor
+TMP is set /tmp will be used.
+.SH EXAMPLES
+.ne 7
+.B "ZMODEM File Transfer"
+(Unix to DSZ/ZCOMM/Professional-YAM)
+.br
+.B "% sz \-a *.c"
+.br
+This single command transfers all .c files in the current Unix directory
+with conversion
+.RB ( \-a )
+to end of line conventions appropriate to the receiving environment.
+With ZMODEM AutoDownload enabled, Professional-YAM and ZCOMM
+will automatically recieve
+the files after performing a security check.
+
+.br
+.B "% sz \-Yan *.c *.h"
+.br
+Send only the .c and .h files that exist on both systems,
+and are newer on the sending system than the
+corresponding version on the receiving system, converting Unix to
+DOS text format.
+.br
+.B
+$ sz -\\Yan file1.c file2.c file3.c foo.h baz.h
+.R
+(for VMS)
+.br
+
+.B "ZMODEM Command Download"
+(Unix to Professional-YAM)
+.br
+ cpszall:all
+ sz \-c "c:;cd /yam/dist"
+ sz \-ya $(YD)/*.me
+ sz \-yqb y*.exe
+ sz \-c "cd /yam"
+ sz \-i "!insms"
+.br
+This Makefile fragment uses
+.B sz
+to issue commands to Professional-YAM to change current disk and directory.
+Next,
+.B sz
+transfers the
+.I .me
+files from the $YD directory, commanding the receiver to overwrite the old files
+and to convert from Unix end of line conventions to PC-DOS conventions.
+The third line transfers some
+.I .exe
+files.
+The fourth and fifth lines command Pro-YAM to
+change directory and execute a PC-DOS batch file
+.I insms .
+Since the batch file takes considerable time, the
+.B "\-i"
+form is used to allow
+.B sz
+to exit immediately.
+
+.B "XMODEM File Transfer"
+(Unix to Crosstalk)
+.br
+%
+.B "sx \-a foo.c"
+.br
+.B "ESC"
+.br
+.B "rx foo.c"
+.br
+The above three commands transfer a single file
+from Unix to a PC and Crosstalk with
+.I sz
+translating Unix newlines to DOS CR/LF.
+This combination is much slower and far less reliable than ZMODEM.
+.SH ERROR MESSAGES
+"Caught signal 99"
+indicates the program was not properly compiled,
+refer to "bibi(99)" in rbsb.c for details.
+.SH SEE ALSO
+rz(omen),
+ZMODEM.DOC,
+YMODEM.DOC,
+Professional-YAM,
+crc(omen),
+sq(omen),
+todos(omen),
+tocpm(omen),
+tomac(omen),
+yam(omen)
+
+Compile time options required for various operating systems are described in
+the source file.
+.SH "VMS VERSION"
+The VMS version does not support wild cards.
+Because of VMS DCL, upper case option letters muse be represented
+by \\ proceding the letter.
+
+The current VMS version does not support XMODEM, XMODEM-1k, or YMODEM.
+
+VMS C Standard I/O and RMS may interact to modify the file contents.
+.SH FILES
+32 bit CRC code courtesy Gary S. Brown.
+
+sz.c, crctab.c, rbsb.c, zm.c, zmodem.h Unix source files
+
+sz.c, crctab.c, vrzsz.c, zm.c, zmodem.h, vmodem.h, vvmodem.c,
+VMS source files.
+
+/tmp/szlog stores debugging output (sz -vv)
+(szlog on VMS).
+.SH "TESTING FEATURE"
+The command "sz -T file"
+exercises the
+.B Attn
+sequence error recovery by commanding
+errors with unterminated packets.
+The receiving program should complain five times about
+binary data packets being too long.
+Each time
+.B sz
+is interrupted,
+it should send a ZDATA header followed by another defective packet.
+If the receiver does not detect five long data packets,
+the
+.B Attn
+sequence is not interrupting the sender, and the
+.B Myattn
+string in
+.B sz.c
+must be modified.
+
+After 5 packets,
+.B sz
+stops the "transfer" and
+prints the total number of characters "sent" (Tcount).
+The difference between Tcount and 5120 represents the number of characters
+stored in various buffers when the Attn sequence is generated.
+.SH BUGS
+Calling
+.I sz
+from most versions of cu(1) doesn't work because cu's receive process
+fights
+.I sz
+for characters from the modem.
+
+On at least one BSD system, sz would hang or exit when it got within
+a few kilobytes of the end of file.
+Using the "-w 8192" flag fixed the problem.
+The real cause is unknown, perhaps a bug in the kernel TTY output routines.
+
+Programs that do not properly implement the specified file transfer protocol
+may cause
+.I sz
+to "hang" the port for a minute or two.
+This problem is corrected by using
+ZCOMM, Pro-YAM, or other program with a correct implementation
+of the specified protocol.
+
+Many programs claiming to support YMODEM only support XMODEM with 1k blocks,
+and they often don't get that quite right.
+
+XMODEM transfers add up to 127 garbage bytes per file.
+XMODEM-1k and YMODEM-1k transfers use 128 byte blocks
+to avoid extra padding.
+
+YMODEM programs use the file length transmitted at the beginning of the
+transfer to prune the file to the correct length; this may cause problems with
+source files that grow during the course of the transfer.
+This problem does not pertain to ZMODEM transfers, which preserve the exact
+file length unconditionally.
+
+Most ZMODEM options are merely passed to the receiving program;
+some do not implement all these options.
+
+Circular buffering and a ZMODEM sliding window should be used
+when input is from pipes instead of acknowledging frames each 1024 bytes.
+If no files can be opened,
+.B sz
+sends a ZMODEM command to echo a suitable complaint;
+perhaps it should check for the presence of at least one accessible file before
+getting hot and bothered.
+The test mode leaves a zero length file on the receiving system.
+
+A few high speed modems have a firmware bug that drops characters when the
+direction of high speed transmissson is reversed.
+The environment variable ZNULLS may be used to specify the number of nulls to
+send before a ZDATA frame.
+Values of 101 for a 4.77 mHz PC and 124 for an AT are typical.
diff --git a/missing b/missing
new file mode 100755
index 0000000..dc01d27
--- /dev/null
+++ b/missing
@@ -0,0 +1,134 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison touch file \`y.tab.c'
+ makeinfo touch the output file
+ yacc touch file \`y.tab.c'"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing - GNU libit 0.0"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. It should be needed only if
+ you modified \`acinclude.m4' or \`configure.in'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. It should be needed only if
+ you modified \`configure.in'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. It should be needed only if
+ you modified \`acconfig.h' or \`configure.in'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ touch config.h.in
+ ;;
+
+ automake)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. It should be needed only if
+ you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print \
+ | sed 's/^\(.*\).am$/touch \1.in/' \
+ | sh
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ touch y.tab.c
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. It should be needed only if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100755
index 0000000..936cf34
--- /dev/null
+++ b/mkinstalldirs
@@ -0,0 +1,34 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Last modified: 1995-03-05
+# Public domain
+
+errstatus=0
+
+for file in ${1+"$@"} ; do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d in ${1+"$@"} ; do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp" 1>&2
+ mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
+ fi
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
diff --git a/po/CVS/Entries b/po/CVS/Entries
new file mode 100644
index 0000000..a9a813b
--- /dev/null
+++ b/po/CVS/Entries
@@ -0,0 +1,9 @@
+/ChangeLog/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/Makefile.in.in/1.1.1.4/Sun Apr 26 13:22:40 1998/-ko/
+/POTFILES.in/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/cat-id-tbl.c/1.7/Sun Aug 22 18:51:21 1999/-ko/
+/de.gmo/1.7/Sun Aug 22 19:59:09 1999/-ko/
+/de.po/1.10/Sun Aug 22 19:59:09 1999/-ko/
+/lrzsz.pot/1.20/Sun Aug 22 19:01:20 1999/-ko/
+/stamp-cat-id/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+D
diff --git a/po/CVS/Repository b/po/CVS/Repository
new file mode 100644
index 0000000..795e2ec
--- /dev/null
+++ b/po/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/po
diff --git a/po/CVS/Root b/po/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/po/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/po/ChangeLog b/po/ChangeLog
new file mode 100644
index 0000000..4dc2621
--- /dev/null
+++ b/po/ChangeLog
@@ -0,0 +1,147 @@
+/* Automatically generated by po2tbl.sed from lrzsz.pot. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libgettext.h"
+
+const struct _msg_ent _msg_tbl[] = {
+ {"", 1},
+ {"Transfer complete.", 2},
+ {"need at least one file to send", 3},
+ {"option C needs argument", 4},
+ {"option c needs argument", 5},
+ {"option L needs argument", 6},
+ {"argument to option L out of range 24..%ld", 7},
+ {"option l needs argument", 8},
+ {"argument to option l out of range 32..%ld", 9},
+ {"argument to option t out of range 10..1000", 10},
+ {"security violation: can't do that under restricted shell\n", 11},
+ {"option w needs argument", 12},
+ {"unknown option", 13},
+ {"Can't send command in restricted mode\n", 14},
+ {"out of memory", 15},
+ {"Transfer incomplete\n", 16},
+ {"Transfer complete\n", 17},
+ {"Answering TIMESYNC", 18},
+ {"at", 19},
+ {"timezone", 20},
+ {"unknown", 21},
+ {"TIMESYNC: failed\n", 22},
+ {"TIMESYNC: ok\n", 23},
+ {" cannot open tmpfile %s: %s", 24},
+ {"Can't open any requested files.", 25},
+ {"Security Violation", 26},
+ {"Sending %s, %ld blocks: ", 27},
+ {"Give your local XMODEM receive command now.", 28},
+ {"Sending: %s\n", 29},
+ {"Timeout on pathname", 30},
+ {"Receiver Cancelled", 31},
+ {"No ACK on EOT", 32},
+ {"Ymodem sectors/kbytes sent: %3d/%2dk", 33},
+ {"Cancelled", 34},
+ {"Timeout on sector ACK", 35},
+ {"NAK on sector", 36},
+ {"Got burst for sector ACK", 37},
+ {"Got %02x for sector ACK", 38},
+ {"Retry Count Exceeded", 39},
+ {"%s version %s for %s %s\n", 40},
+ {"Send file(s) with ZMODEM/YMODEM/XMODEM Protocol\n", 41},
+ {"\
+\t(Y) = Option applies to YMODEM only\n\
+\t(Z) = Option applies to ZMODEM only\n", 42},
+ {"Usage: %s %s\n", 43},
+ {"\
+\tlsz [-2Ceqv] -c COMMAND\n\
+\tlsb [-2adfkquv] [-] file ...\n\
+\tlsx [-2akquv] [-] file\n\
+\t2 Use 2 stop bits\n\
+\t8 go up to 8K blocksize (give twice to start with 8K blocksize)\n\
+\t+ Append to existing destination file (Z)\n\
+\ta (ASCII) change NL to CR/LF\n\
+\tb Binary file transfer override\n\
+\tc send COMMAND (Z)\n\
+\td Change '.' to '/' in pathnames (Y/Z)\n\
+\te Escape all control characters (Z)\n\
+\tf send Full pathname (Y/Z)\n\
+\ti send COMMAND, ack Immediately (Z)\n\
+\th Print this usage message\n\
+\tk Send 1024 byte packets (Y)\n\
+\tL N Limit subpacket length to N bytes (Z)\n\
+\tl N Limit frame length to N bytes (l>=L) (Z)\n\
+\tn send file if source newer (Z)\n\
+\tN send file if source newer or longer (Z)\n\
+\to Use 16 bit CRC instead of 32 bit CRC (Z)\n\
+\tp Protect existing destination file (Z)\n\
+\tr Resume/Recover interrupted file transfer (Z)\n\
+\tq Quiet (no progress reports)\n\
+\tu Unlink file after transmission\n\
+\tU disable restricted mode (if allowed to)\n\
+\tv Verbose - provide debugging information\n\
+\tw N Window is N bytes (Z)\n\
+\tY Yes, overwrite existing file, skip if not present at rx (Z)\n\
+\ty Yes, overwrite existing file (Z)\n", 44},
+ {"Bytes Sent:%7ld/%7ld BPS:%-8ld ETA %02d:%02d ", 45},
+ {"Bytes Sent:%7ld BPS:%-8ld \n", 46},
+ {"Falldown to %ld blklen", 47},
+ {"Sender Canceled", 48},
+ {"TIMEOUT", 49},
+ {"Bad data subpacket", 50},
+ {"Data subpacket too long", 51},
+ {"Garbage count exceeded", 52},
+ {"Got %s", 53},
+ {"Bad escape sequence %x", 54},
+ {"Retry %d: ", 55},
+ {"don't have settimeofday, will not set time\n", 56},
+ {"not running as root (this is good!), can not set time\n", 57},
+ {"option t needs argument", 58},
+ {"for", 59},
+ {"Receive files with ZMODEM/YMODEM/XMODEM protocol\n", 60},
+ {"\
+\t+ append to existing files\n\
+\ta ASCII transfer (change CR/LF to LF)\n\
+\tb binary transfer\n\
+\tc Use 16 bit CRC (XMODEM only)\n\
+\tC allow execution of remote commands (ZMODEM only)\n\
+\tD write all received data to /dev/null\n\
+\te Escape control characters\t(ZMODEM)\n\
+\th Help, print this usage message\n\
+\tO disable timeout code, wait forever for remote data\n\
+\tp protect existing files\n\
+\tq quiet, no progress reports\n\
+\tr try to resume interrupted file transfer (ZMODEM only)\n\
+\tR restricted, more secure mode\n\
+\tS request timesync packet (give twice to set local time)\n\
+\tu keep upper case filenames\n\
+\tU disable restricted mode (if allowed to)\n\
+\tv Verbose - provide debugging information\n\
+\tw N Window is N bytes (Z)\n\
+\ty Yes, clobber existing file if any\n", 61},
+ {"%s waiting to receive.", 62},
+ {"%s: ready to receive %s", 63},
+ {"%s: %s removed.", 64},
+ {"Pathname fetch returned EOT", 65},
+ {"Received dup Sector", 66},
+ {"Sync Error", 67},
+ {"CRC", 68},
+ {"Checksum", 69},
+ {"Sector number garbled", 70},
+ {"Sender CANcelled", 71},
+ {"Got 0%o sector header", 72},
+ {"TIMESYNC: here %ld, remote %ld, diff %d seconds\n", 73},
+ {"TIMESYNC: cannot set time: %s\n", 74},
+ {"Topipe", 75},
+ {"Receiving: %s\n", 76},
+ {"cannot open %s", 77},
+ {"Blocks received: %d", 78},
+ {"%s: %s exists\n", 79},
+ {"%s:\tSecurity Violation", 80},
+ {"remote command execution requested", 81},
+ {"not executed", 82},
+ {"Bytes Received: %7ld/%7ld BPS:%-6ld ", 83},
+ {"Bytes Received: %7ld/%7ld BPS:%-6ld ETA %02d:%02d ", 84},
+ {"file close error", 85},
+};
+
+int _msg_tbl_length = 85;
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
new file mode 100644
index 0000000..c25fea4
--- /dev/null
+++ b/po/Makefile.in.in
@@ -0,0 +1,247 @@
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datadir = $(prefix)/@DATADIRNAME@
+localedir = $(datadir)/locale
+gnulocaledir = $(prefix)/share/locale
+gettextsrcdir = $(prefix)/share/gettext/po
+subdir = po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
+
+CC = @CC@
+GENCAT = @GENCAT@
+GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
+MSGFMT = @MSGFMT@
+XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
+MSGMERGE = PATH=../src:$$PATH msgmerge
+
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCLUDES = -I.. -I$(top_srcdir)/intl
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+SOURCES = cat-id-tbl.c
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
+stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+INSTOBJEXT = @INSTOBJEXT@
+
+.SUFFIXES:
+.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
+
+.c.o:
+ $(COMPILE) $<
+
+.po.pox:
+ $(MAKE) $(PACKAGE).pot
+ $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
+
+.po.mo:
+ $(MSGFMT) -o $@ $<
+
+.po.gmo:
+ file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+ && rm -f $$file && $(GMSGFMT) -o $$file $<
+
+.po.cat:
+ sed -f ../intl/po2msg.sed < $< > $*.msg \
+ && rm -f $@ && $(GENCAT) $@ $*.msg
+
+
+all: all-@USE_NLS@
+
+all-yes: cat-id-tbl.c $(CATALOGS)
+all-no:
+
+$(srcdir)/$(PACKAGE).pot: $(POTFILES)
+ $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
+ --add-comments --keyword=_ --keyword=N_ \
+ --files-from=$(srcdir)/POTFILES.in
+ rm -f $(srcdir)/$(PACKAGE).pot
+ mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
+
+$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
+$(srcdir)/stamp-cat-id: $(PACKAGE).pot
+ rm -f cat-id-tbl.tmp
+ sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
+ | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
+ if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
+ rm cat-id-tbl.tmp; \
+ else \
+ echo cat-id-tbl.c changed; \
+ rm -f $(srcdir)/cat-id-tbl.c; \
+ mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
+ fi
+ cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
+
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-@USE_NLS@
+install-data-no: all
+install-data-yes: all
+ if test -r $(MKINSTALLDIRS); then \
+ $(MKINSTALLDIRS) $(datadir); \
+ else \
+ $(top_srcdir)/mkinstalldirs $(datadir); \
+ fi
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ case "$$cat" in \
+ *.gmo) destdir=$(gnulocaledir);; \
+ *) destdir=$(localedir);; \
+ esac; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ dir=$$destdir/$$lang/LC_MESSAGES; \
+ if test -r $(MKINSTALLDIRS); then \
+ $(MKINSTALLDIRS) $$dir; \
+ else \
+ $(top_srcdir)/mkinstalldirs $$dir; \
+ fi; \
+ if test -r $$cat; then \
+ $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+ echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
+ else \
+ $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
+ echo "installing $(srcdir)/$$cat as" \
+ "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
+ fi; \
+ if test -r $$cat.m; then \
+ $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+ echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
+ else \
+ if test -r $(srcdir)/$$cat.m ; then \
+ $(INSTALL_DATA) $(srcdir)/$$cat.m \
+ $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
+ echo "installing $(srcdir)/$$cat as" \
+ "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
+ else \
+ true; \
+ fi; \
+ fi; \
+ done
+ if test "$(PACKAGE)" = "gettext"; then \
+ if test -r $(MKINSTALLDIRS); then \
+ $(MKINSTALLDIRS) $(gettextsrcdir); \
+ else \
+ $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
+ fi; \
+ $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
+ $(gettextsrcdir)/Makefile.in.in; \
+ else \
+ : ; \
+ fi
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
+ rm -f $(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+ rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
+ rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
+ done
+ rm -f $(gettextsrcdir)/po-Makefile.in.in
+
+check: all
+
+cat-id-tbl.o: ../intl/libgettext.h
+
+dvi info tags TAGS ID:
+
+mostlyclean:
+ rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
+ rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+ rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+
+maintainer-clean: distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+ rm -f $(GMOFILES)
+
+distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: update-po $(DISTFILES)
+ dists="$(DISTFILES)"; \
+ for file in $$dists; do \
+ ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+ || cp -p $(srcdir)/$$file $(distdir); \
+ done
+
+update-po: Makefile
+ $(MAKE) $(PACKAGE).pot
+ PATH=`pwd`/../src:$$PATH; \
+ cd $(srcdir); \
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ mv $$lang.po $$lang.old.po; \
+ echo "$$lang:"; \
+ if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
+ rm -f $$lang.old.po; \
+ else \
+ echo "msgmerge for $$cat failed!"; \
+ rm -f $$lang.po; \
+ mv $$lang.old.po $$lang.po; \
+ fi; \
+ done
+
+POTFILES: POTFILES.in
+ ( if test 'x$(srcdir)' != 'x.'; then \
+ posrcprefix='$(top_srcdir)/'; \
+ else \
+ posrcprefix="../"; \
+ fi; \
+ rm -f $@-t $@ \
+ && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
+ -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
+ | sed -e '$$s/\\$$//') > $@-t \
+ && chmod a-w $@-t \
+ && mv $@-t $@ )
+
+Makefile: Makefile.in.in ../config.status POTFILES
+ cd .. \
+ && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+ $(SHELL) ./config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..3d78bfa
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,6 @@
+src/rbsb.c
+src/lsz.c
+src/zm.c
+src/zperr.c
+src/zreadline.c
+src/lrz.c
diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c
new file mode 100644
index 0000000..b31c9db
--- /dev/null
+++ b/po/cat-id-tbl.c
@@ -0,0 +1,233 @@
+/* Automatically generated by po2tbl.sed from lrzsz.pot. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "libgettext.h"
+
+const struct _msg_ent _msg_tbl[] = {
+ {"", 1},
+ {"io_mode(,2) in rbsb.c not implemented\n", 2},
+ {"caught signal %d; exiting", 3},
+ {"command tries", 4},
+ {"packetlength", 5},
+ {"packetlength out of range 24..%ld", 6},
+ {"framelength", 7},
+ {"framelength out of range 32..%ld", 8},
+ {"min_bps", 9},
+ {"min_bps must be >= 0", 10},
+ {"min_bps_time", 11},
+ {"min_bps_time must be > 1", 12},
+ {"hour to large (0..23)", 13},
+ {"unparsable stop time\n", 14},
+ {"minute to large (0..59)", 15},
+ {"stop time to small", 16},
+ {"stop-at", 17},
+ {"timeout", 18},
+ {"timeout out of range 10..1000", 19},
+ {"security violation: can't do that under restricted shell\n", 20},
+ {"window size", 21},
+ {"cannot turnoff syslog", 22},
+ {"startup delay", 23},
+ {"out of memory", 24},
+ {"this program was never intended to be used setuid\n", 25},
+ {"need at least one file to send", 26},
+ {"Can't send command in restricted mode\n", 27},
+ {"hostname too long\n", 28},
+ {"illegal server address\n", 29},
+ {"can read only one file from stdin", 30},
+ {"Transfer incomplete\n", 31},
+ {"Transfer complete\n", 32},
+ {"send_pseudo %s: cannot open tmpfile %s: %s", 33},
+ {"send_pseudo %s: cannot lstat tmpfile %s: %s", 34},
+ {"send_pseudo %s: avoiding symlink trap", 35},
+ {"send_pseudo %s: cannot write to tmpfile %s: %s", 36},
+ {"send_pseudo %s: failed", 37},
+ {"send_pseudo %s: ok", 38},
+ {"Answering TIMESYNC at %s", 39},
+ {"timezone", 40},
+ {"timezone unknown", 41},
+ {"Can't open any requested files.", 42},
+ {"security violation: not allowed to upload from %s", 43},
+ {"cannot open %s", 44},
+ {"is not a file: %s", 45},
+ {"%s/%s: error occured", 46},
+ {"skipped: %s", 47},
+ {"%s/%s: skipped", 48},
+ {"Bytes Sent:%7ld BPS:%-8ld \n", 49},
+ {"Sending %s, %ld blocks: ", 50},
+ {"Give your local XMODEM receive command now.", 51},
+ {"Sending: %s\n", 52},
+ {"Timeout on pathname", 53},
+ {"Receiver Cancelled", 54},
+ {"No ACK on EOT", 55},
+ {"Xmodem sectors/kbytes sent: %3d/%2dk", 56},
+ {"Ymodem sectors/kbytes sent: %3d/%2dk", 57},
+ {"Cancelled", 58},
+ {"Timeout on sector ACK", 59},
+ {"NAK on sector", 60},
+ {"Got burst for sector ACK", 61},
+ {"Got %02x for sector ACK", 62},
+ {"Retry Count Exceeded", 63},
+ {"Try `%s --help' for more information.\n", 64},
+ {"%s version %s\n", 65},
+ {"Usage: %s [options] file ...\n", 66},
+ {" or: %s [options] -{c|i} COMMAND\n", 67},
+ {"Send file(s) with ZMODEM/YMODEM/XMODEM protocol\n", 68},
+ {"\
+ (X) = option applies to XMODEM only\n\
+ (Y) = option applies to YMODEM only\n\
+ (Z) = option applies to ZMODEM only\n", 69},
+ {"\
+ -+, --append append to existing destination file (Z)\n\
+ -2, --twostop use 2 stop bits\n\
+ -4, --try-4k go up to 4K blocksize\n\
+ --start-4k start with 4K blocksize (doesn't try 8)\n\
+ -8, --try-8k go up to 8K blocksize\n\
+ --start-8k start with 8K blocksize\n\
+ -a, --ascii ASCII transfer (change CR/LF to LF)\n\
+ -b, --binary binary transfer\n\
+ -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n\
+ -c, --command COMMAND execute remote command COMMAND (Z)\n\
+ -C, --command-tries N try N times to execute a command (Z)\n\
+ -d, --dot-to-slash change '.' to '/' in pathnames (Y/Z)\n\
+ --delay-startup N sleep N seconds before doing anything\n\
+ -e, --escape escape all control characters (Z)\n\
+ -E, --rename force receiver to rename files it already has\n\
+ -f, --full-path send full pathname (Y/Z)\n\
+ -i, --immediate-command CMD send remote CMD, return immediately (Z)\n\
+ -h, --help print this usage message\n\
+ -k, --1k send 1024 byte packets (X)\n\
+ -L, --packetlen N limit subpacket length to N bytes (Z)\n\
+ -l, --framelen N limit frame length to N bytes (l>=L) (Z)\n\
+ -m, --min-bps N stop transmission if BPS below N\n\
+ -M, --min-bps-time N for at least N seconds (default: 120)\n", 70},
+ {"\
+ -n, --newer send file if source newer (Z)\n\
+ -N, --newer-or-longer send file if source newer or longer (Z)\n\
+ -o, --16-bit-crc use 16 bit CRC instead of 32 bit CRC (Z)\n\
+ -O, --disable-timeouts disable timeout code, wait forever\n\
+ -p, --protect protect existing destination file (Z)\n\
+ -r, --resume resume interrupted file transfer (Z)\n\
+ -R, --restricted restricted, more secure mode\n\
+ -q, --quiet quiet (no progress reports)\n\
+ -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n\
+ --tcp-server open socket, wait for connection (Z)\n\
+ --tcp-client ADDR:PORT open socket, connect to ... (Z)\n\
+ -u, --unlink unlink file after transmission\n\
+ -U, --unrestrict turn off restricted mode (if allowed to)\n\
+ -v, --verbose be verbose, provide debugging information\n\
+ -w, --windowsize N Window is N bytes (Z)\n\
+ -X, --xmodem use XMODEM protocol\n\
+ -y, --overwrite overwrite existing files\n\
+ -Y, --overwrite-or-skip overwrite existing files, else skip\n\
+ --ymodem use YMODEM protocol\n\
+ -Z, --zmodem use ZMODEM protocol\n\
+\n\
+short options use the same arguments as the long ones\n", 71},
+ {"got ZRQINIT", 72},
+ {"got ZCAN", 73},
+ {"blklen now %d\n", 74},
+ {"zsendfdata: bps rate %ld below min %ld", 75},
+ {"zsendfdata: reached stop time", 76},
+ {"Bytes Sent:%7ld/%7ld BPS:%-8ld ETA %02d:%02d ", 77},
+ {"calc_blklen: reduced to %d due to error\n", 78},
+ {"calc_blklen: returned old value %d due to low bpe diff\n", 79},
+ {"calc_blklen: old %ld, new %ld, d %ld\n", 80},
+ {"calc_blklen: calc total_bytes=%ld, bpe=%ld, ec=%ld\n", 81},
+ {"calc_blklen: blklen %d, ok %ld, failed %ld -> %lu\n", 82},
+ {"calc_blklen: returned %d as best\n", 83},
+ {"\
+\n\
+countem: Total %d %ld\n", 84},
+ {"Bad escape sequence %x", 85},
+ {"Sender Canceled", 86},
+ {"TIMEOUT", 87},
+ {"Bad data subpacket", 88},
+ {"Data subpacket too long", 89},
+ {"Garbage count exceeded", 90},
+ {"Got %s", 91},
+ {"Retry %d: ", 92},
+ {"don't have settimeofday, will not set time\n", 93},
+ {"not running as root (this is good!), can not set time\n", 94},
+ {"bytes_per_error", 95},
+ {"bytes-per-error should be >100", 96},
+ {"O_SYNC not supported by the kernel", 97},
+ {"garbage on commandline", 98},
+ {"Usage: %s [options] [filename.if.xmodem]\n", 99},
+ {"Receive files with ZMODEM/YMODEM/XMODEM protocol\n", 100},
+ {"\
+ -+, --append append to existing files\n\
+ -a, --ascii ASCII transfer (change CR/LF to LF)\n\
+ -b, --binary binary transfer\n\
+ -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n\
+ -c, --with-crc Use 16 bit CRC (X)\n\
+ -C, --allow-remote-commands allow execution of remote commands (Z)\n\
+ -D, --null write all received data to /dev/null\n\
+ --delay-startup N sleep N seconds before doing anything\n\
+ -e, --escape Escape control characters (Z)\n\
+ -E, --rename rename any files already existing\n\
+ --errors N generate CRC error every N bytes (debugging)\n\
+ -h, --help Help, print this usage message\n\
+ -m, --min-bps N stop transmission if BPS below N\n\
+ -M, --min-bps-time N for at least N seconds (default: 120)\n\
+ -O, --disable-timeouts disable timeout code, wait forever for data\n\
+ --o-sync open output file(s) in synchronous write mode\n\
+ -p, --protect protect existing files\n\
+ -q, --quiet quiet, no progress reports\n\
+ -r, --resume try to resume interrupted file transfer (Z)\n\
+ -R, --restricted restricted, more secure mode\n\
+ -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n\
+ -S, --timesync request remote time (twice: set local time)\n\
+ --syslog[=off] turn syslog on or off, if possible\n\
+ -t, --timeout N set timeout to N tenths of a second\n\
+ --tcp-server open socket, wait for connection (Z)\n\
+ --tcp-client ADDR:PORT open socket, connect to ... (Z)\n\
+ -u, --keep-uppercase keep upper case filenames\n\
+ -U, --unrestrict disable restricted mode (if allowed to)\n\
+ -v, --verbose be verbose, provide debugging information\n\
+ -w, --windowsize N Window is N bytes (Z)\n\
+ -X --xmodem use XMODEM protocol\n\
+ -y, --overwrite Yes, clobber existing file if any\n\
+ --ymodem use YMODEM protocol\n\
+ -Z, --zmodem use ZMODEM protocol\n\
+\n\
+short options use the same arguments as the long ones\n", 101},
+ {"%s waiting to receive.", 102},
+ {"\rBytes received: %7ld/%7ld BPS:%-6ld \r\n", 103},
+ {"%s: ready to receive %s", 104},
+ {"\rBytes received: %7ld BPS:%-6ld \r\n", 105},
+ {"\
+\r\n\
+%s: %s removed.\r\n", 106},
+ {"Pathname fetch returned EOT", 107},
+ {"Received dup Sector", 108},
+ {"Sync Error", 109},
+ {"CRC", 110},
+ {"Checksum", 111},
+ {"Sector number garbled", 112},
+ {"Sender Cancelled", 113},
+ {"Got 0%o sector header", 114},
+ {"file name ends with a /, skipped: %s\n", 115},
+ {"zmanag=%d, Lzmanag=%d\n", 116},
+ {"zconv=%d\n", 117},
+ {"file exists, skipped: %s\n", 118},
+ {"TIMESYNC: here %ld, remote %ld, diff %ld seconds\n", 119},
+ {"TIMESYNC: cannot set time: %s\n", 120},
+ {"Topipe", 121},
+ {"Receiving: %s\n", 122},
+ {"Blocks received: %d", 123},
+ {"%s: %s exists\n", 124},
+ {"%s:\tSecurity Violation", 125},
+ {"remote command execution requested", 126},
+ {"not executed", 127},
+ {"got ZRINIT", 128},
+ {"Skipped", 129},
+ {"rzfile: bps rate %ld below min %ld", 130},
+ {"rzfile: reached stop time", 131},
+ {"\rBytes received: %7ld/%7ld BPS:%-6ld ETA %02d:%02d ", 132},
+ {"file close error", 133},
+};
+
+int _msg_tbl_length = 133;
diff --git a/po/de.gmo b/po/de.gmo
new file mode 100644
index 0000000..270b0a0
--- /dev/null
+++ b/po/de.gmo
Binary files differ
diff --git a/po/de.po b/po/de.po
new file mode 100644
index 0000000..9d9a575
--- /dev/null
+++ b/po/de.po
@@ -0,0 +1,812 @@
+# german translation of lrzsz output
+# Copyright (C) 1997 Uwe Ohse
+# Uwe Ohse <uwe@ohse.de>, 1997.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 1999-08-22 21:00+0200\n"
+"PO-Revision-Date: 1997-06-01 19:00+0200\n"
+"Last-Translator: FULL NAME <uwe@ohse.de>\n"
+"Language-Team: none. try <uwe@ohse.de>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/lsz.c:228
+msgid "io_mode(,2) in rbsb.c not implemented\n"
+msgstr "io_mode(2) in rbsb.c nicht implementiert\n"
+
+#: src/lrz.c:196 src/lsz.c:230
+#, c-format
+msgid "caught signal %d; exiting"
+msgstr "erhielt Signal %d; Programmabbruch"
+
+#: src/lsz.c:400
+msgid "command tries"
+msgstr "Kommandowiederholungen"
+
+#: src/lsz.c:422
+msgid "packetlength"
+msgstr "Paketlänge"
+
+#: src/lsz.c:427
+#, c-format
+msgid "packetlength out of range 24..%ld"
+msgstr "Argument der Option L außerhalb des Bereichs 24..%ld"
+
+#: src/lsz.c:436
+msgid "framelength"
+msgstr "Framelänge"
+
+#: src/lsz.c:441
+#, c-format
+msgid "framelength out of range 32..%ld"
+msgstr "Argument der Option l außerhalb des Bereichs 32..%ld"
+
+#: src/lrz.c:318 src/lsz.c:450
+msgid "min_bps"
+msgstr "minimale BPS-Rate"
+
+#: src/lsz.c:452
+msgid "min_bps must be >= 0"
+msgstr "minimale BPS-Rate muß >= 0 sein"
+
+#: src/lrz.c:324 src/lsz.c:458
+msgid "min_bps_time"
+msgstr ""
+
+#: src/lrz.c:326 src/lsz.c:460
+msgid "min_bps_time must be > 1"
+msgstr "Zeitfenster für minimale BPS-Rate muß > 1 Sekunde sein"
+
+#: src/lrz.c:342 src/lsz.c:484
+msgid "hour to large (0..23)"
+msgstr "Stunde zu gross (0..23)"
+
+#: src/lrz.c:344 src/lsz.c:486
+msgid "unparsable stop time\n"
+msgstr "unparsbare Endzeit\n"
+
+#: src/lrz.c:348 src/lsz.c:490
+msgid "minute to large (0..59)"
+msgstr "Minute zu groß (0..59)"
+
+#: src/lrz.c:358 src/lrz.c:365 src/lsz.c:500 src/lsz.c:507
+msgid "stop time to small"
+msgstr "Stopzeit zu kurz"
+
+#: src/lrz.c:363 src/lsz.c:505
+msgid "stop-at"
+msgstr ""
+
+#: src/lrz.c:394 src/lsz.c:516
+msgid "timeout"
+msgstr "Timeout"
+
+#: src/lrz.c:396 src/lsz.c:518
+msgid "timeout out of range 10..1000"
+msgstr "Argument der Option t außerhalb des Bereichs 10..1000"
+
+#: src/lrz.c:412 src/lsz.c:526
+msgid "security violation: can't do that under restricted shell\n"
+msgstr "Sicherheitsverstoß: Ausführung unter eingeschränkter Shell verboten\n"
+
+#: src/lrz.c:402 src/lsz.c:533
+msgid "window size"
+msgstr "Fenstergröße"
+
+#: src/lrz.c:427 src/lrz.c:434 src/lsz.c:556 src/lsz.c:563
+msgid "cannot turnoff syslog"
+msgstr "kann syslogging nicht abschalten"
+
+#: src/lrz.c:449 src/lsz.c:571
+msgid "startup delay"
+msgstr "Startverzögerung"
+
+#: src/lrz.c:465 src/lrz.c:483 src/lrz.c:760 src/lrz.c:1122 src/lrz.c:1244
+#: src/lrz.c:1292 src/lrz.c:1309 src/lrz.c:1324 src/lrz.c:1423 src/lsz.c:580
+#: src/lsz.c:596 src/lsz.c:693 src/lsz.c:828 src/lsz.c:1061
+#: src/zreadline.c:127
+msgid "out of memory"
+msgstr "Kein Speicher mehr frei"
+
+#: src/lrz.c:475 src/lsz.c:592
+msgid "this program was never intended to be used setuid\n"
+msgstr "dieses Programm darf nicht setuid laufen\n"
+
+#: src/lsz.c:612 src/lsz.c:627
+msgid "need at least one file to send"
+msgstr "es muß mindestens ein Name einer zu sendenden Datei angegeben werden"
+
+#: src/lsz.c:629
+msgid "Can't send command in restricted mode\n"
+msgstr "Im eingeschränkten Modus ist das Senden von Kommandos verboten\n"
+
+#: src/lrz.c:527 src/lsz.c:656
+msgid "hostname too long\n"
+msgstr "Hostname zu lang\n"
+
+#: src/lrz.c:542 src/lsz.c:671
+msgid "illegal server address\n"
+msgstr "Illegale Serveraddresse\n"
+
+#: src/lsz.c:710
+msgid "can read only one file from stdin"
+msgstr "kann nur eine Datei von der Standardeingabe lesen"
+
+#: src/lrz.c:574 src/lsz.c:803
+msgid "Transfer incomplete\n"
+msgstr "Übertragung nicht abgeschlossen\n"
+
+#: src/lrz.c:576 src/lsz.c:805
+msgid "Transfer complete\n"
+msgstr "Übertragung abgeschlossen\n"
+
+#: src/lsz.c:838
+#, c-format
+msgid "send_pseudo %s: cannot open tmpfile %s: %s"
+msgstr "send_pseudo %s: kann temporäre Datei %s nicht öffnen: %s"
+
+#: src/lsz.c:851
+#, c-format
+msgid "send_pseudo %s: cannot lstat tmpfile %s: %s"
+msgstr "send_pseudo %s: kann lstat nicht auf temporäre Datei %s anwenden: %s"
+
+#: src/lsz.c:859
+#, c-format
+msgid "send_pseudo %s: avoiding symlink trap"
+msgstr "send_pseudo %s: vermied symlink Falle"
+
+#: src/lsz.c:870
+#, c-format
+msgid "send_pseudo %s: cannot write to tmpfile %s: %s"
+msgstr "send_pseudo %s: kann nicht in temporäre Datei %s schreiben: %s"
+
+#: src/lsz.c:879
+#, c-format
+msgid "send_pseudo %s: failed"
+msgstr "send_pseudo %s: Fehlschlag"
+
+#: src/lsz.c:882
+#, c-format
+msgid "send_pseudo %s: ok"
+msgstr "send_pseudo %s: Erfolg"
+
+#: src/lsz.c:916
+#, c-format
+msgid "Answering TIMESYNC at %s"
+msgstr "Beantworte Zeitsynchronisation um %s"
+
+#: src/lsz.c:921
+msgid "timezone"
+msgstr "Zeitzone"
+
+#: src/lsz.c:924
+msgid "timezone unknown"
+msgstr "Zeitzone unbekannt"
+
+#: src/lsz.c:953
+msgid "Can't open any requested files."
+msgstr "Kann keine der angeforderten Dateien öffnen"
+
+#: src/lsz.c:1009
+#, c-format
+msgid "security violation: not allowed to upload from %s"
+msgstr "Sicherheitsverstoß: Ausführung unter eingeschränkter Shell verboten"
+
+#: src/lrz.c:1384 src/lsz.c:1027
+#, c-format
+msgid "cannot open %s"
+msgstr "kann %s nicht öffnen"
+
+#: src/lsz.c:1082
+#, c-format
+msgid "is not a file: %s"
+msgstr "keine Datei: %s"
+
+#: src/lsz.c:1115 src/lsz.c:1130
+#, c-format
+msgid "%s/%s: error occured"
+msgstr "%s/%s: Fehler aufgetreten"
+
+#: src/lsz.c:1119
+#, c-format
+msgid "skipped: %s"
+msgstr "übersprungen: %s"
+
+#: src/lsz.c:1122
+#, c-format
+msgid "%s/%s: skipped"
+msgstr "%s/%s: übersprungen"
+
+#: src/lsz.c:1149
+#, c-format
+msgid "Bytes Sent:%7ld BPS:%-8ld \n"
+msgstr "Bytes gesendet:%7ld BPS:%-8ld \n"
+
+#: src/lsz.c:1178
+#, c-format
+msgid "Sending %s, %ld blocks: "
+msgstr "Sende %s, %ld Blöcke:"
+
+#: src/lsz.c:1181
+msgid "Give your local XMODEM receive command now."
+msgstr "Starten Sie nun Ihr XMODEM-Empfangsprogramm."
+
+#: src/lsz.c:1224
+#, c-format
+msgid "Sending: %s\n"
+msgstr "Sende: %s\n"
+
+#: src/lsz.c:1267
+msgid "Timeout on pathname"
+msgstr "Timeout beim Warten vor Pfadname"
+
+#: src/lsz.c:1314
+msgid "Receiver Cancelled"
+msgstr "Empfänger brach ab"
+
+#: src/lsz.c:1340
+msgid "No ACK on EOT"
+msgstr "Keine Bestätigung für Übertragungsende erhalten"
+
+#: src/lsz.c:1361
+#, c-format
+msgid "Xmodem sectors/kbytes sent: %3d/%2dk"
+msgstr "Ymodem Sektoren/Kilobytes gesendet: %3d/%2dk"
+
+#: src/lsz.c:1363
+#, c-format
+msgid "Ymodem sectors/kbytes sent: %3d/%2dk"
+msgstr "Ymodem Sektoren/Kilobytes gesendet: %3d/%2dk"
+
+#: src/lsz.c:1395
+msgid "Cancelled"
+msgstr "Abgebrochen"
+
+#: src/lsz.c:1399
+msgid "Timeout on sector ACK"
+msgstr "Timeout bei Sektorbestätigung"
+
+#: src/lsz.c:1404
+msgid "NAK on sector"
+msgstr "Sektor nicht bestätigt"
+
+#: src/lsz.c:1410
+msgid "Got burst for sector ACK"
+msgstr ""
+
+#: src/lsz.c:1412
+#, c-format
+msgid "Got %02x for sector ACK"
+msgstr "Erhielt %02x als Sektorbestätigung"
+
+#: src/lsz.c:1424
+msgid "Retry Count Exceeded"
+msgstr "Maximale Wiederholungsanzahl überschritten"
+
+#: src/lrz.c:596 src/lsz.c:1502
+#, c-format
+msgid "Try `%s --help' for more information.\n"
+msgstr "`%s --help' gibt weitere Informationen.\n"
+
+#: src/lrz.c:601 src/lsz.c:1507
+#, c-format
+msgid "%s version %s\n"
+msgstr "%s Version %s\n"
+
+#: src/lsz.c:1510
+#, c-format
+msgid "Usage: %s [options] file ...\n"
+msgstr "Benutzung: %s [Optionen] Datei ...\n"
+
+#: src/lsz.c:1512
+#, c-format
+msgid " or: %s [options] -{c|i} COMMAND\n"
+msgstr " oder: %s [Optionen] -{c|i} KOMMANDO\n"
+
+#: src/lsz.c:1513
+msgid "Send file(s) with ZMODEM/YMODEM/XMODEM protocol\n"
+msgstr "Dateien mit ZMODEM/YMODEM/XMODEM übertragen\n"
+
+# src/lrz.c:475 src/lsz.c:1330 xx
+#: src/lrz.c:607 src/lsz.c:1515
+msgid ""
+" (X) = option applies to XMODEM only\n"
+" (Y) = option applies to YMODEM only\n"
+" (Z) = option applies to ZMODEM only\n"
+msgstr ""
+" (X) = Option gilt nur für XMODEM\n"
+" (Y) = Option gilt nur für YMODEM\n"
+" (Z) = Option gilt nur für ZMODEM\n"
+
+#: src/lsz.c:1521
+msgid ""
+" -+, --append append to existing destination file (Z)\n"
+" -2, --twostop use 2 stop bits\n"
+" -4, --try-4k go up to 4K blocksize\n"
+" --start-4k start with 4K blocksize (doesn't try 8)\n"
+" -8, --try-8k go up to 8K blocksize\n"
+" --start-8k start with 8K blocksize\n"
+" -a, --ascii ASCII transfer (change CR/LF to LF)\n"
+" -b, --binary binary transfer\n"
+" -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n"
+" -c, --command COMMAND execute remote command COMMAND (Z)\n"
+" -C, --command-tries N try N times to execute a command (Z)\n"
+" -d, --dot-to-slash change '.' to '/' in pathnames (Y/Z)\n"
+" --delay-startup N sleep N seconds before doing anything\n"
+" -e, --escape escape all control characters (Z)\n"
+" -E, --rename force receiver to rename files it already has\n"
+" -f, --full-path send full pathname (Y/Z)\n"
+" -i, --immediate-command CMD send remote CMD, return immediately (Z)\n"
+" -h, --help print this usage message\n"
+" -k, --1k send 1024 byte packets (X)\n"
+" -L, --packetlen N limit subpacket length to N bytes (Z)\n"
+" -l, --framelen N limit frame length to N bytes (l>=L) (Z)\n"
+" -m, --min-bps N stop transmission if BPS below N\n"
+" -M, --min-bps-time N for at least N seconds (default: 120)\n"
+msgstr ""
+" -+, --append an existierende Dateien anhängen (Z)\n"
+" -2, --twostop zwei Stopbits verwenden\n"
+" -4, --try-4k bis zu 4K Blockgröße verwenden\n"
+" --start-4k mit 4K Blockgröße starten (versucht nicht 8)\n"
+" -8, --try-8k bis zu 8K Blockgröße verwenden\n"
+" --start-8k mit 8K Blockgröße starten\n"
+" -a, --ascii ASCII: NL nach CR/LF wandeln\n"
+" -b, --binary Binärübertragung erzwingen\n"
+" -B, --bufsize N N Bytes puffern (auto: ganze Datei puffern)\n"
+" -c, --command COMMAND Kommando KOMMANDO auf Gegenseite ausführen "
+"(Z)\n"
+" -C, --command-tries N N mal Kommandoausführung versuchen (Z)\n"
+" -d, --dot-to-slash C '.' in Dateinamen nach '/' wandeln (Y/Z)\n"
+" --delay-startup N Bei Programmstart N Sek. schlafen (Debugging)\n"
+" -e, --escape alle Steuerzeichen escapen (Z)\n"
+" -E, --rename Empfänger soll Datei umbenennen falls\n"
+" Zieldatei schon existiert\n"
+" -f, --full-path Dateien mit vollen Pfaden senden (Y/Z)\n"
+" -i, --immediate-command CMD wie `c', aber sofort zurückkehren (Z)\n"
+" -h, --help diesen Hilfetext ausgeben\n"
+" -k, --1k 1024 Bytes Pakete senden (Y)\n"
+" -L, --packetlen N Unterpaketlänge auf N Bytes beschränken (Z)\n"
+" -l, --framelen N Rahmenlänge auf N Bytes beschränken (l>=L) "
+"(Z)\n"
+" -m, --min-bps N Übertragung abbrechen bei weniger als N BPS\n"
+" -M, --min-bps-time N für mindestens N Sekunden (Default: 120)\n"
+
+#: src/lsz.c:1546
+msgid ""
+" -n, --newer send file if source newer (Z)\n"
+" -N, --newer-or-longer send file if source newer or longer (Z)\n"
+" -o, --16-bit-crc use 16 bit CRC instead of 32 bit CRC (Z)\n"
+" -O, --disable-timeouts disable timeout code, wait forever\n"
+" -p, --protect protect existing destination file (Z)\n"
+" -r, --resume resume interrupted file transfer (Z)\n"
+" -R, --restricted restricted, more secure mode\n"
+" -q, --quiet quiet (no progress reports)\n"
+" -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n"
+" --tcp-server open socket, wait for connection (Z)\n"
+" --tcp-client ADDR:PORT open socket, connect to ... (Z)\n"
+" -u, --unlink unlink file after transmission\n"
+" -U, --unrestrict turn off restricted mode (if allowed to)\n"
+" -v, --verbose be verbose, provide debugging information\n"
+" -w, --windowsize N Window is N bytes (Z)\n"
+" -X, --xmodem use XMODEM protocol\n"
+" -y, --overwrite overwrite existing files\n"
+" -Y, --overwrite-or-skip overwrite existing files, else skip\n"
+" --ymodem use YMODEM protocol\n"
+" -Z, --zmodem use ZMODEM protocol\n"
+"\n"
+"short options use the same arguments as the long ones\n"
+msgstr ""
+" -n, --newer Datei senden wenn sie neuer ist (Z)\n"
+" -N, --newer-or-longer Datei senden wenn neuer oder länger (Z)\n"
+" -o, --16-bit-crc 16Bit CRC statt 32Bit CRC verwenden (Z)\n"
+" -O, --disable-timeouts Timeoutbehandlung abschalten\n"
+" -p, --protect existierende Dateien nicht verändern\n"
+" -r, --resume unterbrochene Übertragungen fortsetzen (Z)\n"
+" -R, --restricted eingeschränkter, sichererer Modus\n"
+" -q, --quiet leise, keine Ausgaben machen\n"
+" -s, --stop-at {HH:MM|+N} Übertragung um HH:MM oder in N Sek. abbrechen\n"
+" --tcp-server Socket öffnen und auf Verbindung warten\n"
+" --tcp-client ADDR:PORT Socket öffnen und verbindung mit ...\n"
+" -u, --unlink Datei nach Übertragung löschen\n"
+" -U, --unrestrict eingeschränkten Modus aufheben (falls "
+"erlaubt)\n"
+" -v, --verbose mehr ausgeben\n"
+" -w, --windowsize N Fenstergröße auf N Bytes setzen (Z)\n"
+" -X --xmodem XMODEM-Protokoll benutzen\n"
+" -y, --overwrite existierende Dateien überschreiben\n"
+" -Y, --overwrite-or-skip wie `y', aber nicht existierende überspringen\n"
+" --ymodem YMODEM-Protokoll benutzen\n"
+" -Z, --zmodem ZMODEM-Protokoll benutzen\n"
+"\n"
+"Kurze Optionen benötigen dieselben Argumente wie Lange.\n"
+
+#: src/lsz.c:1768
+msgid "got ZRQINIT"
+msgstr "erhielt ZRQINIT"
+
+#: src/lrz.c:1079 src/lrz.c:1772 src/lsz.c:1774
+msgid "got ZCAN"
+msgstr "erhielt ZCAN"
+
+#: src/lsz.c:1991
+#, c-format
+msgid "blklen now %d\n"
+msgstr "Blockgröße nun %d\n"
+
+#: src/lsz.c:2053
+#, c-format
+msgid "zsendfdata: bps rate %ld below min %ld"
+msgstr "rzfile: BPS-Rate %ld unter Minimum %ld"
+
+#: src/lsz.c:2070
+msgid "zsendfdata: reached stop time"
+msgstr "rzfile: Abbruchzeit erreicht"
+
+#: src/lsz.c:2080
+#, c-format
+msgid "Bytes Sent:%7ld/%7ld BPS:%-8ld ETA %02d:%02d "
+msgstr "Bytes gesendet:%7ld/%7ld BPS:%-8ld ETA %02d:%02d "
+
+#: src/lsz.c:2223
+#, c-format
+msgid "calc_blklen: reduced to %d due to error\n"
+msgstr "calc_blklen: Blockgrösse auf %d reduziert wegen Fehler\n"
+
+#: src/lsz.c:2256
+#, c-format
+msgid "calc_blklen: returned old value %d due to low bpe diff\n"
+msgstr "calc_blklen: liefert alten Wert %d wegen geringer bpe Differenz\n"
+
+#: src/lsz.c:2258
+#, c-format
+msgid "calc_blklen: old %ld, new %ld, d %ld\n"
+msgstr "calc_blklen: alt %ld, neu %ld, Differenz %ld\n"
+
+#: src/lsz.c:2267
+#, c-format
+msgid "calc_blklen: calc total_bytes=%ld, bpe=%ld, ec=%ld\n"
+msgstr "calc_blklen: kalkuliere gesamt_bytes=%ld, bpe=%le, ec=%ld\n"
+
+#: src/lsz.c:2278
+#, c-format
+msgid "calc_blklen: blklen %d, ok %ld, failed %ld -> %lu\n"
+msgstr "calc_blklen: Blocklänge %d, ok %ld, fehlgeschlagen %ld -> %lu\n"
+
+#: src/lsz.c:2290
+#, c-format
+msgid "calc_blklen: returned %d as best\n"
+msgstr "calc_blklen: liefert %d als besten Wert\n"
+
+#: src/lsz.c:2486
+#, c-format
+msgid ""
+"\n"
+"countem: Total %d %ld\n"
+msgstr ""
+"\n"
+"countem: Gesamt %d %ld\n"
+
+#: src/zm.c:245
+#, c-format
+msgid "Bad escape sequence %x"
+msgstr "Falsche Escapesequenz %x"
+
+#: src/zm.c:583 src/zm.c:642
+msgid "Sender Canceled"
+msgstr "Sender brach ab"
+
+#: src/lrz.c:1002 src/zm.c:586 src/zm.c:645
+msgid "TIMEOUT"
+msgstr "TIMEOUT"
+
+#: src/zm.c:589 src/zm.c:648
+msgid "Bad data subpacket"
+msgstr "Falsches Unterpaket"
+
+#: src/zm.c:596 src/zm.c:655
+msgid "Data subpacket too long"
+msgstr "Datenunterpaket zu lang"
+
+#: src/zm.c:712
+msgid "Garbage count exceeded"
+msgstr "Maximale Wiederholungsanzahl überschritten"
+
+#: src/zm.c:773
+#, c-format
+msgid "Got %s"
+msgstr "Erhielt %s"
+
+#: src/zperr.c:49
+#, c-format
+msgid "Retry %d: "
+msgstr "Wiederholungsversuch %d: "
+
+#: src/lrz.c:382
+msgid "don't have settimeofday, will not set time\n"
+msgstr "Zeitsynchronisation nicht ausführbar, settimeofday() fehlt\n"
+
+#: src/lrz.c:386
+msgid "not running as root (this is good!), can not set time\n"
+msgstr "Zeitsynchronisation mangels Superuserrechten nicht ausführbar\n"
+
+#: src/lrz.c:441
+msgid "bytes_per_error"
+msgstr "Bytes-pro-Fehler"
+
+#: src/lrz.c:443
+msgid "bytes-per-error should be >100"
+msgstr "Bytes-pro-Fehler muss >100 sein"
+
+#: src/lrz.c:455
+msgid "O_SYNC not supported by the kernel"
+msgstr "O_SYNC vom Kernel nicht unterstützt"
+
+#: src/lrz.c:497 src/lrz.c:499
+msgid "garbage on commandline"
+msgstr "Müll auf der Kommandozeile"
+
+#: src/lrz.c:604
+#, c-format
+msgid "Usage: %s [options] [filename.if.xmodem]\n"
+msgstr "Benutzung: %s [Optionen] [Dateiname.für.xmodem]\n"
+
+#: src/lrz.c:605
+msgid "Receive files with ZMODEM/YMODEM/XMODEM protocol\n"
+msgstr "Dateien mit ZMODEM/YMODEM/XMODEM-Protokoll empfangen\n"
+
+#: src/lrz.c:612
+msgid ""
+" -+, --append append to existing files\n"
+" -a, --ascii ASCII transfer (change CR/LF to LF)\n"
+" -b, --binary binary transfer\n"
+" -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n"
+" -c, --with-crc Use 16 bit CRC (X)\n"
+" -C, --allow-remote-commands allow execution of remote commands (Z)\n"
+" -D, --null write all received data to /dev/null\n"
+" --delay-startup N sleep N seconds before doing anything\n"
+" -e, --escape Escape control characters (Z)\n"
+" -E, --rename rename any files already existing\n"
+" --errors N generate CRC error every N bytes (debugging)\n"
+" -h, --help Help, print this usage message\n"
+" -m, --min-bps N stop transmission if BPS below N\n"
+" -M, --min-bps-time N for at least N seconds (default: 120)\n"
+" -O, --disable-timeouts disable timeout code, wait forever for data\n"
+" --o-sync open output file(s) in synchronous write mode\n"
+" -p, --protect protect existing files\n"
+" -q, --quiet quiet, no progress reports\n"
+" -r, --resume try to resume interrupted file transfer (Z)\n"
+" -R, --restricted restricted, more secure mode\n"
+" -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n"
+" -S, --timesync request remote time (twice: set local time)\n"
+" --syslog[=off] turn syslog on or off, if possible\n"
+" -t, --timeout N set timeout to N tenths of a second\n"
+" --tcp-server open socket, wait for connection (Z)\n"
+" --tcp-client ADDR:PORT open socket, connect to ... (Z)\n"
+" -u, --keep-uppercase keep upper case filenames\n"
+" -U, --unrestrict disable restricted mode (if allowed to)\n"
+" -v, --verbose be verbose, provide debugging information\n"
+" -w, --windowsize N Window is N bytes (Z)\n"
+" -X --xmodem use XMODEM protocol\n"
+" -y, --overwrite Yes, clobber existing file if any\n"
+" --ymodem use YMODEM protocol\n"
+" -Z, --zmodem use ZMODEM protocol\n"
+"\n"
+"short options use the same arguments as the long ones\n"
+msgstr ""
+" -+, --append an existierende Dateien anhängen\n"
+" -a, --ascii ASCII-Übertragung (CR/LF nach LF wandeln)\n"
+" -b, --binary Binärübertragung (keine Umwandlungen)\n"
+" -B, --bufsize N N Bytes puffern (auto: ganze Datei puffern)\n"
+" -c, --with-crc 16bit CRC statt Prüfsumme verwenden (X)\n"
+" -C, --allow-remote-commands Ausführung von Kommandos erlauben (Z)\n"
+" -D, --null empfangene Daten nach /dev/null schreiben\n"
+" --delay-startup N Bei Programmstart N Sek. schlafen (Debugging)\n"
+" -e, --escape Alle Steuerzeichen escapen (Z)\n"
+" -E, --rename Empfänger soll Datei umbenennen falls\n"
+" Zieldatei schon existiert\n"
+" --errors N Einen CRC-Fehler alle N Bytes erzeugen\n"
+" -h, --help Diesen Hilfstext ausgeben\n"
+" -m, --min-bps N Übertragung abbrechen bei weniger als N BPS\n"
+" -M, --min-bps-time N für mindestens N Sekunden (Default: 120)\n"
+" -O, --disable-timeouts Timeoutbehandlung abschalten\n"
+" --o-sync Ausgabedatei(en) im synchron schreiben\n"
+" -p, --protect existierende Dateien nicht verändern\n"
+" -q, --quiet leise, keine Ausgaben machen\n"
+" -r, --resume unterbrochene Übertragungen fortsetzen (Z)\n"
+" -R, --restricted eingeschränkter, sichererer Modus\n"
+" -s, --stop-at {HH:MM|+N} Übertragung um HH:MM oder in N Sek. abbrechen\n"
+" -S, --timesync Zeit anfordern (doppelt: lokale Zeit setzen)\n"
+" --syslog[=off] syslog an- oder ausschalten, wenn möglich\n"
+" -t, --timeout N Timeout auf N Zehntelsekungen setzen\n"
+" --tcp-server Socket öffnen und auf Verbindung warten\n"
+" --tcp-client ADDR:PORT Socket öffnen und verbindung mit ...\n"
+" -u, --keep-uppercase GROSS geschrieben Dateinamen beibehalten\n"
+" -U, --unrestrict eingeschränkten Modus aufheben (falls "
+"erlaubt)\n"
+" -v, --verbose mehr ausgeben\n"
+" -w, --windowsize N Fenstergröße auf N Bytes setzen (Z)\n"
+" -X --xmodem XMODEM-Protokoll benutzen\n"
+" -y, --overwrite existierende Dateien überschreiben\n"
+" --ymodem YMODEM-Protokoll benutzen\n"
+" -Z, --zmodem ZMODEM-Protokoll benutzen\n"
+"\n"
+"Kurze Optionen benötigen dieselben Argumente wie Lange.\n"
+
+#: src/lrz.c:676
+#, c-format
+msgid "%s waiting to receive."
+msgstr "%s wartet auf Sender."
+
+#: src/lrz.c:730 src/lrz.c:1806
+#, c-format
+msgid "\rBytes received: %7ld/%7ld BPS:%-6ld \r\n"
+msgstr "\rBytes empfangen:%7ld/%7ld BPS:%-8ld \r\n"
+
+#: src/lrz.c:772
+#, c-format
+msgid "%s: ready to receive %s"
+msgstr "%s: bereit zum Empfangen von %s"
+
+#: src/lrz.c:799
+#, c-format
+msgid "\rBytes received: %7ld BPS:%-6ld \r\n"
+msgstr "\rBytes empfangen: %7ld BPS:%-6ld \r\n"
+
+#: src/lrz.c:825
+#, c-format
+msgid ""
+"\r\n"
+"%s: %s removed.\r\n"
+msgstr ""
+"\r\n"
+"%s: %s gelöscht\r\n"
+
+#: src/lrz.c:856
+msgid "Pathname fetch returned EOT"
+msgstr "Ende der Übertragung beim Warten auf Dateinamen"
+
+#: src/lrz.c:903
+msgid "Received dup Sector"
+msgstr "Sektor doppelt empfangen"
+
+#: src/lrz.c:917
+msgid "Sync Error"
+msgstr "Synchronisationsfehler"
+
+#: src/lrz.c:965
+msgid "CRC"
+msgstr "CRC-Fehler"
+
+#: src/lrz.c:976
+msgid "Checksum"
+msgstr "Prüfsummenfehler"
+
+#: src/lrz.c:979
+msgid "Sector number garbled"
+msgstr "Sektorennummer fehlerhaft"
+
+#: src/lrz.c:991
+msgid "Sender Cancelled"
+msgstr "Sender brach ab"
+
+#: src/lrz.c:1005
+#, c-format
+msgid "Got 0%o sector header"
+msgstr "Erhielt %02x als Sektorbestätigung"
+
+#: src/lrz.c:1113
+#, c-format
+msgid "file name ends with a /, skipped: %s\n"
+msgstr "Dateiname endet mit /, übersprungen: %s\n"
+
+#: src/lrz.c:1127
+#, c-format
+msgid "zmanag=%d, Lzmanag=%d\n"
+msgstr ""
+
+#: src/lrz.c:1128
+#, c-format
+msgid "zconv=%d\n"
+msgstr ""
+
+#: src/lrz.c:1192 src/lrz.c:1226
+#, c-format
+msgid "file exists, skipped: %s\n"
+msgstr "Datei existiert, übersprungen: %s\n"
+
+#: src/lrz.c:1267
+#, c-format
+msgid "TIMESYNC: here %ld, remote %ld, diff %ld seconds\n"
+msgstr "Zeitsynchronisation: hier %ld, dort %ld, Unterschied %ld Sekunden\n"
+
+#: src/lrz.c:1276
+#, c-format
+msgid "TIMESYNC: cannot set time: %s\n"
+msgstr "Zeitsynchronisation: kann Zeit nicht setzen: %s\n"
+
+#: src/lrz.c:1296
+msgid "Topipe"
+msgstr "Pipe zu"
+
+#: src/lrz.c:1314
+#, c-format
+msgid "Receiving: %s\n"
+msgstr "Empfange: %s\n"
+
+#: src/lrz.c:1545
+#, c-format
+msgid "Blocks received: %d"
+msgstr "Blöcke empfangen: %d"
+
+#: src/lrz.c:1599
+#, c-format
+msgid "%s: %s exists\n"
+msgstr "%s: %s existiert bereits\n"
+
+#: src/lrz.c:1612 src/lrz.c:1620
+#, c-format
+msgid "%s:\tSecurity Violation"
+msgstr "%s:\tSicherheitsverstoß"
+
+#: src/lrz.c:1730
+msgid "remote command execution requested"
+msgstr "Gegenseite versucht Kommandoausführung"
+
+#: src/lrz.c:1737
+msgid "not executed"
+msgstr "nicht ausgeführt"
+
+#: src/lrz.c:1768
+msgid "got ZRINIT"
+msgstr "Erhielt unerwartetes ZRINIT"
+
+#: src/lrz.c:1817
+msgid "Skipped"
+msgstr "Übersprungen"
+
+#. too bad
+#: src/lrz.c:2049
+#, c-format
+msgid "rzfile: bps rate %ld below min %ld"
+msgstr "rzfile: BPS-Rate %ld unter Minimum %ld"
+
+#. too bad
+#: src/lrz.c:2064
+msgid "rzfile: reached stop time"
+msgstr "rzfile: Abbruchzeit erreicht"
+
+#: src/lrz.c:2071
+#, c-format
+msgid "\rBytes received: %7ld/%7ld BPS:%-6ld ETA %02d:%02d "
+msgstr "\rBytes empfangen:%7ld/%7ld BPS:%-8ld ETA %02d:%02d "
+
+#: src/lrz.c:2215
+msgid "file close error"
+msgstr "Fehler beim Schließen der Datei"
+
+#~ msgid "tcp protocol init failed\n"
+#~ msgstr "TCP Protokoll Initialisierung fehlgeschlagen\n"
+
+#~ msgid "cannot tmpfile() for tcp protocol synchronization"
+#~ msgstr "tmpfile() zur tcp Protokoll Synchronisation fehlgeschlagen"
+
+#~ msgid "fgets for tcp protocol synchronization failed: "
+#~ msgstr "fgets() bei tcp Protokoll Synchronisation fehlgeschlagen: "
+
+#~ msgid "Transfer complete."
+#~ msgstr "Übertragung abgeschlossen"
+
+#~ msgid "at"
+#~ msgstr "um"
+
+#~ msgid "TIMESYNC: failed\n"
+#~ msgstr "Zeitsynchronisation: fehlgeschlagen\n"
+
+#~ msgid "TIMESYNC: ok\n"
+#~ msgstr "Zeitsynchronisation: ok\n"
+
+#~ msgid "Falldown to %ld blklen"
+#~ msgstr "Blockgröße auf %ld gesenkt"
diff --git a/po/lrzsz.pot b/po/lrzsz.pot
new file mode 100644
index 0000000..3863e66
--- /dev/null
+++ b/po/lrzsz.pot
@@ -0,0 +1,694 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Free Software Foundation, Inc.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 1999-08-22 21:00+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: ENCODING\n"
+
+#: src/lsz.c:228
+msgid "io_mode(,2) in rbsb.c not implemented\n"
+msgstr ""
+
+#: src/lrz.c:196 src/lsz.c:230
+#, c-format
+msgid "caught signal %d; exiting"
+msgstr ""
+
+#: src/lsz.c:400
+msgid "command tries"
+msgstr ""
+
+#: src/lsz.c:422
+msgid "packetlength"
+msgstr ""
+
+#: src/lsz.c:427
+#, c-format
+msgid "packetlength out of range 24..%ld"
+msgstr ""
+
+#: src/lsz.c:436
+msgid "framelength"
+msgstr ""
+
+#: src/lsz.c:441
+#, c-format
+msgid "framelength out of range 32..%ld"
+msgstr ""
+
+#: src/lrz.c:318 src/lsz.c:450
+msgid "min_bps"
+msgstr ""
+
+#: src/lsz.c:452
+msgid "min_bps must be >= 0"
+msgstr ""
+
+#: src/lrz.c:324 src/lsz.c:458
+msgid "min_bps_time"
+msgstr ""
+
+#: src/lrz.c:326 src/lsz.c:460
+msgid "min_bps_time must be > 1"
+msgstr ""
+
+#: src/lrz.c:342 src/lsz.c:484
+msgid "hour to large (0..23)"
+msgstr ""
+
+#: src/lrz.c:344 src/lsz.c:486
+msgid "unparsable stop time\n"
+msgstr ""
+
+#: src/lrz.c:348 src/lsz.c:490
+msgid "minute to large (0..59)"
+msgstr ""
+
+#: src/lrz.c:358 src/lrz.c:365 src/lsz.c:500 src/lsz.c:507
+msgid "stop time to small"
+msgstr ""
+
+#: src/lrz.c:363 src/lsz.c:505
+msgid "stop-at"
+msgstr ""
+
+#: src/lrz.c:394 src/lsz.c:516
+msgid "timeout"
+msgstr ""
+
+#: src/lrz.c:396 src/lsz.c:518
+msgid "timeout out of range 10..1000"
+msgstr ""
+
+#: src/lrz.c:412 src/lsz.c:526
+msgid "security violation: can't do that under restricted shell\n"
+msgstr ""
+
+#: src/lrz.c:402 src/lsz.c:533
+msgid "window size"
+msgstr ""
+
+#: src/lrz.c:427 src/lrz.c:434 src/lsz.c:556 src/lsz.c:563
+msgid "cannot turnoff syslog"
+msgstr ""
+
+#: src/lrz.c:449 src/lsz.c:571
+msgid "startup delay"
+msgstr ""
+
+#: src/lrz.c:465 src/lrz.c:483 src/lrz.c:760 src/lrz.c:1122 src/lrz.c:1244
+#: src/lrz.c:1292 src/lrz.c:1309 src/lrz.c:1324 src/lrz.c:1423 src/lsz.c:580
+#: src/lsz.c:596 src/lsz.c:693 src/lsz.c:828 src/lsz.c:1061
+#: src/zreadline.c:127
+msgid "out of memory"
+msgstr ""
+
+#: src/lrz.c:475 src/lsz.c:592
+msgid "this program was never intended to be used setuid\n"
+msgstr ""
+
+#: src/lsz.c:612 src/lsz.c:627
+msgid "need at least one file to send"
+msgstr ""
+
+#: src/lsz.c:629
+msgid "Can't send command in restricted mode\n"
+msgstr ""
+
+#: src/lrz.c:527 src/lsz.c:656
+msgid "hostname too long\n"
+msgstr ""
+
+#: src/lrz.c:542 src/lsz.c:671
+msgid "illegal server address\n"
+msgstr ""
+
+#: src/lsz.c:710
+msgid "can read only one file from stdin"
+msgstr ""
+
+#: src/lrz.c:574 src/lsz.c:803
+msgid "Transfer incomplete\n"
+msgstr ""
+
+#: src/lrz.c:576 src/lsz.c:805
+msgid "Transfer complete\n"
+msgstr ""
+
+#: src/lsz.c:838
+#, c-format
+msgid "send_pseudo %s: cannot open tmpfile %s: %s"
+msgstr ""
+
+#: src/lsz.c:851
+#, c-format
+msgid "send_pseudo %s: cannot lstat tmpfile %s: %s"
+msgstr ""
+
+#: src/lsz.c:859
+#, c-format
+msgid "send_pseudo %s: avoiding symlink trap"
+msgstr ""
+
+#: src/lsz.c:870
+#, c-format
+msgid "send_pseudo %s: cannot write to tmpfile %s: %s"
+msgstr ""
+
+#: src/lsz.c:879
+#, c-format
+msgid "send_pseudo %s: failed"
+msgstr ""
+
+#: src/lsz.c:882
+#, c-format
+msgid "send_pseudo %s: ok"
+msgstr ""
+
+#: src/lsz.c:916
+#, c-format
+msgid "Answering TIMESYNC at %s"
+msgstr ""
+
+#: src/lsz.c:921
+msgid "timezone"
+msgstr ""
+
+#: src/lsz.c:924
+msgid "timezone unknown"
+msgstr ""
+
+#: src/lsz.c:953
+msgid "Can't open any requested files."
+msgstr ""
+
+#: src/lsz.c:1009
+#, c-format
+msgid "security violation: not allowed to upload from %s"
+msgstr ""
+
+#: src/lrz.c:1384 src/lsz.c:1027
+#, c-format
+msgid "cannot open %s"
+msgstr ""
+
+#: src/lsz.c:1082
+#, c-format
+msgid "is not a file: %s"
+msgstr ""
+
+#: src/lsz.c:1115 src/lsz.c:1130
+#, c-format
+msgid "%s/%s: error occured"
+msgstr ""
+
+#: src/lsz.c:1119
+#, c-format
+msgid "skipped: %s"
+msgstr ""
+
+#: src/lsz.c:1122
+#, c-format
+msgid "%s/%s: skipped"
+msgstr ""
+
+#: src/lsz.c:1149
+#, c-format
+msgid "Bytes Sent:%7ld BPS:%-8ld \n"
+msgstr ""
+
+#: src/lsz.c:1178
+#, c-format
+msgid "Sending %s, %ld blocks: "
+msgstr ""
+
+#: src/lsz.c:1181
+msgid "Give your local XMODEM receive command now."
+msgstr ""
+
+#: src/lsz.c:1224
+#, c-format
+msgid "Sending: %s\n"
+msgstr ""
+
+#: src/lsz.c:1267
+msgid "Timeout on pathname"
+msgstr ""
+
+#: src/lsz.c:1314
+msgid "Receiver Cancelled"
+msgstr ""
+
+#: src/lsz.c:1340
+msgid "No ACK on EOT"
+msgstr ""
+
+#: src/lsz.c:1361
+#, c-format
+msgid "Xmodem sectors/kbytes sent: %3d/%2dk"
+msgstr ""
+
+#: src/lsz.c:1363
+#, c-format
+msgid "Ymodem sectors/kbytes sent: %3d/%2dk"
+msgstr ""
+
+#: src/lsz.c:1395
+msgid "Cancelled"
+msgstr ""
+
+#: src/lsz.c:1399
+msgid "Timeout on sector ACK"
+msgstr ""
+
+#: src/lsz.c:1404
+msgid "NAK on sector"
+msgstr ""
+
+#: src/lsz.c:1410
+msgid "Got burst for sector ACK"
+msgstr ""
+
+#: src/lsz.c:1412
+#, c-format
+msgid "Got %02x for sector ACK"
+msgstr ""
+
+#: src/lsz.c:1424
+msgid "Retry Count Exceeded"
+msgstr ""
+
+#: src/lrz.c:596 src/lsz.c:1502
+#, c-format
+msgid "Try `%s --help' for more information.\n"
+msgstr ""
+
+#: src/lrz.c:601 src/lsz.c:1507
+#, c-format
+msgid "%s version %s\n"
+msgstr ""
+
+#: src/lsz.c:1510
+#, c-format
+msgid "Usage: %s [options] file ...\n"
+msgstr ""
+
+#: src/lsz.c:1512
+#, c-format
+msgid " or: %s [options] -{c|i} COMMAND\n"
+msgstr ""
+
+#: src/lsz.c:1513
+msgid "Send file(s) with ZMODEM/YMODEM/XMODEM protocol\n"
+msgstr ""
+
+#: src/lrz.c:607 src/lsz.c:1515
+msgid ""
+" (X) = option applies to XMODEM only\n"
+" (Y) = option applies to YMODEM only\n"
+" (Z) = option applies to ZMODEM only\n"
+msgstr ""
+
+#: src/lsz.c:1521
+msgid ""
+" -+, --append append to existing destination file (Z)\n"
+" -2, --twostop use 2 stop bits\n"
+" -4, --try-4k go up to 4K blocksize\n"
+" --start-4k start with 4K blocksize (doesn't try 8)\n"
+" -8, --try-8k go up to 8K blocksize\n"
+" --start-8k start with 8K blocksize\n"
+" -a, --ascii ASCII transfer (change CR/LF to LF)\n"
+" -b, --binary binary transfer\n"
+" -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n"
+" -c, --command COMMAND execute remote command COMMAND (Z)\n"
+" -C, --command-tries N try N times to execute a command (Z)\n"
+" -d, --dot-to-slash change '.' to '/' in pathnames (Y/Z)\n"
+" --delay-startup N sleep N seconds before doing anything\n"
+" -e, --escape escape all control characters (Z)\n"
+" -E, --rename force receiver to rename files it already has\n"
+" -f, --full-path send full pathname (Y/Z)\n"
+" -i, --immediate-command CMD send remote CMD, return immediately (Z)\n"
+" -h, --help print this usage message\n"
+" -k, --1k send 1024 byte packets (X)\n"
+" -L, --packetlen N limit subpacket length to N bytes (Z)\n"
+" -l, --framelen N limit frame length to N bytes (l>=L) (Z)\n"
+" -m, --min-bps N stop transmission if BPS below N\n"
+" -M, --min-bps-time N for at least N seconds (default: 120)\n"
+msgstr ""
+
+#: src/lsz.c:1546
+msgid ""
+" -n, --newer send file if source newer (Z)\n"
+" -N, --newer-or-longer send file if source newer or longer (Z)\n"
+" -o, --16-bit-crc use 16 bit CRC instead of 32 bit CRC (Z)\n"
+" -O, --disable-timeouts disable timeout code, wait forever\n"
+" -p, --protect protect existing destination file (Z)\n"
+" -r, --resume resume interrupted file transfer (Z)\n"
+" -R, --restricted restricted, more secure mode\n"
+" -q, --quiet quiet (no progress reports)\n"
+" -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n"
+" --tcp-server open socket, wait for connection (Z)\n"
+" --tcp-client ADDR:PORT open socket, connect to ... (Z)\n"
+" -u, --unlink unlink file after transmission\n"
+" -U, --unrestrict turn off restricted mode (if allowed to)\n"
+" -v, --verbose be verbose, provide debugging information\n"
+" -w, --windowsize N Window is N bytes (Z)\n"
+" -X, --xmodem use XMODEM protocol\n"
+" -y, --overwrite overwrite existing files\n"
+" -Y, --overwrite-or-skip overwrite existing files, else skip\n"
+" --ymodem use YMODEM protocol\n"
+" -Z, --zmodem use ZMODEM protocol\n"
+"\n"
+"short options use the same arguments as the long ones\n"
+msgstr ""
+
+#: src/lsz.c:1768
+msgid "got ZRQINIT"
+msgstr ""
+
+#: src/lrz.c:1079 src/lrz.c:1772 src/lsz.c:1774
+msgid "got ZCAN"
+msgstr ""
+
+#: src/lsz.c:1991
+#, c-format
+msgid "blklen now %d\n"
+msgstr ""
+
+#: src/lsz.c:2053
+#, c-format
+msgid "zsendfdata: bps rate %ld below min %ld"
+msgstr ""
+
+#: src/lsz.c:2070
+msgid "zsendfdata: reached stop time"
+msgstr ""
+
+#: src/lsz.c:2080
+#, c-format
+msgid "Bytes Sent:%7ld/%7ld BPS:%-8ld ETA %02d:%02d "
+msgstr ""
+
+#: src/lsz.c:2223
+#, c-format
+msgid "calc_blklen: reduced to %d due to error\n"
+msgstr ""
+
+#: src/lsz.c:2256
+#, c-format
+msgid "calc_blklen: returned old value %d due to low bpe diff\n"
+msgstr ""
+
+#: src/lsz.c:2258
+#, c-format
+msgid "calc_blklen: old %ld, new %ld, d %ld\n"
+msgstr ""
+
+#: src/lsz.c:2267
+#, c-format
+msgid "calc_blklen: calc total_bytes=%ld, bpe=%ld, ec=%ld\n"
+msgstr ""
+
+#: src/lsz.c:2278
+#, c-format
+msgid "calc_blklen: blklen %d, ok %ld, failed %ld -> %lu\n"
+msgstr ""
+
+#: src/lsz.c:2290
+#, c-format
+msgid "calc_blklen: returned %d as best\n"
+msgstr ""
+
+#: src/lsz.c:2486
+#, c-format
+msgid ""
+"\n"
+"countem: Total %d %ld\n"
+msgstr ""
+
+#: src/zm.c:245
+#, c-format
+msgid "Bad escape sequence %x"
+msgstr ""
+
+#: src/zm.c:583 src/zm.c:642
+msgid "Sender Canceled"
+msgstr ""
+
+#: src/lrz.c:1002 src/zm.c:586 src/zm.c:645
+msgid "TIMEOUT"
+msgstr ""
+
+#: src/zm.c:589 src/zm.c:648
+msgid "Bad data subpacket"
+msgstr ""
+
+#: src/zm.c:596 src/zm.c:655
+msgid "Data subpacket too long"
+msgstr ""
+
+#: src/zm.c:712
+msgid "Garbage count exceeded"
+msgstr ""
+
+#: src/zm.c:773
+#, c-format
+msgid "Got %s"
+msgstr ""
+
+#: src/zperr.c:49
+#, c-format
+msgid "Retry %d: "
+msgstr ""
+
+#: src/lrz.c:382
+msgid "don't have settimeofday, will not set time\n"
+msgstr ""
+
+#: src/lrz.c:386
+msgid "not running as root (this is good!), can not set time\n"
+msgstr ""
+
+#: src/lrz.c:441
+msgid "bytes_per_error"
+msgstr ""
+
+#: src/lrz.c:443
+msgid "bytes-per-error should be >100"
+msgstr ""
+
+#: src/lrz.c:455
+msgid "O_SYNC not supported by the kernel"
+msgstr ""
+
+#: src/lrz.c:497 src/lrz.c:499
+msgid "garbage on commandline"
+msgstr ""
+
+#: src/lrz.c:604
+#, c-format
+msgid "Usage: %s [options] [filename.if.xmodem]\n"
+msgstr ""
+
+#: src/lrz.c:605
+msgid "Receive files with ZMODEM/YMODEM/XMODEM protocol\n"
+msgstr ""
+
+#: src/lrz.c:612
+msgid ""
+" -+, --append append to existing files\n"
+" -a, --ascii ASCII transfer (change CR/LF to LF)\n"
+" -b, --binary binary transfer\n"
+" -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n"
+" -c, --with-crc Use 16 bit CRC (X)\n"
+" -C, --allow-remote-commands allow execution of remote commands (Z)\n"
+" -D, --null write all received data to /dev/null\n"
+" --delay-startup N sleep N seconds before doing anything\n"
+" -e, --escape Escape control characters (Z)\n"
+" -E, --rename rename any files already existing\n"
+" --errors N generate CRC error every N bytes (debugging)\n"
+" -h, --help Help, print this usage message\n"
+" -m, --min-bps N stop transmission if BPS below N\n"
+" -M, --min-bps-time N for at least N seconds (default: 120)\n"
+" -O, --disable-timeouts disable timeout code, wait forever for data\n"
+" --o-sync open output file(s) in synchronous write mode\n"
+" -p, --protect protect existing files\n"
+" -q, --quiet quiet, no progress reports\n"
+" -r, --resume try to resume interrupted file transfer (Z)\n"
+" -R, --restricted restricted, more secure mode\n"
+" -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n"
+" -S, --timesync request remote time (twice: set local time)\n"
+" --syslog[=off] turn syslog on or off, if possible\n"
+" -t, --timeout N set timeout to N tenths of a second\n"
+" --tcp-server open socket, wait for connection (Z)\n"
+" --tcp-client ADDR:PORT open socket, connect to ... (Z)\n"
+" -u, --keep-uppercase keep upper case filenames\n"
+" -U, --unrestrict disable restricted mode (if allowed to)\n"
+" -v, --verbose be verbose, provide debugging information\n"
+" -w, --windowsize N Window is N bytes (Z)\n"
+" -X --xmodem use XMODEM protocol\n"
+" -y, --overwrite Yes, clobber existing file if any\n"
+" --ymodem use YMODEM protocol\n"
+" -Z, --zmodem use ZMODEM protocol\n"
+"\n"
+"short options use the same arguments as the long ones\n"
+msgstr ""
+
+#: src/lrz.c:676
+#, c-format
+msgid "%s waiting to receive."
+msgstr ""
+
+#: src/lrz.c:730 src/lrz.c:1806
+#, c-format
+msgid "\rBytes received: %7ld/%7ld BPS:%-6ld \r\n"
+msgstr ""
+
+#: src/lrz.c:772
+#, c-format
+msgid "%s: ready to receive %s"
+msgstr ""
+
+#: src/lrz.c:799
+#, c-format
+msgid "\rBytes received: %7ld BPS:%-6ld \r\n"
+msgstr ""
+
+#: src/lrz.c:825
+#, c-format
+msgid ""
+"\r\n"
+"%s: %s removed.\r\n"
+msgstr ""
+
+#: src/lrz.c:856
+msgid "Pathname fetch returned EOT"
+msgstr ""
+
+#: src/lrz.c:903
+msgid "Received dup Sector"
+msgstr ""
+
+#: src/lrz.c:917
+msgid "Sync Error"
+msgstr ""
+
+#: src/lrz.c:965
+msgid "CRC"
+msgstr ""
+
+#: src/lrz.c:976
+msgid "Checksum"
+msgstr ""
+
+#: src/lrz.c:979
+msgid "Sector number garbled"
+msgstr ""
+
+#: src/lrz.c:991
+msgid "Sender Cancelled"
+msgstr ""
+
+#: src/lrz.c:1005
+#, c-format
+msgid "Got 0%o sector header"
+msgstr ""
+
+#: src/lrz.c:1113
+#, c-format
+msgid "file name ends with a /, skipped: %s\n"
+msgstr ""
+
+#: src/lrz.c:1127
+#, c-format
+msgid "zmanag=%d, Lzmanag=%d\n"
+msgstr ""
+
+#: src/lrz.c:1128
+#, c-format
+msgid "zconv=%d\n"
+msgstr ""
+
+#: src/lrz.c:1192 src/lrz.c:1226
+#, c-format
+msgid "file exists, skipped: %s\n"
+msgstr ""
+
+#: src/lrz.c:1267
+#, c-format
+msgid "TIMESYNC: here %ld, remote %ld, diff %ld seconds\n"
+msgstr ""
+
+#: src/lrz.c:1276
+#, c-format
+msgid "TIMESYNC: cannot set time: %s\n"
+msgstr ""
+
+#: src/lrz.c:1296
+msgid "Topipe"
+msgstr ""
+
+#: src/lrz.c:1314
+#, c-format
+msgid "Receiving: %s\n"
+msgstr ""
+
+#: src/lrz.c:1545
+#, c-format
+msgid "Blocks received: %d"
+msgstr ""
+
+#: src/lrz.c:1599
+#, c-format
+msgid "%s: %s exists\n"
+msgstr ""
+
+#: src/lrz.c:1612 src/lrz.c:1620
+#, c-format
+msgid "%s:\tSecurity Violation"
+msgstr ""
+
+#: src/lrz.c:1730
+msgid "remote command execution requested"
+msgstr ""
+
+#: src/lrz.c:1737
+msgid "not executed"
+msgstr ""
+
+#: src/lrz.c:1768
+msgid "got ZRINIT"
+msgstr ""
+
+#: src/lrz.c:1817
+msgid "Skipped"
+msgstr ""
+
+#. too bad
+#: src/lrz.c:2049
+#, c-format
+msgid "rzfile: bps rate %ld below min %ld"
+msgstr ""
+
+#. too bad
+#: src/lrz.c:2064
+msgid "rzfile: reached stop time"
+msgstr ""
+
+#: src/lrz.c:2071
+#, c-format
+msgid "\rBytes received: %7ld/%7ld BPS:%-6ld ETA %02d:%02d "
+msgstr ""
+
+#: src/lrz.c:2215
+msgid "file close error"
+msgstr ""
diff --git a/po/stamp-cat-id b/po/stamp-cat-id
new file mode 100644
index 0000000..9788f70
--- /dev/null
+++ b/po/stamp-cat-id
@@ -0,0 +1 @@
+timestamp
diff --git a/rpmrc b/rpmrc
new file mode 100644
index 0000000..241c2b2
--- /dev/null
+++ b/rpmrc
@@ -0,0 +1,5 @@
+sourcedir: .
+builddir: .
+rpmdir: .
+srcrpmdir: .
+#rpmfilename:
diff --git a/src/CVS/Entries b/src/CVS/Entries
new file mode 100644
index 0000000..698e28b
--- /dev/null
+++ b/src/CVS/Entries
@@ -0,0 +1,21 @@
+/Makefile.am/1.3/Mon Dec 28 08:41:34 1998/-ko/
+/Makefile.in/1.6/Thu Jun 3 15:43:15 1999/-ko/
+/ansi2knr.1/1.2/Sun Dec 27 14:29:31 1998/-ko/
+/ansi2knr.c/1.5/Sun Dec 27 16:09:19 1998/-ko/
+/canit.c/1.1/Mon Dec 28 08:41:34 1998/-ko/
+/crctab.c/1.1.1.1/Sun Apr 26 13:20:52 1998/-ko/
+/lrz.c/1.10/Sun Aug 22 18:51:21 1999/-ko/
+/lrzszbug.in/1.1.1.1/Sun Apr 26 13:22:38 1998/-ko/
+/lsyslog.c/1.3/Tue Dec 29 17:27:55 1998/-ko/
+/lsz.c/1.15/Sun Aug 22 18:51:21 1999/-ko/
+/protname.c/1.1.1.2/Sun Apr 26 13:22:27 1998/-ko/
+/rbsb.c/1.9/Sun Aug 22 18:51:21 1999/-ko/
+/tcp.c/1.6/Sun Aug 22 18:51:21 1999/-ko/
+/timing.c/1.1.1.6/Sun Apr 26 13:22:26 1998/-ko/
+/timing.h/1.1.1.3/Sun Apr 26 13:22:09 1998/-ko/
+/zglobal.h/1.7/Tue Dec 29 12:58:37 1998/-ko/
+/zm.c/1.3/Thu Jun 3 15:43:16 1999/-ko/
+/zmodem.h/1.1.1.4/Sun Apr 26 13:22:40 1998/-ko/
+/zperr.c/1.3/Sun Dec 27 16:09:19 1998/-ko/
+/zreadline.c/1.3/Sun Aug 22 18:51:21 1999/-ko/
+D
diff --git a/src/CVS/Repository b/src/CVS/Repository
new file mode 100644
index 0000000..124e667
--- /dev/null
+++ b/src/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/src
diff --git a/src/CVS/Root b/src/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/src/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..dd0a56c
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,39 @@
+bin_PROGRAMS=lrz lsz
+lrz_SOURCES=lrz.c timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c tcp.c lsyslog.c canit.c
+lsz_SOURCES=lsz.c timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c tcp.c lsyslog.c canit.c
+noinst_HEADERS = timing.h zglobal.h zmodem.h
+datadir = $(prefix)/@DATADIRNAME@
+localedir = $(datadir)/locale
+CFLAGS=@CFLAGS@
+DISTCLEAN_FILES=lrzszbug
+
+LDADD = ../lib/libzmodem.a @INTLLIBS@
+AUTOMAKE_OPTIONS=ansi2knr
+EXTRA_DIST = ansi2knr.1 ansi2knr.c lrzszbug.in
+INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/src -I../intl -I$(top_srcdir)/lib
+#DEFS = -DLOCALEDIR=\"$(localedir)\" -DOS=\"@host_os@\" -DCPU=\"@host_cpu@\"
+DEFS = -DNFGVMIN @DEFS@ -DLOCALEDIR=\"$(localedir)\"
+
+install-exec-local:
+ rm -f $(DESTDIR)/$(bindir)/`echo lsb | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lsb |sed -e '$(transform)'`
+ rm -f $(bindir)/`echo lsx | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'`
+ rm -f $(bindir)/`echo lrb | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'`
+ rm -f $(bindir)/`echo lrx | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lrx |sed -e '$(transform)'`
+# rm -f $(bindir)/`echo lrzszbug | sed -e '$(transform)'`
+# ln $(bindir)/`echo lrzszbug |sed -e '$(transform)'` \
+# $(bindir)/`echo lrzszbug |sed -e '$(transform)'`
+
+uninstall-local:
+ rm -f $(DESTDIR)/$(bindir)/`echo lsb |sed -e '$(transform)'`
+ rm -f $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'`
+ rm -f $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'`
+ rm -f $(DESTDIR)/$(bindir)/`echo lrx |sed -e '$(transform)'`
+# rm -f $(bindir)/`echo lrzszbug |sed -e '$(transform)'`
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..3548804
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,439 @@
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CPP = @CPP@
+DATADIRNAME = @DATADIRNAME@
+ENABLE_TIMESYNC = @ENABLE_TIMESYNC@
+GENCAT = @GENCAT@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+PACKAGE = @PACKAGE@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+U = @U@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+l = @l@
+
+bin_PROGRAMS = lrz lsz
+lrz_SOURCES = lrz.c timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c tcp.c lsyslog.c canit.c
+lsz_SOURCES = lsz.c timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c tcp.c lsyslog.c canit.c
+noinst_HEADERS = timing.h zglobal.h zmodem.h
+datadir = $(prefix)/@DATADIRNAME@
+localedir = $(datadir)/locale
+CFLAGS = @CFLAGS@
+DISTCLEAN_FILES = lrzszbug
+
+LDADD = ../lib/libzmodem.a @INTLLIBS@
+AUTOMAKE_OPTIONS = ansi2knr
+EXTRA_DIST = ansi2knr.1 ansi2knr.c lrzszbug.in
+INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/src -I../intl -I$(top_srcdir)/lib
+#DEFS = -DLOCALEDIR=\"$(localedir)\" -DOS=\"@host_os@\" -DCPU=\"@host_cpu@\"
+DEFS = -DNFGVMIN @DEFS@ -DLOCALEDIR=\"$(localedir)\"
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES = lrzszbug
+PROGRAMS = $(bin_PROGRAMS)
+
+CPPFLAGS = @CPPFLAGS@
+ANSI2KNR = @ANSI2KNR@
+lrz_OBJECTS = lrz$U.o timing$U.o zperr$U.o zreadline$U.o crctab$U.o \
+rbsb$U.o zm$U.o protname$U.o tcp$U.o lsyslog$U.o canit$U.o
+lrz_LDADD = $(LDADD)
+lrz_DEPENDENCIES = ../lib/libzmodem.a
+lrz_LDFLAGS =
+lsz_OBJECTS = lsz$U.o timing$U.o zperr$U.o zreadline$U.o crctab$U.o \
+rbsb$U.o zm$U.o protname$U.o tcp$U.o lsyslog$U.o canit$U.o
+lsz_LDADD = $(LDADD)
+lsz_DEPENDENCIES = ../lib/libzmodem.a
+lsz_LDFLAGS =
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = Makefile.am Makefile.in ansi2knr.1 ansi2knr.c lrzszbug.in
+
+
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+
+TAR = gtar
+GZIP_ENV = --best
+DEP_FILES = .deps/canit.P .deps/crctab.P .deps/lrz.P .deps/lsyslog.P \
+.deps/lsz.P .deps/protname.P .deps/rbsb.P .deps/tcp.P .deps/timing.P \
+.deps/zm.P .deps/zperr.P .deps/zreadline.P
+SOURCES = $(lrz_SOURCES) $(lsz_SOURCES)
+OBJECTS = $(lrz_OBJECTS) $(lsz_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .S .c .o .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+lrzszbug: $(top_builddir)/config.status lrzszbug.in
+ cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+distclean-binPROGRAMS:
+
+maintainer-clean-binPROGRAMS:
+
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(bin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+mostlyclean-krextra:
+
+clean-krextra:
+ -rm -f ansi2knr
+
+distclean-krextra:
+
+maintainer-clean-krextra:
+ansi2knr: ansi2knr.o
+ $(LINK) ansi2knr.o $(LIBS)
+ansi2knr.o: $(CONFIG_HEADER)
+
+
+mostlyclean-kr:
+ -rm -f *_.c
+
+clean-kr:
+
+distclean-kr:
+
+maintainer-clean-kr:
+
+lrz: $(lrz_OBJECTS) $(lrz_DEPENDENCIES)
+ @rm -f lrz
+ $(LINK) $(lrz_LDFLAGS) $(lrz_OBJECTS) $(lrz_LDADD) $(LIBS)
+
+lsz: $(lsz_OBJECTS) $(lsz_DEPENDENCIES)
+ @rm -f lsz
+ $(LINK) $(lsz_LDFLAGS) $(lsz_OBJECTS) $(lsz_LDADD) $(LIBS)
+canit_.c: canit.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/canit.c; then echo $(srcdir)/canit.c; else echo canit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > canit_.c
+crctab_.c: crctab.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/crctab.c; then echo $(srcdir)/crctab.c; else echo crctab.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > crctab_.c
+lrz_.c: lrz.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lrz.c; then echo $(srcdir)/lrz.c; else echo lrz.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > lrz_.c
+lsyslog_.c: lsyslog.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lsyslog.c; then echo $(srcdir)/lsyslog.c; else echo lsyslog.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > lsyslog_.c
+lsz_.c: lsz.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lsz.c; then echo $(srcdir)/lsz.c; else echo lsz.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > lsz_.c
+protname_.c: protname.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/protname.c; then echo $(srcdir)/protname.c; else echo protname.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > protname_.c
+rbsb_.c: rbsb.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rbsb.c; then echo $(srcdir)/rbsb.c; else echo rbsb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > rbsb_.c
+tcp_.c: tcp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tcp.c; then echo $(srcdir)/tcp.c; else echo tcp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > tcp_.c
+timing_.c: timing.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/timing.c; then echo $(srcdir)/timing.c; else echo timing.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > timing_.c
+zm_.c: zm.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/zm.c; then echo $(srcdir)/zm.c; else echo zm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > zm_.c
+zperr_.c: zperr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/zperr.c; then echo $(srcdir)/zperr.c; else echo zperr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > zperr_.c
+zreadline_.c: zreadline.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/zreadline.c; then echo $(srcdir)/zreadline.c; else echo zreadline.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > zreadline_.c
+canit_.o crctab_.o lrz_.o lsyslog_.o lsz_.o protname_.o rbsb_.o tcp_.o \
+timing_.o zm_.o zperr_.o zreadline_.o : $(ANSI2KNR)
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = src
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
+
+-include $(DEP_FILES)
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+ -rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+ @echo '$(COMPILE) -c $<'; \
+ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+ @-cp .deps/$(*F).pp .deps/$(*F).P; \
+ tr ' ' '\012' < .deps/$(*F).pp \
+ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+ >> .deps/$(*F).P; \
+ rm .deps/$(*F).pp
+
+%.lo: %.c
+ @echo '$(LTCOMPILE) -c $<'; \
+ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
+ < .deps/$(*F).pp > .deps/$(*F).P; \
+ tr ' ' '\012' < .deps/$(*F).pp \
+ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+ >> .deps/$(*F).P; \
+ rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am: install-binPROGRAMS install-exec-local
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-binPROGRAMS uninstall-local
+uninstall: uninstall-am
+all-am: Makefile $(ANSI2KNR) $(PROGRAMS) $(HEADERS)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \
+ mostlyclean-krextra mostlyclean-kr mostlyclean-tags \
+ mostlyclean-depend mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-binPROGRAMS clean-compile clean-krextra clean-kr \
+ clean-tags clean-depend clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-binPROGRAMS distclean-compile distclean-krextra \
+ distclean-kr distclean-tags distclean-depend \
+ distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-binPROGRAMS \
+ maintainer-clean-compile maintainer-clean-krextra \
+ maintainer-clean-kr maintainer-clean-tags \
+ maintainer-clean-depend maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-krextra distclean-krextra \
+clean-krextra maintainer-clean-krextra mostlyclean-kr distclean-kr \
+clean-kr maintainer-clean-kr tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir mostlyclean-depend \
+distclean-depend clean-depend maintainer-clean-depend info-am info \
+dvi-am dvi check check-am installcheck-am installcheck \
+install-exec-local install-exec-am install-exec install-data-am \
+install-data install-am install uninstall-local uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+install-exec-local:
+ rm -f $(DESTDIR)/$(bindir)/`echo lsb | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lsb |sed -e '$(transform)'`
+ rm -f $(bindir)/`echo lsx | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'`
+ rm -f $(bindir)/`echo lrb | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'`
+ rm -f $(bindir)/`echo lrx | sed -e '$(transform)'`
+ ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \
+ $(DESTDIR)/$(bindir)/`echo lrx |sed -e '$(transform)'`
+# rm -f $(bindir)/`echo lrzszbug | sed -e '$(transform)'`
+# ln $(bindir)/`echo lrzszbug |sed -e '$(transform)'` \
+# $(bindir)/`echo lrzszbug |sed -e '$(transform)'`
+
+uninstall-local:
+ rm -f $(DESTDIR)/$(bindir)/`echo lsb |sed -e '$(transform)'`
+ rm -f $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'`
+ rm -f $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'`
+ rm -f $(DESTDIR)/$(bindir)/`echo lrx |sed -e '$(transform)'`
+# rm -f $(bindir)/`echo lrzszbug |sed -e '$(transform)'`
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/ansi2knr.1 b/src/ansi2knr.1
new file mode 100644
index 0000000..f9ee5a6
--- /dev/null
+++ b/src/ansi2knr.1
@@ -0,0 +1,36 @@
+.TH ANSI2KNR 1 "19 Jan 1996"
+.SH NAME
+ansi2knr \- convert ANSI C to Kernighan & Ritchie C
+.SH SYNOPSIS
+.I ansi2knr
+[--varargs] input_file [output_file]
+.SH DESCRIPTION
+If no output_file is supplied, output goes to stdout.
+.br
+There are no error messages.
+.sp
+.I ansi2knr
+recognizes function definitions by seeing a non-keyword identifier at the left
+margin, followed by a left parenthesis, with a right parenthesis as the last
+character on the line, and with a left brace as the first token on the
+following line (ignoring possible intervening comments). It will recognize a
+multi-line header provided that no intervening line ends with a left or right
+brace or a semicolon. These algorithms ignore whitespace and comments, except
+that the function name must be the first thing on the line.
+.sp
+The following constructs will confuse it:
+.br
+ - Any other construct that starts at the left margin and follows the
+above syntax (such as a macro or function call).
+.br
+ - Some macros that tinker with the syntax of the function header.
+.sp
+The --varargs switch is obsolete, and is recognized only for
+backwards compatibility. The present version of
+.I ansi2knr
+will always attempt to convert a ... argument to va_alist and va_dcl.
+.SH AUTHOR
+L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
+continues to maintain the current version; most of the code in the current
+version is his work. ansi2knr also includes contributions by Francois
+Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
diff --git a/src/ansi2knr.c b/src/ansi2knr.c
new file mode 100644
index 0000000..62146c0
--- /dev/null
+++ b/src/ansi2knr.c
@@ -0,0 +1,568 @@
+/* Copyright (C) 1989, 1997 Aladdin Enterprises. All rights reserved. */
+
+/* hacked up by uo to get around automake-1.3-problem */
+
+/*$Id: ansi2knr.c,v 1.4 1998/12/27 14:58:37 uwe Exp $*/
+/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
+
+/*
+ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY. No author or distributor accepts responsibility to anyone for the
+consequences of using it or for whether it serves any particular purpose or
+works at all, unless he says so in writing. Refer to the GNU General Public
+License (the "GPL") for full details.
+
+Everyone is granted permission to copy, modify and redistribute ansi2knr,
+but only under the conditions described in the GPL. A copy of this license
+is supposed to have been given to you along with ansi2knr so you can know
+your rights and responsibilities. It should be in a file named COPYLEFT,
+or, if there is no file named COPYLEFT, a file named COPYING. Among other
+things, the copyright notice and this notice must be preserved on all
+copies.
+
+We explicitly state here what we believe is already implied by the GPL: if
+the ansi2knr program is distributed as a separate set of sources and a
+separate executable file which are aggregated on a storage medium together
+with another program, this in itself does not bring the other program under
+the GPL, nor does the mere fact that such a program or the procedures for
+constructing it invoke the ansi2knr executable bring any other part of the
+program under the GPL.
+*/
+
+/*
+ * ----- not valid at the moment -- uwe ------
+ * Usage:
+ ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
+ * --filename provides the file name for the #line directive in the output,
+ * overriding input_file (if present).
+ * If no input_file is supplied, input is read from stdin.
+ * If no output_file is supplied, output goes to stdout.
+ * There are no error messages.
+ *
+ * ansi2knr recognizes function definitions by seeing a non-keyword
+ * identifier at the left margin, followed by a left parenthesis,
+ * with a right parenthesis as the last character on the line,
+ * and with a left brace as the first token on the following line
+ * (ignoring possible intervening comments).
+ * It will recognize a multi-line header provided that no intervening
+ * line ends with a left or right brace or a semicolon.
+ * These algorithms ignore whitespace and comments, except that
+ * the function name must be the first thing on the line.
+ * The following constructs will confuse it:
+ * - Any other construct that starts at the left margin and
+ * follows the above syntax (such as a macro or function call).
+ * - Some macros that tinker with the syntax of the function header.
+ */
+
+/*
+ * The original and principal author of ansi2knr is L. Peter Deutsch
+ * <ghost@aladdin.com>. Other authors are noted in the change history
+ * that follows (in reverse chronological order):
+ lpd 97-12-08 made input_file optional; only closes input and/or
+ output file if not stdin or stdout respectively; prints
+ usage message on stderr rather than stdout; adds
+ --filename switch (changes suggested by
+ <ceder@lysator.liu.se>)
+ lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
+ compilers that don't understand void, as suggested by
+ Tom Lane
+ lpd 96-01-15 changed to require that the first non-comment token
+ on the line following a function header be a left brace,
+ to reduce sensitivity to macros, as suggested by Tom Lane
+ <tgl@sss.pgh.pa.us>
+ lpd 95-06-22 removed #ifndefs whose sole purpose was to define
+ undefined preprocessor symbols as 0; changed all #ifdefs
+ for configuration symbols to #ifs
+ lpd 95-04-05 changed copyright notice to make it clear that
+ including ansi2knr in a program does not bring the entire
+ program under the GPL
+ lpd 94-12-18 added conditionals for systems where ctype macros
+ don't handle 8-bit characters properly, suggested by
+ Francois Pinard <pinard@iro.umontreal.ca>;
+ removed --varargs switch (this is now the default)
+ lpd 94-10-10 removed CONFIG_BROKETS conditional
+ lpd 94-07-16 added some conditionals to help GNU `configure',
+ suggested by Francois Pinard <pinard@iro.umontreal.ca>;
+ properly erase prototype args in function parameters,
+ contributed by Jim Avera <jima@netcom.com>;
+ correct error in writeblanks (it shouldn't erase EOLs)
+ lpd 89-xx-xx original version
+ */
+
+/* Most of the conditionals here are to make ansi2knr work with */
+/* or without the GNU configure machinery. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_CONFIG_H
+
+/*
+ For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
+ This will define HAVE_CONFIG_H and so, activate the following lines.
+ */
+
+# if STDC_HEADERS || HAVE_STRING_H
+# include <string.h>
+# else
+# include <strings.h>
+# endif
+
+#else /* not HAVE_CONFIG_H */
+
+/* Otherwise do it the hard way */
+
+# ifdef BSD
+# include <strings.h>
+# else
+# ifdef VMS
+ extern int strlen(), strncmp();
+# else
+# include <string.h>
+# endif
+# endif
+
+#endif /* not HAVE_CONFIG_H */
+
+#if STDC_HEADERS
+# include <stdlib.h>
+#else
+/*
+ malloc and free should be declared in stdlib.h,
+ but if you've got a K&R compiler, they probably aren't.
+ */
+# ifdef MSDOS
+# include <malloc.h>
+# else
+# ifdef VMS
+ extern char *malloc();
+ extern void free();
+# else
+ extern char *malloc();
+ extern int free();
+# endif
+# endif
+
+#endif
+
+/*
+ * The ctype macros don't always handle 8-bit characters correctly.
+ * Compensate for this here.
+ */
+#ifdef isascii
+# undef HAVE_ISASCII /* just in case */
+# define HAVE_ISASCII 1
+#else
+#endif
+#if STDC_HEADERS || !HAVE_ISASCII
+# define is_ascii(c) 1
+#else
+# define is_ascii(c) isascii(c)
+#endif
+
+#define is_space(c) (is_ascii(c) && isspace(c))
+#define is_alpha(c) (is_ascii(c) && isalpha(c))
+#define is_alnum(c) (is_ascii(c) && isalnum(c))
+
+/* Scanning macros */
+#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
+#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
+
+/* Forward references */
+char *skipspace();
+int writeblanks();
+int test1();
+int convert1();
+
+/* The main program */
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{ FILE *in = stdin;
+ FILE *out = stdout;
+ char *filename = 0;
+#define bufsize 5000 /* arbitrary size */
+ char *buf;
+ char *line;
+ char *more;
+ char *usage =
+ "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
+ /*
+ * In previous versions, ansi2knr recognized a --varargs switch.
+ * If this switch was supplied, ansi2knr would attempt to convert
+ * a ... argument to va_alist and va_dcl; if this switch was not
+ * supplied, ansi2knr would simply drop any such arguments.
+ * Now, ansi2knr always does this conversion, and we only
+ * check for this switch for backward compatibility.
+ */
+ int convert_varargs = 0;
+
+ while ( argc > 1 && argv[1][0] == '-' ) {
+ if ( !strcmp(argv[1], "--varargs") ) {
+ convert_varargs = 1;
+ argc--;
+ argv++;
+ continue;
+ }
+ if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
+ filename = argv[2];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
+ fprintf(stderr, usage);
+ exit(1);
+ }
+ switch ( argc )
+ {
+ default:
+ fprintf(stderr, usage);
+ exit(0);
+ case 2:
+ out = fopen(argv[1], "w");
+ if ( out == NULL ) {
+ fprintf(stderr, "Cannot open output file %s\n", argv[2]);
+ exit(1);
+ }
+ /* falls through */
+ case 1:
+ break;
+ }
+ if ( filename )
+ fprintf(out, "#line 1 \"%s\"\n", filename);
+ buf = malloc(bufsize);
+ line = buf;
+ while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
+ {
+test: line += strlen(line);
+ switch ( test1(buf) )
+ {
+ case 2: /* a function header */
+ convert1(buf, out, 1, convert_varargs);
+ break;
+ case 1: /* a function */
+ /* Check for a { at the start of the next line. */
+ more = ++line;
+f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
+ goto wl;
+ if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
+ goto wl;
+ switch ( *skipspace(more, 1) )
+ {
+ case '{':
+ /* Definitely a function header. */
+ convert1(buf, out, 0, convert_varargs);
+ fputs(more, out);
+ break;
+ case 0:
+ /* The next line was blank or a comment: */
+ /* keep scanning for a non-comment. */
+ line += strlen(line);
+ goto f;
+ default:
+ /* buf isn't a function header, but */
+ /* more might be. */
+ fputs(buf, out);
+ strcpy(buf, more);
+ line = buf;
+ goto test;
+ }
+ break;
+ case -1: /* maybe the start of a function */
+ if ( line != buf + (bufsize - 1) ) /* overflow check */
+ continue;
+ /* falls through */
+ default: /* not a function */
+wl: fputs(buf, out);
+ break;
+ }
+ line = buf;
+ }
+ if ( line != buf )
+ fputs(buf, out);
+ free(buf);
+ if ( out != stdout )
+ fclose(out);
+ if ( in != stdin )
+ fclose(in);
+ return 0;
+}
+
+/* Skip over space and comments, in either direction. */
+char *
+skipspace(p, dir)
+ register char *p;
+ register int dir; /* 1 for forward, -1 for backward */
+{ for ( ; ; )
+ { while ( is_space(*p) )
+ p += dir;
+ if ( !(*p == '/' && p[dir] == '*') )
+ break;
+ p += dir; p += dir;
+ while ( !(*p == '*' && p[dir] == '/') )
+ { if ( *p == 0 )
+ return p; /* multi-line comment?? */
+ p += dir;
+ }
+ p += dir; p += dir;
+ }
+ return p;
+}
+
+/*
+ * Write blanks over part of a string.
+ * Don't overwrite end-of-line characters.
+ */
+int
+writeblanks(start, end)
+ char *start;
+ char *end;
+{ char *p;
+ for ( p = start; p < end; p++ )
+ if ( *p != '\r' && *p != '\n' )
+ *p = ' ';
+ return 0;
+}
+
+/*
+ * Test whether the string in buf is a function definition.
+ * The string may contain and/or end with a newline.
+ * Return as follows:
+ * 0 - definitely not a function definition;
+ * 1 - definitely a function definition;
+ * 2 - definitely a function prototype (NOT USED);
+ * -1 - may be the beginning of a function definition,
+ * append another line and look again.
+ * The reason we don't attempt to convert function prototypes is that
+ * Ghostscript's declaration-generating macros look too much like
+ * prototypes, and confuse the algorithms.
+ */
+int
+test1(buf)
+ char *buf;
+{ register char *p = buf;
+ char *bend;
+ char *endfn;
+ int contin;
+
+ if ( !isidfirstchar(*p) )
+ return 0; /* no name at left margin */
+ bend = skipspace(buf + strlen(buf) - 1, -1);
+ switch ( *bend )
+ {
+ case ';': contin = 0 /*2*/; break;
+ case ')': contin = 1; break;
+ case '{': return 0; /* not a function */
+ case '}': return 0; /* not a function */
+ default: contin = -1;
+ }
+ while ( isidchar(*p) )
+ p++;
+ endfn = p;
+ p = skipspace(p, 1);
+ if ( *p++ != '(' )
+ return 0; /* not a function */
+ p = skipspace(p, 1);
+ if ( *p == ')' )
+ return 0; /* no parameters */
+ /* Check that the apparent function name isn't a keyword. */
+ /* We only need to check for keywords that could be followed */
+ /* by a left parenthesis (which, unfortunately, is most of them). */
+ { static char *words[] =
+ { "asm", "auto", "case", "char", "const", "double",
+ "extern", "float", "for", "if", "int", "long",
+ "register", "return", "short", "signed", "sizeof",
+ "static", "switch", "typedef", "unsigned",
+ "void", "volatile", "while", 0
+ };
+ char **key = words;
+ char *kp;
+ int len = endfn - buf;
+
+ while ( (kp = *key) != 0 )
+ { if ( strlen(kp) == len && !strncmp(kp, buf, len) )
+ return 0; /* name is a keyword */
+ key++;
+ }
+ }
+ return contin;
+}
+
+/* Convert a recognized function definition or header to K&R syntax. */
+int
+convert1(buf, out, header, convert_varargs)
+ char *buf;
+ FILE *out;
+ int header; /* Boolean */
+ int convert_varargs; /* Boolean */
+{ char *endfn;
+ register char *p;
+ /*
+ * The breaks table contains pointers to the beginning and end
+ * of each argument.
+ */
+ char **breaks;
+ unsigned num_breaks = 2; /* for testing */
+ char **btop;
+ char **bp;
+ char **ap;
+ char *vararg = 0;
+
+ /* Pre-ANSI implementations don't agree on whether strchr */
+ /* is called strchr or index, so we open-code it here. */
+ for ( endfn = buf; *(endfn++) != '('; )
+ ;
+top: p = endfn;
+ breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
+ if ( breaks == 0 )
+ { /* Couldn't allocate break table, give up */
+ fprintf(stderr, "Unable to allocate break table!\n");
+ fputs(buf, out);
+ return -1;
+ }
+ btop = breaks + num_breaks * 2 - 2;
+ bp = breaks;
+ /* Parse the argument list */
+ do
+ { int level = 0;
+ char *lp = NULL;
+ char *rp;
+ char *end = NULL;
+
+ if ( bp >= btop )
+ { /* Filled up break table. */
+ /* Allocate a bigger one and start over. */
+ free((char *)breaks);
+ num_breaks <<= 1;
+ goto top;
+ }
+ *bp++ = p;
+ /* Find the end of the argument */
+ for ( ; end == NULL; p++ )
+ { switch(*p)
+ {
+ case ',':
+ if ( !level ) end = p;
+ break;
+ case '(':
+ if ( !level ) lp = p;
+ level++;
+ break;
+ case ')':
+ if ( --level < 0 ) end = p;
+ else rp = p;
+ break;
+ case '/':
+ p = skipspace(p, 1) - 1;
+ break;
+ default:
+ ;
+ }
+ }
+ /* Erase any embedded prototype parameters. */
+ if ( lp )
+ writeblanks(lp + 1, rp);
+ p--; /* back up over terminator */
+ /* Find the name being declared. */
+ /* This is complicated because of procedure and */
+ /* array modifiers. */
+ for ( ; ; )
+ { p = skipspace(p - 1, -1);
+ switch ( *p )
+ {
+ case ']': /* skip array dimension(s) */
+ case ')': /* skip procedure args OR name */
+ { int level = 1;
+ while ( level )
+ switch ( *--p )
+ {
+ case ']': case ')': level++; break;
+ case '[': case '(': level--; break;
+ case '/': p = skipspace(p, -1) + 1; break;
+ default: ;
+ }
+ }
+ if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
+ { /* We found the name being declared */
+ while ( !isidfirstchar(*p) )
+ p = skipspace(p, 1) + 1;
+ goto found;
+ }
+ break;
+ default:
+ goto found;
+ }
+ }
+found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
+ { if ( convert_varargs )
+ { *bp++ = "va_alist";
+ vararg = p-2;
+ }
+ else
+ { p++;
+ if ( bp == breaks + 1 ) /* sole argument */
+ writeblanks(breaks[0], p);
+ else
+ writeblanks(bp[-1] - 1, p);
+ bp--;
+ }
+ }
+ else
+ { while ( isidchar(*p) ) p--;
+ *bp++ = p+1;
+ }
+ p = end;
+ }
+ while ( *p++ == ',' );
+ *bp = p;
+ /* Make a special check for 'void' arglist */
+ if ( bp == breaks+2 )
+ { p = skipspace(breaks[0], 1);
+ if ( !strncmp(p, "void", 4) )
+ { p = skipspace(p+4, 1);
+ if ( p == breaks[2] - 1 )
+ { bp = breaks; /* yup, pretend arglist is empty */
+ writeblanks(breaks[0], p + 1);
+ }
+ }
+ }
+ /* Put out the function name and left parenthesis. */
+ p = buf;
+ while ( p != endfn ) putc(*p, out), p++;
+ /* Put out the declaration. */
+ if ( header )
+ { fputs(");", out);
+ for ( p = breaks[0]; *p; p++ )
+ if ( *p == '\r' || *p == '\n' )
+ putc(*p, out);
+ }
+ else
+ { for ( ap = breaks+1; ap < bp; ap += 2 )
+ { p = *ap;
+ while ( isidchar(*p) )
+ putc(*p, out), p++;
+ if ( ap < bp - 1 )
+ fputs(", ", out);
+ }
+ fputs(") ", out);
+ /* Put out the argument declarations */
+ for ( ap = breaks+2; ap <= bp; ap += 2 )
+ (*ap)[-1] = ';';
+ if ( vararg != 0 )
+ { *vararg = 0;
+ fputs(breaks[0], out); /* any prior args */
+ fputs("va_dcl", out); /* the final arg */
+ fputs(bp[0], out);
+ }
+ else
+ fputs(breaks[0], out);
+ }
+ free((char *)breaks);
+ return 0;
+}
diff --git a/src/canit.c b/src/canit.c
new file mode 100644
index 0000000..f947a25
--- /dev/null
+++ b/src/canit.c
@@ -0,0 +1,46 @@
+/*
+ canit - cancel zmodem connection
+ Copyright (C) until 1988 Chuck Forsberg (Omen Technology INC)
+ Copyright (C) 1994 Matt Porter, Michael D. Black
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+#include "zglobal.h"
+
+#define SS_NORMAL 0
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <ctype.h>
+#include <errno.h>
+#include <getopt.h>
+
+/* send cancel string to get the other end to shut up */
+void
+canit (int fd)
+{
+ static char canistr[] =
+ {
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0
+ };
+ purgeline(fd);
+ write(fd,canistr,strlen(canistr));
+ if (fd==0)
+ write(1,canistr,strlen(canistr));
+}
+
diff --git a/src/crctab.c b/src/crctab.c
new file mode 100644
index 0000000..6b9bada
--- /dev/null
+++ b/src/crctab.c
@@ -0,0 +1,140 @@
+/*
+ * Crc calculation stuff
+ */
+
+/* crctab calculated by Mark G. Mendel, Network Systems Corporation */
+unsigned short crctab[256] = {
+ 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
+ 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
+ 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
+ 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
+ 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
+ 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
+ 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
+ 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
+ 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
+ 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
+ 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
+ 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
+ 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
+ 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
+ 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
+ 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
+ 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
+ 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
+ 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
+ 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
+ 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
+ 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
+ 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
+ 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
+ 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
+ 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
+ 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
+ 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
+ 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
+ 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
+ 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
+ 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
+};
+
+/*
+ * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell.
+ * NOTE: First srgument must be in range 0 to 255.
+ * Second argument is referenced twice.
+ *
+ * Programmers may incorporate any or all code into their programs,
+ * giving proper credit within the source. Publication of the
+ * source routines is permitted so long as proper credit is given
+ * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg,
+ * Omen Technology.
+ */
+
+#define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp)
+
+/*
+ * Copyright (C) 1986 Gary S. Brown. You may use this program, or
+ * code or tables extracted from it, as desired without restriction.
+ */
+
+/* First, the polynomial itself and its table of feedback terms. The */
+/* polynomial is */
+/* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */
+/* Note that we take it "backwards" and put the highest-order term in */
+/* the lowest-order bit. The X^32 term is "implied"; the LSB is the */
+/* X^31 term, etc. The X^0 term (usually shown as "+1") results in */
+/* the MSB being 1. */
+
+/* Note that the usual hardware shift register implementation, which */
+/* is what we're using (we're merely optimizing it by doing eight-bit */
+/* chunks at a time) shifts bits into the lowest-order term. In our */
+/* implementation, that means shifting towards the right. Why do we */
+/* do it this way? Because the calculated CRC must be transmitted in */
+/* order from highest-order term to lowest-order term. UARTs transmit */
+/* characters in order from LSB to MSB. By storing the CRC this way, */
+/* we hand it to the UART in the order low-byte to high-byte; the UART */
+/* sends each low-bit to hight-bit; and the result is transmission bit */
+/* by bit from highest- to lowest-order term without requiring any bit */
+/* shuffling on our part. Reception works similarly. */
+
+/* The feedback terms table consists of 256, 32-bit entries. Notes: */
+/* */
+/* The table can be generated at runtime if desired; code to do so */
+/* is shown later. It might not be obvious, but the feedback */
+/* terms simply represent the results of eight shift/xor opera- */
+/* tions for all combinations of data and CRC register values. */
+/* */
+/* The values must be right-shifted by eight bits by the "updcrc" */
+/* logic; the shift must be unsigned (bring in zeroes). On some */
+/* hardware you could probably optimize the shift in assembler by */
+/* using byte-swap instructions. */
+
+long cr3tab[] = { /* CRC polynomial 0xedb88320 */
+0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
+0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
+0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
+0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
+0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
+0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
+0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
+0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
+0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
+0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
+0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
+0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
+0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
+0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
+0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
+0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
+0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
+0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
+0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
+0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
+0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
+0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
+0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
+0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
+0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
+0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
+};
+
+#ifdef NFGM
+long
+UPDC32(b, c)
+long c;
+{
+ return (cr3tab[((int)c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF));
+}
+
+#else
+
+#define UPDC32(b, c) (cr3tab[((int)c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF))
+#endif
+
+/* End of crctab.c */
diff --git a/src/lrz.c b/src/lrz.c
new file mode 100644
index 0000000..2f6a5ad
--- /dev/null
+++ b/src/lrz.c
@@ -0,0 +1,2314 @@
+/*
+ lrz - receive files with x/y/zmodem
+ Copyright (C) until 1988 Chuck Forsberg (Omen Technology INC)
+ Copyright (C) 1994 Matt Porter, Michael D. Black
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ originally written by Chuck Forsberg
+*/
+
+#include "zglobal.h"
+
+#define SS_NORMAL 0
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <ctype.h>
+#include <errno.h>
+#include <getopt.h>
+
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+
+#include "timing.h"
+#include "long-options.h"
+#include "xstrtoul.h"
+#include "error.h"
+
+#ifndef STRICT_PROTOTYPES
+extern time_t time();
+extern char *strerror();
+extern char *strstr();
+#endif
+
+#ifndef HAVE_ERRNO_DECLARATION
+extern int errno;
+#endif
+
+#define MAX_BLOCK 8192
+
+/*
+ * Max value for HOWMANY is 255 if NFGVMIN is not defined.
+ * A larger value reduces system overhead but may evoke kernel bugs.
+ * 133 corresponds to an XMODEM/CRC sector
+ */
+#ifndef HOWMANY
+#ifdef NFGVMIN
+#define HOWMANY MAX_BLOCK
+#else
+#define HOWMANY 255
+#endif
+#endif
+
+unsigned Baudrate = 2400;
+
+FILE *fout;
+
+
+int Lastrx;
+int Crcflg;
+int Firstsec;
+int errors;
+int Restricted=1; /* restricted; no /.. or ../ in filenames */
+int Readnum = HOWMANY; /* Number of bytes to ask for in read() from modem */
+int skip_if_not_found;
+
+char *Pathname;
+const char *program_name; /* the name by which we were called */
+
+int Topipe=0;
+int MakeLCPathname=TRUE; /* make received pathname lower case */
+int Verbose=0;
+int Quiet=0; /* overrides logic that would otherwise set verbose */
+int Nflag = 0; /* Don't really transfer files */
+int Rxclob=FALSE; /* Clobber existing file */
+int Rxbinary=FALSE; /* receive all files in bin mode */
+int Rxascii=FALSE; /* receive files in ascii (translate) mode */
+int Thisbinary; /* current file is to be received in bin mode */
+int try_resume=FALSE;
+int allow_remote_commands=FALSE;
+int junk_path=FALSE;
+int no_timeout=FALSE;
+enum zm_type_enum protocol;
+int under_rsh=FALSE;
+int zmodem_requested=FALSE;
+
+#ifdef SEGMENTS
+static int chinseg = 0; /* Number of characters received in this data seg */
+#endif
+static char *secbuf;
+
+#ifdef ENABLE_TIMESYNC
+static int timesync_flag=0;
+static int in_timesync=0;
+#endif
+int tcp_socket=-1;
+int tcp_flag=0;
+char *tcp_server_address=NULL;
+
+#if defined(F_GETFD) && defined(F_SETFD) && defined(O_SYNC)
+static int o_sync = 0;
+#endif
+static int rzfiles __P ((struct zm_fileinfo *));
+static int tryz __P ((void));
+static void checkpath __P ((const char *name));
+static void chkinvok __P ((const char *s));
+static void report __P ((int sct));
+static void uncaps __P ((char *s));
+static int IsAnyLower __P ((const char *s));
+static int putsec __P ((struct zm_fileinfo *zi, char *buf, size_t n));
+static int make_dirs __P ((char *pathname));
+static int procheader __P ((char *name, struct zm_fileinfo *));
+static int wcgetsec __P ((size_t *Blklen, char *rxbuf, unsigned int maxtime));
+static int wcrx __P ((struct zm_fileinfo *));
+static int wcrxpn __P ((struct zm_fileinfo *, char *rpn));
+static int wcreceive __P ((int argc, char **argp));
+static int rzfile __P ((struct zm_fileinfo *));
+static void usage __P ((int exitcode, const char *what));
+static void usage1 __P ((int exitcode));
+static void exec2 __P ((const char *s));
+static int closeit __P ((struct zm_fileinfo *));
+static void ackbibi __P ((void));
+static int sys2 __P ((const char *s));
+static void zmputs __P ((const char *s));
+static size_t getfree __P ((void));
+
+static long buffersize=32768;
+static unsigned long min_bps=0;
+static long min_bps_time=120;
+
+char Lzmanag; /* Local file management request */
+char zconv; /* ZMODEM file conversion request */
+char zmanag; /* ZMODEM file management request */
+char ztrans; /* ZMODEM file transport request */
+int Zctlesc; /* Encode control characters */
+int Zrwindow = 1400; /* RX window size (controls garbage count) */
+
+int tryzhdrtype=ZRINIT; /* Header type to send corresponding to Last rx close */
+time_t stop_time;
+
+#ifdef ENABLE_SYSLOG
+# if defined(ENABLE_SYSLOG_FORCE) || defined(ENABLE_SYSLOG_DEFAULT)
+int enable_syslog=TRUE;
+# else
+int enable_syslog=FALSE;
+# endif
+#define DO_SYSLOG_FNAME(message) do { \
+ if (enable_syslog) { \
+ const char *shortname; \
+ if (!zi->fname) \
+ shortname="no.name"; \
+ else { \
+ shortname=strrchr(zi->fname,'/'); \
+ if (!shortname) \
+ shortname=zi->fname; \
+ else \
+ shortname++; \
+ } \
+ lsyslog message ; \
+ } \
+} while(0)
+#define DO_SYSLOG(message) do { \
+ if (enable_syslog) { \
+ lsyslog message ; \
+ } \
+} while(0)
+#else
+#define DO_SYSLOG_FNAME(message) do { } while(0)
+#define DO_SYSLOG(message) do { } while(0)
+#endif
+
+
+/* called by signal interrupt or terminate to clean things up */
+RETSIGTYPE
+bibi(int n)
+{
+ if (zmodem_requested)
+ zmputs(Attn);
+ canit(STDOUT_FILENO);
+ io_mode(0,0);
+ error(128+n,0,_("caught signal %d; exiting"), n);
+}
+
+static struct option const long_options[] =
+{
+ {"append", no_argument, NULL, '+'},
+ {"ascii", no_argument, NULL, 'a'},
+ {"binary", no_argument, NULL, 'b'},
+ {"bufsize", required_argument, NULL, 'B'},
+ {"allow-commands", no_argument, NULL, 'C'},
+ {"allow-remote-commands", no_argument, NULL, 'C'},
+ {"escape", no_argument, NULL, 'e'},
+ {"rename", no_argument, NULL, 'E'},
+ {"help", no_argument, NULL, 'h'},
+ {"crc-check", no_argument, NULL, 'H'},
+ {"junk-path", no_argument, NULL, 'j'},
+ {"errors", required_argument, NULL, 3},
+ {"disable-timeouts", no_argument, NULL, 'O'},
+ {"disable-timeout", no_argument, NULL, 'O'}, /* i can't get it right */
+ {"min-bps", required_argument, NULL, 'm'},
+ {"min-bps-time", required_argument, NULL, 'M'},
+ {"newer", no_argument, NULL, 'n'},
+ {"newer-or-longer", no_argument, NULL, 'N'},
+ {"protect", no_argument, NULL, 'p'},
+ {"resume", no_argument, NULL, 'r'},
+ {"restricted", no_argument, NULL, 'R'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"stop-at", required_argument, NULL, 's'},
+ {"timesync", no_argument, NULL, 'S'},
+ {"timeout", required_argument, NULL, 't'},
+ {"keep-uppercase", no_argument, NULL, 'u'},
+ {"unrestrict", no_argument, NULL, 'U'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"windowsize", required_argument, NULL, 'w'},
+ {"with-crc", no_argument, NULL, 'c'},
+ {"xmodem", no_argument, NULL, 'X'},
+ {"ymodem", no_argument, NULL, 1},
+ {"zmodem", no_argument, NULL, 'Z'},
+ {"overwrite", no_argument, NULL, 'y'},
+ {"null", no_argument, NULL, 'D'},
+ {"syslog", optional_argument, NULL , 2},
+ {"delay-startup", required_argument, NULL, 4},
+ {"o-sync", no_argument, NULL, 5},
+ {"o_sync", no_argument, NULL, 5},
+ {"tcp-server", no_argument, NULL, 6},
+ {"tcp-client", required_argument, NULL, 7},
+ {NULL,0,NULL,0}
+};
+
+static void
+show_version(void)
+{
+ printf ("%s (GNU %s) %s\n", program_name, PACKAGE, VERSION);
+}
+
+int
+main(int argc, char *argv[])
+{
+ register char *cp;
+ register int npats;
+ char **patts=NULL; /* keep compiler quiet */
+ int exitcode=0;
+ int c;
+ unsigned int startup_delay=0;
+
+ Rxtimeout = 100;
+ setbuf(stderr, NULL);
+ if ((cp=getenv("SHELL")) && (strstr(cp, "rsh") || strstr(cp, "rksh")
+ || strstr(cp,"rbash") || strstr(cp, "rshell")))
+ under_rsh=TRUE;
+ if ((cp=getenv("ZMODEM_RESTRICTED"))!=NULL)
+ Restricted=2;
+
+ /* make temporary and unfinished files */
+ umask(0077);
+
+ from_cu();
+ chkinvok(argv[0]); /* if called as [-]rzCOMMAND set flag */
+
+#ifdef ENABLE_SYSLOG
+ openlog(program_name,LOG_PID,ENABLE_SYSLOG);
+#endif
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ parse_long_options (argc, argv, show_version, usage1);
+
+ while ((c = getopt_long (argc, argv,
+ "a+bB:cCDeEhm:M:OprRqs:St:uUvw:XZy",
+ long_options, (int *) 0)) != EOF)
+ {
+ unsigned long int tmp;
+ char *tmpptr;
+ enum strtol_error s_err;
+
+ switch (c)
+ {
+ case 0:
+ break;
+ case '+': Lzmanag = ZF1_ZMAPND; break;
+ case 'a': Rxascii=TRUE; break;
+ case 'b': Rxbinary=TRUE; break;
+ case 'B':
+ if (strcmp(optarg,"auto")==0)
+ buffersize=-1;
+ else
+ buffersize=strtol(optarg,NULL,10);
+ break;
+ case 'c': Crcflg=TRUE; break;
+ case 'C': allow_remote_commands=TRUE; break;
+ case 'D': Nflag = TRUE; break;
+ case 'E': Lzmanag = ZF1_ZMCHNG; break;
+ case 'e': Zctlesc = 1; break;
+ case 'h': usage(0,NULL); break;
+ case 'H': Lzmanag= ZF1_ZMCRC; break;
+ case 'j': junk_path=TRUE; break;
+ case 'm':
+ s_err = xstrtoul (optarg, &tmpptr, 0, &tmp, "km");
+ min_bps = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("min_bps"), s_err);
+ break;
+ case 'M':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ min_bps_time = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("min_bps_time"), s_err);
+ if (min_bps_time<=1)
+ usage(2,_("min_bps_time must be > 1"));
+ break;
+ case 'N': Lzmanag = ZF1_ZMNEWL; break;
+ case 'n': Lzmanag = ZF1_ZMNEW; break;
+ case 'O': no_timeout=TRUE; break;
+ case 'p': Lzmanag = ZF1_ZMPROT; break;
+ case 'q': Quiet=TRUE; Verbose=0; break;
+ case 's':
+ if (isdigit((unsigned char) (*optarg))) {
+ struct tm *tm;
+ time_t t;
+ int hh,mm;
+ char *nex;
+
+ hh = strtoul (optarg, &nex, 10);
+ if (hh>23)
+ usage(2,_("hour to large (0..23)"));
+ if (*nex!=':')
+ usage(2, _("unparsable stop time\n"));
+ nex++;
+ mm = strtoul (optarg, &nex, 10);
+ if (mm>59)
+ usage(2,_("minute to large (0..59)"));
+
+ t=time(NULL);
+ tm=localtime(&t);
+ tm->tm_hour=hh;
+ tm->tm_min=hh;
+ stop_time=mktime(tm);
+ if (stop_time<t)
+ stop_time+=86400L; /* one day more */
+ if (stop_time - t <10)
+ usage(2,_("stop time to small"));
+ } else {
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ stop_time = tmp + time(0);
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("stop-at"), s_err);
+ if (tmp<10)
+ usage(2,_("stop time to small"));
+ }
+ break;
+
+
+ case 'r':
+ if (try_resume)
+ Lzmanag= ZF1_ZMCRC;
+ else
+ try_resume=TRUE;
+ break;
+ case 'R': Restricted++; break;
+ case 'S':
+#ifdef ENABLE_TIMESYNC
+ timesync_flag++;
+ if (timesync_flag==2) {
+#ifdef HAVE_SETTIMEOFDAY
+ error(0,0,_("don't have settimeofday, will not set time\n"));
+#endif
+ if (getuid()!=0)
+ error(0,0,
+ _("not running as root (this is good!), can not set time\n"));
+ }
+#endif
+ break;
+ case 't':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ Rxtimeout = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("timeout"), s_err);
+ if (Rxtimeout<10 || Rxtimeout>1000)
+ usage(2,_("timeout out of range 10..1000"));
+ break;
+ case 'w':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ Zrwindow = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("window size"), s_err);
+ break;
+ case 'u':
+ MakeLCPathname=FALSE; break;
+ case 'U':
+ if (!under_rsh)
+ Restricted=0;
+ else {
+ DO_SYSLOG((LOG_INFO,"--unrestrict option used under restricted shell"));
+ error(1,0,
+ _("security violation: can't do that under restricted shell\n"));
+ }
+ break;
+ case 'v':
+ ++Verbose; break;
+ case 'X': protocol=ZM_XMODEM; break;
+ case 1: protocol=ZM_YMODEM; break;
+ case 'Z': protocol=ZM_ZMODEM; break;
+ case 'y':
+ Rxclob=TRUE; break;
+ case 2:
+#ifdef ENABLE_SYSLOG
+# ifndef ENABLE_SYSLOG_FORCE
+ if (optarg && (!strcmp(optarg,"off") || !strcmp(optarg,"no"))) {
+ if (under_rsh)
+ error(0,0, _("cannot turnoff syslog"));
+ else
+ enable_syslog=FALSE;
+ }
+ else
+ enable_syslog=TRUE;
+# else
+ error(0,0, _("cannot turnoff syslog"));
+# endif
+#endif
+ case 3:
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, "km");
+ bytes_per_error = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("bytes_per_error"), s_err);
+ if (bytes_per_error<100)
+ usage(2,_("bytes-per-error should be >100"));
+ break;
+ case 4:
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ startup_delay = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("startup delay"), s_err);
+ break;
+ case 5:
+#if defined(F_GETFD) && defined(F_SETFD) && defined(O_SYNC)
+ o_sync=1;
+#else
+ error(0,0, _("O_SYNC not supported by the kernel"));
+#endif
+ break;
+ case 6:
+ tcp_flag=2;
+ break;
+ case 7:
+ tcp_flag=3;
+ tcp_server_address=(char *)strdup(optarg);
+ if (!tcp_server_address)
+ error(1,0,_("out of memory"));
+ break;
+ default:
+ usage(2,NULL);
+ }
+
+ }
+
+ if (getuid()!=geteuid()) {
+ error(1,0,
+ _("this program was never intended to be used setuid\n"));
+ }
+
+#ifdef SEGMENTS
+ secbuf=malloc(1+(SEGMENTS+1)*MAX_BLOCK);
+#else
+ secbuf=malloc(MAX_BLOCK+1);
+#endif
+ if (!secbuf) error(1,0,_("out of memory"));
+
+ /* initialize zsendline tab */
+ zsendline_init();
+#ifdef HAVE_SIGINTERRUPT
+ siginterrupt(SIGALRM,1);
+#endif
+ if (startup_delay)
+ sleep(startup_delay);
+
+ npats = argc - optind;
+ patts=&argv[optind];
+
+ if (npats > 1)
+ usage(2,_("garbage on commandline"));
+ if (protocol!=ZM_XMODEM && npats)
+ usage(2, _("garbage on commandline"));
+ if (Restricted && allow_remote_commands) {
+ allow_remote_commands=FALSE;
+ }
+ if (Fromcu && !Quiet) {
+ if (Verbose == 0)
+ Verbose = 2;
+ }
+
+ vfile("%s %s\n", program_name, VERSION);
+
+ if (tcp_flag==2) {
+ char buf[256];
+#ifdef MAXHOSTNAMELEN
+ char hn[MAXHOSTNAMELEN];
+#else
+ char hn[256];
+#endif
+ char *p,*q;
+ int d;
+
+ /* tell receiver to receive via tcp */
+ d=tcp_server(buf);
+ p=strchr(buf+1,'<');
+ p++;
+ q=strchr(p,'>');
+ *q=0;
+ if (gethostname(hn,sizeof(hn))==-1) {
+ error(1,0, _("hostname too long\n"));
+ }
+ fprintf(stdout,"connect with lrz --tcp-client \"%s:%s\"\n",hn,p);
+ fflush(stdout);
+ /* ok, now that this file is sent we can switch to tcp */
+
+ tcp_socket=tcp_accept(d);
+ dup2(tcp_socket,0);
+ dup2(tcp_socket,1);
+ }
+ if (tcp_flag==3) {
+ char buf[256];
+ char *p;
+ p=strchr(tcp_server_address,':');
+ if (!p)
+ error(1,0, _("illegal server address\n"));
+ *p++=0;
+ sprintf(buf,"[%s] <%s>\n",tcp_server_address,p);
+
+ fprintf(stdout,"connecting to %s\n",buf);
+ fflush(stdout);
+
+ /* we need to switch to tcp mode */
+ tcp_socket=tcp_connect(buf);
+ dup2(tcp_socket,0);
+ dup2(tcp_socket,1);
+ }
+
+ io_mode(0,1);
+ readline_setup(0, HOWMANY, MAX_BLOCK*2);
+ if (signal(SIGINT, bibi) == SIG_IGN)
+ signal(SIGINT, SIG_IGN);
+ else
+ signal(SIGINT, bibi);
+ signal(SIGTERM, bibi);
+ signal(SIGPIPE, bibi);
+ if (wcreceive(npats, patts)==ERROR) {
+ exitcode=0200;
+ canit(STDOUT_FILENO);
+ }
+ io_mode(0,0);
+ if (exitcode && !zmodem_requested) /* bellow again with all thy might. */
+ canit(STDOUT_FILENO);
+ if (Verbose)
+ {
+ fputs("\r\n",stderr);
+ if (exitcode)
+ fputs(_("Transfer incomplete\n"),stderr);
+ else
+ fputs(_("Transfer complete\n"),stderr);
+ }
+ exit(exitcode);
+}
+
+static void
+usage1(int exitcode)
+{
+ usage(exitcode,NULL);
+}
+
+static void
+usage(int exitcode, const char *what)
+{
+ FILE *f=stdout;
+
+ if (exitcode)
+ {
+ if (what)
+ fprintf(stderr, "%s: %s\n",program_name,what);
+ fprintf (stderr, _("Try `%s --help' for more information.\n"),
+ program_name);
+ exit(exitcode);
+ }
+
+ fprintf(f, _("%s version %s\n"), program_name,
+ VERSION);
+
+ fprintf(f,_("Usage: %s [options] [filename.if.xmodem]\n"), program_name);
+ fputs(_("Receive files with ZMODEM/YMODEM/XMODEM protocol\n"),f);
+ fputs(_(
+ " (X) = option applies to XMODEM only\n"
+ " (Y) = option applies to YMODEM only\n"
+ " (Z) = option applies to ZMODEM only\n"
+ ),f);
+ fputs(_(
+" -+, --append append to existing files\n"
+" -a, --ascii ASCII transfer (change CR/LF to LF)\n"
+" -b, --binary binary transfer\n"
+" -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n"
+" -c, --with-crc Use 16 bit CRC (X)\n"
+" -C, --allow-remote-commands allow execution of remote commands (Z)\n"
+" -D, --null write all received data to /dev/null\n"
+" --delay-startup N sleep N seconds before doing anything\n"
+" -e, --escape Escape control characters (Z)\n"
+" -E, --rename rename any files already existing\n"
+" --errors N generate CRC error every N bytes (debugging)\n"
+" -h, --help Help, print this usage message\n"
+" -m, --min-bps N stop transmission if BPS below N\n"
+" -M, --min-bps-time N for at least N seconds (default: 120)\n"
+" -O, --disable-timeouts disable timeout code, wait forever for data\n"
+" --o-sync open output file(s) in synchronous write mode\n"
+" -p, --protect protect existing files\n"
+" -q, --quiet quiet, no progress reports\n"
+" -r, --resume try to resume interrupted file transfer (Z)\n"
+" -R, --restricted restricted, more secure mode\n"
+" -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n"
+" -S, --timesync request remote time (twice: set local time)\n"
+" --syslog[=off] turn syslog on or off, if possible\n"
+" -t, --timeout N set timeout to N tenths of a second\n"
+" --tcp-server open socket, wait for connection (Z)\n"
+" --tcp-client ADDR:PORT open socket, connect to ... (Z)\n"
+" -u, --keep-uppercase keep upper case filenames\n"
+" -U, --unrestrict disable restricted mode (if allowed to)\n"
+" -v, --verbose be verbose, provide debugging information\n"
+" -w, --windowsize N Window is N bytes (Z)\n"
+" -X --xmodem use XMODEM protocol\n"
+" -y, --overwrite Yes, clobber existing file if any\n"
+" --ymodem use YMODEM protocol\n"
+" -Z, --zmodem use ZMODEM protocol\n"
+"\n"
+"short options use the same arguments as the long ones\n"
+ ),f);
+ exit(exitcode);
+}
+
+/*
+ * Let's receive something already.
+ */
+
+static int
+wcreceive(int argc, char **argp)
+{
+ int c;
+ struct zm_fileinfo zi;
+#ifdef ENABLE_SYSLOG
+ const char *shortname=NULL;;
+#endif
+ zi.fname=NULL;
+ zi.modtime=0;
+ zi.mode=0;
+ zi.bytes_total=0;
+ zi.bytes_sent=0;
+ zi.bytes_received=0;
+ zi.bytes_skipped=0;
+ zi.eof_seen=0;
+
+ if (protocol!=ZM_XMODEM || argc==0) {
+ Crcflg=1;
+ if ( !Quiet)
+ vstringf(_("%s waiting to receive."), program_name);
+ if ((c=tryz())!=0) {
+ if (c == ZCOMPL)
+ return OK;
+ if (c == ERROR)
+ goto fubar;
+ c = rzfiles(&zi);
+
+#ifdef ENABLE_SYSLOG
+ shortname=NULL;
+#endif
+ if (c)
+ goto fubar;
+ } else {
+ for (;;) {
+ if (Verbose > 1
+#ifdef ENABLE_SYSLOG
+ || enable_syslog
+#endif
+ )
+ timing(1,NULL);
+#ifdef ENABLE_SYSLOG
+ shortname=NULL;
+#endif
+ if (wcrxpn(&zi,secbuf)== ERROR)
+ goto fubar;
+ if (secbuf[0]==0)
+ return OK;
+ if (procheader(secbuf, &zi) == ERROR)
+ goto fubar;
+#ifdef ENABLE_SYSLOG
+ shortname=strrchr(zi.fname,'/');
+ if (shortname)
+ shortname++;
+ else
+ shortname=zi.fname;
+#endif
+ if (wcrx(&zi)==ERROR)
+ goto fubar;
+
+ if (Verbose > 1
+#ifdef ENABLE_SYSLOG
+ || enable_syslog
+#endif
+ ) {
+ double d;
+ long bps;
+ d=timing(0,NULL);
+ if (d==0)
+ d=0.5; /* can happen if timing uses time() */
+ bps=(zi.bytes_received-zi.bytes_skipped)/d;
+
+ if (Verbose>1) {
+ vstringf(
+ _("\rBytes received: %7ld/%7ld BPS:%-6ld \r\n"),
+ (long) zi.bytes_received, (long) zi.bytes_total, bps);
+ }
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_INFO,"%s/%s: %ld Bytes, %ld BPS",
+ shortname,protname(),zi.bytes_received, bps);
+#endif
+ }
+ }
+ }
+ } else {
+ char dummy[128];
+ dummy[0]='\0'; /* pre-ANSI HPUX cc demands this */
+ dummy[1]='\0'; /* procheader uses name + 1 + strlen(name) */
+ zi.bytes_total = DEFBYTL;
+
+ if (Verbose > 1
+#ifdef ENABLE_SYSLOG
+ || enable_syslog
+#endif
+ )
+ timing(1,NULL);
+ procheader(dummy, &zi);
+
+ if (Pathname)
+ free(Pathname);
+ errno=0;
+ Pathname=malloc(PATH_MAX+1);
+ if (!Pathname)
+ error(1,0,_("out of memory"));
+
+ strcpy(Pathname, *argp);
+ checkpath(Pathname);
+#ifdef ENABLE_SYSLOG
+ shortname=strrchr(*argp,'/');
+ if (shortname)
+ shortname++;
+ else
+ shortname=*argp;
+#endif
+ vchar('\n');
+ vstringf(_("%s: ready to receive %s"), program_name, Pathname);
+ vstring("\r\n");
+
+ if ((fout=fopen(Pathname, "w")) == NULL) {
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_ERR,"%s/%s: cannot open: %m",
+ shortname,protname());
+#endif
+ return ERROR;
+ }
+ if (wcrx(&zi)==ERROR) {
+ goto fubar;
+ }
+ if (Verbose > 1
+#ifdef ENABLE_SYSLOG
+ || enable_syslog
+#endif
+ ) {
+ double d;
+ long bps;
+ d=timing(0,NULL);
+ if (d==0)
+ d=0.5; /* can happen if timing uses time() */
+ bps=(zi.bytes_received-zi.bytes_skipped)/d;
+ if (Verbose) {
+ vstringf(
+ _("\rBytes received: %7ld BPS:%-6ld \r\n"),
+ (long) zi.bytes_received, bps);
+ }
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_INFO,"%s/%s: %ld Bytes, %ld BPS",
+ shortname,protname(),zi.bytes_received, bps);
+#endif
+ }
+ }
+ return OK;
+fubar:
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_ERR,"%s/%s: got error",
+ shortname ? shortname : "no.name", protname());
+#endif
+ canit(STDOUT_FILENO);
+ if (Topipe && fout) {
+ pclose(fout); return ERROR;
+ }
+ if (fout)
+ fclose(fout);
+
+ if (Restricted && Pathname) {
+ unlink(Pathname);
+ vstringf(_("\r\n%s: %s removed.\r\n"), program_name, Pathname);
+ }
+ return ERROR;
+}
+
+
+/*
+ * Fetch a pathname from the other end as a C ctyle ASCIZ string.
+ * Length is indeterminate as long as less than Blklen
+ * A null string represents no more files (YMODEM)
+ */
+static int
+wcrxpn(struct zm_fileinfo *zi, char *rpn)
+{
+ register int c;
+ size_t Blklen=0; /* record length of received packets */
+
+#ifdef NFGVMIN
+ READLINE_PF(1);
+#else
+ purgeline(0);
+#endif
+
+et_tu:
+ Firstsec=TRUE;
+ zi->eof_seen=FALSE;
+ sendline(Crcflg?WANTCRC:NAK);
+ flushmo();
+ purgeline(0); /* Do read next time ... */
+ while ((c = wcgetsec(&Blklen, rpn, 100)) != 0) {
+ if (c == WCEOT) {
+ zperr( _("Pathname fetch returned EOT"));
+ sendline(ACK);
+ flushmo();
+ purgeline(0); /* Do read next time ... */
+ READLINE_PF(1);
+ goto et_tu;
+ }
+ return ERROR;
+ }
+ sendline(ACK);
+ flushmo();
+ return OK;
+}
+
+/*
+ * Adapted from CMODEM13.C, written by
+ * Jack M. Wierda and Roderick W. Hart
+ */
+static int
+wcrx(struct zm_fileinfo *zi)
+{
+ register int sectnum, sectcurr;
+ register char sendchar;
+ size_t Blklen;
+
+ Firstsec=TRUE;sectnum=0;
+ zi->eof_seen=FALSE;
+ sendchar=Crcflg?WANTCRC:NAK;
+
+ for (;;) {
+ sendline(sendchar); /* send it now, we're ready! */
+ flushmo();
+ purgeline(0); /* Do read next time ... */
+ sectcurr=wcgetsec(&Blklen, secbuf,
+ (unsigned int) ((sectnum&0177) ? 50 : 130));
+ report(sectcurr);
+ if (sectcurr==((sectnum+1) &0377)) {
+ sectnum++;
+ /* if using xmodem we don't know how long a file is */
+ if (zi->bytes_total && R_BYTESLEFT(zi) < Blklen)
+ Blklen=R_BYTESLEFT(zi);
+ zi->bytes_received+=Blklen;
+ if (putsec(zi, secbuf, Blklen)==ERROR)
+ return ERROR;
+ sendchar=ACK;
+ }
+ else if (sectcurr==(sectnum&0377)) {
+ zperr( _("Received dup Sector"));
+ sendchar=ACK;
+ }
+ else if (sectcurr==WCEOT) {
+ if (closeit(zi))
+ return ERROR;
+ sendline(ACK);
+ flushmo();
+ purgeline(0); /* Do read next time ... */
+ return OK;
+ }
+ else if (sectcurr==ERROR)
+ return ERROR;
+ else {
+ zperr( _("Sync Error"));
+ return ERROR;
+ }
+ }
+}
+
+/*
+ * Wcgetsec fetches a Ward Christensen type sector.
+ * Returns sector number encountered or ERROR if valid sector not received,
+ * or CAN CAN received
+ * or WCEOT if eot sector
+ * time is timeout for first char, set to 4 seconds thereafter
+ ***************** NO ACK IS SENT IF SECTOR IS RECEIVED OK **************
+ * (Caller must do that when he is good and ready to get next sector)
+ */
+static int
+wcgetsec(size_t *Blklen, char *rxbuf, unsigned int maxtime)
+{
+ register int checksum, wcj, firstch;
+ register unsigned short oldcrc;
+ register char *p;
+ int sectcurr;
+
+ for (Lastrx=errors=0; errors<RETRYMAX; errors++) {
+
+ if ((firstch=READLINE_PF(maxtime))==STX) {
+ *Blklen=1024; goto get2;
+ }
+ if (firstch==SOH) {
+ *Blklen=128;
+get2:
+ sectcurr=READLINE_PF(1);
+ if ((sectcurr+(oldcrc=READLINE_PF(1)))==0377) {
+ oldcrc=checksum=0;
+ for (p=rxbuf,wcj=*Blklen; --wcj>=0; ) {
+ if ((firstch=READLINE_PF(1)) < 0)
+ goto bilge;
+ oldcrc=updcrc(firstch, oldcrc);
+ checksum += (*p++ = firstch);
+ }
+ if ((firstch=READLINE_PF(1)) < 0)
+ goto bilge;
+ if (Crcflg) {
+ oldcrc=updcrc(firstch, oldcrc);
+ if ((firstch=READLINE_PF(1)) < 0)
+ goto bilge;
+ oldcrc=updcrc(firstch, oldcrc);
+ if (oldcrc & 0xFFFF)
+ zperr( _("CRC"));
+ else {
+ Firstsec=FALSE;
+ return sectcurr;
+ }
+ }
+ else if (((checksum-firstch)&0377)==0) {
+ Firstsec=FALSE;
+ return sectcurr;
+ }
+ else
+ zperr( _("Checksum"));
+ }
+ else
+ zperr(_("Sector number garbled"));
+ }
+ /* make sure eot really is eot and not just mixmash */
+#ifdef NFGVMIN
+ else if (firstch==EOT && READLINE_PF(1)==TIMEOUT)
+ return WCEOT;
+#else
+ else if (firstch==EOT && READLINE_PF>0)
+ return WCEOT;
+#endif
+ else if (firstch==CAN) {
+ if (Lastrx==CAN) {
+ zperr( _("Sender Cancelled"));
+ return ERROR;
+ } else {
+ Lastrx=CAN;
+ continue;
+ }
+ }
+ else if (firstch==TIMEOUT) {
+ if (Firstsec)
+ goto humbug;
+bilge:
+ zperr( _("TIMEOUT"));
+ }
+ else
+ zperr( _("Got 0%o sector header"), firstch);
+
+humbug:
+ Lastrx=0;
+ {
+ int cnt=1000;
+ while(cnt-- && READLINE_PF(1)!=TIMEOUT)
+ ;
+ }
+ if (Firstsec) {
+ sendline(Crcflg?WANTCRC:NAK);
+ flushmo();
+ purgeline(0); /* Do read next time ... */
+ } else {
+ maxtime=40;
+ sendline(NAK);
+ flushmo();
+ purgeline(0); /* Do read next time ... */
+ }
+ }
+ /* try to stop the bubble machine. */
+ canit(STDOUT_FILENO);
+ return ERROR;
+}
+
+#define ZCRC_DIFFERS (ERROR+1)
+#define ZCRC_EQUAL (ERROR+2)
+/*
+ * do ZCRC-Check for open file f.
+ * check at most check_bytes bytes (crash recovery). if 0 -> whole file.
+ * remote file size is remote_bytes.
+ */
+static int
+do_crc_check(FILE *f, size_t remote_bytes, size_t check_bytes)
+{
+ struct stat st;
+ unsigned long crc;
+ unsigned long rcrc;
+ size_t n;
+ int c;
+ int t1=0,t2=0;
+ if (-1==fstat(fileno(f),&st)) {
+ DO_SYSLOG((LOG_ERR,"cannot fstat open file: %s",strerror(errno)));
+ return ERROR;
+ }
+ if (check_bytes==0 && ((size_t) st.st_size)!=remote_bytes)
+ return ZCRC_DIFFERS; /* shortcut */
+
+ crc=0xFFFFFFFFL;
+ n=check_bytes;
+ if (n==0)
+ n=st.st_size;
+ while (n-- && ((c = getc(f)) != EOF))
+ crc = UPDC32(c, crc);
+ crc = ~crc;
+ clearerr(f); /* Clear EOF */
+ fseek(f, 0L, 0);
+
+ while (t1<3) {
+ stohdr(check_bytes);
+ zshhdr(ZCRC, Txhdr);
+ while(t2<3) {
+ size_t tmp;
+ c = zgethdr(Rxhdr, 0, &tmp);
+ rcrc=(unsigned long) tmp;
+ switch (c) {
+ default: /* ignore */
+ break;
+ case ZFIN:
+ return ERROR;
+ case ZRINIT:
+ return ERROR;
+ case ZCAN:
+ if (Verbose)
+ vstringf(_("got ZCAN"));
+ return ERROR;
+ break;
+ case ZCRC:
+ if (crc!=rcrc)
+ return ZCRC_DIFFERS;
+ return ZCRC_EQUAL;
+ break;
+ }
+ }
+ }
+ return ERROR;
+}
+
+/*
+ * Process incoming file information header
+ */
+static int
+procheader(char *name, struct zm_fileinfo *zi)
+{
+ const char *openmode;
+ char *p;
+ static char *name_static=NULL;
+ char *nameend;
+
+ if (name_static)
+ free(name_static);
+ if (junk_path) {
+ p=strrchr(name,'/');
+ if (p) {
+ p++;
+ if (!*p) {
+ /* alert - file name ended in with a / */
+ if (Verbose)
+ vstringf(_("file name ends with a /, skipped: %s\n"),name);
+ DO_SYSLOG((LOG_ERR,"file name ends with a /, skipped: %s", name));
+ return ERROR;
+ }
+ name=p;
+ }
+ }
+ name_static=malloc(strlen(name)+1);
+ if (!name_static)
+ error(1,0,_("out of memory"));
+ strcpy(name_static,name);
+ zi->fname=name_static;
+
+ if (Verbose>2) {
+ vstringf(_("zmanag=%d, Lzmanag=%d\n"),zmanag,Lzmanag);
+ vstringf(_("zconv=%d\n"),zconv);
+ }
+
+ /* set default parameters and overrides */
+ openmode = "w";
+ Thisbinary = (!Rxascii) || Rxbinary;
+ if (Lzmanag)
+ zmanag = Lzmanag;
+
+ /*
+ * Process ZMODEM remote file management requests
+ */
+ if (!Rxbinary && zconv == ZCNL) /* Remote ASCII override */
+ Thisbinary = 0;
+ if (zconv == ZCBIN) /* Remote Binary override */
+ Thisbinary = TRUE;
+ if (Thisbinary && zconv == ZCBIN && try_resume)
+ zconv=ZCRESUM;
+ if (zmanag == ZF1_ZMAPND && zconv!=ZCRESUM)
+ openmode = "a";
+ if (skip_if_not_found)
+ openmode="r+";
+
+#ifdef ENABLE_TIMESYNC
+ in_timesync=0;
+ if (timesync_flag && 0==strcmp(name,"$time$.t"))
+ in_timesync=1;
+#endif
+
+ zi->bytes_total = DEFBYTL;
+ zi->mode = 0;
+ zi->eof_seen = 0;
+ zi->modtime = 0;
+
+ nameend = name + 1 + strlen(name);
+ if (*nameend) { /* file coming from Unix or DOS system */
+ long modtime;
+ long bytes_total;
+ int mode;
+ sscanf(nameend, "%ld%lo%o", &bytes_total, &modtime, &mode);
+ zi->modtime=modtime;
+ zi->bytes_total=bytes_total;
+ zi->mode=mode;
+ if (zi->mode & UNIXFILE)
+ ++Thisbinary;
+ }
+
+ /* Check for existing file */
+ if (zconv != ZCRESUM && !Rxclob && (zmanag&ZF1_ZMMASK) != ZF1_ZMCLOB
+ && (zmanag&ZF1_ZMMASK) != ZF1_ZMAPND
+#ifdef ENABLE_TIMESYNC
+ && !in_timesync
+#endif
+ && (fout=fopen(name, "r"))) {
+ struct stat sta;
+ char *tmpname;
+ char *ptr;
+ int i;
+ if (zmanag == ZF1_ZMNEW || zmanag==ZF1_ZMNEWL) {
+ if (-1==fstat(fileno(fout),&sta)) {
+#ifdef ENABLE_SYSLOG
+ int e=errno;
+#endif
+ if (Verbose)
+ vstringf(_("file exists, skipped: %s\n"),name);
+ DO_SYSLOG((LOG_ERR,"cannot fstat open file %s: %s",
+ name,strerror(e)));
+ return ERROR;
+ }
+ if (zmanag == ZF1_ZMNEW) {
+ if (sta.st_mtime > zi->modtime) {
+ DO_SYSLOG((LOG_INFO,"skipping %s: newer file exists", name));
+ return ERROR; /* skips file */
+ }
+ } else {
+ /* newer-or-longer */
+ if (((size_t) sta.st_size) >= zi->bytes_total
+ && sta.st_mtime > zi->modtime) {
+ DO_SYSLOG((LOG_INFO,"skipping %s: longer+newer file exists", name));
+ return ERROR; /* skips file */
+ }
+ }
+ fclose(fout);
+ } else if (zmanag==ZF1_ZMCRC) {
+ int r=do_crc_check(fout,zi->bytes_total,0);
+ if (r==ERROR) {
+ fclose(fout);
+ return ERROR;
+ }
+ if (r!=ZCRC_DIFFERS) {
+ return ERROR; /* skips */
+ }
+ fclose(fout);
+ } else {
+ size_t namelen;
+ fclose(fout);
+ if ((zmanag & ZF1_ZMMASK)!=ZF1_ZMCHNG) {
+ if (Verbose)
+ vstringf(_("file exists, skipped: %s\n"),name);
+ return ERROR;
+ }
+ /* try to rename */
+ namelen=strlen(name);
+ tmpname=alloca(namelen+5);
+ memcpy(tmpname,name,namelen);
+ ptr=tmpname+namelen;
+ *ptr++='.';
+ i=0;
+ do {
+ sprintf(ptr,"%d",i++);
+ } while (i<1000 && stat(tmpname,&sta)==0);
+ if (i==1000)
+ return ERROR;
+ free(name_static);
+ name_static=malloc(strlen(tmpname)+1);
+ if (!name_static)
+ error(1,0,_("out of memory"));
+ strcpy(name_static,tmpname);
+ zi->fname=name_static;
+ }
+ }
+
+ if (!*nameend) { /* File coming from CP/M system */
+ for (p=name_static; *p; ++p) /* change / to _ */
+ if ( *p == '/')
+ *p = '_';
+
+ if ( *--p == '.') /* zap trailing period */
+ *p = 0;
+ }
+
+#ifdef ENABLE_TIMESYNC
+ if (in_timesync)
+ {
+ long t=time(0);
+ long d=t-zi->modtime;
+ if (d<0)
+ d=0;
+ if ((Verbose && d>60) || Verbose > 1)
+ vstringf(_("TIMESYNC: here %ld, remote %ld, diff %ld seconds\n"),
+ (long) t, (long) zi->modtime, d);
+#ifdef HAVE_SETTIMEOFDAY
+ if (timesync_flag > 1 && d > 10)
+ {
+ struct timeval tv;
+ tv.tv_sec=zi->modtime;
+ tv.tv_usec=0;
+ if (settimeofday(&tv,NULL))
+ vstringf(_("TIMESYNC: cannot set time: %s\n"),
+ strerror(errno));
+ }
+#endif
+ return ERROR; /* skips file */
+ }
+#endif /* ENABLE_TIMESYNC */
+
+ if (!zmodem_requested && MakeLCPathname && !IsAnyLower(name_static)
+ && !(zi->mode&UNIXFILE))
+ uncaps(name_static);
+ if (Topipe > 0) {
+ if (Pathname)
+ free(Pathname);
+ Pathname=malloc((PATH_MAX)*2);
+ if (!Pathname)
+ error(1,0,_("out of memory"));
+ sprintf(Pathname, "%s %s", program_name+2, name_static);
+ if (Verbose) {
+ vstringf("%s: %s %s\n",
+ _("Topipe"),
+ Pathname, Thisbinary?"BIN":"ASCII");
+ }
+ if ((fout=popen(Pathname, "w")) == NULL)
+ return ERROR;
+ } else {
+ if (protocol==ZM_XMODEM)
+ /* we don't have the filename yet */
+ return OK; /* dummy */
+ if (Pathname)
+ free(Pathname);
+ Pathname=malloc((PATH_MAX)*2);
+ if (!Pathname)
+ error(1,0,_("out of memory"));
+ strcpy(Pathname, name_static);
+ if (Verbose) {
+ /* overwrite the "waiting to receive" line */
+ vstring("\r \r");
+ vstringf(_("Receiving: %s\n"), name_static);
+ }
+ checkpath(name_static);
+ if (Nflag)
+ {
+ /* cast because we might not have a prototyp for strdup :-/ */
+ free(name_static);
+ name_static=(char *) strdup("/dev/null");
+ if (!name_static)
+ {
+ fprintf(stderr,"%s: %s\n", program_name, _("out of memory"));
+ exit(1);
+ }
+ }
+#ifdef OMEN
+ /* looks like a security hole -- uwe */
+ if (name_static[0] == '!' || name_static[0] == '|') {
+ if ( !(fout = popen(name_static+1, "w"))) {
+ return ERROR;
+ }
+ Topipe = -1; return(OK);
+ }
+#endif
+ if (Thisbinary && zconv==ZCRESUM) {
+ struct stat st;
+ fout = fopen(name_static, "r+");
+ if (fout && 0==fstat(fileno(fout),&st))
+ {
+ int can_resume=TRUE;
+ if (zmanag==ZF1_ZMCRC) {
+ int r=do_crc_check(fout,zi->bytes_total,st.st_size);
+ if (r==ERROR) {
+ fclose(fout);
+ return ZFERR;
+ }
+ if (r==ZCRC_DIFFERS) {
+ can_resume=FALSE;
+ }
+ }
+ if ((unsigned long)st.st_size > zi->bytes_total) {
+ can_resume=FALSE;
+ }
+ /* retransfer whole blocks */
+ zi->bytes_skipped = st.st_size & ~(1023);
+ if (can_resume) {
+ if (fseek(fout, (long) zi->bytes_skipped, SEEK_SET)) {
+ fclose(fout);
+ return ZFERR;
+ }
+ }
+ else
+ zi->bytes_skipped=0; /* resume impossible, file has changed */
+ goto buffer_it;
+ }
+ zi->bytes_skipped=0;
+ if (fout)
+ fclose(fout);
+ }
+ fout = fopen(name_static, openmode);
+#ifdef ENABLE_MKDIR
+ if ( !fout && Restricted < 2) {
+ if (make_dirs(name_static))
+ fout = fopen(name_static, openmode);
+ }
+#endif
+ if ( !fout)
+ {
+#ifdef ENABLE_SYSLOG
+ int e=errno;
+#endif
+ zpfatal(_("cannot open %s"), name_static);
+ DO_SYSLOG((LOG_ERR,"%s: cannot open: %s",
+ protname(),strerror(e)));
+ return ERROR;
+ }
+ }
+buffer_it:
+ if (Topipe == 0) {
+ static char *s=NULL;
+ static size_t last_length=0;
+#if defined(F_GETFD) && defined(F_SETFD) && defined(O_SYNC)
+ if (o_sync) {
+ int oldflags;
+ oldflags = fcntl (fileno(fout), F_GETFD, 0);
+ if (oldflags>=0 && !(oldflags & O_SYNC)) {
+ oldflags|=O_SYNC;
+ fcntl (fileno(fout), F_SETFD, oldflags); /* errors don't matter */
+ }
+ }
+#endif
+
+ if (buffersize==-1 && s) {
+ if (zi->bytes_total>last_length) {
+ free(s);
+ s=NULL;
+ last_length=0;
+ }
+ }
+ if (!s && buffersize) {
+ last_length=32768;
+ if (buffersize==-1) {
+ if (zi->bytes_total>0)
+ last_length=zi->bytes_total;
+ } else
+ last_length=buffersize;
+ /* buffer `4096' bytes pages */
+ last_length=(last_length+4095)&0xfffff000;
+ s=malloc(last_length);
+ if (!s) {
+ zpfatal(_("out of memory"));
+ exit(1);
+ }
+ }
+ if (s) {
+#ifdef SETVBUF_REVERSED
+ setvbuf(fout,_IOFBF,s,last_length);
+#else
+ setvbuf(fout,s,_IOFBF,last_length);
+#endif
+ }
+ }
+ zi->bytes_received=zi->bytes_skipped;
+
+ return OK;
+}
+
+#ifdef ENABLE_MKDIR
+/*
+ * Directory-creating routines from Public Domain TAR by John Gilmore
+ */
+
+/*
+ * After a file/link/symlink/dir creation has failed, see if
+ * it's because some required directory was not present, and if
+ * so, create all required dirs.
+ */
+static int
+make_dirs(char *pathname)
+{
+ register char *p; /* Points into path */
+ int madeone = 0; /* Did we do anything yet? */
+ int save_errno = errno; /* Remember caller's errno */
+
+ if (errno != ENOENT)
+ return 0; /* Not our problem */
+
+ for (p = strchr(pathname, '/'); p != NULL; p = strchr(p+1, '/')) {
+ /* Avoid mkdir of empty string, if leading or double '/' */
+ if (p == pathname || p[-1] == '/')
+ continue;
+ /* Avoid mkdir where last part of path is '.' */
+ if (p[-1] == '.' && (p == pathname+1 || p[-2] == '/'))
+ continue;
+ *p = 0; /* Truncate the path there */
+ if ( !mkdir(pathname, 0777)) { /* Try to create it as a dir */
+ vfile("Made directory %s\n", pathname);
+ madeone++; /* Remember if we made one */
+ *p = '/';
+ continue;
+ }
+ *p = '/';
+ if (errno == EEXIST) /* Directory already exists */
+ continue;
+ /*
+ * Some other error in the mkdir. We return to the caller.
+ */
+ break;
+ }
+ errno = save_errno; /* Restore caller's errno */
+ return madeone; /* Tell them to retry if we made one */
+}
+
+#endif /* ENABLE_MKDIR */
+
+/*
+ * Putsec writes the n characters of buf to receive file fout.
+ * If not in binary mode, carriage returns, and all characters
+ * starting with CPMEOF are discarded.
+ */
+static int
+putsec(struct zm_fileinfo *zi, char *buf, size_t n)
+{
+ register char *p;
+
+ if (n == 0)
+ return OK;
+ if (Thisbinary) {
+ if (fwrite(buf,n,1,fout)!=1)
+ return ERROR;
+ }
+ else {
+ if (zi->eof_seen)
+ return OK;
+ for (p=buf; n>0; ++p,n-- ) {
+ if ( *p == '\r')
+ continue;
+ if (*p == CPMEOF) {
+ zi->eof_seen=TRUE;
+ return OK;
+ }
+ putc(*p ,fout);
+ }
+ }
+ return OK;
+}
+
+/* make string s lower case */
+static void
+uncaps(char *s)
+{
+ for ( ; *s; ++s)
+ if (isupper((unsigned char)(*s)))
+ *s = tolower(*s);
+}
+/*
+ * IsAnyLower returns TRUE if string s has lower case letters.
+ */
+static int
+IsAnyLower(const char *s)
+{
+ for ( ; *s; ++s)
+ if (islower((unsigned char)(*s)))
+ return TRUE;
+ return FALSE;
+}
+
+static void
+report(int sct)
+{
+ if (Verbose>1)
+ {
+ vstringf(_("Blocks received: %d"),sct);
+ vchar('\r');
+ }
+}
+
+/*
+ * If called as [-][dir/../]vrzCOMMAND set Verbose to 1
+ * If called as [-][dir/../]rzCOMMAND set the pipe flag
+ * If called as rb use YMODEM protocol
+ */
+static void
+chkinvok(const char *s)
+{
+ const char *p;
+
+ p = s;
+ while (*p == '-')
+ s = ++p;
+ while (*p)
+ if (*p++ == '/')
+ s = p;
+ if (*s == 'v') {
+ Verbose=1; ++s;
+ }
+ program_name = s;
+ if (*s == 'l')
+ s++; /* lrz -> rz */
+ protocol=ZM_ZMODEM;
+ if (s[0]=='r' && s[1]=='x')
+ protocol=ZM_XMODEM;
+ if (s[0]=='r' && (s[1]=='b' || s[1]=='y'))
+ protocol=ZM_YMODEM;
+ if (s[2] && protocol!=ZM_XMODEM)
+ Topipe = 1;
+}
+
+/*
+ * Totalitarian Communist pathname processing
+ */
+static void
+checkpath(const char *name)
+{
+ if (Restricted) {
+ const char *p;
+ p=strrchr(name,'/');
+ if (p)
+ p++;
+ else
+ p=name;
+ /* don't overwrite any file in very restricted mode.
+ * don't overwrite hidden files in restricted mode */
+ if ((Restricted==2 || *name=='.') && fopen(name, "r") != NULL) {
+ canit(STDOUT_FILENO);
+ vstring("\r\n");
+ vstringf(_("%s: %s exists\n"),
+ program_name, name);
+ bibi(-1);
+ }
+ /* restrict pathnames to current tree or uucppublic */
+ if ( strstr(name, "../")
+#ifdef PUBDIR
+ || (name[0]== '/' && strncmp(name, PUBDIR,
+ strlen(PUBDIR)))
+#endif
+ ) {
+ canit(STDOUT_FILENO);
+ vstring("\r\n");
+ vstringf(_("%s:\tSecurity Violation"),program_name);
+ vstring("\r\n");
+ bibi(-1);
+ }
+ if (Restricted > 1) {
+ if (name[0]=='.' || strstr(name,"/.")) {
+ canit(STDOUT_FILENO);
+ vstring("\r\n");
+ vstringf(_("%s:\tSecurity Violation"),program_name);
+ vstring("\r\n");
+ bibi(-1);
+ }
+ }
+ }
+}
+
+/*
+ * Initialize for Zmodem receive attempt, try to activate Zmodem sender
+ * Handles ZSINIT frame
+ * Return ZFILE if Zmodem filename received, -1 on error,
+ * ZCOMPL if transaction finished, else 0
+ */
+static int
+tryz(void)
+{
+ register int c, n;
+ register int cmdzack1flg;
+ int zrqinits_received=0;
+ size_t bytes_in_block=0;
+
+ if (protocol!=ZM_ZMODEM) /* Check for "rb" program name */
+ return 0;
+
+ for (n=zmodem_requested?15:5;
+ (--n + zrqinits_received) >=0 && zrqinits_received<10; ) {
+ /* Set buffer length (0) and capability flags */
+#ifdef SEGMENTS
+ stohdr(SEGMENTS*MAX_BLOCK);
+#else
+ stohdr(0L);
+#endif
+#ifdef CANBREAK
+ Txhdr[ZF0] = CANFC32|CANFDX|CANOVIO|CANBRK;
+#else
+ Txhdr[ZF0] = CANFC32|CANFDX|CANOVIO;
+#endif
+#ifdef ENABLE_TIMESYNC
+ if (timesync_flag)
+ Txhdr[ZF1] |= ZF1_TIMESYNC;
+#endif
+ if (Zctlesc)
+ Txhdr[ZF0] |= TESCCTL; /* TESCCTL == ESCCTL */
+ zshhdr(tryzhdrtype, Txhdr);
+
+ if (tryzhdrtype == ZSKIP) /* Don't skip too far */
+ tryzhdrtype = ZRINIT; /* CAF 8-21-87 */
+again:
+ switch (zgethdr(Rxhdr, 0, NULL)) {
+ case ZRQINIT:
+ /* getting one ZRQINIT is totally ok. Normally a ZFILE follows
+ * (and might be in our buffer, so don't purge it). But if we
+ * get more ZRQINITs than the sender has started up before us
+ * and sent ZRQINITs while waiting.
+ */
+ zrqinits_received++;
+ continue;
+
+ case ZEOF:
+ continue;
+ case TIMEOUT:
+ continue;
+ case ZFILE:
+ zconv = Rxhdr[ZF0];
+ if (!zconv)
+ /* resume with sz -r is impossible (at least with unix sz)
+ * if this is not set */
+ zconv=ZCBIN;
+ if (Rxhdr[ZF1] & ZF1_ZMSKNOLOC) {
+ Rxhdr[ZF1] &= ~(ZF1_ZMSKNOLOC);
+ skip_if_not_found=TRUE;
+ }
+ zmanag = Rxhdr[ZF1];
+ ztrans = Rxhdr[ZF2];
+ tryzhdrtype = ZRINIT;
+ c = zrdata(secbuf, MAX_BLOCK,&bytes_in_block);
+ io_mode(0,3);
+ if (c == GOTCRCW)
+ return ZFILE;
+ zshhdr(ZNAK, Txhdr);
+ goto again;
+ case ZSINIT:
+ /* this once was:
+ * Zctlesc = TESCCTL & Rxhdr[ZF0];
+ * trouble: if rz get --escape flag:
+ * - it sends TESCCTL to sz,
+ * get a ZSINIT _without_ TESCCTL (yeah - sender didn't know),
+ * overwrites Zctlesc flag ...
+ * - sender receives TESCCTL and uses "|=..."
+ * so: sz escapes, but rz doesn't unescape ... not good.
+ */
+ Zctlesc |= TESCCTL & Rxhdr[ZF0];
+ if (zrdata(Attn, ZATTNLEN,&bytes_in_block) == GOTCRCW) {
+ stohdr(1L);
+ zshhdr(ZACK, Txhdr);
+ goto again;
+ }
+ zshhdr(ZNAK, Txhdr);
+ goto again;
+ case ZFREECNT:
+ stohdr(getfree());
+ zshhdr(ZACK, Txhdr);
+ goto again;
+ case ZCOMMAND:
+ cmdzack1flg = Rxhdr[ZF0];
+ if (zrdata(secbuf, MAX_BLOCK,&bytes_in_block) == GOTCRCW) {
+ if (Verbose)
+ {
+ vstringf("%s: %s\n", program_name,
+ _("remote command execution requested"));
+ vstringf("%s: %s\n", program_name, secbuf);
+ }
+ if (!allow_remote_commands)
+ {
+ if (Verbose)
+ vstringf("%s: %s\n", program_name,
+ _("not executed"));
+ zshhdr(ZCOMPL, Txhdr);
+ DO_SYSLOG((LOG_INFO,"rexec denied: %s",secbuf));
+ return ZCOMPL;
+ }
+ DO_SYSLOG((LOG_INFO,"rexec allowed: %s",secbuf));
+ if (cmdzack1flg & ZCACK1)
+ stohdr(0L);
+ else
+ stohdr((size_t)sys2(secbuf));
+ purgeline(0); /* dump impatient questions */
+ do {
+ zshhdr(ZCOMPL, Txhdr);
+ }
+ while (++errors<20 && zgethdr(Rxhdr,1, NULL) != ZFIN);
+ ackbibi();
+ if (cmdzack1flg & ZCACK1)
+ exec2(secbuf);
+ return ZCOMPL;
+ }
+ zshhdr(ZNAK, Txhdr);
+ goto again;
+ case ZCOMPL:
+ goto again;
+ default:
+ continue;
+ case ZFIN:
+ ackbibi();
+ return ZCOMPL;
+ case ZRINIT:
+ if (Verbose)
+ vstringf(_("got ZRINIT"));
+ return ERROR;
+ case ZCAN:
+ if (Verbose)
+ vstringf(_("got ZCAN"));
+ return ERROR;
+ }
+ }
+ return 0;
+}
+
+
+/*
+ * Receive 1 or more files with ZMODEM protocol
+ */
+static int
+rzfiles(struct zm_fileinfo *zi)
+{
+ register int c;
+
+ for (;;) {
+ timing(1,NULL);
+ c = rzfile(zi);
+ switch (c) {
+ case ZEOF:
+ if (Verbose > 1
+#ifdef ENABLE_SYSLOG
+ || enable_syslog
+#endif
+ ) {
+ double d;
+ long bps;
+ d=timing(0,NULL);
+ if (d==0)
+ d=0.5; /* can happen if timing uses time() */
+ bps=(zi->bytes_received-zi->bytes_skipped)/d;
+ if (Verbose > 1) {
+ vstringf(
+ _("\rBytes received: %7ld/%7ld BPS:%-6ld \r\n"),
+ (long) zi->bytes_received, (long) zi->bytes_total, bps);
+ }
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: %ld Bytes, %ld BPS",shortname,
+ protname(), (long) zi->bytes_total,bps));
+ }
+ /* FALL THROUGH */
+ case ZSKIP:
+ if (c==ZSKIP)
+ {
+ if (Verbose)
+ vstringf(_("Skipped"));
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: skipped",shortname,protname()));
+ }
+ switch (tryz()) {
+ case ZCOMPL:
+ return OK;
+ default:
+ return ERROR;
+ case ZFILE:
+ break;
+ }
+ continue;
+ default:
+ return c;
+ case ERROR:
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: error",shortname,protname()));
+ return ERROR;
+ }
+ }
+}
+
+/* "OOSB" means Out Of Sync Block. I once thought that if sz sents
+ * blocks a,b,c,d, of which a is ok, b fails, we might want to save
+ * c and d. But, alas, i never saw c and d.
+ */
+#define SAVE_OOSB
+#ifdef SAVE_OOSB
+typedef struct oosb_t {
+ size_t pos;
+ size_t len;
+ char *data;
+ struct oosb_t *next;
+} oosb_t;
+struct oosb_t *anker=NULL;
+#endif
+
+/*
+ * Receive a file with ZMODEM protocol
+ * Assumes file name frame is in secbuf
+ */
+static int
+rzfile(struct zm_fileinfo *zi)
+{
+ register int c, n;
+ long last_rxbytes=0;
+ unsigned long last_bps=0;
+ long not_printed=0;
+ time_t low_bps=0;
+ size_t bytes_in_block=0;
+
+ zi->eof_seen=FALSE;
+
+ n = 20;
+
+ if (procheader(secbuf,zi) == ERROR) {
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: procheader error",
+ shortname,protname()));
+ return (tryzhdrtype = ZSKIP);
+ }
+
+ for (;;) {
+#ifdef SEGMENTS
+ chinseg = 0;
+#endif
+ stohdr(zi->bytes_received);
+ zshhdr(ZRPOS, Txhdr);
+ goto skip_oosb;
+nxthdr:
+#ifdef SAVE_OOSB
+ if (anker) {
+ oosb_t *akt,*last,*next;
+ for (akt=anker,last=NULL;akt;last= akt ? akt : last ,akt=next) {
+ if (akt->pos==zi->bytes_received) {
+ putsec(zi, akt->data, akt->len);
+ zi->bytes_received += akt->len;
+ vfile("using saved out-of-sync-paket %lx, len %ld",
+ akt->pos,akt->len);
+ goto nxthdr;
+ }
+ next=akt->next;
+ if (akt->pos<zi->bytes_received) {
+ vfile("removing unneeded saved out-of-sync-paket %lx, len %ld",
+ akt->pos,akt->len);
+ if (last)
+ last->next=akt->next;
+ else
+ anker=akt->next;
+ free(akt->data);
+ free(akt);
+ akt=NULL;
+ }
+ }
+ }
+#endif
+ skip_oosb:
+ c = zgethdr(Rxhdr, 0, NULL);
+ switch (c) {
+ default:
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: error: zgethdr returned %d",shortname,
+ protname(),c));
+ vfile("rzfile: zgethdr returned %d", c);
+ return ERROR;
+ case ZNAK:
+ case TIMEOUT:
+#ifdef SEGMENTS
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+#endif
+ if ( --n < 0) {
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: error: zgethdr returned %s",shortname,
+ protname(),c == ZNAK ? "ZNAK" : "TIMEOUT"));
+ vfile("rzfile: zgethdr returned %d", c);
+ return ERROR;
+ }
+ case ZFILE:
+ zrdata(secbuf, MAX_BLOCK,&bytes_in_block);
+ continue;
+ case ZEOF:
+#ifdef SEGMENTS
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+#endif
+ if (rclhdr(Rxhdr) != (long) zi->bytes_received) {
+ /*
+ * Ignore eof if it's at wrong place - force
+ * a timeout because the eof might have gone
+ * out before we sent our zrpos.
+ */
+ errors = 0; goto nxthdr;
+ }
+ if (closeit(zi)) {
+ tryzhdrtype = ZFERR;
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: error: closeit return <>0",
+ shortname, protname()));
+ vfile("rzfile: closeit returned <> 0");
+ return ERROR;
+ }
+ vfile("rzfile: normal EOF");
+ return c;
+ case ERROR: /* Too much garbage in header search error */
+#ifdef SEGMENTS
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+#endif
+ if ( --n < 0) {
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: error: zgethdr returned %d",
+ shortname, protname(),c));
+ vfile("rzfile: zgethdr returned %d", c);
+ return ERROR;
+ }
+ zmputs(Attn);
+ continue;
+ case ZSKIP:
+#ifdef SEGMENTS
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+#endif
+ closeit(zi);
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: error: sender skipped",
+ shortname, protname()));
+ vfile("rzfile: Sender SKIPPED file");
+ return c;
+ case ZDATA:
+ if (rclhdr(Rxhdr) != (long) zi->bytes_received) {
+#if defined(SAVE_OOSB)
+ oosb_t *neu;
+ size_t pos=rclhdr(Rxhdr);
+#endif
+ if ( --n < 0) {
+ vfile("rzfile: out of sync");
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: error: out of sync",
+ shortname, protname()));
+ return ERROR;
+ }
+#if defined(SAVE_OOSB)
+ switch (c = zrdata(secbuf, MAX_BLOCK,&bytes_in_block))
+ {
+ case GOTCRCW:
+ case GOTCRCG:
+ case GOTCRCE:
+ case GOTCRCQ:
+ if (pos>zi->bytes_received) {
+ neu=malloc(sizeof(oosb_t));
+ if (neu)
+ neu->data=malloc(bytes_in_block);
+ if (neu && neu->data) {
+#ifdef ENABLE_SYSLOG
+/* call syslog to tell me if this happens */
+ lsyslog(LOG_ERR,
+ "saving out-of-sync-block %lx, len %lu",
+ pos, (unsigned long) bytes_in_block);
+#endif
+ vfile("saving out-of-sync-block %lx, len %lu",pos,
+ (unsigned long) bytes_in_block);
+ memcpy(neu->data,secbuf,bytes_in_block);
+ neu->pos=pos;
+ neu->len=bytes_in_block;
+ neu->next=anker;
+ anker=neu;
+ }
+ else if (neu)
+ free(neu);
+ }
+ }
+#endif
+#ifdef SEGMENTS
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+#endif
+ zmputs(Attn); continue;
+ }
+moredata:
+ if ((Verbose>1 || min_bps || stop_time)
+ && (not_printed > (min_bps ? 3 : 7)
+ || zi->bytes_received > last_bps / 2 + last_rxbytes)) {
+ int minleft = 0;
+ int secleft = 0;
+ time_t now;
+ double d;
+ d=timing(0,&now);
+ if (d==0)
+ d=0.5; /* timing() might use time() */
+ last_bps=zi->bytes_received/d;
+ if (last_bps > 0) {
+ minleft = (R_BYTESLEFT(zi))/last_bps/60;
+ secleft = ((R_BYTESLEFT(zi))/last_bps)%60;
+ }
+ if (min_bps) {
+ if (low_bps) {
+ if (last_bps<min_bps) {
+ if (now-low_bps>=min_bps_time) {
+ /* too bad */
+ vfile(_("rzfile: bps rate %ld below min %ld"),
+ last_bps, min_bps);
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: bps rate low: %ld < %ld",
+ shortname, protname(), last_bps, min_bps));
+ return ERROR;
+ }
+ }
+ else
+ low_bps=0;
+ } else if (last_bps<min_bps) {
+ low_bps=now;
+ }
+ }
+ if (stop_time && now>=stop_time) {
+ /* too bad */
+ vfile(_("rzfile: reached stop time"));
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: reached stop time",
+ shortname, protname()));
+ return ERROR;
+ }
+
+ if (Verbose > 1) {
+ vstringf(_("\rBytes received: %7ld/%7ld BPS:%-6ld ETA %02d:%02d "),
+ (long) zi->bytes_received, (long) zi->bytes_total,
+ last_bps, minleft, secleft);
+ last_rxbytes=zi->bytes_received;
+ not_printed=0;
+ }
+ } else if (Verbose)
+ not_printed++;
+#ifdef SEGMENTS
+ if (chinseg >= (MAX_BLOCK * SEGMENTS)) {
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+ }
+ switch (c = zrdata(secbuf+chinseg, MAX_BLOCK,&bytes_in_block))
+#else
+ switch (c = zrdata(secbuf, MAX_BLOCK,&bytes_in_block))
+#endif
+ {
+ case ZCAN:
+#ifdef SEGMENTS
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+#endif
+ vfile("rzfile: zrdata returned %d", c);
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: zrdata returned ZCAN",
+ shortname, protname()));
+ return ERROR;
+ case ERROR: /* CRC error */
+#ifdef SEGMENTS
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+#endif
+ if ( --n < 0) {
+ vfile("rzfile: zgethdr returned %d", c);
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: zrdata returned ERROR",
+ shortname, protname()));
+ return ERROR;
+ }
+ zmputs(Attn);
+ continue;
+ case TIMEOUT:
+#ifdef SEGMENTS
+ putsec(secbuf, chinseg);
+ chinseg = 0;
+#endif
+ if ( --n < 0) {
+ DO_SYSLOG_FNAME((LOG_INFO, "%s/%s: zrdata returned TIMEOUT",
+ shortname, protname()));
+ vfile("rzfile: zgethdr returned %d", c);
+ return ERROR;
+ }
+ continue;
+ case GOTCRCW:
+ n = 20;
+#ifdef SEGMENTS
+ chinseg += bytes_in_block;
+ putsec(zi, secbuf, chinseg);
+ chinseg = 0;
+#else
+ putsec(zi, secbuf, bytes_in_block);
+#endif
+ zi->bytes_received += bytes_in_block;
+ stohdr(zi->bytes_received);
+ zshhdr(ZACK | 0x80, Txhdr);
+ goto nxthdr;
+ case GOTCRCQ:
+ n = 20;
+#ifdef SEGMENTS
+ chinseg += bytes_in_block;
+#else
+ putsec(zi, secbuf, bytes_in_block);
+#endif
+ zi->bytes_received += bytes_in_block;
+ stohdr(zi->bytes_received);
+ zshhdr(ZACK, Txhdr);
+ goto moredata;
+ case GOTCRCG:
+ n = 20;
+#ifdef SEGMENTS
+ chinseg += bytes_in_block;
+#else
+ putsec(zi, secbuf, bytes_in_block);
+#endif
+ zi->bytes_received += bytes_in_block;
+ goto moredata;
+ case GOTCRCE:
+ n = 20;
+#ifdef SEGMENTS
+ chinseg += bytes_in_block;
+#else
+ putsec(zi, secbuf, bytes_in_block);
+#endif
+ zi->bytes_received += bytes_in_block;
+ goto nxthdr;
+ }
+ }
+ }
+}
+
+/*
+ * Send a string to the modem, processing for \336 (sleep 1 sec)
+ * and \335 (break signal)
+ */
+static void
+zmputs(const char *s)
+{
+ const char *p;
+
+ while (s && *s)
+ {
+ p=strpbrk(s,"\335\336");
+ if (!p)
+ {
+ write(1,s,strlen(s));
+ return;
+ }
+ if (p!=s)
+ {
+ write(1,s,(size_t) (p-s));
+ s=p;
+ }
+ if (*p=='\336')
+ sleep(1);
+ else
+ sendbrk(0);
+ p++;
+ }
+}
+
+/*
+ * Close the receive dataset, return OK or ERROR
+ */
+static int
+closeit(struct zm_fileinfo *zi)
+{
+ int ret;
+ if (Topipe) {
+ if (pclose(fout)) {
+ return ERROR;
+ }
+ return OK;
+ }
+ ret=fclose(fout);
+ if (ret) {
+ zpfatal(_("file close error"));
+ /* this may be any sort of error, including random data corruption */
+
+ unlink(Pathname);
+ return ERROR;
+ }
+ if (zi->modtime) {
+#ifdef HAVE_STRUCT_UTIMBUF
+ struct utimbuf timep;
+ timep.actime = time(NULL);
+ timep.modtime = zi->modtime;
+ utime(Pathname, &timep);
+#else
+ time_t timep[2];
+ timep[0] = time(NULL);
+ timep[1] = zi->modtime;
+ utime(Pathname, timep);
+#endif
+ }
+#ifdef S_ISREG
+ if (S_ISREG(zi->mode)) {
+#else
+ if ((zi->mode&S_IFMT) == S_IFREG) {
+#endif
+ /* we must not make this program executable if running
+ * under rsh, because the user might have uploaded an
+ * unrestricted shell.
+ */
+ if (under_rsh)
+ chmod(Pathname, (00666 & zi->mode));
+ else
+ chmod(Pathname, (07777 & zi->mode));
+ }
+ return OK;
+}
+
+/*
+ * Ack a ZFIN packet, let byegones be byegones
+ */
+static void
+ackbibi(void)
+{
+ int n;
+
+ vfile("ackbibi:");
+ Readnum = 1;
+ stohdr(0L);
+ for (n=3; --n>=0; ) {
+ purgeline(0);
+ zshhdr(ZFIN, Txhdr);
+ switch (READLINE_PF(100)) {
+ case 'O':
+ READLINE_PF(1); /* Discard 2nd 'O' */
+ vfile("ackbibi complete");
+ return;
+ case RCDO:
+ return;
+ case TIMEOUT:
+ default:
+ break;
+ }
+ }
+}
+
+/*
+ * Strip leading ! if present, do shell escape.
+ */
+static int
+sys2(const char *s)
+{
+ if (*s == '!')
+ ++s;
+ return system(s);
+}
+
+/*
+ * Strip leading ! if present, do exec.
+ */
+static void
+exec2(const char *s)
+{
+ if (*s == '!')
+ ++s;
+ io_mode(0,0);
+ execl("/bin/sh", "sh", "-c", s);
+ zpfatal("execl");
+ exit(1);
+}
+
+/*
+ * Routine to calculate the free bytes on the current file system
+ * ~0 means many free bytes (unknown)
+ */
+static size_t
+getfree(void)
+{
+ return((size_t) (~0L)); /* many free bytes ... */
+}
+
+/* End of lrz.c */
diff --git a/src/lrzszbug.in b/src/lrzszbug.in
new file mode 100755
index 0000000..7559d5a
--- /dev/null
+++ b/src/lrzszbug.in
@@ -0,0 +1,245 @@
+#! /bin/sh
+#
+# lrzszbug - create a bug report and mail it to the bug address.
+#
+# configuration section:
+# these variables are filled in by configure
+#
+VERSION="@VERSION@"
+BUGGLIBC="bugs@bulkmail.ohse.de"
+
+PATH=$PATH:/bin:/usr/bin:/usr/local/bin
+export PATH
+
+TEMP=/tmp/lrzszbug.$$
+
+BUGADDR=${1-$BUGGLIBC}
+ENVIRONMENT=`uname -a`
+
+: ${EDITOR=emacs}
+
+: ${USER=${LOGNAME-`whoami`}}
+
+trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
+trap 'rm -f $TEMP $TEMP.x' 0
+
+
+# How to read the passwd database.
+PASSWD="cat /etc/passwd"
+
+if [ -f /usr/lib/sendmail ] ; then
+ MAIL_AGENT="/usr/lib/sendmail -oi -t"
+elif [ -f /usr/sbin/sendmail ] ; then
+ MAIL_AGENT="/usr/sbin/sendmail -oi -t"
+else
+ MAIL_AGENT=rmail
+fi
+
+# Figure out how to echo a string without a trailing newline
+N=`echo 'hi there\c'`
+case "$N" in
+*c) ECHON1='echo -n' ECHON2= ;;
+*) ECHON1=echo ECHON2='\c' ;;
+esac
+
+# Find out the name of the originator of this PR.
+if [ -n "$NAME" ]; then
+ ORIGINATOR="$NAME"
+elif [ -f $HOME/.fullname ]; then
+ ORIGINATOR="`sed -e '1q' $HOME/.fullname`"
+else
+ # Must use temp file due to incompatibilities in quoting behavior
+ # and to protect shell metacharacters in the expansion of $LOGNAME
+ $PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP
+ ORIGINATOR="`cat $TEMP`"
+ rm -f $TEMP
+fi
+
+if [ -n "$ORGANIZATION" ]; then
+ if [ -f "$ORGANIZATION" ]; then
+ ORGANIZATION="`cat $ORGANIZATION`"
+ fi
+else
+ if [ -f $HOME/.organization ]; then
+ ORGANIZATION="`cat $HOME/.organization`"
+ elif [ -f $HOME/.signature ]; then
+ ORGANIZATION=`sed -e "s/^/ /" $HOME/.signature; echo ">"`
+ fi
+fi
+
+# If they don't have a preferred editor set, then use
+if [ -z "$VISUAL" ]; then
+ if [ -z "$EDITOR" ]; then
+ EDIT=vi
+ else
+ EDIT="$EDITOR"
+ fi
+else
+ EDIT="$VISUAL"
+fi
+
+# Find out some information.
+SYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \
+ ( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
+ARCH=`[ -f /bin/arch ] && /bin/arch`
+MACHINE=`[ -f /bin/machine ] && /bin/machine`
+
+ORGANIZATION_C='<organization of PR author (multiple lines)>'
+SYNOPSIS_C='<synopsis of the problem (one line)>'
+SEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
+PRIORITY_C='<[ low | medium | high ] (one line)>'
+CLASS_C='<[ sw-bug | doc-bug | change-request | support ] (one line)>'
+RELEASE_C='<release number or tag (one line)>'
+ENVIRONMENT_C='<machine, os, target, libraries (multiple lines)>'
+DESCRIPTION_C='<precise description of the problem (multiple lines)>'
+HOW_TO_REPEAT_C='<code/input/activities to reproduce the problem (multiple lines)>'
+FIX_C='<how to correct or work around the problem, if known (multiple lines)>'
+
+
+cat > $TEMP <<EOF
+SEND-PR: -*- send-pr -*-
+SEND-PR: Lines starting with \`SEND-PR' will be removed automatically, as
+SEND-PR: will all comments (text enclosed in \`<' and \`>').
+SEND-PR:
+From: ${USER}
+To: ${BUGADDR}
+Subject: lrzsz: [50 character or so descriptive subject here (for reference)]
+
+>Submitter-Id: net
+>Originator: ${ORIGINATOR}
+>Organization:
+${ORGANIZATION- $ORGANIZATION_C}
+>Confidential: no
+>Synopsis: $SYNOPSIS_C
+>Severity: $SEVERITY_C
+>Priority: $PRIORITY_C
+>Category: lrzsz
+>Class: $CLASS_C
+>Release: lrzsz-${VERSION}
+>Environment:
+ $ENVIRONMENT_C
+`[ -n "$SYSTEM" ] && echo System: $SYSTEM`
+`[ -n "$ARCH" ] && echo Architecture: $ARCH`
+`[ -n "$MACHINE" ] && echo Machine: $MACHINE`
+`[ -f "lrz" ] && echo " include, if possible, the output of 'ldd lrz'"`
+`[ -f "src/lrz" ] && echo " include, if possible, the output of 'ldd src/lrz'"`
+`[ -f "lrzsz-@VERSION@/src/lrz" ] && echo " include, if possible, the output of 'ldd lrzsz-@VERSION@/src/lrz'"`
+
+>Description:
+ $DESCRIPTION_C
+>How-To-Repeat:
+ $HOW_TO_REPEAT_C
+>Fix:
+ $FIX_C
+EOF
+
+chmod u+w $TEMP
+cp $TEMP $TEMP.x
+
+eval $EDIT $TEMP
+
+if cmp -s $TEMP $TEMP.x; then
+ echo "File not changed, no bug report submitted."
+ exit 1
+fi
+
+#
+# Check the enumeration fields
+
+# This is a "sed-subroutine" with one keyword parameter
+# (with workaround for Sun sed bug)
+#
+SED_CMD='
+/$PATTERN/{
+s|||
+s|<.*>||
+s|^[ ]*||
+s|[ ]*$||
+p
+q
+}'
+
+
+while :; do
+ CNT=0
+
+ #
+ # 1) Severity
+ #
+ PATTERN=">Severity:"
+ SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
+ case "$SEVERITY" in
+ ""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;;
+ *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
+ esac
+ #
+ # 2) Priority
+ #
+ PATTERN=">Priority:"
+ PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
+ case "$PRIORITY" in
+ ""|low|medium|high) CNT=`expr $CNT + 1` ;;
+ *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
+ esac
+ #
+ # 3) Class
+ #
+ PATTERN=">Class:"
+ CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
+ case "$CLASS" in
+ ""|sw-bug|doc-bug|change-request|support) CNT=`expr $CNT + 1` ;;
+ *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
+ esac
+
+ [ $CNT -lt 3 ] &&
+ echo "Errors were found with the problem report."
+
+ while :; do
+ $ECHON1 "a)bort, e)dit or s)end? $ECHON2"
+ read input
+ case "$input" in
+ a*)
+ echo "$COMMAND: problem report saved in $HOME/dead.lrzszbug."
+ cat $TEMP >> $HOME/dead.lrzszbug
+ xs=1; exit
+ ;;
+ e*)
+ eval $EDIT $TEMP
+ continue 2
+ ;;
+ s*)
+ break 2
+ ;;
+ esac
+ done
+done
+#
+# Remove comments and send the problem report
+# (we have to use patterns, where the comment contains regex chars)
+#
+# /^>Originator:/s;$ORIGINATOR;;
+sed -e "
+/^SEND-PR:/d
+/^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
+/^>Confidential:/s;<.*>;;
+/^>Synopsis:/s;$SYNOPSIS_C;;
+/^>Severity:/s;<.*>;;
+/^>Priority:/s;<.*>;;
+/^>Class:/s;<.*>;;
+/^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
+/^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
+/^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
+/^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
+/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
+" $TEMP > $TEMP.x
+
+if $MAIL_AGENT < $TEMP.x; then
+ echo "$COMMAND: problem report sent"
+ xs=0; exit
+else
+ echo "$COMMAND: mysterious mail failure, report not sent."
+ echo "$COMMAND: problem report saved in $HOME/dead.lrzszbug."
+ cat $TEMP >> $HOME/dead.lrzszbug
+fi
+
+exit 0
diff --git a/src/lsyslog.c b/src/lsyslog.c
new file mode 100644
index 0000000..6baf4a2
--- /dev/null
+++ b/src/lsyslog.c
@@ -0,0 +1,81 @@
+/*
+ lsyslog.c - wrapper for the syslog function
+ Copyright (C) 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+*/
+#include "config.h"
+#ifdef ENABLE_SYSLOG
+#include "zglobal.h"
+#include <pwd.h>
+#include <stdlib.h>
+#include <string.h>
+#endif
+
+#if __STDC__
+# include <stdarg.h>
+# define VA_START(args, lastarg) va_start(args, lastarg)
+# define WAYTOGO
+#else
+# include <varargs.h>
+# define VA_START(args, lastarg) va_start(args)
+#endif
+
+void
+#ifdef WAYTOGO
+lsyslog(int prio, const char *format, ...)
+#else
+lsyslog(prio,format,va_alist)
+ int prio;
+ const char *format;
+ va_dcl
+#endif
+{
+#ifdef ENABLE_SYSLOG
+ static char *username=NULL;
+ static char uid_string[20]=""; /* i'd really hate this function to fail! */
+ char *s=NULL;
+ static int init_done=0;
+ va_list ap;
+ if (!enable_syslog)
+ return;
+ if (!init_done) {
+ uid_t uid;
+ struct passwd *pwd;
+ init_done=1;
+ uid=getuid();
+ pwd=getpwuid(uid);
+ if (pwd && pwd->pw_name && *pwd->pw_name) {
+ username=strdup(pwd->pw_name);
+ }
+ if (!username) {
+ username=uid_string;
+ sprintf(uid_string,"#%lu",(unsigned long) uid);
+ }
+ }
+
+ VA_START(ap, format);
+ vasprintf(&s,format, ap);
+ va_end(ap);
+ syslog(prio,"[%s] %s",username,s);
+ free(s);
+#else
+ (void) prio; /* get rid of warning */
+ (void) format; /* get rid of warning */
+#endif
+}
+
diff --git a/src/lsz.c b/src/lsz.c
new file mode 100644
index 0000000..b9d2545
--- /dev/null
+++ b/src/lsz.c
@@ -0,0 +1,2493 @@
+/*
+ lsz - send files with x/y/zmodem
+ Copyright (C) until 1988 Chuck Forsberg (Omen Technology INC)
+ Copyright (C) 1994 Matt Porter, Michael D. Black
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ originally written by Chuck Forsberg
+*/
+#include "zglobal.h"
+
+/* char *getenv(); */
+
+#define SS_NORMAL 0
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <ctype.h>
+#include <errno.h>
+#include <getopt.h>
+
+#ifndef R_OK
+# define R_OK 4
+#endif
+
+#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MMAP)
+# include <sys/mman.h>
+size_t mm_size;
+void *mm_addr=NULL;
+#else
+# undef HAVE_MMAP
+#endif
+#include "timing.h"
+#include "long-options.h"
+#include "xstrtoul.h"
+#include "error.h"
+
+#ifndef STRICT_PROTOTYPES
+extern time_t time();
+extern char *strerror();
+extern char *strstr();
+#endif
+
+#ifndef HAVE_ERRNO_DECLARATION
+extern int errno;
+#endif
+
+unsigned Baudrate=2400; /* Default, should be set by first mode() call */
+unsigned Txwindow; /* Control the size of the transmitted window */
+unsigned Txwspac; /* Spacing between zcrcq requests */
+unsigned Txwcnt; /* Counter used to space ack requests */
+size_t Lrxpos; /* Receiver's last reported offset */
+int errors;
+enum zm_type_enum protocol;
+int under_rsh=FALSE;
+extern int turbo_escape;
+static int no_unixmode;
+
+int Canseek=1; /* 1: can; 0: only rewind, -1: neither */
+
+static int zsendfile __P ((struct zm_fileinfo *zi, const char *buf, size_t blen));
+static int getnak __P ((void));
+static int wctxpn __P ((struct zm_fileinfo *));
+static int wcs __P ((const char *oname, const char *remotename));
+static size_t zfilbuf __P ((struct zm_fileinfo *zi));
+static size_t filbuf __P ((char *buf, size_t count));
+static int getzrxinit __P ((void));
+static int calc_blklen __P ((long total_sent));
+static int sendzsinit __P ((void));
+static int wctx __P ((struct zm_fileinfo *));
+static int zsendfdata __P ((struct zm_fileinfo *));
+static int getinsync __P ((struct zm_fileinfo *, int flag));
+static void countem __P ((int argc, char **argv));
+static void chkinvok __P ((const char *s));
+static void usage __P ((int exitcode, const char *what));
+static int zsendcmd __P ((const char *buf, size_t blen));
+static void saybibi __P ((void));
+static int wcsend __P ((int argc, char *argp[]));
+static int wcputsec __P ((char *buf, int sectnum, size_t cseclen));
+static void usage1 __P ((int exitcode));
+
+#ifdef ENABLE_SYSLOG
+#define DO_SYSLOG(message) do { \
+ if (enable_syslog) { \
+ const char *shortname; \
+ if (!zi->fname) \
+ shortname="no.name"; \
+ else { \
+ shortname=strrchr(zi->fname,'/'); \
+ if (!shortname) \
+ shortname=zi->fname; \
+ else \
+ shortname++; \
+ } \
+ lsyslog message ; \
+ } \
+ } while(0)
+#else
+#define DO_SYSLOG(message) do { } while(0)
+#endif
+
+#define ZSDATA(x,y,z) \
+ do { if (Crc32t) {zsda32(x,y,z); } else {zsdata(x,y,z);}} while(0)
+#ifdef HAVE_MMAP
+#define DATAADR (mm_addr ? ((char *)mm_addr)+zi->bytes_sent : txbuf)
+#else
+#define DATAADR (txbuf)
+#endif
+
+int Filesleft;
+long Totalleft;
+size_t buffersize=16384;
+#ifdef HAVE_MMAP
+int use_mmap=1;
+#endif
+
+/*
+ * Attention string to be executed by receiver to interrupt streaming data
+ * when an error is detected. A pause (0336) may be needed before the
+ * ^C (03) or after it.
+ */
+#ifdef READCHECK
+char Myattn[] = { 0 };
+#else
+char Myattn[] = { 03, 0336, 0 };
+#endif
+
+FILE *input_f;
+
+#define MAX_BLOCK 8192
+char *txbuf;
+
+long vpos = 0; /* Number of bytes read from file */
+
+char Lastrx;
+char Crcflg;
+int Verbose=0;
+int Restricted=0; /* restricted; no /.. or ../ in filenames */
+int Quiet=0; /* overrides logic that would otherwise set verbose */
+int Ascii=0; /* Add CR's for brain damaged programs */
+int Fullname=0; /* transmit full pathname */
+int Unlinkafter=0; /* Unlink file after it is sent */
+int Dottoslash=0; /* Change foo.bar.baz to foo/bar/baz */
+int firstsec;
+int errcnt=0; /* number of files unreadable */
+size_t blklen=128; /* length of transmitted records */
+int Optiong; /* Let it rip no wait for sector ACK's */
+int Totsecs; /* total number of sectors this file */
+int Filcnt=0; /* count of number of files opened */
+int Lfseen=0;
+unsigned Rxbuflen = 16384; /* Receiver's max buffer length */
+unsigned Tframlen = 0; /* Override for tx frame length */
+unsigned blkopt=0; /* Override value for zmodem blklen */
+int Rxflags = 0;
+int Rxflags2 = 0;
+size_t bytcnt;
+int Wantfcs32 = TRUE; /* want to send 32 bit FCS */
+char Lzconv; /* Local ZMODEM file conversion request */
+char Lzmanag; /* Local ZMODEM file management request */
+int Lskipnocor;
+char Lztrans;
+char zconv; /* ZMODEM file conversion request */
+char zmanag; /* ZMODEM file management request */
+char ztrans; /* ZMODEM file transport request */
+int command_mode; /* Send a command, then exit. */
+int Cmdtries = 11;
+int Cmdack1; /* Rx ACKs command, then do it */
+int Exitcode;
+int enable_timesync=0;
+size_t Lastsync; /* Last offset to which we got a ZRPOS */
+int Beenhereb4; /* How many times we've been ZRPOS'd same place */
+
+int no_timeout=FALSE;
+size_t max_blklen=1024;
+size_t start_blklen=0;
+int zmodem_requested;
+time_t stop_time=0;
+char *tcp_server_address=0;
+int tcp_socket=-1;
+int tcp_flag=0;
+
+int error_count;
+#define OVERHEAD 18
+#define OVER_ERR 20
+
+#define MK_STRING(x) #x
+
+#ifdef ENABLE_SYSLOG
+# if defined(ENABLE_SYSLOG_FORCE) || defined(ENABLE_SYSLOG_DEFAULT)
+int enable_syslog=TRUE;
+# else
+int enable_syslog=FALSE;
+# endif
+#endif
+
+jmp_buf intrjmp; /* For the interrupt on RX CAN */
+
+static long min_bps;
+static long min_bps_time;
+
+static int io_mode_fd=0;
+static int zrqinits_sent=0;
+static int play_with_sigint=0;
+
+/* called by signal interrupt or terminate to clean things up */
+RETSIGTYPE
+bibi (int n)
+{
+ canit(STDOUT_FILENO);
+ fflush (stdout);
+ io_mode (io_mode_fd,0);
+ if (n == 99)
+ error (0, 0, _ ("io_mode(,2) in rbsb.c not implemented\n"));
+ else
+ error (0, 0, _ ("caught signal %d; exiting"), n);
+ if (n == SIGQUIT)
+ abort ();
+ exit (128 + n);
+}
+
+/* Called when ZMODEM gets an interrupt (^C) */
+static RETSIGTYPE
+onintr(int n)
+{
+ signal(SIGINT, SIG_IGN);
+ n++; /* use it */
+ longjmp(intrjmp, -1);
+}
+
+int Zctlesc; /* Encode control characters */
+const char *program_name = "sz";
+int Zrwindow = 1400; /* RX window size (controls garbage count) */
+
+static struct option const long_options[] =
+{
+ {"append", no_argument, NULL, '+'},
+ {"twostop", no_argument, NULL, '2'},
+ {"try-8k", no_argument, NULL, '8'},
+ {"start-8k", no_argument, NULL, '9'},
+ {"try-4k", no_argument, NULL, '4'},
+ {"start-4k", no_argument, NULL, '5'},
+ {"ascii", no_argument, NULL, 'a'},
+ {"binary", no_argument, NULL, 'b'},
+ {"bufsize", required_argument, NULL, 'B'},
+ {"cmdtries", required_argument, NULL, 'C'},
+ {"command", required_argument, NULL, 'c'},
+ {"immediate-command", required_argument, NULL, 'i'},
+ {"dot-to-slash", no_argument, NULL, 'd'},
+ {"full-path", no_argument, NULL, 'f'},
+ {"escape", no_argument, NULL, 'e'},
+ {"rename", no_argument, NULL, 'E'},
+ {"help", no_argument, NULL, 'h'},
+ {"crc-check", no_argument, NULL, 'H'},
+ {"1024", no_argument, NULL, 'k'},
+ {"1k", no_argument, NULL, 'k'},
+ {"packetlen", required_argument, NULL, 'L'},
+ {"framelen", required_argument, NULL, 'l'},
+ {"min-bps", required_argument, NULL, 'm'},
+ {"min-bps-time", required_argument, NULL, 'M'},
+ {"newer", no_argument, NULL, 'n'},
+ {"newer-or-longer", no_argument, NULL, 'N'},
+ {"16-bit-crc", no_argument, NULL, 'o'},
+ {"disable-timeouts", no_argument, NULL, 'O'},
+ {"disable-timeout", no_argument, NULL, 'O'}, /* i can't get it right */
+ {"protect", no_argument, NULL, 'p'},
+ {"resume", no_argument, NULL, 'r'},
+ {"restricted", no_argument, NULL, 'R'},
+ {"quiet", no_argument, NULL, 'q'},
+ {"stop-at", required_argument, NULL, 's'},
+ {"syslog", optional_argument, NULL , 2},
+ {"timesync", no_argument, NULL, 'S'},
+ {"timeout", required_argument, NULL, 't'},
+ {"turbo", no_argument, NULL, 'T'},
+ {"unlink", no_argument, NULL, 'u'},
+ {"unrestrict", no_argument, NULL, 'U'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"windowsize", required_argument, NULL, 'w'},
+ {"xmodem", no_argument, NULL, 'X'},
+ {"ymodem", no_argument, NULL, 1},
+ {"zmodem", no_argument, NULL, 'Z'},
+ {"overwrite", no_argument, NULL, 'y'},
+ {"overwrite-or-skip", no_argument, NULL, 'Y'},
+
+ {"delay-startup", required_argument, NULL, 4},
+ {"tcp-server", no_argument, NULL, 6},
+ {"tcp-client", required_argument, NULL, 7},
+ {"no-unixmode", no_argument, NULL, 8},
+ {NULL, 0, NULL, 0}
+};
+
+static void
+show_version(void)
+{
+ printf ("%s (%s) %s\n", program_name, PACKAGE, VERSION);
+}
+
+
+int
+main(int argc, char **argv)
+{
+ char *cp;
+ int npats;
+ int dm;
+ int i;
+ int stdin_files;
+ char **patts;
+ int c;
+ const char *Cmdstr=NULL; /* Pointer to the command string */
+ unsigned int startup_delay=0;
+
+ if (((cp = getenv("ZNULLS")) != NULL) && *cp)
+ Znulls = atoi(cp);
+ if (((cp=getenv("SHELL"))!=NULL) && (strstr(cp, "rsh") || strstr(cp, "rksh")
+ || strstr(cp, "rbash") || strstr(cp,"rshell")))
+ {
+ under_rsh=TRUE;
+ Restricted=1;
+ }
+ if ((cp=getenv("ZMODEM_RESTRICTED"))!=NULL)
+ Restricted=1;
+ from_cu();
+ chkinvok(argv[0]);
+
+#ifdef ENABLE_SYSLOG
+ openlog(program_name,LOG_PID,ENABLE_SYSLOG);
+#endif
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ parse_long_options (argc, argv, show_version, usage1);
+
+ Rxtimeout = 600;
+
+ while ((c = getopt_long (argc, argv,
+ "2+48abB:C:c:dfeEghHi:kL:l:m:M:NnOopRrqsSt:TUuvw:XYy",
+ long_options, (int *) 0))!=EOF)
+ {
+ unsigned long int tmp;
+ char *tmpptr;
+ enum strtol_error s_err;
+
+ switch (c)
+ {
+ case 0:
+ break;
+ case '+': Lzmanag = ZF1_ZMAPND; break;
+ case '2': Twostop = TRUE; break;
+ case '8':
+ if (max_blklen==8192)
+ start_blklen=8192;
+ else
+ max_blklen=8192;
+ break;
+ case '9': /* this is a longopt .. */
+ start_blklen=8192;
+ max_blklen=8192;
+ break;
+ case '4':
+ if (max_blklen==4096)
+ start_blklen=4096;
+ else
+ max_blklen=4096;
+ break;
+ case '5': /* this is a longopt .. */
+ start_blklen=4096;
+ max_blklen=4096;
+ break;
+ case 'a': Lzconv = ZCNL; Ascii = TRUE; break;
+ case 'b': Lzconv = ZCBIN; break;
+ case 'B':
+ if (0==strcmp(optarg,"auto"))
+ buffersize= (size_t) -1;
+ else
+ buffersize=strtol(optarg,NULL,10);
+#ifdef HAVE_MMAP
+ use_mmap=0;
+#endif
+ break;
+ case 'C':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ Cmdtries = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("command tries"), s_err);
+ break;
+ case 'i':
+ Cmdack1 = ZCACK1;
+ /* **** FALL THROUGH TO **** */
+ case 'c':
+ command_mode = TRUE;
+ Cmdstr = optarg;
+ break;
+ case 'd':
+ ++Dottoslash;
+ /* **** FALL THROUGH TO **** */
+ case 'f': Fullname=TRUE; break;
+ case 'e': Zctlesc = 1; break;
+ case 'E': Lzmanag = ZF1_ZMCHNG; break;
+ case 'h': usage(0,NULL); break;
+ case 'H': Lzmanag = ZF1_ZMCRC; break;
+ case 'k': start_blklen=1024; break;
+ case 'L':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, "ck");
+ blkopt = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("packetlength"), s_err);
+ if (blkopt<24 || blkopt>MAX_BLOCK)
+ {
+ char meld[256];
+ sprintf(meld,
+ _("packetlength out of range 24..%ld"),
+ (long) MAX_BLOCK);
+ usage(2,meld);
+ }
+ break;
+ case 'l':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, "ck");
+ Tframlen = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("framelength"), s_err);
+ if (Tframlen<32 || Tframlen>MAX_BLOCK)
+ {
+ char meld[256];
+ sprintf(meld,
+ _("framelength out of range 32..%ld"),
+ (long) MAX_BLOCK);
+ usage(2,meld);
+ }
+ break;
+ case 'm':
+ s_err = xstrtoul (optarg, &tmpptr, 0, &tmp, "km");
+ min_bps = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("min_bps"), s_err);
+ if (min_bps<0)
+ usage(2,_("min_bps must be >= 0"));
+ break;
+ case 'M':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ min_bps_time = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("min_bps_time"), s_err);
+ if (min_bps_time<=1)
+ usage(2,_("min_bps_time must be > 1"));
+ break;
+ case 'N': Lzmanag = ZF1_ZMNEWL; break;
+ case 'n': Lzmanag = ZF1_ZMNEW; break;
+ case 'o': Wantfcs32 = FALSE; break;
+ case 'O': no_timeout = TRUE; break;
+ case 'p': Lzmanag = ZF1_ZMPROT; break;
+ case 'r':
+ if (Lzconv == ZCRESUM)
+ Lzmanag = ZF1_ZMCRC;
+ else
+ Lzconv = ZCRESUM;
+ break;
+ case 'R': Restricted = TRUE; break;
+ case 'q': Quiet=TRUE; Verbose=0; break;
+ case 's':
+ if (isdigit((unsigned char) (*optarg))) {
+ struct tm *tm;
+ time_t t;
+ int hh,mm;
+ char *nex;
+
+ hh = strtoul (optarg, &nex, 10);
+ if (hh>23)
+ usage(2,_("hour to large (0..23)"));
+ if (*nex!=':')
+ usage(2, _("unparsable stop time\n"));
+ nex++;
+ mm = strtoul (optarg, &nex, 10);
+ if (mm>59)
+ usage(2,_("minute to large (0..59)"));
+
+ t=time(NULL);
+ tm=localtime(&t);
+ tm->tm_hour=hh;
+ tm->tm_min=hh;
+ stop_time=mktime(tm);
+ if (stop_time<t)
+ stop_time+=86400L; /* one day more */
+ if (stop_time - t <10)
+ usage(2,_("stop time to small"));
+ } else {
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ stop_time = tmp + time(0);
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("stop-at"), s_err);
+ if (tmp<10)
+ usage(2,_("stop time to small"));
+ }
+ break;
+ case 'S': enable_timesync=1; break;
+ case 'T': turbo_escape=1; break;
+ case 't':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ Rxtimeout = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("timeout"), s_err);
+ if (Rxtimeout<10 || Rxtimeout>1000)
+ usage(2,_("timeout out of range 10..1000"));
+ break;
+ case 'u': ++Unlinkafter; break;
+ case 'U':
+ if (!under_rsh)
+ Restricted=0;
+ else
+ error(1,0,
+ _("security violation: can't do that under restricted shell\n"));
+ break;
+ case 'v': ++Verbose; break;
+ case 'w':
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ Txwindow = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("window size"), s_err);
+ if (Txwindow < 256)
+ Txwindow = 256;
+ Txwindow = (Txwindow/64) * 64;
+ Txwspac = Txwindow/4;
+ if (blkopt > Txwspac
+ || (!blkopt && Txwspac < MAX_BLOCK))
+ blkopt = Txwspac;
+ break;
+ case 'X': protocol=ZM_XMODEM; break;
+ case 1: protocol=ZM_YMODEM; break;
+ case 'Z': protocol=ZM_ZMODEM; break;
+ case 'Y':
+ Lskipnocor = TRUE;
+ /* **** FALLL THROUGH TO **** */
+ case 'y':
+ Lzmanag = ZF1_ZMCLOB; break;
+ case 2:
+#ifdef ENABLE_SYSLOG
+# ifndef ENABLE_SYSLOG_FORCE
+ if (optarg && (!strcmp(optarg,"off") || !strcmp(optarg,"no")))
+ {
+ if (under_rsh)
+ error(0,0, _("cannot turnoff syslog"));
+ else
+ enable_syslog=FALSE;
+ }
+ else
+ enable_syslog=TRUE;
+# else
+ error(0,0, _("cannot turnoff syslog"));
+# endif
+#endif
+ break;
+ case 4:
+ s_err = xstrtoul (optarg, NULL, 0, &tmp, NULL);
+ startup_delay = tmp;
+ if (s_err != LONGINT_OK)
+ STRTOL_FATAL_ERROR (optarg, _("startup delay"), s_err);
+ break;
+ case 6:
+ tcp_flag=2;
+ break;
+ case 7:
+ tcp_flag=3;
+ tcp_server_address=(char *)strdup(optarg);
+ if (!tcp_server_address) {
+ error(1,0,_("out of memory"));
+ }
+ break;
+ case 8: no_unixmode=1; break;
+ default:
+ usage (2,NULL);
+ break;
+ }
+ }
+
+ if (getuid()!=geteuid()) {
+ error(1,0,
+ _("this program was never intended to be used setuid\n"));
+ }
+
+ txbuf=malloc(MAX_BLOCK);
+ if (!txbuf) error(1,0,_("out of memory"));
+
+ zsendline_init();
+
+ if (start_blklen==0) {
+ if (protocol == ZM_ZMODEM) {
+ start_blklen=1024;
+ if (Tframlen) {
+ start_blklen=max_blklen=Tframlen;
+ }
+ }
+ else
+ start_blklen=128;
+ }
+
+ if (argc<2)
+ usage(2,_("need at least one file to send"));
+
+ if (startup_delay)
+ sleep(startup_delay);
+
+#ifdef HAVE_SIGINTERRUPT
+ /* we want interrupted system calls to fail and not to be restarted. */
+ siginterrupt(SIGALRM,1);
+#endif
+
+
+ npats = argc - optind;
+ patts=&argv[optind];
+
+ if (npats < 1 && !command_mode)
+ usage(2,_("need at least one file to send"));
+ if (command_mode && Restricted) {
+ printf(_("Can't send command in restricted mode\n"));
+ exit(1);
+ }
+
+ if (Fromcu && !Quiet) {
+ if (Verbose == 0)
+ Verbose = 2;
+ }
+ vfile("%s %s\n", program_name, VERSION);
+
+ if (tcp_flag==2) {
+ char buf[256];
+#ifdef MAXHOSTNAMELEN
+ char hn[MAXHOSTNAMELEN];
+#else
+ char hn[256];
+#endif
+ char *p,*q;
+ int d;
+
+ /* tell receiver to receive via tcp */
+ d=tcp_server(buf);
+ p=strchr(buf+1,'<');
+ p++;
+ q=strchr(p,'>');
+ *q=0;
+ if (gethostname(hn,sizeof(hn))==-1) {
+ error(1,0, _("hostname too long\n"));
+ }
+ fprintf(stdout,"connect with lrz --tcp-client \"%s:%s\"\n",hn,p);
+ fflush(stdout);
+ /* ok, now that this file is sent we can switch to tcp */
+
+ tcp_socket=tcp_accept(d);
+ dup2(tcp_socket,0);
+ dup2(tcp_socket,1);
+ }
+ if (tcp_flag==3) {
+ char buf[256];
+ char *p;
+ p=strchr(tcp_server_address,':');
+ if (!p)
+ error(1,0, _("illegal server address\n"));
+ *p++=0;
+ sprintf(buf,"[%s] <%s>\n",tcp_server_address,p);
+
+ fprintf(stdout,"connecting to %s\n",buf);
+ fflush(stdout);
+
+ /* we need to switch to tcp mode */
+ tcp_socket=tcp_connect(buf);
+ dup2(tcp_socket,0);
+ dup2(tcp_socket,1);
+ }
+
+
+ {
+ /* we write max_blocklen (data) + 18 (ZModem protocol overhead)
+ * + escape overhead (about 4 %), so buffer has to be
+ * somewhat larger than max_blklen
+ */
+ char *s=malloc(max_blklen+1024);
+ if (!s)
+ {
+ zperr(_("out of memory"));
+ exit(1);
+ }
+#ifdef SETVBUF_REVERSED
+ setvbuf(stdout,_IOFBF,s,max_blklen+1024);
+#else
+ setvbuf(stdout,s,_IOFBF,max_blklen+1024);
+#endif
+ }
+ blklen=start_blklen;
+
+ for (i=optind,stdin_files=0;i<argc;i++) {
+ if (0==strcmp(argv[i],"-"))
+ stdin_files++;
+ }
+
+ if (stdin_files>1) {
+ usage(1,_("can read only one file from stdin"));
+ } else if (stdin_files==1) {
+ io_mode_fd=1;
+ }
+ io_mode(io_mode_fd,1);
+ readline_setup(io_mode_fd, 128, 256);
+
+ if (signal(SIGINT, bibi) == SIG_IGN)
+ signal(SIGINT, SIG_IGN);
+ else {
+ signal(SIGINT, bibi);
+ play_with_sigint=1;
+ }
+ signal(SIGTERM, bibi);
+ signal(SIGPIPE, bibi);
+ signal(SIGHUP, bibi);
+
+ if ( protocol!=ZM_XMODEM) {
+ if (protocol==ZM_ZMODEM) {
+ printf("rz\r");
+ fflush(stdout);
+ }
+ countem(npats, patts);
+ if (protocol == ZM_ZMODEM) {
+ /* throw away any input already received. This doesn't harm
+ * as we invite the receiver to send it's data again, and
+ * might be useful if the receiver has already died or
+ * if there is dirt left if the line
+ */
+#ifdef HAVE_SELECT
+ struct timeval t;
+ unsigned char throwaway;
+ fd_set f;
+#endif
+
+ purgeline(io_mode_fd);
+
+#ifdef HAVE_SELECT
+ t.tv_sec = 0;
+ t.tv_usec = 0;
+
+ FD_ZERO(&f);
+ FD_SET(io_mode_fd,&f);
+
+ while (select(1,&f,NULL,NULL,&t)) {
+ if (0==read(io_mode_fd,&throwaway,1)) /* EOF ... */
+ break;
+ }
+#endif
+
+ purgeline(io_mode_fd);
+ stohdr(0L);
+ if (command_mode)
+ Txhdr[ZF0] = ZCOMMAND;
+ zshhdr(ZRQINIT, Txhdr);
+ zrqinits_sent++;
+#if defined(ENABLE_TIMESYNC)
+ if (Rxflags2 != ZF1_TIMESYNC)
+ /* disable timesync if there are any flags we don't know.
+ * dsz/gsz seems to use some other flags! */
+ enable_timesync=FALSE;
+ if (Rxflags2 & ZF1_TIMESYNC && enable_timesync) {
+ Totalleft+=6; /* TIMESYNC never needs more */
+ Filesleft++;
+ }
+#endif
+ }
+ }
+ fflush(stdout);
+
+ if (Cmdstr) {
+ if (getzrxinit()) {
+ Exitcode=0200; canit(STDOUT_FILENO);
+ }
+ else if (zsendcmd(Cmdstr, strlen(Cmdstr)+1)) {
+ Exitcode=0200; canit(STDOUT_FILENO);
+ }
+ } else if (wcsend(npats, patts)==ERROR) {
+ Exitcode=0200;
+ canit(STDOUT_FILENO);
+ }
+ fflush(stdout);
+ io_mode(io_mode_fd,0);
+ if (Exitcode)
+ dm=Exitcode;
+ else if (errcnt)
+ dm=1;
+ else
+ dm=0;
+ if (Verbose)
+ {
+ fputs("\r\n",stderr);
+ if (dm)
+ fputs(_("Transfer incomplete\n"),stderr);
+ else
+ fputs(_("Transfer complete\n"),stderr);
+ }
+ exit(dm);
+ /*NOTREACHED*/
+}
+
+static int
+send_pseudo(const char *name, const char *data)
+{
+ char *tmp;
+ const char *p;
+ int ret=0; /* ok */
+ size_t plen;
+ int fd;
+ int lfd;
+
+ p = getenv ("TMPDIR");
+ if (!p)
+ p = getenv ("TMP");
+ if (!p)
+ p = "/tmp";
+ tmp=malloc(PATH_MAX+1);
+ if (!tmp)
+ error(1,0,_("out of memory"));
+
+ plen=strlen(p);
+ memcpy(tmp,p,plen);
+ tmp[plen++]='/';
+
+ lfd=0;
+ do {
+ if (lfd++==10) {
+ free(tmp);
+ vstringf (_ ("send_pseudo %s: cannot open tmpfile %s: %s"),
+ name, tmp, strerror (errno));
+ vstring ("\r\n");
+ return 1;
+ }
+ sprintf(tmp+plen,"%s.%lu.%d",name,(unsigned long) getpid(),lfd);
+ fd=open(tmp,O_WRONLY|O_CREAT|O_EXCL,0700);
+ /* is O_EXCL guaranted to not follow symlinks?
+ * I don`t know ... so be careful
+ */
+ if (fd!=-1) {
+ struct stat st;
+ if (0!=lstat(tmp,&st)) {
+ vstringf (_ ("send_pseudo %s: cannot lstat tmpfile %s: %s"),
+ name, tmp, strerror (errno));
+ vstring ("\r\n");
+ unlink(tmp);
+ close(fd);
+ fd=-1;
+ } else {
+ if (S_ISLNK(st.st_mode)) {
+ vstringf (_ ("send_pseudo %s: avoiding symlink trap"),name);
+ vstring ("\r\n");
+ unlink(tmp);
+ close(fd);
+ fd=-1;
+ }
+ }
+ }
+ } while (fd==-1);
+ if (write(fd,data,strlen(data))!=(signed long) strlen(data)
+ || close(fd)!=0) {
+ vstringf (_ ("send_pseudo %s: cannot write to tmpfile %s: %s"),
+ name, tmp, strerror (errno));
+ vstring ("\r\n");
+ free(tmp);
+ return 1;
+ }
+
+ if (wcs (tmp,name) == ERROR) {
+ if (Verbose)
+ vstringf (_ ("send_pseudo %s: failed"),name);
+ else {
+ if (Verbose)
+ vstringf (_ ("send_pseudo %s: ok"),name);
+ Filcnt--;
+ }
+ vstring ("\r\n");
+ ret=1;
+ }
+ unlink (tmp);
+ free(tmp);
+ return ret;
+}
+
+static int
+wcsend (int argc, char *argp[])
+{
+ int n;
+
+ Crcflg = FALSE;
+ firstsec = TRUE;
+ bytcnt = (size_t) -1;
+
+ for (n = 0; n < argc; ++n) {
+ Totsecs = 0;
+ if (wcs (argp[n],NULL) == ERROR)
+ return ERROR;
+ }
+#if defined(ENABLE_TIMESYNC)
+ if (Rxflags2 & ZF1_TIMESYNC && enable_timesync) {
+ /* implement Peter Mandrellas extension */
+ char buf[60];
+ time_t t = time (NULL);
+ struct tm *tm = localtime (&t); /* sets timezone */
+ strftime (buf, sizeof (buf) - 1, "%H:%M:%S", tm);
+ if (Verbose) {
+ vstring ("\r\n");
+ vstringf (_("Answering TIMESYNC at %s"),buf);
+ }
+#if defined(HAVE_TIMEZONE_VAR)
+ sprintf(buf+strlen(buf),"%ld\r\n", timezone / 60);
+ if (Verbose)
+ vstringf (" (%s %ld)\r\n", _ ("timezone"), timezone / 60);
+#else
+ if (Verbose)
+ vstringf (" (%s)\r\n", _ ("timezone unknown"));
+#endif
+ send_pseudo("/$time$.t",buf);
+ }
+#endif
+ Totsecs = 0;
+ if (Filcnt == 0) { /* bitch if we couldn't open ANY files */
+#if 0
+ /* i *really* do not like this */
+ if (protocol != ZM_XMODEM) {
+ const char *Cmdstr; /* Pointer to the command string */
+ command_mode = TRUE;
+ Cmdstr = "echo \"lsz: Can't open any requested files\"";
+ if (getnak ()) {
+ Exitcode = 0200;
+ canit(STDOUT_FILENO);
+ }
+ if (!zmodem_requested)
+ canit(STDOUT_FILENO);
+ else if (zsendcmd (Cmdstr, 1 + strlen (Cmdstr))) {
+ Exitcode = 0200;
+ canit(STDOUT_FILENO);
+ }
+ Exitcode = 1;
+ return OK;
+ }
+#endif
+ canit(STDOUT_FILENO);
+ vstring ("\r\n");
+ vstringf (_ ("Can't open any requested files."));
+ vstring ("\r\n");
+ return ERROR;
+ }
+ if (zmodem_requested)
+ saybibi ();
+ else if (protocol != ZM_XMODEM) {
+ struct zm_fileinfo zi;
+ char *pa;
+ pa=alloca(PATH_MAX+1);
+ *pa='\0';
+ zi.fname = pa;
+ zi.modtime = 0;
+ zi.mode = 0;
+ zi.bytes_total = 0;
+ zi.bytes_sent = 0;
+ zi.bytes_received = 0;
+ zi.bytes_skipped = 0;
+ wctxpn (&zi);
+ }
+ return OK;
+}
+
+static int
+wcs(const char *oname, const char *remotename)
+{
+#if !defined(S_ISDIR)
+ int c;
+#endif
+ struct stat f;
+ char *name;
+ struct zm_fileinfo zi;
+#ifdef HAVE_MMAP
+ int dont_mmap_this=0;
+#endif
+#ifdef ENABLE_SYSLOG
+ const char *shortname;
+ shortname=strrchr(oname,'/');
+ if (shortname)
+ shortname++;
+ else
+ shortname=oname;
+#endif
+
+
+ if (Restricted) {
+ /* restrict pathnames to current tree or uucppublic */
+ if ( strstr(oname, "../")
+#ifdef PUBDIR
+ || (oname[0]== '/' && strncmp(oname, MK_STRING(PUBDIR),
+ strlen(MK_STRING(PUBDIR))))
+#endif
+ ) {
+ canit(STDOUT_FILENO);
+ vchar('\r');
+ error(1,0,
+ _("security violation: not allowed to upload from %s"),oname);
+ }
+ }
+
+ if (0==strcmp(oname,"-")) {
+ char *p=getenv("ONAME");
+ name=alloca(PATH_MAX+1);
+ if (p) {
+ strcpy(name, p);
+ } else {
+ sprintf(name, "s%lu.lsz", (unsigned long) getpid());
+ }
+ input_f=stdin;
+#ifdef HAVE_MMAP
+ dont_mmap_this=1;
+#endif
+ } else if ((input_f=fopen(oname, "r"))==NULL) {
+ int e=errno;
+ error(0,e, _("cannot open %s"),oname);
+ ++errcnt;
+ return OK; /* pass over it, there may be others */
+ } else {
+ name=alloca(PATH_MAX+1);
+ strcpy(name, oname);
+ }
+#ifdef HAVE_MMAP
+ if (!use_mmap || dont_mmap_this)
+#endif
+ {
+ static char *s=NULL;
+ static size_t last_length=0;
+ struct stat st;
+ if (fstat(fileno(input_f),&st)==-1)
+ st.st_size=1024*1024;
+ if (buffersize==(size_t) -1 && s) {
+ if ((size_t) st.st_size > last_length) {
+ free(s);
+ s=NULL;
+ last_length=0;
+ }
+ }
+ if (!s && buffersize) {
+ last_length=16384;
+ if (buffersize==(size_t) -1) {
+ if (st.st_size>0)
+ last_length=st.st_size;
+ } else
+ last_length=buffersize;
+ /* buffer whole pages */
+ last_length=(last_length+4095)&0xfffff000;
+ s=malloc(last_length);
+ if (!s) {
+ zpfatal(_("out of memory"));
+ exit(1);
+ }
+ }
+ if (s) {
+#ifdef SETVBUF_REVERSED
+ setvbuf(input_f,_IOFBF,s,last_length);
+#else
+ setvbuf(input_f,s,_IOFBF,last_length);
+#endif
+ }
+ }
+ vpos = 0;
+ /* Check for directory or block special files */
+ fstat(fileno(input_f), &f);
+#if defined(S_ISDIR)
+ if (S_ISDIR(f.st_mode) || S_ISBLK(f.st_mode)) {
+#else
+ c = f.st_mode & S_IFMT;
+ if (c == S_IFDIR || c == S_IFBLK) {
+#endif
+ error(0,0, _("is not a file: %s"),name);
+ fclose(input_f);
+ return OK;
+ }
+
+ if (remotename) {
+ /* disqualify const */
+ union {
+ const char *c;
+ char *s;
+ } cheat;
+ cheat.c=remotename;
+ zi.fname=cheat.s;
+ } else
+ zi.fname=name;
+ zi.modtime=f.st_mtime;
+ zi.mode=f.st_mode;
+#if defined(S_ISFIFO)
+ zi.bytes_total= (S_ISFIFO(f.st_mode)) ? DEFBYTL : f.st_size;
+#else
+ zi.bytes_total= c == S_IFIFO ? DEFBYTL : f.st_size;
+#endif
+ zi.bytes_sent=0;
+ zi.bytes_received=0;
+ zi.bytes_skipped=0;
+ zi.eof_seen=0;
+ timing(1,NULL);
+
+ ++Filcnt;
+ switch (wctxpn(&zi)) {
+ case ERROR:
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_INFO, _("%s/%s: error occured"),protname(),shortname);
+#endif
+ return ERROR;
+ case ZSKIP:
+ error(0,0, _("skipped: %s"),name);
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_INFO, _("%s/%s: skipped"),protname(),shortname);
+#endif
+ return OK;
+ }
+ if (!zmodem_requested && wctx(&zi)==ERROR)
+ {
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_INFO, _("%s/%s: error occured"),protname(),shortname);
+#endif
+ return ERROR;
+ }
+ if (Unlinkafter)
+ unlink(oname);
+
+ if (Verbose > 1
+#ifdef ENABLE_SYSLOG
+ || enable_syslog
+#endif
+ ) {
+ long bps;
+ double d=timing(0,NULL);
+ if (d==0) /* can happen if timing() uses time() */
+ d=0.5;
+ bps=zi.bytes_sent/d;
+ vchar('\r');
+ if (Verbose > 1)
+ vstringf(_("Bytes Sent:%7ld BPS:%-8ld \n"),
+ (long) zi.bytes_sent,bps);
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_INFO, "%s/%s: %ld Bytes, %ld BPS",shortname,
+ protname(), (long) zi.bytes_sent,bps);
+#endif
+ }
+ return 0;
+}
+
+/*
+ * generate and transmit pathname block consisting of
+ * pathname (null terminated),
+ * file length, mode time and file mode in octal
+ * as provided by the Unix fstat call.
+ * N.B.: modifies the passed name, may extend it!
+ */
+static int
+wctxpn(struct zm_fileinfo *zi)
+{
+ register char *p, *q;
+ char *name2;
+ struct stat f;
+
+ name2=alloca(PATH_MAX+1);
+
+ if (protocol==ZM_XMODEM) {
+ if (Verbose && *zi->fname && fstat(fileno(input_f), &f)!= -1) {
+ vstringf(_("Sending %s, %ld blocks: "),
+ zi->fname, (long) (f.st_size>>7));
+ }
+ vstringf(_("Give your local XMODEM receive command now."));
+ vstring("\r\n");
+ return OK;
+ }
+ if (!zmodem_requested)
+ if (getnak()) {
+ vfile("getnak failed");
+ DO_SYSLOG((LOG_INFO, "%s/%s: getnak failed",
+ shortname,protname()));
+ return ERROR;
+ }
+
+ q = (char *) 0;
+ if (Dottoslash) { /* change . to . */
+ for (p=zi->fname; *p; ++p) {
+ if (*p == '/')
+ q = p;
+ else if (*p == '.')
+ *(q=p) = '/';
+ }
+ if (q && strlen(++q) > 8) { /* If name>8 chars */
+ q += 8; /* make it .ext */
+ strcpy(name2, q); /* save excess of name */
+ *q = '.';
+ strcpy(++q, name2); /* add it back */
+ }
+ }
+
+ for (p=zi->fname, q=txbuf ; *p; )
+ if ((*q++ = *p++) == '/' && !Fullname)
+ q = txbuf;
+ *q++ = 0;
+ p=q;
+ while (q < (txbuf + MAX_BLOCK))
+ *q++ = 0;
+ /* note that we may lose some information here in case mode_t is wider than an
+ * int. But i believe sending %lo instead of %o _could_ break compatability
+ */
+ if (!Ascii && (input_f!=stdin) && *zi->fname && fstat(fileno(input_f), &f)!= -1)
+ sprintf(p, "%lu %lo %o 0 %d %ld", (long) f.st_size, f.st_mtime,
+ (unsigned int)((no_unixmode) ? 0 : f.st_mode),
+ Filesleft, Totalleft);
+ if (Verbose)
+ vstringf(_("Sending: %s\n"),txbuf);
+ Totalleft -= f.st_size;
+ if (--Filesleft <= 0)
+ Totalleft = 0;
+ if (Totalleft < 0)
+ Totalleft = 0;
+
+ /* force 1k blocks if name won't fit in 128 byte block */
+ if (txbuf[125])
+ blklen=1024;
+ else { /* A little goodie for IMP/KMD */
+ txbuf[127] = (f.st_size + 127) >>7;
+ txbuf[126] = (f.st_size + 127) >>15;
+ }
+ if (zmodem_requested)
+ return zsendfile(zi,txbuf, 1+strlen(p)+(p-txbuf));
+ if (wcputsec(txbuf, 0, 128)==ERROR) {
+ vfile("wcputsec failed");
+ DO_SYSLOG((LOG_INFO, "%s/%s: wcputsec failed",
+ shortname,protname()));
+ return ERROR;
+ }
+ return OK;
+}
+
+static int
+getnak(void)
+{
+ int firstch;
+ int tries=0;
+
+ Lastrx = 0;
+ for (;;) {
+ tries++;
+ switch (firstch = READLINE_PF(100)) {
+ case ZPAD:
+ if (getzrxinit())
+ return ERROR;
+ Ascii = 0; /* Receiver does the conversion */
+ return FALSE;
+ case TIMEOUT:
+ /* 30 seconds are enough */
+ if (tries==3) {
+ zperr(_("Timeout on pathname"));
+ return TRUE;
+ }
+ /* don't send a second ZRQINIT _directly_ after the
+ * first one. Never send more then 4 ZRQINIT, because
+ * omen rz stops if it saw 5 of them */
+ if ((zrqinits_sent>1 || tries>1) && zrqinits_sent<4) {
+ /* if we already sent a ZRQINIT we are using zmodem
+ * protocol and may send further ZRQINITs
+ */
+ stohdr(0L);
+ zshhdr(ZRQINIT, Txhdr);
+ zrqinits_sent++;
+ }
+ continue;
+ case WANTG:
+ io_mode(io_mode_fd,2); /* Set cbreak, XON/XOFF, etc. */
+ Optiong = TRUE;
+ blklen=1024;
+ case WANTCRC:
+ Crcflg = TRUE;
+ case NAK:
+ return FALSE;
+ case CAN:
+ if ((firstch = READLINE_PF(20)) == CAN && Lastrx == CAN)
+ return TRUE;
+ default:
+ break;
+ }
+ Lastrx = firstch;
+ }
+}
+
+
+static int
+wctx(struct zm_fileinfo *zi)
+{
+ register size_t thisblklen;
+ register int sectnum, attempts, firstch;
+
+ firstsec=TRUE; thisblklen = blklen;
+ vfile("wctx:file length=%ld", (long) zi->bytes_total);
+
+ while ((firstch=READLINE_PF(Rxtimeout))!=NAK && firstch != WANTCRC
+ && firstch != WANTG && firstch!=TIMEOUT && firstch!=CAN)
+ ;
+ if (firstch==CAN) {
+ zperr(_("Receiver Cancelled"));
+ return ERROR;
+ }
+ if (firstch==WANTCRC)
+ Crcflg=TRUE;
+ if (firstch==WANTG)
+ Crcflg=TRUE;
+ sectnum=0;
+ for (;;) {
+ if (zi->bytes_total <= (zi->bytes_sent + 896L))
+ thisblklen = 128;
+ if ( !filbuf(txbuf, thisblklen))
+ break;
+ if (wcputsec(txbuf, ++sectnum, thisblklen)==ERROR)
+ return ERROR;
+ zi->bytes_sent += thisblklen;
+ }
+ fclose(input_f);
+ attempts=0;
+ do {
+ purgeline(io_mode_fd);
+ sendline(EOT);
+ flushmo();
+ ++attempts;
+ } while ((firstch=(READLINE_PF(Rxtimeout)) != ACK) && attempts < RETRYMAX);
+ if (attempts == RETRYMAX) {
+ zperr(_("No ACK on EOT"));
+ return ERROR;
+ }
+ else
+ return OK;
+}
+
+static int
+wcputsec(char *buf, int sectnum, size_t cseclen)
+{
+ int checksum, wcj;
+ char *cp;
+ unsigned oldcrc;
+ int firstch;
+ int attempts;
+
+ firstch=0; /* part of logic to detect CAN CAN */
+
+ if (Verbose>1) {
+ vchar('\r');
+ if (protocol==ZM_XMODEM) {
+ vstringf(_("Xmodem sectors/kbytes sent: %3d/%2dk"), Totsecs, Totsecs/8 );
+ } else {
+ vstringf(_("Ymodem sectors/kbytes sent: %3d/%2dk"), Totsecs, Totsecs/8 );
+ }
+ }
+ for (attempts=0; attempts <= RETRYMAX; attempts++) {
+ Lastrx= firstch;
+ sendline(cseclen==1024?STX:SOH);
+ sendline(sectnum);
+ sendline(-sectnum -1);
+ oldcrc=checksum=0;
+ for (wcj=cseclen,cp=buf; --wcj>=0; ) {
+ sendline(*cp);
+ oldcrc=updcrc((0377& *cp), oldcrc);
+ checksum += *cp++;
+ }
+ if (Crcflg) {
+ oldcrc=updcrc(0,updcrc(0,oldcrc));
+ sendline((int)oldcrc>>8);
+ sendline((int)oldcrc);
+ }
+ else
+ sendline(checksum);
+
+ flushmo();
+ if (Optiong) {
+ firstsec = FALSE; return OK;
+ }
+ firstch = READLINE_PF(Rxtimeout);
+gotnak:
+ switch (firstch) {
+ case CAN:
+ if(Lastrx == CAN) {
+cancan:
+ zperr(_("Cancelled")); return ERROR;
+ }
+ break;
+ case TIMEOUT:
+ zperr(_("Timeout on sector ACK")); continue;
+ case WANTCRC:
+ if (firstsec)
+ Crcflg = TRUE;
+ case NAK:
+ zperr(_("NAK on sector")); continue;
+ case ACK:
+ firstsec=FALSE;
+ Totsecs += (cseclen>>7);
+ return OK;
+ case ERROR:
+ zperr(_("Got burst for sector ACK")); break;
+ default:
+ zperr(_("Got %02x for sector ACK"), firstch); break;
+ }
+ for (;;) {
+ Lastrx = firstch;
+ if ((firstch = READLINE_PF(Rxtimeout)) == TIMEOUT)
+ break;
+ if (firstch == NAK || firstch == WANTCRC)
+ goto gotnak;
+ if (firstch == CAN && Lastrx == CAN)
+ goto cancan;
+ }
+ }
+ zperr(_("Retry Count Exceeded"));
+ return ERROR;
+}
+
+/* fill buf with count chars padding with ^Z for CPM */
+static size_t
+filbuf(char *buf, size_t count)
+{
+ int c;
+ size_t m;
+
+ if ( !Ascii) {
+ m = read(fileno(input_f), buf, count);
+ if (m <= 0)
+ return 0;
+ while (m < count)
+ buf[m++] = 032;
+ return count;
+ }
+ m=count;
+ if (Lfseen) {
+ *buf++ = 012; --m; Lfseen = 0;
+ }
+ while ((c=getc(input_f))!=EOF) {
+ if (c == 012) {
+ *buf++ = 015;
+ if (--m == 0) {
+ Lfseen = TRUE; break;
+ }
+ }
+ *buf++ =c;
+ if (--m == 0)
+ break;
+ }
+ if (m==count)
+ return 0;
+ else
+ while (m--!=0)
+ *buf++ = CPMEOF;
+ return count;
+}
+
+/* Fill buffer with blklen chars */
+static size_t
+zfilbuf (struct zm_fileinfo *zi)
+{
+ size_t n;
+
+ n = fread (txbuf, 1, blklen, input_f);
+ if (n < blklen)
+ zi->eof_seen = 1;
+ else {
+ /* save one empty paket in case file ends ob blklen boundary */
+ int c = getc(input_f);
+
+ if (c != EOF || !feof(input_f))
+ ungetc(c, input_f);
+ else
+ zi->eof_seen = 1;
+ }
+ return n;
+}
+
+static void
+usage1 (int exitcode)
+{
+ usage (exitcode, NULL);
+}
+
+static void
+usage(int exitcode, const char *what)
+{
+ FILE *f=stdout;
+
+ if (exitcode)
+ {
+ if (what)
+ fprintf(stderr, "%s: %s\n",program_name,what);
+ fprintf (stderr, _("Try `%s --help' for more information.\n"),
+ program_name);
+ exit(exitcode);
+ }
+
+ fprintf(f, _("%s version %s\n"), program_name,
+ VERSION);
+
+ fprintf(f,_("Usage: %s [options] file ...\n"),
+ program_name);
+ fprintf(f,_(" or: %s [options] -{c|i} COMMAND\n"),program_name);
+ fputs(_("Send file(s) with ZMODEM/YMODEM/XMODEM protocol\n"),f);
+ fputs(_(
+ " (X) = option applies to XMODEM only\n"
+ " (Y) = option applies to YMODEM only\n"
+ " (Z) = option applies to ZMODEM only\n"
+ ),f);
+ /* splitted into two halves for really bad compilers */
+ fputs(_(
+" -+, --append append to existing destination file (Z)\n"
+" -2, --twostop use 2 stop bits\n"
+" -4, --try-4k go up to 4K blocksize\n"
+" --start-4k start with 4K blocksize (doesn't try 8)\n"
+" -8, --try-8k go up to 8K blocksize\n"
+" --start-8k start with 8K blocksize\n"
+" -a, --ascii ASCII transfer (change CR/LF to LF)\n"
+" -b, --binary binary transfer\n"
+" -B, --bufsize N buffer N bytes (N==auto: buffer whole file)\n"
+" -c, --command COMMAND execute remote command COMMAND (Z)\n"
+" -C, --command-tries N try N times to execute a command (Z)\n"
+" -d, --dot-to-slash change '.' to '/' in pathnames (Y/Z)\n"
+" --delay-startup N sleep N seconds before doing anything\n"
+" -e, --escape escape all control characters (Z)\n"
+" -E, --rename force receiver to rename files it already has\n"
+" -f, --full-path send full pathname (Y/Z)\n"
+" -i, --immediate-command CMD send remote CMD, return immediately (Z)\n"
+" -h, --help print this usage message\n"
+" -k, --1k send 1024 byte packets (X)\n"
+" -L, --packetlen N limit subpacket length to N bytes (Z)\n"
+" -l, --framelen N limit frame length to N bytes (l>=L) (Z)\n"
+" -m, --min-bps N stop transmission if BPS below N\n"
+" -M, --min-bps-time N for at least N seconds (default: 120)\n"
+ ),f);
+ fputs(_(
+" -n, --newer send file if source newer (Z)\n"
+" -N, --newer-or-longer send file if source newer or longer (Z)\n"
+" -o, --16-bit-crc use 16 bit CRC instead of 32 bit CRC (Z)\n"
+" -O, --disable-timeouts disable timeout code, wait forever\n"
+" -p, --protect protect existing destination file (Z)\n"
+" -r, --resume resume interrupted file transfer (Z)\n"
+" -R, --restricted restricted, more secure mode\n"
+" -q, --quiet quiet (no progress reports)\n"
+" -s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds\n"
+" --tcp-server open socket, wait for connection (Z)\n"
+" --tcp-client ADDR:PORT open socket, connect to ... (Z)\n"
+" -u, --unlink unlink file after transmission\n"
+" -U, --unrestrict turn off restricted mode (if allowed to)\n"
+" -v, --verbose be verbose, provide debugging information\n"
+" -w, --windowsize N Window is N bytes (Z)\n"
+" -X, --xmodem use XMODEM protocol\n"
+" -y, --overwrite overwrite existing files\n"
+" -Y, --overwrite-or-skip overwrite existing files, else skip\n"
+" --ymodem use YMODEM protocol\n"
+" -Z, --zmodem use ZMODEM protocol\n"
+"\n"
+"short options use the same arguments as the long ones\n"
+ ),f);
+ exit(exitcode);
+}
+
+/*
+ * Get the receiver's init parameters
+ */
+static int
+getzrxinit(void)
+{
+ static int dont_send_zrqinit=1;
+ int old_timeout=Rxtimeout;
+ int n;
+ struct stat f;
+ size_t rxpos;
+ int timeouts=0;
+
+ Rxtimeout=100; /* 10 seconds */
+ /* XXX purgeline(io_mode_fd); this makes _real_ trouble. why? -- uwe */
+
+ for (n=10; --n>=0; ) {
+ /* we might need to send another zrqinit in case the first is
+ * lost. But *not* if getting here for the first time - in
+ * this case we might just get a ZRINIT for our first ZRQINIT.
+ * Never send more then 4 ZRQINIT, because
+ * omen rz stops if it saw 5 of them.
+ */
+ if (zrqinits_sent<4 && n!=10 && !dont_send_zrqinit) {
+ zrqinits_sent++;
+ stohdr(0L);
+ zshhdr(ZRQINIT, Txhdr);
+ }
+ dont_send_zrqinit=0;
+
+ switch (zgethdr(Rxhdr, 1,&rxpos)) {
+ case ZCHALLENGE: /* Echo receiver's challenge numbr */
+ stohdr(rxpos);
+ zshhdr(ZACK, Txhdr);
+ continue;
+ case ZCOMMAND: /* They didn't see our ZRQINIT */
+ /* ??? Since when does a receiver send ZCOMMAND? -- uwe */
+ continue;
+ case ZRINIT:
+ Rxflags = 0377 & Rxhdr[ZF0];
+ Rxflags2 = 0377 & Rxhdr[ZF1];
+ Txfcs32 = (Wantfcs32 && (Rxflags & CANFC32));
+ {
+ int old=Zctlesc;
+ Zctlesc |= Rxflags & TESCCTL;
+ /* update table - was initialised to not escape */
+ if (Zctlesc && !old)
+ zsendline_init();
+ }
+ Rxbuflen = (0377 & Rxhdr[ZP0])+((0377 & Rxhdr[ZP1])<<8);
+ if ( !(Rxflags & CANFDX))
+ Txwindow = 0;
+ vfile("Rxbuflen=%d Tframlen=%d", Rxbuflen, Tframlen);
+ if ( play_with_sigint)
+ signal(SIGINT, SIG_IGN);
+ io_mode(io_mode_fd,2); /* Set cbreak, XON/XOFF, etc. */
+#ifndef READCHECK
+ /* Use MAX_BLOCK byte frames if no sample/interrupt */
+ if (Rxbuflen < 32 || Rxbuflen > MAX_BLOCK) {
+ Rxbuflen = MAX_BLOCK;
+ vfile("Rxbuflen=%d", Rxbuflen);
+ }
+#endif
+ /* Override to force shorter frame length */
+ if (Tframlen && Rxbuflen > Tframlen)
+ Rxbuflen = Tframlen;
+ if ( !Rxbuflen)
+ Rxbuflen = 1024;
+ vfile("Rxbuflen=%d", Rxbuflen);
+
+ /* If using a pipe for testing set lower buf len */
+ fstat(0, &f);
+#if defined(S_ISCHR)
+ if (! (S_ISCHR(f.st_mode))) {
+#else
+ if ((f.st_mode & S_IFMT) != S_IFCHR) {
+#endif
+ Rxbuflen = MAX_BLOCK;
+ }
+ /*
+ * If input is not a regular file, force ACK's to
+ * prevent running beyond the buffer limits
+ */
+ if ( !command_mode) {
+ fstat(fileno(input_f), &f);
+#if defined(S_ISREG)
+ if (!(S_ISREG(f.st_mode))) {
+#else
+ if ((f.st_mode & S_IFMT) != S_IFREG) {
+#endif
+ Canseek = -1;
+ /* return ERROR; */
+ }
+ }
+ /* Set initial subpacket length */
+ if (blklen < 1024) { /* Command line override? */
+ if (Baudrate > 300)
+ blklen = 256;
+ if (Baudrate > 1200)
+ blklen = 512;
+ if (Baudrate > 2400)
+ blklen = 1024;
+ }
+ if (Rxbuflen && blklen>Rxbuflen)
+ blklen = Rxbuflen;
+ if (blkopt && blklen > blkopt)
+ blklen = blkopt;
+ vfile("Rxbuflen=%d blklen=%d", Rxbuflen, blklen);
+ vfile("Txwindow = %u Txwspac = %d", Txwindow, Txwspac);
+ Rxtimeout=old_timeout;
+ return (sendzsinit());
+ case ZCAN:
+ case TIMEOUT:
+ if (timeouts++==0)
+ continue; /* force one other ZRQINIT to be sent */
+ return ERROR;
+ case ZRQINIT:
+ if (Rxhdr[ZF0] == ZCOMMAND)
+ continue;
+ default:
+ zshhdr(ZNAK, Txhdr);
+ continue;
+ }
+ }
+ return ERROR;
+}
+
+/* Send send-init information */
+static int
+sendzsinit(void)
+{
+ int c;
+
+ if (Myattn[0] == '\0' && (!Zctlesc || (Rxflags & TESCCTL)))
+ return OK;
+ errors = 0;
+ for (;;) {
+ stohdr(0L);
+ if (Zctlesc) {
+ Txhdr[ZF0] |= TESCCTL; zshhdr(ZSINIT, Txhdr);
+ }
+ else
+ zsbhdr(ZSINIT, Txhdr);
+ ZSDATA(Myattn, 1+strlen(Myattn), ZCRCW);
+ c = zgethdr(Rxhdr, 1,NULL);
+ switch (c) {
+ case ZCAN:
+ return ERROR;
+ case ZACK:
+ return OK;
+ default:
+ if (++errors > 19)
+ return ERROR;
+ continue;
+ }
+ }
+}
+
+/* Send file name and related info */
+static int
+zsendfile(struct zm_fileinfo *zi, const char *buf, size_t blen)
+{
+ unsigned long crc;
+ size_t rxpos;
+
+ /* we are going to send a ZFILE. There cannot be much useful
+ * stuff in the line right now (*except* ZCAN?).
+ */
+#if 0
+ purgeline(io_mode_fd); /* might possibly fix stefan glasers problems */
+#endif
+
+ for (;;) {
+ int gotblock;
+ int gotchar;
+ Txhdr[ZF0] = Lzconv; /* file conversion request */
+ Txhdr[ZF1] = Lzmanag; /* file management request */
+ if (Lskipnocor)
+ Txhdr[ZF1] |= ZF1_ZMSKNOLOC;
+ Txhdr[ZF2] = Lztrans; /* file transport request */
+ Txhdr[ZF3] = 0;
+ zsbhdr(ZFILE, Txhdr);
+ ZSDATA(buf, blen, ZCRCW);
+again:
+ gotblock = zgethdr(Rxhdr, 1, &rxpos);
+ switch (gotblock) {
+ case ZRINIT:
+ while ((gotchar = READLINE_PF(50)) > 0)
+ if (gotchar == ZPAD) {
+ goto again;
+ }
+ /* **** FALL THRU TO **** */
+ default:
+ continue;
+ case ZRQINIT: /* remote site is sender! */
+ if (Verbose)
+ vstringf(_("got ZRQINIT"));
+ DO_SYSLOG((LOG_INFO, "%s/%s: got ZRQINIT - sz talks to sz",
+ shortname,protname()));
+ return ERROR;
+ case ZCAN:
+ if (Verbose)
+ vstringf(_("got ZCAN"));
+ DO_SYSLOG((LOG_INFO, "%s/%s: got ZCAN - receiver canceled",
+ shortname,protname()));
+ return ERROR;
+ case TIMEOUT:
+ DO_SYSLOG((LOG_INFO, "%s/%s: got TIMEOUT",
+ shortname,protname()));
+ return ERROR;
+ case ZABORT:
+ DO_SYSLOG((LOG_INFO, "%s/%s: got ZABORT",
+ shortname,protname()));
+ return ERROR;
+ case ZFIN:
+ DO_SYSLOG((LOG_INFO, "%s/%s: got ZFIN",
+ shortname,protname()));
+ return ERROR;
+ case ZCRC:
+ crc = 0xFFFFFFFFL;
+#ifdef HAVE_MMAP
+ if (use_mmap && !mm_addr)
+ {
+ struct stat st;
+ /* mmap on files of 0 length can give 0 as result .. under linux 2.2.9 at least */
+ if (fstat (fileno (input_f), &st) == 0 && st.st_size!=0) {
+ mm_size = st.st_size;
+ mm_addr = mmap (0, mm_size, PROT_READ,
+ MAP_SHARED, fileno (input_f), 0);
+ if ((caddr_t) mm_addr == (caddr_t) - 1)
+ mm_addr = NULL;
+ else {
+ fclose (input_f);
+ input_f = NULL;
+ }
+ }
+ }
+ if (mm_addr) {
+ size_t i;
+ size_t count;
+ char *p=mm_addr;
+ count=(rxpos < mm_size && rxpos > 0)? rxpos: mm_size;
+ for (i=0;i<count;i++,p++) {
+ crc = UPDC32(*p, crc);
+ }
+ crc = ~crc;
+ } else
+#endif
+ if (Canseek >= 0) {
+ if (rxpos==0) {
+ struct stat st;
+ if (0==fstat(fileno(input_f),&st)) {
+ rxpos=st.st_size;
+ } else
+ rxpos=-1;
+ }
+ while (rxpos-- && ((gotchar = getc(input_f)) != EOF))
+ crc = UPDC32(gotchar, crc);
+ crc = ~crc;
+ clearerr(input_f); /* Clear EOF */
+ fseek(input_f, 0L, 0);
+ }
+ stohdr(crc);
+ zsbhdr(ZCRC, Txhdr);
+ goto again;
+ case ZSKIP:
+ if (input_f) {
+ fclose(input_f);
+ input_f=NULL;
+ }
+#ifdef HAVE_MMAP
+ else if (mm_addr) {
+ munmap(mm_addr,mm_size);
+ mm_addr=NULL;
+ }
+#endif
+
+ vfile("receiver skipped");
+ DO_SYSLOG((LOG_INFO, "%s/%s: receiver skipped",
+ shortname, protname()));
+ return ZSKIP;
+ case ZRPOS:
+ /*
+ * Suppress zcrcw request otherwise triggered by
+ * lastsync==bytcnt
+ */
+#ifdef HAVE_MMAP
+ if (!mm_addr)
+#endif
+ if (rxpos && fseek(input_f, (long) rxpos, 0)) {
+ int er=errno;
+ vfile("fseek failed: %s", strerror(er));
+ DO_SYSLOG((LOG_INFO, "%s/%s: fseek failed: %s",
+ shortname, protname(), strerror(er)));
+ return ERROR;
+ }
+ if (rxpos)
+ zi->bytes_skipped=rxpos;
+ bytcnt = zi->bytes_sent = rxpos;
+ Lastsync = rxpos -1;
+ return zsendfdata(zi);
+ }
+ }
+}
+
+/* Send the data in the file */
+static int
+zsendfdata (struct zm_fileinfo *zi)
+{
+ static int c;
+ int newcnt;
+ static int junkcount; /* Counts garbage chars received by TX */
+ static size_t last_txpos = 0;
+ static long last_bps = 0;
+ static long not_printed = 0;
+ static long total_sent = 0;
+ static time_t low_bps=0;
+
+#ifdef HAVE_MMAP
+ if (use_mmap && !mm_addr)
+ {
+ struct stat st;
+ if (fstat (fileno (input_f), &st) == 0 && st.st_size!=0) {
+ mm_size = st.st_size;
+ mm_addr = mmap (0, mm_size, PROT_READ,
+ MAP_SHARED, fileno (input_f), 0);
+ if ((caddr_t) mm_addr == (caddr_t) - 1)
+ mm_addr = NULL;
+ else {
+ fclose (input_f);
+ input_f = NULL;
+ }
+ }
+ }
+#endif
+
+ if (play_with_sigint)
+ signal (SIGINT, onintr);
+
+ Lrxpos = 0;
+ junkcount = 0;
+ Beenhereb4 = 0;
+ somemore:
+ if (setjmp (intrjmp)) {
+ if (play_with_sigint)
+ signal (SIGINT, onintr);
+ waitack:
+ junkcount = 0;
+ c = getinsync (zi, 0);
+ gotack:
+ switch (c) {
+ default:
+ if (input_f) {
+ fclose (input_f);
+ input_f=NULL;
+ }
+ DO_SYSLOG((LOG_INFO, "%s/%s: got %d",
+ shortname, protname(), c));
+ return ERROR;
+ case ZCAN:
+ if (input_f) {
+ fclose (input_f);
+ input_f=NULL;
+ }
+ DO_SYSLOG((LOG_INFO, "%s/%s: got ZCAN",
+ shortname, protname()));
+ return ERROR;
+ case ZSKIP:
+ if (input_f) {
+ fclose (input_f);
+ input_f=NULL;
+ }
+ DO_SYSLOG((LOG_INFO, "%s/%s: got ZSKIP",
+ shortname, protname()));
+ return ZSKIP;
+ case ZACK:
+ case ZRPOS:
+ break;
+ case ZRINIT:
+ return OK;
+ }
+#ifdef READCHECK
+ /*
+ * If the reverse channel can be tested for data,
+ * this logic may be used to detect error packets
+ * sent by the receiver, in place of setjmp/longjmp
+ * rdchk(fdes) returns non 0 if a character is available
+ */
+ while (rdchk (io_mode_fd)) {
+#ifdef READCHECK_READS
+ switch (checked)
+#else
+ switch (READLINE_PF (1))
+#endif
+ {
+ case CAN:
+ case ZPAD:
+ c = getinsync (zi, 1);
+ goto gotack;
+ case XOFF: /* Wait a while for an XON */
+ case XOFF | 0200:
+ READLINE_PF (100);
+ }
+ }
+#endif
+ }
+
+ newcnt = Rxbuflen;
+ Txwcnt = 0;
+ stohdr (zi->bytes_sent);
+ zsbhdr (ZDATA, Txhdr);
+
+ do {
+ size_t n;
+ int e;
+ unsigned old = blklen;
+ blklen = calc_blklen (total_sent);
+ total_sent += blklen + OVERHEAD;
+ if (Verbose > 2 && blklen != old)
+ vstringf (_("blklen now %d\n"), blklen);
+#ifdef HAVE_MMAP
+ if (mm_addr) {
+ if (zi->bytes_sent + blklen < mm_size)
+ n = blklen;
+ else {
+ n = mm_size - zi->bytes_sent;
+ zi->eof_seen = 1;
+ }
+ } else
+#endif
+ n = zfilbuf (zi);
+ if (zi->eof_seen) {
+ e = ZCRCE;
+ if (Verbose>3)
+ vstring("e=ZCRCE/eof seen");
+ } else if (junkcount > 3) {
+ e = ZCRCW;
+ if (Verbose>3)
+ vstring("e=ZCRCW/junkcount > 3");
+ } else if (bytcnt == Lastsync) {
+ e = ZCRCW;
+ if (Verbose>3)
+ vstringf("e=ZCRCW/bytcnt == Lastsync == %ld",
+ (unsigned long) Lastsync);
+#if 0
+ /* what is this good for? Rxbuflen/newcnt normally are short - so after
+ * a few KB ZCRCW will be used? (newcnt is never incremented)
+ */
+ } else if (Rxbuflen && (newcnt -= n) <= 0) {
+ e = ZCRCW;
+ if (Verbose>3)
+ vstringf("e=ZCRCW/Rxbuflen(newcnt=%ld,n=%ld)",
+ (unsigned long) newcnt,(unsigned long) n);
+#endif
+ } else if (Txwindow && (Txwcnt += n) >= Txwspac) {
+ Txwcnt = 0;
+ e = ZCRCQ;
+ if (Verbose>3)
+ vstring("e=ZCRCQ/Window");
+ } else {
+ e = ZCRCG;
+ if (Verbose>3)
+ vstring("e=ZCRCG");
+ }
+ if ((Verbose > 1 || min_bps || stop_time)
+ && (not_printed > (min_bps ? 3 : 7)
+ || zi->bytes_sent > last_bps / 2 + last_txpos)) {
+ int minleft = 0;
+ int secleft = 0;
+ time_t now;
+ last_bps = (zi->bytes_sent / timing (0,&now));
+ if (last_bps > 0) {
+ minleft = (zi->bytes_total - zi->bytes_sent) / last_bps / 60;
+ secleft = ((zi->bytes_total - zi->bytes_sent) / last_bps) % 60;
+ }
+ if (min_bps) {
+ if (low_bps) {
+ if (last_bps<min_bps) {
+ if (now-low_bps>=min_bps_time) {
+ /* too bad */
+ if (Verbose) {
+ vstringf(_("zsendfdata: bps rate %ld below min %ld"),
+ last_bps, min_bps);
+ vstring("\r\n");
+ }
+ DO_SYSLOG((LOG_INFO, "%s/%s: bps rate low: %ld <%ld",
+ shortname, protname(), last_bps, min_bps));
+ return ERROR;
+ }
+ } else
+ low_bps=0;
+ } else if (last_bps < min_bps) {
+ low_bps=now;
+ }
+ }
+ if (stop_time && now>=stop_time) {
+ /* too bad */
+ if (Verbose) {
+ vstring(_("zsendfdata: reached stop time"));
+ vstring("\r\n");
+ }
+ DO_SYSLOG((LOG_INFO, "%s/%s: reached stop time",
+ shortname, protname()));
+ return ERROR;
+ }
+
+ if (Verbose > 1) {
+ vchar ('\r');
+ vstringf (_("Bytes Sent:%7ld/%7ld BPS:%-8ld ETA %02d:%02d "),
+ (long) zi->bytes_sent, (long) zi->bytes_total,
+ last_bps, minleft, secleft);
+ }
+ last_txpos = zi->bytes_sent;
+ } else if (Verbose)
+ not_printed++;
+ ZSDATA (DATAADR, n, e);
+ bytcnt = zi->bytes_sent += n;
+ if (e == ZCRCW)
+ goto waitack;
+#ifdef READCHECK
+ /*
+ * If the reverse channel can be tested for data,
+ * this logic may be used to detect error packets
+ * sent by the receiver, in place of setjmp/longjmp
+ * rdchk(fdes) returns non 0 if a character is available
+ */
+ fflush (stdout);
+ while (rdchk (io_mode_fd)) {
+#ifdef READCHECK_READS
+ switch (checked)
+#else
+ switch (READLINE_PF (1))
+#endif
+ {
+ case CAN:
+ case ZPAD:
+ c = getinsync (zi, 1);
+ if (c == ZACK)
+ break;
+ /* zcrce - dinna wanna starta ping-pong game */
+ ZSDATA (txbuf, 0, ZCRCE);
+ goto gotack;
+ case XOFF: /* Wait a while for an XON */
+ case XOFF | 0200:
+ READLINE_PF (100);
+ default:
+ ++junkcount;
+ }
+ }
+#endif /* READCHECK */
+ if (Txwindow) {
+ size_t tcount = 0;
+ while ((tcount = zi->bytes_sent - Lrxpos) >= Txwindow) {
+ vfile ("%ld (%ld,%ld) window >= %u", tcount,
+ (long) zi->bytes_sent, (long) Lrxpos,
+ Txwindow);
+ if (e != ZCRCQ)
+ ZSDATA (txbuf, 0, e = ZCRCQ);
+ c = getinsync (zi, 1);
+ if (c != ZACK) {
+ ZSDATA (txbuf, 0, ZCRCE);
+ goto gotack;
+ }
+ }
+ vfile ("window = %ld", tcount);
+ }
+ } while (!zi->eof_seen);
+
+
+ if (play_with_sigint)
+ signal (SIGINT, SIG_IGN);
+
+ for (;;) {
+ stohdr (zi->bytes_sent);
+ zsbhdr (ZEOF, Txhdr);
+ switch (getinsync (zi, 0)) {
+ case ZACK:
+ continue;
+ case ZRPOS:
+ goto somemore;
+ case ZRINIT:
+ return OK;
+ case ZSKIP:
+ if (input_f) {
+ fclose (input_f);
+ input_f=NULL;
+ }
+ DO_SYSLOG((LOG_INFO, "%s/%s: got ZSKIP",
+ shortname, protname()));
+ return c;
+ default:
+ if (input_f) {
+ fclose (input_f);
+ input_f=NULL;
+ }
+ DO_SYSLOG((LOG_INFO, "%s/%s: got %d",
+ shortname, protname(), c));
+ return ERROR;
+ }
+ }
+}
+
+static int
+calc_blklen(long total_sent)
+{
+ static long total_bytes=0;
+ static int calcs_done=0;
+ static long last_error_count=0;
+ static int last_blklen=0;
+ static long last_bytes_per_error=0;
+ unsigned long best_bytes=0;
+ long best_size=0;
+ long this_bytes_per_error;
+ long d;
+ unsigned int i;
+ if (total_bytes==0)
+ {
+ /* called from countem */
+ total_bytes=total_sent;
+ return 0;
+ }
+
+ /* it's not good to calc blklen too early */
+ if (calcs_done++ < 5) {
+ if (error_count && start_blklen >1024)
+ return last_blklen=1024;
+ else
+ last_blklen/=2;
+ return last_blklen=start_blklen;
+ }
+
+ if (!error_count) {
+ /* that's fine */
+ if (start_blklen==max_blklen)
+ return start_blklen;
+ this_bytes_per_error=LONG_MAX;
+ goto calcit;
+ }
+
+ if (error_count!=last_error_count) {
+ /* the last block was bad. shorten blocks until one block is
+ * ok. this is because very often many errors come in an
+ * short period */
+ if (error_count & 2)
+ {
+ last_blklen/=2;
+ if (last_blklen < 32)
+ last_blklen = 32;
+ else if (last_blklen > 512)
+ last_blklen=512;
+ if (Verbose > 3)
+ vstringf(_("calc_blklen: reduced to %d due to error\n"),
+ last_blklen);
+ }
+ last_error_count=error_count;
+ last_bytes_per_error=0; /* force recalc */
+ return last_blklen;
+ }
+
+ this_bytes_per_error=total_sent / error_count;
+ /* we do not get told about every error, because
+ * there may be more than one error per failed block.
+ * but one the other hand some errors are reported more
+ * than once: If a modem buffers more than one block we
+ * get at least two ZRPOS for the same position in case
+ * *one* block has to be resent.
+ * so don't do this:
+ * this_bytes_per_error/=2;
+ */
+ /* there has to be a margin */
+ if (this_bytes_per_error<100)
+ this_bytes_per_error=100;
+
+ /* be nice to the poor machine and do the complicated things not
+ * too often
+ */
+ if (last_bytes_per_error>this_bytes_per_error)
+ d=last_bytes_per_error-this_bytes_per_error;
+ else
+ d=this_bytes_per_error-last_bytes_per_error;
+ if (d<4)
+ {
+ if (Verbose > 3)
+ {
+ vstringf(_("calc_blklen: returned old value %d due to low bpe diff\n"),
+ last_blklen);
+ vstringf(_("calc_blklen: old %ld, new %ld, d %ld\n"),
+ last_bytes_per_error,this_bytes_per_error,d );
+ }
+ return last_blklen;
+ }
+ last_bytes_per_error=this_bytes_per_error;
+
+calcit:
+ if (Verbose > 3)
+ vstringf(_("calc_blklen: calc total_bytes=%ld, bpe=%ld, ec=%ld\n"),
+ total_bytes,this_bytes_per_error,(long) error_count);
+ for (i=32;i<=max_blklen;i*=2) {
+ long ok; /* some many ok blocks do we need */
+ long failed; /* and that's the number of blocks not transmitted ok */
+ unsigned long transmitted;
+ ok=total_bytes / i + 1;
+ failed=((long) i + OVERHEAD) * ok / this_bytes_per_error;
+ transmitted=total_bytes + ok * OVERHEAD
+ + failed * ((long) i+OVERHEAD+OVER_ERR);
+ if (Verbose > 4)
+ vstringf(_("calc_blklen: blklen %d, ok %ld, failed %ld -> %lu\n"),
+ i,ok,failed,transmitted);
+ if (transmitted < best_bytes || !best_bytes)
+ {
+ best_bytes=transmitted;
+ best_size=i;
+ }
+ }
+ if (best_size > 2*last_blklen)
+ best_size=2*last_blklen;
+ last_blklen=best_size;
+ if (Verbose > 3)
+ vstringf(_("calc_blklen: returned %d as best\n"),
+ last_blklen);
+ return last_blklen;
+}
+
+/*
+ * Respond to receiver's complaint, get back in sync with receiver
+ */
+static int
+getinsync(struct zm_fileinfo *zi, int flag)
+{
+ size_t rxpos;
+
+ for (;;) {
+ int gotblock;
+ gotblock = zgethdr(Rxhdr, 0, &rxpos);
+ switch (gotblock) {
+ case ZCAN:
+ case ZABORT:
+ case ZFIN:
+ case TIMEOUT:
+ return ERROR;
+ case ZRPOS:
+ /* ************************************* */
+ /* If sending to a buffered modem, you */
+ /* might send a break at this point to */
+ /* dump the modem's buffer. */
+ if (input_f)
+ clearerr(input_f); /* In case file EOF seen */
+#ifdef HAVE_MMAP
+ if (!mm_addr)
+#endif
+ if (fseek(input_f, (long) rxpos, 0))
+ return ERROR;
+ zi->eof_seen = 0;
+ bytcnt = Lrxpos = zi->bytes_sent = rxpos;
+ if (Lastsync == rxpos) {
+ error_count++;
+ }
+ Lastsync = rxpos;
+ return ZRPOS;
+ case ZACK:
+ Lrxpos = rxpos;
+ if (flag || zi->bytes_sent == rxpos)
+ return ZACK;
+ continue;
+ case ZRINIT:
+ case ZSKIP:
+ if (input_f) {
+ fclose (input_f);
+ input_f=NULL;
+ }
+#ifdef HAVE_MMAP
+ else if (mm_addr) {
+ munmap(mm_addr,mm_size);
+ mm_addr=NULL;
+ }
+#endif
+ return ZSKIP;
+ case ERROR:
+ default:
+ error_count++;
+ zsbhdr(ZNAK, Txhdr);
+ continue;
+ }
+ }
+}
+
+
+/* Say "bibi" to the receiver, try to do it cleanly */
+static void
+saybibi(void)
+{
+ for (;;) {
+ stohdr(0L); /* CAF Was zsbhdr - minor change */
+ zshhdr(ZFIN, Txhdr); /* to make debugging easier */
+ switch (zgethdr(Rxhdr, 0,NULL)) {
+ case ZFIN:
+ sendline('O');
+ sendline('O');
+ flushmo();
+ case ZCAN:
+ case TIMEOUT:
+ return;
+ }
+ }
+}
+
+/* Send command and related info */
+static int
+zsendcmd(const char *buf, size_t blen)
+{
+ int c;
+ pid_t cmdnum;
+ size_t rxpos;
+
+ cmdnum = getpid();
+ errors = 0;
+ for (;;) {
+ stohdr((size_t) cmdnum);
+ Txhdr[ZF0] = Cmdack1;
+ zsbhdr(ZCOMMAND, Txhdr);
+ ZSDATA(buf, blen, ZCRCW);
+listen:
+ Rxtimeout = 100; /* Ten second wait for resp. */
+ c = zgethdr(Rxhdr, 1, &rxpos);
+
+ switch (c) {
+ case ZRINIT:
+ goto listen; /* CAF 8-21-87 */
+ case ERROR:
+ case TIMEOUT:
+ if (++errors > Cmdtries)
+ return ERROR;
+ continue;
+ case ZCAN:
+ case ZABORT:
+ case ZFIN:
+ case ZSKIP:
+ case ZRPOS:
+ return ERROR;
+ default:
+ if (++errors > 20)
+ return ERROR;
+ continue;
+ case ZCOMPL:
+ Exitcode = rxpos;
+ saybibi();
+ return OK;
+ case ZRQINIT:
+ vfile("******** RZ *******");
+ system("rz");
+ vfile("******** SZ *******");
+ goto listen;
+ }
+ }
+}
+
+/*
+ * If called as lsb use YMODEM protocol
+ */
+static void
+chkinvok (const char *s)
+{
+ const char *p;
+
+ p = s;
+ while (*p == '-')
+ s = ++p;
+ while (*p)
+ if (*p++ == '/')
+ s = p;
+ if (*s == 'v') {
+ Verbose = 1;
+ ++s;
+ }
+ program_name = s;
+ if (*s == 'l')
+ s++; /* lsz -> sz */
+ protocol = ZM_ZMODEM;
+ if (s[0] == 's' && s[1] == 'x')
+ protocol = ZM_XMODEM;
+ if (s[0] == 's' && (s[1] == 'b' || s[1] == 'y')) {
+ protocol = ZM_YMODEM;
+ }
+}
+
+static void
+countem (int argc, char **argv)
+{
+ struct stat f;
+
+ for (Totalleft = 0, Filesleft = 0; --argc >= 0; ++argv) {
+ f.st_size = -1;
+ if (Verbose > 2) {
+ vstringf ("\nCountem: %03d %s ", argc, *argv);
+ }
+ if (access (*argv, R_OK) >= 0 && stat (*argv, &f) >= 0) {
+#if defined(S_ISDIR)
+ if (!S_ISDIR(f.st_mode) && !S_ISBLK(f.st_mode)) {
+#else
+ int c;
+ c = f.st_mode & S_IFMT;
+ if (c != S_IFDIR && c != S_IFBLK) {
+#endif
+ ++Filesleft;
+ Totalleft += f.st_size;
+ }
+ } else if (strcmp (*argv, "-") == 0) {
+ ++Filesleft;
+ Totalleft += DEFBYTL;
+ }
+ if (Verbose > 2)
+ vstringf (" %ld", (long) f.st_size);
+ }
+ if (Verbose > 2)
+ vstringf (_("\ncountem: Total %d %ld\n"),
+ Filesleft, Totalleft);
+ calc_blklen (Totalleft);
+}
+
+/* End of lsz.c */
+
+
diff --git a/src/protname.c b/src/protname.c
new file mode 100644
index 0000000..c33657a
--- /dev/null
+++ b/src/protname.c
@@ -0,0 +1,41 @@
+/*
+ protname.c - return the name of the protocol used
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+*/
+#include "zglobal.h"
+
+/* this code was duplicate in lrz.c and lsz.c */
+
+const char *
+protname(void)
+{
+ const char *prot_name;
+ switch(protocol) {
+ case ZM_XMODEM:
+ prot_name="XMODEM";
+ break;
+ case ZM_YMODEM:
+ prot_name="YMODEM";
+ break;
+ default:
+ prot_name="ZMODEM";
+ break;
+ }
+ return prot_name;
+}
diff --git a/src/rbsb.c b/src/rbsb.c
new file mode 100644
index 0000000..88b977c
--- /dev/null
+++ b/src/rbsb.c
@@ -0,0 +1,506 @@
+/*
+ rbsb.c - terminal handling stuff for lrzsz
+ Copyright (C) until 1988 Chuck Forsberg (Omen Technology INC)
+ Copyright (C) 1994 Matt Porter, Michael D. Black
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ originally written by Chuck Forsberg
+*/
+
+/*
+ * Rev 05-05-1988
+ * ============== (not quite, but originated there :-). -- uwe
+ */
+#include "zglobal.h"
+
+#include <stdio.h>
+#include <errno.h>
+
+#ifndef HAVE_ERRNO_DECLARATION
+extern int errno;
+#endif
+
+#ifdef USE_SGTTY
+# ifdef LLITOUT
+long Locmode; /* Saved "local mode" for 4.x BSD "new driver" */
+long Locbit = LLITOUT; /* Bit SUPPOSED to disable output translations */
+# endif
+#endif
+
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#ifdef MAJOR_IN_MKDEV
+#include <sys/mkdev.h>
+#else
+# ifdef MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+# endif
+#endif
+
+#if defined(HOWMANY) && HOWMANY > 255
+#ifndef NFGVMIN
+Howmany must be 255 or less
+#endif
+#endif
+
+static struct {
+ unsigned baudr;
+ speed_t speedcode;
+} speeds[] = {
+ {110, B110},
+ {300, B300},
+ {600, B600},
+ {1200, B1200},
+ {2400, B2400},
+ {4800, B4800},
+ {9600, B9600},
+#ifdef B19200
+ {19200, B19200},
+#endif
+#ifdef B38400
+ {38400, B38400},
+#endif
+#ifdef B57600
+ {57600, B57600},
+#endif
+#ifdef B115200
+ {115200, B115200},
+#endif
+#ifdef B230400
+ {230400, B230400},
+#endif
+#ifdef B460800
+ {460800, B460800},
+#endif
+#ifdef EXTA
+ {19200, EXTA},
+#endif
+#ifdef EXTB
+ {38400, EXTB},
+#endif
+ {0, 0}
+};
+
+static unsigned getspeed __P((speed_t));
+
+static unsigned
+getspeed(speed_t code)
+{
+ int n;
+ for (n=0; speeds[n].baudr; ++n)
+ if (speeds[n].speedcode == code)
+ return speeds[n].baudr;
+ return 38400; /* Assume fifo if ioctl failed */
+}
+
+/*
+ * return 1 if stdout and stderr are different devices
+ * indicating this program operating with a modem on a
+ * different line
+ */
+int Fromcu; /* Were called from cu or yam */
+int
+from_cu(void)
+{
+#ifdef HAVE_ST_RDEV
+ struct stat a, b;
+#if defined(makedev)
+ dev_t help=makedev(0,0);
+#else
+ int help=0;
+#endif
+
+ /* in case fstat fails */
+ a.st_rdev=b.st_rdev=a.st_dev=b.st_dev=help;
+
+ fstat(1, &a); fstat(2, &b);
+
+#if defined(major) && defined(minor)
+ if (major(a.st_rdev) != major(b.st_rdev)
+ || minor(a.st_rdev) != minor(b.st_rdev))
+ Fromcu=1;
+ else if (major(a.st_dev) != major(b.st_dev)
+ || minor(a.st_dev) != minor(b.st_dev))
+ Fromcu=1;
+ else
+ Fromcu=0;
+#else
+ Fromcu = (a.st_rdev != b.st_rdev) || (a.st_dev != b.st_dev);
+#endif
+#else
+ Fromcu = 1; /* a bad guess .. */
+#endif
+ return Fromcu;
+}
+
+
+
+int Twostop; /* Use two stop bits */
+
+
+#ifdef READCHECK_FIONREAD
+/*
+ * Return non 0 if something to read from io descriptor f
+ */
+int
+rdchk(int fd)
+{
+ static long lf;
+
+ ioctl(fd, FIONREAD, &lf);
+ return ((int) lf);
+}
+#endif
+
+#ifdef READCHECK_GETFL
+unsigned char checked = '\0' ;
+/*
+ * Nonblocking I/O is a bit different in System V, Release 2
+ */
+int
+rdchk(int fd)
+{
+ int lf, savestat;
+
+ savestat = fcntl(fd, F_GETFL) ;
+ if (savestat == -1)
+ return 0;
+#ifdef OVERLY_PARANOID
+ if (-1==fcntl(fd, F_SETFL, savestat | O_NDELAY))
+ return 0;
+ lf = read(fd, &checked, 1) ;
+ if (-1==fcntl(fd, F_SETFL, savestat)) {
+#ifdef ENABLE_SYSLOG
+ if (enable_syslog)
+ lsyslog(LOG_CRIT,"F_SETFL failed in rdchk(): %s",
+ strerror(errno));
+#endif
+ zpfatal("rdchk: F_SETFL failed\n"); /* lose */
+ /* there is really no way to recover. And we can't tell
+ * the other side what's going on if we can't write to
+ * fd, but we try.
+ */
+ canit(fd);
+ exit(1);
+ }
+#else
+ fcntl(fd, F_SETFL, savestat | O_NDELAY);
+ lf = read(fd, &checked, 1) ;
+ fcntl(fd, F_SETFL, savestat);
+#endif
+ return(lf == -1 && errno==EWOULDBLOCK ? 0 : lf) ;
+}
+#endif
+
+
+
+
+
+#ifdef USE_TERMIOS
+struct termios oldtty, tty;
+#else
+# if defined(USE_TERMIO)
+struct termio oldtty, tty;
+# else
+struct sgttyb oldtty, tty;
+struct tchars oldtch, tch;
+# endif
+#endif
+
+
+/*
+ * mode(n)
+ * 3: save old tty stat, set raw mode with flow control
+ * 2: set XON/XOFF for sb/sz with ZMODEM or YMODEM-g
+ * 1: save old tty stat, set raw mode
+ * 0: restore original tty mode
+ */
+int
+io_mode(int fd, int n)
+{
+ static int did0 = FALSE;
+
+ vfile("mode:%d", n);
+
+ switch(n) {
+
+#ifdef USE_TERMIOS
+ case 2: /* Un-raw mode used by sz, sb when -g detected */
+ if(!did0) {
+ did0 = TRUE;
+ tcgetattr(fd,&oldtty);
+ }
+ tty = oldtty;
+
+ tty.c_iflag = BRKINT|IXON;
+
+ tty.c_oflag = 0; /* Transparent output */
+
+ tty.c_cflag &= ~PARENB; /* Disable parity */
+ tty.c_cflag |= CS8; /* Set character size = 8 */
+ if (Twostop)
+ tty.c_cflag |= CSTOPB; /* Set two stop bits */
+
+#ifdef READCHECK
+ tty.c_lflag = protocol==ZM_ZMODEM ? 0 : ISIG;
+ tty.c_cc[VINTR] = protocol==ZM_ZMODEM ? -1 : 030; /* Interrupt char */
+#else
+ tty.c_lflag = 0;
+ tty.c_cc[VINTR] = protocol==ZM_ZMODEM ? 03 : 030; /* Interrupt char */
+#endif
+#ifdef _POSIX_VDISABLE
+ if (((int) _POSIX_VDISABLE)!=(-1)) {
+ tty.c_cc[VQUIT] = _POSIX_VDISABLE; /* Quit char */
+ } else {
+ tty.c_cc[VQUIT] = -1; /* Quit char */
+ }
+#else
+ tty.c_cc[VQUIT] = -1; /* Quit char */
+#endif
+#ifdef NFGVMIN
+ tty.c_cc[VMIN] = 1;
+#else
+ tty.c_cc[VMIN] = 3; /* This many chars satisfies reads */
+#endif
+ tty.c_cc[VTIME] = 1; /* or in this many tenths of seconds */
+
+ tcsetattr(fd,TCSADRAIN,&tty);
+
+ return OK;
+ case 1:
+ case 3:
+ if(!did0) {
+ did0 = TRUE;
+ tcgetattr(fd,&oldtty);
+ }
+ tty = oldtty;
+
+ tty.c_iflag = IGNBRK;
+ if (n==3) /* with flow control */
+ tty.c_iflag |= IXOFF;
+
+ /* Setup raw mode: no echo, noncanonical (no edit chars),
+ * no signal generating chars, and no extended chars (^V,
+ * ^O, ^R, ^W).
+ */
+ tty.c_lflag &= ~(ECHO | ICANON | ISIG | IEXTEN);
+ tty.c_oflag = 0; /* Transparent output */
+
+ tty.c_cflag &= ~(PARENB); /* Same baud rate, disable parity */
+ /* Set character size = 8 */
+ tty.c_cflag &= ~(CSIZE);
+ tty.c_cflag |= CS8;
+ if (Twostop)
+ tty.c_cflag |= CSTOPB; /* Set two stop bits */
+#ifdef NFGVMIN
+ tty.c_cc[VMIN] = 1; /* This many chars satisfies reads */
+#else
+ tty.c_cc[VMIN] = HOWMANY; /* This many chars satisfies reads */
+#endif
+ tty.c_cc[VTIME] = 1; /* or in this many tenths of seconds */
+ tcsetattr(fd,TCSADRAIN,&tty);
+ Baudrate = getspeed(cfgetospeed(&tty));
+ return OK;
+ case 0:
+ if(!did0)
+ return ERROR;
+ tcdrain (fd); /* wait until everything is sent */
+ tcflush (fd,TCIOFLUSH); /* flush input queue */
+ tcsetattr (fd,TCSADRAIN,&oldtty);
+ tcflow (fd,TCOON); /* restart output */
+
+ return OK;
+#endif
+
+#ifdef USE_TERMIO
+ case 2: /* Un-raw mode used by sz, sb when -g detected */
+ if(!did0)
+ (void) ioctl(fd, TCGETA, &oldtty);
+ tty = oldtty;
+
+ tty.c_iflag = BRKINT|IXON;
+
+ tty.c_oflag = 0; /* Transparent output */
+
+ tty.c_cflag &= ~PARENB; /* Disable parity */
+ tty.c_cflag |= CS8; /* Set character size = 8 */
+ if (Twostop)
+ tty.c_cflag |= CSTOPB; /* Set two stop bits */
+
+
+#ifdef READCHECK
+ tty.c_lflag = protocol==ZM_ZMODEM ? 0 : ISIG;
+ tty.c_cc[VINTR] = protocol==ZM_ZMODEM ? -1 : 030; /* Interrupt char */
+#else
+ tty.c_lflag = 0;
+ tty.c_cc[VINTR] = protocol==ZM_ZMODEM ? 03 : 030; /* Interrupt char */
+#endif
+ tty.c_cc[VQUIT] = -1; /* Quit char */
+#ifdef NFGVMIN
+ tty.c_cc[VMIN] = 1;
+#else
+ tty.c_cc[VMIN] = 3; /* This many chars satisfies reads */
+#endif
+ tty.c_cc[VTIME] = 1; /* or in this many tenths of seconds */
+
+ (void) ioctl(fd, TCSETAW, &tty);
+ did0 = TRUE;
+ return OK;
+ case 1:
+ case 3:
+ if(!did0)
+ (void) ioctl(fd, TCGETA, &oldtty);
+ tty = oldtty;
+
+ tty.c_iflag = n==3 ? (IGNBRK|IXOFF) : IGNBRK;
+
+ /* No echo, crlf mapping, delays, no erase/kill */
+ tty.c_lflag &= ~(ECHO | ICANON | ISIG);
+
+ tty.c_oflag = 0; /* Transparent output */
+
+ tty.c_cflag &= ~PARENB; /* Same baud rate, disable parity */
+ tty.c_cflag |= CS8; /* Set character size = 8 */
+ if (Twostop)
+ tty.c_cflag |= CSTOPB; /* Set two stop bits */
+#ifdef NFGVMIN
+ tty.c_cc[VMIN] = 1; /* This many chars satisfies reads */
+#else
+ tty.c_cc[VMIN] = HOWMANY; /* This many chars satisfies reads */
+#endif
+ tty.c_cc[VTIME] = 1; /* or in this many tenths of seconds */
+ (void) ioctl(fd, TCSETAW, &tty);
+ did0 = TRUE;
+ Baudrate = getspeed(tty.c_cflag & CBAUD);
+ return OK;
+ case 0:
+ if(!did0)
+ return ERROR;
+ (void) ioctl(fd, TCSBRK, 1); /* Wait for output to drain */
+ (void) ioctl(fd, TCFLSH, 0); /* Flush input queue */
+ (void) ioctl(fd, TCSETAW, &oldtty); /* Restore modes */
+ (void) ioctl(fd, TCXONC,1); /* Restart output */
+ return OK;
+#endif
+
+
+#ifdef USE_SGTTY
+ /*
+ * NOTE: this should transmit all 8 bits and at the same time
+ * respond to XOFF/XON flow control. If no FIONREAD or other
+ * READCHECK alternative, also must respond to INTRRUPT char
+ * This doesn't work with V7. It should work with LLITOUT,
+ * but LLITOUT was broken on the machine I tried it on.
+ */
+ case 2: /* Un-raw mode used by sz, sb when -g detected */
+ if(!did0) {
+ ioctl(fd, TIOCEXCL, 0);
+ ioctl(fd, TIOCGETP, &oldtty);
+ ioctl(fd, TIOCGETC, &oldtch);
+#ifdef LLITOUT
+ ioctl(fd, TIOCLGET, &Locmode);
+#endif
+ }
+ tty = oldtty;
+ tch = oldtch;
+#ifdef READCHECK
+ tch.t_intrc = Zmodem ? -1:030; /* Interrupt char */
+#else
+ tch.t_intrc = Zmodem ? 03:030; /* Interrupt char */
+#endif
+ tty.sg_flags |= (ODDP|EVENP|CBREAK);
+ tty.sg_flags &= ~(ALLDELAY|CRMOD|ECHO|LCASE);
+ ioctl(fd, TIOCSETP, &tty);
+ ioctl(fd, TIOCSETC, &tch);
+#ifdef LLITOUT
+ ioctl(fd, TIOCLBIS, &Locbit);
+#else
+ bibi(99); /* un-raw doesn't work w/o lit out */
+#endif
+ did0 = TRUE;
+ return OK;
+ case 1:
+ case 3:
+ if(!did0) {
+ ioctl(fd, TIOCEXCL, 0);
+ ioctl(fd, TIOCGETP, &oldtty);
+ ioctl(fd, TIOCGETC, &oldtch);
+#ifdef LLITOUT
+ ioctl(fd, TIOCLGET, &Locmode);
+#endif
+ }
+ tty = oldtty;
+ tty.sg_flags |= RAW;
+ tty.sg_flags &= ~ECHO;
+ ioctl(fd, TIOCSETP, &tty);
+ did0 = TRUE;
+ Baudrate = getspeed(tty.sg_ospeed);
+ return OK;
+ case 0:
+ if(!did0)
+ return ERROR;
+ ioctl(fd, TIOCSETP, &oldtty);
+ ioctl(fd, TIOCSETC, &oldtch);
+ ioctl(fd, TIOCNXCL, 0);
+#ifdef LLITOUT
+ ioctl(fd, TIOCLSET, &Locmode);
+#endif
+#ifdef TIOCFLUSH
+ { int x=1; ioctl(fd,TIOCFLUSH,&x); }
+#endif
+#endif
+
+ return OK;
+ default:
+ return ERROR;
+ }
+}
+
+void
+sendbrk(int fd)
+{
+#ifdef USE_TERMIOS
+ tcsendbreak(fd,0);
+#endif
+#ifdef USE_TERMIO
+ ioctl(fd, TCSBRK, 0);
+#endif
+#ifdef USE_SGTTY
+#ifdef TIOCSBRK
+ sleep(1);
+ ioctl(fd, TIOCSBRK, 0);
+ sleep(1);
+ ioctl(fd, TIOCCBRK, 0);
+#endif
+#endif
+}
+
+void
+purgeline(int fd)
+{
+ readline_purge();
+#ifdef TCFLSH
+ ioctl(fd, TCFLSH, 0);
+#else
+ lseek(fd, 0L, 2);
+#endif
+}
+
+/* End of rbsb.c */
diff --git a/src/tcp.c b/src/tcp.c
new file mode 100644
index 0000000..7e1ba3f
--- /dev/null
+++ b/src/tcp.c
@@ -0,0 +1,169 @@
+/*
+ tcp.c - tcp handling for lrzsz
+ Copyright (C) 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ originally written by Uwe Ohse
+*/
+
+#include "config.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#include <errno.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <signal.h>
+
+#include "zglobal.h"
+#include <stdlib.h>
+#include "error.h"
+
+static RETSIGTYPE
+tcp_alarm_handler(int dummy)
+{
+ dummy++; /* doesn't need to do anything */
+}
+
+
+/* server/lsz:
+ * Get a TCP socket, bind it, listen, figure out the port,
+ * and build the magic string for lrz in "buf".
+ */
+int
+tcp_server (char *buf)
+{
+ int sock;
+ struct sockaddr_in s;
+ struct sockaddr_in t;
+ int on=1;
+ socklen_t len;
+
+ if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
+ error(1,errno,"socket");
+ }
+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof (on)) < 0) {
+ error(1,errno,"setsockopt (reuse address)");
+ }
+ memset (&s, 0, sizeof (s));
+ s.sin_family = AF_INET;
+ s.sin_port=0; /* let system fill it in */
+ s.sin_addr.s_addr=htonl(INADDR_ANY);
+ if (bind(sock, (struct sockaddr *)&s, sizeof (s)) < 0) {
+ error(1,errno,"bind");
+ }
+ len=sizeof(t);
+ if (getsockname (sock, (struct sockaddr *) &t, &len)) {
+ error(1,errno,"getsockname");
+ }
+ sprintf(buf,"[%s] <%d>\n",inet_ntoa(t.sin_addr),ntohs(t.sin_port));
+
+ if (listen(sock, 1) < 0) {
+ error(1,errno,"listen");
+ }
+ getsockname (sock, (struct sockaddr *) &t, &len);
+
+ return (sock);
+}
+
+/* server/lsz: accept a connection */
+int
+tcp_accept (int d)
+{
+ int so;
+ struct sockaddr_in s;
+ socklen_t namelen;
+ int num=0;
+
+ namelen = sizeof(s);
+ memset((char*)&s,0, namelen);
+
+retry:
+ signal(SIGALRM, tcp_alarm_handler);
+ alarm(30);
+ if ((so = accept(d, (struct sockaddr*)&s, &namelen)) < 0) {
+ if (errno == EINTR) {
+ if (++num<=5)
+ goto retry;
+ }
+ error(1,errno,"accept");
+ }
+ alarm(0);
+ return so;
+}
+
+/* client/lrz:
+ * "Connect" to the TCP socket decribed in "buf" and
+ * return the connected socket.
+ */
+int
+tcp_connect (char *buf)
+{
+ int sock;
+ struct sockaddr_in s_in;
+ char *p;
+ char *q;
+
+ memset(&s_in,0,sizeof(s_in));
+ s_in.sin_family = AF_INET;
+
+ /* i _really_ distrust scanf & co. Or maybe i distrust bad input */
+ if (*buf!='[') {
+ error(1,0,_("tcp_connect: illegal format1\n"));
+ }
+ p=strchr(buf+1,']');
+ if (!p) {
+ error(1,0,_("tcp_connect: illegal format2\n"));
+ }
+ *p++=0;
+ s_in.sin_addr.s_addr=inet_addr(buf+1);
+#ifndef INADDR_NONE
+#define INADDR_NONE (-1)
+#endif
+ if (s_in.sin_addr.s_addr== (unsigned long) INADDR_NONE) {
+ struct hostent *h=gethostbyname(buf+1);
+ if (!h)
+ error(1,0,_("tcp_connect: illegal format3\n"));
+ memcpy(& s_in.sin_addr.s_addr,h->h_addr,h->h_length);
+ }
+ while (isspace((unsigned char)(*p)))
+ p++;
+ if (*p!='<') {
+ error(1,0,_("tcp_connect: illegal format4\n"));
+ }
+ q=strchr(p+1,'>');
+ if (!q)
+ error(1,0,_("tcp_connect: illegal format5\n"));
+ s_in.sin_port = htons(strtol(p+1,NULL,10));
+
+ if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
+ error(1,errno,"socket");
+ }
+
+ signal(SIGALRM, tcp_alarm_handler);
+ alarm(30);
+ if (connect (sock, (struct sockaddr *) &s_in, sizeof (s_in)) < 0) {
+ error(1,errno,"connect");
+ }
+ alarm(0);
+ return (sock);
+}
diff --git a/src/timing.c b/src/timing.c
new file mode 100644
index 0000000..d776fc7
--- /dev/null
+++ b/src/timing.c
@@ -0,0 +1,186 @@
+/*
+ timing.c - Timing routines for computing elapsed wall time
+ Copyright (C) 1994 Michael D. Black
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ originally written by Michael D. Black, mblack@csihq.com
+*/
+
+#include "zglobal.h"
+
+#include "timing.h"
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#if !defined(TIME_WITH_SYS_TIME) && !defined(HAVE_SYS_TIME_H)
+ /* can't use gettimeofday without struct timeval */
+# undef HAVE_GETTIMEOFDAY
+#endif
+
+/* Prefer gettimeofday to ftime to times. */
+#if defined(HAVE_GETTIMEOFDAY)
+# undef HAVE_FTIME
+# undef HAVE_TIMES
+#else
+# if defined(HAVE_FTIME)
+# undef HAVE_TIMES
+# endif
+#endif
+
+#ifdef HAVE_FTIME
+# include <sys/timeb.h>
+#endif
+
+#ifdef HAVE_TIMES
+# if HAVE_SYS_TIMES_H
+# include <sys/times.h>
+# endif
+# ifdef _SC_CLK_TCK
+# define HAVE_SC_CLK_TCK 1
+# else
+# define HAVE_SC_CLK_TCK 0
+# endif
+/* TIMES_TICK may have been set in policy.h, or we may be able to get
+ it using sysconf. If neither is the case, try to find a useful
+ definition from the system header files. */
+# if !defined(TIMES_TICK) && (!defined(HAVE_SYSCONF) || !defined(HAVE_SC_CLK_TCK))
+# ifdef CLK_TCK
+# define TIMES_TICK CLK_TCK
+# else /* ! defined (CLK_TCK) */
+# ifdef HZ
+# define TIMES_TICK HZ
+# endif /* defined (HZ) */
+# endif /* ! defined (CLK_TCK) */
+#else
+# endif /* TIMES_TICK == 0 && (! HAVE_SYSCONF || ! HAVE_SC_CLK_TCK) */
+# ifndef TIMES_TICK
+# define TIMES_TICK 0
+# endif
+#endif /* HAVE_TIMES */
+
+#ifdef HAVE_GETTIMEOFDAY
+/* collides with Solaris 2.5 prototype? */
+/* int gettimeofday (struct timeval *tv, struct timezone *tz); */
+#endif
+
+double
+timing (int reset, time_t *nowp)
+{
+ static double elaptime, starttime, stoptime;
+ double yet;
+#define NEED_TIME
+#ifdef HAVE_GETTIMEOFDAY
+ struct timeval tv;
+ struct timezone tz;
+
+#ifdef DST_NONE
+ tz.tz_dsttime = DST_NONE;
+#else
+ tz.tz_dsttime = 0;
+#endif
+ gettimeofday (&tv, &tz);
+ yet=tv.tv_sec + tv.tv_usec/1000000.0;
+#undef NEED_TIME
+#endif
+#ifdef HAVE_FTIME
+ static int fbad=0;
+
+ if (! fbad)
+ {
+ struct timeb stime;
+ static struct timeb slast;
+
+ (void) ftime (&stime);
+
+ /* On some systems, such as SCO 3.2.2, ftime can go backwards in
+ time. If we detect this, we switch to using time. */
+ if (slast.time != 0
+ && (stime.time < slast.time
+ || (stime.time == slast.time && stime.millitm < slast.millitm)))
+ fbad = 1;
+ else
+ {
+ yet = stime.millitm / 1000.0 + stime.time;
+ slast = stime;
+ }
+ }
+ if (fbad)
+ yet=(double) time(NULL);
+#undef NEED_TIME
+#endif
+
+#ifdef HAVE_TIMES
+ struct tms s;
+ long i;
+ static int itick;
+
+ if (itick == 0)
+ {
+#if TIMES_TICK == 0
+#if HAVE_SYSCONF && HAVE_SC_CLK_TCK
+ itick = (int) sysconf (_SC_CLK_TCK);
+#else /* ! HAVE_SYSCONF || ! HAVE_SC_CLK_TCK */
+ const char *z;
+
+ z = getenv ("HZ");
+ if (z != NULL)
+ itick = (int) strtol (z, (char **) NULL, 10);
+
+ /* If we really couldn't get anything, just use 60. */
+ if (itick == 0)
+ itick = 60;
+#endif /* ! HAVE_SYSCONF || ! HAVE_SC_CLK_TCK */
+#else /* TIMES_TICK != 0 */
+ itick = TIMES_TICK;
+#endif /* TIMES_TICK == 0 */
+ }
+ yet = ((double) times (&s)) / itick;
+#undef NEED_TIME
+#endif
+
+#ifdef NEED_TIME
+ yet=(double) time(NULL);
+#endif
+ if (nowp)
+ *nowp=(time_t) yet;
+ if (reset) {
+ starttime = yet;
+ return starttime;
+ }
+ else {
+ stoptime = yet;
+ elaptime = stoptime - starttime;
+ return elaptime;
+ }
+}
+
+/*#define TEST*/
+#ifdef TEST
+main()
+{
+ int i;
+ printf("timing %g\n",timing(1));
+ printf("timing %g\n",timing(0));
+ for(i=0;i<20;i++){
+ sleep(1);
+ printf("timing %g\n",timing(0));
+ }
+}
+#endif
diff --git a/src/timing.h b/src/timing.h
new file mode 100644
index 0000000..41c7c9d
--- /dev/null
+++ b/src/timing.h
@@ -0,0 +1 @@
+double timing __P ((int reset,time_t *now));
diff --git a/src/zglobal.h b/src/zglobal.h
new file mode 100644
index 0000000..0f59dba
--- /dev/null
+++ b/src/zglobal.h
@@ -0,0 +1,463 @@
+#ifndef ZMODEM_GLOBAL_H
+#define ZMODEM_GLOBAL_H
+
+/* zglobal.h - prototypes etcetera for lrzsz
+
+ Copyright (C) until 1998 Chuck Forsberg (OMEN Technology Inc)
+ Copyright (C) 1994 Matt Porter
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+*/
+
+#include "config.h"
+#include <sys/types.h>
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+# define HAVE_ALLOCA 1
+#else
+# if defined HAVE_ALLOCA_H || defined _LIBC
+# include <alloca.h>
+# else
+# ifdef _AIX
+#pragma alloca
+# else
+# ifndef alloca
+# ifndef __GLIBC__
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifndef __P
+#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif /* GCC. */
+#endif /* Not __P. */
+
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+# define INCLUDED_SYS_TIME
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# define INCLUDED_SYS_TIME
+# else
+# include <time.h>
+# endif
+#endif
+#ifdef SYS_TIME_WITHOUT_SYS_SELECT
+# ifdef INCLUDED_SYS_TIME
+# undef HAVE_SYS_SELECT_H
+# endif
+#endif
+
+
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#ifdef __BEOS__
+ /* BeOS 4.0: sys/select.h is almost completely #ifdefd out */
+#define HAVE_SOCKET_H
+#ifdef HAVE_SOCKET_H
+#include <socket.h>
+#endif
+#endif
+
+#if STDC_HEADERS
+# include <string.h>
+#else
+# ifdef HAVE_STRINGS_H
+# include <strings.h>
+# endif
+# ifndef HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+# endif
+char *strchr (), *strrchr ();
+# ifndef HAVE_MEMCPY
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+# define memmove(d, s, n) bcopy ((s), (d), (n))
+# endif
+#endif
+
+#include <sys/stat.h>
+
+/* we need to decide whether readcheck is possible */
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+#ifdef HAVE_RDCHK
+# define READCHECK
+#else
+# ifdef FIONREAD
+# define READCHECK_FIONREAD
+# define READCHECK
+# else
+# ifdef F_GETFL
+# define READCHECK
+# define READCHECK_READS
+# define READCHECK_GETFL
+# endif
+# endif
+#endif
+
+/* used to use #elif, but native braindead hpux 9.00 c compiler didn't
+ * understand it */
+#ifdef HAVE_TERMIOS_H
+/* get rid of warnings on SCO ODT 3.2 */
+struct termios;
+# include <termios.h>
+# define USE_TERMIOS
+#else
+# if defined(HAVE_SYS_TERMIOS_H)
+# include <sys/termios.h>
+# define USE_TERMIOS
+# else
+# if defined(HAVE_TERMIO_H)
+# include <termio.h>
+# define USE_TERMIO
+# else
+# if defined(HAVE_SYS_TERMIO_H)
+# include <sys/termio.h>
+# define USE_TERMIO
+# else
+# if defined(HAVE_SGTTY_H)
+# include <sgtty.h>
+# define USE_SGTTY
+# ifdef LLITOUT
+ extern long Locmode; /* Saved "local mode" for 4.x BSD "new driver" */
+ extern long Locbit; /* Bit SUPPOSED to disable output translations */
+# endif
+# else
+# error neither termio.h nor sgtty.h found. Cannot continue.
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef USE_SGTTY
+# ifdef TIOCSBRK
+# define CANBREAK
+# endif
+#endif
+#ifdef USE_TERMIO
+# define CANBREAK
+#endif
+
+
+
+/* Take care of NLS matters. */
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+#if !HAVE_SETLOCALE
+# define setlocale(Category, Locale) /* empty */
+#endif
+
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
+#else
+# define bindtextdomain(Domain, Directory) /* empty */
+# define textdomain(Domain) /* empty */
+# define _(Text) Text
+#endif
+
+#ifndef ENABLE_SYSLOG
+# undef HAVE_SYSLOG
+#else
+# ifdef HAVE_SYSLOG_H
+# include <syslog.h>
+# else
+# if defined(HAVE_SYS_SYSLOG_H)
+# include <sys/syslog.h>
+# else
+# undef HAVE_SYSLOG
+# endif
+# endif
+#endif
+#ifndef ENABLE_SYSLOG
+# define openlog(name,pid,facility) /* void it */
+# define setlogmask(x) /* void it */
+#else
+extern int enable_syslog;
+#endif
+
+#if defined HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+/* The following is from pathmax.h. */
+/* Non-POSIX BSD systems might have gcc's limits.h, which doesn't define
+ PATH_MAX but might cause redefinition warnings when sys/param.h is
+ later included (as on MORE/BSD 4.3). */
+#if defined(_POSIX_VERSION) || (defined(HAVE_LIMITS_H) && !defined(__GNUC__))
+# include <limits.h>
+#endif
+
+#ifndef _POSIX_PATH_MAX
+# define _POSIX_PATH_MAX 255
+#endif
+
+#if !defined(PATH_MAX) && defined(_PC_PATH_MAX)
+# define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX))
+#endif
+
+/* Don't include sys/param.h if it already has been. */
+#if defined(HAVE_SYS_PARAM_H) && !defined(PATH_MAX) && !defined(MAXPATHLEN)
+# include <sys/param.h>
+#endif
+
+#if !defined(PATH_MAX) && defined(MAXPATHLEN)
+# define PATH_MAX MAXPATHLEN
+#endif
+
+#if !defined(LONG_MAX) && defined(HAVE_LIMITS_H)
+# include <limits.h>
+#endif
+
+#ifndef PATH_MAX
+# define PATH_MAX _POSIX_PATH_MAX
+#endif
+
+#ifdef __GNUC__
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 5)
+# define LRZSZ_ATTRIB_SECTION(x) __attribute__((section(#x)))
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+# define LRZSZ_ATTRIB_CONST __attribute__((__const__))
+#endif
+
+ /* gcc.info sagt, noreturn wäre ab 2.5 verfügbar. HPUX-gcc 2.5.8
+ * kann es noch nicht - what's this?
+ */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 5)
+# define LRZSZ_ATTRIB_NORET __attribute__((__noreturn__))
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 5)
+# define LRZSZ_ATTRIB_PRINTF(formatnr,firstargnr) \
+ __attribute__((__format__ (printf,formatnr,firstargnr)))
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
+#define LRZSZ_ATTRIB_UNUSED __attribute__((__unused__))
+#endif
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define LRZSZ_ATTRIB_REGPARM(n) \
+ __attribute__((__regparm__ (n)))
+#endif
+#endif /* __GNUC__ */
+#ifndef LRZSZ_ATTRIB_REGPARM
+#define LRZSZ_ATTRIB_REGPARM(n)
+#endif
+#ifndef LRZSZ_ATTRIB_UNUSED
+#define LRZSZ_ATTRIB_UNUSED
+#endif
+#ifndef LRZSZ_ATTRIB_NORET
+#define LRZSZ_ATTRIB_NORET
+#endif
+#ifndef LRZSZ_ATTRIB_CONST
+#define LRZSZ_ATTRIB_CONST
+#endif
+#ifndef LRZSZ_ATTRIB_PRINTF
+#define LRZSZ_ATTRIB_PRINTF(x,y)
+#endif
+#ifndef LRZSZ_ATTRIB_SECTION
+#define LRZSZ_ATTRIB_SECTION(n)
+#endif
+#undef LRZSZ_ATTRIB_SECTION
+#define LRZSZ_ATTRIB_SECTION(x)
+#undef LRZSZ_ATTRIB_REGPARM
+#define LRZSZ_ATTRIB_REGPARM(x)
+
+
+#define OK 0
+#define FALSE 0
+#define TRUE 1
+#define ERROR (-1)
+
+/* Ward Christensen / CP/M parameters - Don't change these! */
+#define ENQ 005
+#define CAN ('X'&037)
+#define XOFF ('s'&037)
+#define XON ('q'&037)
+#define SOH 1
+#define STX 2
+#define EOT 4
+#define ACK 6
+#define NAK 025
+#define CPMEOF 032
+#define WANTCRC 0103 /* send C not NAK to get crc not checksum */
+#define WANTG 0107 /* Send G not NAK to get nonstop batch xmsn */
+#define TIMEOUT (-2)
+#define RCDO (-3)
+#define WCEOT (-10)
+
+#define RETRYMAX 10
+
+#define UNIXFILE 0xF000 /* The S_IFMT file mask bit for stat */
+
+#define DEFBYTL 2000000000L /* default rx file size */
+
+enum zm_type_enum {
+ ZM_XMODEM,
+ ZM_YMODEM,
+ ZM_ZMODEM
+};
+
+struct zm_fileinfo {
+ char *fname;
+ time_t modtime;
+ mode_t mode;
+ size_t bytes_total;
+ size_t bytes_sent;
+ size_t bytes_received;
+ size_t bytes_skipped; /* crash recovery */
+ int eof_seen;
+};
+
+#define R_BYTESLEFT(x) ((x)->bytes_total-(x)->bytes_received)
+
+extern enum zm_type_enum protocol;
+
+extern const char *program_name; /* the name by which we were called */
+extern int Verbose;
+extern int errors;
+extern int no_timeout;
+extern int Zctlesc; /* Encode control characters */
+extern int under_rsh;
+
+RETSIGTYPE bibi __P ((int n));
+
+#define sendline(c) putchar((c) & 0377)
+#define xsendline(c) putchar(c)
+
+/* zreadline.c */
+extern char *readline_ptr; /* pointer for removing chars from linbuf */
+extern int readline_left; /* number of buffered chars left to read */
+#define READLINE_PF(timeout) \
+ (--readline_left >= 0? (*readline_ptr++ & 0377) : readline_internal(timeout))
+
+int readline_internal __P ((unsigned int timeout));
+void readline_purge __P ((void));
+void readline_setup __P ((int fd, size_t readnum,
+ size_t buffer_size)) LRZSZ_ATTRIB_SECTION(lrzsz_rare);
+
+
+/* rbsb.c */
+extern int Fromcu;
+extern int Twostop;
+#ifdef READCHECK_READS
+extern unsigned char checked;
+#endif
+extern int iofd;
+extern unsigned Baudrate;
+
+void zperr __P ((const char *fmt, ...));
+void zpfatal __P ((const char *fmt, ...));
+void vfile __P ((const char *format, ...));
+#define vchar(x) putc(x,stderr)
+#define vstring(x) fputs(x,stderr)
+
+#ifdef __GNUC__
+#if __GNUC__ > 1
+#define vstringf(format,args...) fprintf(stderr,format, ##args)
+#endif
+#endif
+#ifndef vstringf
+void vstringf __P ((const char *format, ...));
+#endif
+#define VPRINTF(level,format_args) do {if ((Verbose)>=(level)) \
+ vstringf format_args ; } while(0)
+
+/* rbsb.c */
+int from_cu __P ((void)) LRZSZ_ATTRIB_SECTION(lrzsz_rare);
+int rdchk __P ((int fd));
+int io_mode __P ((int fd, int n)) LRZSZ_ATTRIB_SECTION(lrzsz_rare);
+void sendbrk __P ((int fd));
+#define flushmo() fflush(stdout)
+void purgeline __P ((int fd));
+void canit __P ((int fd));
+
+
+/* crctab.c */
+extern unsigned short crctab[256];
+#define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp)
+extern long cr3tab[];
+#define UPDC32(b, c) (cr3tab[((int)c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF))
+
+/* zm.c */
+#include "zmodem.h"
+extern unsigned int Rxtimeout; /* Tenths of seconds to wait for something */
+extern int bytes_per_error; /* generate one error around every x bytes */
+
+/* Globals used by ZMODEM functions */
+extern int Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */
+extern int Rxtype; /* Type of header received */
+extern int Zrwindow; /* RX window size (controls garbage count) */
+/* extern int Rxcount; */ /* Count of data bytes received */
+extern char Rxhdr[4]; /* Received header */
+extern char Txhdr[4]; /* Transmitted header */
+extern long Txpos; /* Transmitted file position */
+extern int Txfcs32; /* TURE means send binary frames with 32 bit FCS */
+extern int Crc32t; /* Display flag indicating 32 bit CRC being sent */
+extern int Crc32; /* Display flag indicating 32 bit CRC being received */
+extern int Znulls; /* Number of nulls to send at beginning of ZDATA hdr */
+extern char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */
+
+extern void zsendline __P ((int c));
+extern void zsendline_init __P ((void)) LRZSZ_ATTRIB_SECTION(lrzsz_rare);
+void zsbhdr __P ((int type, char *hdr));
+void zshhdr __P ((int type, char *hdr));
+void zsdata __P ((const char *buf, size_t length, int frameend));
+void zsda32 __P ((const char *buf, size_t length, int frameend));
+int zrdata __P ((char *buf, int length, size_t *received));
+int zgethdr __P ((char *hdr, int eflag, size_t *));
+void stohdr __P ((size_t pos)) LRZSZ_ATTRIB_REGPARM(1);
+long rclhdr __P ((char *hdr)) LRZSZ_ATTRIB_REGPARM(1);
+
+int tcp_server __P ((char *buf)) LRZSZ_ATTRIB_SECTION(lrzsz_rare);
+int tcp_connect __P ((char *buf)) LRZSZ_ATTRIB_SECTION(lrzsz_rare);
+int tcp_accept __P ((int d)) LRZSZ_ATTRIB_SECTION(lrzsz_rare);
+
+
+const char * protname __P ((void)) LRZSZ_ATTRIB_SECTION(lrzsz_rare);
+void lsyslog __P ((int, const char *,...));
+
+
+
+
+#endif
diff --git a/src/zm.c b/src/zm.c
new file mode 100644
index 0000000..0d742ab
--- /dev/null
+++ b/src/zm.c
@@ -0,0 +1,982 @@
+/*
+ zm.c - zmodem protocol handling lowlevelstuff
+ Copyright (C) until 1998 Chuck Forsberg (OMEN Technology Inc)
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ originally written by Chuck Forsberg
+*/
+/* historical comment: -- uwe
+ * Z M . C
+ * ZMODEM protocol primitives
+ * 05-09-88 Chuck Forsberg Omen Technology Inc
+ *
+ * Entry point Functions:
+ * zsbhdr(type, hdr) send binary header
+ * zshhdr(type, hdr) send hex header
+ * zgethdr(hdr, eflag) receive header - binary or hex
+ * zsdata(buf, len, frameend) send data
+ * zrdata(buf, len, bytes_received) receive data
+ * stohdr(pos) store position data in Txhdr
+ * long rclhdr(hdr) recover position offset from header
+ */
+
+
+#include "zglobal.h"
+
+#include <stdio.h>
+
+unsigned int Rxtimeout = 100; /* Tenths of seconds to wait for something */
+
+/* Globals used by ZMODEM functions */
+int Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */
+int Rxtype; /* Type of header received */
+char Rxhdr[4]; /* Received header */
+char Txhdr[4]; /* Transmitted header */
+long Txpos; /* Transmitted file position */
+int Txfcs32; /* TRUE means send binary frames with 32 bit FCS */
+int Crc32t; /* Display flag indicating 32 bit CRC being sent */
+int Crc32; /* Display flag indicating 32 bit CRC being received */
+int Znulls; /* Number of nulls to send at beginning of ZDATA hdr */
+char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */
+
+static char lastsent; /* Last char we sent */
+int turbo_escape;
+int bytes_per_error=0;
+
+static const char *frametypes[] = {
+ "Carrier Lost", /* -3 */
+ "TIMEOUT", /* -2 */
+ "ERROR", /* -1 */
+#define FTOFFSET 3
+ "ZRQINIT",
+ "ZRINIT",
+ "ZSINIT",
+ "ZACK",
+ "ZFILE",
+ "ZSKIP",
+ "ZNAK",
+ "ZABORT",
+ "ZFIN",
+ "ZRPOS",
+ "ZDATA",
+ "ZEOF",
+ "ZFERR",
+ "ZCRC",
+ "ZCHALLENGE",
+ "ZCOMPL",
+ "ZCAN",
+ "ZFREECNT",
+ "ZCOMMAND",
+ "ZSTDERR",
+ "xxxxx"
+#define FRTYPES 22 /* Total number of frame types in this array */
+ /* not including psuedo negative entries */
+};
+
+#define badcrc _("Bad CRC")
+/* static char *badcrc = "Bad CRC"; */
+static inline int noxrd7 __P ((void));
+static inline int zdlread __P ((void));
+static int zdlread2 __P ((int)) LRZSZ_ATTRIB_REGPARM(1);
+static inline int zgeth1 __P ((void));
+static void zputhex __P ((int c, char *pos));
+static inline int zgethex __P ((void));
+static int zrbhdr __P ((char *hdr));
+static int zrbhdr32 __P ((char *hdr));
+static int zrhhdr __P ((char *hdr));
+static char zsendline_tab[256];
+static int zrdat32 __P ((char *buf, int length, size_t *));
+static void zsbh32 __P ((char *hdr, int type));
+static inline void zsendline_s __P((const char *s, size_t count));
+
+extern int zmodem_requested;
+
+#define sendline(c) putchar((c) & 0377)
+#define xsendline(c) putchar(c)
+
+/*
+ * Read a character from the modem line with timeout.
+ * Eat parity, XON and XOFF characters.
+ */
+static inline int
+noxrd7(void)
+{
+ register int c;
+
+ for (;;) {
+ if ((c = READLINE_PF(Rxtimeout)) < 0)
+ return c;
+ switch (c &= 0177) {
+ case XON:
+ case XOFF:
+ continue;
+ default:
+ if (Zctlesc && !(c & 0140))
+ continue;
+ case '\r':
+ case '\n':
+ case ZDLE:
+ return c;
+ }
+ }
+}
+
+static inline int
+zgeth1(void)
+{
+ register int c, n;
+
+ if ((c = noxrd7()) < 0)
+ return c;
+ n = c - '0';
+ if (n > 9)
+ n -= ('a' - ':');
+ if (n & ~0xF)
+ return ERROR;
+ if ((c = noxrd7()) < 0)
+ return c;
+ c -= '0';
+ if (c > 9)
+ c -= ('a' - ':');
+ if (c & ~0xF)
+ return ERROR;
+ c += (n<<4);
+ return c;
+}
+
+/* Decode two lower case hex digits into an 8 bit byte value */
+static inline int
+zgethex(void)
+{
+ register int c;
+
+ c = zgeth1();
+ VPRINTF(9,("zgethex: %02X", c));
+ return c;
+}
+
+/*
+ * Read a byte, checking for ZMODEM escape encoding
+ * including CAN*5 which represents a quick abort
+ */
+static inline int
+zdlread(void)
+{
+ int c;
+ /* Quick check for non control characters */
+ if ((c = READLINE_PF(Rxtimeout)) & 0140)
+ return c;
+ return zdlread2(c);
+}
+/* no, i don't like gotos. -- uwe */
+static int
+zdlread2(int c)
+{
+ goto jump_over; /* bad style */
+
+again:
+ /* Quick check for non control characters */
+ if ((c = READLINE_PF(Rxtimeout)) & 0140)
+ return c;
+jump_over:
+ switch (c) {
+ case ZDLE:
+ break;
+ case XON:
+ case (XON|0200):
+ case XOFF:
+ case (XOFF|0200):
+ goto again;
+ default:
+ if (Zctlesc && !(c & 0140)) {
+ goto again;
+ }
+ return c;
+ }
+again2:
+ if ((c = READLINE_PF(Rxtimeout)) < 0)
+ return c;
+ if (c == CAN && (c = READLINE_PF(Rxtimeout)) < 0)
+ return c;
+ if (c == CAN && (c = READLINE_PF(Rxtimeout)) < 0)
+ return c;
+ if (c == CAN && (c = READLINE_PF(Rxtimeout)) < 0)
+ return c;
+ switch (c) {
+ case CAN:
+ return GOTCAN;
+ case ZCRCE:
+ case ZCRCG:
+ case ZCRCQ:
+ case ZCRCW:
+ return (c | GOTOR);
+ case ZRUB0:
+ return 0177;
+ case ZRUB1:
+ return 0377;
+ case XON:
+ case (XON|0200):
+ case XOFF:
+ case (XOFF|0200):
+ goto again2;
+ default:
+ if (Zctlesc && ! (c & 0140)) {
+ goto again2;
+ }
+ if ((c & 0140) == 0100)
+ return (c ^ 0100);
+ break;
+ }
+ VPRINTF(2,(_("Bad escape sequence %x"), c));
+ return ERROR;
+}
+
+
+
+/*
+ * Send character c with ZMODEM escape sequence encoding.
+ * Escape XON, XOFF. Escape CR following @ (Telenet net escape)
+ */
+inline void
+zsendline(int c)
+{
+
+ switch(zsendline_tab[(unsigned) (c&=0377)])
+ {
+ case 0:
+ xsendline(lastsent = c);
+ break;
+ case 1:
+ xsendline(ZDLE);
+ c ^= 0100;
+ xsendline(lastsent = c);
+ break;
+ case 2:
+ if ((lastsent & 0177) != '@') {
+ xsendline(lastsent = c);
+ } else {
+ xsendline(ZDLE);
+ c ^= 0100;
+ xsendline(lastsent = c);
+ }
+ break;
+ }
+}
+
+static inline void
+zsendline_s(const char *s, size_t count)
+{
+ const char *end=s+count;
+ while(s!=end) {
+ int last_esc=0;
+ const char *t=s;
+ while (t!=end) {
+ last_esc=zsendline_tab[(unsigned) ((*t) & 0377)];
+ if (last_esc)
+ break;
+ t++;
+ }
+ if (t!=s) {
+ fwrite(s,(size_t)(t-s),1,stdout);
+ lastsent=t[-1];
+ s=t;
+ }
+ if (last_esc) {
+ int c=*s;
+ switch(last_esc) {
+ case 0:
+ xsendline(lastsent = c);
+ break;
+ case 1:
+ xsendline(ZDLE);
+ c ^= 0100;
+ xsendline(lastsent = c);
+ break;
+ case 2:
+ if ((lastsent & 0177) != '@') {
+ xsendline(lastsent = c);
+ } else {
+ xsendline(ZDLE);
+ c ^= 0100;
+ xsendline(lastsent = c);
+ }
+ break;
+ }
+ s++;
+ }
+ }
+}
+
+
+/* Send ZMODEM binary header hdr of type type */
+void
+zsbhdr(int type, char *hdr)
+{
+ register int n;
+ register unsigned short crc;
+
+ VPRINTF(3,("zsbhdr: %s %lx", frametypes[type+FTOFFSET], rclhdr(hdr)));
+ if (type == ZDATA)
+ for (n = Znulls; --n >=0; )
+ xsendline(0);
+
+ xsendline(ZPAD); xsendline(ZDLE);
+
+ Crc32t=Txfcs32;
+ if (Crc32t)
+ zsbh32(hdr, type);
+ else {
+ xsendline(ZBIN); zsendline(type); crc = updcrc(type, 0);
+
+ for (n=4; --n >= 0; ++hdr) {
+ zsendline(*hdr);
+ crc = updcrc((0377& *hdr), crc);
+ }
+ crc = updcrc(0,updcrc(0,crc));
+ zsendline(crc>>8);
+ zsendline(crc);
+ }
+ if (type != ZDATA)
+ flushmo();
+}
+
+
+/* Send ZMODEM binary header hdr of type type */
+static void
+zsbh32(char *hdr, int type)
+{
+ register int n;
+ register unsigned long crc;
+
+ xsendline(ZBIN32); zsendline(type);
+ crc = 0xFFFFFFFFL; crc = UPDC32(type, crc);
+
+ for (n=4; --n >= 0; ++hdr) {
+ crc = UPDC32((0377 & *hdr), crc);
+ zsendline(*hdr);
+ }
+ crc = ~crc;
+ for (n=4; --n >= 0;) {
+ zsendline((int)crc);
+ crc >>= 8;
+ }
+}
+
+/* Send ZMODEM HEX header hdr of type type */
+void
+zshhdr(int type, char *hdr)
+{
+ register int n;
+ register unsigned short crc;
+ char s[30];
+ size_t len;
+
+ VPRINTF(3,("zshhdr: %s %lx", frametypes[(type & 0x7f)+FTOFFSET], rclhdr(hdr)));
+ s[0]=ZPAD;
+ s[1]=ZPAD;
+ s[2]=ZDLE;
+ s[3]=ZHEX;
+ zputhex(type & 0x7f ,s+4);
+ len=6;
+ Crc32t = 0;
+
+ crc = updcrc((type & 0x7f), 0);
+ for (n=4; --n >= 0; ++hdr) {
+ zputhex(*hdr,s+len);
+ len += 2;
+ crc = updcrc((0377 & *hdr), crc);
+ }
+ crc = updcrc(0,updcrc(0,crc));
+ zputhex(crc>>8,s+len);
+ zputhex(crc,s+len+2);
+ len+=4;
+
+ /* Make it printable on remote machine */
+ s[len++]=015;
+ s[len++]=0212;
+ /*
+ * Uncork the remote in case a fake XOFF has stopped data flow
+ */
+ if (type != ZFIN && type != ZACK)
+ {
+ s[len++]=021;
+ }
+ flushmo();
+ write(1,s,len);
+}
+
+/*
+ * Send binary array buf of length length, with ending ZDLE sequence frameend
+ */
+static const char *Zendnames[] = { "ZCRCE", "ZCRCG", "ZCRCQ", "ZCRCW"};
+void
+zsdata(const char *buf, size_t length, int frameend)
+{
+ register unsigned short crc;
+
+ VPRINTF(3,("zsdata: %lu %s", (unsigned long) length,
+ Zendnames[(frameend-ZCRCE)&3]));
+ crc = 0;
+ do {
+ zsendline(*buf); crc = updcrc((0377 & *buf), crc);
+ buf++;
+ } while (--length>0);
+ xsendline(ZDLE); xsendline(frameend);
+ crc = updcrc(frameend, crc);
+
+ crc = updcrc(0,updcrc(0,crc));
+ zsendline(crc>>8); zsendline(crc);
+ if (frameend == ZCRCW) {
+ xsendline(XON); flushmo();
+ }
+}
+
+void
+zsda32(const char *buf, size_t length, int frameend)
+{
+ int c;
+ unsigned long crc;
+ int i;
+ VPRINTF(3,("zsdat32: %d %s", length, Zendnames[(frameend-ZCRCE)&3]));
+
+ crc = 0xFFFFFFFFL;
+ zsendline_s(buf,length);
+ for (; length; length--) {
+ c = *buf & 0377;
+ crc = UPDC32(c, crc);
+ buf++;
+ }
+ xsendline(ZDLE); xsendline(frameend);
+ crc = UPDC32(frameend, crc);
+
+ crc = ~crc;
+ for (i=4; --i >= 0;) {
+ c=(int) crc;
+ if (c & 0140)
+ xsendline(lastsent = c);
+ else
+ zsendline(c);
+ crc >>= 8;
+ }
+ if (frameend == ZCRCW) {
+ xsendline(XON); flushmo();
+ }
+}
+
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 4)
+# undef DEBUG_BLOCKSIZE
+#endif
+
+#ifdef DEBUG_BLOCKSIZE
+struct debug_blocksize {
+ int size;
+ long count;
+};
+struct debug_blocksize blocksizes[]={
+ {32,0},
+ {64,0},
+ {128,0},
+ {256,0},
+ {512,0},
+ {1024,0},
+ {2048,0},
+ {4096,0},
+ {8192,0},
+ {0,0}
+};
+static inline void
+count_blk(int size)
+{
+ int i;
+ for (i=0;blocksizes[i].size;i++) {
+ if (blocksizes[i].size==size) {
+ blocksizes[i].count++;
+ return;
+ }
+ }
+ blocksizes[i].count++;
+}
+
+static void printout_blocksizes(void) __attribute__((__destructor__));
+static void
+printout_blocksizes(void)
+{
+ int i;
+ for (i=0;blocksizes[i].size;i++) {
+ if (blocksizes[i].count) {
+ lsyslog(LOG_DEBUG,"%4d byte: %ld blocks\n",
+ blocksizes[i].size,blocksizes[i].count);
+ }
+ }
+ if (blocksizes[i].count) {
+ lsyslog(LOG_DEBUG,"unk. byte: %ld blocks",
+ blocksizes[i].count);
+ }
+}
+#define COUNT_BLK(x) count_blk(x)
+#else
+#define COUNT_BLK(x)
+#endif
+
+/*
+ * Receive array buf of max length with ending ZDLE sequence
+ * and CRC. Returns the ending character or error code.
+ * NB: On errors may store length+1 bytes!
+ */
+int
+zrdata(char *buf, int length, size_t *bytes_received)
+{
+ register int c;
+ register unsigned short crc;
+ register char *end;
+ register int d;
+
+ *bytes_received=0;
+ if (Rxframeind == ZBIN32)
+ return zrdat32(buf, length, bytes_received);
+
+ crc = 0; end = buf + length;
+ while (buf <= end) {
+ if ((c = zdlread()) & ~0377) {
+crcfoo:
+ switch (c) {
+ case GOTCRCE:
+ case GOTCRCG:
+ case GOTCRCQ:
+ case GOTCRCW:
+ {
+ d = c;
+ c &= 0377;
+ crc = updcrc(c, crc);
+ if ((c = zdlread()) & ~0377)
+ goto crcfoo;
+ crc = updcrc(c, crc);
+ if ((c = zdlread()) & ~0377)
+ goto crcfoo;
+ crc = updcrc(c, crc);
+ if (crc & 0xFFFF) {
+ zperr(badcrc);
+ return ERROR;
+ }
+ *bytes_received = length - (end - buf);
+ COUNT_BLK(*bytes_received);
+ VPRINTF(3,("zrdata: %lu %s", (unsigned long) (*bytes_received),
+ Zendnames[(d-GOTCRCE)&3]));
+ return d;
+ }
+ case GOTCAN:
+ zperr(_("Sender Canceled"));
+ return ZCAN;
+ case TIMEOUT:
+ zperr(_("TIMEOUT"));
+ return c;
+ default:
+ zperr(_("Bad data subpacket"));
+ return c;
+ }
+ }
+ *buf++ = c;
+ crc = updcrc(c, crc);
+ }
+ zperr(_("Data subpacket too long"));
+ return ERROR;
+}
+
+static int
+zrdat32(char *buf, int length, size_t *bytes_received)
+{
+ register int c;
+ register unsigned long crc;
+ register char *end;
+ register int d;
+
+ crc = 0xFFFFFFFFL; end = buf + length;
+ while (buf <= end) {
+ if ((c = zdlread()) & ~0377) {
+crcfoo:
+ switch (c) {
+ case GOTCRCE:
+ case GOTCRCG:
+ case GOTCRCQ:
+ case GOTCRCW:
+ d = c;
+ c &= 0377;
+ crc = UPDC32(c, crc);
+ if ((c = zdlread()) & ~0377)
+ goto crcfoo;
+ crc = UPDC32(c, crc);
+ if ((c = zdlread()) & ~0377)
+ goto crcfoo;
+ crc = UPDC32(c, crc);
+ if ((c = zdlread()) & ~0377)
+ goto crcfoo;
+ crc = UPDC32(c, crc);
+ if ((c = zdlread()) & ~0377)
+ goto crcfoo;
+ crc = UPDC32(c, crc);
+ if (crc != 0xDEBB20E3) {
+ zperr(badcrc);
+ return ERROR;
+ }
+ *bytes_received = length - (end - buf);
+ COUNT_BLK(*bytes_received);
+ VPRINTF(3,("zrdat32: %lu %s", (unsigned long) *bytes_received,
+ Zendnames[(d-GOTCRCE)&3]));
+ return d;
+ case GOTCAN:
+ zperr(_("Sender Canceled"));
+ return ZCAN;
+ case TIMEOUT:
+ zperr(_("TIMEOUT"));
+ return c;
+ default:
+ zperr(_("Bad data subpacket"));
+ return c;
+ }
+ }
+ *buf++ = c;
+ crc = UPDC32(c, crc);
+ }
+ zperr(_("Data subpacket too long"));
+ return ERROR;
+}
+
+/*
+ * Read a ZMODEM header to hdr, either binary or hex.
+ * eflag controls local display of non zmodem characters:
+ * 0: no display
+ * 1: display printing characters only
+ * 2: display all non ZMODEM characters
+ * On success, set Zmodem to 1, set Rxpos and return type of header.
+ * Otherwise return negative on error.
+ * Return ERROR instantly if ZCRCW sequence, for fast error recovery.
+ */
+int
+zgethdr(char *hdr, int eflag, size_t *Rxpos)
+{
+ register int c, cancount;
+ unsigned int max_garbage; /* Max bytes before start of frame */
+ size_t rxpos=0; /* keep gcc happy */
+
+ max_garbage = Zrwindow + Baudrate;
+ Rxframeind = Rxtype = 0;
+
+startover:
+ cancount = 5;
+again:
+ /* Return immediate ERROR if ZCRCW sequence seen */
+ switch (c = READLINE_PF(Rxtimeout)) {
+ case RCDO:
+ case TIMEOUT:
+ goto fifi;
+ case CAN:
+gotcan:
+ if (--cancount <= 0) {
+ c = ZCAN; goto fifi;
+ }
+ switch (c = READLINE_PF(1)) {
+ case TIMEOUT:
+ goto again;
+ case ZCRCW:
+ c = ERROR;
+ /* **** FALL THRU TO **** */
+ case RCDO:
+ goto fifi;
+ default:
+ break;
+ case CAN:
+ if (--cancount <= 0) {
+ c = ZCAN; goto fifi;
+ }
+ goto again;
+ }
+ /* **** FALL THRU TO **** */
+ default:
+agn2:
+ if ( --max_garbage == 0) {
+ zperr(_("Garbage count exceeded"));
+ return(ERROR);
+ }
+ if (eflag && ((c &= 0177) & 0140) && Verbose)
+ vchar(c);
+ else if (eflag > 1 && Verbose)
+ vchar(c);
+ goto startover;
+ case ZPAD|0200: /* This is what we want. */
+ case ZPAD: /* This is what we want. */
+ break;
+ }
+ cancount = 5;
+splat:
+ switch (c = noxrd7()) {
+ case ZPAD:
+ goto splat;
+ case RCDO:
+ case TIMEOUT:
+ goto fifi;
+ default:
+ goto agn2;
+ case ZDLE: /* This is what we want. */
+ break;
+ }
+
+ switch (c = noxrd7()) {
+ case RCDO:
+ case TIMEOUT:
+ goto fifi;
+ case ZBIN:
+ Rxframeind = ZBIN; Crc32 = FALSE;
+ c = zrbhdr(hdr);
+ break;
+ case ZBIN32:
+ Crc32 = Rxframeind = ZBIN32;
+ c = zrbhdr32(hdr);
+ break;
+ case ZHEX:
+ Rxframeind = ZHEX; Crc32 = FALSE;
+ c = zrhhdr(hdr);
+ break;
+ case CAN:
+ goto gotcan;
+ default:
+ goto agn2;
+ }
+ rxpos = hdr[ZP3] & 0377;
+ rxpos = (rxpos<<8) + (hdr[ZP2] & 0377);
+ rxpos = (rxpos<<8) + (hdr[ZP1] & 0377);
+ rxpos = (rxpos<<8) + (hdr[ZP0] & 0377);
+fifi:
+ switch (c) {
+ case GOTCAN:
+ c = ZCAN;
+ /* **** FALL THRU TO **** */
+ case ZNAK:
+ case ZCAN:
+ case ERROR:
+ case TIMEOUT:
+ case RCDO:
+ zperr(_("Got %s"), frametypes[c+FTOFFSET]);
+ /* **** FALL THRU TO **** */
+ default:
+ if (c >= -3 && c <= FRTYPES)
+ VPRINTF(3,("zgethdr: %s %lx", frametypes[c+FTOFFSET], (unsigned long) rxpos));
+ else
+ VPRINTF(3,("zgethdr: %d %lx", c, (unsigned long) rxpos));
+ }
+ if (Rxpos)
+ *Rxpos=rxpos;
+ return c;
+}
+
+/* Receive a binary style header (type and position) */
+static int
+zrbhdr(char *hdr)
+{
+ register int c, n;
+ register unsigned short crc;
+
+ if ((c = zdlread()) & ~0377)
+ return c;
+ Rxtype = c;
+ crc = updcrc(c, 0);
+
+ for (n=4; --n >= 0; ++hdr) {
+ if ((c = zdlread()) & ~0377)
+ return c;
+ crc = updcrc(c, crc);
+ *hdr = c;
+ }
+ if ((c = zdlread()) & ~0377)
+ return c;
+ crc = updcrc(c, crc);
+ if ((c = zdlread()) & ~0377)
+ return c;
+ crc = updcrc(c, crc);
+ if (crc & 0xFFFF) {
+ zperr(badcrc);
+ return ERROR;
+ }
+ protocol = ZM_ZMODEM;
+ zmodem_requested=TRUE;
+ return Rxtype;
+}
+
+/* Receive a binary style header (type and position) with 32 bit FCS */
+static int
+zrbhdr32(char *hdr)
+{
+ register int c, n;
+ register unsigned long crc;
+
+ if ((c = zdlread()) & ~0377)
+ return c;
+ Rxtype = c;
+ crc = 0xFFFFFFFFL; crc = UPDC32(c, crc);
+#ifdef DEBUGZ
+ VPRINTF(3,("zrbhdr32 c=%X crc=%lX", c, crc)i);
+#endif
+
+ for (n=4; --n >= 0; ++hdr) {
+ if ((c = zdlread()) & ~0377)
+ return c;
+ crc = UPDC32(c, crc);
+ *hdr = c;
+#ifdef DEBUGZ
+ VPRINTF(3,("zrbhdr32 c=%X crc=%lX", c, crc));
+#endif
+ }
+ for (n=4; --n >= 0;) {
+ if ((c = zdlread()) & ~0377)
+ return c;
+ crc = UPDC32(c, crc);
+#ifdef DEBUGZ
+ VPRINTF(3,("zrbhdr32 c=%X crc=%lX", c, crc));
+#endif
+ }
+ if (crc != 0xDEBB20E3) {
+ zperr(badcrc);
+ return ERROR;
+ }
+ protocol = ZM_ZMODEM;
+ zmodem_requested=TRUE;
+ return Rxtype;
+}
+
+
+/* Receive a hex style header (type and position) */
+static int
+zrhhdr(char *hdr)
+{
+ register int c;
+ register unsigned short crc;
+ register int n;
+
+ if ((c = zgethex()) < 0)
+ return c;
+ Rxtype = c;
+ crc = updcrc(c, 0);
+
+ for (n=4; --n >= 0; ++hdr) {
+ if ((c = zgethex()) < 0)
+ return c;
+ crc = updcrc(c, crc);
+ *hdr = c;
+ }
+ if ((c = zgethex()) < 0)
+ return c;
+ crc = updcrc(c, crc);
+ if ((c = zgethex()) < 0)
+ return c;
+ crc = updcrc(c, crc);
+ if (crc & 0xFFFF) {
+ zperr(badcrc); return ERROR;
+ }
+ switch ( c = READLINE_PF(1)) {
+ case 0215:
+ /* **** FALL THRU TO **** */
+ case 015:
+ /* Throw away possible cr/lf */
+ READLINE_PF(1);
+ break;
+ }
+ protocol = ZM_ZMODEM;
+ zmodem_requested=TRUE;
+ return Rxtype;
+}
+
+/* Write a byte as two hex digits */
+static void
+zputhex(int c, char *pos)
+{
+ static char digits[] = "0123456789abcdef";
+
+ VPRINTF(9,("zputhex: %02X", c));
+ pos[0]=digits[(c&0xF0)>>4];
+ pos[1]=digits[c&0x0F];
+}
+
+void
+zsendline_init(void)
+{
+ int i;
+ for (i=0;i<256;i++) {
+ if (i & 0140)
+ zsendline_tab[i]=0;
+ else {
+ switch(i)
+ {
+ case ZDLE:
+ case XOFF: /* ^Q */
+ case XON: /* ^S */
+ case (XOFF | 0200):
+ case (XON | 0200):
+ zsendline_tab[i]=1;
+ break;
+ case 020: /* ^P */
+ case 0220:
+ if (turbo_escape)
+ zsendline_tab[i]=0;
+ else
+ zsendline_tab[i]=1;
+ break;
+ case 015:
+ case 0215:
+ if (Zctlesc)
+ zsendline_tab[i]=1;
+ else if (!turbo_escape)
+ zsendline_tab[i]=2;
+ else
+ zsendline_tab[i]=0;
+ break;
+ default:
+ if (Zctlesc)
+ zsendline_tab[i]=1;
+ else
+ zsendline_tab[i]=0;
+ }
+ }
+ }
+}
+
+
+
+/* Store pos in Txhdr */
+void
+stohdr(size_t pos)
+{
+ long lpos=(long) pos;
+ Txhdr[ZP0] = lpos;
+ Txhdr[ZP1] = lpos>>8;
+ Txhdr[ZP2] = lpos>>16;
+ Txhdr[ZP3] = lpos>>24;
+}
+
+/* Recover a long integer from a header */
+long
+rclhdr(char *hdr)
+{
+ long l;
+
+ l = (hdr[ZP3] & 0377);
+ l = (l << 8) | (hdr[ZP2] & 0377);
+ l = (l << 8) | (hdr[ZP1] & 0377);
+ l = (l << 8) | (hdr[ZP0] & 0377);
+ return l;
+}
+
+/* End of zm.c */
diff --git a/src/zmodem.h b/src/zmodem.h
new file mode 100644
index 0000000..01c9b2e
--- /dev/null
+++ b/src/zmodem.h
@@ -0,0 +1,142 @@
+/* zmodem.h - ZMODEM protocol constants
+
+ Copyright (C) until 1998 Chuck Forsberg (OMEN Technology Inc)
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ * 05-23-87 Chuck Forsberg Omen Technology Inc
+*/
+#define ZPAD '*' /* 052 Padding character begins frames */
+#define ZDLE 030 /* Ctrl-X Zmodem escape - `ala BISYNC DLE */
+#define ZDLEE (ZDLE^0100) /* Escaped ZDLE as transmitted */
+#define ZBIN 'A' /* Binary frame indicator */
+#define ZHEX 'B' /* HEX frame indicator */
+#define ZBIN32 'C' /* Binary frame with 32 bit FCS */
+
+/* Frame types (see array "frametypes" in zm.c) */
+#define ZRQINIT 0 /* Request receive init */
+#define ZRINIT 1 /* Receive init */
+#define ZSINIT 2 /* Send init sequence (optional) */
+#define ZACK 3 /* ACK to above */
+#define ZFILE 4 /* File name from sender */
+#define ZSKIP 5 /* To sender: skip this file */
+#define ZNAK 6 /* Last packet was garbled */
+#define ZABORT 7 /* Abort batch transfers */
+#define ZFIN 8 /* Finish session */
+#define ZRPOS 9 /* Resume data trans at this position */
+#define ZDATA 10 /* Data packet(s) follow */
+#define ZEOF 11 /* End of file */
+#define ZFERR 12 /* Fatal Read or Write error Detected */
+#define ZCRC 13 /* Request for file CRC and response */
+#define ZCHALLENGE 14 /* Receiver's Challenge */
+#define ZCOMPL 15 /* Request is complete */
+#define ZCAN 16 /* Other end canned session with CAN*5 */
+#define ZFREECNT 17 /* Request for free bytes on filesystem */
+#define ZCOMMAND 18 /* Command from sending program */
+#define ZSTDERR 19 /* Output to standard error, data follows */
+
+/* ZDLE sequences */
+#define ZCRCE 'h' /* CRC next, frame ends, header packet follows */
+#define ZCRCG 'i' /* CRC next, frame continues nonstop */
+#define ZCRCQ 'j' /* CRC next, frame continues, ZACK expected */
+#define ZCRCW 'k' /* CRC next, ZACK expected, end of frame */
+#define ZRUB0 'l' /* Translate to rubout 0177 */
+#define ZRUB1 'm' /* Translate to rubout 0377 */
+
+/* zdlread return values (internal) */
+/* -1 is general error, -2 is timeout */
+#define GOTOR 0400
+#define GOTCRCE (ZCRCE|GOTOR) /* ZDLE-ZCRCE received */
+#define GOTCRCG (ZCRCG|GOTOR) /* ZDLE-ZCRCG received */
+#define GOTCRCQ (ZCRCQ|GOTOR) /* ZDLE-ZCRCQ received */
+#define GOTCRCW (ZCRCW|GOTOR) /* ZDLE-ZCRCW received */
+#define GOTCAN (GOTOR|030) /* CAN*5 seen */
+
+/* Byte positions within header array */
+#define ZF0 3 /* First flags byte */
+#define ZF1 2
+#define ZF2 1
+#define ZF3 0
+#define ZP0 0 /* Low order 8 bits of position */
+#define ZP1 1
+#define ZP2 2
+#define ZP3 3 /* High order 8 bits of file position */
+
+/* Bit Masks for ZRINIT flags byte ZF0 */
+#define CANFDX 0x01 /* Rx can send and receive true FDX */
+#define CANOVIO 0x02 /* Rx can receive data during disk I/O */
+#define CANBRK 0x04 /* Rx can send a break signal */
+#define CANCRY 0x08 /* Receiver can decrypt */
+#define CANLZW 0x10 /* Receiver can uncompress */
+#define CANFC32 0x20 /* Receiver can use 32 bit Frame Check */
+#define ESCCTL 0x40 /* Receiver expects ctl chars to be escaped */
+#define ESC8 0x80 /* Receiver expects 8th bit to be escaped */
+/* Bit Masks for ZRINIT flags byze ZF1 */
+#define ZF1_CANVHDR 0x01 /* Variable headers OK, unused in lrzsz */
+#define ZF1_TIMESYNC 0x02 /* nonstandard, Receiver request timesync */
+
+/* Parameters for ZSINIT frame */
+#define ZATTNLEN 32 /* Max length of attention string */
+/* Bit Masks for ZSINIT flags byte ZF0 */
+#define TESCCTL 0100 /* Transmitter expects ctl chars to be escaped */
+#define TESC8 0200 /* Transmitter expects 8th bit to be escaped */
+
+/* Parameters for ZFILE frame */
+/* Conversion options one of these in ZF0 */
+#define ZCBIN 1 /* Binary transfer - inhibit conversion */
+#define ZCNL 2 /* Convert NL to local end of line convention */
+#define ZCRESUM 3 /* Resume interrupted file transfer */
+/* Management include options, one of these ored in ZF1 */
+#define ZF1_ZMSKNOLOC 0x80 /* Skip file if not present at rx */
+/* Management options, one of these ored in ZF1 */
+#define ZF1_ZMMASK 0x1f /* Mask for the choices below */
+#define ZF1_ZMNEWL 1 /* Transfer if source newer or longer */
+#define ZF1_ZMCRC 2 /* Transfer if different file CRC or length */
+#define ZF1_ZMAPND 3 /* Append contents to existing file (if any) */
+#define ZF1_ZMCLOB 4 /* Replace existing file */
+#define ZF1_ZMNEW 5 /* Transfer if source newer */
+ /* Number 5 is alive ... */
+#define ZF1_ZMDIFF 6 /* Transfer if dates or lengths different */
+#define ZF1_ZMPROT 7 /* Protect destination file */
+#define ZF1_ZMCHNG 8 /* Change filename if destination exists */
+
+/* Transport options, one of these in ZF2 */
+#define ZTLZW 1 /* Lempel-Ziv compression */
+#define ZTCRYPT 2 /* Encryption */
+#define ZTRLE 3 /* Run Length encoding */
+/* Extended options for ZF3, bit encoded */
+#define ZXSPARS 64 /* Encoding for sparse file operations */
+
+/* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */
+#define ZCACK1 1 /* Acknowledge, then do command */
+
+/* Globals used by ZMODEM functions */
+#if 0
+extern int Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */
+extern int Rxtype; /* Type of header received */
+extern int Zrwindow; /* RX window size (controls garbage count) */
+extern char Rxhdr[4]; /* Received header */
+extern char Txhdr[4]; /* Transmitted header */
+extern long Txpos; /* Transmitted file position */
+extern int Txfcs32; /* TURE means send binary frames with 32 bit FCS */
+extern int Crc32t; /* Display flag indicating 32 bit CRC being sent */
+extern int Crc32; /* Display flag indicating 32 bit CRC being received */
+extern int Znulls; /* Number of nulls to send at beginning of ZDATA hdr */
+extern char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */
+#endif
+
+/* End of ZMODEM.H */
diff --git a/src/zperr.c b/src/zperr.c
new file mode 100644
index 0000000..31963de
--- /dev/null
+++ b/src/zperr.c
@@ -0,0 +1,113 @@
+/*
+ zperr.c - "stderr" output stuff
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ originally written by Uwe Ohse
+*/
+#include "zglobal.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#ifdef __STDC__
+# define WAYTOGO
+# include <stdarg.h>
+# define VA_START(args, lastarg) va_start(args, lastarg)
+#else
+# include <varargs.h>
+# define VA_START(args, lastarg) va_start(args)
+#endif
+
+void
+#ifdef WAYTOGO
+zperr(const char *fmt, ...)
+#else
+zperr(fmt, va_alist)
+ const char *fmt;
+ va_dcl
+#endif
+{
+ va_list ap;
+
+ if (Verbose<=0)
+ return;
+ fprintf(stderr,_("Retry %d: "),errors);
+ VA_START(ap, fmt);
+ vfprintf(stderr,fmt, ap);
+ va_end(ap);
+ putc('\n',stderr);
+}
+
+void
+#ifdef WAYTOGO
+zpfatal(const char *fmt, ...)
+#else
+zpfatal(fmt, va_alist)
+ const char *fmt;
+ va_dcl
+#endif
+{
+ va_list ap;
+ int err=errno;
+
+ if (Verbose<=0)
+ return;
+ fprintf(stderr,"%s: ",program_name);
+ VA_START(ap, fmt);
+ vfprintf(stderr,fmt, ap);
+ va_end(ap);
+ fprintf(stderr,": %s\n",strerror(err));
+}
+
+void
+#ifdef WAYTOGO
+vfile(const char *format, ...)
+#else
+vfile(format, va_alist)
+ const char *format;
+ va_dcl
+#endif
+{
+ va_list ap;
+
+ if (Verbose < 3)
+ return;
+ VA_START(ap, format);
+ vfprintf(stderr,format, ap);
+ va_end(ap);
+ putc('\n',stderr);
+}
+
+#ifndef vstringf
+/* if using gcc this function is not needed */
+void
+#ifdef WAYTOGO
+vstringf(const char *format, ...)
+#else
+vstringf(format, va_alist)
+ const char *format;
+ va_dcl
+#endif
+{
+ va_list ap;
+
+ VA_START(ap, format);
+ vfprintf(stderr,format, ap);
+ va_end(ap);
+}
+#endif
diff --git a/src/zreadline.c b/src/zreadline.c
new file mode 100644
index 0000000..dd9736b
--- /dev/null
+++ b/src/zreadline.c
@@ -0,0 +1,136 @@
+/*
+ zreadline.c - line reading stuff for lrzsz
+ Copyright (C) until 1998 Chuck Forsberg (OMEN Technology Inc)
+ Copyright (C) 1994 Matt Porter
+ Copyright (C) 1996, 1997 Uwe Ohse
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ originally written by Chuck Forsberg
+*/
+/* once part of lrz.c, taken out to be useful to lsz.c too */
+
+#include "zglobal.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "error.h"
+
+
+/* Ward Christensen / CP/M parameters - Don't change these! */
+#define TIMEOUT (-2)
+
+static size_t readline_readnum;
+static int readline_fd;
+static char *readline_buffer;
+int readline_left=0;
+char *readline_ptr;
+
+static RETSIGTYPE
+zreadline_alarm_handler(int dummy)
+{
+ dummy++; /* doesn't need to do anything */
+}
+
+/*
+ * This version of readline is reasonably well suited for
+ * reading many characters.
+ *
+ * timeout is in tenths of seconds
+ */
+int
+readline_internal(unsigned int timeout)
+{
+
+ if (!no_timeout)
+ {
+ unsigned int n;
+ n = timeout/10;
+ if (n < 2 && timeout!=1)
+ n = 3;
+ else if (n==0)
+ n=1;
+ if (Verbose > 5)
+ vstringf("Calling read: alarm=%d Readnum=%d ",
+ n, readline_readnum);
+ signal(SIGALRM, zreadline_alarm_handler);
+ alarm(n);
+ }
+ else if (Verbose > 5)
+ vstringf("Calling read: Readnum=%d ",
+ readline_readnum);
+
+ readline_ptr=readline_buffer;
+ readline_left=read(readline_fd, readline_ptr, readline_readnum);
+ if (!no_timeout)
+ alarm(0);
+ if (readline_left>0 && bytes_per_error) {
+ static long ct=0;
+ static int mod=1;
+ ct+=readline_left;
+ while (ct>bytes_per_error) {
+ readline_ptr[ct % bytes_per_error]^=mod;
+ ct-=bytes_per_error;
+ mod++;
+ if (mod==256)
+ mod=1;
+ }
+ }
+ if (Verbose > 5) {
+ vstringf("Read returned %d bytes\n", readline_left);
+ if (readline_left==-1)
+ vstringf("errno=%d:%s\n", errno,strerror(errno));
+ if (Verbose > 9 && readline_left>0) {
+ int i,j;
+ j=readline_left > 48 ? 48 : readline_left;
+ vstring(" ");
+ for (i=0;i<j;i++) {
+ if (i%24==0 && i)
+ vstring("\n ");
+ vstringf("%02x ", readline_ptr[i] & 0377);
+ }
+ vstringf("\n");
+ }
+ }
+ if (readline_left < 1)
+ return TIMEOUT;
+ --readline_left;
+ return (*readline_ptr++ & 0377);
+}
+
+
+
+void
+readline_setup(int fd, size_t readnum, size_t bufsize)
+{
+ readline_fd=fd;
+ readline_readnum=readnum;
+ readline_buffer=malloc(bufsize > readnum ? bufsize : readnum);
+ if (!readline_buffer)
+ error(1,0,_("out of memory"));
+}
+
+void
+readline_purge(void)
+{
+ readline_left=0;
+ return;
+}
+
diff --git a/stamp-h.in b/stamp-h.in
new file mode 100644
index 0000000..9788f70
--- /dev/null
+++ b/stamp-h.in
@@ -0,0 +1 @@
+timestamp
diff --git a/systype.in b/systype.in
new file mode 100644
index 0000000..9d51b15
--- /dev/null
+++ b/systype.in
@@ -0,0 +1,211 @@
+#! /bin/sh
+
+CC="@CC@"
+CFLAGS="@CFLAGS@"
+GCC="@GCC@"
+
+srcdir=@srcdir@
+
+# oper-:arch-:syst-:chip-:kern-
+# oper = operating system type; e.g., sunos-4.1.4
+# arch = machine language; e.g., sparc
+# syst = which binaries can run; e.g., sun4
+# chip = chip model; e.g., micro-2-80
+# kern = kernel version; e.g., sun4m
+# dependence: arch --- chip
+# \ \
+# oper --- syst --- kern
+# so, for example, syst is interpreted in light of oper, but chip is not.
+# anyway, no slashes, no extra colons, no uppercase letters.
+# the point of the extra -'s is to ease parsing: can add hierarchies later.
+# e.g., *:i386-*:*:pentium-*:* would handle pentium-100 as well as pentium,
+# and i386-486 (486s do have more instructions, you know) as well as i386.
+# the idea here is to include ALL useful available information.
+
+sys="`uname -s 2>/dev/null | tr '/:[A-Z]' '..[a-z]'`"
+if [ x"$sys" != x ]
+then
+ unamer="`uname -r 2>/dev/null | tr /: ..`"
+ unamem="`uname -m 2>/dev/null | tr /: ..`"
+ unamev="`uname -v 2>/dev/null | tr /: ..`"
+
+ case "$sys" in
+ bsd.os)
+ # in bsd 4.4, uname -v does not have useful info.
+ # in bsd 4.4, uname -m is arch, not chip.
+ oper="$sys-$unamer"
+ arch="$unamem"
+ syst=""
+ chip="`sysctl -n hw.model 2>/dev/null`"
+ kern=""
+ ;;
+ freebsd)
+ # see above about bsd 4.4
+ oper="$sys-$unamer"
+ arch="$unamem"
+ syst=""
+ chip="`sysctl -n hw.model 2>/dev/null`" # hopefully
+ kern=""
+ ;;
+ netbsd)
+ # see above about bsd 4.4
+ oper="$sys-$unamer"
+ arch="$unamem"
+ syst=""
+ chip="`sysctl -n hw.model 2>/dev/null`" # hopefully
+ kern=""
+ ;;
+ linux)
+ # i'd really like to know what distribution the user has ...
+
+ # as in bsd 4.4, uname -v does not have useful info.
+ oper="$sys-$unamer" # not oper!
+ syst=""
+ chip="$unamem"
+ case "$chip" in
+ i386|i486|i586|i686)
+ arch="i386"
+ ;;
+ alpha)
+ arch="alpha"
+ ;;
+ esac
+ ;;
+ aix)
+ # naturally IBM has to get uname -r and uname -v backwards. dorks.
+ oper="$sys-$unamev-$unamer"
+ arch="`arch 2>/dev/null | tr /: ..`"
+ syst=""
+ chip="$unamem"
+ kern=""
+ ;;
+ sunos)
+ oper="$sys-$unamer-$unamev"
+ arch="`(uname -p 2>/dev/null || mach 2>/dev/null ) | tr /: ..`"
+ syst="`arch 2>/dev/null | tr /: ..`"
+ chip="$unamem" # this is wrong; is there any way to get the real info?
+ kern="`arch -k 2>/dev/null | tr /: ..`"
+ ;;
+ unix_sv)
+ oper="$sys-$unamer-$unamev"
+ arch="`uname -m 2>/dev/null`"
+ syst=""
+ chip="$unamem"
+ kern=""
+ ;;
+ beos)
+ oper="$sys-$unamer-$unamev"
+ case "$unamem" in
+ *BePC*)
+ arch="i386";
+ chip="";
+ if /bin/sysinfo -cpu 2>/dev/null >/dev/null ; then
+ (/bin/sysinfo -cpu 2>/dev/null |grep PentiumPro >/dev/null) && chip=ppro;
+ test "$chip" = "" && \
+ (/bin/sysinfo -cpu 2>/dev/null |grep Pentium >/dev/null) && chip=pentium;
+ fi
+ ;;
+ esac
+ ;;
+ *)
+ need_config_guess=1;
+ ;;
+ esac
+else
+ need_config_guess=1;
+fi
+
+if test "x$need_config_guess" = x1 ; then
+ cg=`$srcdir/config.guess` # cpu-company-system
+ if test "x$cg" = x ; then
+ # damned, config.guess does nothing if it doesn't support the
+ # system.
+ oper="`uname -s 2>/dev/null | tr '/:[A-Z]' '..[a-z]'`"
+ chip="`uname -m 2>/dev/null | tr /: ..`"
+ if test "x$oper" = x ; then
+ oper="unknown"
+ fi
+ else
+ # cpu-company-system
+ # chip-useless-oper+version
+ # i586-unknown-sco3.2v4.2
+ # m68k-hp-hpux9.00
+ # i486-unknown-linux
+ chip="`echo $cg | sed s/-.*//`"
+ oper="`echo $cg | sed s/.*-// | tr '[A-Z]' '[a-z]'`"
+ case "$oper" in
+ *[0-9]*)
+ # sco3.2v4.2
+ # hpux9.00
+ x="`echo $oper|sed 's/[0-9].*//'`"
+ y="`echo $oper|sed 's/^[a-z]*//'`"
+ oper="$x-$y";
+ ;;
+ *linux*)
+ oper=linux-"`uname -r`"
+ ;;
+ esac
+ fi
+fi
+
+
+case "$chip" in
+80486)
+ # let's try to be consistent here. (BSD/OS)
+ chip=i486
+ ;;
+i486DX)
+ # respect the hyphen hierarchy. (FreeBSD)
+ chip=i486-dx
+ ;;
+i486.DX2)
+ # respect the hyphen hierarchy. (FreeBSD)
+ chip=i486-dx2
+ ;;
+Intel.586)
+ # no, you nitwits, there is no such chip. (NeXTStep)
+ chip=pentium
+ ;;
+i586)
+ # no, you nitwits, there is no such chip. (Linux)
+ chip=pentium
+ # djb, stop bashing linux alone, bash to GNU people too ...
+ # config.guess also does this!
+ ;;
+i686)
+ # STOP SAYING THAT! (Linux)
+ chip=ppro
+esac
+if test "x$arch" = x ; then
+ if test "x$chip" = i386 -o "x$chip" = i486 -o "x$chip" = "pentium" \
+ -o "x$chip" = "ppro" ; then
+ arch="i386";
+ fi
+fi
+
+x=`echo "$oper-:$arch-:$syst-:$chip-:$kern-" | tr ' [A-Z]' '.[a-z]'`
+
+if test x"$@" = x ; then
+ echo "Future @PACKAGE@ versions will include a list of systems this version" >&2
+ echo "was compiled under (that's what you send this message for). In case" >&2
+ echo "want to see a shorthand expression of your real name in this list" >&2
+ echo "you may provide it here:" >&2
+ echo "Realname: " >&2
+ read realname
+else
+ realname="$@"
+fi
+
+echo # BeOS /bin/mail doesn't generate any header ...
+echo ""
+echo "SYS: $x"
+echo "PACKAGE: @PACKAGE@ @VERSION@"
+cc="`echo \"$CC\"|sed 's/ .*//'`"
+x=`$CC --version </dev/null 2>/dev/null`
+echo "CC: $cc $x"
+echo "CFLAGS: $CFLAGS"
+if test "x$realname" = x ; then
+ :
+else
+ echo "REALNAME: $realname"
+fi
diff --git a/testsuite/CVS/Entries b/testsuite/CVS/Entries
new file mode 100644
index 0000000..488aa68
--- /dev/null
+++ b/testsuite/CVS/Entries
@@ -0,0 +1,5 @@
+/Makefile.am/1.2/Thu Oct 8 18:15:46 1998/-ko/
+/Makefile.in/1.5/Thu Jun 3 15:43:16 1999/-ko/
+D/config////
+D/lib////
+D/lrzsz////
diff --git a/testsuite/CVS/Repository b/testsuite/CVS/Repository
new file mode 100644
index 0000000..7429d41
--- /dev/null
+++ b/testsuite/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/testsuite
diff --git a/testsuite/CVS/Root b/testsuite/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/testsuite/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
new file mode 100644
index 0000000..71787ad
--- /dev/null
+++ b/testsuite/Makefile.am
@@ -0,0 +1,13 @@
+AUTOMAKE_OPTIONS=dejagnu
+
+DISTFILES=Makefile.am Makefile.in
+CLEANFILES=lrzsz.log lrzsz.sum site.bak
+DISTCLEANFILES=site.exp
+
+dist-hook:
+ mkdir $(distdir)/config
+ mkdir $(distdir)/lib
+ mkdir $(distdir)/lrzsz
+ cp -p $(srcdir)/config/*.exp $(distdir)/config
+ cp -p $(srcdir)/lib/*.exp $(distdir)/lib
+ cp -p $(srcdir)/lrzsz/*.exp $(distdir)/lrzsz
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
new file mode 100644
index 0000000..e36a96b
--- /dev/null
+++ b/testsuite/Makefile.in
@@ -0,0 +1,246 @@
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
+
+# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+DATADIRNAME = @DATADIRNAME@
+ENABLE_TIMESYNC = @ENABLE_TIMESYNC@
+GENCAT = @GENCAT@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+PACKAGE = @PACKAGE@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+U = @U@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+l = @l@
+
+AUTOMAKE_OPTIONS = dejagnu
+
+DISTFILES = Makefile.am Makefile.in
+CLEANFILES = lrzsz.log lrzsz.sum site.bak
+DISTCLEANFILES = site.exp
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+DIST_COMMON = Makefile.am Makefile.in
+
+
+TAR = gtar
+GZIP_ENV = --best
+EXPECT = expect
+RUNTEST = runtest
+all: all-redirect
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu testsuite/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+tags: TAGS
+TAGS:
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = testsuite
+
+distdir: $(DISTFILES)
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu testsuite/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pr $$d/$$file $(distdir)/$$file; \
+ else \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
+
+RUNTESTFLAGS =
+
+DEJATOOL = $(PACKAGE)
+
+RUNTESTDEFAULTFLAGS = --tool $(DEJATOOL) --srcdir $$srcdir
+
+check-DEJAGNU: site.exp
+ srcdir=`cd $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ $$runtest $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ else echo "WARNING: could not find \`runtest'" 1>&2; :;\
+ fi
+site.exp: Makefile
+ @echo 'Making a new site.exp file...'
+ @test ! -f site.bak || rm -f site.bak
+ @echo '## these variables are automatically generated by make ##' > $@-t
+ @echo '# Do not edit here. If you wish to override these values' >> $@-t
+ @echo '# edit the last section' >> $@-t
+ @echo 'set tool $(DEJATOOL)' >> $@-t
+ @echo 'set srcdir $(srcdir)' >> $@-t
+ @echo 'set objdir' `pwd` >> $@-t
+ @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
+ @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
+ @test ! -f site.exp || mv site.exp site.bak
+ @mv $@-t site.exp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am:
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am:
+uninstall: uninstall-am
+all-am: Makefile
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+installdirs:
+
+
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+mostlyclean-am: mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-generic mostlyclean-am
+
+clean: clean-am
+
+distclean-am: distclean-generic clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-generic distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: tags distdir check-DEJAGNU info-am info dvi-am dvi check \
+check-am installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+dist-hook:
+ mkdir $(distdir)/config
+ mkdir $(distdir)/lib
+ mkdir $(distdir)/lrzsz
+ cp -p $(srcdir)/config/*.exp $(distdir)/config
+ cp -p $(srcdir)/lib/*.exp $(distdir)/lib
+ cp -p $(srcdir)/lrzsz/*.exp $(distdir)/lrzsz
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/testsuite/config/CVS/Entries b/testsuite/config/CVS/Entries
new file mode 100644
index 0000000..e316d77
--- /dev/null
+++ b/testsuite/config/CVS/Entries
@@ -0,0 +1,2 @@
+/unix.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+D
diff --git a/testsuite/config/CVS/Repository b/testsuite/config/CVS/Repository
new file mode 100644
index 0000000..5ce4514
--- /dev/null
+++ b/testsuite/config/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/testsuite/config
diff --git a/testsuite/config/CVS/Root b/testsuite/config/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/testsuite/config/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/testsuite/config/unix.exp b/testsuite/config/unix.exp
new file mode 100644
index 0000000..76d156d
--- /dev/null
+++ b/testsuite/config/unix.exp
@@ -0,0 +1,8 @@
+proc lrzsz_version {} {
+ global objdir
+ set tmp [exec "$objdir/../src/lsz" "--version"]
+ regexp "lrzsz. (\[0-9.\]+)" $tmp tmp version
+ clone_output "$objdir/../src/lsz version $version\n"
+}
+proc lrzsz_exit {} {}
+
diff --git a/testsuite/lib/CVS/Entries b/testsuite/lib/CVS/Entries
new file mode 100644
index 0000000..ef93298
--- /dev/null
+++ b/testsuite/lib/CVS/Entries
@@ -0,0 +1,2 @@
+/lrzsz.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+D
diff --git a/testsuite/lib/CVS/Repository b/testsuite/lib/CVS/Repository
new file mode 100644
index 0000000..23fc628
--- /dev/null
+++ b/testsuite/lib/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/testsuite/lib
diff --git a/testsuite/lib/CVS/Root b/testsuite/lib/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/testsuite/lib/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/testsuite/lib/lrzsz.exp b/testsuite/lib/lrzsz.exp
new file mode 100644
index 0000000..4a1d754
--- /dev/null
+++ b/testsuite/lib/lrzsz.exp
@@ -0,0 +1,364 @@
+# change to tmp dir
+
+set z8_test_files ""
+set z_test_files ""
+set y_test_files ""
+set x_test_files ""
+set objdir [absolute $objdir]
+set srcdir [absolute $srcdir]
+
+set srcdir2 [exec sh -c "cd $srcdir/.. && pwd"]
+set objdir2 [exec sh -c "cd $objdir/.. && pwd"]
+
+set SZBUFSIZE "-B 524288"
+set RZBUFSIZE "-B 524288"
+set env(LANG) C
+#puts "LANG=$env(LANG)"
+
+foreach i [glob -nocomplain $srcdir/../src/l?z.c] {
+ set z_test_files "$z_test_files $i"
+ set x_test_files "$x_test_files $i"
+}
+foreach i [glob -nocomplain $objdir/../src/l?z] {
+ set z_test_files "$z_test_files $i"
+ set y_test_files "$y_test_files $i"
+}
+foreach i [glob -nocomplain /pub/gnu/emacs-*.tar.gz] {
+ set z8_test_files "$z8_test_files $i"
+}
+#puts "objdir=$objdir\n"
+#puts "srcdir=$srcdir\n"
+#puts "x_test_files=$x_test_files\n"
+#puts "y_test_files=$y_test_files\n"
+#puts "z_test_files=$z_test_files\n"
+#puts "z8_test_files=$z8_test_files\n"
+
+# change to tmp dir
+set TMPDIR [getenv TMPDIR]
+#puts "T=$TMPDIR\n"
+if [string compare "x$TMPDIR" "x"] then {
+ set MYTEMP "$TMPDIR"
+} else {
+ set MYTEMP "/tmp"
+}
+set OLDDIR [pwd]
+set testdir "$MYTEMP/test.lrzsz"
+exec rm -rf $testdir
+exec mkdir $testdir
+exec sh -c "mkfifo $testdir/pipe || mknod $testdir/pipe p"
+
+proc runthem_internal { name sz szopts rz rzopts files flags up} {
+ global MYTEMP
+ global OLDDIR
+ global testdir
+ global verbose
+ global fail_is_ok
+ upvar $up up_p
+ if {[string match "*mkdir*" $flags] == 1} {
+ exec mkdir $testdir/$name
+ }
+ set fails 0
+ cd $MYTEMP
+ catch "exec sh -c \"($sz $szopts $files) <$testdir/pipe | \
+ (cd $testdir/$name ; exec $rz $rzopts >>../pipe)\"" dummy
+ set up_p $dummy
+ foreach i $files {
+ set bn [file tail $i]
+ set v $verbose
+ if {[string match "*compare*" $flags] == 1} {
+ set res [catch "exec cmp $i $testdir/$name/$bn" dummy]
+ set verbose $v
+ if {$res == 0} {
+ if {[string match "*delete*" $flags] == 1} {
+ catch "file delete $testdir/$name/$bn" dummy
+ }
+ } else {
+ send_log "$i: not identical: cmp told\n"
+ send_log "$dummy\n"
+ incr fails
+ }
+ } else {
+ if {[string match "*delete*" $flags] == 1} {
+ catch "file delete $testdir/$name/$bn" dummy
+ }
+ }
+ }
+ if {[string match "*rmdir*" $flags] == 1} {
+ set res [catch "exec rmdir $testdir/$name" dummy]
+ if {$res != 0} {
+ send_log "rmdir failed: $dummy\n"
+ incr fails
+ }
+ }
+ if [info exists "fail_is_ok"] {
+ if {$fails > 0} {
+ set fails 0;
+ } else {
+ set fails 1;
+ }
+ }
+ cd $OLDDIR
+ return $fails
+}
+
+# own test function for xmodem: xmodem can't transfer file names
+proc runxmodem { name sz szopts rz rzopts files } {
+ global MYTEMP
+ global OLDDIR
+ global testdir
+ global verbose
+ verbose "Testing $name" 1
+ exec mkdir $testdir/$name
+ set failed 0
+ cd $MYTEMP
+ foreach i $files {
+ set bn [file tail $i]
+ set output [catch "set done [exec sh -c "($sz $szopts --xmodem $i 2>/dev/null) \
+ <$testdir/pipe | \
+ (cd $testdir/$name ; exec $rz $rzopts --xmodem $bn >>../pipe 2>/dev/null)"]]"]
+ set res [catch "exec cmp $i $testdir/$name/$bn" dummy]
+ if {$res == 0} {
+ catch "file delete $testdir/$name/$bn" dummy
+ } else {
+ send_log "$i: not identical: cmp told\n"
+ send_log "$dummy\n"
+ set failed 1
+ }
+ }
+ set res [catch "exec rmdir $testdir/$name" dummy]
+ if {$res != 0} {
+ send_log "rmdir: $dummy\n"
+ set failed 1
+ }
+ cd $OLDDIR
+ if {$failed == 0} {
+ pass "$name"
+ } else {
+ fail "$name"
+ }
+}
+
+proc runthem { name sz szopts rz rzopts files } {
+ verbose "Testing $name" 1
+ set fails [runthem_internal "$name" "$sz" "$szopts" "$rz" "$rzopts" \
+ "$files" "mkdir,compare,delete,rmdir" dummy]
+ if {$fails == 0} {
+ pass "$name"
+ } else {
+ fail "$name"
+ }
+}
+
+proc runabuse { name sz szopts rz rzopts files } {
+ global fail_is_ok
+ global testdir
+
+ set fail_is_ok 1
+ verbose "Testing $name" 1
+ set fails [runthem_internal "$name" "$sz" "$szopts" "$rz" "$rzopts" \
+ "$files" "mkdir" output]
+ if {$fails == 1 && [string match "*ZRINIT*" $output]} {
+ set fails 0
+ }
+ if {$fails == 1 && [string match "*Broken pipe*" $output]} {
+ set fails 0
+ }
+ if {$fails == 1 && [string match "*caught signal*" $output]} {
+ set fails 0
+ }
+ if {$fails == 1 && [string match "*exited abnormally*" $output]} {
+ set fails 0
+ }
+ if {$fails == 0} {
+ exec rm -rf "$testdir/$name"
+ pass "$name"
+ } else {
+#puts "fails=$fails"
+ fail "$name"
+ }
+ unset fail_is_ok
+}
+
+proc runthem0 { name sz szopts rz rzopts files } {
+ verbose "Testing $name (write to /dev/null)" 1
+ set fails [runthem_internal "$name" "$sz" "$szopts" "$rz" "$rzopts" \
+ "$files" "mkdir,rmdir" dummy]
+ if {$fails == 0} {
+ pass "$name"
+ } else {
+ fail "$name"
+ }
+}
+
+proc runappend { name sz szopts rz rzopts file} {
+ global testdir
+ verbose "Testing $name" 1
+ set fails [runthem_internal "$name" "$sz" "$szopts" "$rz" "$rzopts" \
+ "$file $file" "mkdir" dummy]
+ if {$fails == 0} {
+ set compare "$testdir/$name/compare"
+ set bn [file tail $file]
+ exec rm -f $compare
+ exec cp $file $compare
+ exec cat $file >>$compare
+
+ set res [catch "exec cmp $testdir/$name/$bn $compare" dummy]
+ if {$res != 0} {
+ incr fails
+ } else {
+ catch "file delete $testdir/$name/$bn" dummy
+ catch "file delete $compare" dummy
+ }
+ }
+ if {$fails == 0} {
+ set res [catch "exec rmdir $testdir/$name" dummy]
+ if {$res != 0} {
+ incr fails
+ }
+ }
+
+ if {$fails == 0} {
+ pass "$name"
+ } else {
+ fail "$name"
+ }
+}
+
+#
+proc runrename { name sz szopts rz rzopts files} {
+ global testdir
+ verbose "Testing $name" 1
+ exec mkdir $testdir/$name
+ foreach i $files {
+ set bn [file tail $i]
+ exec touch "$testdir/$name/$bn"
+ exec echo "1234" ">$testdir/$name/$bn.0"
+ }
+ set fails [runthem_internal "$name" "$sz" "$szopts" "$rz" "$rzopts" \
+ "$files" "" dummy]
+ if {$fails == 0} {
+ foreach i $files {
+ set bn [file tail $i]
+ set f "$testdir/$name/$bn"
+ if {[file size $f] != 0} {
+ incr fails
+ send_log "$f: size !=0\n"
+ } else {
+ set s [file size $f.0]
+ if {$s == 0 || $s>5} {
+ incr fails
+ send_log "$f: size !=5\n"
+ } else {
+ set compare "$f.1"
+ set res [catch "exec cmp $i $compare" dummy]
+ if {$res != 0} {
+ incr fails
+ send_log "$f: compare failed\n"
+ } else {
+ catch "file delete $f" dummy
+ catch "file delete $f.0" dummy
+ catch "file delete $f.1" dummy
+ }
+ }
+ }
+ }
+ }
+ if {$fails == 0} {
+ set res [catch "exec rmdir $testdir/$name" dummy]
+ if {$res != 0} {
+ incr fails
+ }
+ }
+
+ if {$fails == 0} {
+ pass "$name"
+ } else {
+ fail "$name"
+ }
+}
+
+proc runresume { name sz szopts rz rzopts files} {
+ global testdir
+ global srcdir
+ verbose "Testing $name" 1
+ exec mkdir $testdir/$name
+ set trash $srcdir/../src/Makefile.in
+ foreach i $files {
+ set bn [file tail $i]
+ catch "exec dd if=$trash of=$testdir/$name/$bn bs=256 count=5" dummy
+ }
+
+ set fails [runthem_internal "$name" "$sz" "$szopts" "$rz" "$rzopts" \
+ "$files" "" dummy]
+ if {$fails == 0} {
+ foreach i $files {
+ set bn [file tail $i]
+ set f "$testdir/$name/$bn"
+ set res [catch "exec cmp $i $f" dummy]
+ if {$res == 0} {
+ send_log "receiver did not resume but file is OK\n"
+ puts "receiver did not resume but file is OK - error, but not critical"
+ incr fails
+ } else {
+ catch "exec dd if=$i of=$f.1 bs=256 count=5" dummy
+ catch "exec dd if=$f bs=256 skip=5 >>$f.1" dummy
+ set res [catch "exec cmp $i $f.1" dummy]
+ if {$res == 0} {
+ catch "file delete $f" dummy
+ catch "file delete $f.1" dummy
+ } else {
+ send_log "sender resumed, but files differ. This is really bad\n"
+ puts "sender resumed, but files differ. This is really bad"
+ incr fails
+ }
+ }
+ }
+ }
+ if {$fails == 0} {
+ set res [catch "exec rmdir $testdir/$name" dummy]
+ if {$res != 0} {
+ incr fails
+ }
+ }
+
+ if {$fails == 0} {
+ pass "$name"
+ } else {
+ fail "$name"
+ }
+}
+
+# --protect option
+proc runprotect { name sz szopts rz rzopts files} {
+ global testdir
+ verbose "Testing $name" 1
+ exec mkdir $testdir/$name
+ foreach i $files {
+ set bn [file tail $i]
+ exec touch "$testdir/$name/$bn"
+ }
+ set fails [runthem_internal "$name" "$sz" "$szopts" "$rz" "$rzopts" \
+ "$files" "" dummy]
+ foreach i $files {
+ set bn [file tail $i]
+ set f "$testdir/$name/$bn"
+ if {[file size $f] != 0} {
+ incr fails
+ send_log "$f: size !=0 - overwritten, nit protected\n"
+ } else {
+ catch "file delete $f" dummy
+ }
+ }
+ if {$fails == 0} {
+ set res [catch "exec rmdir $testdir/$name" dummy]
+ if {$res != 0} {
+ incr fails
+ }
+ }
+
+ if {$fails == 0} {
+ pass "$name"
+ } else {
+ fail "$name"
+ }
+}
diff --git a/testsuite/lrzsz/CVS/Entries b/testsuite/lrzsz/CVS/Entries
new file mode 100644
index 0000000..20835c2
--- /dev/null
+++ b/testsuite/lrzsz/CVS/Entries
@@ -0,0 +1,18 @@
+/abuse.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/command.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/compatability.exp/1.2/Sun Aug 22 18:51:21 1999/-ko/
+/crc.exp/1.2/Thu Oct 8 18:15:47 1998/-ko/
+/manage.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/newer.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/null.exp/1.2/Sun Aug 22 18:51:21 1999/-ko/
+/path.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/resume.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/timing.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/uppercase.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/window.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/xmodem.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/ymodem.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/zmodem-crc16.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/zmodem-escape.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+/zmodem.exp/1.1.1.1/Sun Apr 26 13:22:52 1998/-ko/
+D
diff --git a/testsuite/lrzsz/CVS/Repository b/testsuite/lrzsz/CVS/Repository
new file mode 100644
index 0000000..fcdd351
--- /dev/null
+++ b/testsuite/lrzsz/CVS/Repository
@@ -0,0 +1 @@
+lrzsz/testsuite/lrzsz
diff --git a/testsuite/lrzsz/CVS/Root b/testsuite/lrzsz/CVS/Root
new file mode 100644
index 0000000..97a1f75
--- /dev/null
+++ b/testsuite/lrzsz/CVS/Root
@@ -0,0 +1 @@
+/var/cvs-pub
diff --git a/testsuite/lrzsz/abuse.exp b/testsuite/lrzsz/abuse.exp
new file mode 100644
index 0000000..577983e
--- /dev/null
+++ b/testsuite/lrzsz/abuse.exp
@@ -0,0 +1,13 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# sz <-> sz
+runabuse abuse-sz $objdir/../src/lsz "-q" \
+ $objdir/../src/lsz "-q $z_test_files" "$z_test_files"
+# rz <-> rz
+runabuse abuse-rz $objdir/../src/lrz "-q" \
+ $objdir/../src/lrz "-q" ""
+
+
diff --git a/testsuite/lrzsz/command.exp b/testsuite/lrzsz/command.exp
new file mode 100644
index 0000000..4ca94e1
--- /dev/null
+++ b/testsuite/lrzsz/command.exp
@@ -0,0 +1,75 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# i would really like to throw that code out of zmodem ...
+# but then again: somebody might need it, and it's disabled by default.
+# so check first: is it _really_ disabled?
+
+#puts RES=[getenv ZMODEM_RESTRICTED]
+if {[string compare [getenv ZMODEM_RESTRICTED] ""] != 0} {
+ unsetenv ZMODEM_RESTRICTED
+}
+
+proc runcommand { name sz szopts rz rzopts expect_fail} {
+ global MYTEMP
+ global testdir
+ set magic XXXYYYZZZ
+ verbose "Testing $name" 1
+ catch "exec rm -f $testdir/command_tmp"
+ set fails [runthem_internal "$name" "$sz" "$szopts" "$rz" "$rzopts" \
+ "\\\"echo $magic \\>$testdir/command_tmp\\\"" "mkdir,rmdir" dummy]
+ if {[file exists $testdir/command_tmp] == 0} {
+ set fails 1;
+ }
+ if {$fails == 0} {
+ catch "set dummy [grep $testdir/command_tmp $magic]"
+ if [string compare $magic $dummy] {
+ incr fails
+ send_log "grep fetch not $magic\n";
+ }
+ } else {
+ send_log "call failed\n";
+ }
+ if [string compare $expect_fail "OK"] {
+ if {$fails > 0} {
+ set fails 0;
+ } else {
+ set fails 1;
+ }
+ }
+ if {$fails == 0} {
+ pass "$name"
+ } else {
+ fail "$name"
+ }
+}
+
+runcommand command-disabled $objdir/../src/lsz "-q -c" \
+ "$objdir/../src/lrz" "" FAIL
+runcommand command-enabled-restricted $objdir/../src/lsz "-q -c" \
+ "$objdir/../src/lrz" "-C" FAIL
+runcommand command-enabled-unrestricted $objdir/../src/lsz "-q -c" \
+ "$objdir/../src/lrz" "--unrestrict --allow-commands" OK
+# same for -i
+runcommand i-command-disabled $objdir/../src/lsz "-q -i" \
+ "$objdir/../src/lrz" "" FAIL
+runcommand i-command-enabled-restricted $objdir/../src/lsz "-q -i" \
+ "$objdir/../src/lrz" "-C" FAIL
+runcommand i-command-enabled-unrestricted $objdir/../src/lsz "-q -i" \
+ "$objdir/../src/lrz" "--unrestrict --allow-commands" OK
+
+# basic tests done
+
+#set and unset ZMODEM_RESTRICTED. Should work.
+runcommand command-restricted-by-env "$objdir/../src/lsz" "-q -c" \
+ "env ZMODEM_RESTRICTED=1 sh -c '$objdir/../src/lrz -qUC'" "" OK
+# "strace -vfs 128 -o /tmp/o2 env ZMODEM_RESTRICTED=1 sh -c \"$objdir/../src/lrz -qUC\"" "" OK
+# must not work.
+runcommand command-rbash-receiver "$objdir/../src/lsz" "-q -c" \
+ "env SHELL=rbash sh -c '$objdir/../src/lrz -qUC'" "" FAIL
+# must not work.
+runcommand command-rbash-sender "env SHELL=rbash sh -c '$objdir/../src/lsz -qc'" "" \
+ "$objdir/../src/lrz" "-qUC" FAIL
+
diff --git a/testsuite/lrzsz/compatability.exp b/testsuite/lrzsz/compatability.exp
new file mode 100644
index 0000000..d8347aa
--- /dev/null
+++ b/testsuite/lrzsz/compatability.exp
@@ -0,0 +1,68 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set omen_sz [which omen.sz]
+set omen_rz [which omen.rz]
+set zmtx [which zmtx]
+set zmrx [which zmrx]
+# one short file - omen is slow ...
+set files "$srcdir/../src/lsz.c $srcdir/../src/lsyslog.c"
+if [string compare "$omen_sz" 0] {
+ set bn [file tail $omen_sz]
+ runthem compat-$bn $omen_sz "" \
+ $objdir/../src/lrz "-q" $files
+ runthem compat-$bn-delay $omen_sz "" \
+ $objdir/../src/lrz "-q --delay-startup 10" $files
+ # oops. omen.sz has a really bad error behaviour
+ runthem compat-$bn-errors $omen_sz "" \
+ $objdir/../src/lrz "-q --errors 32768" $files
+} else {
+ set bn [file tail $omen_sz]
+ unsupported "compat-omen-sz: omen.sz not available"
+ unsupported "compat-omen-sz-delay: omen.sz not available"
+ unsupported "compat-omen-sz-errors: omen.sz not available"
+}
+if [string compare "$zmtx" 0] {
+ set bn [file tail $zmtx]
+ runthem compat-$bn $zmtx "" \
+ $objdir/../src/lrz "-q" $files
+ runthem compat-$bn-delay $zmtx "" \
+ $objdir/../src/lrz "-q --delay-startup 10" $files
+ runthem compat-$bn-errors $zmtx "" \
+ $objdir/../src/lrz "-q --errors 32768" $files
+} else {
+ unsupported "compat-zmtx: zmtx not available"
+ unsupported "compat-zmtx-delay: zmtx not available"
+ unsupported "compat-zmtx-errors: zmtx not available"
+}
+
+if [string compare "$omen_rz" 0] {
+ set bn [file tail $omen_rz]
+ runthem compat-$bn $objdir/../src/lsz "-q" \
+ $omen_rz "" $files
+ runthem compat-$bn-delay "$objdir/../src/lsz" "-q --delay-startup 10" \
+ $omen_rz "" $z_test_files
+ runthem compat-$bn-turbo "$objdir/../src/lsz" "-q --turbo" \
+ $omen_rz "" $z_test_files
+} else {
+ unsupported "compat-omen_rz: omen.rz bn not available"
+ unsupported "compat-omen_rz-delay: omen.rz bn not available"
+ unsupported "compat-omen_rz-errors: omen.rz not available"
+}
+
+if [string compare "$zmrx" 0] {
+ set bn [file tail $zmrx]
+ runthem compat-$bn $objdir/../src/lsz "-q" \
+ $zmrx "" $files
+ runthem compat-$bn-delay "$objdir/../src/lsz" "-q --delay-startup 10" \
+ $zmrx "" $z_test_files
+ runthem compat-$bn-turbo "$objdir/../src/lsz" "-q --turbo" \
+ $zmrx "" $z_test_files
+} else {
+ unsupported "compat-zmrx: zmrx bn not available"
+ unsupported "compat-zmrx-delay: zmrx bn not available"
+ unsupported "compat-zmrx-errors: zmrx not available"
+}
+unset bn
diff --git a/testsuite/lrzsz/crc.exp b/testsuite/lrzsz/crc.exp
new file mode 100644
index 0000000..190fcb9
--- /dev/null
+++ b/testsuite/lrzsz/crc.exp
@@ -0,0 +1,245 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# ZMCRC test. Belongs to filemanagment ...
+
+# Part 1: file exists, same length, crc identical. sender init
+set name crc-check-sender-equal-crc
+exec mkdir $testdir/$name
+exec cp -p $objdir/../src/lrz $testdir/$name/lrz
+
+# this deals with different touch -t conventions. (POSIX/pre-posix-HPUX in this case)
+catch "exec sh -c \"touch -t 020304051980.06 $testdir/$name/lrz || touch -t 198002030405.06 $testdir/$name/lrz\"" dummy
+catch "exec ls -l $testdir/$name/lrz 2>/dev/null" timestamp
+set fails [runthem_internal $name "$objdir/../src/lsz -B 10240" "-q --crc-check" \
+ $objdir/../src/lrz "-q" \
+ "$objdir/../src/lrz" "" dummy]
+if {$fails == 0} {
+ set res [catch "exec cmp $objdir/../src/lrz $testdir/$name/lrz" dummy]
+ if {$res == 0} {
+ catch "exec ls -l $testdir/$name/lrz 2>/dev/null" dummy
+ if {0!=[string compare "$dummy" "$timestamp"]} {
+ send_log "timestamp changed\n"
+ send_log "1. $timestamp\n"
+ send_log "2. $dummy\n"
+ incr fails
+ } else {
+ send_log "timestamp ok\n"
+ send_log "1. $timestamp\n"
+ send_log "2. $dummy\n"
+ }
+ } else {
+ send_log "files not identical: cmp told\n"
+ send_log "$dummy\n"
+ incr fails
+ }
+} else {
+ incr fails
+}
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy timestamp
+
+# Part 2: file exists, same length, crc identical. sender init. no mmap
+# (ZCRC code on sender side is different if using mmap)
+set name crc-check-sender-equal-crc-no-mmap
+exec mkdir $testdir/$name
+exec cp -p $objdir/../src/lrz $testdir/$name/lrz
+catch "exec sh -c \"touch -t 020304051980.06 $testdir/$name/lrz || touch -t 198002030405.06 $testdir/$name/lrz\"" dummy
+catch "exec ls -l $testdir/$name/lrz 2>/dev/null" timestamp
+set fails [runthem_internal $name "/tmp/out $objdir/../src/lsz -B 10240" "-q --crc-check" \
+ $objdir/../src/lrz "-q" \
+ "$objdir/../src/lrz" "" dummy]
+if {$fails == 0} {
+ set res [catch "exec cmp $objdir/../src/lrz $testdir/$name/lrz" dummy]
+ if {$res == 0} {
+ catch "exec ls -l $testdir/$name/lrz 2>/dev/null" dummy
+ if {0!=[string compare "$dummy" "$timestamp"]} {
+ send_log "timestamp changed\n"
+ send_log "1. $timestamp\n"
+ send_log "2. $dummy\n"
+ incr fails
+ } else {
+ send_log "timestamp ok\n"
+ send_log "1. $timestamp\n"
+ send_log "2. $dummy\n"
+ }
+ } else {
+ send_log "files not identical: cmp told\n"
+ send_log "$dummy\n"
+ incr fails
+ }
+} else {
+ incr fails
+}
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy timestamp
+
+# Part 3: file exists, same length, crc identical. receiver init
+set name crc-check-receiver-equal-crc
+exec mkdir $testdir/$name
+exec cp -p $objdir/../src/lrz $testdir/$name/lrz
+catch "exec sh -c \"touch -t 020304051980.06 $testdir/$name/lrz || touch -t 198002030405.06 $testdir/$name/lrz\"" dummy
+catch "exec ls -l $testdir/$name/lrz 2>/dev/null" timestamp
+set fails [runthem_internal $name "$objdir/../src/lsz" "-q" \
+ $objdir/../src/lrz "-q --crc-check" \
+ "$objdir/../src/lrz" "" dummy]
+if {$fails == 0} {
+ set res [catch "exec cmp $objdir/../src/lrz $testdir/$name/lrz" dummy]
+ if {$res == 0} {
+ catch "exec ls -l $testdir/$name/lrz 2>/dev/null" dummy
+ if {0!=[string compare "$dummy" "$timestamp"]} {
+ send_log "timestamp changed\n"
+ send_log "1. $timestamp\n"
+ send_log "2. $dummy\n"
+ incr fails
+ } else {
+ send_log "timestamp ok\n"
+ send_log "1. $timestamp\n"
+ send_log "2. $dummy\n"
+ }
+ } else {
+ send_log "files not identical: cmp told\n"
+ send_log "$dummy\n"
+ incr fails
+ }
+} else {
+ incr fails
+}
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy timestamp
+
+# from now on ignore who initiates the crc-check. We know that both sides
+# can init it, from Part 1 & 2.
+
+exec logger 4
+# Part 4: file exists, same length, crc differs.
+set name crc-check-diff-crc
+exec mkdir $testdir/$name
+exec cp $objdir/../src/lrz $testdir/$name/lrz
+catch "exec dd if=$srcdir/../src/lrz.c of=$testdir/$name/lrz conv=notrunc bs=512 count=1"
+set fails [runthem_internal $name "$objdir/../src/lsz" "-q --crc-check" \
+ "$objdir/../src/lrz" "-q" \
+ "$objdir/../src/lrz" "rmdir,compare,delete" dummy]
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy
+
+# Part 5: file exists, different length, same crc.
+set name crc-check-diff-len
+exec mkdir $testdir/$name
+catch "exec dd if=$srcdir/../src/lrz.c of=$testdir/$name/lrz.c conv=notrunc bs=256 count=81"
+set fails [runthem_internal $name "$objdir/../src/lsz" "-q --crc-check" \
+ $objdir/../src/lrz "-q" \
+ "$srcdir/../src/lrz.c" "rmdir,compare,delete" dummy]
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy
+
+exec logger 6
+# Part 6: file exists, different length, diff crc.
+set name crc-check-diff-len-crc
+exec mkdir $testdir/$name
+catch "exec dd if=$srcdir/../src/lrz.c of=$testdir/$name/lrz.c conv=notrunc bs=256 count=81"
+catch "exec dd if=$objdir/../src/lrz of=$testdir/$name/lrz.c conv=notrunc bs=512 count=1"
+set fails [runthem_internal $name "$objdir/../src/lsz" "-q --crc-check" \
+ $objdir/../src/lrz "-q" \
+ "$srcdir/../src/lrz.c" "rmdir,compare,delete" dummy]
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy
+
+
+exec logger 7
+# Part 7: file exists, different length, same crc. try resume
+set name crc-check-diff-len-resume-sender
+exec mkdir $testdir/$name
+catch "exec dd if=$srcdir/../src/lrz.c of=$testdir/$name/lrz.c conv=notrunc bs=256 count=81"
+set fails [runthem_internal $name "$objdir/../src/lsz" "-q -r --crc-check" \
+ $objdir/../src/lrz "-q" \
+ "$srcdir/../src/lrz.c" "rmdir,compare,delete" dummy]
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy
+
+exec logger part 8
+# Part 8: file exists, different length, same crc. try resume (receiver)
+set name crc-check-diff-len-resume-receiver
+exec mkdir $testdir/$name
+catch "exec dd if=$srcdir/../src/lrz.c of=$testdir/$name/lrz.c conv=notrunc bs=256 count=81"
+set fails [runthem_internal $name "$objdir/../src/lsz" "-q --crc-check" \
+ $objdir/../src/lrz "-q -r" \
+ "$srcdir/../src/lrz.c" "rmdir,compare,delete" dummy]
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy
+
+exec logger part 9
+# Part 9: file exists, different length + crc. try resume (sender)
+set name crc-check-diff-len-resume-receiver
+exec mkdir $testdir/$name
+catch "exec dd if=$srcdir/../src/lrz.c of=$testdir/$name/lrz.c conv=notrunc bs=256 count=81"
+catch "exec dd if=$objdir/../src/lrz of=$testdir/$name/lrz.c conv=notrunc bs=512 count=1"
+set fails [runthem_internal $name "$objdir/../src/lsz" "-q --crc-check -r" \
+ $objdir/../src/lrz "-q" \
+ "$srcdir/../src/lrz.c" "rmdir,compare,delete" dummy]
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy
+
+exec logger part 10
+# Part 9: file exists, different crc, same length. try resume (sender)
+set name crc-check-diff-crc-resume-receiver
+exec mkdir $testdir/$name
+catch "exec dd if=$srcdir/../src/lrz.c of=$testdir/$name/lrz.c conv=notrunc"
+catch "exec dd if=$objdir/../src/lrz of=$testdir/$name/lrz.c conv=notrunc bs=512 count=1"
+set fails [runthem_internal $name "$objdir/../src/lsz" "-q --crc-check -r" \
+ $objdir/../src/lrz "-q" \
+ "$srcdir/../src/lrz.c" "rmdir,compare,delete" dummy]
+if {$fails == 0} {
+ pass "$name"
+ exec rm -rf $testdir/$name
+} else {
+ fail "$name"
+}
+unset name fails dummy
diff --git a/testsuite/lrzsz/manage.exp b/testsuite/lrzsz/manage.exp
new file mode 100644
index 0000000..24f266f
--- /dev/null
+++ b/testsuite/lrzsz/manage.exp
@@ -0,0 +1,121 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# File management test, Part 1: Append, sender initiated
+runappend sender-init-append $objdir/../src/lsz "-q --append" \
+ $objdir/../src/lrz "-q" \
+ "$srcdir/../src/lsz.c"
+
+# File management test, Part 2: Append, receiver initiated
+runappend receiver-init-append $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-q --append" \
+ "$srcdir/../src/lsz.c"
+
+# File management test, Part 3: renaming, sender initiated
+runrename sender-init-rename $objdir/../src/lsz "-q --rename" \
+ $objdir/../src/lrz "-q" \
+ "$z_test_files"
+
+# File management test, Part 4: renaming, receiver initiated
+runrename receiver-init-rename $objdir/../src/lsz "-q" \
+ "$objdir/../src/lrz" "-q --rename" \
+ "$z_test_files"
+
+# File management test, Part 5: protecting, sender init
+runprotect sender-init-protect $objdir/../src/lsz "-q --protect" \
+ $objdir/../src/lrz "-q" \
+ "$z_test_files"
+
+# File management test, Part 6: protect, receiver initiated
+runprotect receiver-init-protect $objdir/../src/lsz "-q" \
+ "$objdir/../src/lrz" "-q --protect" \
+ "$z_test_files"
+
+# File management test, Part 7: sender wishes renaming, receiver overwriting.
+runthem receiver-overwrite $objdir/../src/lsz "-q --rename" \
+ $objdir/../src/lrz "-q --overwrite" \
+ "$z_test_files"
+
+# File management test, Part 8: sender to write only existing,
+# but file does not exist
+set fail_is_ok 1
+runthem sender-overwrite-or-skip $objdir/../src/lsz "-q --overwrite-or-skip" \
+ "$objdir/../src/lrz" "-q" \
+ "$objdir/../src/lrz"
+unset fail_is_ok
+# Part 9: touch file ...
+set name sender-overwrite-or-skip2
+exec mkdir $testdir/$name
+exec touch $testdir/$name/lrz
+set fails [runthem_internal $name $objdir/../src/lsz "-q --overwrite-or-skip" \
+ $objdir/../src/lrz "-q" \
+ "$objdir/../src/lrz" "compare,delete,rmdir" dummy]
+if {$fails == 0} {
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+
+
+exec logger 10
+# Part 10: file exists, sender doesn't wish to overwrite
+set name sender-overwrite-fail
+exec mkdir $testdir/$name
+exec touch $testdir/$name/lrz
+set fail_is_ok 1
+set fails [runthem_internal $name $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-q" \
+ "$objdir/../src/lrz" "compare,delete,rmdir" dummy]
+unset fail_is_ok
+if {$fails == 0} {
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+
+exec logger 11
+# Part 11: file exists, sender wishes to overwrite
+set name sender-overwrite
+exec mkdir $testdir/$name
+exec touch $testdir/$name/lrz
+set fails [runthem_internal $name $objdir/../src/lsz "-q --overwrite" \
+ $objdir/../src/lrz "-q" \
+ "$objdir/../src/lrz" "compare,delete,rmdir" dummy]
+if {$fails == 0} {
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+
+exec logger 12
+# part 12: sender unlinks.
+set name sender-unlink
+exec mkdir $testdir/$name
+exec cp $objdir/../src/lrz $testdir/LRZ
+set fails [runthem_internal $name $objdir/../src/lsz "-q --unlink" \
+ $objdir/../src/lrz "-q" \
+ "$testdir/LRZ" "" dummy]
+if [file exists $testdir/LRZ] {
+ incr fails
+ send_log "sender failed to unlink file\n"
+}
+set res [catch "exec cmp $objdir/../src/lrz $testdir/$name/LRZ" dummy]
+if {$res != 0} {
+ send_log "$i: not identical: cmp told\n"
+ send_log "$dummy\n"
+ incr fails
+}
+if {$fails == 0} {
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+unset fails
+
+
diff --git a/testsuite/lrzsz/newer.exp b/testsuite/lrzsz/newer.exp
new file mode 100644
index 0000000..8f02690
--- /dev/null
+++ b/testsuite/lrzsz/newer.exp
@@ -0,0 +1,130 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# check wether --newer option works
+# case a: should not work if existing file is younger
+set name sz-newer-fail
+exec mkdir $testdir/$name
+exec cp -p $srcdir/../src/lrz.c $testdir/LRZ
+# so existing file ist younger.
+exec touch $testdir/$name/LRZ
+set fail_is_ok 1
+set fails [runthem_internal $name $objdir/../src/lsz "-q --newer" \
+ $objdir/../src/lrz "-q" \
+ "$testdir/LRZ" "compare" dummy]
+unset fail_is_ok
+if {[file size $testdir/$name/LRZ] != 0} {
+ send_log "file has been overwritten\n"
+ incr fails
+}
+if {$fails == 0} {
+ exec rm -rf $testdir/$name
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+unset fails
+
+set name rz-newer-fail
+exec mkdir $testdir/$name
+exec cp -p $srcdir/../src/lrz.c $testdir/LRZ
+# so existing file ist younger.
+exec touch $testdir/$name/LRZ
+set fail_is_ok 1
+set fails [runthem_internal $name $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-q --newer" \
+ "$testdir/LRZ" "compare" dummy]
+unset fail_is_ok
+if {[file size $testdir/$name/LRZ] != 0} {
+ send_log "file has been overwritten\n"
+ incr fails
+}
+if {$fails == 0} {
+ exec rm -rf $testdir/$name
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+unset fails
+
+# check wether --newer option works
+# case b: should work if existing file is older
+set name sz-newer-ok
+exec mkdir $testdir/$name
+exec cp -p $objdir/../src/lrz $testdir/LRZ
+exec touch -r $srcdir/../src/lrz.c $testdir/$name/LRZ
+set fails [runthem_internal $name $objdir/../src/lsz "-q --newer" \
+ "$objdir/../src/lrz" "-q" \
+ "$testdir/LRZ" "compare" dummy]
+if {$fails == 0} {
+ exec rm -rf $testdir/$name
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+unset fails
+
+# case b: should work if existing file is older
+set name rz-newer-ok
+exec mkdir $testdir/$name
+exec cp -p $objdir/../src/lrz $testdir/LRZ
+exec touch -r $srcdir/../src/lrz.c $testdir/$name/LRZ
+set fails [runthem_internal $name $objdir/../src/lsz "-q" \
+ "$objdir/../src/lrz" "-q --newer" \
+ "$testdir/LRZ" "compare" dummy]
+if {$fails == 0} {
+ exec rm -rf $testdir/$name
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+unset fails
+
+# check wether --newer-or-longer option works
+set name sz-newer-or-longer
+exec mkdir $testdir/$name
+exec cp -p $srcdir/../src/lrz.c $testdir/LRZ
+# so existing file ist younger.
+exec touch $testdir/$name/LRZ
+set fails [runthem_internal $name $objdir/../src/lsz "-q --newer-or-longer" \
+ "$objdir/../src/lrz" "-q" \
+ "$testdir/LRZ" "compare" dummy]
+if {[file size $testdir/$name/LRZ] == 0} {
+ send_log "file has not been overwritten\n"
+ incr fails
+}
+if {$fails == 0} {
+ exec rm -rf $testdir/$name
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+unset fails
+
+set name rz-newer-or-longer
+exec mkdir $testdir/$name
+exec cp -p $srcdir/../src/lrz.c $testdir/LRZ
+# so existing file ist younger.
+exec touch $testdir/$name/LRZ
+set fails [runthem_internal $name $objdir/../src/lsz "-q" \
+ "$objdir/../src/lrz" "-q --newer-or-longer" \
+ "$testdir/LRZ" "compare" dummy]
+if {[file size $testdir/$name/LRZ] == 0} {
+ send_log "file has not been overwritten\n"
+ incr fails
+}
+if {$fails == 0} {
+ exec rm -rf $testdir/$name
+ pass "$name"
+} else {
+ fail "$name"
+}
+unset name
+unset fails
diff --git a/testsuite/lrzsz/null.exp b/testsuite/lrzsz/null.exp
new file mode 100644
index 0000000..ef372ea
--- /dev/null
+++ b/testsuite/lrzsz/null.exp
@@ -0,0 +1,32 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+
+# why ascii mode? xmodem in binary mode appends ^Zs to pad blocks ...
+#
+exec sh -c "rm -f $objdir/null ; touch $objdir/null";
+runxmodem xmodem $objdir/../src/lsz "-qa" \
+ $objdir/../src/lrz "-qa" $objdir/null
+runxmodem xmodem-1k $objdir/../src/lsz "-qa --1024" \
+ $objdir/../src/lrz "-qa" $objdir/null
+runxmodem xmodem-crc $objdir/../src/lsz "-qa" \
+ $objdir/../src/lrz "-qa --with-crc" $objdir/null
+
+runthem ymodem $objdir/../src/lsz "-q --ymodem" \
+ $objdir/../src/lrz "-q --ymodem" $objdir/null
+runthem ymodem-1k $objdir/../src/lsz "-q --ymodem --1024" \
+ $objdir/../src/lrz "-q --ymodem" $objdir/null
+
+runthem zmodem $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-q" $objdir/null
+runthem zmodem-buffered $objdir/../src/lsz "-q $SZBUFSIZE" \
+ $objdir/../src/lrz "-q $SZBUFSIZE" $objdir/null
+runthem zmodem-turbo $objdir/../src/lsz "-qT" \
+ $objdir/../src/lrz "-q" $objdir/null
+runthem zmodem4k $objdir/../src/lsz "-q4" \
+ $objdir/../src/lrz "-q" $objdir/null
+runthem zmodem-start4k $objdir/../src/lsz "-q44" \
+ $objdir/../src/lrz "-q" $objdir/null
+exec sh -c "rm -f $objdir/null";
diff --git a/testsuite/lrzsz/path.exp b/testsuite/lrzsz/path.exp
new file mode 100644
index 0000000..ffc6742
--- /dev/null
+++ b/testsuite/lrzsz/path.exp
@@ -0,0 +1,21 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# check wether --junk-path and --full-path work.
+runthem junk-and-full $objdir/../src/lsz "-q --full-path" \
+ $objdir/../src/lrz "-q --junk-path" \
+ "$objdir2/src/lsz"
+
+# --full-path alone, must fail
+set fail_is_ok 1
+runthem full-only $objdir/../src/lsz "-q --full-path" \
+ $objdir/../src/lrz "-q" \
+ "$objdir2/src/lsz"
+unset fail_is_ok
+
+# --junk-path alone, must work
+runthem junk-only $objdir/../src/lsz "-q" \
+ "$objdir/../src/lrz" "-q --junk-path" \
+ "$objdir2/src/lsz"
diff --git a/testsuite/lrzsz/resume.exp b/testsuite/lrzsz/resume.exp
new file mode 100644
index 0000000..3ddb5ce
--- /dev/null
+++ b/testsuite/lrzsz/resume.exp
@@ -0,0 +1,9 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+runresume sz-r $objdir/../src/lsz "-qr" \
+ $objdir/../src/lrz "-q" $z_test_files
+runresume rz-r $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-qr" $z_test_files
diff --git a/testsuite/lrzsz/timing.exp b/testsuite/lrzsz/timing.exp
new file mode 100644
index 0000000..c6cf67e
--- /dev/null
+++ b/testsuite/lrzsz/timing.exp
@@ -0,0 +1,20 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+send_user "*** these test take some time ***\n"
+
+# delay startup for 10 seconds
+runthem zmodem-delay-sz $objdir/../src/lsz "-q --delay-startup 10" \
+ $objdir/../src/lrz "-q" $z_test_files
+runthem zmodem-delay-rz $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-q --delay-startup 10" $z_test_files
+
+# combine with --stop-at
+set fail_is_ok 1
+runthem zmodem-sz-stops $objdir/../src/lsz "-q --stop-at +10" \
+ $objdir/../src/lrz "-q --delay-startup 12" $z_test_files
+runthem zmodem-rz-stops $objdir/../src/lsz "-q --delay-startup 12" \
+ $objdir/../src/lrz "-q --stop-at +10" $z_test_files
+unset fail_is_ok
diff --git a/testsuite/lrzsz/uppercase.exp b/testsuite/lrzsz/uppercase.exp
new file mode 100644
index 0000000..adfe08c
--- /dev/null
+++ b/testsuite/lrzsz/uppercase.exp
@@ -0,0 +1,19 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# check case conversion behavoiur
+# no way to check with zmodem - zmodem does no case conversion.
+
+# check --keep-uppercase option
+exec cp $srcdir/../src/lrz.c $testdir/LRZC
+runthem ymodem-keep-uppercase $objdir/../src/lsz "-q --ymodem" \
+ $objdir/../src/lrz "-q --ymodem --keep-uppercase" $testdir/LRZC
+
+# reverse case ... case conversion works?
+set fail_is_ok 1
+runthem ymodem-try-uppercase $objdir/../src/lsz "-q --ymodem --no-unixmode" \
+ "$objdir/../src/lrz" "--ymodem -q" "$testdir/LRZC"
+unset fail_is_ok
+exec rm -f $testdir/LRZC
diff --git a/testsuite/lrzsz/window.exp b/testsuite/lrzsz/window.exp
new file mode 100644
index 0000000..aa8b5bf
--- /dev/null
+++ b/testsuite/lrzsz/window.exp
@@ -0,0 +1,14 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+
+# well, we _cannot_ see the difference - without, maybe, a buffering program
+# between sender and receiver.
+runthem zmodem-sz-window "$objdir/../src/lsz" "-q --window 2048" \
+ "$objdir/../src/lrz" "-q" "$z_test_files"
+runthem zmodem-rz-window "$objdir/../src/lsz" "-q" \
+ "$objdir/../src/lrz" "-q --window 2048" "$z_test_files"
+
+
diff --git a/testsuite/lrzsz/xmodem.exp b/testsuite/lrzsz/xmodem.exp
new file mode 100644
index 0000000..4029f03
--- /dev/null
+++ b/testsuite/lrzsz/xmodem.exp
@@ -0,0 +1,14 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+
+# why ascii mode? xmodem in binary mode appends ^Zs to pad blocks ...
+#
+runxmodem xmodem $objdir/../src/lsz "-qa" \
+ $objdir/../src/lrz "-qa" $x_test_files
+runxmodem xmodem-1k $objdir/../src/lsz "-qa --1024" \
+ $objdir/../src/lrz "-qa" $x_test_files
+runxmodem xmodem-crc $objdir/../src/lsz "-qa" \
+ $objdir/../src/lrz "-qa --with-crc" $x_test_files
diff --git a/testsuite/lrzsz/ymodem.exp b/testsuite/lrzsz/ymodem.exp
new file mode 100644
index 0000000..8fabffc
--- /dev/null
+++ b/testsuite/lrzsz/ymodem.exp
@@ -0,0 +1,9 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+runthem ymodem $objdir/../src/lsz "-q --ymodem" \
+ $objdir/../src/lrz "-q --ymodem" $y_test_files
+runthem ymodem-1k $objdir/../src/lsz "-q --ymodem --1024" \
+ $objdir/../src/lrz "-q --ymodem" $y_test_files
diff --git a/testsuite/lrzsz/zmodem-crc16.exp b/testsuite/lrzsz/zmodem-crc16.exp
new file mode 100644
index 0000000..2795eeb
--- /dev/null
+++ b/testsuite/lrzsz/zmodem-crc16.exp
@@ -0,0 +1,9 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# check 16 bit crc
+# only sender knows this option
+runthem zmodem-crc16-sz $objdir/../src/lsz "-q --16-bit-crc" \
+ $objdir/../src/lrz "-q" $z_test_files
diff --git a/testsuite/lrzsz/zmodem-escape.exp b/testsuite/lrzsz/zmodem-escape.exp
new file mode 100644
index 0000000..7c018dd
--- /dev/null
+++ b/testsuite/lrzsz/zmodem-escape.exp
@@ -0,0 +1,12 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# check --escape option
+runthem zmodem-escape-sz $objdir/../src/lsz "-q --escape" \
+ $objdir/../src/lrz "-q" $z_test_files
+runthem zmodem-escape-rz $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-q -e" $z_test_files
+runthem zmodem-escape-both $objdir/../src/lsz "-q --escape" \
+ $objdir/../src/lrz "-q --escape" $z_test_files
diff --git a/testsuite/lrzsz/zmodem.exp b/testsuite/lrzsz/zmodem.exp
new file mode 100644
index 0000000..a3409b1
--- /dev/null
+++ b/testsuite/lrzsz/zmodem.exp
@@ -0,0 +1,33 @@
+load_lib "lrzsz.exp"
+if $tracelevel then {
+ strace $tracelevel
+}
+
+runthem zmodem $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-q" $z_test_files
+runthem zmodem-buffered $objdir/../src/lsz "-q $SZBUFSIZE" \
+ $objdir/../src/lrz "-q $SZBUFSIZE" $z_test_files
+runthem zmodem-turbo $objdir/../src/lsz "-qT" \
+ $objdir/../src/lrz "-q" $z_test_files
+runthem zmodem4k $objdir/../src/lsz "-q4" \
+ $objdir/../src/lrz "-q" $z_test_files
+runthem zmodem-start4k $objdir/../src/lsz "-q44" \
+ $objdir/../src/lrz "-q" $z_test_files
+# run this one only if we have something really large?
+# 8k, turbo, no timout!
+runthem zmodem8k $objdir/../src/lsz "-q8OT" \
+ $objdir/../src/lrz "-qO" "$z_test_files $z8_test_files"
+runthem zmodem-start8k $objdir/../src/lsz "-q88OT" \
+ $objdir/../src/lrz "-qO" $z_test_files
+# write to /dev/null - keeps buffer cache influence low.
+runthem0 zmodem8k0 $objdir/../src/lsz "-q8OT" \
+ $objdir/../src/lrz "-qDO" "$z_test_files $z8_test_files"
+
+# check error behaviour
+runthem zmodem-errors $objdir/../src/lsz "-q8" \
+ $objdir/../src/lrz "-q --errors 32768" $z_test_files
+
+# try o-sync option
+# might be useless if the system doesn't support O_SYNC.
+runthem zmodem-o-sync $objdir/../src/lsz "-q" \
+ $objdir/../src/lrz "-q --o-sync" $z_test_files