lrzsz-0.13.1/0000775000175000017500000000000015260431651006526 5lrzsz-0.13.1/COPYING0000664000175000017500000004312706607440600007507 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. Copyright (C) 19yy 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. , 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. lrzsz-0.13.1/missing0000755000175000017500000001706015256501374010054 #! /bin/sh # Common wrapper for a few potentially missing GNU and other programs. scriptversion=2024-06-07.14; # UTC # shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells # Copyright (C) 1996-2024 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autogen autoheader autom4te automake autoreconf bison flex help2man lex makeinfo perl yacc Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Report bugs to . GNU Automake home page: . General help using GNU software: ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing (GNU Automake) $scriptversion" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake|autoreconf) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; *) : ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" autoheader_deps="'acconfig.h'" automake_deps="'Makefile.am'" aclocal_deps="'acinclude.m4'" case $normalized_program in aclocal*) echo "You should only need it if you modified $aclocal_deps or" echo "$configure_deps." ;; autoconf*) echo "You should only need it if you modified $configure_deps." ;; autogen*) echo "You should only need it if you modified a '.def' or '.tpl' file." echo "You may want to install the GNU AutoGen package:" echo "<$gnu_software_URL/autogen/>" ;; autoheader*) echo "You should only need it if you modified $autoheader_deps or" echo "$configure_deps." ;; automake*) echo "You should only need it if you modified $automake_deps or" echo "$configure_deps." ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." ;; autoreconf*) echo "You should only need it if you modified $aclocal_deps or" echo "$automake_deps or $autoheader_deps or $automake_deps or" echo "$configure_deps." ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; perl*) echo "You should only need it to run GNU Autoconf, GNU Automake, " echo " assorted other tools, or if you modified a Perl source file." echo "You may want to install the Perl 5 language interpreter:" echo "<$perl_URL>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac program_details "$normalized_program" } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: lrzsz-0.13.1/Makefile.in0000664000175000017500000007535015260417112010521 # Makefile.in generated by automake 1.17 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2024 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/build-to-host.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = Specfile CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Specfile.in \ $(srcdir)/config.h.in ABOUT-NLS AUTHORS COPYING ChangeLog \ INSTALL NEWS README THANKS TODO compile config.guess \ config.rpath config.sub depcomp install-sh missing \ mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \ ; rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = -9 DIST_TARGETS = dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = \ find . \( -type f -a \! \ \( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIST_TARBALL = @DIST_TARBALL@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LRZSZ_CFLAGS = @LRZSZ_CFLAGS@ LRZSZ_LDFLAGS = @LRZSZ_LDFLAGS@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MIN_POSIX_C_STD = @MIN_POSIX_C_STD@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUPPORTED_C_STDS = @SUPPORTED_C_STDS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localedir_c = @localedir_c@ localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src po man EXTRA_DIST = m4/ChangeLog check.lrzsz COMPATABILITY README.cvs README.isdn4linux \ README.tests remote-build-check.sh \ doc/README doc/zmodem-forsberg.txt doc/zmodem-zmtx-zmrx.txt doc/zmodem-wip.txt doc/zmodemsnif.txt PR = @DIST_TARBALL@ DISTCLEANFILES = fastcheck.done CLEANFILES = fastcheck.done ACLOCAL_AMFLAGS = -I m4 QUICKCHECKS = xmodem-lsz-lrz-16k-binary xmodem-lsz-lrz-large-binary-1k-crc zmodem-lsz-lrz-MGMT-default-nonexisting zmodem-lsz-lrz-MGMT-ZMCRC-r \ zmodem-lsz-lrz-multiple zmodem-lsz-lrz-4k zmodem-lsz-lrz-8k-turbo zmodem-lsz-lrz-MGMT-mode-0666 \ zmodem-lsz-lrz-MGMT-traversal-dotdot zmodem-lsz-lrz-RESUME-shrink # Note: the inofficial target is to compile on systems of up to 20 years of age. # We support one C standard older than that. # SUPPORTED_C_STANDARDS = @SUPPORTED_C_STDS@ SUPPORTED_COMPILERS = gcc clang SANITIZERS = asan msan ubsan all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status $(AM_V_at)rm -f stamp-h1 $(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) $(AM_V_GEN)($(am__cd) $(top_srcdir) && $(AUTOHEADER)) $(AM_V_at)rm -f stamp-h1 $(AM_V_at)touch $@ distclean-hdr: -rm -f config.h stamp-h1 Specfile: $(top_builddir)/config.status $(srcdir)/Specfile.in cd $(top_builddir) && $(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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) $(AM_V_at)$(MKDIR_P) "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -$(am__rm_f) $(CLEANFILES) distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) -$(am__rm_f) $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ dist-zstd distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile buildcheck: for cc in $(SUPPORTED_COMPILERS) ; do if command -v "$$cc" >/dev/null ; then \ for std in $(SUPPORTED_C_STANDARDS) ; do \ echo "running clean/configure/make with CC=$$cc --enable-std=$$std"; \ make -s V=0 clean >/dev/null ; \ ./configure CC="$$cc" -q --enable-std=$$std || exit 1 ; \ make -s V=0 -j 4 || exit 1 ; \ done \ fi ; done ; \ make -s V=0 clean >/dev/null buildcheck+: for cc in $(SUPPORTED_COMPILERS) ; do if command -v "$$cc" >/dev/null ; then \ for std in $(SUPPORTED_C_STANDARDS) ; do \ echo "running clean/configure/make/vcheck with CC=$$cc --enable-std=$$std"; \ make -s V=0 clean >/dev/null ; \ ./configure CC="$$cc" -q --enable-std=$$std || exit 1 ; \ make -s V=0 -j 4 || exit 1 ; \ QUIET=1 make -s V=0 vcheck || exit 1 ; \ done \ fi ; done ; \ make -s V=0 clean >/dev/null ; # Remote build checks (gnulib cfg.mk convention): the host list lives in a # local, non-distributed cfg.mk, e.g.: # REMOTE_HOSTS = uwe@openbsd uwe@dev -include cfg.mk buildcheck-remote: dist @for h in $(REMOTE_HOSTS) ; do \ echo "remote buildcheck on $$h"; \ scp ./remote-build-check.sh $(PR).tar.gz "$$h": || exit 1; \ ssh "$$h" sh ./remote-build-check.sh $(PR) || exit 1; \ done .PHONY: buildcheck-remote oldcheck-local: QUIET=-q $(srcdir)/check.lrzsz $(srcdir) `pwd` quickcheck: $(srcdir)/check.lrzsz $(srcdir) `pwd` select $(QUICKCHECKS) vcheck: $(srcdir)/check.lrzsz $(srcdir) `pwd` vcheck-%: $(srcdir)/check.lrzsz $(srcdir) `pwd` $(subst vcheck-,,$@) vcheck-x: $(srcdir)/check.lrzsz $(srcdir) `pwd` x vcheck-y: $(srcdir)/check.lrzsz $(srcdir) `pwd` y vcheck-z: $(srcdir)/check.lrzsz $(srcdir) `pwd` z # need clang compiler options for clang-tidy. clangconfigure: CC=clang ./configure -q tidy: @$(MAKE) -C src tidy .PHONY: tiny # releasecheck runs about 2h. releasecheck: distclean clangconfigure all tidy maintainertools dist distcheck vcheck qa buildcheck+ buildcheck-remote fuzz1000 # need clang compiler options for clang-tidy. releasecheck1: distclean CC=clang ./configure -q @$(MAKE) maintainertools: @$(MAKE) -C src zmodemfuzz zmodemsnif timestamp linesimulator # zmodem protocol fuzzing: 25 iterations per mode (FUZZITER overrides), each # iteration is alarm limited (-t 20). # fails if the target crashes, is killed by a signal (!= timeout ALRM), # escapes the receiving directory, or transfers some wrong content. # -P prints one progress line per iteration. fuzz: @$(MAKE) -C src zmodemfuzz lrz lsz; \ $(srcdir)/src/zmodemfuzz -P -m receive -n $${FUZZITER:-25} -t 20 -- ./src/lrz -q -Z; \ $(srcdir)/src/zmodemfuzz -P -m send -n $${FUZZITER:-25} -t 20 -- ./src/lsz -q -Z ./test/4k.bin fuzz1000: @$(MAKE) -C src zmodemfuzz lrz lsz; \ $(srcdir)/src/zmodemfuzz -P -m receive -n 1000 -t 20 -- ./src/lrz -q -Z; \ $(srcdir)/src/zmodemfuzz -P -m send -n 1000 -t 20 -- ./src/lsz -q -Z ./test/4k.bin .PHONY: fuzz fuzz1000 qa: asan msan ubsan coverage .PHONY: $(SANITIZERS) qa coverage $(SANITIZERS): CC_LIST = clang gcc msan: CC_LIST = clang $(SANITIZERS): for i in $(CC_LIST) ; do if command -v "$$i" >/dev/null ; then \ echo "running clean/configure/vcheck with $$i --enable-$@"; \ make -s V=0 clean >/dev/null ; \ ./configure CC="$$i" -q --enable-$@ || exit 1 ; \ make -s V=0 -j 4 || exit 1 ; \ QUIET=1 make -s V=0 vcheck || exit 1 ; \ fi ; done coverage: coverage/coverage.html coverage/coverage.html: $(wildcard src/*.c src/*.h) mkdir coverage 2>/dev/null || exit 0 make -s V=0 clean ./configure --enable-coverage -q make -s V=0 -j 4 make -s V=0 vcheck if command -v "gcovr" >/dev/null; then gcovr --html-details --output coverage/coverage.html src/; else echo "gcovr not found, no coverage report"; fi ./configure -q make -s V=0 clean make -s V=0 -j 4 # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% lrzsz-0.13.1/config.rpath0000755000175000017500000004734415236326254010775 #! /bin/sh # Output a system dependent set of variables, describing how to set the # run time search path of shared libraries in a binary (executable or # shared library). # # Copyright 1996-2024 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer # than 256 bytes, otherwise the compiler driver will dump core. The only # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. # func_usage # outputs to stdout the --help usage message. func_usage () { echo "\ Usage: config.rpath [OPTION] HOST Prints shell variable assignments that describe how to hardcode a directory for the lookup of shared libraries into a binary (executable or shared library). The first argument passed to this file is the canonical host specification, CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM or CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld should be set by the caller. The set of defined variables is at the end of this script. Options: --help print this help and exit --version print version information and exit Send patches and bug reports to ." } # func_version # outputs to stdout the --version message. func_version () { echo "config.rpath (GNU gnulib, module havelib)" echo "Copyright (C) 2024 Free Software Foundation, Inc. License: All-Permissive. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." echo printf 'Written by %s.\n' "Bruno Haible" } # func_fatal_error message # outputs to stderr a fatal error message, and terminates the program. func_fatal_error () { echo "config.rpath: *** $1" 1>&2 echo "config.rpath: *** Stop." 1>&2 exit 1 } # Command-line option processing. while test $# -gt 0; do case "$1" in --help | --hel | --he | --h ) func_usage exit 0 ;; --version | --versio | --versi | --vers | --ver | --ve | --v ) func_version exit 0 ;; -- ) # Stop option processing shift; break ;; -* ) func_fatal_error "unrecognized option: $1" ;; * ) break ;; esac done if test $# -gt 1; then func_fatal_error "too many arguments" fi if test $# -lt 1; then func_fatal_error "too few arguments" fi # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a shrext=.so host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # Code taken from libtool.m4's _LT_CC_BASENAME. for cc_temp in $CC""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` # Code taken from libtool.m4's _LT_COMPILER_PIC. wl= if test "$GCC" = yes; then wl='-Wl,' else case "$host_os" in aix*) wl='-Wl,' ;; mingw* | cygwin* | pw32* | os2* | cegcc*) ;; hpux9* | hpux10* | hpux11*) wl='-Wl,' ;; irix5* | irix6* | nonstopux*) wl='-Wl,' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in ecc*) wl='-Wl,' ;; icc* | ifort*) wl='-Wl,' ;; lf95*) wl='-Wl,' ;; nagfor*) wl='-Wl,-Wl,,' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) wl='-Wl,' ;; ccc*) wl='-Wl,' ;; xl* | bgxl* | bgf* | mpixl*) wl='-Wl,' ;; como) wl='-lopt=' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ F* | *Sun*Fortran*) wl= ;; *Sun\ C*) wl='-Wl,' ;; esac ;; esac ;; newsos6) ;; *nto* | *qnx*) ;; osf3* | osf4* | osf5*) wl='-Wl,' ;; rdos*) ;; solaris*) case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) wl='-Qoption ld ' ;; *) wl='-Wl,' ;; esac ;; sunos4*) wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3*) wl='-Wl,' ;; sysv4*MP*) ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) wl='-Wl,' ;; unicos*) wl='-Wl,' ;; uts4*) ;; esac fi # Code taken from libtool.m4's _LT_LINKER_SHLIBS. hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no hardcode_minus_L=no case "$host_os" in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. # Unlike libtool, we use -rpath here, not --rpath, since the documented # option of GNU ld is called -rpath, not --rpath. hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' case "$host_os" in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no fi ;; amigaos*) case "$host_cpu" in powerpc) ;; m68k) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then : else ld_shlibs=no fi ;; haiku*) ;; interix[3-9]*) hardcode_direct=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; netbsd*) ;; solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' else ld_shlibs=no fi ;; esac ;; sunos4*) hardcode_direct=yes ;; *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then : else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then hardcode_libdir_flag_spec= fi else case "$host_os" in aix3*) # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac fi hardcode_direct=yes hardcode_libdir_separator=':' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac fi # Begin _LT_AC_SYS_LIBPATH_AIX. echo 'int main () { return 0; }' > conftest.c ${CC} ${LDFLAGS} conftest.c -o conftest aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } }'` fi if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib" fi rm -f conftest.c conftest # End _LT_AC_SYS_LIBPATH_AIX. if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' else hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" fi fi ;; amigaos*) case "$host_cpu" in powerpc) ;; m68k) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' libext=lib ;; darwin* | rhapsody*) hardcode_direct=no if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then : else ld_shlibs=no fi ;; dgux*) hardcode_libdir_flag_spec='-L$libdir' ;; freebsd2.[01]*) hardcode_direct=yes hardcode_minus_L=yes ;; freebsd* | dragonfly* | midnightbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; hpux9*) hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; hpux10*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no ;; *) hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; netbsd*) hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes ;; newsos6) hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then hardcode_libdir_flag_spec='${wl}-rpath,$libdir' else case "$host_os" in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) hardcode_libdir_flag_spec='-R$libdir' ;; *) hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; osf3*) hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) if test "$GCC" = yes; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else # Both cc and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; solaris*) hardcode_libdir_flag_spec='-R$libdir' ;; sunos4*) hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes ;; sysv4) case $host_vendor in sni) hardcode_direct=yes # is this really true??? ;; siemens) hardcode_direct=no ;; motorola) hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac ;; sysv4.3*) ;; sysv4*MP*) if test -d /usr/nec; then ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) ;; sysv5* | sco3.2v5* | sco5v6*) hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' hardcode_libdir_separator=':' ;; uts4*) hardcode_libdir_flag_spec='-L$libdir' ;; *) ld_shlibs=no ;; esac fi # Check dynamic linker characteristics # Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. # Unlike libtool.m4, here we don't care about _all_ names of the library, but # only about the one the linker finds when passed -lNAME. This is the last # element of library_names_spec in libtool.m4, or possibly two of them if the # linker has special search rules. library_names_spec= # the last element of library_names_spec in libtool.m4 libname_spec='lib$name' case "$host_os" in aix3*) library_names_spec='$libname.a' ;; aix[4-9]*) library_names_spec='$libname$shrext' ;; amigaos*) case "$host_cpu" in powerpc*) library_names_spec='$libname$shrext' ;; m68k) library_names_spec='$libname.a' ;; esac ;; beos*) library_names_spec='$libname$shrext' ;; bsdi[45]*) library_names_spec='$libname$shrext' ;; cygwin* | mingw* | pw32* | cegcc*) shrext=.dll library_names_spec='$libname.dll.a $libname.lib' ;; darwin* | rhapsody*) shrext=.dylib library_names_spec='$libname$shrext' ;; dgux*) library_names_spec='$libname$shrext' ;; freebsd[23].*) library_names_spec='$libname$shrext$versuffix' ;; freebsd* | dragonfly* | midnightbsd*) library_names_spec='$libname$shrext' ;; gnu*) library_names_spec='$libname$shrext' ;; haiku*) library_names_spec='$libname$shrext' ;; hpux9* | hpux10* | hpux11*) case $host_cpu in ia64*) shrext=.so ;; hppa*64*) shrext=.sl ;; *) shrext=.sl ;; esac library_names_spec='$libname$shrext' ;; interix[3-9]*) library_names_spec='$libname$shrext' ;; irix5* | irix6* | nonstopux*) library_names_spec='$libname$shrext' case "$host_os" in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; *) libsuff= shlibsuff= ;; esac ;; esac ;; linux*oldld* | linux*aout* | linux*coff*) ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) library_names_spec='$libname$shrext' ;; knetbsd*-gnu) library_names_spec='$libname$shrext' ;; netbsd*) library_names_spec='$libname$shrext' ;; newsos6) library_names_spec='$libname$shrext' ;; *nto* | *qnx*) library_names_spec='$libname$shrext' ;; openbsd*) library_names_spec='$libname$shrext$versuffix' ;; os2*) libname_spec='$name' shrext=.dll library_names_spec='$libname.a' ;; osf3* | osf4* | osf5*) library_names_spec='$libname$shrext' ;; rdos*) ;; solaris*) library_names_spec='$libname$shrext' ;; sunos4*) library_names_spec='$libname$shrext$versuffix' ;; sysv4 | sysv4.3*) library_names_spec='$libname$shrext' ;; sysv4*MP*) library_names_spec='$libname$shrext' ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) library_names_spec='$libname$shrext' ;; tpf*) library_names_spec='$libname$shrext' ;; uts4*) library_names_spec='$libname$shrext' ;; esac sed_quote_subst='s/\(["`$\\]\)/\\\1/g' escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` shlibext=`echo "$shrext" | sed -e 's,^\.,,'` escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <: Modification for versions 0.10 und 0.11 mblack@csihq.com: Modifications for version 0.12a Uwe Ohse : Modifications for 0.12b und 0.12.* lrzsz-0.13.1/m4/0000775000175000017500000000000015260431651007046 5lrzsz-0.13.1/m4/ax_compiler_flags_cflags.m40000644000175000017500000001323115236613630014225 # ============================================================================= # https://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html # ============================================================================= # # SYNOPSIS # # AX_COMPILER_FLAGS_CFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS]) # # DESCRIPTION # # Add warning flags for the C compiler to VARIABLE, which defaults to # WARN_CFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be # manually added to the CFLAGS variable for each target in the code base. # # This macro depends on the environment set up by AX_COMPILER_FLAGS. # Specifically, it uses the value of $ax_enable_compile_warnings to decide # which flags to enable. # # LICENSE # # Copyright (c) 2014, 2015 Philip Withnall # Copyright (c) 2017, 2018 Reini Urban # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 17 AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[ AC_REQUIRE([AC_PROG_SED]) AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) # Variable names m4_define([ax_warn_cflags_variable], [m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))]) AC_LANG_PUSH([C]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ [#ifndef __cplusplus #error "no C++" #endif]])], [ax_compiler_cxx=yes;], [ax_compiler_cxx=no;]) # Always pass -Werror=unknown-warning-option to get Clang to fail on bad # flags, otherwise they are always appended to the warn_cflags variable, and # Clang warns on them for every compilation unit. # If this is passed to GCC, it will explode, so the flag must be enabled # conditionally. AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[ ax_compiler_flags_test="-Werror=unknown-warning-option" ],[ ax_compiler_flags_test="" ]) # Check that -Wno-suggest-attribute=format is supported AX_CHECK_COMPILE_FLAG([-Wno-suggest-attribute=format],[ ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format" ],[ ax_compiler_no_suggest_attribute_flags="" ]) # Base flags AX_APPEND_COMPILE_FLAGS([ dnl -fno-strict-aliasing dnl $3 dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) AS_IF([test "$ax_enable_compile_warnings" != "no"],[ if test "$ax_compiler_cxx" = "no" ; then # C-only flags. Warn in C++ AX_APPEND_COMPILE_FLAGS([ dnl -Wnested-externs dnl -Wmissing-prototypes dnl -Wstrict-prototypes dnl -Wdeclaration-after-statement dnl -Wimplicit-function-declaration dnl -Wold-style-definition dnl -Wjump-misses-init dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) fi # "yes" flags AX_APPEND_COMPILE_FLAGS([ dnl -Wall dnl -Wextra dnl -Wundef dnl -Wwrite-strings dnl -Wpointer-arith dnl -Wmissing-declarations dnl -Wredundant-decls dnl -Wno-unused-parameter dnl -Wno-missing-field-initializers dnl -Wformat=2 dnl -Wcast-align dnl -Wformat-nonliteral dnl -Wformat-security dnl -Wsign-compare dnl -Wstrict-aliasing dnl -Wshadow dnl -Winline dnl -Wpacked dnl -Wmissing-format-attribute dnl -Wmissing-noreturn dnl -Winit-self dnl -Wredundant-decls dnl -Wmissing-include-dirs dnl -Wunused-but-set-variable dnl -Warray-bounds dnl -Wreturn-type dnl -Wswitch-enum dnl -Wswitch-default dnl -Wduplicated-cond dnl -Wduplicated-branches dnl -Wlogical-op dnl -Wrestrict dnl -Wnull-dereference dnl -Wdouble-promotion dnl $4 dnl $5 dnl $6 dnl $7 dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) ]) AS_IF([test "$ax_enable_compile_warnings" = "error"],[ # "error" flags; -Werror has to be appended unconditionally because # it's not possible to test for # # suggest-attribute=format is disabled because it gives too many false # positives AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable) AX_APPEND_COMPILE_FLAGS([ dnl [$ax_compiler_no_suggest_attribute_flags] dnl ],ax_warn_cflags_variable,[$ax_compiler_flags_test]) ]) # In the flags below, when disabling specific flags, always add *both* # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example) # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall, # which effectively turns that flag back on again as an error. for flag in $ax_warn_cflags_variable; do AS_CASE([$flag], [-Wno-*=*],[], [-Wno-*],[ AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')], ax_warn_cflags_variable, [$ax_compiler_flags_test]) ]) done AC_LANG_POP([C]) # Substitute the variables AC_SUBST(ax_warn_cflags_variable) ])dnl AX_COMPILER_FLAGS lrzsz-0.13.1/m4/ax_require_defined.m40000644000175000017500000000230215236613336013052 # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_require_defined.html # =========================================================================== # # SYNOPSIS # # AX_REQUIRE_DEFINED(MACRO) # # DESCRIPTION # # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have # been defined and thus are available for use. This avoids random issues # where a macro isn't expanded. Instead the configure script emits a # non-fatal: # # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found # # It's like AC_REQUIRE except it doesn't expand the required macro. # # Here's an example: # # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) # # LICENSE # # Copyright (c) 2014 Mike Frysinger # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 2 AC_DEFUN([AX_REQUIRE_DEFINED], [dnl m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) ])dnl AX_REQUIRE_DEFINED lrzsz-0.13.1/m4/ax_append_flag.m40000644000175000017500000000302015236613355012157 # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_append_flag.html # =========================================================================== # # SYNOPSIS # # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) # # DESCRIPTION # # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space # added in between. # # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly # FLAG. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 8 AC_DEFUN([AX_APPEND_FLAG], [dnl AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) AS_VAR_SET_IF(FLAGS,[ AS_CASE([" AS_VAR_GET(FLAGS) "], [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], [ AS_VAR_APPEND(FLAGS,[" $1"]) AC_RUN_LOG([: FLAGS="$FLAGS"]) ]) ], [ AS_VAR_SET(FLAGS,[$1]) AC_RUN_LOG([: FLAGS="$FLAGS"]) ]) AS_VAR_POPDEF([FLAGS])dnl ])dnl AX_APPEND_FLAG lrzsz-0.13.1/m4/po.m40000644000175000017500000004510515236326254007656 # po.m4 # serial 33 (gettext-0.23) dnl Copyright (C) 1995-2014, 2016, 2018-2022, 2024 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under dnl the GNU General Public License or the GNU Lesser General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2024. AC_PREREQ([2.60]) dnl Checks for all prerequisites of the po subdirectory. AC_DEFUN([AM_PO_SUBDIRS], [ AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_SED])dnl AC_REQUIRE([AM_NLS])dnl dnl Release version of the gettext macros. This is used to ensure that dnl the gettext macros and po/Makefile.in.in are in sync. AC_SUBST([GETTEXT_MACRO_VERSION], [0.22]) dnl Perform the following tests also if --disable-nls has been given, dnl because they are needed for "make dist" to work. dnl Search for GNU msgfmt in the PATH. dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. dnl The second test excludes FreeBSD msgfmt. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) dnl Test whether it is GNU msgfmt >= 0.15. changequote(,)dnl case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; *) GMSGFMT_015=$GMSGFMT ;; esac changequote([,])dnl AC_SUBST([GMSGFMT_015]) dnl Search for GNU xgettext 0.12 or newer in the PATH. dnl The first test excludes Solaris xgettext and early GNU xgettext versions. dnl The second test excludes FreeBSD xgettext. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], :) dnl Remove leftover from FreeBSD xgettext call. rm -f messages.po dnl Test whether it is GNU xgettext >= 0.15. changequote(,)dnl case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; *) XGETTEXT_015=$XGETTEXT ;; esac changequote([,])dnl AC_SUBST([XGETTEXT_015]) dnl Search for GNU msgmerge 0.11 or newer in the PATH. AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) dnl Test whether it is GNU msgmerge >= 0.20. if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt' else dnl Test whether it is GNU msgmerge >= 0.12. if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet' else dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is dnl slow. But this is not a big problem, as such old gettext versions are dnl hardly in use any more. MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet' fi fi AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION]) dnl Support for AM_XGETTEXT_OPTION. test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) AC_CONFIG_COMMANDS([po-directories], [[ for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" gt_tab=`printf '\t'` cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*) useit=yes ;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done]], [# Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS" # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" ]) ]) dnl Postprocesses a Makefile in a directory containing PO files. AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], [ # When this code is run, in config.status, two variables have already been # set: # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, # - LINGUAS is the value of the environment variable LINGUAS at configure # time. changequote(,)dnl # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Find a way to echo strings without interpreting backslash. if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then gt_echo='echo' else if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then gt_echo='printf %s\n' else echo_func () { cat < "$ac_file.tmp" tab=`printf '\t'` if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` cat >> "$ac_file.tmp" < /dev/null; then # Add dependencies that cannot be formulated as a simple suffix rule. for lang in $ALL_LINGUAS; do frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1995-2000. dnl Bruno Haible , 2000-2003. AC_PREREQ([2.50]) AC_DEFUN([AM_NLS], [ AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE([nls], [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT([$USE_NLS]) AC_SUBST([USE_NLS]) ]) lrzsz-0.13.1/m4/host-cpu-c-abi.m40000644000175000017500000004145215236326254011754 # host-cpu-c-abi.m4 # serial 18 dnl Copyright (C) 2002-2024 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 file is offered as-is, without any warranty. dnl From Bruno Haible and Sam Steingold. dnl Sets the HOST_CPU variable to the canonical name of the CPU. dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its dnl C language ABI (application binary interface). dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in dnl config.h. dnl dnl This canonical name can be used to select a particular assembly language dnl source file that will interoperate with C code on the given host. dnl dnl For example: dnl * 'i386' and 'sparc' are different canonical names, because code for i386 dnl will not run on SPARC CPUs and vice versa. They have different dnl instruction sets. dnl * 'sparc' and 'sparc64' are different canonical names, because code for dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit dnl mode, but not both. dnl * 'mips' and 'mipsn32' are different canonical names, because they use dnl different argument passing and return conventions for C functions, and dnl although the instruction set of 'mips' is a large subset of the dnl instruction set of 'mipsn32'. dnl * 'mipsn32' and 'mips64' are different canonical names, because they use dnl different sizes for the C types like 'int' and 'void *', and although dnl the instruction sets of 'mipsn32' and 'mips64' are the same. dnl * The same canonical name is used for different endiannesses. You can dnl determine the endianness through preprocessor symbols: dnl - 'arm': test __ARMEL__. dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. dnl - 'powerpc64': test __BIG_ENDIAN__ vs. __LITTLE_ENDIAN__. dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because dnl - Instructions that do not exist on all of these CPUs (cmpxchg, dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your dnl assembly language source files use such instructions, you will dnl need to make the distinction. dnl - Speed of execution of the common instruction set is reasonable across dnl the entire family of CPUs. If you have assembly language source files dnl that are optimized for particular CPU types (like GNU gmp has), you dnl will need to make the distinction. dnl See . AC_DEFUN([gl_HOST_CPU_C_ABI], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_C_ASM]) AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], [case "$host_cpu" in changequote(,)dnl i[34567]86 ) changequote([,])dnl gl_cv_host_cpu_c_abi=i386 ;; x86_64 ) # On x86_64 systems, the C compiler may be generating code in one of # these ABIs: # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 # with native Windows (mingw, MSVC). # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if (defined __x86_64__ || defined __amd64__ \ || defined _M_X64 || defined _M_AMD64) int ok; #else error fail #endif ]])], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __ILP32__ || defined _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=x86_64-x32], [gl_cv_host_cpu_c_abi=x86_64])], [gl_cv_host_cpu_c_abi=i386]) ;; changequote(,)dnl alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) changequote([,])dnl gl_cv_host_cpu_c_abi=alpha ;; arm* | aarch64 ) # Assume arm with EABI. # On arm64 systems, the C compiler may be generating code in one of # these ABIs: # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef __aarch64__ int ok; #else error fail #endif ]])], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __ILP32__ || defined _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=arm64-ilp32], [gl_cv_host_cpu_c_abi=arm64])], [# Don't distinguish little-endian and big-endian arm, since they # don't require different machine code for simple operations and # since the user can distinguish them through the preprocessor # defines __ARMEL__ vs. __ARMEB__. # But distinguish arm which passes floating-point arguments and # return values in integer registers (r0, r1, ...) - this is # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which # passes them in float registers (s0, s1, ...) and double registers # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer # sets the preprocessor defines __ARM_PCS (for the first case) and # __ARM_PCS_VFP (for the second case), but older GCC does not. echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c # Look for a reference to the register d0 in the .s file. AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then gl_cv_host_cpu_c_abi=armhf else gl_cv_host_cpu_c_abi=arm fi rm -f conftest* ]) ;; hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) # On hppa, the C compiler may be generating 32-bit code or 64-bit # code. In the latter case, it defines _LP64 and __LP64__. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef __LP64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=hppa64], [gl_cv_host_cpu_c_abi=hppa]) ;; ia64* ) # On ia64 on HP-UX, the C compiler may be generating 64-bit code or # 32-bit code. In the latter case, it defines _ILP32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#ifdef _ILP32 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=ia64-ilp32], [gl_cv_host_cpu_c_abi=ia64]) ;; mips* ) # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this # at 32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=mips64], [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but # may later get defined by ), and _MIPS_SIM == _ABIN32. # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but # may later get defined by ), and _MIPS_SIM == _ABIO32. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if (_MIPS_SIM == _ABIN32) int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=mipsn32], [gl_cv_host_cpu_c_abi=mips])]) ;; powerpc* ) # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. # No need to distinguish them here; the caller may distinguish # them based on the OS. # On powerpc64 systems, the C compiler may still be generating # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail #endif ]])], [# On powerpc64, there are two ABIs on Linux: The AIX compatible # one and the ELFv2 one. The latter defines _CALL_ELF=2. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined _CALL_ELF && _CALL_ELF == 2 int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=powerpc64-elfv2], [gl_cv_host_cpu_c_abi=powerpc64]) ], [gl_cv_host_cpu_c_abi=powerpc]) ;; rs6000 ) gl_cv_host_cpu_c_abi=powerpc ;; riscv32 | riscv64 ) # There are 2 architectures (with variants): rv32* and rv64*. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if __riscv_xlen == 64 int ok; #else error fail #endif ]])], [cpu=riscv64], [cpu=riscv32]) # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. # Size of 'long' and 'void *': AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ int ok; #else error fail #endif ]])], [main_abi=lp64], [main_abi=ilp32]) # Float ABIs: # __riscv_float_abi_double: # 'float' and 'double' are passed in floating-point registers. # __riscv_float_abi_single: # 'float' are passed in floating-point registers. # __riscv_float_abi_soft: # No values are passed in floating-point registers. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __riscv_float_abi_double int ok; #else error fail #endif ]])], [float_abi=d], [AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __riscv_float_abi_single int ok; #else error fail #endif ]])], [float_abi=f], [float_abi='']) ]) gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" ;; s390* ) # On s390x, the C compiler may be generating 64-bit (= s390x) code # or 31-bit (= s390) code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __LP64__ || defined __s390x__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=s390x], [gl_cv_host_cpu_c_abi=s390]) ;; sparc | sparc64 ) # UltraSPARCs running Linux have `uname -m` = "sparc64", but the # C compiler still generates 32-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( [[#if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif ]])], [gl_cv_host_cpu_c_abi=sparc64], [gl_cv_host_cpu_c_abi=sparc]) ;; *) gl_cv_host_cpu_c_abi="$host_cpu" ;; esac ]) dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same. HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" AC_SUBST([HOST_CPU]) AC_SUBST([HOST_CPU_C_ABI]) # This was # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) # earlier, but KAI C++ 3.2d doesn't like this. sed -e 's/-/_/g' >> confdefs.h <]], [[CFPreferencesCopyAppValue(NULL, NULL)]])], [gt_cv_func_CFPreferencesCopyAppValue=yes], [gt_cv_func_CFPreferencesCopyAppValue=no]) LIBS="$gt_saved_LIBS"]) if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent, dnl because in macOS 10.13.4 it has the following behaviour: dnl When two or more languages are specified in the dnl "System Preferences > Language & Region > Preferred Languages" panel, dnl it returns en_CC where CC is the territory (even when English is not among dnl the preferred languages!). What we want instead is what dnl CFLocaleCopyCurrent returned in earlier macOS releases and what dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the dnl first among the preferred languages and CC is the territory. AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages], [gt_saved_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[CFLocaleCopyPreferredLanguages();]])], [gt_cv_func_CFLocaleCopyPreferredLanguages=yes], [gt_cv_func_CFLocaleCopyPreferredLanguages=no]) LIBS="$gt_saved_LIBS"]) if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1], [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then dnl Starting with macOS version 14, CoreFoundation relies on CoreServices, dnl and we have to link it in explicitly, otherwise an exception dnl NSInvalidArgumentException "unrecognized selector sent to instance" dnl occurs. INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices" fi AC_SUBST([INTL_MACOSX_LIBS]) ]) lrzsz-0.13.1/m4/ChangeLog0000664000175000017500000000106715236322776010556 2026-08-10 gettextize * build-to-host.m4: New file, from gettext-0.23.1. * gettext.m4: New file, from gettext-0.23.1. * host-cpu-c-abi.m4: New file, from gettext-0.23.1. * iconv.m4: New file, from gettext-0.23.1. * intlmacosx.m4: New file, from gettext-0.23.1. * lib-ld.m4: New file, from gettext-0.23.1. * lib-link.m4: New file, from gettext-0.23.1. * lib-prefix.m4: New file, from gettext-0.23.1. * nls.m4: New file, from gettext-0.23.1. * po.m4: New file, from gettext-0.23.1. * progtest.m4: New file, from gettext-0.23.1. lrzsz-0.13.1/m4/build-to-host.m40000664000175000017500000002203215236613062011722 # build-to-host.m4 # serial 5 dnl Copyright (C) 2023-2024 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 file is offered as-is, without any warranty. dnl Written by Bruno Haible. dnl When the build environment ($build_os) is different from the target runtime dnl environment ($host_os), file names may need to be converted from the build dnl environment syntax to the target runtime environment syntax. This is dnl because the Makefiles are executed (mostly) by build environment tools and dnl therefore expect file names in build environment syntax, whereas the runtime dnl expects file names in target runtime environment syntax. dnl dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need dnl be converted from Cygwin syntax to native Windows syntax: dnl /cygdrive/c/foo/bar -> C:\foo\bar dnl /usr/local/share -> C:\cygwin64\usr\local\share dnl dnl gl_BUILD_TO_HOST([somedir]) dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must dnl already have its final value assigned, and produces two additional dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the dnl same file name value, just in different syntax: dnl - somedir_c is the file name in target runtime environment syntax, dnl as a C string (starting and ending with a double-quote, dnl and with escaped backslashes and double-quotes in dnl between). dnl - somedir_c_make is the same thing, escaped for use in a Makefile. AC_DEFUN([gl_BUILD_TO_HOST], [ AC_REQUIRE([AC_CANONICAL_BUILD]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_BUILD_TO_HOST_INIT]) dnl Define somedir_c. gl_final_[$1]="$[$1]" dnl Translate it from build syntax to host syntax. case "$build_os" in cygwin*) case "$host_os" in mingw* | windows*) gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;; esac ;; esac dnl Convert it to C string syntax. [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"` [$1]_c='"'"$[$1]_c"'"' AC_SUBST([$1_c]) dnl Define somedir_c_make. [$1]_c_make=`printf '%s\n' "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2" | tr -d "$gl_tr_cr"` dnl Use the substituted somedir variable, when possible, so that the user dnl may adjust somedir a posteriori when there are no special characters. if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then [$1]_c_make='\"$([$1])\"' fi AC_SUBST([$1_c_make]) ]) dnl Some initializations for gl_BUILD_TO_HOST. AC_DEFUN([gl_BUILD_TO_HOST_INIT], [ gl_sed_double_backslashes='s/\\/\\\\/g' gl_sed_escape_doublequotes='s/"/\\"/g' changequote(,)dnl gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" changequote([,])dnl gl_sed_escape_for_make_2='s,\$,\\$$,g' dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr dnl does not understand '\r'. case `echo r | tr -d '\r'` in '') gl_tr_cr='\015' ;; *) gl_tr_cr='\r' ;; esac ]) dnl The following macros are convenience invocations of gl_BUILD_TO_HOST dnl for some of the variables that are defined by Autoconf. dnl To do so for _all_ the possible variables, use the module 'configmake'. dnl Defines bindir_c and bindir_c_make. AC_DEFUN_ONCE([gl_BUILD_TO_HOST_BINDIR], [ dnl Find the final value of bindir. gl_saved_prefix="${prefix}" gl_saved_exec_prefix="${exec_prefix}" gl_saved_bindir="${bindir}" dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi if test "X$exec_prefix" = "XNONE"; then exec_prefix='${prefix}' fi eval exec_prefix="$exec_prefix" eval bindir="$bindir" gl_BUILD_TO_HOST([bindir]) bindir="${gl_saved_bindir}" exec_prefix="${gl_saved_exec_prefix}" prefix="${gl_saved_prefix}" ]) dnl Defines datadir_c and datadir_c_make, dnl where datadir = $(datarootdir) AC_DEFUN_ONCE([gl_BUILD_TO_HOST_DATADIR], [ dnl Find the final value of datadir. gl_saved_prefix="${prefix}" gl_saved_datarootdir="${datarootdir}" gl_saved_datadir="${datadir}" dnl Unfortunately, prefix gets only finally determined at the end of dnl configure. if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi eval datarootdir="$datarootdir" eval datadir="$datadir" gl_BUILD_TO_HOST([datadir]) datadir="${gl_saved_datadir}" datarootdir="${gl_saved_datarootdir}" prefix="${gl_saved_prefix}" ]) dnl Defines libdir_c and libdir_c_make. AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBDIR], [ dnl Find the final value of libdir. gl_saved_prefix="${prefix}" gl_saved_exec_prefix="${exec_prefix}" gl_saved_libdir="${libdir}" dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi if test "X$exec_prefix" = "XNONE"; then exec_prefix='${prefix}' fi eval exec_prefix="$exec_prefix" eval libdir="$libdir" gl_BUILD_TO_HOST([libdir]) libdir="${gl_saved_libdir}" exec_prefix="${gl_saved_exec_prefix}" prefix="${gl_saved_prefix}" ]) dnl Defines libexecdir_c and libexecdir_c_make. AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBEXECDIR], [ dnl Find the final value of libexecdir. gl_saved_prefix="${prefix}" gl_saved_exec_prefix="${exec_prefix}" gl_saved_libexecdir="${libexecdir}" dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi if test "X$exec_prefix" = "XNONE"; then exec_prefix='${prefix}' fi eval exec_prefix="$exec_prefix" eval libexecdir="$libexecdir" gl_BUILD_TO_HOST([libexecdir]) libexecdir="${gl_saved_libexecdir}" exec_prefix="${gl_saved_exec_prefix}" prefix="${gl_saved_prefix}" ]) dnl Defines localedir_c and localedir_c_make. AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LOCALEDIR], [ dnl Find the final value of localedir. gl_saved_prefix="${prefix}" gl_saved_datarootdir="${datarootdir}" gl_saved_localedir="${localedir}" dnl Unfortunately, prefix gets only finally determined at the end of dnl configure. if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi eval datarootdir="$datarootdir" eval localedir="$localedir" gl_BUILD_TO_HOST([localedir]) localedir="${gl_saved_localedir}" datarootdir="${gl_saved_datarootdir}" prefix="${gl_saved_prefix}" ]) dnl Defines pkgdatadir_c and pkgdatadir_c_make, dnl where pkgdatadir = $(datadir)/$(PACKAGE) AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGDATADIR], [ dnl Find the final value of pkgdatadir. gl_saved_prefix="${prefix}" gl_saved_datarootdir="${datarootdir}" gl_saved_datadir="${datadir}" gl_saved_pkgdatadir="${pkgdatadir}" dnl Unfortunately, prefix gets only finally determined at the end of dnl configure. if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi eval datarootdir="$datarootdir" eval datadir="$datadir" eval pkgdatadir="$pkgdatadir" gl_BUILD_TO_HOST([pkgdatadir]) pkgdatadir="${gl_saved_pkgdatadir}" datadir="${gl_saved_datadir}" datarootdir="${gl_saved_datarootdir}" prefix="${gl_saved_prefix}" ]) dnl Defines pkglibdir_c and pkglibdir_c_make, dnl where pkglibdir = $(libdir)/$(PACKAGE) AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBDIR], [ dnl Find the final value of pkglibdir. gl_saved_prefix="${prefix}" gl_saved_exec_prefix="${exec_prefix}" gl_saved_libdir="${libdir}" gl_saved_pkglibdir="${pkglibdir}" dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi if test "X$exec_prefix" = "XNONE"; then exec_prefix='${prefix}' fi eval exec_prefix="$exec_prefix" eval libdir="$libdir" eval pkglibdir="$pkglibdir" gl_BUILD_TO_HOST([pkglibdir]) pkglibdir="${gl_saved_pkglibdir}" libdir="${gl_saved_libdir}" exec_prefix="${gl_saved_exec_prefix}" prefix="${gl_saved_prefix}" ]) dnl Defines pkglibexecdir_c and pkglibexecdir_c_make, dnl where pkglibexecdir = $(libexecdir)/$(PACKAGE) AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBEXECDIR], [ dnl Find the final value of pkglibexecdir. gl_saved_prefix="${prefix}" gl_saved_exec_prefix="${exec_prefix}" gl_saved_libexecdir="${libexecdir}" gl_saved_pkglibexecdir="${pkglibexecdir}" dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi if test "X$exec_prefix" = "XNONE"; then exec_prefix='${prefix}' fi eval exec_prefix="$exec_prefix" eval libexecdir="$libexecdir" eval pkglibexecdir="$pkglibexecdir" gl_BUILD_TO_HOST([pkglibexecdir]) pkglibexecdir="${gl_saved_pkglibexecdir}" libexecdir="${gl_saved_libexecdir}" exec_prefix="${gl_saved_exec_prefix}" prefix="${gl_saved_prefix}" ]) lrzsz-0.13.1/m4/gettext.m40000644000175000017500000003521615236326254010726 # gettext.m4 # serial 81 (gettext-0.23) dnl Copyright (C) 1995-2014, 2016, 2018-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under dnl the GNU General Public License or the GNU Lesser General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2024. dnl Macro to add for using GNU gettext. dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). dnl INTLSYMBOL must be one of 'external', 'use-libtool', 'here'. dnl INTLSYMBOL should be 'external' for packages other than GNU gettext. dnl It should be 'use-libtool' for the packages 'gettext-runtime' and dnl 'gettext-tools'. dnl It should be 'here' for the package 'gettext-runtime/intl'. dnl If INTLSYMBOL is 'here', then a libtool library dnl $(top_builddir)/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of dnl AM-DISABLE-SHARED). dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext dnl implementations (in libc or libintl) without the ngettext() function dnl will be ignored. If NEEDSYMBOL is specified and is dnl 'need-formatstring-macros', then GNU gettext implementations that don't dnl support the ISO C 99 formatstring macros will be ignored. dnl INTLDIR is used to find the intl libraries. If empty, dnl the value '$(top_builddir)/intl/' is used. dnl dnl The result of the configuration is one of three cases: dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled dnl and used. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 2) GNU gettext has been found in the system's C library. dnl Catalog format: GNU --> install in $(datadir) dnl Catalog extension: .mo after installation, .gmo in source tree dnl 3) No internationalization, always use English msgid. dnl Catalog format: none dnl Catalog extension: none dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. dnl The use of .gmo is historical (it was needed to avoid overwriting the dnl GNU format catalogs when building on a platform with an X/Open gettext), dnl but we keep it in order not to force irrelevant filename changes on the dnl maintainers. dnl AC_DEFUN([AM_GNU_GETTEXT], [ dnl Argument checking. m4_if([$1], [], , [m4_if([$1], [external], , [m4_if([$1], [use-libtool], , [m4_if([$1], [here], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT ])])])])]) m4_if(m4_if([$1], [], [old])[]m4_if([$1], [no-libtool], [old]), [old], [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported. ])]) m4_if([$2], [], , [m4_if([$2], [need-ngettext], , [m4_if([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) define([gt_building_libintl_in_same_build_tree], m4_if([$1], [use-libtool], [yes], [m4_if([$1], [here], [yes], [no])])) gt_NEEDS_INIT AM_GNU_GETTEXT_NEED([$2]) AC_REQUIRE([AM_PO_SUBDIRS])dnl dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Sometimes libintl requires libiconv, so first search for libiconv. dnl Ideally we would do this search only after the dnl if test "$USE_NLS" = "yes"; then dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl tests. But if configure.ac invokes AM_ICONV after AM_GNU_GETTEXT dnl the configure script would need to contain the same shell code dnl again, outside any 'if'. There are two solutions: dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it. m4_if(gt_building_libintl_in_same_build_tree, yes, , [ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation. gt_INTL_MACOSX dnl Set USE_NLS. AC_REQUIRE([AM_NLS]) m4_if(gt_building_libintl_in_same_build_tree, yes, [ USE_INCLUDED_LIBINTL=no ]) LIBINTL= LTLIBINTL= POSUB= dnl Add a version number to the cache macros. case " $gt_needs " in *" need-formatstring-macros "*) gt_api_version=3 ;; *" need-ngettext "*) gt_api_version=2 ;; *) gt_api_version=1 ;; esac gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no m4_if(gt_building_libintl_in_same_build_tree, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH([included-gettext], [ --with-included-gettext use the GNU gettext library included here], nls_cv_force_use_gnu_gettext=$withval, nls_cv_force_use_gnu_gettext=no) AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" if test "$nls_cv_force_use_gnu_gettext" != "yes"; then ]) dnl User does not insist on using GNU NLS library. Figure out what dnl to use. If GNU gettext is available we use this. Else we have dnl to fall back to GNU NLS library. if test $gt_api_version -ge 3; then gt_revision_test_code=' #ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif changequote(,)dnl typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; changequote([,])dnl ' else gt_revision_test_code= fi if test $gt_api_version -ge 2; then gt_expression_test_code=' + * ngettext ("", "", 0)' else gt_expression_test_code= fi AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) #else #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 #endif $gt_revision_test_code ]], [[ bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION ]])], [eval "$gt_func_gnugettext_libc=yes"], [eval "$gt_func_gnugettext_libc=no"])]) if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl Sometimes libintl requires libiconv, so first search for libiconv. m4_if(gt_building_libintl_in_same_build_tree, yes, , [ AM_ICONV_LINK ]) dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) dnl because that would add "-liconv" to LIBINTL and LTLIBINTL dnl even if libiconv doesn't exist. AC_LIB_LINKFLAGS_BODY([intl]) AC_CACHE_CHECK([for GNU gettext in libintl], [$gt_func_gnugettext_libintl], [gt_saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_saved_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" dnl Now see whether libintl exists and does not depend on libiconv. AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) #else #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 #endif $gt_revision_test_code ]], [[ bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION ]])], [eval "$gt_func_gnugettext_libintl=yes"], [eval "$gt_func_gnugettext_libintl=no"]) dnl Now see whether libintl exists and depends on libiconv or other dnl OS dependent libraries, specifically on macOS and AIX. gt_LIBINTL_EXTRA="$INTL_MACOSX_LIBS" AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in aix*) gt_LIBINTL_EXTRA="-lpthread" ;; esac if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } \ && { test -n "$LIBICONV" || test -n "$gt_LIBINTL_EXTRA"; }; then LIBS="$LIBS $LIBICONV $gt_LIBINTL_EXTRA" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) #else #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 #endif $gt_revision_test_code ]], [[ bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION ]])], [LIBINTL="$LIBINTL $LIBICONV $gt_LIBINTL_EXTRA" LTLIBINTL="$LTLIBINTL $LTLIBICONV $gt_LIBINTL_EXTRA" eval "$gt_func_gnugettext_libintl=yes" ]) fi CPPFLAGS="$gt_saved_CPPFLAGS" LIBS="$gt_saved_LIBS"]) fi dnl If an already present or preinstalled GNU gettext() is found, dnl use it. But if this macro is used in GNU gettext, and GNU dnl gettext is already preinstalled in libintl, we update this dnl libintl. (Cf. the install rule in intl/Makefile.in.) if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools \ && test "$PACKAGE" != libintl; }; then gt_use_preinstalled_gnugettext=yes else dnl Reset the values set by searching for libintl. LIBINTL= LTLIBINTL= INCINTL= fi m4_if(gt_building_libintl_in_same_build_tree, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then dnl GNU gettext is not found in the C library. dnl Fall back on included GNU gettext library. nls_cv_use_gnu_gettext=yes fi fi if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. USE_INCLUDED_LIBINTL=yes LIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD" LTLIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD" LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` fi CATOBJEXT= if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions to use GNU gettext tools. CATOBJEXT=.gmo fi ]) if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Some extra flags are needed during linking. LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then AC_DEFINE([ENABLE_NLS], [1], [Define to 1 if translation of program messages to the user's native language is requested.]) else USE_NLS=no fi fi AC_MSG_CHECKING([whether to use NLS]) AC_MSG_RESULT([$USE_NLS]) if test "$USE_NLS" = "yes"; then AC_MSG_CHECKING([where the gettext function comes from]) if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi AC_MSG_RESULT([$gt_source]) fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then AC_MSG_CHECKING([how to link with libintl]) AC_MSG_RESULT([$LIBINTL]) AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) fi dnl For backward compatibility. Some packages may be using this. AC_DEFINE([HAVE_GETTEXT], [1], [Define if the GNU gettext() function is already present or preinstalled.]) AC_DEFINE([HAVE_DCGETTEXT], [1], [Define if the GNU dcgettext() function is already present or preinstalled.]) fi dnl We need to process the po/ directory. POSUB=po fi m4_if(gt_building_libintl_in_same_build_tree, yes, [ dnl Make all variables we use known to autoconf. AC_SUBST([USE_INCLUDED_LIBINTL]) AC_SUBST([CATOBJEXT]) ]) m4_if(gt_building_libintl_in_same_build_tree, yes, [], [ dnl For backward compatibility. Some Makefiles may be using this. INTLLIBS="$LIBINTL" AC_SUBST([INTLLIBS]) ]) dnl Make all documented variables known to autoconf. AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) AC_SUBST([POSUB]) dnl Define localedir_c and localedir_c_make. gl_BUILD_TO_HOST_LOCALEDIR ]) dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. m4_define([gt_NEEDS_INIT], [ m4_divert_text([DEFAULTS], [gt_needs=]) m4_define([gt_NEEDS_INIT], []) ]) dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) AC_DEFUN([AM_GNU_GETTEXT_NEED], [ m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) ]) dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], []) lrzsz-0.13.1/m4/lib-prefix.m40000644000175000017500000003044615236326254011303 # lib-prefix.m4 # serial 23 dnl Copyright (C) 2001-2005, 2008-2024 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 file is offered as-is, without any warranty. dnl From Bruno Haible. dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed dnl with the same --prefix option. dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate dnl libraries, but is otherwise very convenient. AC_DEFUN([AC_LIB_PREFIX], [ AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) AC_ARG_WITH([lib-prefix], [[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib --without-lib-prefix don't search for libraries in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" fi fi ]) if test $use_additional = yes; then dnl Potentially add $additional_includedir to $CPPFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $CPPFLAGS. CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi fi dnl Potentially add $additional_libdir to $LDFLAGS. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's already present in $LDFLAGS, dnl 3. if it's /usr/local/lib and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= for x in $LDFLAGS; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then if test -n "$GCC"; then case $host_os in linux*) haveit=yes;; esac fi fi if test -z "$haveit"; then if test -d "$additional_libdir"; then dnl Really add $additional_libdir to $LDFLAGS. LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" fi fi fi fi fi ]) dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and dnl $exec_prefix will expand at the end of the configure script. AC_DEFUN([AC_LIB_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined dnl at the end of configure. if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_saved_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_saved_prefix" ]) dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the dnl variables prefix and exec_prefix bound to the values they will have dnl at the end of the configure script. AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], [ acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" $1 exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" ]) dnl AC_LIB_PREPARE_MULTILIB creates dnl - a function acl_is_expected_elfclass, that tests whether standard input dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI, dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing dnl the basename of the libdir to try in turn, either "lib" or "lib64" or dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar. AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ dnl There is no formal standard regarding lib, lib32, and lib64. dnl On most glibc systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib. dnl We determine the compiler's default mode by looking at the compiler's dnl library search path. If at least one of its elements ends in /lib64 or dnl points to a directory whose absolute pathname ends in /lib64, we use that dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default, dnl namely "lib". dnl On Solaris systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], [AC_EGREP_CPP([Extensible Linking Format], [#if defined __ELF__ || (defined __linux__ && (defined __EDG__ || defined __SUNPRO_C)) Extensible Linking Format #endif ], [gl_cv_elf=yes], [gl_cv_elf=no]) ]) if test $gl_cv_elf = yes; then # Extract the ELF class of a file (5th byte) in decimal. # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header if od -A x < /dev/null >/dev/null 2>/dev/null; then # Use POSIX od. func_elfclass () { od -A n -t d1 -j 4 -N 1 } else # Use BSD hexdump. func_elfclass () { dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' echo } fi # Use 'expr', not 'test', to compare the values of func_elfclass, because on # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, # not 1 or 2. changequote(,)dnl case $HOST_CPU_C_ABI_32BIT in yes) # 32-bit ABI. acl_is_expected_elfclass () { expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null } ;; no) # 64-bit ABI. acl_is_expected_elfclass () { expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null } ;; *) # Unknown. acl_is_expected_elfclass () { : } ;; esac changequote([,])dnl else acl_is_expected_elfclass () { : } fi dnl Allow the user to override the result by setting acl_cv_libdirstems. AC_CACHE_CHECK([for the common suffixes of directories in the library search path], [acl_cv_libdirstems], [dnl Try 'lib' first, because that's the default for libdir in GNU, see dnl . acl_libdirstem=lib acl_libdirstem2= acl_libdirstem3= case "$host_os" in solaris*) dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment dnl . dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the dnl symlink is missing, so we set acl_libdirstem2 too. if test $HOST_CPU_C_ABI_32BIT = no; then acl_libdirstem2=lib/64 case "$host_cpu" in sparc*) acl_libdirstem3=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; esac fi ;; netbsd*) dnl On NetBSD/sparc64, there is a 'sparc' subdirectory that contains dnl 32-bit libraries. if test $HOST_CPU_C_ABI_32BIT != no; then case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparc ;; esac fi ;; *) dnl If $CC generates code for a 32-bit ABI, the libraries are dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64. dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32. dnl Find the compiler's search path. However, non-system compilers dnl sometimes have odd library search paths. But we can't simply invoke dnl '/usr/bin/gcc -print-search-dirs' because that would not take into dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS. searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test $HOST_CPU_C_ABI_32BIT != no; then # 32-bit or unknown ABI. if test -d /usr/lib32; then acl_libdirstem2=lib32 fi fi if test $HOST_CPU_C_ABI_32BIT != yes; then # 64-bit or unknown ABI. if test -d /usr/lib64; then acl_libdirstem3=lib64 fi fi if test -n "$searchpath"; then acl_saved_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib32 ) acl_libdirstem2=lib32 ;; */lib64 ) acl_libdirstem3=lib64 ;; esac ;; esac fi done IFS="$acl_saved_IFS" if test $HOST_CPU_C_ABI_32BIT = yes; then # 32-bit ABI. acl_libdirstem3= fi if test $HOST_CPU_C_ABI_32BIT = no; then # 64-bit ABI. acl_libdirstem2= fi fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" ]) dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and dnl acl_libdirstem3. changequote(,)dnl acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` changequote([,])dnl ]) lrzsz-0.13.1/m4/ax_append_compile_flags.m40000644000175000017500000000334515236613516014063 # ============================================================================ # https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html # ============================================================================ # # SYNOPSIS # # AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # For every FLAG1, FLAG2 it is checked whether the compiler works with the # flag. If it does, the flag is added FLAGS-VARIABLE # # If FLAGS-VARIABLE is not specified, the current language's flags (e.g. # CFLAGS) is used. During the check the flag is always added to the # current language's flags. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: This macro depends on the AX_APPEND_FLAG and # AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with # AX_APPEND_LINK_FLAGS. # # LICENSE # # Copyright (c) 2011 Maarten Bosmans # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 7 AC_DEFUN([AX_APPEND_COMPILE_FLAGS], [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) for flag in $1; do AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) done ])dnl AX_APPEND_COMPILE_FLAGS lrzsz-0.13.1/m4/iconv.m40000644000175000017500000002545415236326254010363 # iconv.m4 # serial 28 dnl Copyright (C) 2000-2002, 2007-2014, 2016-2024 Free Software Foundation, dnl 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 file is offered as-is, without any warranty. dnl From Bruno Haible. AC_PREREQ([2.64]) dnl Note: AM_ICONV is documented in the GNU gettext manual dnl . dnl Don't make changes that are incompatible with that documentation! AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_LIB_LINKFLAGS_BODY([iconv]) ]) AC_DEFUN([AM_ICONV_LINK], [ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and dnl those with the standalone portable GNU libiconv installed). AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV dnl accordingly. AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) dnl Add $INCICONV to CPPFLAGS before performing the following checks, dnl because if the user has installed libiconv and not disabled its use dnl via --without-libiconv-prefix, he wants to use it. The first dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. gl_saved_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #include ]], [[iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);]])], [am_cv_func_iconv=yes]) if test "$am_cv_func_iconv" != yes; then gl_saved_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[ #include #include ]], [[iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd);]])], [am_cv_lib_iconv=yes] [am_cv_func_iconv=yes]) LIBS="$gl_saved_LIBS" fi ]) if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, dnl Solaris 10, macOS 14.4. gl_saved_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[ #include #include #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif ]], [[int result = 0; /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from successful returns. This is even documented in */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against macOS 14.4 bug: Failures are not distinguishable from successful returns. POSIX:2018 says: "The iconv() function shall ... return the number of non-identical conversions performed." But here, the conversion always does transliteration (the suffixes "//TRANSLIT" and "//IGNORE" have no effect, nor does iconvctl()) and does not report when it does a non-identical conversion. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\305\202"; /* LATIN SMALL LETTER L WITH STROKE */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); /* Here: With glibc, GNU libiconv (including macOS up to 13): res == (size_t)-1, errno == EILSEQ. With musl libc, NetBSD 10, Solaris 11: res == 1. With macOS 14.4: res == 0, output is "l". */ if (res == 0) result |= 2; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 4; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 8; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 16; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ { /* Try standardized names. */ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); /* Try IRIX, OSF/1 names. */ iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); /* Try AIX names. */ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); /* Try HP-UX names. */ iconv_t cd4 = iconv_open ("utf8", "eucJP"); if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) result |= 32; if (cd1 != (iconv_t)(-1)) iconv_close (cd1); if (cd2 != (iconv_t)(-1)) iconv_close (cd2); if (cd3 != (iconv_t)(-1)) iconv_close (cd3); if (cd4 != (iconv_t)(-1)) iconv_close (cd4); } return result; ]])], [am_cv_func_iconv_works=yes], , [case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac]) test "$am_cv_func_iconv_works" = no || break done LIBS="$gl_saved_LIBS" ]) case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then AC_DEFINE([HAVE_ICONV], [1], [Define if you have the iconv() function and it works.]) fi if test "$am_cv_lib_iconv" = yes; then AC_MSG_CHECKING([how to link with libiconv]) AC_MSG_RESULT([$LIBICONV]) else dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV dnl either. CPPFLAGS="$gl_saved_CPPFLAGS" LIBICONV= LTLIBICONV= fi AC_SUBST([LIBICONV]) AC_SUBST([LTLIBICONV]) ]) dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". AC_DEFUN_ONCE([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature], [gl_cv_iconv_nonconst], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ #include #include extern #ifdef __cplusplus "C" #endif size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); ]], [[]])], [gl_cv_iconv_nonconst=yes], [gl_cv_iconv_nonconst=no]) ]) else dnl When compiling GNU libiconv on a system that does not have iconv yet, dnl pick the POSIX compliant declaration without 'const'. gl_cv_iconv_nonconst=yes fi if test $gl_cv_iconv_nonconst = yes; then iconv_arg1="" else iconv_arg1="const" fi AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1], [Define as const if the declaration of iconv() needs const.]) dnl Also substitute ICONV_CONST in the gnulib generated . m4_ifdef([gl_ICONV_H_DEFAULTS], [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) if test $gl_cv_iconv_nonconst != yes; then ICONV_CONST="const" fi ]) dnl A summary result, for those packages which want to print a summary at the dnl end of the configuration. if test "$am_func_iconv" = yes; then if test -n "$LIBICONV"; then am_cv_func_iconv_summary='yes, in libiconv' else am_cv_func_iconv_summary='yes, in libc' fi else if test "$am_cv_func_iconv" = yes; then am_cv_func_iconv_summary='not working, consider installing GNU libiconv' else am_cv_func_iconv_summary='no, consider installing GNU libiconv' fi fi ]) lrzsz-0.13.1/m4/progtest.m40000644000175000017500000000602315236326254011103 # progtest.m4 # serial 10 (gettext-0.23) dnl Copyright (C) 1996-2003, 2005, 2008-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under dnl the GNU General Public License or the GNU Lesser General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1996. AC_PREREQ([2.53]) # Search path for a program which passes the given test. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) AC_DEFUN([AM_PATH_PROG_WITH_TEST], [ # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL([ac_cv_path_$1], [case "[$]$1" in [[\\/]]* | ?:[[\\/]]*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) gt_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in m4_if([$5], , $PATH, [$5]); do IFS="$gt_saved_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$gt_saved_IFS" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. m4_if([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test m4_if([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$][$1]) else AC_MSG_RESULT([no]) fi AC_SUBST([$1])dnl ]) lrzsz-0.13.1/m4/ax_check_compile_flag.m40000644000175000017500000000466015236613313013502 # =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # INPUT gives an alternative input source to AC_COMPILE_IFELSE. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim # Copyright (c) 2011 Maarten Bosmans # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. This file is offered as-is, without any # warranty. #serial 11 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether the _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS if test x"m4_case(_AC_LANG, [C], [$GCC], [C++], [$GXX], [Fortran], [$GFC], [Fortran 77], [$G77], [Objective C], [$GOBJC], [Objective C++], [$GOBJCXX], [no])" = xyes ; then add_gnu_werror="-Werror" fi _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1 $add_gnu_werror" AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_VAR_IF(CACHEVAR,yes, [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS lrzsz-0.13.1/m4/lib-link.m40000644000175000017500000010572415236326254010745 # lib-link.m4 # serial 34 dnl Copyright (C) 2001-2024 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 file is offered as-is, without any warranty. dnl From Bruno Haible. AC_PREREQ([2.61]) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and dnl augments the CPPFLAGS variable. dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) pushdef([Name],[m4_translit([$1],[./+-], [____])]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ AC_LIB_LINKFLAGS_BODY([$1], [$2]) ac_cv_lib[]Name[]_libs="$LIB[]NAME" ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" ac_cv_lib[]Name[]_cppflags="$INC[]NAME" ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" ]) LIB[]NAME="$ac_cv_lib[]Name[]_libs" LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" INC[]NAME="$ac_cv_lib[]Name[]_cppflags" LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) AC_SUBST([LIB]NAME[_PREFIX]) dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the dnl results of this search when this library appears as a dependency. HAVE_LIB[]NAME=yes popdef([NAME]) popdef([Name]) ]) dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) dnl searches for libname and the libraries corresponding to explicit and dnl implicit dependencies, together with the specified include files and dnl the ability to compile and link the specified testcode. The missing-message dnl defaults to 'no' and may contain additional hints for the user. dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], [ AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) AC_REQUIRE([AC_LIB_RPATH]) pushdef([Name],[m4_translit([$1],[./+-], [____])]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME dnl accordingly. AC_LIB_LINKFLAGS_BODY([$1], [$2]) dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, dnl because if the user has installed lib[]Name and not disabled its use dnl via --without-lib[]Name-prefix, he wants to use it. acl_saved_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ acl_saved_LIBS="$LIBS" dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, dnl because these -l options might require -L options that are present in dnl LIBS. -l options benefit only from the -L options listed before it. dnl Otherwise, add it to the front of LIBS, because it may be a static dnl library that depends on another static library that is present in LIBS. dnl Static libraries benefit only from the static libraries listed after dnl it. case " $LIB[]NAME" in *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; *) LIBS="$LIB[]NAME $LIBS" ;; esac AC_LINK_IFELSE( [AC_LANG_PROGRAM([[$3]], [[$4]])], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) LIBS="$acl_saved_LIBS" ]) if test "$ac_cv_lib[]Name" = yes; then HAVE_LIB[]NAME=yes AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) AC_MSG_CHECKING([how to link with lib[]$1]) AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no dnl If $LIB[]NAME didn't lead to a usable library, we don't need dnl $INC[]NAME either. CPPFLAGS="$acl_saved_CPPFLAGS" LIB[]NAME= LTLIB[]NAME= LIB[]NAME[]_PREFIX= fi AC_SUBST([HAVE_LIB]NAME) AC_SUBST([LIB]NAME) AC_SUBST([LTLIB]NAME) AC_SUBST([LIB]NAME[_PREFIX]) popdef([NAME]) popdef([Name]) ]) dnl Determine the platform dependent parameters needed to use rpath: dnl acl_libext, dnl acl_shlibext, dnl acl_libname_spec, dnl acl_library_names_spec, dnl acl_hardcode_libdir_flag_spec, dnl acl_hardcode_libdir_separator, dnl acl_hardcode_direct, dnl acl_hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ dnl Complain if config.rpath is missing. AC_REQUIRE_AUX_FILE([config.rpath]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ]) wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" dnl Determine whether the user wants rpath handling at all. AC_ARG_ENABLE([rpath], [ --disable-rpath do not hardcode runtime library paths], :, enable_rpath=yes) ]) dnl AC_LIB_FROMPACKAGE(name, package) dnl declares that libname comes from the given package. The configure file dnl will then not have a --with-libname-prefix option but a dnl --with-package-prefix option. Several libraries can come from the same dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar dnl macro call that searches for libname. AC_DEFUN([AC_LIB_FROMPACKAGE], [ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_frompackage_]NAME, [$2]) popdef([NAME]) pushdef([PACK],[$2]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) define([acl_libsinpackage_]PACKUP, m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) popdef([PACKUP]) popdef([PACK]) ]) dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. AC_DEFUN([AC_LIB_LINKFLAGS_BODY], [ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) AC_ARG_WITH(PACK[-prefix], [[ --with-]]PACK[[-prefix[=DIR] search for ]]PACKLIBS[[ in DIR/include and DIR/lib --without-]]PACK[[-prefix don't search for ]]PACKLIBS[[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" additional_libdir2="$withval/$acl_libdirstem2" additional_libdir3="$withval/$acl_libdirstem3" fi fi ]) if test "X$additional_libdir2" = "X$additional_libdir"; then additional_libdir2= fi if test "X$additional_libdir3" = "X$additional_libdir"; then additional_libdir3= fi dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Use breadth-first search. LIB[]NAME= LTLIB[]NAME= INC[]NAME= LIB[]NAME[]_PREFIX= dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been dnl computed. So it has to be reset here. HAVE_LIB[]NAME= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='$1 $2' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" dnl See if it was already located by an earlier AC_LIB_LINKFLAGS dnl or AC_LIB_HAVE_LINKFLAGS call. uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined dnl that this library doesn't exist. So just drop it. : fi else dnl Search the library lib$name in $additional_libdir and $LDFLAGS dnl and the already constructed $LIBNAME/$LTLIBNAME. found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do if test "X$found_dir" = "X"; then eval dir=\$$additional_libdir_variable if test -n "$dir"; then dnl The same code as in the loop below: dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi fi done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` dnl First look for a shared library. if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi dnl Then look for a static library. if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then dnl Found the library. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its dnl directory into the executable's runpath, unless it's the dnl standard /usr/lib. if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi dnl The hardcoding into $LIBNAME is system dependent. if test "$acl_hardcode_direct" = yes; then dnl Using DIR/libNAME.so during linking hardcodes DIR into the dnl resulting binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode DIR into the resulting dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else dnl Rely on "-L$found_dir". dnl But don't add it if it's already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH dnl here, because this doesn't fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only dnl very old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else dnl We shouldn't come here, but anyway it's good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi fi dnl Assume the include files are nearby. additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem3 | */$acl_libdirstem3/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` if test "$name" = '$1'; then LIB[]NAME[]_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, dnl 3. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then dnl Really add $additional_includedir to $INCNAME. INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi fi fi dnl Look for dependencies. if test -n "$found_la"; then dnl Read the .la file. It defines the variables dnl dlname, library_names, old_library, dependency_libs, current, dnl age, revision, installed, dlopen, dlpreopen, libdir. saved_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$saved_libdir" dnl We use only dependency_libs. for dep in $dependency_libs; do case "$dep" in -L*) dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then dnl Really add $dependency_libdir to $LIBNAME. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then dnl Really add $dependency_libdir to $LTLIBNAME. LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. dnl The rpathdirs will be appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dnl Handle this in the next round. dnl But on GNU systems, ignore -lc options, because dnl - linking with libc is the default anyway, dnl - linking with libc.a may produce an error dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie" dnl or may produce an executable that always crashes, see dnl . dep=`echo "X$dep" | sed -e 's/^X-l//'` if test "X$dep" != Xc \ || case $host_os in linux* | gnu* | k*bsd*-gnu) false ;; *) true ;; esac; then names_next_round="$names_next_round $dep" fi ;; *.la) dnl Handle this in the next round. Throw away the .la's dnl directory; it is already contained in a preceding -L dnl option. names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) dnl Most likely an immediate library name. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" ;; esac done fi else dnl Didn't find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user must dnl pass all path elements in one option. We can arrange that for a dnl single library, but not when more than one $LIBNAMEs are used. alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. acl_saved_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_saved_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" else dnl The -rpath options are cumulative. for found_dir in $rpathdirs; do acl_saved_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_saved_libdir" LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then dnl When using libtool, the option that works for both libraries and dnl executables is -R. The -R options are cumulative. for found_dir in $ltrpathdirs; do LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi popdef([PACKLIBS]) popdef([PACKUP]) popdef([PACK]) popdef([NAME]) ]) dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, dnl unless already present in VAR. dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes dnl contains two or three consecutive elements that belong together. AC_DEFUN([AC_LIB_APPENDTOVAR], [ for element in [$2]; do haveit= for x in $[$1]; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then [$1]="${[$1]}${[$1]:+ }$element" fi done ]) dnl For those cases where a variable contains several -L and -l options dnl referring to unknown libraries and directories, this macro determines the dnl necessary additional linker options for the runtime path. dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) dnl sets LDADDVAR to linker options needed together with LIBSVALUE. dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, dnl otherwise linking without libtool is assumed. AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], [ AC_REQUIRE([AC_LIB_RPATH]) AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) $1= if test "$enable_rpath" != no; then if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then dnl Use an explicit option to hardcode directories into the resulting dnl binary. rpathdirs= next= for opt in $2; do if test -n "$next"; then dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2" \ && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= else case $opt in -L) next=yes ;; -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ && test "X$dir" != "X/usr/$acl_libdirstem2" \ && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= ;; *) next= ;; esac fi done if test "X$rpathdirs" != "X"; then if test -n ""$3""; then dnl libtool is used for linking. Use -R options. for dir in $rpathdirs; do $1="${$1}${$1:+ }-R$dir" done else dnl The linker is used for linking directly. if test -n "$acl_hardcode_libdir_separator"; then dnl Weird platform: only the last -rpath option counts, the user dnl must pass all path elements in one option. alldirs= for dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" done acl_saved_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_saved_libdir" $1="$flag" else dnl The -rpath options are cumulative. for dir in $rpathdirs; do acl_saved_libdir="$libdir" libdir="$dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_saved_libdir" $1="${$1}${$1:+ }$flag" done fi fi fi fi fi AC_SUBST([$1]) ]) lrzsz-0.13.1/m4/lib-ld.m40000644000175000017500000001250015236326254010374 # lib-ld.m4 # serial 13 dnl Copyright (C) 1996-2003, 2009-2024 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 file is offered as-is, without any warranty. dnl Subroutines of libtool.m4, dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid dnl collision with libtool.m4. dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], [# I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 /dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi if test -n "$LD"; then AC_MSG_CHECKING([for ld]) elif test "$GCC" = yes; then AC_MSG_CHECKING([for ld used by $CC]) elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi if test -n "$LD"; then # Let the user override the test with a path. : else AC_CACHE_VAL([acl_cv_path_LD], [ acl_cv_path_LD= # Final result of this test ac_prog=ld # Program to search in $PATH if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. case $host in *-*-mingw* | windows*) # gcc leaves a trailing carriage return which upsets mingw acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) acl_output=`($CC -print-prog-name=ld) 2>&5` ;; esac case $acl_output in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` done # Got the pathname. No search in PATH is needed. acl_cv_path_LD="$acl_output" ac_prog= ;; "") # If it fails, then pretend we aren't using GCC. ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac fi if test -n "$ac_prog"; then # Search for $ac_prog in $PATH. acl_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_saved_IFS" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # 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. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in cloudabi*-eabi* \ | kfreebsd*-gnu* \ | knetbsd*-gnu* \ | kopensolaris*-gnu* \ | linux-* \ | managarm-* \ | netbsd*-eabi* \ | netbsd*-gnu* \ | nto-qnx* \ | os2-emx* \ | rtmk-nova* \ | storm-chaos* \ | uclinux-gnu* \ | uclinux-uclibc* \ | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) case $field1-$field2 in # Shorthands that happen to contain a single dash convex-c[12] | convex-c3[248]) basic_machine=$field2-convex basic_os= ;; decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Do not treat sunos as a manufacturer sun*os*) basic_machine=$field1 basic_os=$field2 ;; # Manufacturers 3100* \ | 32* \ | 3300* \ | 3600* \ | 7300* \ | acorn \ | altos* \ | apollo \ | apple \ | atari \ | att* \ | axis \ | be \ | bull \ | cbm \ | ccur \ | cisco \ | commodore \ | convergent* \ | convex* \ | cray \ | crds \ | dec* \ | delta* \ | dg \ | digital \ | dolphin \ | encore* \ | gould \ | harris \ | highlevel \ | hitachi* \ | hp \ | ibm* \ | intergraph \ | isi* \ | knuth \ | masscomp \ | microblaze* \ | mips* \ | motorola* \ | ncr* \ | news \ | next \ | ns \ | oki \ | omron* \ | pc533* \ | rebel \ | rom68k \ | rombug \ | semi \ | sequent* \ | siemens \ | sgi* \ | siemens \ | sim \ | sni \ | sony* \ | stratus \ | sun \ | sun[234]* \ | tektronix \ | tti* \ | ultra \ | unicom* \ | wec \ | winbond \ | wrs) basic_machine=$field1-$field2 basic_os= ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # 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) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | delta-motorola | 3300-motorola | motorola-delta | motorola-3300) cpu=m68k vendor=motorola ;; # This used to be dpx2*, but that gets the RS6000-based # DPX/20 and the x86-based DPX/2-100 wrong. See # https://oldskool.silicium.org/stations/bull_dpx20.htm # https://www.feb-patrimoine.com/english/bull_dpx2.htm # https://www.feb-patrimoine.com/english/unix_and_bull.htm dpx2 | dpx2[23]00 | dpx2[23]xx) cpu=m68k vendor=bull ;; dpx2100 | dpx21xx) cpu=i386 vendor=bull ;; dpx20) cpu=rs6000 vendor=bull ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x"$basic_os" != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. obj= case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) saved_IFS=$IFS IFS="-" read kernel os <&2 fi ;; *) echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 exit 1 ;; esac case $obj in aout* | coff* | elf* | pe*) ;; '') # empty is fine ;; *) echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 exit 1 ;; esac # Here we handle the constraint that a (synthetic) cpu and os are # valid only in combination with each other and nowhere else. case $cpu-$os in # The "javascript-unknown-ghcjs" triple is used by GHC; we # accept it here in order to tolerate that, but reject any # variations. javascript-ghcjs) ;; javascript-* | *-ghcjs) echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os-$obj in linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ | linux-mlibc*- | linux-musl*- | linux-newlib*- \ | linux-relibc*- | linux-uclibc*- | linux-ohos*- ) ;; uclinux-uclibc*- | uclinux-gnu*- ) ;; managarm-mlibc*- | managarm-kernel*- ) ;; windows*-msvc*-) ;; -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ | -uclibc*- ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 exit 1 ;; -kernel*- ) echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 exit 1 ;; *-kernel*- ) echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 exit 1 ;; *-msvc*- ) echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 exit 1 ;; kfreebsd*-gnu*- | knetbsd*-gnu*- | netbsd*-gnu*- | kopensolaris*-gnu*-) ;; vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) ;; nto-qnx*-) ;; os2-emx-) ;; rtmk-nova-) ;; *-eabi*- | *-gnueabi*-) ;; none--*) # None (no kernel, i.e. freestanding / bare metal), # can be paired with an machine code file format ;; -*-) # Blank kernel with real OS is always fine. ;; --*) # Blank kernel and OS with real machine code file format is always fine. ;; *-*-*) echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos* | *-solaris*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: lrzsz-0.13.1/Makefile.am0000664000175000017500000001107415257302265010511 SUBDIRS = src po man EXTRA_DIST = m4/ChangeLog check.lrzsz COMPATABILITY README.cvs README.isdn4linux \ README.tests remote-build-check.sh \ doc/README doc/zmodem-forsberg.txt doc/zmodem-zmtx-zmrx.txt doc/zmodem-wip.txt doc/zmodemsnif.txt PR=@DIST_TARBALL@ DISTCLEANFILES=fastcheck.done CLEANFILES=fastcheck.done ACLOCAL_AMFLAGS = -I m4 QUICKCHECKS=xmodem-lsz-lrz-16k-binary xmodem-lsz-lrz-large-binary-1k-crc zmodem-lsz-lrz-MGMT-default-nonexisting zmodem-lsz-lrz-MGMT-ZMCRC-r \ zmodem-lsz-lrz-multiple zmodem-lsz-lrz-4k zmodem-lsz-lrz-8k-turbo zmodem-lsz-lrz-MGMT-mode-0666 \ zmodem-lsz-lrz-MGMT-traversal-dotdot zmodem-lsz-lrz-RESUME-shrink # Note: the inofficial target is to compile on systems of up to 20 years of age. # We support one C standard older than that. # SUPPORTED_C_STANDARDS=@SUPPORTED_C_STDS@ SUPPORTED_COMPILERS=gcc clang buildcheck: for cc in $(SUPPORTED_COMPILERS) ; do if command -v "$$cc" >/dev/null ; then \ for std in $(SUPPORTED_C_STANDARDS) ; do \ echo "running clean/configure/make with CC=$$cc --enable-std=$$std"; \ make -s V=0 clean >/dev/null ; \ ./configure CC="$$cc" -q --enable-std=$$std || exit 1 ; \ make -s V=0 -j 4 || exit 1 ; \ done \ fi ; done ; \ make -s V=0 clean >/dev/null buildcheck+: for cc in $(SUPPORTED_COMPILERS) ; do if command -v "$$cc" >/dev/null ; then \ for std in $(SUPPORTED_C_STANDARDS) ; do \ echo "running clean/configure/make/vcheck with CC=$$cc --enable-std=$$std"; \ make -s V=0 clean >/dev/null ; \ ./configure CC="$$cc" -q --enable-std=$$std || exit 1 ; \ make -s V=0 -j 4 || exit 1 ; \ QUIET=1 make -s V=0 vcheck || exit 1 ; \ done \ fi ; done ; \ make -s V=0 clean >/dev/null ; # Remote build checks (gnulib cfg.mk convention): the host list lives in a # local, non-distributed cfg.mk, e.g.: # REMOTE_HOSTS = uwe@openbsd uwe@dev -include cfg.mk buildcheck-remote: dist @for h in $(REMOTE_HOSTS) ; do \ echo "remote buildcheck on $$h"; \ scp ./remote-build-check.sh $(PR).tar.gz "$$h": || exit 1; \ ssh "$$h" sh ./remote-build-check.sh $(PR) || exit 1; \ done .PHONY: buildcheck-remote oldcheck-local: QUIET=-q $(srcdir)/check.lrzsz $(srcdir) `pwd` quickcheck: $(srcdir)/check.lrzsz $(srcdir) `pwd` select $(QUICKCHECKS) vcheck: $(srcdir)/check.lrzsz $(srcdir) `pwd` vcheck-%: $(srcdir)/check.lrzsz $(srcdir) `pwd` $(subst vcheck-,,$@) vcheck-x: $(srcdir)/check.lrzsz $(srcdir) `pwd` x vcheck-y: $(srcdir)/check.lrzsz $(srcdir) `pwd` y vcheck-z: $(srcdir)/check.lrzsz $(srcdir) `pwd` z # need clang compiler options for clang-tidy. clangconfigure: CC=clang ./configure -q tidy: @$(MAKE) -C src tidy .PHONY: tiny # releasecheck runs about 2h. releasecheck: distclean clangconfigure all tidy maintainertools dist distcheck vcheck qa buildcheck+ buildcheck-remote fuzz1000 # need clang compiler options for clang-tidy. releasecheck1: distclean CC=clang ./configure -q @$(MAKE) maintainertools: @$(MAKE) -C src zmodemfuzz zmodemsnif timestamp linesimulator # zmodem protocol fuzzing: 25 iterations per mode (FUZZITER overrides), each # iteration is alarm limited (-t 20). # fails if the target crashes, is killed by a signal (!= timeout ALRM), # escapes the receiving directory, or transfers some wrong content. # -P prints one progress line per iteration. fuzz: @$(MAKE) -C src zmodemfuzz lrz lsz; \ $(srcdir)/src/zmodemfuzz -P -m receive -n $${FUZZITER:-25} -t 20 -- ./src/lrz -q -Z; \ $(srcdir)/src/zmodemfuzz -P -m send -n $${FUZZITER:-25} -t 20 -- ./src/lsz -q -Z ./test/4k.bin fuzz1000: @$(MAKE) -C src zmodemfuzz lrz lsz; \ $(srcdir)/src/zmodemfuzz -P -m receive -n 1000 -t 20 -- ./src/lrz -q -Z; \ $(srcdir)/src/zmodemfuzz -P -m send -n 1000 -t 20 -- ./src/lsz -q -Z ./test/4k.bin .PHONY: fuzz fuzz1000 qa: asan msan ubsan coverage .PHONY: $(SANITIZERS) qa coverage SANITIZERS = asan msan ubsan $(SANITIZERS): CC_LIST = clang gcc msan: CC_LIST = clang $(SANITIZERS): for i in $(CC_LIST) ; do if command -v "$$i" >/dev/null ; then \ echo "running clean/configure/vcheck with $$i --enable-$@"; \ make -s V=0 clean >/dev/null ; \ ./configure CC="$$i" -q --enable-$@ || exit 1 ; \ make -s V=0 -j 4 || exit 1 ; \ QUIET=1 make -s V=0 vcheck || exit 1 ; \ fi ; done coverage: coverage/coverage.html coverage/coverage.html: $(wildcard src/*.c src/*.h) mkdir coverage 2>/dev/null || exit 0 make -s V=0 clean ./configure --enable-coverage -q make -s V=0 -j 4 make -s V=0 vcheck if command -v "gcovr" >/dev/null; then gcovr --html-details --output coverage/coverage.html src/; else echo "gcovr not found, no coverage report"; fi ./configure -q make -s V=0 clean make -s V=0 -j 4 lrzsz-0.13.1/install-sh0000755000175000017500000003611515256501374010463 #!/bin/sh # install - install a program, script, or datafile scriptversion=2024-06-19.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Report bugs to . GNU Automake home page: . General help using GNU software: ." while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 (GNU Automake) $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibility with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: lrzsz-0.13.1/configure0000775000175000017500000135076215260417113010370 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.72 for lrzsz 0.13.1. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, # Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case e in #( e) case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ) then : else case e in #( e) exitcode=1; echo positional parameters were not saved. ;; esac fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else case e in #( e) as_have_required=no ;; esac fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else case e in #( e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$as_shell as_have_required=yes if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null then : break 2 fi fi done;; esac as_found=false done IFS=$as_save_IFS if $as_found then : else case e in #( e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes fi ;; esac fi if test "x$CONFIG_SHELL" != x then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno then : printf "%s\n" "$0: This script requires a shell more modern than all" printf "%s\n" "$0: the shells that I found on your system." if test ${ZSH_VERSION+y} ; then printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi ;; esac fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' t clear :clear s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='lrzsz' PACKAGE_TARNAME='lrzsz' PACKAGE_VERSION='0.13.1' PACKAGE_STRING='lrzsz 0.13.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="src/crctab.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_STDIO_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #ifdef HAVE_STRING_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_c_list= gt_needs= enable_year2038=no ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS localedir_c_make localedir_c POSUB LTLIBINTL LIBINTL INTLLIBS LTLIBICONV LIBICONV INTL_MACOSX_LIBS CPP host_os host_vendor host_cpu host build_os build_vendor build_cpu build XGETTEXT_EXTRA_OPTIONS MSGMERGE_FOR_MSGFMT_OPTION MSGMERGE XGETTEXT_015 XGETTEXT GMSGFMT_015 GMSGFMT MSGFMT GETTEXT_MACRO_VERSION USE_NLS LRZSZ_LDFLAGS LRZSZ_CFLAGS WARN_CFLAGS SED DIST_TARBALL SUPPORTED_C_STDS MIN_POSIX_C_STD am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__xargs_n am__rm_f_notfound AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V CSCOPE ETAGS CTAGS am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking enable_largefile enable_mkdir with_syslog_facility enable_std enable_asan enable_lsan enable_msan enable_ubsan enable_coverage enable_Werror enable_nls with_gnu_ld enable_rpath with_libiconv_prefix with_libintl_prefix enable_year2038 ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= 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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$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 ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=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 ;; -*) as_fn_error $? "unrecognized option: '$ac_option' Try '$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: '$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: '$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # 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 the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF 'configure' configures lrzsz 0.13.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print 'checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for '--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or '..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, 'make install' will install all the files in '$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify an installation prefix other than '$ac_default_prefix' using '--prefix', for instance '--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/lrzsz] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of lrzsz 0.13.1:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --disable-largefile omit support for large files --disable-mkdir disable support for creating directories (lrz) --enable-std=STD use a specific C std (c23 c17 c11 c99) --enable-asan enable the address sanitizer (if available) --enable-lsan enable the leak sanitizer (if available) --enable-msan enable the memory sanitizer (if available) --enable-ubsan enable the undefined behavior sanitizer (if available) --enable-coverage compile with coverage information --disable-Werror do not turn compiler warnings into errors --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --enable-year2038 support timestamps after 2038 Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-syslog-facility=FACILITY syslog facility (default: LOG_UUCP) --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by 'configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for configure.gnu first; this name is used for a wrapper for # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF lrzsz configure 0.13.1 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" else case e in #( e) eval "$3=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext } then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (void); below. */ #include #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (void); /* 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_$2 || defined __stub___$2 choke me #endif int main (void) { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" else case e in #( e) eval "$3=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err } then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that # executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status ;; esac fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run ac_configure_args_raw= for ac_arg do case $ac_arg in *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append ac_configure_args_raw " '$ac_arg'" done case $ac_configure_args_raw in *$as_nl*) ac_safe_unquote= ;; *) ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. ac_unsafe_a="$ac_unsafe_z#~" ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by lrzsz $as_me 0.13.1, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Sanitize IFS. IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && printf "%s\n" "$as_me: caught signal $ac_signal" printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi for ac_site_file in $ac_site_files do case $ac_site_file in #( */*) : ;; #( *) : ac_site_file=./$ac_site_file ;; esac if test -f "$ac_site_file" && test -r "$ac_site_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See 'config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" # Test code for whether the C compiler supports C89 (global declarations) ac_c_conftest_c89_globals=' /* Does the compiler advertise C89 conformance? Do not test the value of __STDC__, because some compilers set it to 0 while being otherwise adequately conformant. */ #if !defined __STDC__ # error "Compiler does not advertise C89 conformance" #endif #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (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; } /* C89 style stringification. */ #define noexpand_stringify(a) #a const char *stringified = noexpand_stringify(arbitrary+token=sequence); /* C89 style token pasting. Exercises some of the corner cases that e.g. old MSVC gets wrong, but not very hard. */ #define noexpand_concat(a,b) a##b #define expand_concat(a,b) noexpand_concat(a,b) extern int vA; extern int vbee; #define aye A #define bee B int *pvA = &expand_concat(v,aye); int *pvbee = &noexpand_concat(v,bee); /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated as an "x". The following induces an error, until -std is added to get proper ANSI mode. Curiously \x00 != x always comes out true, for an array size at least. It is necessary to write \x00 == 0 to get something that is true only with -std. */ int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) '\''x'\'' int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), int, int);' # Test code for whether the C compiler supports C89 (body of main). ac_c_conftest_c89_main=' ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); ' # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' /* Does the compiler advertise C99 conformance? */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif // See if C++-style comments work. #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); extern void free (void *); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare // FILE and stderr. #define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void test_varargs_macros (void) { int x = 1234; int y = 5678; debug ("Flag"); debug ("X = %d\n", x); showlist (The first, second, and third items.); report (x>y, "x is %d but y is %d", x, y); } // Check long long types. #define BIG64 18446744073709551615ull #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK #error "your preprocessor is broken" #endif #if BIG_OK #else #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; struct incomplete_array { int datasize; double data[]; }; struct named_init { int number; const wchar_t *name; double average; }; typedef const char *ccp; static inline int test_restrict (ccp restrict text) { // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. static bool test_varargs (const char *format, ...) { va_list args; va_start (args, format); va_list args_copy; va_copy (args_copy, args); const char *str = ""; int number = 0; float fnumber = 0; while (*format) { switch (*format++) { case '\''s'\'': // string str = va_arg (args_copy, const char *); break; case '\''d'\'': // int number = va_arg (args_copy, int); break; case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: break; } } va_end (args_copy); va_end (args); return *str && number && fnumber; } ' # Test code for whether the C compiler supports C99 (body of main). ac_c_conftest_c99_main=' // Check bool. _Bool success = false; success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) success = true; char *restrict newvar = "Another string"; // Check varargs. success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. struct incomplete_array *ia = malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; // Work around memory leak warnings. free (ia); // Check named initializers. struct named_init ni = { .number = 34, .name = L"Test wide string", .average = 543.34343, }; ni.number = 58; int dynamic_array[ni.number]; dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' || dynamic_array[ni.number - 1] != 543); ' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' /* Does the compiler advertise C11 conformance? */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif // Check _Alignas. char _Alignas (double) aligned_as_double; char _Alignas (0) no_special_alignment; extern char aligned_as_int; char _Alignas (0) _Alignas (int) aligned_as_int; // Check _Alignof. enum { int_alignment = _Alignof (int), int_array_alignment = _Alignof (int[100]), char_alignment = _Alignof (char) }; _Static_assert (0 < -_Alignof (int), "_Alignof is signed"); // Check _Noreturn. int _Noreturn does_not_return (void) { for (;;) continue; } // Check _Static_assert. struct test_static_assert { int x; _Static_assert (sizeof (int) <= sizeof (long int), "_Static_assert does not work in struct"); long int y; }; // Check UTF-8 literals. #define u8 syntax error! char const utf8_literal[] = u8"happens to be ASCII" "another string"; // Check duplicate typedefs. typedef long *long_ptr; typedef long int *long_ptr; typedef long_ptr long_ptr; // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. struct anonymous { union { struct { int i; int j; }; struct { int k; long int l; } w; }; int m; } v1; ' # Test code for whether the C compiler supports C11 (body of main). ac_c_conftest_c11_main=' _Static_assert ((offsetof (struct anonymous, i) == offsetof (struct anonymous, w.k)), "Anonymous union alignment botch"); v1.i = 2; v1.w.k = 5; ok |= v1.i != 5; ' # Test code for whether the C compiler supports C11 (complete). ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} ${ac_c_conftest_c11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} ${ac_c_conftest_c11_main} return ok; } " # Test code for whether the C compiler supports C99 (complete). ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} ${ac_c_conftest_c99_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} ${ac_c_conftest_c99_main} return ok; } " # Test code for whether the C compiler supports C89 (complete). ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} int main (int argc, char **argv) { int ok = 0; ${ac_c_conftest_c89_main} return ok; } " as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" gt_needs="$gt_needs " # Auxiliary files required by this configure script. ac_aux_files="config.guess config.sub config.rpath compile missing install-sh" # Locations in which to look for auxiliary files. ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." # Search for a directory containing all of the required auxiliary files, # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. # If we don't find one directory that contains all the files we need, # we report the set of missing files from the *first* directory in # $ac_aux_dir_candidates and give up. ac_missing_aux_files="" ac_first_candidate=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in $ac_aux_dir_candidates do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac as_found=: printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 ac_aux_dir_found=yes ac_install_sh= for ac_aux in $ac_aux_files do # As a special case, if "install-sh" is required, that requirement # can be satisfied by any of "install-sh", "install.sh", or "shtool", # and $ac_install_sh is set appropriately for whichever one is found. if test x"$ac_aux" = x"install-sh" then if test -f "${as_dir}install-sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 ac_install_sh="${as_dir}install-sh -c" elif test -f "${as_dir}install.sh"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 ac_install_sh="${as_dir}install.sh -c" elif test -f "${as_dir}shtool"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 ac_install_sh="${as_dir}shtool install -c" else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} install-sh" else break fi fi else if test -f "${as_dir}${ac_aux}"; then printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 else ac_aux_dir_found=no if $ac_first_candidate; then ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" else break fi fi fi done if test "$ac_aux_dir_found" = yes; then ac_aux_dir="$as_dir" break fi ac_first_candidate=false as_found=false done IFS=$as_save_IFS if $as_found then : else case e in #( e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; esac fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. if test -f "${ac_aux_dir}config.guess"; then ac_config_guess="$SHELL ${ac_aux_dir}config.guess" fi if test -f "${ac_aux_dir}config.sub"; then ac_config_sub="$SHELL ${ac_aux_dir}config.sub" fi if test -f "$ac_aux_dir/configure"; then ac_configure="$SHELL ${ac_aux_dir}configure" fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.17' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 else case e in #( e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac # Account for fact that we put trailing slashes in our PATH walk. case $as_dir in #(( ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir ;; esac fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether sleep supports fractional seconds" >&5 printf %s "checking whether sleep supports fractional seconds... " >&6; } if test ${am_cv_sleep_fractional_seconds+y} then : printf %s "(cached) " >&6 else case e in #( e) if sleep 0.001 2>/dev/null then : am_cv_sleep_fractional_seconds=yes else case e in #( e) am_cv_sleep_fractional_seconds=no ;; esac fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_sleep_fractional_seconds" >&5 printf "%s\n" "$am_cv_sleep_fractional_seconds" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking filesystem timestamp resolution" >&5 printf %s "checking filesystem timestamp resolution... " >&6; } if test ${am_cv_filesystem_timestamp_resolution+y} then : printf %s "(cached) " >&6 else case e in #( e) # Default to the worst case. am_cv_filesystem_timestamp_resolution=2 # Only try to go finer than 1 sec if sleep can do it. # Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, # - 1 sec is not much of a win compared to 2 sec, and # - it takes 2 seconds to perform the test whether 1 sec works. # # Instead, just use the default 2s on platforms that have 1s resolution, # accept the extra 1s delay when using $sleep in the Automake tests, in # exchange for not incurring the 2s delay for running the test for all # packages. # am_try_resolutions= if test "$am_cv_sleep_fractional_seconds" = yes; then # Even a millisecond often causes a bunch of false positives, # so just try a hundredth of a second. The time saved between .001 and # .01 is not terribly consequential. am_try_resolutions="0.01 0.1 $am_try_resolutions" fi # In order to catch current-generation FAT out, we must *modify* files # that already exist; the *creation* timestamp is finer. Use names # that make ls -t sort them differently when they have equal # timestamps than when they have distinct timestamps, keeping # in mind that ls -t prints the *newest* file first. rm -f conftest.ts? : > conftest.ts1 : > conftest.ts2 : > conftest.ts3 # Make sure ls -t actually works. Do 'set' in a subshell so we don't # clobber the current shell's arguments. (Outer-level square brackets # are removed by m4; they're present so that m4 does not expand # ; be careful, easy to get confused.) if ( set X `ls -t conftest.ts[12]` && { test "$*" != "X conftest.ts1 conftest.ts2" || test "$*" != "X conftest.ts2 conftest.ts1"; } ); then :; else # 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". printf "%s\n" ""Bad output from ls -t: \"`ls -t conftest.ts[12]`\""" >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "ls -t produces unexpected output. Make sure there is not a broken ls alias in your environment. See 'config.log' for more details" "$LINENO" 5; } fi for am_try_res in $am_try_resolutions; do # Any one fine-grained sleep might happen to cross the boundary # between two values of a coarser actual resolution, but if we do # two fine-grained sleeps in a row, at least one of them will fall # entirely within a coarse interval. echo alpha > conftest.ts1 sleep $am_try_res echo beta > conftest.ts2 sleep $am_try_res echo gamma > conftest.ts3 # We assume that 'ls -t' will make use of high-resolution # timestamps if the operating system supports them at all. if (set X `ls -t conftest.ts?` && test "$2" = conftest.ts3 && test "$3" = conftest.ts2 && test "$4" = conftest.ts1); then # # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, # because we don't need to test make. make_ok=true if test $am_try_res != 1; then # But if we've succeeded so far with a subsecond resolution, we # have one more thing to check: make. It can happen that # everything else supports the subsecond mtimes, but make doesn't; # notably on macOS, which ships make 3.81 from 2006 (the last one # released under GPLv2). https://bugs.gnu.org/68808 # # We test $MAKE if it is defined in the environment, else "make". # It might get overridden later, but our hope is that in practice # it does not matter: it is the system "make" which is (by far) # the most likely to be broken, whereas if the user overrides it, # probably they did so with a better, or at least not worse, make. # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html # # Create a Makefile (real tab character here): rm -f conftest.mk echo 'conftest.ts1: conftest.ts2' >conftest.mk echo ' touch conftest.ts2' >>conftest.mk # # Now, running # touch conftest.ts1; touch conftest.ts2; make # should touch ts1 because ts2 is newer. This could happen by luck, # but most often, it will fail if make's support is insufficient. So # test for several consecutive successes. # # (We reuse conftest.ts[12] because we still want to modify existing # files, not create new ones, per above.) n=0 make=${MAKE-make} until test $n -eq 3; do echo one > conftest.ts1 sleep $am_try_res echo two > conftest.ts2 # ts2 should now be newer than ts1 if $make -f conftest.mk | grep 'up to date' >/dev/null; then make_ok=false break # out of $n loop fi n=`expr $n + 1` done fi # if $make_ok; then # Everything we know to check worked out, so call this resolution good. am_cv_filesystem_timestamp_resolution=$am_try_res break # out of $am_try_res loop fi # Otherwise, we'll go on to check the next resolution. fi done rm -f conftest.ts? # (end _am_filesystem_timestamp_resolution) ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_filesystem_timestamp_resolution" >&5 printf "%s\n" "$am_cv_filesystem_timestamp_resolution" >&6; } # This check should not be cached, as it may vary across builds of # different projects. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # 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). am_build_env_is_sane=no am_has_slept=no rm -f conftest.file for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi test "$2" = conftest.file ); then am_build_env_is_sane=yes break fi # Just in case. sleep "$am_cv_filesystem_timestamp_resolution" am_has_slept=yes done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_build_env_is_sane" >&5 printf "%s\n" "$am_build_env_is_sane" >&6; } if test "$am_build_env_is_sane" = no; then as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1 then : else case e in #( e) ( sleep "$am_cv_filesystem_timestamp_resolution" ) & am_sleep_pid=$! ;; esac fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was 's,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_STRIP+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 printf "%s\n" "$STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_STRIP+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 printf "%s\n" "$ac_ct_STRIP" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test ${ac_cv_path_mkdir+y} then : printf %s "(cached) " >&6 else case e in #( e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir ('*'coreutils) '* | \ *'BusyBox '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS ;; esac fi test -d ./--version && rmdir ./--version if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use plain mkdir -p, # in the hope it doesn't have the bugs of ancient mkdir. MKDIR_P='mkdir -p' fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AWK+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 printf "%s\n" "$AWK" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 else case e in #( e) cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make ;; esac fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } SET_MAKE= else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AM_DEFAULT_VERBOSITY=1 # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi am_make=${MAKE-make} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 printf %s "checking whether $am_make supports nested variables... " >&6; } if test ${am_cv_make_support_nested_variables+y} then : printf %s "(cached) " >&6 else case e in #( e) if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } AM_BACKSLASH='\' am__rm_f_notfound= if (rm -f && rm -fr && rm -rf) 2>/dev/null then : else case e in #( e) am__rm_f_notfound='""' ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking xargs -n works" >&5 printf %s "checking xargs -n works... " >&6; } if test ${am_cv_xargs_n_works+y} then : printf %s "(cached) " >&6 else case e in #( e) if test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 3" then : am_cv_xargs_n_works=yes else case e in #( e) am_cv_xargs_n_works=no ;; esac fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_xargs_n_works" >&5 printf "%s\n" "$am_cv_xargs_n_works" >&6; } if test "$am_cv_xargs_n_works" = yes then : am__xargs_n='xargs -n' else case e in #( e) am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "" "$am__xargs_n_arg"; done; }' ;; esac fi if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='lrzsz' VERSION='0.13.1' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi if test -z "$ETAGS"; then ETAGS=etags fi if test -z "$CSCOPE"; then CSCOPE=cscope fi ac_config_headers="$ac_config_headers config.h" DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test ${enable_dependency_tracking+y} then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_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 $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See 'config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 printf %s "checking whether the C compiler works... " >&6; } ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. # So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an '-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else case e in #( e) ac_file='' ;; esac fi if test -z "$ac_file" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See 'config.log' for more details" "$LINENO" 5; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) # catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will # work properly (i.e., refer to 'conftest.exe'), while it won't with # 'rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else case e in #( e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See 'config.log' for more details" "$LINENO" 5; } ;; esac fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { FILE *f = fopen ("conftest.out", "w"); if (!f) return 1; return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use '--host'. See 'config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext \ conftest.o conftest.obj conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See 'config.log' for more details" "$LINENO" 5; } ;; esac fi rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else case e in #( e) ac_compiler_gnu=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else case e in #( e) CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else case e in #( e) ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; 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 ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 ;; esac fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 ;; esac fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 ;; esac fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thus: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_header= ac_cache= for ac_item in $ac_header_c_list do if test $ac_cache; then ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then printf "%s\n" "#define $ac_item 1" >> confdefs.h fi ac_header= ac_cache= elif test $ac_header; then ac_cache=$ac_item else ac_header=$ac_item fi done if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } if test ${ac_cv_safe_to_define___extensions__+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_safe_to_define___extensions__=yes else case e in #( e) ac_cv_safe_to_define___extensions__=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } if test ${ac_cv_should_define__xopen_source+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_should_define__xopen_source=no if test $ac_cv_header_wchar_h = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include mbstate_t x; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE 500 #include mbstate_t x; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_should_define__xopen_source=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h if test $ac_cv_header_minix_config_h = yes then : MINIX=yes printf "%s\n" "#define _MINIX 1" >>confdefs.h printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h else case e in #( e) MINIX= ;; esac fi if test $ac_cv_safe_to_define___extensions__ = yes then : printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h fi if test $ac_cv_should_define__xopen_source = yes then : printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h fi # Check whether --enable-largefile was given. if test ${enable_largefile+y} then : enableval=$enable_largefile; fi if test "$enable_largefile,$enable_year2038" != no,no then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CPPFLAGS option for large files" >&5 printf %s "checking for $CPPFLAGS option for large files... " >&6; } if test ${ac_cv_sys_largefile_opts+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_save_CPPFLAGS=$CPPFLAGS ac_opt_found=no for ac_opt in "none needed" "-D_FILE_OFFSET_BITS=64" "-D_LARGE_FILES=1"; do if test x"$ac_opt" != x"none needed" then : CPPFLAGS="$ac_save_CPPFLAGS $ac_opt" fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef FTYPE # define FTYPE off_t #endif /* Check that FTYPE can represent 2**63 - 1 correctly. We can't simply define LARGE_FTYPE to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31)) int FTYPE_is_large[(LARGE_FTYPE % 2147483629 == 721 && LARGE_FTYPE % 2147483647 == 1) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : if test x"$ac_opt" = x"none needed" then : # GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t. CPPFLAGS="$CPPFLAGS -DFTYPE=ino_t" if ac_fn_c_try_compile "$LINENO" then : else case e in #( e) CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" if ac_fn_c_try_compile "$LINENO" then : ac_opt='-D_FILE_OFFSET_BITS=64' fi rm -f core conftest.err conftest.$ac_objext conftest.beam ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam fi ac_cv_sys_largefile_opts=$ac_opt ac_opt_found=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test $ac_opt_found = no || break done CPPFLAGS=$ac_save_CPPFLAGS test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_opts" >&5 printf "%s\n" "$ac_cv_sys_largefile_opts" >&6; } ac_have_largefile=yes case $ac_cv_sys_largefile_opts in #( "none needed") : ;; #( "supported through gnulib") : ;; #( "support not detected") : ac_have_largefile=no ;; #( "-D_FILE_OFFSET_BITS=64") : printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h ;; #( "-D_LARGE_FILES=1") : printf "%s\n" "#define _LARGE_FILES 1" >>confdefs.h ;; #( *) : as_fn_error $? "internal error: bad value for \$ac_cv_sys_largefile_opts" "$LINENO" 5 ;; esac if test "$enable_year2038" != no then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CPPFLAGS option for timestamps after 2038" >&5 printf %s "checking for $CPPFLAGS option for timestamps after 2038... " >&6; } if test ${ac_cv_sys_year2038_opts+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_save_CPPFLAGS="$CPPFLAGS" ac_opt_found=no for ac_opt in "none needed" "-D_TIME_BITS=64" "-D__MINGW_USE_VC2005_COMPAT" "-U_USE_32_BIT_TIME_T -D__MINGW_USE_VC2005_COMPAT"; do if test x"$ac_opt" != x"none needed" then : CPPFLAGS="$ac_save_CPPFLAGS $ac_opt" fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that time_t can represent 2**32 - 1 correctly. */ #define LARGE_TIME_T \\ ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 && LARGE_TIME_T % 65537 == 0) ? 1 : -1]; int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_year2038_opts="$ac_opt" ac_opt_found=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test $ac_opt_found = no || break done CPPFLAGS="$ac_save_CPPFLAGS" test $ac_opt_found = yes || ac_cv_sys_year2038_opts="support not detected" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_year2038_opts" >&5 printf "%s\n" "$ac_cv_sys_year2038_opts" >&6; } ac_have_year2038=yes case $ac_cv_sys_year2038_opts in #( "none needed") : ;; #( "support not detected") : ac_have_year2038=no ;; #( "-D_TIME_BITS=64") : printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h ;; #( "-D__MINGW_USE_VC2005_COMPAT") : printf "%s\n" "#define __MINGW_USE_VC2005_COMPAT 1" >>confdefs.h ;; #( "-U_USE_32_BIT_TIME_T"*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "the 'time_t' type is currently forced to be 32-bit. It will stop working after mid-January 2038. Remove _USE_32BIT_TIME_T from the compiler flags. See 'config.log' for more details" "$LINENO" 5; } ;; #( *) : as_fn_error $? "internal error: bad value for \$ac_cv_sys_year2038_opts" "$LINENO" 5 ;; esac fi fi supported_c_stds="c23 c17 c11 c99" MIN_POSIX_C_STD="200809L" SUPPORTED_C_STDS="$supported_c_stds" DIST_TARBALL="$PACKAGE-$VERSION" # Check whether --enable-mkdir was given. if test ${enable_mkdir+y} then : enableval=$enable_mkdir; fi if test "x$enable_mkdir" != xno then : printf "%s\n" "#define ENABLE_MKDIR 1" >>confdefs.h fi # Check whether --with-syslog-facility was given. if test ${with_syslog_facility+y} then : withval=$with_syslog_facility; case $withval in #( yes|no|"") : syslog_facility=LOG_UUCP ;; #( *) : syslog_facility=$withval ;; esac else case e in #( e) syslog_facility=LOG_UUCP ;; esac fi printf "%s\n" "#define SYSLOG_FACILITY $syslog_facility" >>confdefs.h have_std= # Check whether --enable-std was given. if test ${enable_std+y} then : enableval=$enable_std; have_std=$enableval else case e in #( e) have_std="no" ;; esac fi # Check whether --enable-asan was given. if test ${enable_asan+y} then : enableval=$enable_asan; want_asan=$enableval else case e in #( e) want_asan="no" ;; esac fi # Check whether --enable-lsan was given. if test ${enable_lsan+y} then : enableval=$enable_lsan; want_lsan=$enableval else case e in #( e) want_lsan="no" ;; esac fi # Check whether --enable-msan was given. if test ${enable_msan+y} then : enableval=$enable_msan; want_msan=$enableval else case e in #( e) want_msan="no" ;; esac fi # Check whether --enable-ubsan was given. if test ${enable_ubsan+y} then : enableval=$enable_ubsan; want_ubsan=$enableval else case e in #( e) want_ubsan="no" ;; esac fi # Check whether --enable-coverage was given. if test ${enable_coverage+y} then : enableval=$enable_coverage; want_coverage=$enableval else case e in #( e) want_coverage="no" ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_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 $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. set dummy ${ac_tool_prefix}clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 printf "%s\n" "$CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "clang", so it can be a program name with args. set dummy clang; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="clang" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi ;; esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 printf "%s\n" "$ac_ct_CC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi fi test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See 'config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes else case e in #( e) ac_compiler_gnu=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes else case e in #( e) CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : else case e in #( e) ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } if test $ac_test_CFLAGS; 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 ac_prog_cc_stdc=no if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c11_program _ACEOF for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } CC="$CC $ac_cv_prog_cc_c11" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 ;; esac fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c99_program _ACEOF for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c99=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } CC="$CC $ac_cv_prog_cc_c99" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 ;; esac fi fi if test x$ac_prog_cc_stdc = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_c_conftest_c89_program _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC ;; esac fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else case e in #( e) if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } CC="$CC $ac_cv_prog_cc_c89" ;; esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 ;; esac fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 printf %s "checking whether $CC understands -c and -o together... " >&6; } if test ${am_cv_prog_cc_c_o+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 printf %s "checking dependency style of $depcc... " >&6; } if test ${am_cv_CC_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thus: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi case $enable_std in #( yes|no|"") : ;; #( *) : case " $supported_c_stds " in #( *" $enable_std "*) : ;; #( *) : as_fn_error $? "--enable-std=$enable_std: not supported (try: $supported_c_stds)" "$LINENO" 5 ;; esac as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__-std=$enable_std" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts -std=$enable_std" >&5 printf %s "checking whether the C compiler accepts -std=$enable_std... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS -std=$enable_std $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : have_std=$enable_std else case e in #( e) as_fn_error $? "--enable-std=$enable_std: not supported by $CC" "$LINENO" 5 ;; esac fi ;; esac for i in $supported_c_stds ; do if test "$have_std" = "no" ; then as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__-std=$i" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts -std=$i" >&5 printf %s "checking whether the C compiler accepts -std=$i... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS -std=$i $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : have_std=$i else case e in #( e) : ;; esac fi fi done if test "$have_std" != "no" ; then for flag in -std=$have_std; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi for flag in -g3; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done for flag in -D_FORTIFY_SOURCE=2; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done # Check whether --enable-Werror was given. if test ${enable_Werror+y} then : enableval=$enable_Werror; else case e in #( e) enable_Werror=yes ;; esac fi WARN_CFLAGS="" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 printf %s "checking for a sed that does not truncate output... " >&6; } if test ${ac_cv_path_SED+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in sed gsed do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in #( *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; #( *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 printf "%s\n" "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed if test "x$GCC" = "xyes" then : # Variable names ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus #error "no C++" #endif int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_compiler_cxx=yes; else case e in #( e) ax_compiler_cxx=no; ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Always pass -Werror=unknown-warning-option to get Clang to fail on bad # flags, otherwise they are always appended to the warn_cflags variable, and # Clang warns on them for every compilation unit. # If this is passed to GCC, it will explode, so the flag must be enabled # conditionally. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts -Werror=unknown-warning-option" >&5 printf %s "checking whether the C compiler accepts -Werror=unknown-warning-option... " >&6; } if test ${ax_cv_check_cflags___Werror_unknown_warning_option+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS -Werror=unknown-warning-option $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___Werror_unknown_warning_option=yes else case e in #( e) ax_cv_check_cflags___Werror_unknown_warning_option=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Werror_unknown_warning_option" >&5 printf "%s\n" "$ax_cv_check_cflags___Werror_unknown_warning_option" >&6; } if test "x$ax_cv_check_cflags___Werror_unknown_warning_option" = xyes then : ax_compiler_flags_test="-Werror=unknown-warning-option" else case e in #( e) ax_compiler_flags_test="" ;; esac fi # Check that -Wno-suggest-attribute=format is supported { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts -Wno-suggest-attribute=format" >&5 printf %s "checking whether the C compiler accepts -Wno-suggest-attribute=format... " >&6; } if test ${ax_cv_check_cflags___Wno_suggest_attribute_format+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS -Wno-suggest-attribute=format $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___Wno_suggest_attribute_format=yes else case e in #( e) ax_cv_check_cflags___Wno_suggest_attribute_format=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wno_suggest_attribute_format" >&5 printf "%s\n" "$ax_cv_check_cflags___Wno_suggest_attribute_format" >&6; } if test "x$ax_cv_check_cflags___Wno_suggest_attribute_format" = xyes then : ax_compiler_no_suggest_attribute_flags="-Wno-suggest-attribute=format" else case e in #( e) ax_compiler_no_suggest_attribute_flags="" ;; esac fi # Base flags for flag in -fno-strict-aliasing ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $ax_compiler_flags_test $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done if test "$ax_enable_compile_warnings" != "no" then : if test "$ax_compiler_cxx" = "no" ; then # C-only flags. Warn in C++ for flag in -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -Wdeclaration-after-statement -Wimplicit-function-declaration -Wold-style-definition -Wjump-misses-init ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $ax_compiler_flags_test $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi # "yes" flags for flag in -Wall -Wextra -Wundef -Wwrite-strings -Wpointer-arith -Wmissing-declarations -Wredundant-decls -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Winline -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wredundant-decls -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wreturn-type -Wswitch-enum -Wswitch-default -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -Wnull-dereference -Wdouble-promotion ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $ax_compiler_flags_test $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi if test "$ax_enable_compile_warnings" = "error" then : # "error" flags; -Werror has to be appended unconditionally because # it's not possible to test for # # suggest-attribute=format is disabled because it gives too many false # positives if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" -Werror "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains -Werror"; } >&5 (: WARN_CFLAGS already contains -Werror) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " -Werror" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=-Werror { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi for flag in $ax_compiler_no_suggest_attribute_flags ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $ax_compiler_flags_test $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi # In the flags below, when disabling specific flags, always add *both* # -Wno-foo and -Wno-error=foo. This fixes the situation where (for example) # we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall, # which effectively turns that flag back on again as an error. for flag in $WARN_CFLAGS; do case $flag in #( -Wno-*=*) : ;; #( -Wno-*) : for flag in -Wno-error=$(printf "%s\n" $flag | $SED 's/^-Wno-//'); do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags_$ax_compiler_flags_test_$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $ax_compiler_flags_test $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done ;; #( *) : ;; esac done ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Substitute the variables for flag in -Wunused-result -Wpedantic -Wcast-qual -Wmissing-braces -Wcomments -Wformat; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts -Wpre-c23-compat" >&5 printf %s "checking whether the C compiler accepts -Wpre-c23-compat... " >&6; } if test ${ax_cv_check_cflags___Wpre_c23_compat+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS -Wpre-c23-compat $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : ax_cv_check_cflags___Wpre_c23_compat=yes else case e in #( e) ax_cv_check_cflags___Wpre_c23_compat=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___Wpre_c23_compat" >&5 printf "%s\n" "$ax_cv_check_cflags___Wpre_c23_compat" >&6; } if test "x$ax_cv_check_cflags___Wpre_c23_compat" = xyes then : for flag in -Wno-pre-c23-compat; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done else case e in #( e) : ;; esac fi if test "x$enable_Werror" = xyes then : for flag in -Werror ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${WARN_CFLAGS+y} then : case " $WARN_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS already contains \$flag"; } >&5 (: WARN_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append WARN_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) WARN_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : WARN_CFLAGS=\"\$WARN_CFLAGS\""; } >&5 (: WARN_CFLAGS="$WARN_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi fi if test "$want_coverage" != "no" ; then for flag in --coverage ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done for flag in --coverage; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_LDFLAGS+y} then : case " $LRZSZ_LDFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS already contains \$flag"; } >&5 (: LRZSZ_LDFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_LDFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_LDFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi if test "$want_asan" != "no" ; then for flag in -fsanitize=address ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done for flag in -fsanitize=address ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_LDFLAGS+y} then : case " $LRZSZ_LDFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS already contains \$flag"; } >&5 (: LRZSZ_LDFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_LDFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_LDFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi if test "$want_lsan" != "no" ; then for flag in -fsanitize=leak ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done for flag in -fsanitize=leak ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_LDFLAGS+y} then : case " $LRZSZ_LDFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS already contains \$flag"; } >&5 (: LRZSZ_LDFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_LDFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_LDFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi if test "$want_msan" != "no" ; then for flag in -fsanitize=memory ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done for flag in -fsanitize=memory ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_LDFLAGS+y} then : case " $LRZSZ_LDFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS already contains \$flag"; } >&5 (: LRZSZ_LDFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_LDFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_LDFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done for flag in -U_FORTIFY_SOURCE ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi if test "$want_ubsan" != "no" ; then for flag in -fsanitize=undefined ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done for flag in -fsanitize=undefined ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_LDFLAGS+y} then : case " $LRZSZ_LDFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS already contains \$flag"; } >&5 (: LRZSZ_LDFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_LDFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_LDFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_LDFLAGS=\"\$LRZSZ_LDFLAGS\""; } >&5 (: LRZSZ_LDFLAGS="$LRZSZ_LDFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi # coverage and the sanitizers instrument every operation, which inflates # inline function bodies past gcc's inline budget (--param # max-inline-insns-single); gcc then refuses to inline functions declared # inline, and -Winline turns that into an error under -Werror. Keep # -Werror strict for everything else in plain builds. LRZSZ_CFLAGS is # appended after WARN_CFLAGS in AM_CFLAGS, so this overrides -Werror. if test "$want_coverage" != "no" -o "$want_asan" != "no" \ -o "$want_lsan" != "no" -o "$want_msan" != "no" \ -o "$want_ubsan" != "no" ; then for flag in -Wno-error=inline ; do as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$flag" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler accepts $flag" >&5 printf %s "checking whether the C compiler accepts $flag... " >&6; } if eval test \${$as_CACHEVAR+y} then : printf %s "(cached) " >&6 else case e in #( e) ax_check_save_flags=$CFLAGS if test x"$GCC" = xyes ; then add_gnu_werror="-Werror" fi CFLAGS="$CFLAGS $flag $add_gnu_werror" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_CACHEVAR=yes" else case e in #( e) eval "$as_CACHEVAR=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags ;; esac fi eval ac_res=\$$as_CACHEVAR { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_CACHEVAR"\" = x"yes" then : if test ${LRZSZ_CFLAGS+y} then : case " $LRZSZ_CFLAGS " in #( *" $flag "*) : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS already contains \$flag"; } >&5 (: LRZSZ_CFLAGS already contains $flag) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; #( *) : as_fn_append LRZSZ_CFLAGS " $flag" { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac else case e in #( e) LRZSZ_CFLAGS=$flag { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : LRZSZ_CFLAGS=\"\$LRZSZ_CFLAGS\""; } >&5 (: LRZSZ_CFLAGS="$LRZSZ_CFLAGS") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } ;; esac fi else case e in #( e) : ;; esac fi done fi ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" if test "x$ac_cv_func_getopt_long" = xyes then : printf "%s\n" "#define HAVE_GETOPT_LONG 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for O_NOFOLLOW" >&5 printf %s "checking for O_NOFOLLOW... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { int x = O_NOFOLLOW; return x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : printf "%s\n" "#define HAVE_O_NOFOLLOW 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else case e in #( e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 printf %s "checking whether NLS is requested... " >&6; } # Check whether --enable-nls was given. if test ${enable_nls+y} then : enableval=$enable_nls; USE_NLS=$enableval else case e in #( e) USE_NLS=yes ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 printf "%s\n" "$USE_NLS" >&6; } GETTEXT_MACRO_VERSION=0.22 # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_MSGFMT+y} then : printf %s "(cached) " >&6 else case e in #( e) case "$MSGFMT" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) gt_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$gt_saved_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$gt_saved_IFS" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" ;; esac ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 printf "%s\n" "$MSGFMT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_GMSGFMT+y} then : printf %s "(cached) " >&6 else case e in #( e) case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_path_GMSGFMT="$as_dir$ac_word$ac_exec_ext" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 printf "%s\n" "$GMSGFMT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; *) GMSGFMT_015=$GMSGFMT ;; esac # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_XGETTEXT+y} then : printf %s "(cached) " >&6 else case e in #( e) case "$XGETTEXT" in [\\/]* | ?:[\\/]*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) gt_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$gt_saved_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$gt_saved_IFS" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 printf "%s\n" "$XGETTEXT" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi rm -f messages.po case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; *) XGETTEXT_015=$XGETTEXT ;; esac # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_path_MSGMERGE+y} then : printf %s "(cached) " >&6 else case e in #( e) case "$MSGMERGE" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; *) gt_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$gt_saved_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$gt_saved_IFS" test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" ;; esac ;; esac fi MSGMERGE="$ac_cv_path_MSGMERGE" if test "$MSGMERGE" != ":"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 printf "%s\n" "$MSGMERGE" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt' else if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet' else MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet' fi fi test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= ac_config_commands="$ac_config_commands po-directories" if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_saved_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_saved_prefix" # Make sure we can run config.sub. $SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 else case e in #( e) ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 else case e in #( e) if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # Check whether --with-gnu-ld was given. if test ${with_gnu_ld+y} then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else case e in #( e) with_gnu_ld=no ;; esac fi # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which # contains only /bin. Note that ksh looks also at the FPATH variable, # so we have to set that as well for the test. PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ || PATH_SEPARATOR=';' } fi if test -n "$LD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 printf %s "checking for ld... " >&6; } elif test "$GCC" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } elif test "$with_gnu_ld" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 printf %s "checking for GNU ld... " >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 printf %s "checking for non-GNU ld... " >&6; } fi if test -n "$LD"; then # Let the user override the test with a path. : else if test ${acl_cv_path_LD+y} then : printf %s "(cached) " >&6 else case e in #( e) acl_cv_path_LD= # Final result of this test ac_prog=ld # Program to search in $PATH if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. case $host in *-*-mingw* | windows*) # gcc leaves a trailing carriage return which upsets mingw acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) acl_output=`($CC -print-prog-name=ld) 2>&5` ;; esac case $acl_output in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` done # Got the pathname. No search in PATH is needed. acl_cv_path_LD="$acl_output" ac_prog= ;; "") # If it fails, then pretend we aren't using GCC. ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac fi if test -n "$ac_prog"; then # Search for $ac_prog in $PATH. acl_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$acl_saved_IFS" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 conftest.$ac_ext /* end confdefs.h. */ #if defined __powerpc64__ || defined __LP64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : # The compiler produces 64-bit code. Add option '-b64' so that the # linker groks 64-bit object files. case "$acl_cv_path_LD " in *" -b64 "*) ;; *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; sparc64-*-netbsd*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __sparcv9 || defined __arch64__ int ok; #else error fail #endif _ACEOF if ac_fn_c_try_compile "$LINENO" then : else case e in #( e) # The compiler produces 32-bit code. Add option '-m elf32_sparc' # so that the linker groks 32-bit object files. case "$acl_cv_path_LD " in *" -m elf32_sparc "*) ;; *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; esac ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac ;; esac fi LD="$acl_cv_path_LD" fi if test -n "$LD"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 printf %s "checking if the linker ($LD) is GNU ld... " >&6; } if test ${acl_cv_prog_gnu_ld+y} then : printf %s "(cached) " >&6 else case e in #( e) # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 printf "%s\n" "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 printf %s "checking for shared library run path origin... " >&6; } if test ${acl_cv_rpath+y} then : printf %s "(cached) " >&6 else case e in #( e) CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 printf "%s\n" "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test ${enable_rpath+y} then : enableval=$enable_rpath; : else case e in #( e) enable_rpath=yes ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking 32-bit host C ABI" >&5 printf %s "checking 32-bit host C ABI... " >&6; } if test ${gl_cv_host_cpu_c_abi_32bit+y} then : printf %s "(cached) " >&6 else case e in #( e) case "$host_cpu" in # CPUs that only support a 32-bit ABI. arc \ | bfin \ | cris* \ | csky \ | epiphany \ | ft32 \ | h8300 \ | m68k \ | microblaze | microblazeel \ | nds32 | nds32le | nds32be \ | nios2 | nios2eb | nios2el \ | or1k* \ | or32 \ | sh | sh1234 | sh1234elb \ | tic6x \ | xtensa* ) gl_cv_host_cpu_c_abi_32bit=yes ;; # CPUs that only support a 64-bit ABI. alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ | mmix ) gl_cv_host_cpu_c_abi_32bit=no ;; *) if test -n "$gl_cv_host_cpu_c_abi"; then case "$gl_cv_host_cpu_c_abi" in i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) gl_cv_host_cpu_c_abi_32bit=yes ;; x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) gl_cv_host_cpu_c_abi_32bit=no ;; *) gl_cv_host_cpu_c_abi_32bit=unknown ;; esac else gl_cv_host_cpu_c_abi_32bit=unknown fi if test $gl_cv_host_cpu_c_abi_32bit = unknown; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int test_pointer_size[sizeof (void *) - 5]; _ACEOF if ac_fn_c_try_compile "$LINENO" then : gl_cv_host_cpu_c_abi_32bit=no else case e in #( e) gl_cv_host_cpu_c_abi_32bit=yes ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi ;; esac ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi_32bit" >&5 printf "%s\n" "$gl_cv_host_cpu_c_abi_32bit" >&6; } HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 printf %s "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 else case e in #( e) # Double quotes because $CC needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else case e in #( e) # Broken: fails on valid input. continue ;; esac fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else case e in #( e) # Passes both tests. ac_preproc_ok=: break ;; esac fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : break fi done ac_cv_prog_CPP=$CPP ;; esac fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 printf "%s\n" "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO" then : else case e in #( e) # Broken: fails on valid input. continue ;; esac fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO" then : # Broken: success on invalid input. continue else case e in #( e) # Passes both tests. ac_preproc_ok=: break ;; esac fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok then : else case e in #( e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See 'config.log' for more details" "$LINENO" 5; } ;; esac fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep -e" >&5 printf %s "checking for egrep -e... " >&6; } if test ${ac_cv_path_EGREP_TRADITIONAL+y} then : printf %s "(cached) " >&6 else case e in #( e) if test -z "$EGREP_TRADITIONAL"; then ac_path_EGREP_TRADITIONAL_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in grep ggrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue # Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. # Check for GNU $ac_path_EGREP_TRADITIONAL case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( *GNU*) ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;; #( *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl" "$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_TRADITIONAL_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then : fi else ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL fi if test "$ac_cv_path_EGREP_TRADITIONAL" then : ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E" else case e in #( e) if test -z "$EGREP_TRADITIONAL"; then ac_path_EGREP_TRADITIONAL_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac for ac_prog in egrep do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue # Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. # Check for GNU $ac_path_EGREP_TRADITIONAL case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( *GNU*) ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;; #( *) ac_count=0 printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl" "$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_TRADITIONAL_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL fi ;; esac fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5 printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; } EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ELF binary format" >&5 printf %s "checking for ELF binary format... " >&6; } if test ${gl_cv_elf+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined __ELF__ || (defined __linux__ && (defined __EDG__ || defined __SUNPRO_C)) Extensible Linking Format #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP_TRADITIONAL "Extensible Linking Format" >/dev/null 2>&1 then : gl_cv_elf=yes else case e in #( e) gl_cv_elf=no ;; esac fi rm -rf conftest* ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_elf" >&5 printf "%s\n" "$gl_cv_elf" >&6; } if test $gl_cv_elf = yes; then # Extract the ELF class of a file (5th byte) in decimal. # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header if od -A x < /dev/null >/dev/null 2>/dev/null; then # Use POSIX od. func_elfclass () { od -A n -t d1 -j 4 -N 1 } else # Use BSD hexdump. func_elfclass () { dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' echo } fi # Use 'expr', not 'test', to compare the values of func_elfclass, because on # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, # not 1 or 2. case $HOST_CPU_C_ABI_32BIT in yes) # 32-bit ABI. acl_is_expected_elfclass () { expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null } ;; no) # 64-bit ABI. acl_is_expected_elfclass () { expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null } ;; *) # Unknown. acl_is_expected_elfclass () { : } ;; esac else acl_is_expected_elfclass () { : } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 printf %s "checking for the common suffixes of directories in the library search path... " >&6; } if test ${acl_cv_libdirstems+y} then : printf %s "(cached) " >&6 else case e in #( e) acl_libdirstem=lib acl_libdirstem2= acl_libdirstem3= case "$host_os" in solaris*) if test $HOST_CPU_C_ABI_32BIT = no; then acl_libdirstem2=lib/64 case "$host_cpu" in sparc*) acl_libdirstem3=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; esac fi ;; netbsd*) if test $HOST_CPU_C_ABI_32BIT != no; then case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparc ;; esac fi ;; *) searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test $HOST_CPU_C_ABI_32BIT != no; then # 32-bit or unknown ABI. if test -d /usr/lib32; then acl_libdirstem2=lib32 fi fi if test $HOST_CPU_C_ABI_32BIT != yes; then # 64-bit or unknown ABI. if test -d /usr/lib64; then acl_libdirstem3=lib64 fi fi if test -n "$searchpath"; then acl_saved_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib32 ) acl_libdirstem2=lib32 ;; */lib64 ) acl_libdirstem3=lib64 ;; esac ;; esac fi done IFS="$acl_saved_IFS" if test $HOST_CPU_C_ABI_32BIT = yes; then # 32-bit ABI. acl_libdirstem3= fi if test $HOST_CPU_C_ABI_32BIT = no; then # 64-bit ABI. acl_libdirstem2= fi fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 printf "%s\n" "$acl_cv_libdirstems" >&6; } acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` use_additional=yes acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" # Check whether --with-libiconv-prefix was given. if test ${with_libiconv_prefix+y} then : withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" additional_libdir2="$withval/$acl_libdirstem2" additional_libdir3="$withval/$acl_libdirstem3" fi fi fi if test "X$additional_libdir2" = "X$additional_libdir"; then additional_libdir2= fi if test "X$additional_libdir3" = "X$additional_libdir"; then additional_libdir3= fi LIBICONV= LTLIBICONV= INCICONV= LIBICONV_PREFIX= HAVE_LIBICONV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='iconv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do if test "X$found_dir" = "X"; then eval dir=\$$additional_libdir_variable if test -n "$dir"; then if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi fi done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBICONV; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" else LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem3 | */$acl_libdirstem3/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCICONV; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then saved_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$saved_libdir" for dep in $dependency_libs; do case "$dep" in -L*) dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBICONV; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBICONV; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$dependency_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dep=`echo "X$dep" | sed -e 's/^X-l//'` if test "X$dep" != Xc \ || case $host_os in linux* | gnu* | k*bsd*-gnu) false ;; *) true ;; esac; then names_next_round="$names_next_round $dep" fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" ;; esac done fi else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_saved_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_saved_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_saved_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_saved_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done fi gl_sed_double_backslashes='s/\\/\\\\/g' gl_sed_escape_doublequotes='s/"/\\"/g' gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" gl_sed_escape_for_make_2='s,\$,\\$$,g' case `echo r | tr -d '\r'` in '') gl_tr_cr='\015' ;; *) gl_tr_cr='\r' ;; esac gl_saved_prefix="${prefix}" gl_saved_datarootdir="${datarootdir}" gl_saved_localedir="${localedir}" if test "X$prefix" = "XNONE"; then prefix="$ac_default_prefix" fi eval datarootdir="$datarootdir" eval localedir="$localedir" gl_final_localedir="$localedir" case "$build_os" in cygwin*) case "$host_os" in mingw* | windows*) gl_final_localedir=`cygpath -w "$gl_final_localedir"` ;; esac ;; esac localedir_c=`printf '%s\n' "$gl_final_localedir" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"` localedir_c='"'"$localedir_c"'"' localedir_c_make=`printf '%s\n' "$localedir_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2" | tr -d "$gl_tr_cr"` if test "$localedir_c_make" = '\"'"${gl_final_localedir}"'\"'; then localedir_c_make='\"$(localedir)\"' fi localedir="${gl_saved_localedir}" datarootdir="${gl_saved_datarootdir}" prefix="${gl_saved_prefix}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 printf %s "checking for CFPreferencesCopyAppValue... " >&6; } if test ${gt_cv_func_CFPreferencesCopyAppValue+y} then : printf %s "(cached) " >&6 else case e in #( e) gt_saved_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gt_cv_func_CFPreferencesCopyAppValue=yes else case e in #( e) gt_cv_func_CFPreferencesCopyAppValue=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_saved_LIBS" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 printf "%s\n" "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then printf "%s\n" "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyPreferredLanguages" >&5 printf %s "checking for CFLocaleCopyPreferredLanguages... " >&6; } if test ${gt_cv_func_CFLocaleCopyPreferredLanguages+y} then : printf %s "(cached) " >&6 else case e in #( e) gt_saved_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { CFLocaleCopyPreferredLanguages(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : gt_cv_func_CFLocaleCopyPreferredLanguages=yes else case e in #( e) gt_cv_func_CFLocaleCopyPreferredLanguages=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_saved_LIBS" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyPreferredLanguages" >&5 printf "%s\n" "$gt_cv_func_CFLocaleCopyPreferredLanguages" >&6; } if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then printf "%s\n" "#define HAVE_CFLOCALECOPYPREFERREDLANGUAGES 1" >>confdefs.h fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices" fi LIBINTL= LTLIBINTL= POSUB= case " $gt_needs " in *" need-formatstring-macros "*) gt_api_version=3 ;; *" need-ngettext "*) gt_api_version=2 ;; *) gt_api_version=1 ;; esac gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no if test $gt_api_version -ge 3; then gt_revision_test_code=' #ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; ' else gt_revision_test_code= fi if test $gt_api_version -ge 2; then gt_expression_test_code=' + * ngettext ("", "", 0)' else gt_expression_test_code= fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 printf %s "checking for GNU gettext in libc... " >&6; } if eval test \${$gt_func_gnugettext_libc+y} then : printf %s "(cached) " >&6 else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) #else #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 #endif $gt_revision_test_code int main (void) { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$gt_func_gnugettext_libc=yes" else case e in #( e) eval "$gt_func_gnugettext_libc=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi eval ac_res=\$$gt_func_gnugettext_libc { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then gl_saved_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 printf %s "checking for iconv... " >&6; } if test ${am_cv_func_iconv+y} then : printf %s "(cached) " >&6 else case e in #( e) am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then gl_saved_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main (void) { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$gl_saved_LIBS" fi ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 printf "%s\n" "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 printf %s "checking for working iconv... " >&6; } if test ${am_cv_func_iconv_works+y} then : printf %s "(cached) " >&6 else case e in #( e) gl_saved_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi am_cv_func_iconv_works=no for ac_iconv_const in '' 'const'; do if test "$cross_compiling" = yes then : case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef ICONV_CONST # define ICONV_CONST $ac_iconv_const #endif int main (void) { int result = 0; /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from successful returns. This is even documented in */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; iconv_close (cd_utf8_to_88591); } } /* Test against macOS 14.4 bug: Failures are not distinguishable from successful returns. POSIX:2018 says: "The iconv() function shall ... return the number of non-identical conversions performed." But here, the conversion always does transliteration (the suffixes "//TRANSLIT" and "//IGNORE" have no effect, nor does iconvctl()) and does not report when it does a non-identical conversion. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\305\202"; /* LATIN SMALL LETTER L WITH STROKE */ char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); /* Here: With glibc, GNU libiconv (including macOS up to 13): res == (size_t)-1, errno == EILSEQ. With musl libc, NetBSD 10, Solaris 11: res == 1. With macOS 14.4: res == 0, output is "l". */ if (res == 0) result |= 2; iconv_close (cd_utf8_to_88591); } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\263"; char buf[10]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 4; iconv_close (cd_ascii_to_88591); } } /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ { iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 8; iconv_close (cd_88591_to_utf8); } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 16; iconv_close (cd_88591_to_utf8); } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ { /* Try standardized names. */ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); /* Try IRIX, OSF/1 names. */ iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); /* Try AIX names. */ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); /* Try HP-UX names. */ iconv_t cd4 = iconv_open ("utf8", "eucJP"); if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) result |= 32; if (cd1 != (iconv_t)(-1)) iconv_close (cd1); if (cd2 != (iconv_t)(-1)) iconv_close (cd2); if (cd3 != (iconv_t)(-1)) iconv_close (cd3); if (cd4 != (iconv_t)(-1)) iconv_close (cd4); } return result; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO" then : am_cv_func_iconv_works=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi test "$am_cv_func_iconv_works" = no || break done LIBS="$gl_saved_LIBS" ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 printf "%s\n" "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 printf %s "checking how to link with libiconv... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 printf "%s\n" "$LIBICONV" >&6; } else CPPFLAGS="$gl_saved_CPPFLAGS" LIBICONV= LTLIBICONV= fi use_additional=yes acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" # Check whether --with-libintl-prefix was given. if test ${with_libintl_prefix+y} then : withval=$with_libintl_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" additional_libdir2="$withval/$acl_libdirstem2" additional_libdir3="$withval/$acl_libdirstem3" fi fi fi if test "X$additional_libdir2" = "X$additional_libdir"; then additional_libdir2= fi if test "X$additional_libdir3" = "X$additional_libdir"; then additional_libdir3= fi LIBINTL= LTLIBINTL= INCINTL= LIBINTL_PREFIX= HAVE_LIBINTL= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='intl ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do if test "X$found_dir" = "X"; then eval dir=\$$additional_libdir_variable if test -n "$dir"; then if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi fi done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBINTL; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBINTL; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" else LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'intl'; then LIBINTL_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'intl'; then LIBINTL_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem3 | */$acl_libdirstem3/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` if test "$name" = 'intl'; then LIBINTL_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCINTL; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then saved_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$saved_libdir" for dep in $dependency_libs; do case "$dep" in -L*) dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBINTL; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBINTL; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$dependency_libdir"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$dependency_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) dep=`echo "X$dep" | sed -e 's/^X-l//'` if test "X$dep" != Xc \ || case $host_os in linux* | gnu* | k*bsd*-gnu) false ;; *) true ;; esac; then names_next_round="$names_next_round $dep" fi ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" ;; esac done fi else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_saved_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_saved_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" else for found_dir in $rpathdirs; do acl_saved_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_saved_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 printf %s "checking for GNU gettext in libintl... " >&6; } if eval test \${$gt_func_gnugettext_libintl+y} then : printf %s "(cached) " >&6 else case e in #( e) gt_saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_saved_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) #else #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 #endif $gt_revision_test_code int main (void) { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$gt_func_gnugettext_libintl=yes" else case e in #( e) eval "$gt_func_gnugettext_libintl=no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext gt_LIBINTL_EXTRA="$INTL_MACOSX_LIBS" case "$host_os" in aix*) gt_LIBINTL_EXTRA="-lpthread" ;; esac if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } \ && { test -n "$LIBICONV" || test -n "$gt_LIBINTL_EXTRA"; }; then LIBS="$LIBS $LIBICONV $gt_LIBINTL_EXTRA" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef __GNU_GETTEXT_SUPPORTED_REVISION extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); #define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) #else #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 #endif $gt_revision_test_code int main (void) { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : LIBINTL="$LIBINTL $LIBICONV $gt_LIBINTL_EXTRA" LTLIBINTL="$LTLIBINTL $LTLIBICONV $gt_LIBINTL_EXTRA" eval "$gt_func_gnugettext_libintl=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$gt_saved_CPPFLAGS" LIBS="$gt_saved_LIBS" ;; esac fi eval ac_res=\$$gt_func_gnugettext_libintl { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } fi if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools \ && test "$PACKAGE" != libintl; }; then gt_use_preinstalled_gnugettext=yes else LIBINTL= LTLIBINTL= INCINTL= fi if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then printf "%s\n" "#define ENABLE_NLS 1" >>confdefs.h else USE_NLS=no fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 printf %s "checking whether to use NLS... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 printf "%s\n" "$USE_NLS" >&6; } if test "$USE_NLS" = "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 printf %s "checking where the gettext function comes from... " >&6; } if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 printf "%s\n" "$gt_source" >&6; } fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 printf %s "checking how to link with libintl... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 printf "%s\n" "$LIBINTL" >&6; } for element in $INCINTL; do haveit= for x in $CPPFLAGS; do acl_saved_prefix="$prefix" prefix="$acl_final_prefix" acl_saved_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_saved_exec_prefix" prefix="$acl_saved_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done fi printf "%s\n" "#define HAVE_GETTEXT 1" >>confdefs.h printf "%s\n" "#define HAVE_DCGETTEXT 1" >>confdefs.h fi POSUB=po fi INTLLIBS="$LIBINTL" ac_config_files="$ac_config_files Makefile man/Makefile po/Makefile.in src/Makefile Specfile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # 'ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* 'ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # 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. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # 'set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # 'set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 printf "%s\n" "done" >&6; } case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; esac if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi # Check whether --enable-year2038 was given. if test ${enable_year2038+y} then : enableval=$enable_year2038; fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case e in #( e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac ;; esac fi # Reset variables that may have inherited troublesome values from # the environment. # IFS needs to be set, to space, tab, and newline, in precisely that order. # (If _AS_PATH_WALK were called with IFS unset, it would have the # side effect of setting IFS to empty, thus disabling word splitting.) # Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl IFS=" "" $as_nl" PS1='$ ' PS2='> ' PS4='+ ' # Ensure predictable behavior from utilities with locale-dependent output. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # We cannot yet rely on "unset" to work, but we need these variables # to be unset--not just set to an empty or harmless value--now, to # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct # also avoids known problems related to "unset" and subshell syntax # in other old shells (e.g. bash 2.01 and pdksh 5.2.14). for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH do eval test \${$as_var+y} \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done # Ensure that fds 0, 1, and 2 are open. if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( '') as_dir=./ ;; */) ;; *) as_dir=$as_dir/ ;; esac test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null then : eval 'as_fn_append () { eval $1+=\$2 }' else case e in #( e) as_fn_append () { eval $1=\$$1\$2 } ;; esac fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null then : eval 'as_fn_arith () { as_val=$(( $* )) }' else case e in #( e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } ;; esac fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # Determine whether it's possible to make 'echo' print without a newline. # These variables are no longer used directly by Autoconf, but are AC_SUBSTed # for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac # For backward compatibility with old third-party macros, we provide # the shell variables $as_echo and $as_echo_n. New code should use # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. as_echo='printf %s\n' as_echo_n='printf %s' rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" as_tr_sh="eval sed '$as_sed_sh'" # deprecated exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by lrzsz $as_me 0.13.1, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ '$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ lrzsz config.status 0.13.1 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" Copyright (C) 2023 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: '$1' Try '$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: '$1' Try '$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX printf "%s\n" "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS" # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "Specfile") CONFIG_FILES="$CONFIG_FILES Specfile" ;; *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to '$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with './config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with './config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script 'defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #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. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain ':'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is 'configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when '$srcdir' = '.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&5 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See 'config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "po-directories":C) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" gt_tab=`printf '\t'` cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*) useit=yes ;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi lrzsz-0.13.1/check.lrzsz0000775000175000017500000026061515260222634010645 #! /bin/sh testdir=$(pwd)/"test" 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 echo checking with srcdir = $1 and objdir = $2 rm -rf "$testdir" || exit 1 mkdir "$testdir" || exit 1 cd "$testdir" || exit 1 exec 5>$testdir/error.log (mkfifo $testdir/pipe || mknod $testdir/pipe p) 2>&5 selectedtests= if test "x$3" = x ; then mode=all else mode=$3 if test "$mode" = "select" ; then mode=all shift shift shift for i in "$@" ; do selectedtests="$selectedtests $i"; done fi fi ECHO=echo if test -n "$QUIET" ; then ECHO=":" fi SZ="$objdir/src/lsz" RZ="$objdir/src/lrz" SNIF="$objdir/src/zmodemsnif" SIMU="$objdir/src/linesimulator" TIMESTAMP="$objdir/src/timestamp" runlog=$testdir/run.log LRZSZ_JOURNAL=$testdir/journal.log export LRZSZ_JOURNAL TRACEFILE_SZ=$testdir/trace-sz.txt TRACEFILE_RZ=$testdir/trace-rz.txt binary_1m=$(find /usr/bin/ /usr/lib -size +1100000c -a -size -5000000c |xargs ls -S1 | tail -n1) dd if="$binary_1m" of="$testdir/binary_1m" bs=1024 count=1024 2>&5 binary_1m="$testdir/binary_1m" binary_2m=$testdir/2m.bin for i in $(seq 0 1) ; do cat $binary_1m >>$binary_2m done binary_4m=$testdir/4m.bin for i in $(seq 0 3) ; do cat $binary_1m >>$binary_4m done binary_8m=$testdir/8m.bin for i in $(seq 0 7) ; do cat $binary_1m >>$binary_8m done binary_16m=$testdir/16m.bin for i in $(seq 0 15) ; do cat $binary_1m >>$binary_16m done # special files to test x/y binary transfers all_256_file=$testdir/all256.bin for i in $(seq 0 255); do printf "\\$(printf '%03o' "$i")"; done > $all_256_file binary_512k=$testdir/512k.bin dd if="$binary_1m" of="$binary_512k" bs=1024 count=512 2>&5 dd if="$all_256_file" of="$binary_512k" bs=1 seek=8192 conv=notrunc 2>&5 binary_256k=$testdir/256k.bin dd if="$binary_1m" of="$binary_256k" bs=1024 count=256 2>&5 dd if="$all_256_file" of="$binary_256k" bs=1 seek=8192 conv=notrunc 2>&5 binary_128k=$testdir/128k.bin dd if="$binary_1m" of="$binary_128k" bs=1024 count=128 2>&5 dd if="$all_256_file" of="$binary_128k" bs=1 seek=8192 conv=notrunc 2>&5 binary_64k=$testdir/64k.bin dd if="$binary_1m" of="$binary_64k" bs=1024 count=64 2>&5 dd if="$all_256_file" of="$binary_64k" bs=1 seek=8192 conv=notrunc 2>&5 binary_32k=$testdir/32k.bin dd if="$binary_1m" of="$binary_32k" bs=1024 count=32 2>&5 dd if="$all_256_file" of="$binary_32k" bs=1 seek=8192 conv=notrunc 2>&5 binary_16k=$testdir/16k.bin dd if="$binary_1m" of="$binary_16k" bs=1024 count=16 2>&5 dd if="$all_256_file" of="$binary_16k" bs=1 seek=8192 conv=notrunc 2>&5 binary_8k=$testdir/8k.bin dd if="$binary_1m" of="$binary_8k" bs=1024 count=8 2>&5 dd if="$all_256_file" of="$binary_8k" bs=1 seek=1024 conv=notrunc 2>&5 binary_4k=$testdir/4k.bin dd if="$binary_1m" of="$binary_4k" bs=1024 count=4 2>&5 dd if="$all_256_file" of="$binary_4k" bs=1 seek=1024 conv=notrunc 2>&5 binary_2k=$testdir/2k.bin dd if="$binary_1m" of="$binary_2k" bs=1024 count=2 2>&5 dd if="$all_256_file" of="$binary_2k" bs=1 seek=1024 conv=notrunc 2>&5 nocontrols_file=$testdir/nocontrols.txt for i in $(seq 64 95); do printf "\\$(printf '%03o' "$i")"; done > $nocontrols_file for i in $(seq 32 255); do printf "\\$(printf '%03o' "$i")"; done >> $nocontrols_file #for i in $(seq 64 95); do printf "\\$(printf '%03o' "$i")"; done >> $nocontrols_file #for i in $(seq 160 255); do printf "\\$(printf '%03o' "$i")"; done >> $nocontrols_file # a real file for once: man_file=$objdir/man/lsz.1 man_file_crlf=$testdir/lsz.1.crlf man_file_crlf_padded_128=$testdir/lsz.1.crlf.padded_128 sed "s/\$/$(printf '\015')/" <$man_file >$man_file_crlf cp $man_file_crlf $man_file_crlf_padded_128 sz=$(wc -c < $man_file_crlf) pad=$(( 128 - (sz % 128) )) [ $pad -eq 1024 ] && pad=0 [ $pad -gt 0 ] && dd if=/dev/zero bs=1 count=$pad 2>/dev/null | tr '\0' '\032' >>$man_file_crlf_padded_128 # $$ is the main, not the sub shell getpid(){ echo $(exec sh -c 'echo "$PPID"') } totalsize() { ts_bytes=0 for ts_t in $* ; do # wc, because stat -f is not portable (OpenBSD, i greet you. And i hate you). ts_bytes=$(expr $ts_bytes + $(wc -c <$ts_t)) done echo $ts_bytes } doit() { doit_key="$1" title="$2" sz="$3" rz="$4" cmp="$5" files="$6" # Optional arguments 7 and 8: exit codes accepted for the sender and # the receiver, comma separated (empty or absent = only 0). Used for # tests where a side is EXPECTED to fail (aborts, refusals, path # violations). Death by a core-dumping signal can and will never be # accepted, so a buggy binary that dumps core can no longer yield # "PASSED". The caught-signal exits that lrzsz produces by design # (SIGPIPE=141 etc.) still need an opt-out. # I wish that complication wasn't needed. # Two separate arguments, NOT one "A|B" argument: the "|" would have # to be split out of the string, and in a ${var%%...} pattern ksh # treats it as alternation, not as a literal character (dash and # bash treat it as literal) — so the split is unportable. doit_ok_sender="0" doit_ok_receiver="0" if test -n "$7" ; then doit_ok_sender="$7" fi if test -n "$8" ; then doit_ok_receiver="$8" fi if test "$ONLY" != "$doit_key" -a -n "$ONLY"; then # caller might have prepared something here. rm -rf $testdir/$doit_key 2>&5 return fi if test -n "$selectedtests" ; then found= for t in $selectedtests ; do if test "$t" = "$doit_key" ; then found=t fi done if test -z "$found" ; then rm -rf $testdir/$doit_key 2>&5 return fi fi mkdir $testdir/$doit_key 2>/dev/null $ECHO "$doit_key - $title" failed=0 start=$($TIMESTAMP) MYSNIF="" if test -n "$ONLY" ; then MYSNIF="strace -vs 1280 -fo /tmp/sniff.trace $SNIF" MYSNIF="$SNIF" fi if test -n "$NOSNIF" ; then MYSNIF="" fi doit_timeout=${TIMEOUT_VALUE:-35} TIMEOUT="" if test -n "$TIMEOUT_FLAGS" && type "timeout" >/dev/null ; then TIMEOUT="timeout $TIMEOUT_FLAGS $doit_timeout "; elif type "timeout" >/dev/null ; then TIMEOUT="timeout $doit_timeout "; fi TRACE_SZ="" TRACE_RZ="" if test -n "$STRACE" ; then TRACE_SZ="strace -f -vs 1280 -Ttt -o $TRACEFILE_SZ" TRACE_RZ="strace -f -vs 1280 -Ttt -o $TRACEFILE_RZ" fi if test -n "$KTRACE" ; then TRACE_SZ="ktrace -f $TRACEFILE_SZ" TRACE_RZ="ktrace -i -f $TRACEFILE_RZ" fi #rz="$rz -vvvv"; echo "$doit_key - $title" >>$runlog echo "pid: $$" >>$runlog echo "cmd: ($sz $files ) <$testdir/pipe | (cd $testdir/$doit_key ; exec $FAULT $MYSNIF $rz >>../pipe )" >>$runlog # both sides record their exit status (128+N = death by signal N or # lrzsz's caught-signal exits); a missing status file (hard kill of # the subshell) fails too. The `exec` was dropped from both # subshells: the wrapper must survive to write the status file. The # receiver subshell keeps its redirections on the command, as # before. doit_st_s=$testdir/$doit_key/.status-sender doit_st_r=$testdir/$doit_key/.status-receiver rm -f $doit_st_s $doit_st_r (echo "pid-sender: " $(getpid) >>$runlog ; $TIMEOUT $TRACE_SZ $sz $files ; echo $? >$doit_st_s ) <$testdir/pipe | (echo "pid-receiver: $(getpid)" >>$runlog ; cd $testdir/$doit_key ; $TRACE_RZ $FAULT $MYSNIF $TIMEOUT $rz >>../pipe ; echo $? >$doit_st_r ) end=$($TIMESTAMP) doit_rc_s=$(cat $doit_st_s 2>/dev/null) doit_rc_r=$(cat $doit_st_r 2>/dev/null) if test -z "$doit_rc_s" ; then echo "status: sender did not report an exit status (hard kill?)" >>$runlog doit_rc_s="none" fi if test -z "$doit_rc_r" ; then echo "status: receiver did not report an exit status (hard kill?)" >>$runlog doit_rc_r="none" fi echo "status: sender=$doit_rc_s receiver=$doit_rc_r" >>$runlog # status verdict: 0 always ok; otherwise the code must be listed in # the opt-out. Death by a CORE-DUMPING signal is never acceptable — # those are the codes a buggy binary produces (SIGSEGV=139, # SIGABRT=134, SIGFPE=136, SIGILL=132, SIGBUS=138, SIGTRAP=133, # SIGQUIT=131, SIGSYS=140, SIGXCPU=152, SIGXFSZ=153). The codes for # SIGPIPE/SIGTERM/SIGINT (141/143/130) are NOT listed: lrzsz # catches those by design (bibi_sighandler) and may legitimately # exit 141 on an aborted transfer; they still need an opt-out. doit_bad="" if test "$doit_rc_s" != "0" ; then case ,"$doit_ok_sender", in *,"$doit_rc_s",*) ;; *) doit_bad="$doit_bad sender-exit-$doit_rc_s" ;; esac fi if test "$doit_rc_r" != "0" ; then case ,"$doit_ok_receiver", in *,"$doit_rc_r",*) ;; *) doit_bad="$doit_bad receiver-exit-$doit_rc_r" ;; esac fi case "$doit_rc_s" in 131|132|133|134|136|138|139|140|152|153) doit_bad="$doit_bad sender-signal-death" ;; esac case "$doit_rc_r" in 131|132|133|134|136|138|139|140|152|153) doit_bad="$doit_bad receiver-signal-death" ;; esac if test -n "$doit_bad" ; then echo "$doit_key:$doit_bad" >>$testdir/failures.log echo "summary: $doit_key FAILED ($doit_bad)" >>$runlog failed=1 fi rm -f $doit_st_s $doit_st_r echo "cmp: $cmp" >>$runlog for doit_i in $files ; do doit_bn=`basename $doit_i` _st=""; _res=""; if test -f $cmp ; then _res=" $testdir/$doit_key/$doit_bn = $cmp" cmp "$cmp" $testdir/$doit_key/$doit_bn _st=$? elif test "$cmp" = "missing" ; then _res=" $testdir/$doit_key/$doit_bn is missing as it should" test ! -e "$testdir/$doit_key/$doit_bn" _st=$? else _res=" $doit_i and $testdir/$doit_key/$doit_bn passed cmp function $cmp" $cmp "$doit_i" "$testdir/$doit_key/$doit_bn" _st=$? fi if test $_st -eq 0 ; then echo "filecheck-success: $doit_i ($_res)" >>$runlog rm -f $testdir/$doit_key/$doit_bn else echo "filecheck-fail: $doit_i" >>$runlog echo "stat original:" >>$runlog if test -f $cmp ; then stat $cmp | awk '{print " " $0}' >>$runlog else stat $doit_i | awk '{print " " $0}' >>$runlog fi echo "stat received:" >>$runlog stat $testdir/$doit_key/$doit_bn | awk '{print " " $0}' >>$runlog failed=1 fi done if test $failed = 1 ; then rmdir $testdir/$doit_key 2>&5 echo "$doit_key FAILED" echo "---- see $testdir/run.log for more information" echo "summary: $doit_key FAILED" >>$runlog echo "summary: $doit_key FAILED" >>$testdir/failures.log any_failure="$any_failure $doit_key" echo "sender: $sz" >>$runlog echo "receiver: $sz" >>$runlog else rm -rf $testdir/$doit_key 2>&5 $ECHO "$doit_key PASSED" echo "summary: $doit_key PASSED" >>$runlog bytes=0 for doit_t in $files ; do # wc, because stat -f is not portable (OpenBSD, i greet you. And i hate you). bytes=$(expr $bytes + $(wc -c <$doit_t)) done dur=$(echo "$end - $start" | bc) durshort=$(echo "scale=3; $end - $start" | bc) if test "$dur" = "0" ; then # bc cannot divide by zero; clamp to half a second. dur=0.5 durshort=0.5 fi bps=$(echo "scale=2; $bytes / $dur" | bc) mbps=$(echo "scale=1; $bps / 1000000.0" | bc) if test "$mbps" = "0" ; then kbps=$(echo "scale=1; $bps / 1000.0" | bc) pres_bps="$kbps KB/s" else pres_bps="$mbps MB/s" fi echo "$bps byte/sec ($pres_bps): $doit_key, $bytes bytes transmitted in $durshort seconds" >>$testdir/perf.log echo "$bps byte/sec ($pres_bps): $doit_key, $bytes bytes transmitted in $durshort seconds" >>$runlog fi echo >>$runlog } resume_cmp() { if cmp "$1" "$2" >&5 ; then echo "---- receiver did not resume, but file is ok" return 0 fi # $1 is the real file # $2 is the muddled file dir=$(dirname $2) bn=$(basename $2) dd if="$1" of="$dir/$bn"-cmp bs=256 count=5 2>&5 dd if="$2" bs=256 skip=5 >>"$dir/$bn-cmp" 2>&5 if cmp "$1" "$dir/$bn-cmp" >&5 ; then rm "$dir/$bn-cmp" return 0 fi echo "-- sender resumed, but files differ. This is really bad." return 1 } # check content and the security relevant part of the mode of a received file: # group and other permissions must not be set (lrz forces umask 0077 for # creation, and closeit() must not widen the file again via chmod()). # optional $3: "x" = owner execute bit must have survived (sender had it). mode_cmp() { if cmp "$1" "$2" >&5 ; then : else echo "-- files differ" return 1 fi case $(ls -l "$2" | cut -c5-10) in ------) ;; *) echo "-- received file has group/other permission bits set: $(ls -l "$2" | cut -c1-10)" return 1 ;; esac if test "$3" = x ; then case $(ls -l "$2" | cut -c4) in x) return 0 ;; *) echo "-- received file: owner lost the execute bit: $(ls -l "$2" | cut -c1-10)" return 1 ;; esac fi return 0 } # --keep-incomplete check: $2 (the received partial) must exist, be smaller # than the original ($1), and be a strict prefix of it (aborted mid-transfer). incomplete_keep_cmp() { if test ! -f "$2" ; then echo "-- incomplete file was not kept: $2 missing" return 1 fi if cmp -s "$1" "$2" >&5 ; then echo "-- file is complete; the abort never happened" return 1 fi _orig_size=$(expr "$(wc -c <"$1")" + 0) _part_size=$(expr "$(wc -c <"$2")" + 0) if test "$_part_size" -ge "$_orig_size" ; then echo "-- partial ($_part_size) is not smaller than original ($_orig_size)" return 1 fi dd if="$1" ibs="$_part_size" count=1 2>&5 | cmp -s - "$2" || { echo "-- partial file is not a prefix of the original" return 1 } return 0 } FAULTS="not slightly moderately noticeably significantly very extremely" fault2num() { case "$1" in extremely) echo 1024 ; return ;; very) echo 2048 ; return ;; significantly) echo 4096 ; return ;; noticeably) echo 16384 ; return ;; moderately) echo 32768 ; return ;; slightly) echo 65536 ; return ;; *) echo 9999999999 ; return ;; esac } xerrors() { # start with the error handling tests for i in $FAULTS ; do # note: -f 1024 in average creates N errors per 1024 bytes, # with N= number_of_channels * number_of_error_classes # 3 error classes (-e, -x, -g), 2 channels: 1 error every 170 bytes. # xmodem IS slow, and it is incredibly slow with many errors on the line. # switch to a smaller file with many errors. bin=$binary_128k if test $(fault2num $i) -lt 65536 ; then bin=$binary_16k fi if test $(fault2num $i) -lt 16384 ; then bin=$binary_4k fi bn=$(basename $bin) FAULT="$SIMU -s 1 -f $(fault2num $i) -r 8m -e 2 -x 4 -g 1" # flip up to 2 bits, drop up to 4 bytes, garble one byte. quite fast. app="-3e"; if test "$i" = "not"; then app=""; fi doit "xmodem-lsz-lrz-errorbase-crc-$i$app" "lsz sending to lrz, $i faulty line" "$SZ -q -X" "$RZ -q -b -X -c $bn" cmp "$bin" # 1k mode CANNOT cope with to high error rates. it just needs to be able transfer some sectors… if test $(fault2num $i) -gt 2048 ; then doit "xmodem-lsz-lrz-errorbase-crc-1k-$i$app" "lsz sending to lrz, $i faulty line" "$SZ -q -X -k" "$RZ -q -b -X -c $bn" cmp "$bin" fi # we repeat that with just 1 error class. if test "$i" != "not"; then FAULT="$SIMU -s 1 -f $(fault2num $i) -r 8m -e 1" # flip 1 bit. quite fast. doit "xmodem-lsz-lrz-errorbase-crc-$i-1e" "lsz sending to lrz, $i faulty line" "$SZ -q -X" "$RZ -q -b -X -c $bn" cmp "$bin" if test $(fault2num $i) -gt 2048 ; then doit "xmodem-lsz-lrz-errorbase-crc-1k-$i-1e" "lsz sending to lrz, $i faulty line" "$SZ -q -X -k" "$RZ -q -b -X -c $bn" cmp "$bin" fi fi done FAULT= } yerrors() { for i in $FAULTS ; do # note: -f 1024 in average creates N errors per 1024 bytes, # with N= number_of_channels * number_of_error_classes # 3 error classes (-e, -x, -g), 2 channels: 1 error every 170 bytes. # xmodem IS slow, and it is incredibly slow with many errors on the line. # switch to a smaller file with many errors. bin="$binary_128k $binary_16k $binary_4k" if test $(fault2num $i) -lt 65536 ; then bin="$binary_16k $binary_4k" fi if test $(fault2num $i) -lt 16384 ; then bin="$binary_4k $all_256_file" fi FAULT="$SIMU -s 1 -f $(fault2num $i) -r 8m -e 2 -x 4 -g 1" # flip up to 2 bits, drop up to 4 bytes, garble one byte. quite fast. app="-3e"; if test "$i" = "not"; then app=""; fi doit "ymodem-lsz-lrz-errorbase-crc-$i$app" "lsz sending to lrz, $i faulty line" "$SZ -q -g" "$RZ -q -b -g -c" cmp "$bin" # 1k mode CANNOT cope with to high error rates. it just needs to be able transfer some sectors… if test $(fault2num $i) -gt 2048 ; then doit "ymodem-lsz-lrz-errorbase-crc-1k-$i$app" "lsz sending to lrz, $i faulty line" "$SZ -q -g -k" "$RZ -q -b -g -c" cmp "$bin" fi # we repeat that with just 1 error class. if test "$i" != "not"; then FAULT="$SIMU -s 1 -f $(fault2num $i) -r 8m -e 1" # flip 1 bit. quite fast. doit "ymodem-lsz-lrz-errorbase-crc-$i-1e" "lsz sending to lrz, $i faulty line" "$SZ -q -g" "$RZ -q -b -g -c" cmp "$bin" if test $(fault2num $i) -gt 2048 ; then doit "ymodem-lsz-lrz-errorbase-crc-1k-$i-1e" "lsz sending to lrz, $i faulty line" "$SZ -q -X -g" "$RZ -q -b -g -c" cmp "$bin" fi fi done FAULT= } zerrors() { for thisfault in $FAULTS ; do # speed=1m # note: -f 1024 in average creates N errors per 1024 bytes, # with N= number_of_channels * number_of_error_classes # 3 error classes (-e, -x, -g), 2 channels: 1 error every 170 bytes. all_binaries="$binary_16k $binary_128k" case $speed in 1m) all_binaries="$binary_16k $binary_128k";; esac case "$thisfault" in extremely) all_binaries="$all_256_file $binary_2k" ;; very) all_binaries="$binary_2k $binary_4k" ;; significantly) all_binaries="$binary_4k $binary_8k" ;; noticeable) all_binaries="$binary_16k $binary_32k" ;; moderately) all_binaries="$binary_32k $binary_64k" ;; slightly) all_binaries="$binary_64k $binary_128k" ;; no) all_binaries="$binary_64k $binary_128k" ;; esac # if test $(fault2num $thisfault) -lt 16384 ; then # bin="$binary_4k $all_256_file" # fi app="-3e"; if test "$thisfault" = "not"; then app=""; fi app="$app-$speed"; FAULT="$SIMU -s 1 -f $(fault2num $thisfault) -r $speed -e 2 -x 4 -g 1" # flip up to 2 bits, drop up to 4 bytes, garble one byte. quite fast. doit "zmodem-lsz-lrz-errors-$thisfault$app" "lsz sending to lrz, $thisfault faulty line ($speed baud simulated)" "$SZ -q -Z" "$RZ -q -Z" cmp "$all_binaries" doit "zmodem-lsz-lrz-errors-4k-$thisfault$app" "lsz sending to lrz, $thisfault faulty line ($speed baud simulated)" "$SZ -q -4 -Z" "$RZ -q -Z" cmp "$all_binaries" doit "zmodem-lsz-lrz-errors-8k-$thisfault$app" "lsz sending to lrz, $thisfault faulty line ($speed baud simulated)" "$SZ -q -8 -Z" "$RZ -q -Z" cmp "$all_binaries" # we repeat that with just 1 error class. if test "$thisfault" != "not"; then FAULT="$SIMU -s 1 -f $(fault2num $thisfault) -r $speed -e 1" # flip 1 bit. quite fast. app="-1e"; if test "$thisfault" = "not"; then app=""; fi app="$app-$speed"; doit "zmodem-lsz-lrz-errors-$thisfault$app" "lsz sending to lrz, $thisfault faulty line ($speed baud simulated)" "$SZ -q -Z" "$RZ -q -Z" cmp "$all_binaries" doit "zmodem-lsz-lrz-errors-4k-$thisfault$app" "lsz sending to lrz, $thisfault faulty line ($speed baud simulated)" "$SZ -q -4 -Z" "$RZ -q -Z" cmp "$all_binaries" doit "zmodem-lsz-lrz-errors-8k-$thisfault$app" "lsz sending to lrz, $thisfault faulty line ($speed baud simulated)" "$SZ -q -8 -Zk" "$RZ -q -Zc" cmp "$all_binaries" fi done FAULT= } compat_traits() { other="$1" s_framelen_opt="" s_4k_opt="" s_8k_opt="" s_turbo_opt="" r_error_opt="" r_ymodem_opt="" s_ymodem_opt="" r_xmodem_opt="" s_xmodem_opt="" r_xmodem_crc_opt="" r_can_xmodem_1k="" s_1k_opt="" r_ascii_opt="" s_ascii_opt="" r_binary_opt="" r_resume_opt="" s_resume_opt="" s_append_opt="" s_rename_opt="" r_rename_opt="" r_can_rename="" s_can_rename="" s_can_resume="" r_can_4k="" r_can_8k="" can_escctl="" can_esc8="" s_16bit_crc_opt="" r_can_16bit_crc="" TEST_SZ="" TEST_SB="" TEST_SX="" TEST_RZ="" TEST_RB="" TEST_RX="" BENCH_SZ_1k="" BENCH_SZ_2k="" BENCH_SZ_4k="" BENCH_SZ_8k="" BENCH_RZ="" case "$other" in lrzsz) BENCH_SZ_1k="$SZ -q" BENCH_SZ_2k="" BENCH_SZ_4k="$SZ -q -4" BENCH_SZ_8k="$SZ -q -8" BENCH_RZ="$RZ -q" TEST_SZ="$SZ -q" TEST_SB="$SZ -q -g" TEST_SX="$SZ -q -X" TEST_RZ="$RZ -q" TEST_RB="$RZ -q -g" TEST_RX="$RZ -q -X" s_framelen_opt=-l r_error_opt="-F" # lrzsz lrz option to create errors, short form r_ymodem_opt="-g" s_ymodem_opt="-g" r_xmodem_opt="-X" s_xmodem_opt="-X" r_xmodem_crc_opt="-c" r_can_xmodem_1k="yes" s_1k_opt="-k" r_ascii_opt="-a" s_ascii_opt="-a" r_binary_opt="-b" r_resume_opt="-r" s_resume_opt="-r" s_append_opt="-+" s_rename_opt="-E" r_rename_opt="-E" r_can_rename=yes s_can_rename=yes s_can_resume=yes r_can_4k="yes" r_can_8k="yes" otherrz="lrz" othersz="lsz" can_escctl="yes" can_esc8="yes" s_16bit_crc_opt="-o" r_can_16bit_crc="yes" ;; lrzsz_old) TEST_SZ=~/bin/lrzsz-0.12.21rc/lsz" -q" TEST_SX=~/bin/lrzsz-0.12.21rc/lsz" -q --xmodem" TEST_SB=~/bin/lrzsz-0.12.21rc/lsz" -q --ymodem" TEST_RZ=~/bin/lrzsz-0.12.21rc/lrz" -q " TEST_RX=~/bin/lrzsz-0.12.21rc/lrz" -q --xmodem" TEST_RB=~/bin/lrzsz-0.12.21rc/lrz" -q --ymodem" BENCH_SZ_1k="$TEST_SZ" BENCH_SZ_2k="" BENCH_SZ_4k="$TEST_SZ -4" BENCH_SZ_8k="$TEST_SZ -8" BENCH_RZ="$TEST_RZ" s_framelen_opt=-l s_4k_opt="-4" s_8k_opt="-8" s_turbo_opt="-T" r_error_opt="--errors" #lrzsz lrz option to create errors r_ymodem_opt="--ymodem" s_ymodem_opt="--ymodem" r_xmodem_opt="--xmodem" s_xmodem_opt="--xmodem" r_xmodem_crc_opt="-c" r_can_xmodem_1k="yes" s_1k_opt="-k" r_ascii_opt="-a" s_ascii_opt="-a" r_binary_opt="-b" r_resume_opt="-r" s_resume_opt="-r" s_append_opt="-+" s_rename_opt="-E" r_rename_opt="-E" r_can_rename=yes s_can_rename=yes s_can_resume=yes r_can_4k="yes" r_can_8k="yes" can_escctl="yes" otherrz="lrz01221rc" othersz="lsz01221rc" s_16bit_crc_opt="-o" r_can_16bit_crc="yes" ;; sexyz) TEST_SZ=~/bin/sexyz-3.6" -s sz" TEST_RZ=~/bin/sexyz-3.6" -s rz" TEST_SX=~/bin/sexyz-3.6" sx" TEST_RX=~/bin/sexyz-3.6" rx" TEST_SB=~/bin/sexyz-3.6" sy" TEST_RB=~/bin/sexyz-3.6" ry" otherrz="sexyz" othersz="sexyz" s_1k_opt="-k" r_can_4k="yes" r_can_8k="yes" s_4k_opt="-4" s_8k_opt="-8" r_binary_opt=" " # always binary BENCH_SZ_1k="$TEST_SZ" BENCH_SZ_2k="$TEST_SZ -2" BENCH_SZ_4k="$TEST_SZ -4" BENCH_SZ_8k="$TEST_SZ -8" BENCH_RZ="$TEST_RZ" ;; crzsz) TEST_SZ=~/bin/crzsz/csz # no -q option TEST_SB=~/bin/crzsz/csb # no -q option TEST_SX=~/bin/crzsz/csx # no -q option TEST_RZ=~/bin/crzsz/crz TEST_RB=~/bin/crzsz/crb TEST_RX=~/bin/crzsz/crx otherrz="crz" othersz="csz" s_can_resume=yes can_escctl="yes" s_16bit_crc_opt="-o" r_can_16bit_crc="yes" s_1k_opt="-k" BENCH_SZ_1k="$TEST_SZ" BENCH_RZ="$TEST_RZ" ;; rzsz373) TEST_SZ=~/bin/rzsz373/sz # no -q option TEST_SB=~/bin/rzsz373/sb # no -q option TEST_SX=~/bin/rzsz373/sx # no -q option TEST_RZ=~/bin/rzsz373/rz TEST_RB=~/bin/rzsz373/rb TEST_RX=~/bin/rzsz373/rx otherrz="rz373" othersz="sz373" s_can_resume=yes can_escctl="yes" s_16bit_crc_opt="-o" r_can_16bit_crc="yes" s_1k_opt="-k" BENCH_SZ_1k="$TEST_SZ" BENCH_RZ="$TEST_RZ" ;; zmtxzmrx2) TEST_SZ=~/bin/zmtx-zmrx-2.06/zmtx # no -q option TEST_RZ=~/bin/zmtx-zmrx-2.06/zmrx" -q" BENCH_SZ_1k="$TEST_SZ" BENCH_RZ="$TEST_RZ" otherrz="zmtxzmrx2" othersz="zmtxzmrx2" r_can_4k="yes" r_can_8k="yes" r_4k_opt="-q" s_4k_opt="-4" s_8k_opt="-8" s_turbo_opt="" #s_can_resume= : ZCRC is not implemented. #can_escapectl= : ZESCCTL is not implemented ;; esac } available() { available="lrzsz" if test -x ~/bin/lrzsz-0.12.21rc/lrz -a -x ~/bin/lrzsz-0.12.21rc/lsz ; then available="$available lrzsz_old" fi if test -x ~/bin/crzsz/crz -a -x ~/bin/crzsz/csz ; then available="$available crzsz" fi if test -x ~/bin/rzsz373/rz -a -x ~/bin/rzsz373/sz ; then available="$available rzsz373" fi if test -x ~/bin/zmtx-zmrx-2.06/zmtx -a -x ~/bin/zmtx-zmrx-2.06/zmrx ; then available="$available zmtxzmrx2" fi if test -x ~/bin/sexyz-3.6 ; then available="$available sexyz" fi echo "$available" } xcompat() { available=$(available) for other in $available; do compat_traits "$other" if test -n "$r_xmodem_opt" ; then bn=$(basename $all_256_file) test -n "$r_binary_opt" && \ doit "xmodem-lsz-$otherrz-small-binary" "lsz sending to $otherrz" "$SZ -q -X" "$TEST_RX $r_binary_opt $bn" cmp "$all_256_file" bn=$(basename $binary_16k) test -n "$r_binary_opt" && \ doit "xmodem-lsz-$otherrz-16k-binary" "lsz sending to $otherrz" "$SZ -q -X" "$TEST_RX $r_binary_opt $bn" cmp "$binary_16k" test -n "$r_binary_opt" && test -n "$r_xmodem_crc_opt" && \ doit "xmodem-lsz-$otherrz-16k-binary-crc" "lsz sending to $otherrz" "$SZ -q -X" "$TEST_RX $r_xmodem_crc_opt $r_binary_opt $bn" cmp "$binary_16k" bn=$(basename $binary_128k) test -n "$r_binary_opt" && test -n "$r_can_xmodem_1k" && \ doit "xmodem-lsz-$otherrz-large-binary-1k" "lsz sending to $otherrz" "$SZ -q -X -k" "$TEST_RX $r_binary_opt $bn" cmp "$binary_128k" test -n "$r_binary_opt" && test -n "$r_can_xmodem_1k" && test -n "$r_xmodem_crc_opt" && \ doit "xmodem-lsz-$otherrz-large-binary-1k-crc" "lsz sending to $otherrz" "$SZ -q -X -k" "$TEST_RX $r_xmodem_crc_opt $r_binary_opt $bn" cmp "$binary_128k" bn=$(basename $binary_1m) test -n "$r_binary_opt" && test -n "$r_can_xmodem_1k" && test -n "$r_xmodem_crc_opt" && \ doit "xmodem-lsz-$otherrz-megabyte-binary-1k-crc" "lsz sending to $otherrz" "$SZ -q -X -k" "$TEST_RX $r_xmodem_crc_opt $r_binary_opt $bn" cmp "$binary_1m" bn=$(basename $nocontrols_file) test -n "$r_ascii_opt" && \ doit "xmodem-lsz-$otherrz-small-ascii" "lsz sending to $otherrz" "$SZ -q -X" "$TEST_RX $r_ascii_opt $bn" cmp "$nocontrols_file" bn=$(basename $man_file) test -n "$r_ascii_opt" && \ doit "xmodem-lsz-$otherrz-medium-ascii" "lsz sending to $otherrz" "$SZ -q -X" "$TEST_RX $r_ascii_opt $bn" cmp "$man_file" test -n "$r_ascii_opt" && test -n "$r_xmodem_crc_opt" && \ doit "xmodem-lsz-$otherrz-medium-ascii-crc" "lsz sending to $otherrz" "$SZ -q -X" "$TEST_RX $r_xmodem_crc_opt $r_ascii_opt $bn" cmp "$man_file" test -n "$r_ascii_opt" && test -n "$r_can_xmodem_1k" && \ doit "xmodem-lsz-$otherrz-medium-ascii-1k" "lsz sending to $otherrz" "$SZ -k -q -X" "$TEST_RX $r_ascii_opt $bn" cmp "$man_file" test -n "$r_ascii_opt" && test -n "$r_xmodem_crc_opt" && test -n "$r_can_xmodem_1k" && \ doit "xmodem-lsz-$otherrz-medium-ascii-1k-crc" "lsz sending to $otherrz" "$SZ -q -k -X" "$TEST_RX $r_xmodem_crc_opt $r_ascii_opt $bn" cmp "$man_file" # sender -a option: \n => \r\n. because, well, featuritis? # problem: rz -a removes the \r again. rz -b adds ^Zs. so we use a padded comparison file. if test -n "$r_binary_opt"; then bn=$(basename $man_file) doit "xmodem-lsz-$otherrz-medium-crlf" "lsz sending to $otherrz" "$SZ -a -q -X" "$TEST_RX $r_binary_opt $bn" "$man_file_crlf_padded_128" "$man_file" fi fi if test "$other" != "lrzsz" -a -n "$TEST_SX"; then bn=$(basename $all_256_file) doit "xmodem-$othersz-lrz-small-binary" "XMODEM: small binary transfer: $othersz sending to lrz" "$TEST_SX -b" "$RZ -q -X -b $bn" cmp "$all_256_file" bn=$(basename $binary_16k) doit "xmodem-$othersz-lrz-16k-binary" "XMODEM: 16k binary transfer: $otherrz sending to lrz" "$TEST_SX" "$RZ -q -X -b $bn" cmp "$binary_16k" doit "xmodem-$othersz-lrz-16k-binary-crc" "XMODEM/CRC: 16k binary transfer: $otherrz sending to lrz" "$TEST_SX" "$RZ -q -X -b -c $bn" cmp "$binary_16k" bn=$(basename $binary_128k) test -n "$s_1k_opt" && \ doit "xmodem-$othersz-lrz-large-binary-1k" "XMODEM/1k: large binary transfer: $otherrz sending to lrz" "$TEST_SX $s_1k_opt" "$RZ -q -X -b $bn" cmp "$binary_128k" test -n "$s_1k_opt" && \ doit "xmodem-$othersz-lrz-large-binary-1k-crc" "XMODEM/1k/CRC: large binary transfer: $otherrz sending to lrz" "$TEST_SX $s_1k_opt" "$RZ -q -X -b -c $bn" cmp "$binary_128k" bn=$(basename $binary_1m) test -n "$s_1k_opt" && \ doit "xmodem-$othersz-lrz-megabyte-binary-1k-crc" "XMODEM/1k/CRC: megabyte binary transfer: $otherrz sending to lrz" "$TEST_SX $s_1k_opt" "$RZ -q -X -b -c $bn" cmp "$binary_1m" bn=$(basename $nocontrols_file) doit "xmodem-$othersz-lrz-small-ascii" "XMODEM: small ascii transfer: $otherrz sending to lrz" "$TEST_SX" "$RZ -q -X -a $bn" cmp "$nocontrols_file" bn=$(basename $man_file) doit "xmodem-$othersz-lrz-medium-ascii" "XMODEM: medium ascii transfer: $otherrz sending to lrz" "$TEST_SX" "$RZ -q -X -a $bn" cmp "$man_file" doit "xmodem-$othersz-lrz-medium-ascii-crc" "XMODEM/CRC: medium ascii transfer: $otherrz sending to lrz" "$TEST_SX" "$RZ -q -X -c -a $bn" cmp "$man_file" bn=$(basename $man_file) test -n "$s_1k_opt" && \ doit "xmodem-$othersz-lrz-medium-ascii-1k" "XMODEM/1k: medium ascii transfer: $otherrz sending to lrz" "$TEST_SX $s_1k_opt" "$RZ -q -X -a $bn" cmp "$man_file" test -n "$s_1k_opt" && \ doit "xmodem-$othersz-lrz-medium-ascii-1k-crc" "XMODEM/1k/CRC: medium ascii transfer: $otherrz sending to lrz" "$TEST_SX $s_1k_opt" "$RZ -q -X -c -a $bn" cmp "$man_file" bn=$(basename $man_file) test -n "$s_ascii_opt" && \ doit "xmodem-$othersz-lrz-medium-crlf" "XMODEM CR/LF conversion: medium ascii transfer: $otherrz sending to lrz" "$TEST_SX $s_ascii_opt" "$RZ -q -X -b $bn" "$man_file_crlf_padded_128" "$man_file" fi done } ycompat() { available=$(available) for other in $available; do compat_traits "$other" # we here assume the Y is implemented like X. Which is quite reasonable. # we also assume that all programs transfer binary by default. rzsz and descendants do, and to do something else would be stupid. # we also do NO ascii tests. all_binaries="$all_256_file $binary_16k $binary_128k $binary_256k $binary_1m" if test -n "$TEST_RB" ; then doit "ymodem-lsz-$otherrz-small-binary" "lsz sending to $otherrz" "$SZ -q -g" "$TEST_RB" cmp "$all_256_file" doit "ymodem-lsz-$otherrz-16k-binary" "lsz sending to $otherrz" "$SZ -q -g" "$TEST_RB" cmp "$binary_16k" # the next one checks the transfer of multiple files. we do another one with CRC and 1k. doit "ymodem-lsz-$otherrz-multiple" "lsz sending to $otherrz" "$SZ -q -g" "$TEST_RB" cmp "$all_binaries" test -n "$r_xmodem_crc_opt" && doit "ymodem-lsz-$otherrz-crc" "lsz sending to $otherrz" "$SZ -q -g" "$TEST_RB $r_xmodem_crc_opt" cmp "$binary_256k" test -n "$r_can_xmodem_1k" && doit "ymodem-lsz-$otherrz-1k" "lsz sending to $otherrz" "$SZ -q -g -k" "$TEST_RB" cmp "$binary_256k" # second multiple file test test -n "$r_can_xmodem_1k" && test -n "$r_xmodem_crc_opt" && \ doit "ymodem-lsz-$otherrz-1k-crc-multiple" "lsz sending to $otherrz" "$SZ -q -g -k" "$TEST_RB $r_xmodem_crc_opt" cmp "$all_binaries" fi if test "$other" != "lrzsz" -a -n "$TEST_SB"; then doit "ymodem-$othersz-lrz-small-binary" "$othersz sending to lrz" "$TEST_SB -b" "$RZ -q -g -b" cmp "$all_256_file" doit "ymodem-$othersz-lrz-16k-binary" "$otherrz sending to lrz" "$TEST_SB" "$RZ -q -g -b " cmp "$binary_16k" doit "ymodem-$othersz-lrz-multiple" "$otherrz sending to lrz" "$TEST_SB" "$RZ -q -g -b " cmp "$all_binaries" doit "ymodem-$othersz-lrz-crc" "$otherrz sending to lrz" "$TEST_SB" "$RZ -q -g -b -c " cmp "$binary_256k" test -n "$s_1k_opt" && \ doit "ymodem-$othersz-lrz-1k" "$otherrz sending to lrz" "$TEST_SB $s_1k_opt" "$RZ -q -g -b" cmp "$binary_256k" test -n "$s_1k_opt" && \ doit "ymodem-$othersz-lrz-1k-crc-multiple" "$otherrz sending to lrz" "$TEST_SB $s_1k_opt" "$RZ -q -g -b" cmp "$all_binaries" fi done } zcompat() { available=$(available) for other in $available; do compat_traits "$other" # we also assume that all programs transfer binary by default. rzsz and descendants do, and to do something else would be stupid. # we also do NO ascii tests. ASCII conversion should die, die, die. We will test it in lrzsz specific test, though all_binaries="$all_256_file $binary_4k $binary_16k $binary_128k $binary_256k $binary_1m $binary_2m $binary_8m" doit "zmodem-lsz-$otherrz-multiple" "lsz sending multiple files to $otherrz" "$SZ -q" "$TEST_RZ" cmp "$all_binaries" doit "zmodem-lsz-$otherrz-framelen-512" "lsz sending with framelen 512 to $otherrz" "$SZ -q -l 512" "$TEST_RZ" cmp "$all_binaries" doit "zmodem-lsz-$otherrz-framelen-128" "lsz sending with framelen 256 to $otherrz" "$SZ -q -l 128" "$TEST_RZ" cmp "$all_binaries" test -n "$r_can_4k" && doit "zmodem-lsz-$otherrz-4k" "lsz tries to send 4k blocks to $otherrz" "$SZ -q -4" "$TEST_RZ" cmp "$all_binaries" test -n "$r_can_4k" && doit "zmodem-lsz-$otherrz-4kstart" "lsz starts to send 4k blocks to $otherrz" "$SZ -q -5" "$TEST_RZ" cmp "$all_binaries" test -n "$r_can_8k" && doit "zmodem-lsz-$otherrz-8k" "lsz tries to send 8k blocks to $otherrz" "$SZ -q -8" "$TEST_RZ" cmp "$all_binaries" test -n "$r_can_8k" && doit "zmodem-lsz-$otherrz-8kstart" "lsz starts to send 8k blocks to $otherrz" "$SZ -q -9" "$TEST_RZ" cmp "$all_binaries" doit "zmodem-lsz-$otherrz-turbo" "lsz sending with turbo escaping to $otherrz" "$SZ -qT" "$TEST_RZ" cmp "$all_binaries" test -n "$r_can_8k" && doit "zmodem-lsz-$otherrz-8k-turbo" "lsz tries to send 4k block with turbo escaping to $otherrz" "$SZ -qT -8" "$TEST_RZ" cmp "$all_binaries" test -n "$can_escctl" && doit "zmodem-lsz-$otherrz-escapectl-s" "lsz sending with escaped control chars to $otherrz (sender initiated)" "$SZ -q -e" "$TEST_RZ" cmp "$all_binaries" test -n "$r_can_16bit_crc" && doit "zmodem-lsz-$otherrz-crc16" "lsz sending with CRC16 to $otherrz" "$SZ -q -o" "$TEST_RZ" cmp "$all_binaries" if test -n "$s_resume_opt" ; then key="zmodem-lsz-$otherrz-RESUME-s" mkdir $testdir/$key 2>/dev/null|| true dd if=$srcdir/src/Makefile.in of=$testdir/$key/lsz.c bs=256 count=5 2>&5 doit "$key" "lsz sending (resuming) to $other" "$SZ -rq" "$TEST_RZ" resume_cmp $srcdir/src/lsz.c key="zmodem-lsz-$otherrz-RESUME-CRC-s" mkdir $testdir/$key 2>/dev/null|| true dd if=$srcdir/src/Makefile.in of=$testdir/$key/lsz.c bs=256 count=5 2>&5 doit "$key" "lsz sending (resuming with CRC -H) to $other" "$SZ -rqH" "$TEST_RZ" cmp $srcdir/src/lsz.c key="zmodem-lsz-$otherrz-RESUME-CRC2-s" mkdir $testdir/$key 2>/dev/null|| true dd if=$srcdir/src/Makefile.in of=$testdir/$key/lsz.c bs=256 count=5 2>&5 doit "$key" "lsz sending (resuming with CRC -rr) to $other" "$SZ -rqr" "$TEST_RZ" cmp $srcdir/src/lsz.c fi if test -n "$r_resume_opt" ; then key="zmodem-lsz-$otherrz-RESUME-r" mkdir $testdir/$key 2>/dev/null|| true dd if=$srcdir/src/Makefile.in of=$testdir/$key/lsz.c bs=256 count=5 2>&5 doit "$key" "lsz sending to $other (resuming)" "$SZ -q" "$TEST_RZ $r_resume_opt" resume_cmp $srcdir/src/lsz.c # could check against the receivers CRC options - but why should i check them? fi if test "$other" != "lrzsz" ; then doit "zmodem-$othersz-lrz-multiple" "$othersz sending multiple files to lrz" "$TEST_SZ" "$RZ -q" cmp "$all_binaries" test "$s_opt_framelen" = 1 && doit "zmodem-$othersz-lrz-framelen-512" "$othersz sending with framelen 512 to lrz" "$TEST_SZ $s_opt_framelen 512" "$RZ -q" cmp "$all_binaries" test "$s_opt_framelen" = 1 && doit "zmodem-$othersz-lrz-framelen-128" "$othersz sending with framelen 512 to lrz" "$TEST_SZ $s_opt_framelen 128" "$RZ -q" cmp "$all_binaries" test -n "$s_4k_opt" && doit "zmodem-$othersz-lrz-4k" "$othersz tries to send 4k blocks to lrz" "$TEST_SZ $s_4k_opt" "$RZ -q" cmp "$all_binaries" test -n "$s_8k_opt" && doit "zmodem-$othersz-lrz-8k" "$othersz tries to send 8k blocks to lrz" "$TEST_SZ $s_8k_opt" "$RZ -q" cmp "$all_binaries" test -n "$s_turbo_opt" && doit "zmodem-$othersz-lrz-turbo" "$othersz sending with turbo escaping to lrz" "$TEST_SZ $s_turbo_opt" "$RZ -q" cmp "$all_binaries" test -n "$s_turbo_opt" && test -n "$s_8k_opt" && \ doit "zmodem-$othersz-lrz-8k-8k-turbo" "$othersz sending 8k blocks with turbo escaping to lrz" "$TEST_SZ $s_turbo_opt $s_8k_opt" "$RZ -q" cmp "$all_binaries" test -n "$can_escapectl" && doit "zmodem-$othersz-lrz-escape-r" "$othersz sending with escaped control characters to lrz (receiver initialized)" "$TEST_SZ" "$RZ -q -e" cmp "$all_binaries" test -n "$s_16bit_crc_opt" && doit "zmodem-$othersz-lrz-crc16" "$othersz sending with CRC16 to lrz" "$TEST_SZ $s_16bit_crc_opt" "$RZ -q -e" cmp "$all_binaries" key=zmodem-$othersz-lrz-resume-r mkdir $testdir/$key 2>/dev/null|| true dd if=$srcdir/src/Makefile.in of=$testdir/$key/lsz.c bs=256 count=5 2>&5 doit "$key" "$othersz sending to lsz (tries to resume)" "$TEST_SZ" "$RZ -qr" resume_cmp $srcdir/src/lsz.c if test -n "$s_can_resume" ; then key=zmodem-$othersz-lrz-resume-crc-r mkdir $testdir/$key 2>/dev/null|| true dd if=$srcdir/src/Makefile.in of=$testdir/$key/lsz.c bs=256 count=5 2>&5 doit "$key" "$othersz sending to lsz (resuming with -H)" "$TEST_SZ" "$RZ -qrH" cmp $srcdir/src/lsz.c key=zmodem-$othersz-lrz-resume-crc2-r mkdir $testdir/$key 2>/dev/null|| true dd if=$srcdir/src/Makefile.in of=$testdir/$key/lsz.c bs=256 count=5 2>&5 doit "$key" "$othersz sending to lsz (resuming with -rr)" "$TEST_SZ" "$RZ -qrr" cmp $srcdir/src/lsz.c fi if test -n "$s_resume_opt" ; then key=zmodem-$othersz-lrz-resume-r mkdir $testdir/$key 2>/dev/null|| true dd if=$srcdir/src/Makefile.in of=$testdir/$key/lsz.c bs=256 count=5 2>&5 doit "$key" "$othersz sending with resume to lrz" "$TEST_SZ $s_resume_opt" "$RZ -q" resume_cmp $srcdir/src/lsz.c fi fi done } zbuffer() { compat_traits "lrzsz" _SZ_8k="$BENCH_SZ_8k"; _RZ="$BENCH_RZ"; sender="lsz" receiver="lrz" for i in $(seq 1 7); do FAULT="" all_binaries="$all_256_file $binary_4k $binary_16k $binary_64k $binary_256k $binary_1m $binary_2m $binary_4m $binary_8m" for i in 8192 16384 32768 65536 131072 262144 ; do key="zmodem-$sender-$receiver-rbuf-$i" doit "$key" "$sender sending multiple files to $receiver" "$_SZ_8k" "$_RZ -B$i" cmp "$all_binaries" done for i in 8192 16384 32768 65536 131072 262144 ; do key="zmodem-$sender-$receiver-sbuf-$i" doit "$key" "$sender sending multiple files to $receiver" "$_SZ_8k -B$i" "$_RZ" cmp "$all_binaries" done for i in 8192 16384 32768 65536 131072 262144 ; do key="zmodem-$sender-$receiver-srbuf-$i" doit "$key" "$sender sending multiple files to $receiver" "$_SZ_8k -B$i" "$_RZ -B$i" cmp "$all_binaries" done done } # for the benchmarking. config() { case "$1" in lrzsz) shift _cmd= _opt= for _i in $* ; do case "$_i" in sx) _cmd=$SZ" -q -X" ;; sy) _cmd=$SZ" -q -g" ;; sz) _cmd=$SZ" -q" ;; rx) _cmd=$RZ" -q -X" ;; ry) _cmd=$RZ" -q -g" ;; rz) _cmd=$RZ" -q" ;; crc) _opt="$_opt -c" ;; crc16) _opt="$_opt -o" ;; 1k) _opt="$_opt -k" ;; 4k) _opt="$_opt -4" ;; 8k) _opt="$_opt -8" ;; turbo) _opt="$_opt -T" ;; r_can_2k) ;; r_can_4k) ;; r_can_8k) ;; *) echo "" ; return ;; esac done echo $_cmd $_opt return ;; lrzsz_old) shift _cmd= _opt= for _i in $* ; do case "$_i" in sx) _cmd=~/bin/lrzsz-0.12.21rc/lsz" -q --xmodem" ;; ry) _cmd=~/bin/lrzsz-0.12.21rc/lsz" -q --ymodem" ;; sz) _cmd=~/bin/lrzsz-0.12.21rc/lsz" -q" ;; rx) _cmd=~/bin/lrzsz-0.12.21rc/lrz" -q --xmodem" ;; ry) _cmd=~/bin/lrzsz-0.12.21rc/lrz" -q --ymodem" ;; rz) _cmd=~/bin/lrzsz-0.12.21rc/lrz" -q" ;; crc) _opt="$_opt -c" ;; crc16) _opt="$_opt -o" ;; 1k) _opt="$_opt -k" ;; 4k) _opt="$_opt -4" ;; 8k) _opt="$_opt -8" ;; turbo) _opt="$_opt -T" ;; r_can_2k) ;; r_can_4k) ;; r_can_8k) ;; *) echo "" ; return ;; esac done echo $_cmd $_opt return ;; rzsz373) shift _cmd= _opt= for _i in $* ; do case "$_i" in sx) _cmd=~/bin/rzsz373/sx ;; sy) _cmd=~/bin/rzsz373/sb ;; sz) _cmd=~/bin/rzsz373/sz ;; rx) _cmd=~/bin/rzsz373/rx ;; ry) _cmd=~/bin/rzsz373/rb ;; rz) _cmd=~/bin/rzsz373/rz ;; crc16) _opt="$_opt -o" ;; 1k) _opt="$_opt -k" ;; *) echo "" ; return ;; esac done echo $_cmd $_opt return; ;; crzsz) shift _cmd= _opt= for _i in $* ; do case "$_i" in sx) _cmd=~/bin/crzsz/csx ;; sy) _cmd=~/bin/crzsz/csb ;; sz) _cmd=~/bin/crzsz/csz ;; rx) _cmd=~/bin/crzsz/crx ;; ry) _cmd=~/bin/crzsz/crb ;; rz) _cmd=~/bin/crzsz/crz ;; crc16) _opt="$_opt -o" ;; 1k) _opt="$_opt -k" ;; *) echo "" ; return ;; esac done echo $_cmd $_opt return; ;; zmtxzmrx2) shift _cmd= for _i in $* ; do case "$_i" in r_can_2k) ;; r_can_4k) ;; r_can_8k) ;; sz) _cmd=~/bin/zmtx-zmrx-2.06/zmtx ;; rz) _cmd=~/bin/zmtx-zmrx-2.06/zmrx" -q" ;; *) echo "" ; return ;; esac done echo $_cmd return; ;; sexyz) shift _cmd=~/bin/sexyz-3.6 _post=~/bin/sexyz-3.6 for _i in $* ; do case "$_i" in r_can_2k) ;; r_can_4k) ;; r_can_8k) ;; 8k) _cmd="$_cmd -8" ;; 4k) _cmd="$_cmd -4" ;; 2k) _cmd="$_cmd -2" ;; 1k) _cmd="$_cmd -k" ;; crc) _cmd="$_cmd -c" ;; crc16) _cmd="$_cmd -o" ;; segmented) _cmd="$_cmd -s" ;; sz) _post="sz" ;; rz) _post="rz" ;; sy) _post="sy" ;; ry) _post="ry" ;; sx) _post="sx" ;; rx) _post="rx" ;; *) echo "" ; return ;; esac done echo $_cmd $_post return ;; esac } # bandwidth(g|m|k|nothing)-delay(ms|nodelay)-errorfree|faulty translate_profile() { if test "$1" = "unlimited" ; then part1="unlimited"; part2="nodelay"; part3="errorfree"; else part1="${1%%-*}" rest="${1#*-}" part2="${rest%%-*}" part3="${rest#*-}" fi __purenum=$(echo $part1 | sed 's/[kmg]$//') case "$part1" in unlimited) __s="" __limit=15000000000 ;; *g) # gigabit __s="-r $part1" __limit=$(expr $__purenum '*' 50000000) ;; *m) # megabit __s="-r $part1" __limit=$(expr $__purenum '*' 500000) ;; *k) # kilobit __s="-r $part1" __limit=$(expr $__purenum '*' 500) ;; [0-9]*) __s="-r $part1" __limit=$(expr $__purenum '/' 2) if test "$part1" = 38400 ; then __limit=$(expr $__limit '*' 2) # avoid a pathological case fi ;; esac case "$part2" in 0) __d="" ;; *ms) # gigabit __purenum=$(echo $part2 | sed 's/ms$//') __d="-L $part2" ;; esac if test "$part3" = faulty ; then __limit=$(expr $__limit / 2) fi __sz=0 __a="" for __i in $all_256_file $binary_2k $binary_4k $binary_8k $binary_16k $binary_32k $binary_64k $binary_128k $binary_256k \ $binary_512k $binary_1m $binary_2m $binary_4m $binary_8m $binary_16m; do __t=$(totalsize $__i); __sz=$(expr $__sz + $__t) if test $__sz -gt $__limit ; then break fi __a="$__a $__i" #echo "after $__i with $__t is __sz=$__sz while __limit is $__limit" >&2 done case "$part3" in errorfree) __e="" ;; faulty) ts=$(totalsize $__a); errornum=$(expr $ts / 10) __e="-F $errornum -e1" ;; esac if test "$__s$__d$__e" = ""; then echo "" else echo "$SIMU -s 1 $__s $__d $__e" fi echo "$__a" } zbenchmark() { available=$(available) if false ; then for sender in $available ; do echo "sender $sender sz =" $(config $sender sz) echo "receiver $sender rz =" $(config $sender rz) echo "sender $sender sz 4k =" $(config $sender sz 4k) echo "receiver $sender rz r_can_4k =" $(config $sender rz r_can_4k) done return fi # note: with the line simulator between sz and rz the # possible speed is limited by the linesimulator, which # has overhead. # # profiles: # unlimited = pipe # 100m-0ms-errorfree = local ethernet # 100m-5ms-errorfree = fast net, 500km. # 10m-9ms-errorfree = hamburg-münchen # 10m-50ms-errorfree = düsseldorf-ankara # 1m-250ms-errorfree = düsseldorf-sydney # 115200-0ms-errorfree = lokale serielle # 115200-0ms-faulty = fehlerhafte lokale serielle # 115200-20ms-errorfree = 2000km modemverbindung # 115200-20ms-faulty = fehlerhafte 2000km modemverbindung # 38400-0ms-errorfree = langsamere serielle # 38400-0ms-faulty = langsamere serielle profiles="unlimited 100m-0ms-errorfree 100m-5ms-errorfree 10m-9ms-errorfree 10m-50ms-errorfree 1m-250ms-errorfree 115200-0ms-errorfree 115200-0ms-faulty 115200-20ms-errorfree 115200-20ms-faulty" # for speed in unlimited 100m 10m 2m 1m 115200 38400 25ms 20ms 15ms 10ms 5ms 2ms; do # profiles=unlimited TIMEOUT_VALUE=180 # The sniffer must stay out of benchmark runs: its per-frame stderr # logging both distorts the numbers being measured and perturbs the # byte-flow timing enough to trigger retransmit storms in fragile # senders. An ONLY= filtered benchmark would otherwise silently # change what is being measured. NOSNIF=1 export NOSNIF for profile in $profiles; do # FAULT=$(translate_profile $profile) translate_profile $profile > profile_tmp { read FAULT; read all_binaries; } < "profile_tmp" #echo "FAULT=$FAULT" #echo "all_binaries=$all_binaries" # $all_binaries is also set for kparm in "" 2k 4k 8k ; do for sender in $available ; do for receiver in $available ; do # blacklist of known problem combos case "$sender-$receiver" in zmtxzmrx2-crzsz|zmtxzmrx2-rzsz373) # CRC, ERROR, TIMEOUTs continue; ;; esac TEST_S=$(config $sender sz $kparm) if test -z "$TEST_S" ; then continue ; fi t="" kdisplay="$kparm" if test -z "$kdisplay" ; then kdisplay="1k" fi if test -n "$kparm" ; then t="r_can_$kparm" fi TEST_R=$(config $receiver rz $t) if test -z "$TEST_R" ; then continue ; fi t="1k" if test -n "$kparm" ; then t="$kparm" fi key="zmodem-$sender-$receiver-benchmark-$kdisplay-$profile" doit "$key" "$sender sending multiple files to $receiver" "$TEST_S" "$TEST_R" cmp "$all_binaries" done done done done unset NOSNIF } zbenchmark2() { available=$(available) if false ; then for sender in $available ; do echo "sender $sender sz =" $(config $sender sz) echo "receiver $sender rz =" $(config $sender rz) echo "sender $sender sz 4k =" $(config $sender sz 4k) echo "receiver $sender rz r_can_4k =" $(config $sender rz r_can_4k) done return fi for speed in unlimited 100m 10m 2m 1m 115200 38400 25ms 20ms 15ms 10ms 5ms 2ms; do case "$speed" in 2ms) all_binaries="$all_256_file $binary_4k $binary_16k $binary_32k $binary_256k" ;; 5ms) all_binaries="$all_256_file $binary_8k $binary_16k $binary_64k" ;; 10ms) all_binaries="$all_256_file $binary_8k $binary_32k" ;; 15ms) all_binaries="$all_256_file $binary_8k $binary_16k" ;; 20ms) all_binaries="$all_256_file $binary_4k $binary_16k" ;; 25ms) all_binaries="$all_256_file $binary_2k $binary_16k" ;; *ms) all_binaries="$all_256_file $binary_4k $binary_16k $binary_128k $binary_256k" ;; 38400) all_binaries="$all_256_file $binary_2k $binary_8k " ;; 115200) all_binaries="$all_256_file $binary_2k $binary_4k $binary_8k $binary_16k" ;; 1m) all_binaries="$all_256_file $binary_2k $binary_4k $binary_8k $binary_16k $binary_256k" ;; 2m) all_binaries="$all_256_file $binary_2k $binary_4k $binary_8k $binary_16k $binary_256k $binary_512k";; 10m) all_binaries="$all_256_file $binary_2k $binary_4k $binary_8k $binary_16k $binary_32k $binary_64k $binary_128k $binary_256k $binary_512k $binary_2m" ;; 100m) all_binaries="$all_256_file $binary_2k $binary_4k $binary_8k $binary_16k $binary_32k $binary_64k $binary_128k $binary_256k $binary_2m $binary_4m" ;; *) all_binaries="$all_256_file $binary_4k $binary_16k $binary_128k $binary_256k $binary_1m $binary_8m" ;; esac ts=$(totalsize $all_binaries); errornum=$(expr $ts / 10) for kparm in "" 2k 4k 8k ; do for sender in $available ; do for receiver in $available ; do TEST_S=$(config $sender sz $kparm) if test -z "$TEST_S" ; then continue ; fi t="" if test -n "$kparm" ; then t="r_can_$kparm" fi TEST_R=$(config $receiver rz $t) if test -z "$TEST_R" ; then continue ; fi case "$speed" in unlimited) FAULT="" ;; *ms) FAULT="$SIMU -s 1 -d $speed -b 128" ;; *) FAULT="$SIMU -s 1 -r $speed" ;; esac #echo "FAULT=$FAULT for $speed" t="1k" if test -n "$kparm" ; then t="$kparm" fi key="zmodem-$sender-$receiver-benchmark-$speed-$t" doit "$key" "$sender sending multiple files to $receiver" "$TEST_S" "$TEST_R" cmp "$all_binaries" F="$FAULT" if test -z "$F" ; then F="$SIMU "; fi FAULT="$F -s 1 -f $errornum -e1" key="zmodem-$sender-$receiver-benchmark-$speed-$t-fault" doit "$key" "$sender sending multiple files to $receiver (faulty line)" "$TEST_S" "$TEST_R" cmp "$all_binaries" done done done done } zmanage() { # this is deliberatly limited to lrzsz alone. # - zmtx only implements newer, clobber and protect. # - crzsz implements most or all, but crz doesn't have options for them (csz has). # i decided against testing against other zmodems here, because # a) interoperability shouldn't be a problem (all these are just header flags) # b) i would need three flags (in the already long list above) per management option: # -- "senders XXX option." # -- "receivers XXX option." # -- "receiver can handle XXX, if the sender initializes it." # multiply that by CRC, NEW, NEWL, APND, CLOB, DIFF, PROT, CHNG… # c) i'd bet there are logical differences in the implementations. # notes: # - ZMDIFF isn't implemented anywhere. # - ZMCRC has to be tested as part of the resume handling, too. # first check the defaults # - lrz does create a not existing target. # - lrz does NOT overwrite an existing file without a ZMCLOB key="zmodem-lsz-lrz-MGMT-default-nonexisting" doit "$key" "lsz sending to lrz does create file" "$SZ -q" "$RZ -q" "$testdir/$key/all256.bin" $all_256_file # check the opposite: a file of the same name and the same size is not overwritten key="zmodem-lsz-lrz-MGMT-default-existing" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/16k.bin # this one is smaller touch -d 2001-02-03T04:05:06.07 $testdir/16k.bin # this one is old. cp $testdir/$key/16k.bin $testdir/$key/cmp doit "$key" "lsz sending to lrz does not overwrite existing file" "$SZ -q" "$RZ -q" "$testdir/$key/cmp" $binary_16k # # test ZMNEW (5), ZMNEWL (1) # ZMNEWL is only partially tested (size), as it falls through to ZMNEW. # key="zmodem-lsz-lrz-MGMT-ZMNEW-fail-s" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/test.bin cp $binary_16k $testdir/test.bin touch -d 2001-02-03T04:05:06.07 $testdir/test.bin # this one is old. doit "$key" "lsz sending to lrz fails (sender initialized)" "$SZ -q -n" "$RZ -q" $all_256_file "$testdir/test.bin" key="zmodem-lsz-lrz-MGMT-ZMNEW-success-s" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/test.bin touch -d 2001-02-03T04:05:06.07 $testdir/$key/test.bin # this one is old. cp $binary_16k $testdir/test.bin doit "$key" "lsz sending to lrz succeeds (sender initialized)" "$SZ -q -n" "$RZ -q" $binary_16k "$testdir/test.bin" key="zmodem-lsz-lrz-MGMT-ZMNEWL-succes-s" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/test.bin cp $binary_16k $testdir/test.bin touch -d 2001-02-03T04:05:06.07 $testdir/test.bin # this one is old. doit "$key" "lsz sending to lrz succeeds (sender initialized)" "$SZ -q -N" "$RZ -q" $binary_16k "$testdir/test.bin" key="zmodem-lsz-lrz-MGMT-ZMNEW-fail-r" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/test.bin cp $binary_16k $testdir/test.bin touch -d 2001-02-03T04:05:06.07 $testdir/test.bin # this one is old. doit "$key" "lsz sending to lrz fails (receiver initialized)" "$SZ -q" "$RZ -q -n" $all_256_file "$testdir/test.bin" key="zmodem-lsz-lrz-MGMT-ZMNEW-success-r" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/test.bin touch -d 2001-02-03T04:05:06.07 $testdir/$key/test.bin # this one is old. cp $binary_16k $testdir/test.bin doit "$key" "lsz sending to lrz succeeds (receiver initialized)" "$SZ -q" "$RZ -q -n" $binary_16k "$testdir/test.bin" key="zmodem-lsz-lrz-MGMT-ZMNEWL-success-r" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/test.bin cp $binary_16k $testdir/test.bin touch -d 2001-02-03T04:05:06.07 $testdir/test.bin # this one is old, but longer doit "$key" "lsz sending to lrz fails (receiver initialized)" "$SZ -q" "$RZ -q -N" $binary_16k "$testdir/test.bin" # # ZMCRC (2) # # first we check that lrz without -H somewhere does keep the modified file. key="zmodem-lsz-lrz-MGMT-noZMCRC-s" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/ printf '\x41' | dd of=$testdir/$key/all256.bin bs=1 seek=32 conv=notrunc 2>&5 cp $testdir/$key/all256.bin $testdir/$key/cmp doit "$key" "lsz sending to lrz does not overwrite (sender initialized)" "$SZ -q" "$RZ -q" "$testdir/$key/cmp" $all_256_file key="zmodem-lsz-lrz-MGMT-ZMCRC-s" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/ printf '\x41' | dd of=$testdir/$key/all256.bin bs=1 seek=32 conv=notrunc 2>&5 doit "$key" "lsz sending to lrz overwrites (sender initialized)" "$SZ -qH" "$RZ -q" cmp $all_256_file key="zmodem-lsz-lrz-MGMT-ZMCRC-r" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/ printf '\x41' | dd of=$testdir/$key/all256.bin bs=1 seek=32 conv=notrunc 2>&5 doit "$key" "lsz sending to lrz overwrites (receiver initialized)" "$SZ -q" "$RZ -q -H" cmp $all_256_file # # ZMAPND (3) # receiver appends to the target, if it exists # the doc does not specify if the target shall be created if it doesn't exists, # but in practice it is (the 1988s code changed the fopen mode from "w" to "a", and omen also does this). # key="zmodem-lsz-lrz-MGMT-ZMAPND-s" mkdir $testdir/$key 2>/dev/null|| true cp $srcdir/src/Makefile.in $testdir/$key/lsz.c cat $srcdir/src/Makefile.in $srcdir/src/lsz.c >>$testdir/$key/cmp doit "$key" "ZMODEM/MGMT/ZMAPND: lsz sending to $other" "$SZ -q -+" "$RZ -q" "$testdir/$key/cmp" $srcdir/src/lsz.c key="zmodem-lsz-lrz-MGMT-ZMAPND-r" mkdir $testdir/$key 2>/dev/null|| true cp $srcdir/src/Makefile.in $testdir/$key/lsz.c cat $srcdir/src/Makefile.in $srcdir/src/lsz.c >>$testdir/$key/cmp doit "$key" "ZMODEM/MGMT/ZMAPND: $othersz sending to lrz" "$SZ" "$RZ -q -+" "$testdir/$key/cmp" $srcdir/src/lsz.c # # ZMCLOB (4) # we check in the ZMCRC test that the file would normally be skipped. # key="zmodem-lsz-lrz-MGMT-ZMCLOB-s" mkdir "$testdir/$key" printf '\x41' | dd of=$testdir/$key/all256.bin bs=1 seek=32 conv=notrunc 2>&5 doit "$key" "lsz -y sending to lrz (sender initialized)" "$SZ -q -y" "$RZ -q" "$all_256_file" $all_256_file key="zmodem-lsz-lrz-MGMT-ZMCLOB-r" mkdir "$testdir/$key" printf '\x41' | dd of=$testdir/$key/all256.bin bs=1 seek=32 conv=notrunc 2>&5 doit "$key" "lsz sending to lrz -y (receiver initialized)" "$SZ -q" "$RZ -q -y" "$all_256_file" $all_256_file # # ZMDIFF (6) # Transfer file if destination file absent. Otherwise, transfer file # overwriting destination if files have different lengths or dates. # This is not implemented anywhere, not even in crzsz # # # ZMPROT (7) # key="zmodem-lsz-lrz-MGMT-ZMPROT-s" mkdir "$testdir/$key" touch $testdir/$key/all256.bin touch $testdir/$key/null doit "$key" "lsz sending to lrz (sender initialized)" "$SZ -q -p" "$RZ -q" "$testdir/$key/null" $all_256_file key="zmodem-lsz-lrz-MGMT-ZMPROT-r" mkdir "$testdir/$key" touch $testdir/$key/all256.bin touch $testdir/$key/null doit "$key" "lsz sending to lrz (receiver initialized)" "$SZ -q" "$RZ -q -p" "$testdir/$key/null" $all_256_file # # ZMCHNG (8) # key="zmodem-lsz-lrz-MGMT-ZMCHNG-s" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/ doit "$key" "lsz sending to lrz (sender initialized)" "$SZ -q -E" "$RZ -q" "$testdir/$key/all256.bin.0" $all_256_file key="zmodem-lsz-lrz-MGMT-ZMCHNG-r" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/ doit "$key" "lsz sending to lrz (received initialized)" "$SZ -q" "$RZ -q -E" "$testdir/$key/all256.bin.0" $all_256_file # -E with two pre-existing collision names: must escalate to .1 key="zmodem-lsz-lrz-MGMT-ZMCHNG-escalate" mkdir "$testdir/$key" cp $all_256_file $testdir/$key/all256.bin cp $all_256_file $testdir/$key/all256.bin.0 doit "$key" "lsz -E sending to lrz picks all256.bin.1 when .0 is taken" "$SZ -q -E" "$RZ -q" "$testdir/$key/all256.bin.1" $all_256_file # there also is this: # define ZF1_ZMSKNOLOC 0x80 /* Skip file if not present at rx */ (alternatively written as ZF1ZMSKNOLOC) # lrzsz sets this if lsz is given the -Y (overwrite or skip) option. key="zmodem-lsz-lrz-MGMT-ZMSKNOLOC-nonexisting" doit "$key" "lsz sending to lrz does not create file if does not exist" "$SZ -q -Y" "$RZ -q" "missing" $all_256_file key="zmodem-lsz-lrz-MGMT-ZMSKNOLOC-existing" mkdir "$testdir/$key" touch $testdir/$key/all256.bin doit "$key" "lsz sending to lrz does update file if it does exist" "$SZ -q -Y" "$RZ -q" "$all_256_file" $all_256_file # # file modes sent by the sender must not widen the received file's # permissions: lrz forces umask 0077 at creation time, and closeit() # must not undo that with chmod(). # key="zmodem-lsz-lrz-MGMT-mode-0666" mkdir "$testdir/$key" cp $all_256_file $testdir/mode666.bin chmod 666 $testdir/mode666.bin doit "$key" "lsz sending 0666 file to lrz keeps group/other bits off" "$SZ -q" "$RZ -q" mode_cmp $testdir/mode666.bin key="zmodem-lsz-lrz-MGMT-mode-0777" mkdir "$testdir/$key" cp $all_256_file $testdir/mode777.bin chmod 777 $testdir/mode777.bin doit "$key" "lsz sending 0777 file to lrz keeps group/other bits off" "$SZ -q" "$RZ -q" mode_cmp $testdir/mode777.bin x # # sanity check: closeit() must never leave the owner without read/ # write access to their own uploaded file, no matter what mode bits the # sender chose (the ZFILE field carries the full st_mode; lsz sends it # too, so mode 0100406 = S_IFREG|0406 reaches lrz verbatim). Old code # chmod'ed to (mode&0777)&~umask = 0400 here — the reported worst case # 0100006 (= S_IFREG|0006) even produced 0000: the owner locked out of # their own upload. closeit() now ORs in owner read/write. A source # with mode 0006 cannot be exercised directly (lsz could not open it, # owner has no read), so 0406 (owner r, no owner w) is used: the write # bit must come from the |0600 clamp, and group/other must stay masked. # key="zmodem-lsz-lrz-MGMT-mode-0406" mkdir "$testdir/$key" cp $all_256_file $testdir/mode0406.bin chmod 0406 $testdir/mode0406.bin mode_owner_rw_cmp() { if cmp "$1" "$2" >&5 ; then : else echo "-- files differ" return 1 fi case $(ls -l "$2" | cut -c2-4) in rw-) ;; *) echo "-- received file lacks owner rw: $(ls -l "$2" | cut -c1-10)" return 1 ;; esac case $(ls -l "$2" | cut -c5-10) in ------) ;; *) echo "-- received file has group/other permission bits set: $(ls -l "$2" | cut -c1-10)" return 1 ;; esac } doit "$key" "lsz sending a 0406-mode file leaves the owner rw-" "$SZ -q" "$RZ -q" mode_owner_rw_cmp $testdir/mode0406.bin # # A sender's pathnames must never escape the receiving directory: # checkpath() rejects traversing names, safe_open() confines resolution # to the CWD. The canaries live outside $key (the receiving directory); # a pristine copy makes "canary modified" detectable even if the attacker # (a buggy lrz) merely rewrites the file with the same size. # # Note: the sender runs with cwd=$testdir, the receiver with cwd=$key. # To make lsz transmit a name that lrz would have to resolve upwards, # the sender is wrapped so its cwd is $key, too — the source then is # "../escape-target.bin" (= the canary) and -f makes lsz transmit that # literal name. key="zmodem-lsz-lrz-MGMT-traversal-dotdot" mkdir "$testdir/$key" cp $all_256_file $testdir/escape-target.bin # canary == sender's source cp $all_256_file $testdir/escape-target.pristine # sender with cwd=$key: lsz must open ../escape-target.bin and, with -f, # transmits that literal name. doit() expands $sz unquoted, so we cannot # nest shell quotes here; generate a small wrapper script instead. cat > $testdir/run-traversal-sender.sh <>$testdir/failures.log any_failure="$any_failure $key" fi rm -f $testdir/escape-target.pristine # A symlinked directory inside the receiving directory must not redirect # file creation out of the CWD (safe_open()'s openat walk: ELOOP). key="zmodem-lsz-lrz-MGMT-traversal-symlink" mkdir "$testdir/$key" mkdir "$testdir/sub" cp $all_256_file $testdir/sub/escape-target.bin cp $all_256_file $testdir/escape-target.pristine ln -s .. $testdir/$key/sub # the receiver refuses via safe_open() ELOOP -> clean ZSKIP path: # both sides are expected to exit 0 (no opt-out needed). doit "$key" "lsz sending sub/escape-target.bin through a symlinked dir must fail" \ "$SZ -q -f sub/escape-target.bin" "$RZ -q" missing sub/escape-target.bin if cmp -s $testdir/sub/escape-target.bin $testdir/escape-target.pristine ; then : else echo "$key: canary outside the receiving directory was modified" echo "summary: $key FAILED (canary modified)" >>$testdir/failures.log any_failure="$any_failure $key" fi rm -f $testdir/escape-target.pristine # # resume with a local file LONGER than the source: resume is impossible, the receiver must # retransmit from 0 and TRUNCATE. Without truncation the received file keeps a stale tail # (which was a bug in lrzsz<0.13). # key="zmodem-lsz-lrz-RESUME-shrink" mkdir "$testdir/$key" dd if=$srcdir/src/lsz.c of=$testdir/lsz-shrunk.bin bs=256 count=5 2>&5 # 1280 bytes cp $testdir/lsz-shrunk.bin $testdir/$key/lsz-shrunk.bin dd if=$srcdir/src/lsz.c bs=1 skip=3000 count=200 >>$testdir/$key/lsz-shrunk.bin 2>&5 # longer! doit "$key" "resuming with a shorter source must truncate the stale tail" \ "$SZ -rq" "$RZ -q" cmp $testdir/lsz-shrunk.bin rm -f $testdir/lsz-shrunk.bin # # -D / --null in XMODEM mode: the received data goes to /dev/null, # no file with the given pathname may be created. # Since -D actually opens /dev/null again (formerly rejected by # safe_open_fd's blanket absolute-path ban), the receiver accepts the # whole transfer, answers the EOT, and both sides exit 0. The verdict # is the missing file. # # -c on the receiver only: plain lsz -X always sends CRC-format # sectors (lsz has no XMODEM checksum flag; -c is the removed # ZCOMMAND mode there), so lrz must ask for CRC via -c (Crcflg). # Without it lrz would send NAK requesting checksum mode, get CRC # blocks, fail them, and cancel the first sector. # # The receiver gets a (never-created) filename argument: XMODEM has # no filename on the wire, and lrz's XMODEM branch uses one from the # command line. Without any, `argc==0` makes wcreceive run the # ZMODEM tryz handshake and then the YMODEM pathname loop - which # consumes the first data sector as "pathname" and cancels the # transfer. -D still discards the data to /dev/null regardless. key="xmodem-lrz-null" mkdir "$testdir/$key" doit "$key" "xmodem lrz -D does not create the file" \ "$SZ -q -X" "$RZ -q -b -X -c -D payload.bin" "missing" $all_256_file # # long ZFILE subpacket (V10): a filename near the 960-byte name limit # must produce a ZFILE data subpacket that still stays within the # 1024-byte limit after the metadata suffix is appended, and must be # receivable by lrz (whose buffer is 8192, so this tests the sender # side budget only — a truncated metadata suffix is acceptable). # key="zmodem-lsz-lrz-ZFILE-longname" mkdir "$testdir/$key" # A ZFILE name near the 960-byte wire limit: single components are limited # to 255 bytes by the filesystem, so build a deep path instead (each # component 80 chars, ~900 bytes total). With -f, lsz transmits the whole # relative path as the file name; lrz must accept it and create the # directory levels via its mkdirat walk. The subpacket total (name + # metadata suffix) must stay within the 1024-byte limit (V10). # The SOURCE tree lives OUTSIDE $key (in a sibling "-src" tree): doit() # removes $key on success before its byte-count loop stats the file. deepname=$key-src for i in 1 2 3 4 5 6 7 8 9 10 11; do deepname=$deepname/$(printf 'd%.0s' $(seq 1 79))$i done deepname=$deepname/payload.bin mkdir -p "$testdir/$(dirname "$deepname")" cp $all_256_file "$testdir/$deepname" longname_cmp() { # $1 = relative source path (ignored), $2 = received file cmp "$testdir/$deepname" "$testdir/$key/$deepname" } doit "$key" "lsz sends a ~900-char deep path as filename" \ "$SZ -q -f" "$RZ -q" longname_cmp "$deepname" rm -rf "$testdir/$key-src" # # very restricted mode: an existing non-hidden file must not be overwritten, neither with # ZMODEM_RESTRICTED set nor with -R on top of it. (The old code clamped neither, so when # both were set, it resulted in level 3, which skipped the overwrite check). The overwrite # would actually happen only with -y (ZMCLOB) — very restricted mode must refuse it, where # plain restricted mode politely skips. The victim has distinctive content, so a buggy # overwrite is detectable via cmp. # key="zmodem-lsz-lrz-MGMT-veryrestricted" mkdir "$testdir/$key" dd if=$srcdir/src/lsz.c of=$testdir/newfile.bin bs=256 count=3 2>&5 cp $testdir/newfile.bin $testdir/$key/newfile.bin # the victim # receiver 127 is bibi(-1) by design (see the traversal test for the # theoretical receiver-141 variant); sender 141 is the same teardown # race mirrored: if lrz's refusal arrived while lsz was writing, lsz # died of SIGPIPE in its cancel path. doit "$key" "ZMODEM_RESTRICTED + -R + -y refuses to overwrite existing file" \ "$SZ -q -y" "env ZMODEM_RESTRICTED=1 $RZ -q -R -y" cmp $testdir/newfile.bin 128,141 127 doit "$key" "ZMODEM_RESTRICTED + -y refuses to overwrite existing file" \ "$SZ -q -y" "env ZMODEM_RESTRICTED=1 $RZ -q -y" cmp $testdir/newfile.bin 128,141 127 # # -U/--unrestrict was removed: both programs must print the removal # message and exit nonzero, without touching the protocol stream. # Checked directly (no transfer): the receiver wrapper exits immediately, # so the sender side is a short-lived no-op, not a protocol peer. # key="zmodem-lsz-lrz-MGMT-U-removed" mkdir "$testdir/$key" u_removed_rc=0 for u_prog in $SZ $RZ ; do $u_prog -U >$testdir/$key/u.out 2>$testdir/$key/u.err && u_removed_rc=1 grep -q "has been removed" $testdir/$key/u.err || u_removed_rc=1 $u_prog --unrestrict >$testdir/$key/u.out 2>$testdir/$key/u.err && u_removed_rc=1 grep -q "has been removed" $testdir/$key/u.err || u_removed_rc=1 done if test $u_removed_rc = 0 ; then echo "filecheck-success: $key (-U and --unrestrict rejected by both programs)" >>$runlog else echo "filecheck-fail: $key (-U/--unrestrict not handled as removed)" >>$runlog echo "summary: $key FAILED" >>$testdir/failures.log any_failure="$any_failure $key" fi # --keep-incomplete: an aborted transfer must DELETE the partial file by # default and KEEP it with --keep-incomplete. The '-s +1' aborts after # 1-2 seconds, and since the file is large and the (simulated) line is # slow, the transfer is incomplete. # We ignore exit 128 (deadline reached) and 141 (sigpipe), because the # test is racy. # The real verdicts are the cmp functions (delete vs keep). key="zmodem-lsz-lrz-MGMT-keep-incomplete" mkdir "$testdir/$key" FAULT="$SIMU -s 1 -f 9999999999 -r 1m" doit "$key-delete-default" "aborted transfer deletes the incomplete file" \ "$SZ -q -Z" "$RZ -q -Z -s +1" missing $binary_1m 128,141 128,141 doit "$key-keep" "aborted transfer keeps the incomplete file with --keep-incomplete" \ "$SZ -q -Z" "$RZ -q -Z --keep-incomplete -s +1" incomplete_keep_cmp $binary_1m 128,141 128,141 FAULT= # SIGINT during a ZMODEM send: the sender gets ^C mid-stream (a # backgrounded waiter signals it as soon as the data phase is truly # underway) while a throttled line keeps the transfer busy. lsz must # resync with the receiver and complete the transfer anyway (the # onintr/intrjmp machinery). Interrupt timing makes the counters # nondeterministic, so this key must not be part of any # journal-counter baseline. # # Careful when changing: This is a jungle of incompatibilities. # # The waiter signals the sender via a pid file, not $PPID: shells do # not re-evaluate $PPID inside a subshell (dash on Linux, OpenBSD ksh, # bash), so there it still holds the *script's* parent — here the # timeout(1) wrapper. # Signaling that wrapper had inconsistent results: # - GNU timeout happens to forward a caught SIGINT to the child # (which made Linux pass by accident), # - OpenBSD's timeout does setpgid(0,0) + killpg with SIGTERM, # killing the transfer via the bibi handler. # The sender runs under "timeout --foreground" so a stray signal is # forwarded to the child instead of a process group kill. The long # option is used because GNU coreutils uses -f for --kill-after. # yes, OpenBSD implements the long option. key="zmodem-lsz-lrz-sigint" mkdir "$testdir/$key" cat > $testdir/run-sigint-sender.sh <.lsz-pid # ^C the sender once the data phase is truly underway: the receiver has # written at least one byte to the partial file, which can only happen # after lsz entered zsendfdata() and installed the resync SIGINT handler. # Bounded to ~8s so a dead peer cannot stall the test. ( n=0 while test \$n -lt 40 && test ! -s binary_1m ; do sleep 0.2 n=\`expr \$n + 1\` done read -r pid <.lsz-pid kill -INT \$pid ) & # ignore the arguments doit() appends; send the 1 MiB payload by basename exec $SZ -q -Z ../binary_1m SEOF chmod +x $testdir/run-sigint-sender.sh FAULT="$SIMU -s 1 -f 9999999999 -r 1m" TIMEOUT_FLAGS="--foreground" doit "$key" "^C mid-stream must resync and complete the transfer" \ "$testdir/run-sigint-sender.sh" "$RZ -q -Z" cmp $binary_1m FAULT= TIMEOUT_FLAGS="" } zpacketloss() { # # Packetized lines with silent packet loss. The historical trigger was # isdn4linux/X.75i in 1998 (see README.isdn4linux): frames larger than # the configured packet size silently vanish. isdn4linux is gone # (Linux 5.15 removed the tty emulation), but the failure class — a # packetized line silently losing whole N-byte packets, in the data # and/or the ack direction — is a general one, and the only acceptable # outcome is: the transfer completes (data intact), or a side aborts # in bounded time. What may NEVER happen is the lsz "seems to stop" # silent stall. doit()'s timeout + exit-status machinery turns a hang # into a failure, so these tests are that regression check. # # -P N: silently drop exactly N bytes per event; -F N: exactly one # event per N bytes (deterministic with -s 1); -r 8m keeps the # overhead-dominated run fast. Payload is binary_256k: ZMODEM pays # one full resync per dropped packet, so ~12% loss (the literal 1998 # scenario) makes even 256k crawl well past doit()'s 35s budget — # the calibration below (~6% loss on 256k) matches the zerrors # suite's loss-per-file-size ratio and exercises the same machinery # within the budget. Heavier loss belongs in a manual benchmark run. # # Budget: 100s, not the default 35s. On a lossy line a resync storm # (duplicate ZRPOS answered, stale ZDATA discarded, a subpacket # terminator eaten by a drop) costs ~10s per event — both sides # legitimately wait for each other until the receiver's retry breaks # the tie. Runs therefore quantize to 10s steps; 0-3 storms are # normal (measured: max 45s pre-fix, max 31s after lrz learned to # swallow stale ZDATA and re-request ZDATA quickly). 100s leaves # generous headroom on slow machines while a hang (exit 124) stays # a failure. TIMEOUT_VALUE=100 # packetized but errorfree line: pacing alone (X.75-style framing # flavor) must never stall the sender. key="zmodem-lsz-lrz-packetline" FAULT="$SIMU -s 1 -r 8m -b 1024 -d 5" doit "$key" "lsz sending to lrz, packetized line (1024 byte blocks, 5ms)" \ "$SZ -q -Z" "$RZ -q -Z" cmp $binary_256k # ~6% silent packet loss, sender in integrity mode (--sync-transfer): a # dropped subframe is retransmitted by resync instead of silently shifting # the receiver. Plain streaming CANNOT detect the loss of a whole # subpacket (data + ZCRCx escape + CRC: no checksum breaks and the ZDATA # position is frame-anchored only), which corrupted completed files with # exit 0 here before. # The payload is 64k: with -F 16384 the loss frequency scales with the # wire length (~4 events instead of 16), so the test stays a quick # ~10s resync-proof instead of a 160s slog. lrz runs with -t 10 (its # minimum, 1s): in sync mode the sender waits anyway, the shortened # receiver wait only accelerates the resync turnaround; jitter-triggered # spurious ZRPOSes are self-healing (the ZDATA at the same position is # accepted). Real-world sync transfers keep the 10s default. key="zmodem-lsz-lrz-packetdrop" FAULT="$SIMU -s 1 -r 8m -P 1024 -F 16384" doit "$key" "lsz sending to lrz, ~4 silent packet drops (1k packets)" \ "$SZ -q -Z --sync-transfer" "$RZ -q -Z -t 10" cmp $binary_64k # the 1998 scenario shape: the sender insists on oversized (8k) # subpackets while packets keep dropping silently. key="zmodem-lsz-lrz-packetdrop-8k" doit "$key" "lsz -8 sending to lrz, ~4 silent packet drops (1k packets)" \ "$SZ -q -8 -Z --sync-transfer" "$RZ -q -Z -t 10" cmp $binary_64k # loss only in the ack direction: the sender's resync path must stay # bounded while its data gets through untouched. key="zmodem-lsz-lrz-packetdrop-acks" FAULT="$SIMU -s 1 -r 8m -P 1024 -F 16384 -2" doit "$key" "lsz sending to lrz, packet drops in ack direction only" \ "$SZ -q -Z" "$RZ -q -Z" cmp $binary_256k FAULT= } zrcdo() { # # RCDO (line gone: peer closed its end of the line, carrier lost) on # the RECEIVER side. The sender-side variants are covered by the # packetloss suite (linesimulator exits when its peer dies) and the # fuzzers' M_EOF class; these tests exercise lrz's verdict paths: # the receiver must abort promptly instead of burning its retry # budgets against a dead line — and must NOT fall back to a slower # protocol or re-handshake, because a reconnected line may carry an # unauthenticated peer (the calling program authenticated the # original one). # # Verdicts. The acceptable exits are 128 (lrz's ERROR exit, 0x80) # and 141 (SIGPIPE via lrz's bibi_sighandler): with the sender dead # and the pipe/FIFO write end gone, one of lrz's own writes (the # ZRINIT invitation or a cancel sequence) can hit EPIPE first — # which side of the abort sees it is a race. Death by SIGPIPE is # lrzsz's designed caught-signal exit here (see doit()'s comments); # what must NOT happen is a hang (exit 124 via doit()'s timeout) — # that would be the regression. # # The sender dies as soon as it is up: the wrapper writes its own # pid (which becomes lsz's pid via exec), then the killer (after a # short grace period so lsz is really the process holding the pid) # SIGKILLs it. lrz then sees the dead line either as RCDO or, # racing its own first write, as EPIPE/SIGPIPE — both bounded # aborts. PROTO carries the sender protocol flag (ZMODEM -Z / # YMODEM -g). The script is generated per test (key/PROTO must be # set), not once for the suite. FAULT="$SIMU -s 1 -f 9999999999 -r 1m" key="zmodem-lrz-sender-dies-start" mkdir "$testdir/$key" RCDO_PROTO=-Z cat > $testdir/run-rcdo-die-start.sh <.sz-pid ( sleep 0.3 if test -f .sz-pid ; then read -r pid <.sz-pid kill -KILL \$pid 2>/dev/null fi ) & exec $SZ -q $RCDO_PROTO ../binary_1m SEOF chmod +x $testdir/run-rcdo-die-start.sh doit "$key" "lrz must abort when the sender dies before/during the handshake" \ "$testdir/run-rcdo-die-start.sh" "$RZ -q -Z" missing $binary_1m 137 128,141 # same idea, YMODEM: the pathname fetch (wcrxpn/wcgetsec) must hit # the dead line and abort. key="ymodem-lrz-sender-dies-start" mkdir "$testdir/$key" RCDO_PROTO=-g cat > $testdir/run-rcdo-die-start.sh <.sz-pid ( sleep 0.3 if test -f .sz-pid ; then read -r pid <.sz-pid kill -KILL \$pid 2>/dev/null fi ) & exec $SZ -q $RCDO_PROTO ../binary_1m SEOF chmod +x $testdir/run-rcdo-die-start.sh doit "$key" "ymodem lrz must abort when the sender dies before the handshake" \ "$testdir/run-rcdo-die-start.sh" "$RZ -q -g" missing $binary_1m 137 128,141 RCDO_PROTO= FAULT= # sender dies mid-data-phase (SIGKILL once the receiver has written # at least one byte): the data-phase reads must surface RCDO and # abort instead of resyncing into the void. cmp=missing: the partial # file must have been removed (default delete-on-error). key="zmodem-lrz-sender-dies-mid" mkdir "$testdir/$key" cat > $testdir/run-rcdo-mid-sender.sh <.sz-pid ( n=0 while test \$n -lt 40 && test ! -s binary_1m ; do sleep 0.2 n=\`expr \$n + 1\` done read -r pid <.sz-pid kill -KILL \$pid ) & exec $SZ -q -Z ../binary_1m SEOF chmod +x $testdir/run-rcdo-mid-sender.sh FAULT="$SIMU -s 1 -f 9999999999 -r 1m" doit "$key" "lrz must abort when the sender dies mid-transfer" \ "$testdir/run-rcdo-mid-sender.sh" "$RZ -q -Z" missing $binary_1m 137 128,141 FAULT= # cleanup: doit() with cmp=missing leaves the (partial) file only # on failure; remove the leftover from the success paths rm -f $testdir/zmodem-lrz-sender-dies-mid/binary_1m 2>/dev/null } echo "mode=$mode" if test "$mode" = all -o "$mode" = xerrors -o "$mode" = "errors" -o "$mode" = "x" ; then xerrors fi if test "$mode" = all -o "$mode" = yerrors -o "$mode" = "errors" -o "$mode" = "y" ; then yerrors fi if test "$mode" = all -o "$mode" = zerrors -o "$mode" = "errors" -o "$mode" = "z" ; then zerrors fi if test "$mode" = all -o "$mode" = xcompat -o "$mode" = "compat" -o "$mode" = "x" ; then xcompat fi if test "$mode" = all -o "$mode" = ycompat -o "$mode" = "compat" -o "$mode" = "y" ; then ycompat fi if test "$mode" = all -o "$mode" = zcompat -o "$mode" = "compat" -o "$mode" = "z" ; then zcompat fi if test "$mode" = all -o "$mode" = zmanage -o "$mode" = "z" ; then zmanage fi if test "$mode" = all -o "$mode" = packetloss -o "$mode" = "p" ; then zpacketloss fi if test "$mode" = all -o "$mode" = rcdo -o "$mode" = "r" ; then zrcdo fi # not part of the normal self test, this is just too slow if test "$mode" = zbenchmark -o "$mode" = "benchmark" ; then zbenchmark fi if test "$mode" = zbuffer ; then # benchmark if the setvbuf default of 32768 is ok. # very special stuff, not a regular self check. zbuffer fi if test -s "$testdir/failures.log" ; then echo "Some tests failed. See $testdir/failures.log and $testdir/run.log" exit 1 fi echo "All primary tests passed.\n"; if test "$mode" = all -o "$mode" = abuse ; then if test -z "$ONLY" ; then echo "going to tests misuse. Errors are ok, hangs are not!" echo "both sides sending:" $SZ -q $binary_1m <$testdir/pipe | \ ($SZ -q $binary_1m >>$testdir/pipe ) echo "both sides receiving:" $RZ -q <$testdir/pipe | \ ( $RZ -q >>$testdir/pipe ) fi fi echo "All tests passed.\n"; exit 0 lrzsz-0.13.1/src/0000775000175000017500000000000015260431651007315 5lrzsz-0.13.1/src/timing.c0000664000175000017500000000354215260420160010665 /* 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" static double starttime; static int initialized = 0; static double timing_now(void) { /* CLOCK_MONOTONIC: durations (bps, ETA, min_bps watchdog) must not be * affected by NTP steps or date changes (zmodem-wip.txt uses wall * time only for the user-specified -s stop deadline, which timing.c * callers obtain via time(2) separately). */ struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { /* unreachable on POSIX-2008 systems */ return (double) time(NULL); } return ts.tv_sec + ts.tv_nsec/1000000000.0; } void timing_reset(void) { starttime = timing_now(); initialized = 1; } double timing_elapsed(void) { double yet = timing_now(); if (!initialized) { starttime = yet; initialized = 1; } return yet - starttime; } long timing_bps(double bytes) { double d = timing_elapsed(); if (d == 0) /* can happen on the very first call (zero elapsed) */ d = 0.5; return (long) (bytes / d); } lrzsz-0.13.1/src/crctab.c0000664000175000017500000002161315255263431010645 /* * Crc calculation stuff */ #include "crctab.h" /* * 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. */ /* * This is the CRC-16/CCITT (0x1021), also named 0x8810 after another * representation of the same polynomial. * * It is a suboptimal polynomial for its width - research by Koopman et al. * has shown that better 16-bit polynomials exist with superior Hamming * distance properties at common block sizes, meaning that the 0x1021 misses * more multi-bit error patterns than necessary: * https://users.ece.cmu.edu/~koopman/roses/dsn04/koopman04_crc_poly_embedded.pdf * * Additionally, its 16-bit CRC width gives a (1/65536) per-block collision * probability that becomes non-negligible over large transfers - * 1000 blocks with random errors yields a ~1.5% chance of at least one * undetected corruption. * * This is why ZMODEM offered CRC-32 (ZBIN32) for data. */ /* crctab calculated by Mark G. Mendel, Network Systems Corporation */ const 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 }; /* * 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. */ const unsigned long cr3tab[256] = { /* 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 }; /* End of crctab.c */ lrzsz-0.13.1/src/lsyslog.c0000664000175000017500000000354715255263431011111 /* 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" #include "zglobal.h" #include #include #include #include void lsyslog(int prio, const char *format, ...) { static char *username=NULL; /* i'd really hate this function to fail! 21 is enough for \0 plus * uint64_t uids, which most likely will never exist... */ static char uid_string[21]=""; char s[1024]; char scrub[1024]; 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) { snprintf(uid_string,sizeof(uid_string),"#%lu",(unsigned long) uid); username = uid_string; } } va_start(ap, format); vsnprintf(s, sizeof(s), format, ap); va_end(ap); (void) sanitize_bytes(scrub, sizeof(scrub), s); syslog(prio,"[%s] %s",username, scrub); } lrzsz-0.13.1/src/zmodemfuzz.c0000664000175000017500000026504115256425310011623 /* * zmodemfuzz - ZMODEM protocol fuzzer / peer driver. * * Runs a target binary (typically lrz or lsz) and plays the opposing * ZMODEM peer with malformed or hostile traffic, checking invariants: * bounded termination, no death-by-signal, and (receive mode) that * nothing is written outside the receiving directory. Failures leave * a fuzz-fail-*.log with the seed and the complete byte transcript, * so every run is reproducible: zmodemfuzz -s SEED -m receive ... * * Modes: * -m receive target is a receiver (lrz); the fuzzer plays a sender * whose byte stream is mutated (phase 1). * -m send target is a sender (lsz); the fuzzer plays a receiver * whose frames are drawn from a hostile sequence engine * (phase 2). * * Build: cc -o zmodemfuzz zmodemfuzz.c * Deliberately independent of the lrzsz code (like zmodemsnif). * * Deterministic: xorshift64* PRNG; -s SEED replays a run exactly. * Each iteration is alarm-bounded (-t, default 20s); a target killed * by that alarm counts as a hang failure. * * Written by glm-5.3-flash, because this needed to be independent of * my own logic. */ #define _POSIX_C_SOURCE 200809L #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* --- protocol constants (copied, as in zmodemsnif) --- */ #define ZPAD '*' #define ZDLE 030 #define ZBIN 'A' #define ZHEX 'B' #define ZBIN32 'C' #define ZRQINIT 0 #define ZRINIT 1 #define ZSINIT 2 #define ZACK 3 #define ZFILE 4 #define ZSKIP 5 #define ZNAK 6 #define ZABORT 7 #define ZFIN 8 #define ZRPOS 9 #define ZDATA 10 #define ZEOF 11 #define ZFERR 12 #define ZCRC 13 #define ZCHALLENGE 14 #define ZCOMPL 15 #define ZCAN 16 #define ZFREECNT 17 #define ZCOMMAND 18 #define ZSTDERR 19 #define ZCRCE 'h' #define ZCRCG 'i' #define ZCRCQ 'j' #define ZCRCW 'k' #define ZP0 0 #define ZP1 1 #define ZP2 2 #define ZP3 3 #define CANFDX 0x01 #define CANOVIO 0x02 #define CANBRK 0x04 #define CANFC32 0x20 #define ESCCTL 0x40 #define ESC8 0x80 #define ZCBIN 1 #define XON ('q' & 0x1f) #define XOFF ('s' & 0x1f) #define CAN 0x18 /* the receiver-side subpacket cap (mirrors LRZSZ_MAX_SUBPACKET_LEN; * other zmodem implementations accept up to 64k) */ #define SUBPKT_MAX 8192 /* --- CRC --- */ static unsigned short crctab[256]; static unsigned long cr3tab[256]; static void init_crc_tables(void) { int i; for (i = 0; i < 256; i++) { unsigned short crc = (unsigned short)(i << 8); int j; for (j = 0; j < 8; j++) { if (crc & 0x8000) crc = (unsigned short)((crc << 1) ^ 0x1021); else crc = (unsigned short)(crc << 1); } crctab[i] = crc; } for (i = 0; i < 256; i++) { unsigned long crc = (unsigned long)i; int j; for (j = 0; j < 8; j++) { if (crc & 1) crc = (crc >> 1) ^ 0xedb88320UL; else crc >>= 1; } cr3tab[i] = crc; } } static unsigned short updcrc(unsigned char b, unsigned short crc) { return (unsigned short)(crctab[(crc >> 8) & 0xff] ^ (crc << 8) ^ b); } static unsigned long updc32(unsigned char b, unsigned long c) { return (cr3tab[(c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFFUL)); } /* --- deterministic PRNG: xorshift64* --- */ static unsigned long long rng_state = 88172645463325252ULL; static unsigned long long rng_next(void) { unsigned long long x = rng_state; x ^= x >> 12; x ^= x << 25; x ^= x >> 27; rng_state = x; return x * 0x2545F4914F6CDD1DULL; } static unsigned int rng_below(unsigned int n) { return n ? (unsigned int)(rng_next() % n) : 0; } /* --- frame output buffer --- */ static unsigned char outbuf[262144]; static size_t outpos; static void ob(unsigned char c) { if (outpos < sizeof(outbuf) - 8) outbuf[outpos++] = c; } static void out_reset(void) { outpos = 0; } /* ZDLE escaping as lrzsz's zsendline() does it (without TESCCTL/TESC8): * every byte with (c & 0x60) == 0 (controls and their 0x80-0x9f, * 0xc0-0xdf mirrors), ZDLE itself, XON/XOFF and their high-bit forms; * CR only when control-char escaping was negotiated. */ static int needs_escape(unsigned char c, int ctlesc) { if (!(c & 0x60)) return 1; if (c == ZDLE || c == XON || c == XOFF) return 1; if (c == (XON | 0x80) || c == (XOFF | 0x80)) return 1; if (c == '\r') return ctlesc ? 1 : 0; return 0; } static void ob_esc(unsigned char c, int ctlesc) { if (needs_escape(c, ctlesc)) { ob(ZDLE); ob((unsigned char)(c ^ 0x40)); } else { ob(c); } } /* binary header, 16-bit CRC */ static void build_binhdr16(int type, const unsigned char hdr[4], int ctlesc) { unsigned short crc = 0; int n; ob(ZPAD); ob(ZPAD); ob(ZDLE); ob(ZBIN); ob_esc((unsigned char)type, ctlesc); crc = updcrc((unsigned char)type, 0); for (n = 0; n < 4; n++) { ob_esc(hdr[n], ctlesc); crc = updcrc(hdr[n], crc); } crc = updcrc(0, updcrc(0, crc)); ob_esc((unsigned char)(crc >> 8), ctlesc); ob_esc((unsigned char)(crc & 0xff), ctlesc); if (getenv("ZFUZZ_DEBUG")) fprintf(stderr, "binhdr16 type=%d crc=%04x\n", type, crc); } /* binary header, 32-bit CRC */ static void build_binhdr32(int type, const unsigned char hdr[4]) { unsigned long crc = 0xFFFFFFFFUL; int n; ob(ZPAD); ob(ZPAD); ob(ZDLE); ob(ZBIN32); ob_esc((unsigned char)type, 0); crc = updc32((unsigned char)type, crc); for (n = 0; n < 4; n++) { crc = updc32(hdr[n], crc); ob_esc(hdr[n], 0); } crc = ~crc; for (n = 0; n < 4; n++) { ob_esc((unsigned char)(crc & 0xff), 0); crc >>= 8; } } /* hex header */ static void build_hexhdr(int type, const unsigned char hdr[4]) { unsigned short crc = 0; char hex[20]; int n; crc = updcrc((unsigned char)type, 0); for (n = 0; n < 4; n++) crc = updcrc(hdr[n], crc); crc = updcrc(0, updcrc(0, crc)); ob(ZPAD); ob(ZPAD); ob(ZDLE); ob(ZHEX); snprintf(hex, sizeof hex, "%02x%02x%02x%02x%02x%04x", type & 0xff, hdr[0], hdr[1], hdr[2], hdr[3], crc & 0xffff); if (getenv("ZFUZZ_DEBUG")) fprintf(stderr, "build_hexhdr type=%d hex=%s\n", type, hex); for (n = 0; hex[n]; n++) ob((unsigned char)hex[n]); ob('\r'); ob((unsigned char)('\n' | 0x80)); if (type != ZFIN && type != ZACK) ob(XON); } /* data subpacket with 16-bit CRC, appended to a byte buffer */ static size_t append_data16(unsigned char *dst, size_t dstcap, size_t pos, const unsigned char *data, size_t len, int term, int ctlesc) { unsigned short crc = 0; size_t i; if (pos + len * 2 + 10 >= dstcap) return pos; for (i = 0; i < len; i++) { unsigned char c = data[i]; crc = updcrc(c, crc); if (needs_escape(c, ctlesc)) { dst[pos++] = ZDLE; dst[pos++] = (unsigned char)(c ^ 0x40); } else dst[pos++] = c; } dst[pos++] = ZDLE; dst[pos++] = (unsigned char)term; crc = updcrc((unsigned char)term, crc); crc = updcrc(0, updcrc(0, crc)); /* the CRC bytes are escaped like data bytes: ZDLE plus the * byte XORed with 0x40 */ { unsigned char cb[2]; int k; cb[0] = (unsigned char)((crc >> 8) & 0xff); cb[1] = (unsigned char)(crc & 0xff); for (k = 0; k < 2; k++) { if (needs_escape(cb[k], ctlesc)) { dst[pos++] = ZDLE; dst[pos++] = (unsigned char)(cb[k] ^ 0x40); } else dst[pos++] = cb[k]; } } return pos; } /* data subpacket with 32-bit CRC, appended to a byte buffer */ static size_t append_data32(unsigned char *dst, size_t dstcap, size_t pos, const unsigned char *data, size_t len, int term, int ctlesc) { unsigned long crc = 0xFFFFFFFFUL; size_t i; if (pos + len * 2 + 12 >= dstcap) return pos; for (i = 0; i < len; i++) { unsigned char c = data[i]; crc = updc32(c, crc); if (needs_escape(c, ctlesc)) { dst[pos++] = ZDLE; dst[pos++] = (unsigned char)(c ^ 0x40); } else dst[pos++] = c; } dst[pos++] = ZDLE; dst[pos++] = (unsigned char)term; crc = updc32((unsigned char)term, crc); crc = ~crc; { int k; for (k = 0; k < 4; k++) { unsigned char cb = (unsigned char)(crc & 0xff); crc >>= 8; if (needs_escape(cb, ctlesc)) { dst[pos++] = ZDLE; dst[pos++] = (unsigned char)(cb ^ 0x40); } else dst[pos++] = cb; } } return pos; } /* --- configuration / iteration context --- */ static void usage(void) __attribute__((noreturn)); static const char *progname = "zmodemfuzz"; static char *target_argv[64]; static int target_argc; static long seed = 0; static long iterations = 200; static long start_iteration = 0; static long current_iteration; /* for helpers outside the main loop */ static int alarm_seconds = 25; static int do_selftest = 0; static int keep_dirs = 0; static int show_progress = 0; static int mode_receive = -1; /* 1 = receive fuzz, 0 = send fuzz */ static void build_payload(void); static char fuzzdir[512]; /* working root */ static char recvdir[768]; /* receiving directory */ static char canary[768]; /* parent-dir canary */ static char canary_pristine[768]; static char canary2[768]; /* subdir-symlink canary target */ static char canary2_pristine[768]; static unsigned char payload[131072]; static size_t payload_len; static char payload_name[128]; static int longpkt_done; /* M_LONGPACKET: exchange ran to completion */ static void build_payload(void) { size_t i; payload_len = 1 + rng_below(20000); for (i = 0; i < payload_len; i++) payload[i] = (unsigned char)rng_next(); } __attribute__((noreturn)) __attribute__((format(printf, 1, 2))) static void die(const char *fmt, ...) { va_list ap; fprintf(stderr, "%s: ", progname); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fputc('\n', stderr); exit(1); } /* --- transcript --- */ static FILE *transcript; static void tr_buf(int dir, const unsigned char *b, size_t n) { size_t i; if (!transcript) return; for (i = 0; i < n; i++) { if (dir) { fprintf(transcript, "<%02x", b[i] & 0xff); } else { fprintf(transcript, ">%02x", b[i] & 0xff); } } } static time_t fuzz_start; __attribute__((format(printf, 1, 2))) static void tr_mark(const char *fmt, ...) { va_list ap; if (!transcript) return; va_start(ap, fmt); fprintf(transcript, "[%lds] ", (long)(time(NULL) - fuzz_start)); vfprintf(transcript, fmt, ap); va_end(ap); fputc('\n', transcript); } /* --- target management --- */ static pid_t target_pid = -1; static int to_target[2]; /* parent -> target stdin */ static int from_target[2]; /* target stdout -> parent */ static int target_stderr[2]; static volatile sig_atomic_t alarm_fired; #ifdef RLIMIT_AS /* 256MB guards the parent against mutation-driven memory bombs in * plain targets, but it is fatal for sanitizer-built targets: MSan * must mmap ~16TB of virtual shadow memory at startup and dies with * "failed to allocate shadow memory (errno 12)" under any RLIMIT_AS. * The harness itself is msan-built when the tree is (--enable-msan), * so its targets are msan-built too - skip the limit there and rely * on the per-iteration -t deadline to bound runaway targets. */ #if defined(__has_feature) #if __has_feature(memory_sanitizer) #define FUZZ_UNDER_MSAN 1 #endif #elif defined(__SANITIZE_MEMORY__) #define FUZZ_UNDER_MSAN 1 #endif # ifndef FUZZ_UNDER_MSAN static unsigned long mem_limit = 256UL * 1024 * 1024; # endif #endif /* run a shell command, discarding its status (mkdir/ln/rm plumbing). * system() is deliberately NOT used: its /bin/sh child resets signal * dispositions and glibc's save/restore dance around SIGALRM made a * pending harness alarm lethal (observed against targets that ignore * reads, e.g. zmtx-zmrx-1.02: harness killed by its own SIGALRM). * Here the child gets a known-clean signal state; the parent's * on_alarm stays installed and the target-kill alarm semantics in * wait_target() are untouched. */ static void run_cmd(const char *cmd) { pid_t pid = fork(); if (pid < 0) die("fork: %s", strerror(errno)); if (pid == 0) { /* plumbing child: default dispositions, no alarm - the * harness's wait_target() deadline must not be shortened * by an alarm armed in the forked shell */ signal(SIGALRM, SIG_DFL); alarm(0); execl("/bin/sh", "sh", "-c", cmd, (char *)NULL); _exit(127); } { int status; pid_t r; do { r = waitpid(pid, &status, 0); } while (r < 0 && errno == EINTR); /* status is deliberately ignored: the plumbing (mkdir/ln/ * rm) is best-effort; failures surface as invariant * violations instead */ (void)r; (void)status; } } static void on_alarm(int sig) { (void)sig; alarm_fired = 1; /* nothing must rely on the main loop checking the flag: kill the * wedged target immediately so wait_target() reaps it; the flag * stays set for the deadline bookkeeping */ if (target_pid > 0) kill(target_pid, SIGKILL); } static void spawn_target(void) { /* a leftover alarm from a previous iteration's early exit (target * died / receiver aborted) must not fire mid-iteration where no * alarm_fired check exists */ alarm(0); target_pid = fork(); if (target_pid < 0) die("fork: %s", strerror(errno)); if (target_pid == 0) { char *argv[68]; int i; sigset_t alrm; /* the parent keeps SIGALRM blocked between waits so a * stray alarm cannot kill the harness; the child must * receive it default-style (its own bounded alarm) */ sigemptyset(&alrm); sigaddset(&alrm, SIGALRM); sigprocmask(SIG_UNBLOCK, &alrm, NULL); signal(SIGALRM, SIG_DFL); alarm((unsigned)alarm_seconds); /* receive mode: the child must chdir into the receiving * directory so received files land there (and the escape * canaries around it are meaningful). * send mode: the target only READS files (its file * arguments are relative to the caller's cwd) and writes * nothing to disk, so keep the caller's cwd - otherwise * relative file arguments like ./test/4k.bin break. */ if (mode_receive && chdir(recvdir) != 0) _exit(126); #ifdef RLIMIT_AS # ifndef FUZZ_UNDER_MSAN if (mem_limit && setrlimit(RLIMIT_AS, &(struct rlimit){ mem_limit, mem_limit }) != 0) _exit(126); # endif #endif if (dup2(to_target[0], 0) < 0 || dup2(from_target[1], 1) < 0 || dup2(target_stderr[1], 2) < 0) _exit(126); close(to_target[0]); close(to_target[1]); close(from_target[0]); close(from_target[1]); close(target_stderr[0]); close(target_stderr[1]); for (i = 0; i < target_argc && i < 66; i++) argv[i] = target_argv[i]; argv[i] = NULL; if (!argv[0]) { _exit(127); /* ECANTHAPPEN */ } execvp(argv[0], argv); _exit(127); } /* parent ends; the pipes must be non-blocking for the poll-driven * pump/flush paths */ close(to_target[0]); close(from_target[1]); close(target_stderr[1]); { int flags = fcntl(to_target[1], F_GETFL, 0); fcntl(to_target[1], F_SETFL, flags | O_NONBLOCK); flags = fcntl(from_target[0], F_GETFL, 0); fcntl(from_target[0], F_SETFL, flags | O_NONBLOCK); } } static void close_pipes(void) { if (to_target[1] >= 0) close(to_target[1]); to_target[1] = -1; close(to_target[0]); close(from_target[0]); close(from_target[1]); close(target_stderr[0]); close(target_stderr[1]); } static struct { unsigned char data[65536]; size_t len; } to_target_buf; /* set when the target's pipe broke: the target is gone, stop feeding it */ static int target_dead; static int poll_one_out(void); static unsigned char stderr_capture[262144]; static size_t stderr_len; /* target stdout bytes not yet consumed by the frame parser */ static struct { unsigned char data[131072]; size_t len; size_t pos; } rxbuf; static void rxbuf_reset(void) { rxbuf.len = 0; rxbuf.pos = 0; } /* drain target stdout/stderr; returns -1 when the target's stdout closed */ static int drain_target(void) { struct pollfd fds[2]; int nfds = 0; int pi_tout = -1, pi_terr = -1; if (from_target[0] >= 0) { fds[nfds].fd = from_target[0]; fds[nfds].events = POLLIN; fds[nfds].revents = 0; pi_tout = nfds++; } if (target_stderr[0] >= 0) { fds[nfds].fd = target_stderr[0]; fds[nfds].events = POLLIN; fds[nfds].revents = 0; pi_terr = nfds++; } if (!nfds) return 0; if (poll(fds, nfds, 50) < 0) { if (errno == EINTR) return 0; return -1; } if (pi_tout >= 0 && (fds[pi_tout].revents & (POLLIN | POLLHUP))) { unsigned char tmp[8192]; ssize_t n = read(from_target[0], tmp, sizeof tmp); if (n > 0) { tr_buf(1, tmp, (size_t)n); if (rxbuf.len + (size_t)n <= sizeof rxbuf.data) { memcpy(rxbuf.data + rxbuf.len, tmp, (size_t)n); rxbuf.len += (size_t)n; } } else if (n == 0) { close(from_target[0]); from_target[0] = -1; } } if (pi_terr >= 0 && (fds[pi_terr].revents & (POLLIN | POLLHUP))) { ssize_t n = read(target_stderr[0], stderr_capture + stderr_len, sizeof stderr_capture - stderr_len); if (n > 0) { tr_buf(1, stderr_capture + stderr_len, (size_t)n); stderr_len += (size_t)n; } else if (n == 0) { close(target_stderr[0]); target_stderr[0] = -1; } } return 0; } /* push to_target_buf out to the target; returns -1 on EPIPE (dead target) */ static int flush_to_target(void) { if (target_dead) return -1; while (to_target_buf.len) { ssize_t n = write(to_target[1], to_target_buf.data, to_target_buf.len); if (n < 0) { if (errno == EINTR) continue; if (errno == EAGAIN) { if (poll_one_out() < 0) return -1; continue; } target_dead = 1; return -1; /* EPIPE */ } memmove(to_target_buf.data, to_target_buf.data + n, to_target_buf.len - (size_t)n); to_target_buf.len -= (size_t)n; } return 0; } static int poll_one_out(void) { struct pollfd p; p.fd = to_target[1]; p.events = POLLOUT; p.revents = 0; if (poll(&p, 1, 200) < 0 && errno != EINTR) return -1; return 0; } static void send_bytes(const unsigned char *b, size_t n) { size_t off = 0; if (target_dead) { tr_mark("# dropped %zu bytes: target already gone", n); return; } tr_buf(0, b, n); if (getenv("ZFUZZ_DEBUG")) { fprintf(stderr, "send %zu bytes:", n); { size_t qi; for (qi = 0; qi < n && qi < 24; qi++) fprintf(stderr, " %02x", b[qi]); } fputc('\n', stderr); } while (off < n) { size_t room = sizeof to_target_buf.data - to_target_buf.len; size_t chunk = n - off < room ? n - off : room; memcpy(to_target_buf.data + to_target_buf.len, b + off, chunk); to_target_buf.len += chunk; off += chunk; if (to_target_buf.len == sizeof to_target_buf.data) if (flush_to_target() < 0) return; drain_target(); } if (flush_to_target() < 0) return; } static int wait_target(int *exitcode) { int status = 0; pid_t r; sigset_t alrm, oldmask; alarm_fired = 0; /* The alarm must fire *here*, not while the target-side plumbing * or a mutation step blocks it: a deferred SIGALRM would otherwise * be delivered at an arbitrary later sigprocmask restore (observed * killing the harness itself against targets that ignore reads, * e.g. zmtx-zmrx-1.02). Arming happens BEFORE unblocking so no * alarm can slip through. */ sigemptyset(&alrm); sigaddset(&alrm, SIGALRM); sigprocmask(SIG_UNBLOCK, &alrm, &oldmask); alarm((unsigned)(alarm_seconds + 5)); for (;;) { r = waitpid(target_pid, &status, WNOHANG); if (r == target_pid) break; if (r < 0) { if (errno == EINTR) { /* interrupted: alarm may have fired, fall * through to the alarm_fired check below */ if (alarm_fired) break; continue; } /* early out must not leak an armed alarm or an * unblocked mask into the rest of the iteration */ alarm(0); sigprocmask(SIG_BLOCK, &alrm, NULL); return -1; } if (alarm_fired) break; drain_target(); } alarm(0); /* re-block: the rest of the iteration (mutation sends, plumbing) * must not lose the harness to a stray SIGALRM */ sigprocmask(SIG_BLOCK, &alrm, NULL); if (alarm_fired) { kill(target_pid, SIGKILL); waitpid(target_pid, &status, 0); return -1; /* hang */ } if (WIFEXITED(status)) *exitcode = WEXITSTATUS(status); else if (WIFSIGNALED(status)) *exitcode = -WTERMSIG(status); else *exitcode = -99; return 0; } /* --- invariant helpers --- */ static int file_changed(const char *a, const char *b) { struct stat sa, sb; if (stat(a, &sa) != 0 || stat(b, &sb) != 0) return 1; if (sa.st_size != sb.st_size) return 1; /* content check: cheap full compare (canaries are <= 64 KiB) */ { static unsigned char ca[70000], cb[70000]; int fa = open(a, O_RDONLY); int fb = open(b, O_RDONLY); ssize_t na = 0, nb = 0; if (fa < 0 || fb < 0) { if (fa >= 0) close(fa); if (fb >= 0) close(fb); return 1; } na = read(fa, ca, sizeof ca); nb = read(fb, cb, sizeof cb); close(fa); close(fb); if (na != nb) return 1; return memcmp(ca, cb, (size_t)na) != 0; } } /* --- failure report --- */ static char transcript_name[768]; static void fail(const char *what, long it, int exitcode) { char path[768]; snprintf(path, sizeof path, "/tmp/zmodemfuzz-fail-seed%ld-it%ld.log", seed, it); if (transcript) { fclose(transcript); transcript = NULL; } if (rename(transcript_name, path) != 0 && errno != ENOENT) fprintf(stderr, "zmodemfuzz: transcript rename failed: %s\n", strerror(errno)); fprintf(stderr, "FAIL iter %ld: %s (exit %d, transcript: %s)\n", it, what, exitcode, path); if (stderr_len) { /* full stderr next to the fail transcript (the on-stderr * excerpt stays capped at 800 bytes) */ char spath[768]; FILE *f; fprintf(stderr, " target stderr: %.*s\n", (int)(stderr_len < 800 ? stderr_len : 800), stderr_capture); snprintf(spath, sizeof spath, "/tmp/zmodemfuzz-fail-seed%ld-it%ld.stderr", seed, it); f = fopen(spath, "wb"); if (f) { fwrite(stderr_capture, 1, stderr_len, f); fclose(f); fprintf(stderr, " full target stderr: %s\n", spath); } } } /* --- frame parsing (what the target sends to us) --- */ #define FUZZ_TIMEOUT (-1000) #define FUZZ_EOF (-1001) struct framebuf { int type; unsigned char hdr[4]; unsigned char data[2048]; size_t data_len; int frame_ind; int term; /* data subpacket: the ZCRCx terminator byte */ int crc_ok; /* data subpacket: CRC checked out */ }; enum rstate { R_IDLE, R_ZPADS, R_FRAME, R_HEX, R_BIN, R_BIN32 }; struct rparser { enum rstate state; unsigned char hdr[4]; int type; int frame_ind; int bytecnt; char hexbuf[16]; int hexcnt; unsigned short crc16; unsigned long crc32; unsigned char crcrecv[4]; int crccnt; int crc_esc; int canc; int term_byte; /* data subpacket: the ZCRCx terminator */ int in_data; /* binary data frame: subpackets follow, not CRC */ int sub_term; /* current data subpacket's ZCRCx terminator */ int sub_crc_cnt; /* collecting subpacket CRC bytes */ int data_len; /* data bytes of the current subpacket */ int hdr_crc_left; /* binary header CRC bytes still pending */ int eof_frame; /* ZEOF: frame ends after the header CRC */ }; static void rp_init(struct rparser *p) { memset(p, 0, sizeof *p); p->frame_ind = -1; p->type = -1; } static int rp_emit(struct rparser *p, struct framebuf *fb) { fb->type = p->type; memcpy(fb->hdr, p->hdr, 4); fb->data_len = 0; fb->frame_ind = p->frame_ind; fb->term = p->term_byte; if (p->state == R_BIN) fb->crc_ok = (p->crc16 == 0); else fb->crc_ok = (p->crc32 == 0xDEBB20E3UL); memset(p, 0, sizeof *p); p->type = -1; p->frame_ind = -1; return 1; } /* process one byte; returns 1 when a frame is complete */ static int rp_byte(struct rparser *p, unsigned char c, struct framebuf *fb) { switch (p->state) { case R_IDLE: if (c == CAN) { if (++p->canc >= 5) { fb->type = ZCAN; fb->data_len = 0; fb->frame_ind = -1; memset(p, 0, sizeof *p); p->type = -1; p->frame_ind = -1; return 1; } return 0; } p->canc = 0; if (c == ZPAD) p->state = R_ZPADS; return 0; case R_ZPADS: if (c == ZPAD) return 0; if (c == ZDLE) { p->state = R_FRAME; return 0; } p->state = R_IDLE; return 0; case R_FRAME: if (c == ZHEX) { p->frame_ind = ZHEX; p->hexcnt = 0; p->state = R_HEX; } else if (c == ZBIN) { p->frame_ind = ZBIN; p->crc16 = 0; p->bytecnt = 0; p->crccnt = 0; p->crc_esc = 0; p->state = R_BIN; } else if (c == ZBIN32) { p->frame_ind = ZBIN32; p->crc32 = 0xFFFFFFFFUL; p->bytecnt = 0; p->crccnt = 0; p->crc_esc = 0; p->state = R_BIN32; } else { p->state = R_IDLE; } return 0; case R_HEX: if (getenv("ZFUZZ_DEBUG") && c != '\r' && c != 0x11 && c != 0x8a) fprintf(stderr, "R_HEX got %02x (%c) cnt=%d\n", c, (c >= 0x20 && c < 0x7f) ? c : '?', p->hexcnt); if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) { if (p->hexcnt < 14) p->hexbuf[p->hexcnt] = (char)c; p->hexcnt++; if (p->hexcnt == 14) { unsigned int t, d0, d1, d2, d3, crc; sscanf(p->hexbuf, "%2x%2x%2x%2x%2x%4x", &t, &d0, &d1, &d2, &d3, &crc); p->type = (int)(t & 0xff); p->hdr[0] = (unsigned char)d0; p->hdr[1] = (unsigned char)d1; p->hdr[2] = (unsigned char)d2; p->hdr[3] = (unsigned char)d3; } return 0; } /* line ending: CR, LF|0x80, XON, NUL */ if (c == '\r' || c == 0x8a || c == 0x11 || c == 0) { if (p->hexcnt >= 14) { rp_emit(p, fb); return 1; } return 0; } p->state = R_IDLE; return 0; default: break; case R_BIN: case R_BIN32: if (p->in_data && p->bytecnt >= 5) { /* data subpackets: the ZDLE handling below is * per-byte, done in the branches themselves */ } else if (p->crc_esc) { p->crc_esc = 0; c = (unsigned char)(c ^ 0x40); } else if (c == ZDLE) { p->crc_esc = 1; return 0; } if (p->bytecnt == 0) { p->type = c; p->term_byte = 0; p->in_data = 0; p->sub_term = 0; p->sub_crc_cnt = 0; if (p->state == R_BIN) p->crc16 = updcrc(c, 0); else p->crc32 = updc32(c, p->crc32); p->bytecnt = 1; return 0; } if (p->bytecnt <= 4) { p->hdr[p->bytecnt - 1] = c; if (p->state == R_BIN) p->crc16 = updcrc(c, p->crc16); else p->crc32 = updc32(c, p->crc32); p->bytecnt++; if (p->bytecnt == 5) { /* header complete: binary headers end * with their own CRC (2 bytes 16-bit / * 4 bytes 32-bit) BEFORE any data * subpackets; the CRC bytes must be * consumed first */ switch (p->type) { case ZRPOS: case ZACK: case ZRQINIT: case ZRINIT: case ZFIN: case ZNAK: case ZABORT: case ZFERR: case ZSKIP: case ZCRC: case ZCHALLENGE: case ZCOMPL: case ZCAN: case ZFREECNT: case ZCOMMAND: case ZSTDERR: p->in_data = 0; /* CRC follows */ break; case ZSINIT: /* ZSINIT carries the attention * string as a data subpacket, * but lsz sends it only after * ESCCTL/TESC8 negotiation - the * header CRC comes first either * way */ p->in_data = 0; break; default: /* ZFILE/ZDATA/ZEOF: header CRC * first (consumed in the * !in_data branch). ZDATA/ZFILE * then carry data subpackets; * ZEOF ENDS after its header CRC * (no subpackets) */ p->in_data = 0; p->hdr_crc_left = (p->state == R_BIN) ? 2 : 4; p->eof_frame = (p->type == ZEOF); break; } } return 0; } if (!p->in_data) { /* header CRC bytes: 2 (16-bit) / 4 (32-bit) close * the header; for data frames they precede the * subpackets instead of ending the frame */ p->crcrecv[p->crccnt++] = c; if (p->crccnt == 1) p->term_byte = c; if (p->state == R_BIN) p->crc16 = updcrc(c, p->crc16); else p->crc32 = updc32(c, p->crc32); if ((p->state == R_BIN && p->crccnt == 2) || (p->state == R_BIN32 && p->crccnt == 4)) { if (p->hdr_crc_left && !p->eof_frame) { /* data frame: header CRC done, * subpackets follow; re-init the * CRC chain: the subpacket CRC * covers only data + terminator + * CRC, not the header */ p->hdr_crc_left = 0; p->crccnt = 0; p->in_data = 1; p->sub_crc_cnt = 0; if (p->state == R_BIN) p->crc16 = 0; else p->crc32 = 0xFFFFFFFFUL; return 0; } rp_emit(p, fb); return 1; } return 0; } /* data frame: parse the subpacket stream. A ZDLE pair * 'h'/'i'/'j'/'k' is the subpacket terminator (the raw * terminator is never ZDLE-escaped as data), then 2/4 * CRC bytes, also ZDLE-escaped. One event per subpacket. */ if (p->sub_crc_cnt == 0) { /* collecting data bytes */ if (p->crc_esc) { /* the byte after ZDLE: terminator or * escaped data? Only 'h'/'i'/'j'/'k' are * terminators; everything else is data */ if (c == ZCRCE || c == ZCRCG || c == ZCRCQ || c == ZCRCW) { p->sub_term = c; p->crc_esc = 0; if (p->state == R_BIN) p->crc16 = updcrc(c, p->crc16); else p->crc32 = updc32(c, p->crc32); p->sub_crc_cnt = 1; return 0; } /* escaped data byte */ p->crc_esc = 0; if (p->data_len < (int)sizeof fb->data) fb->data[p->data_len++] = (unsigned char)(c ^ 0x40); if (p->state == R_BIN) p->crc16 = updcrc( (unsigned char)(c ^ 0x40), p->crc16); else p->crc32 = updc32( (unsigned char)(c ^ 0x40), p->crc32); return 0; } if (c == ZDLE) { p->crc_esc = 1; return 0; } if (p->data_len < (int)sizeof fb->data) fb->data[p->data_len++] = c; if (p->state == R_BIN) p->crc16 = updcrc(c, p->crc16); else p->crc32 = updc32(c, p->crc32); return 0; } /* subpacket CRC bytes */ { int want = (p->state == R_BIN) ? 2 : 4; p->crcrecv[p->crccnt++] = c; if (p->state == R_BIN) p->crc16 = updcrc(c, p->crc16); else p->crc32 = updc32(c, p->crc32); if (p->crccnt >= want) { fb->data_len = p->data_len; fb->type = p->type; memcpy(fb->hdr, p->hdr, 4); fb->frame_ind = p->frame_ind; fb->term = p->sub_term; if (p->state == R_BIN) fb->crc_ok = (p->crc16 == 0); else fb->crc_ok = (p->crc32 == 0xDEBB20E3UL); p->data_len = 0; p->crccnt = 0; p->sub_crc_cnt = 0; { int t = p->sub_term; p->sub_term = 0; if (t == ZCRCE || t == ZCRCW) { /* frame ends: the next * bytes are a new header * (lsz flushes after * ZCRCE/ZCRCW subpackets) */ p->state = R_IDLE; p->bytecnt = 0; } else { /* stay in data mode: the * next subpacket continues * this frame */ p->bytecnt = 5; } } return 1; } } return 0; } return 0; } /* read one frame from the target with a deadline (ms); fills fb. * returns 1 = frame complete, 0 = deadline */ static int read_frame(struct rparser *rp, struct framebuf *fb, int ms) { time_t start = time(NULL); time_t end = start + (ms + 999) / 1000; for (;;) { /* consume buffered bytes first */ while (rxbuf.pos < rxbuf.len) { if (rp_byte(rp, rxbuf.data[rxbuf.pos++], fb)) return 1; } rxbuf.len = 0; rxbuf.pos = 0; if (from_target[0] < 0) return 0; if (time(NULL) >= end) return 0; drain_target(); /* fills rxbuf (50ms poll) */ } } /* --- phase 1: fuzz-receive (target = lrz; we are the sender) --- */ static const char *hostile_names[] = { "normal.bin", "with space.bin", "..", "../escape-target.bin", "/tmp/zmodemfuzz-escape-target.bin", "-dashleading", ".hidden", "\xc3\xa4-\xc3\xb6-\xc3\xbc-8bit.bin", /* utf-8 umlauts */ "tab\tand\nnewline.bin", "-", "a.bin.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak" ".bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak" ".bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak" ".bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak.bak", "subdir/deep/deeper/file.bin", }; #define N_HOSTILE ((int)(sizeof hostile_names / sizeof hostile_names[0])) /* mutation classes (for logging/coverage checks) */ enum mclass { M_NONE = 0, /* clean baseline */ M_BYTEFLIP, /* random bit flips in the stream */ M_CRC16, /* corrupt 16-bit CRCs */ M_CRC32, /* corrupt 32-bit CRCs */ M_CRCMODE, /* claim CRC32 flag but send 16-bit CRC */ M_FRAMETYPE, /* frame-type byte roulette */ M_ZDLE_ILL, /* illegal ZDLE escapes */ M_POSITION, /* position-field extremes */ M_FLAGS, /* capability/flag byte storms */ M_GARBAGE, /* garbage floods */ M_CANCAN, /* CAN bursts */ M_TRUNC, /* truncate the stream at a random point */ M_EOF, /* premature close */ M_NAME, /* hostile filename */ M_LONGPACKET, /* oversized/large data subpackets */ N_MCLASS }; /* --- per-class run statistics (for the end-of-run summary) --- */ struct class_stats { long count; long total_ms; long max_ms; long hangs; /* target waited until the alarm */ long timeouts; /* hangs + excused child-alarm (-14) deaths */ long fails; long crc32; /* iterations that negotiated 32-bit CRC (receive mode) */ }; static struct class_stats rx_stats[N_MCLASS]; /* receive mode: class */ static struct class_stats tx_stats[13]; /* send mode: choice */ static int send_choice = -1; static int n_tx_choices = 13; /* includes the data-phase ACK-loop */ static enum mclass mc_current = M_NONE; /* class of the running iteration */ static int iter_crc32; /* iteration negotiated 32-bit CRC (receive mode) */ /* per-class fail-reason histogram: the raw `bad` string from * check_invariants()/fail() grouped by class/choice, so a summary row * says WHAT failed, not just how often */ #define N_FAIL_REASONS 64 struct fail_reason { const char *what; long count; }; static struct fail_reason fail_reasons[N_MCLASS][N_FAIL_REASONS]; static struct fail_reason fail_reasons_tx[13][N_FAIL_REASONS]; static void note_fail_reason(const char *what, int rx, long idx) { struct fail_reason (*tab)[N_FAIL_REASONS] = rx ? fail_reasons : fail_reasons_tx; struct fail_reason *t = tab[idx]; int i; for (i = 0; i < N_FAIL_REASONS && t[i].what; i++) { if (t[i].what == what) { /* same string literal */ t[i].count++; return; } } if (i < N_FAIL_REASONS) { t[i].what = what; t[i].count = 1; } } /* build one ZFILE metadata subpacket around `name` */ static size_t build_zfile_data(unsigned char *dst, size_t dstcap, const char *name, size_t len, int ctlesc) { char meta[120]; int mlen; mlen = snprintf(meta, sizeof meta, "%lu %lo 100644 0 1 %lu", (unsigned long)len, (unsigned long)time(NULL), (unsigned long)len); (void)mlen; (void)ctlesc; { size_t nl = strlen(name); size_t ml = strlen(meta); size_t pos = 0; size_t i; /* nl + NUL + ml + trailing NUL (+ terminator added by the * append layer) must fit; the trailing NUL is required by * receivers that validate the last block byte (zmrx-2.02 * ZNAKs the ZFILE without it - the bug behind its * "odd exit code 4" run) */ if (nl + ml + 3 > dstcap) return 0; for (i = 0; i < nl; i++) dst[pos++] = (unsigned char)name[i]; dst[pos++] = 0; for (i = 0; i < ml; i++) dst[pos++] = (unsigned char)meta[i]; dst[pos++] = 0; return pos; } } /* one clean transfer exchange against lrz; every parameter can be * corrupted per the mutation matrix. Returns 0 = ok. */ /* --- mutation parameters (bounded corruption, deterministic) --- */ /* per-iteration mutation parameters, drawn from the main xorshift * stream so -s/-S stay deterministic. draw_mut_params() is the SINGLE * source of the draw sequence: both fuzz_receive_iter() and * fast_forward_rng() call it, which keeps the mirror exact by * construction. */ struct mut_params { int n_flips; /* M_BYTEFLIP: number of bit flips */ int flip_off; /* M_BYTEFLIP: first flip position */ int flip_bit; /* M_BYTEFLIP: bit index (0..7) */ int crc_n; /* M_CRC16/32: CRC bytes to corrupt */ int crc_off; /* M_CRC16/32: offset of the CRC byte */ int frame_type; /* M_FRAMETYPE: substitute frame type */ int frame_off; /* M_FRAMETYPE: position to substitute */ int ill_n; /* M_ZDLE_ILL: illegal escapes to inject */ int ill_off; /* M_ZDLE_ILL: injection offset */ int pos_mode; /* M_POSITION: 0=0, 1=max, 2=pos-1, 3=pos+1 */ int flags_bits; /* M_FLAGS: bits to XOR into flag bytes */ int flags_off; /* M_FLAGS: position to corrupt */ int garb_n; /* M_GARBAGE: noise bytes to inject */ int garb_off; /* M_GARBAGE: injection offset */ unsigned char garb[64]; /* M_GARBAGE: the noise bytes themselves */ int can_n; /* M_CANCAN: CAN bytes to inject */ int can_off; /* M_CANCAN: injection offset */ int trunc_stop; /* M_TRUNC: stop after this many subpackets */ int eof_after_zfile; /* M_EOF: drop the line after ZRPOS */ unsigned int sub_chunk; /* M_LONGPACKET: subpacket size to send */ }; static struct mut_params mut; /* Draw all bounded mutation parameters for one iteration. `mc` selects * which fields are actually consumed; the draws happen in a fixed order * so the sequence is reproducible regardless of how the consumer uses * the values. */ static void draw_mut_params(enum mclass mc) { mut.n_flips = (mc == M_BYTEFLIP) ? 1 + (int)rng_below(8) : 0; mut.flip_off = (int)rng_below(256); mut.flip_bit = (int)rng_below(8); mut.crc_n = (mc == M_CRC16 || mc == M_CRC32) ? 1 + (int)rng_below(2) : 0; mut.crc_off = (int)rng_below(64); mut.frame_type = (mc == M_FRAMETYPE) ? (int)rng_below(32) : 0; mut.frame_off = (int)rng_below(32); mut.ill_n = (mc == M_ZDLE_ILL) ? 1 + (int)rng_below(4) : 0; mut.ill_off = (int)rng_below(128); mut.pos_mode = (mc == M_POSITION) ? (int)rng_below(4) : -1; mut.flags_bits = (mc == M_FLAGS) ? (int)(rng_next() & 0xff) : 0; mut.flags_off = (int)rng_below(48); mut.garb_n = (mc == M_GARBAGE) ? 1 + (int)rng_below(64) : 0; mut.garb_off = (int)rng_below(512); { int k; for (k = 0; k < mut.garb_n && k < 64; k++) mut.garb[k] = (unsigned char)rng_next(); } mut.can_n = (mc == M_CANCAN) ? 2 + (int)rng_below(8) : 0; mut.can_off = (int)rng_below(128); mut.trunc_stop = (mc == M_TRUNC) ? (int)rng_below(9) : -1; mut.eof_after_zfile = (mc == M_EOF) ? 1 : 0; mut.sub_chunk = 0; if (mc == M_LONGPACKET) { static const unsigned int sizes[5] = { SUBPKT_MAX, SUBPKT_MAX + 1, 16384, 32768, 65536 }; mut.sub_chunk = sizes[rng_below(5)]; } } /* inject n bytes at offset off into the built frame (clamped); used by * M_GARBAGE and M_CANCAN */ static void inject_bytes(size_t off, const unsigned char *bytes, size_t n) { size_t i; if (off > outpos) off = outpos; if (n > sizeof outbuf - outpos) n = sizeof outbuf - outpos > n ? n : 0; if (n == 0) return; memmove(outbuf + off + n, outbuf + off, outpos - off); for (i = 0; i < n; i++) outbuf[off + i] = bytes[i]; outpos += n; } /* mutate the freshly built frame in outbuf[0..outpos) according to the * drawn parameters, then send it. Clean classes pass through untouched. * Mutations only apply to data-path frames (ZDATA header, subpackets, * ZEOF): corrupting the handshake frames wedges the session state machine * (the receiver ZNAKs forever) instead of exercising the data path, which * is what the bounded classes are for. Session-level mutations (M_TRUNC, * M_EOF, M_NAME) act on the exchange, not on these frames. */ static void mut_send(enum mclass mc, int data_frame) { int i; if (!data_frame || mc == M_NONE || mc == M_NAME || mc == M_CRCMODE || mc == M_TRUNC || mc == M_EOF || mc == M_LONGPACKET) { send_bytes(outbuf, outpos); return; } if (mc == M_BYTEFLIP) { for (i = 0; i < mut.n_flips; i++) { size_t off = (size_t)mut.flip_off + (size_t)i * 7; if (outpos == 0) break; off %= outpos; outbuf[off] ^= (unsigned char)(1 << mut.flip_bit); } } else if (mc == M_CRC16 || mc == M_CRC32) { /* corrupt the trailing CRC bytes of the frame: they sit * right before the ZDLE+terminator pair (2 bytes), i.e. at * outpos-4 .. outpos-3 (16-bit) or outpos-6..-3 (32-bit) */ for (i = 0; i < mut.crc_n; i++) { size_t off = outpos >= 6 ? outpos - 4 - (size_t)i : 0; outbuf[off] ^= 0xa5; } } else if (mc == M_FRAMETYPE) { /* the frame-type byte is the first byte after the ZDLE+ind * pair (outbuf[3] for binary, hex digit pair start for hex); * simplest reliable target: XOR a few bytes near the front */ size_t off = (size_t)mut.frame_off % (outpos ? outpos : 1); outbuf[off] ^= (unsigned char)(mut.frame_type & 0x1f); } else if (mc == M_ZDLE_ILL) { unsigned char ill[4]={0,0,0,0}; for (i = 0; i < mut.ill_n && i < 4; i++) ill[i] = ZDLE; inject_bytes((size_t)mut.ill_off, ill, (size_t)(i ? i : 1)); } else if (mc == M_FLAGS) { size_t off = (size_t)mut.flags_off % (outpos ? outpos : 1); outbuf[off] ^= (unsigned char)mut.flags_bits; } else if (mc == M_GARBAGE) { /* mut.garb[] was drawn in draw_mut_params(): rng draws must * never happen at send time or -S fast-forward desyncs */ inject_bytes((size_t)mut.garb_off, mut.garb, (size_t)mut.garb_n); } else if (mc == M_CANCAN) { unsigned char cans[9]; for (i = 0; i < mut.can_n && i < 9; i++) cans[i] = CAN; inject_bytes((size_t)mut.can_off, cans, (size_t)i); } else if (mc == M_POSITION) { /* corrupt a position byte inside a data header: the four * position bytes of binary headers live at outbuf[5..8] */ if (outpos >= 9) { size_t off = 5 + (size_t)(mut.pos_mode & 3) % 4; static const unsigned char pm[4] = { 0x00, 0xff, 0xfe, 0x7f }; outbuf[off] = pm[mut.pos_mode & 3]; } } send_bytes(outbuf, outpos); } /* fast-forward the PRNG over iterations 0..it-1 without running the * target: replay exactly the draws a real run made, so iteration `it` * starts with the identical rng_state and behaves byte-for-byte like * it did in the original run. Mirrors the main loop's per-iteration * draw order: build_payload(), mutation class, optional hostile-name * pick, then fuzz_receive_iter()'s payload length and payload bytes * plus draw_mut_params(). In send mode the mirror is fuzz_send_iter()'s * unconditional sequence: build_payload(), mc draw, draw_mut_params(), * choice draw (the clean-baseline overrides never touch the stream). */ static void fast_forward_rng(long it) { long i; for (i = 0; i < it; i++) { unsigned int mc; if (it > 100000 && (i % 1000000) == 999999) { /* no wall-clock dedup here: the loop can pass * several marks within one time() second, and a * silently suppressed report is exactly what we * are guarding against */ fprintf(stderr, "zmodemfuzz: fast-forwarding rng: " "%ld/%ld iterations done (%d%%)\n", i + 1, it, (int)((i + 1) * 100 / it)); } build_payload(); /* main loop's per-iteration draw */ mc = rng_below(N_MCLASS - 1) + 1; if (i % 17 == 0) mc = M_NONE; if (!mode_receive) { draw_mut_params((enum mclass)mc); (void)rng_below(n_tx_choices); /* fuzz_send_iter's choice */ continue; } if ((enum mclass)mc == M_NAME) (void)rng_below(N_HOSTILE); build_payload(); /* fuzz_receive_iter()'s own call */ payload_len = 1 + rng_below(20000); draw_mut_params((enum mclass)mc); if ((enum mclass)mc == M_LONGPACKET && mut.sub_chunk) /* keep the mirror identical to fuzz_receive_iter(): * one conditional draw for the extra payload len */ payload_len = mut.sub_chunk + 1024 + rng_below(8192); { size_t k; for (k = 0; k < payload_len; k++) (void)rng_next(); } } } static int fuzz_receive_iter(int it, enum mclass mc, int *exitcode) { struct rparser rp; int nameidx = (mc == M_NAME) ? (rng_below(N_HOSTILE)) : 0; const char *name = hostile_names[nameidx]; int crc32 = 0; int ctlesc = 0; unsigned long sent_pos = 0; mc_current = mc; build_payload(); snprintf(payload_name, sizeof payload_name, "%s", name); payload_len = 1 + rng_below(20000); /* the clean baseline uses 16-bit CRC everywhere; M_CRCMODE * negotiates 32-bit CRC and sends CRC32-protected frames (lrz * advertises CANFC32 in every ZRINIT). The old "escape * subtleties" concern is obsolete: append_data32/build_binhdr32 * escape control bytes and CRC bytes like lrz expects. */ crc32 = (mc == M_CRCMODE); iter_crc32 = crc32; draw_mut_params(mc); if (mc == M_LONGPACKET && mut.sub_chunk) payload_len = mut.sub_chunk + 1024 + rng_below(8192); { size_t i; for (i = 0; i < payload_len; i++) payload[i] = (unsigned char)rng_next(); } /* frame builder state */ { /* 1. send ZRQINIT up to 4 times */ int tries; int got_zrinit = 0; struct framebuf fb; for (tries = 0; tries < 4 && !got_zrinit; tries++) { unsigned char hdr[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZRQINIT, hdr); tr_mark("> ZRQINIT try %d", tries); mut_send(mc, 0); rp_init(&rp); if (read_frame(&rp, &fb, 2000) && fb.type == ZRINIT) { got_zrinit = 1; /* honor ESCCTL, but stay at CRC16 for the * clean baseline (see crc32 = 0 below) */ ctlesc = (fb.hdr[3] & ESCCTL) ? 1 : 0; } } if (!got_zrinit) { tr_mark("# no ZRINIT: aborting exchange"); /* counted as ok: a receiver may legitimately ignore * a mutated ZRQINIT. But if it printed anything it * is usually a misconfigured invocation - say so * loudly instead of looking like a healthy run. */ if (stderr_len) { fprintf(stderr, "zmodemfuzz: iter %d: target sent no " "ZRINIT and printed:\n %.*s\n", it, (int)(stderr_len < 400 ? stderr_len : 400), stderr_capture); *exitcode = -2; return 1; /* counted as ok (target rejected us) */ } /* total silence: on iteration 0 the target cannot * be "rejecting" anything - it never started * (exec failure in spawn_target, e.g. binary * missing). Anything else is a mutated ZRQINIT * the receiver legitimately ignored. */ if (it == 0) { die("target never spoke (exec failure? " "target built?); fuzzing aborted"); } *exitcode = -2; return 1; /* counted as ok (target rejected us) */ } /* 3. ZFILE with (possibly hostile) name */ tr_mark("# entering ZFILE phase (class=%d)", (int)mc); { unsigned char zdata[1200]; size_t zlen; unsigned char hdr[4]; zlen = build_zfile_data(zdata, sizeof zdata, name, payload_len, ctlesc); hdr[0] = 0; hdr[1] = 0; hdr[2] = 0; hdr[3] = ZCBIN; out_reset(); if (crc32) build_binhdr32(ZFILE, hdr); else build_binhdr16(ZFILE, hdr, ctlesc); { size_t npos = outpos; if (crc32) outpos = append_data32(outbuf, sizeof outbuf, npos, zdata, zlen, ZCRCW, ctlesc); else outpos = append_data16(outbuf, sizeof outbuf, npos, zdata, zlen, ZCRCW, ctlesc); } tr_mark("> ZFILE name=%s len=%lu crc32=%d", name, (unsigned long)payload_len, crc32); mut_send(mc, 0); /* expect ZRPOS (or ZCRC first) */ rp_init(&rp); { /* junk frames (ZNAK etc.) tolerated up to 3 * times per exchange: the counter MUST be * per-iteration - a function-static leaked * across iterations and permanently broke * the exchange wait after 3 junk frames * had accumulated in earlier iterations */ int znaks = 0; while (read_frame(&rp, &fb, 2500)) { if (fb.type == ZRPOS) break; if (fb.type == ZSKIP) { tr_mark("# receiver skipped the file"); goto finish; } if (fb.type == ZCRC) { /* answer the CRC query */ unsigned long crc = 0xFFFFFFFFUL; size_t i; unsigned char chdr[4] = { 0, 0, 0, 0 }; for (i = 0; i < payload_len; i++) crc = updc32(payload[i], crc); crc = ~crc; chdr[0] = crc & 0xff; chdr[1] = (crc >> 8) & 0xff; chdr[2] = (crc >> 16) & 0xff; chdr[3] = (crc >> 24) & 0xff; out_reset(); build_hexhdr(ZCRC, chdr); mut_send(mc, 0); continue; } if (fb.type == ZCAN || fb.type == ZSKIP || fb.type == ZABORT || fb.type == ZFERR) { goto finish; } if (++znaks > 3) break; } } /* M_EOF: premature line drop right after the file * offer was acknowledged - the receiver sees the * carrier go away mid-session */ if (mut.eof_after_zfile) { tr_mark("# dropping the line (M_EOF)"); close(to_target[1]); to_target[1] = -1; target_dead = 1; } } /* 4. ZDATA + subpackets: ONE ZDATA header per frame - after a * ZCRCG-terminated subpacket the receiver expects the next * subpacket to continue within the same frame (no new * header), so all chunks stream here under a single header * until the final ZCRCE. M_LONGPACKET sends one oversized * subpacket (up to 64k, sizes other implementations accept) * and then resyncs like a real sender: on the receiver's * ZRPOS it resumes from the acknowledged offset with legal * 1024-byte subpackets. Receivers with a smaller subpacket * limit (e.g. crzsz: 1024) reject even "legal" chunks; the * post-stream drain below honors their (repeated) ZRPOS * requests and re-streams the remainder from the requested * offset, as many times as they ask - bounded. */ { size_t off = 0; int done = 0; int resyncs = 0; unsigned char hdr[4]; size_t cap = (mc == M_LONGPACKET && mut.sub_chunk) ? mut.sub_chunk : 1024; longpkt_done = 0; hdr[0] = 0; hdr[1] = 0; hdr[2] = 0; hdr[3] = 0; out_reset(); if (crc32) build_binhdr32(ZDATA, hdr); else build_binhdr16(ZDATA, hdr, ctlesc); mut_send(mc, 1); tr_mark("> ZDATA pos=0 (single header)"); if (mc == M_LONGPACKET && mut.sub_chunk) tr_mark("# long-packet size=%u", mut.sub_chunk); while (off < payload_len && !done) { size_t chunk = payload_len - off; int term; if (chunk > cap) chunk = cap; if (off + chunk >= payload_len) { term = ZCRCE; done = 1; } else term = ZCRCG; out_reset(); { size_t npos = outpos; if (crc32) outpos = append_data32(outbuf, sizeof outbuf, npos, payload + off, chunk, term, ctlesc); else outpos = append_data16(outbuf, sizeof outbuf, npos, payload + off, chunk, term, ctlesc); } tr_mark("> subpacket pos=%lu chunk=%lu term=%c", (unsigned long)off, (unsigned long)chunk, term); mut_send(mc, 1); off += chunk; /* M_LONGPACKET: the receiver rejects a * subpacket larger than its buffer * ("Data subpacket too long") and drops * into its error-resync loop; it answers * with ZRPOS(pos) - wait for it and * resume from the acknowledged offset */ if (cap > SUBPKT_MAX) { size_t resume_pos; int got; struct rparser rp3; tr_mark("# long-packet: sent %lu-byte" " subpacket (> %d)", (unsigned long)chunk, SUBPKT_MAX); cap = 1024; rp_init(&rp3); got = read_frame(&rp3, &fb, 3000); if (!got) got = read_frame(&rp3, &fb, 3000); if (got && fb.type == ZRPOS) { resume_pos = (size_t)fb.hdr[0] | ((size_t)fb.hdr[1] << 8) | ((size_t)fb.hdr[2] << 16) | ((size_t)fb.hdr[3] << 24); if (resume_pos > off) resume_pos = off; tr_mark("# long-packet: " "resync at pos=%lu", (unsigned long) resume_pos); hdr[0] = resume_pos & 0xff; hdr[1] = (resume_pos >> 8) & 0xff; hdr[2] = (resume_pos >> 16) & 0xff; hdr[3] = (resume_pos >> 24) & 0xff; out_reset(); if (crc32) build_binhdr32(ZDATA, hdr); else build_binhdr16(ZDATA, hdr, ctlesc); mut_send(mc, 1); tr_mark("> ZDATA pos=%lu " "(resync)", (unsigned long) resume_pos); off = resume_pos; continue; } tr_mark("# long-packet: no ZRPOS " "(receiver kept it), " "continuing"); } /* M_TRUNC: cut the stream after a bounded * number of subpackets - the receiver is * left waiting for data that never comes */ if (mut.trunc_stop >= 0 && (int)(off / 1024) >= mut.trunc_stop) { tr_mark("# truncating stream after " "%d subpackets", mut.trunc_stop); sent_pos = off; goto after_data; } } /* the stream is out; a receiver that rejected chunks * (small subpacket limit) is error-retrying and has * sent ZRPOS requests while we were streaming. Honor * them now, newest wins, and re-stream the remainder * from the requested offset - a real sender does * exactly this, as many times as it takes. Bounded: * a wedged receiver must not extend the iteration * forever. IMPORTANT: after a rejection the receiver * keeps scanning the leftover of the rejected data * as garbage; re-streaming immediately would feed * THAT scan too (the receiver then errors again). * So after each ZRPOS: quiesce first (collect more * ZRPOS for a grace period), then stream once. * Gated on M_LONGPACKET only: for the other classes * a receiver stuck in an error loop over corrupted * data IS the mutation - answering its retries would * turn every BYTEFLIP/FLAGS iteration into a * 14s resync marathon instead of a bounded abort. * SKIPPED when the stream ran to completion * (off >= payload_len): the ZEOF at after_data: * is due the instant the last subpacket is out. * Waiting here for the receiver's next ZRPOS lets * its error-retry budget expire on timeouts before * the ZEOF arrives, and lrz then unlinks the * COMPLETE file (observed: seed 453009526 it 535 - * 20 queued ZRPOS(73598) answered post-mortem). */ if (off < payload_len && mc == M_LONGPACKET && mut.sub_chunk) { size_t last_pos = 0; int same_pos = 0; size_t wait_ms = 200; for (;;) { size_t p2; struct rparser rp4; size_t newest; int got_any; /* quiesce: collect ZRPOS until the * receiver stops asking */ newest = payload_len; got_any = 0; for (;;) { rp_init(&rp4); if (!read_frame(&rp4, &fb, (int)wait_ms)) break; if (fb.type == ZRPOS) { newest = (size_t)fb.hdr[0] | ((size_t)fb.hdr [1] << 8) | ((size_t)fb.hdr [2] << 16) | ((size_t)fb.hdr [3] << 24); if (newest > payload_len) newest = payload_len; got_any = 1; if (newest >= payload_len) { /* the receiver * has everything: * it wants the * ZEOF, not more * collecting. Break * out NOW - the * receiver is * burning its * error-retry * budget (one ZRPOS * per timeout * round, 20 rounds) * while we collect; * if the budget * expires before our * ZEOF lands it * unlinks the * COMPLETE file * (observed as the * two LONGPKT fails * of seed * 1812719613). */ break; } } else if (fb.type == ZSKIP || fb.type == ZCAN || fb.type == ZABORT || fb.type == ZFERR) { tr_mark("# receiver " "aborted " "during " "resync"); goto finish; } } if (!got_any) break; p2 = newest; if (resyncs >= 20) { tr_mark("# resync budget " "exhausted, " "abandoning"); goto finish; } resyncs++; tr_mark("# resync at pos=%lu", (unsigned long)p2); if (p2 >= payload_len) { /* the receiver already has * everything: it wants the * ZEOF, not another header */ break; } hdr[0] = p2 & 0xff; hdr[1] = (p2 >> 8) & 0xff; hdr[2] = (p2 >> 16) & 0xff; hdr[3] = (p2 >> 24) & 0xff; out_reset(); if (crc32) build_binhdr32(ZDATA, hdr); else build_binhdr16(ZDATA, hdr, ctlesc); mut_send(mc, 1); tr_mark("> ZDATA pos=%lu (resync)", (unsigned long)p2); /* re-stream payload[p2..] with * legal 1024-byte subpackets */ { size_t o2 = p2; while (o2 < payload_len) { size_t c2 = payload_len - o2; size_t npos; if (c2 > 1024) c2 = 1024; out_reset(); npos = outpos; if (crc32) outpos = append_data32( outbuf, sizeof outbuf, npos, payload + o2, c2, (o2 + c2 >= payload_len) ? ZCRCE : ZCRCG, ctlesc); else outpos = append_data16( outbuf, sizeof outbuf, npos, payload + o2, c2, (o2 + c2 >= payload_len) ? ZCRCE : ZCRCG, ctlesc); mut_send(mc, 1); o2 += c2; } tr_mark("# re-streamed " "pos=%lu..%lu", (unsigned long)p2, (unsigned long) payload_len); } /* if the receiver asks for the SAME * position again, it discarded our * re-stream as garbage: back off so * its scanner can drain the pipe */ if (p2 == last_pos) { same_pos++; if (same_pos >= 2) wait_ms = 1200; } else { same_pos = 0; last_pos = p2; wait_ms = 200; } /* the receiver has everything: stop * resyncing entirely - the ZEOF is * sent at after_data:, reached the * moment this loop breaks. Waiting * here (or for another ZRPOS) while * the receiver sits in ST_HDR lets * its 20-round error budget expire * before the ZEOF lands, and it * unlinks the COMPLETE file. */ if (p2 >= payload_len) goto zeof_now; } } zeof_now: sent_pos = payload_len; if (mc == M_LONGPACKET && mut.sub_chunk) longpkt_done = 1; } after_data: /* 5. ZEOF (skipped after M_TRUNC: the receiver is left * hanging mid-stream - that is the mutation). The cut is * followed by a CAN burst so the receiver cancels the * file promptly instead of waiting out its full 10s * Rxtimeout retries: the mid-stream interruption (and the * resulting partial write) is the mutation, and the * bounded cancel keeps the iteration fast. */ if (mut.trunc_stop >= 0) { /* six CANs: lrz's cancount needs five consecutive * CANs to trigger zcancel */ unsigned char cans[6] = { CAN, CAN, CAN, CAN, CAN, CAN }; tr_mark("# truncated mid-stream: cancelling"); send_bytes(cans, sizeof cans); goto finish; } { unsigned char hdr[4]; hdr[0] = sent_pos & 0xff; hdr[1] = (sent_pos >> 8) & 0xff; hdr[2] = (sent_pos >> 16) & 0xff; hdr[3] = (sent_pos >> 24) & 0xff; out_reset(); build_hexhdr(ZEOF, hdr); tr_mark("> ZEOF pos=%lu", (unsigned long)sent_pos); mut_send(mc, 1); } /* 6. wait for ZRINIT (next file) or ZFIN/skip, then ZFIN */ tr_mark("# entering final wait"); { int final = 0; int rounds; for (rounds = 0; rounds < 6 && !final; rounds++) { rp_init(&rp); if (!read_frame(&rp, &fb, 1200)) break; switch (fb.type) { case ZRINIT: final = 1; break; case ZRPOS: /* resume request after an M_LONGPACKET * resync was already honored above; * here it means an error loop we do * not replay - just abort */ final = 1; break; case ZFIN: final = 2; break; case ZSKIP: final = 1; break; case ZCAN: final = 3; break; default: break; } } if (final != 2) { unsigned char hdr[4] = { 0, 0, 0, 0 }; struct rparser rp2; out_reset(); build_hexhdr(ZFIN, hdr); tr_mark("> ZFIN (final)"); mut_send(mc, 0); /* complete the close handshake: the receiver * answers ZFIN, then expects the "OO" - * without it it lingers in bounded retries */ rp_init(&rp2); if (read_frame(&rp2, &fb, 1500) && fb.type == ZFIN) { unsigned char oo[2]; oo[0] = 'O'; oo[1] = 'O'; tr_mark("> OO"); send_bytes(oo, sizeof oo); } } } } finish: /* every early exit skips wait_target() - a pending alarm would * otherwise fire mid-later-iteration where nothing checks it * (observed: harness killed by its own SIGALRM against * zmtx-zmrx-1.02, which ignores reads) */ alarm(0); (void)it; (void)exitcode; return 0; } /* main-loop hook: an M_LONGPACKET exchange that ran to completion sends * only clean frames after the oversized one, so the received file must * match byte for byte - the resync path is where resume-position bugs * would live. */ static int longpkt_completed(void) { return mc_current == M_LONGPACKET && mut.sub_chunk != 0 && longpkt_done; } /* --- phase 2: fuzz-send (target = lsz; we are the receiver) --- */ static void fuzz_send_iter(void) { struct rparser rp; struct framebuf fb; int crc32 = 0; /* byte-level mutation class for the receiver's own frames: the * mirror of receive mode. The choice below still decides the * session-level behavior; mc corrupts the answer frames. Every * 17th iteration is forced to M_NONE (like receive mode's clean * baseline) so the data-phase ACK loop can complete cleanly - * the mutation classes corrupt every ACK by design, which would * otherwise keep lsz in its bounded retry paths forever. The * override happens AFTER the draw: the PRNG stream is unaffected * (which is what makes send-mode -S replay possible). */ enum mclass mc = (enum mclass)(rng_below(N_MCLASS - 1) + 1); if (current_iteration % 17 == 0) mc = M_NONE; draw_mut_params(mc); /* wait for the first ZRQINIT */ rp_init(&rp); if (!read_frame(&rp, &fb, 5000)) { /* the sender never even spoke. A sender that printed * to stderr is a misconfigured invocation - fail * loudly instead of masquerading as a healthy * "silence" iteration. */ if (stderr_len) { fprintf(stderr, "zmodemfuzz: target sent nothing and printed:\n" " %.*s\n", (int)(stderr_len < 400 ? stderr_len : 400), stderr_capture); die("target never spoke (bad file argument?); " "fuzzing aborted"); } /* total silence means the target never started: the * classic case is an exec failure (_exit(127) in * spawn_target, e.g. binary missing or not built). * This used to return and the main loop still booked * the iteration into tx_stats[0] ("silence") - a run * against a nonexistent target then looked perfectly * green. Die loudly instead. */ die("target never spoke and said nothing " "(exec failure? target built?); fuzzing aborted"); } { int got_file = 0; for (;;) { unsigned char hdr[4] = { 0, 0, 0, CANFDX | CANOVIO | CANBRK | CANFC32 }; if (target_dead) break; /* the target is gone */ out_reset(); build_hexhdr(ZRINIT, hdr); tr_mark("< ZRINIT (hostile receiver ready)"); send_bytes(outbuf, outpos); /* session init: never mutated */ rp_init(&rp); if (read_frame(&rp, &fb, 5000)) { if (fb.type == ZFILE || fb.type == ZSINIT) { got_file = 1; break; } } } if (!got_file && stderr_len) { /* lsz answered ZRQINIT but then died without * ever offering a file, and said why on stderr: * that is a misconfigured invocation (e.g. a * file argument that does not exist relative to * the harness's cwd) - the classic symptom is * "cannot open : No such file or * directory". This used to masquerade as a * healthy 0-failure run of "silence" * iterations. Fail loudly instead. */ fprintf(stderr, "zmodemfuzz: target never offered a file and " "printed:\n %.*s\n", (int)(stderr_len < 400 ? stderr_len : 400), stderr_capture); die("target never offered a file (bad file " "argument?); fuzzing aborted"); } if (!got_file) { /* same as above: a live lsz always offers a file * or says something on stderr; total silence is * an exec/startup failure and must not book a * healthy "silence" iteration */ die("target never offered a file and said nothing " "(exec failure? target built?); fuzzing aborted"); } } /* now ZFILE arrived: decide hostile answer */ { unsigned int choice = rng_below(n_tx_choices); /* clean-baseline iterations always take the ACK loop: * the mutated choices would keep lsz in its bounded * handshake retry paths and never exercise the data * phase; the PRNG stream keeps its draw (which is what * makes send-mode -S replay possible) */ if (current_iteration % 17 == 0) choice = 11; send_choice = (int)choice; switch (choice) { case 0: /* never respond: lsz must hit its retry bounds */ drain_target(); break; case 1: { /* ZNAK loop */ int i; for (i = 0; i < 5; i++) { unsigned char h[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZNAK, h); mut_send(mc, 1); read_frame(&rp, &fb, 2000); } break; } case 2: { /* skip the file */ unsigned char h[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZSKIP, h); tr_mark("< ZSKIP"); mut_send(mc, 1); read_frame(&rp, &fb, 3000); break; } case 3: { /* abort with ZABORT: lsz must reply ZFIN+OO */ unsigned char h[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZABORT, h); tr_mark("< ZABORT"); mut_send(mc, 1); read_frame(&rp, &fb, 5000); { unsigned char h2[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZFIN, h2); mut_send(mc, 1); } break; } case 4: { /* fatal file error ZFERR: same as ZABORT */ unsigned char h[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZFERR, h); tr_mark("< ZFERR"); mut_send(mc, 1); read_frame(&rp, &fb, 5000); { unsigned char h2[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZFIN, h2); mut_send(mc, 1); } break; } case 5: { /* ZCRC request (crc check) then skip */ unsigned char h[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZCRC, h); mut_send(mc, 1); read_frame(&rp, &fb, 3000); { unsigned char h2[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZSKIP, h2); mut_send(mc, 1); } break; } case 6: { /* challenge (receiver MUST NOT send; lsz MAY ack) */ unsigned char h[4] = { 0x12, 0x34, 0x56, 0x78 }; out_reset(); build_hexhdr(ZCHALLENGE, h); tr_mark("< ZCHALLENGE (protocol-hostile)"); mut_send(mc, 1); read_frame(&rp, &fb, 2000); break; } case 7: { /* RPOS to absurd offset */ unsigned char h[4] = { 0xff, 0xff, 0xff, 0x7f }; out_reset(); build_hexhdr(ZRPOS, h); tr_mark("< ZRPOS 0x7fffffff"); mut_send(mc, 1); read_frame(&rp, &fb, 3000); break; } case 8: { /* cancel burst */ int i; for (i = 0; i < 9; i++) { unsigned char c = CAN; send_bytes(&c, 1); } tr_mark("< CAN*9"); break; } case 9: { /* ZRINIT storm: ack nothing, keep ZRINITing */ int i; for (i = 0; i < 6; i++) { unsigned char h[4] = { 0, 0, 0, CANFDX | CANOVIO }; out_reset(); build_hexhdr(ZRINIT, h); mut_send(mc, 1); read_frame(&rp, &fb, 1000); } break; } case 10: { /* finish the session politely */ unsigned char h[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZFIN, h); tr_mark("< ZFIN (receiver quits)"); mut_send(mc, 1); read_frame(&rp, &fb, 3000); break; } case 11: { /* the data-phase ACK loop: act as a real receiver - * answer the ZFILE's ZCRCW with ZRPOS(0), then ack * every data subpacket: ZCRCQ → ZACK(pos), ZCRCW → * ZACK(pos), ZCRCE → ZACK(pos) + ZEOF handling and * the final ZRINIT (next-file) close. All answer * frames go through mut_send(mc, 1), so the 14 * byte-mutation classes corrupt ACKs, positions and * CRCs mid-stream - this is the only send-mode * choice that exercises the ACK path at all. */ unsigned char rh[4]; unsigned long ack_pos = 0; long n_acked = 0; int rounds; int data_phase_open = 0; /* ZRINIT for the data phase: advertise CANFDX with * a 4096-byte buffer so lsz opens its streaming * window (Txwindow = (Rxbuflen/2/64)*64, lsz.c) and * pings ZCRCQ every Txwspac bytes - without a * buffer size it streams ZCRCG-only and the ACK * loop stays idle until ZCRCE. CANFC32 stays on: * when lsz negotiates CRC32 the data subpackets * arrive with 4-byte CRCs (R_BIN32) and our ZACKs * must be built with the 32-bit builder. */ rh[0] = 0x00; /* Rxbuflen low */ rh[1] = 0x10; /* Rxbuflen high: 0x1000 = 4096 */ rh[2] = 0; rh[3] = CANFDX | CANOVIO | CANBRK | CANFC32; out_reset(); build_hexhdr(ZRINIT, rh); tr_mark("< ZRINIT (ACK-loop, buffer 4096)"); send_bytes(outbuf, outpos); /* clean: session frame */ for (rounds = 0; rounds < 100; rounds++) { if (target_dead) break; rp_init(&rp); /* 8s, not 4s: after a ZRINIT bad-ack lsz * eats input for up to 5s (READLINE_PF(50) * in its ZPAD hunter) before it resends * the ZFILE; 4s missed the resend every * time ("0 subpackets acked"). Once the * data phase is open, lsz's stdio * buffering can hold ZCRCG subpackets * for a while (pipes: auto-flush at * ~4KB), so keep reading up to 15s * before declaring the sender dead. */ if (!read_frame(&rp, &fb, data_phase_open ? 15000 : 8000)) break; /* lsz stopped talking */ ack_pos = (unsigned long)fb.hdr[0] | ((unsigned long)fb.hdr[1] << 8) | ((unsigned long)fb.hdr[2] << 16) | ((unsigned long)fb.hdr[3] << 24); switch (fb.type) { case ZFILE: case ZSINIT: /* re-offer / attention string: * answer ZRPOS(0) - the sender * (re)starts the data phase. * Handshake frame: pass through * UNMUTATED (like receive mode's * mut_send(mc, 0)) - a mutated * ZRPOS fails lsz's CRC check and * lsz resends the ZFILE forever * (bounded by its bad_acks>3), so * the data phase would never open * for the mutation classes. The * ZACK/ZNAK data-phase answers * below stay mutated. */ rh[0] = 0; rh[1] = 0; rh[2] = 0; rh[3] = 0; out_reset(); build_hexhdr(ZRPOS, rh); tr_mark("< ZRPOS pos=0"); mut_send(mc, 0); break; case ZDATA: /* the parser emits the ZDATA * frame's FIRST subpacket as a * ZDATA event (fb.term carries the * ZCRCx); later subpackets of the * same frame arrive as more ZDATA * events. Both are acked below via * the shared term-based path. */ if (fb.term != ZCRCE && fb.term != ZCRCG && fb.term != ZCRCQ && fb.term != ZCRCW) break; /* pure header */ goto ack_subpacket; case ZEOF: /* the sender is done: confirm with * ZRINIT (file accepted) and end * the loop on a clean note */ rh[0] = 0; rh[1] = 0; rh[2] = 0; rh[3] = CANFDX | CANOVIO | CANBRK | CANFC32; out_reset(); build_hexhdr(ZRINIT, rh); tr_mark("< ZRINIT (after ZEOF, " "file accepted)"); send_bytes(outbuf, outpos); rounds = 1000; /* leave the loop */ break; case ZCAN: case ZABORT: case ZFERR: tr_mark("# sender aborted the " "data phase"); rounds = 1000; break; case ZFIN: rh[0] = 0; rh[1] = 0; rh[2] = 0; rh[3] = 0; out_reset(); build_hexhdr(ZFIN, rh); tr_mark("< ZFIN (close)"); mut_send(mc, 1); rounds = 1000; break; default: if (fb.term != ZCRCE && fb.term != ZCRCG && fb.term != ZCRCQ && fb.term != ZCRCW) break; ack_subpacket: /* a data subpacket: the ack * carries the file offset lsz has * sent so far (header position + * acked bytes); lsz's getinsync * compares it with its bytes_sent * and eats mismatched acks */ if (fb.crc_ok) { ack_pos += fb.data_len; rh[0] = (unsigned char) ack_pos; rh[1] = (unsigned char) (ack_pos >> 8); rh[2] = (unsigned char) (ack_pos >> 16); rh[3] = (unsigned char) (ack_pos >> 24); out_reset(); if (crc32) build_binhdr32(ZACK, rh); else build_hexhdr(ZACK, rh); tr_mark("< ZACK pos=%lu " "(term=%c)", ack_pos, fb.term); } else { /* corrupted subpacket: * protocol answer is * ZNAK; position unchanged */ rh[0] = 0; rh[1] = 0; rh[2] = 0; rh[3] = 0; out_reset(); build_hexhdr(ZNAK, rh); tr_mark("< ZNAK (bad " "subpacket CRC, " "term=%c)", fb.term); } mut_send(mc, 1); n_acked++; if (fb.type == ZDATA) data_phase_open = 1; break; } } tr_mark("# ACK-loop: %ld subpackets acked", n_acked); /* six CANs so lsz exits promptly instead of * waiting out saybibi()'s 60s read timeout (the * session was torn down mid-stream; the same * trick keeps receive-mode M_TRUNC bounded) */ { unsigned char cans[6] = { CAN, CAN, CAN, CAN, CAN, CAN }; tr_mark("# ACK-loop: cancelling"); send_bytes(cans, sizeof cans); } break; } default: { /* ZRPOS offset 0: force restart, then skip */ unsigned char h[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZRPOS, h); mut_send(mc, 1); read_frame(&rp, &fb, 3000); { unsigned char h2[4] = { 0, 0, 0, 0 }; out_reset(); build_hexhdr(ZSKIP, h2); mut_send(mc, 1); read_frame(&rp, &fb, 3000); } break; } } } (void)crc32; } /* --- per-iteration setup/teardown --- */ static void setup_iteration(void) { char cmd[1024]; FILE *f; snprintf(fuzzdir, sizeof fuzzdir, "/tmp/zmodemfuzz-%ld", (long)getpid()); snprintf(recvdir, sizeof recvdir, "%s/recv", fuzzdir); snprintf(canary, sizeof canary, "%s/escape-target.bin", fuzzdir); snprintf(canary_pristine, sizeof canary_pristine, "%s/cp", fuzzdir); snprintf(canary2, sizeof canary2, "%s/outside/escape-target.bin", fuzzdir); snprintf(canary2_pristine, sizeof canary2_pristine, "%s/cp2", fuzzdir); /* idempotent */ mkdir(fuzzdir, 0777); { char cmd2[1100]; snprintf(cmd2, sizeof cmd2, "rm -rf %s", recvdir); run_cmd(cmd2); mkdir(recvdir, 0777); } snprintf(transcript_name, sizeof transcript_name, "%s/fuzz-trans-%ld-%ld.log", fuzzdir, seed, (long)getpid()); transcript = fopen(transcript_name, "w"); if (!transcript) fprintf(stderr, "zmodemfuzz: cannot open transcript %s: %s\n", transcript_name, strerror(errno)); /* outside/: a real directory beside the receiving directory; * recvdir/sub is a symlink to it, so a receiver that escapes the * receiving directory via a symlinked directory lands in outside/ * and touches the canary there */ snprintf(cmd, sizeof cmd, "mkdir -p %s/outside", fuzzdir); run_cmd(cmd); snprintf(cmd, sizeof cmd, "ln -sfn ../outside %s/sub 2>/dev/null", recvdir); run_cmd(cmd); /* payload-sized canary */ f = fopen(canary, "wb"); if (f) { fwrite(payload, 1, 1024, f); fclose(f); } f = fopen(canary_pristine, "wb"); if (f) { fwrite(payload, 1, 1024, f); fclose(f); } f = fopen(canary2, "wb"); if (f) { fwrite(payload, 1024, 1, f); fclose(f); } f = fopen(canary2_pristine, "wb"); if (f) { fwrite(payload, 1024, 1, f); fclose(f); } } static void teardown_iteration(void) { char cmd[1100]; if (transcript) { fclose(transcript); transcript = NULL; } /* persist the target's stderr next to the transcript; with -k it * stays in the working dir, otherwise it is deleted again with * the dir below (failures copy it to /tmp first, see fail()) */ if (stderr_len) { char sp[1100]; FILE *f; snprintf(sp, sizeof sp, "%s/target-stderr-%ld-it%ld.log", fuzzdir, seed, current_iteration); f = fopen(sp, "wb"); if (f) { fwrite(stderr_capture, 1, stderr_len, f); fclose(f); } } if (keep_dirs) return; /* debugging: keep the working tree */ snprintf(cmd, sizeof cmd, "rm -rf %s", fuzzdir); run_cmd(cmd); } /* check invariants after one iteration; returns string failure or NULL */ static const char * check_invariants(int exitcode, int hang) { /* distinct string literals per exit code so the fail-reason * histogram can group by pointer identity */ static char reason[256]; if (hang) return "target hang (alarm)"; if (exitcode < 0) { switch (-exitcode) { case 2: return "death by signal 2"; case 4: return "death by signal 4"; case 6: return "death by signal 6"; case 7: return "death by signal 7"; case 8: return "death by signal 8"; case 11: return "death by signal 11"; default: break; } snprintf(reason, sizeof reason, "death by signal %d", -exitcode); return reason; } /* exitcode 0/1/4/24/127/128+ are fine; anything else is suspicious. * 127 is lrz's Security-Violation outcome: checkpath() rejects a * hostile name (e.g. the M_NAME class sends "..") with * bibi(-1) → fatal_error(128 + -1, ...) → exit(127). That is a * correct, intended rejection, not a fuzzer finding. * 4 is zmtx-zmrx-2.02's EXIT_TRANSFER_FAILED: its designed * abort when a transfer cannot complete (the mutation classes * corrupt exchanges by design - a receiver giving up then is * like lrz's exit 1). A clean iteration (it % 17 == 0) must * NEVER end in 4; that was the harness's missing trailing-NUL * bug in build_zfile_data, fixed. * 24 is zmtx-zmrx-1.02's "remote aborted": it counts >=5 CAN * bytes as a receiver cancel and tears down (verified directly: * 5 raw CANs on stdin → exit 24, no message; the harness's * post-transfer 6-CAN close burst lands as a cancel even on a * clean exchange). Same class as 4 - designed cancel, not a bug. */ if (exitcode != 0 && exitcode != 1 && exitcode != 4 && exitcode != 24 && exitcode != 127 && exitcode < 0x80) { switch (exitcode) { case 2: return "odd exit code 2"; case 3: return "odd exit code 3"; case 5: return "odd exit code 5"; case 101: return "odd exit code 101"; case 126: return "odd exit code 126"; case 128: return "odd exit code 128"; default: break; } snprintf(reason, sizeof reason, "odd exit code %d", exitcode); return reason; } if (file_changed(canary, canary_pristine)) return "parent-dir canary modified"; if (file_changed(canary2, canary2_pristine)) return "subdir canary modified"; return NULL; } /* after a clean receive-mode exchange: SOME file in the receiving * directory (lrz may rename hostile names) must match the payload byte * for byte */ static const char * check_received(void) { static unsigned char buf[131072]; DIR *d; struct dirent *e; d = opendir(recvdir); if (!d) return "clean exchange: receiving directory vanished"; while ((e = readdir(d)) != NULL) { char path[1024]; int fd; ssize_t n; if (!strcmp(e->d_name, ".") || !strcmp(e->d_name, "..")) continue; snprintf(path, sizeof path, "%s/%s", recvdir, e->d_name); fd = open(path, O_RDONLY); if (fd < 0) continue; n = read(fd, buf, sizeof buf); close(fd); if ((size_t)n == payload_len && memcmp(buf, payload, payload_len) == 0) { closedir(d); return NULL; } } closedir(d); return "clean exchange: no file matches the payload"; } /* --- selftest: the clean exchange must always pass --- */ static int selftest_receive(long it, int *exitcode) { /* like fuzz_receive_iter but with mc = M_NONE and a fixed name */ return fuzz_receive_iter(it, M_NONE, exitcode); } /* --- main loop --- */ static void usage(void) { fprintf(stderr, "Usage: zmodemfuzz -m receive|send [-s SEED] [-n N] [-S N] [-t SEC] [--] TARGET [args...]\n" " -m receive target is a receiver (lrz); fuzzer plays a mutating sender\n" " -m send target is a sender (lsz); fuzzer plays a hostile receiver.\n" " Its file arguments are anchored to THIS process's cwd\n" " (relative paths like test/4k.bin work from anywhere)\n" " -s SEED deterministic PRNG seed (default: time-based)\n" " -n N iterations (default 200; FUZZITER overrides when -n is absent)\n" " -S N fast-forward to iteration N: replay the PRNG draws of\n" " iterations 0..N-1 without running the target, then run\n" " iterations N..N-1+(-n N). NOTE: the draw sequence is\n" " only stable within one binary - changes to the mutation\n" " code invalidate older seeds' offsets\n" " -t SEC per-iteration timeout in seconds (default 20). Keep this\n" " at 8s or more for exploratory runs: the receiver has a\n" " fixed 10s internal retry wait, and smaller values cut\n" " recovery paths short and make clean baselines flaky.\n" " Small values (1-5s) are fine for targeted -S replays.\n" " -k keep the per-iteration working directory (debugging)\n" " -P, --progress print a progress line (with elapsed ms) per iteration\n" " --selftest run the clean-baseline exchange only\n\n" " A target that exits (or prints to stderr) before speaking ZMODEM is\n" " reported loudly, not silently skipped.\n"); exit(2); } int main(int argc, char *argv[]) { int i; setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); init_crc_tables(); for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-m") && i + 1 < argc) { if (!strcmp(argv[i + 1], "receive")) mode_receive = 1; else if (!strcmp(argv[i + 1], "send")) mode_receive = 0; else usage(); i++; } else if (!strcmp(argv[i], "-s") && i + 1 < argc) { seed = strtol(argv[++i], NULL, 0); } else if (!strcmp(argv[i], "-n") && i + 1 < argc) { iterations = strtol(argv[++i], NULL, 0); } else if (!strcmp(argv[i], "-S") && i + 1 < argc) { start_iteration = strtol(argv[++i], NULL, 0); /* replays are for debugging a run of tens to * thousands of iterations. Each fast-forwarded * iteration costs ~200 PRNG draws, so a large * -S spins for hours at 100% CPU with no alarm * protection (observed with a seed-sized value). * Die before the freeze instead. */ if (start_iteration < 0 || start_iteration > 10000000) die("unreasonable -S start_iteration %ld " "(replay range is small; did you mean " "-s for the seed?)", start_iteration); } else if (!strcmp(argv[i], "-t") && i + 1 < argc) { alarm_seconds = atoi(argv[++i]); } else if (!strcmp(argv[i], "--selftest")) { do_selftest = 1; } else if (!strcmp(argv[i], "-k")) { keep_dirs = 1; } else if (!strcmp(argv[i], "-P") || !strcmp(argv[i], "--progress")) { show_progress = 1; } else if (!strcmp(argv[i], "--")) { i++; break; } else if (argv[i][0] == '-' && argv[i][1]) { usage(); } else { break; } } if (i >= argc) usage(); target_argc = 0; for (; i < argc && target_argc < 64; i++) target_argv[target_argc++] = argv[i]; if (!target_argc) usage(); /* the child chdir()s to the receiving directory in receive mode: * make every target argument that names an executable OR a * readable regular file a path relative to OUR cwd, so relative * invocations keep working (this covers nested execs like * zmodemsnif lrz and send-mode data files like test/4k.bin - * in send mode the target's file arguments are relative to the * harness's cwd, not the fuzz working directory). Absolute paths * (leading '/') must NOT be touched: rewriting "/bin/true" * produced "//bin/true" and a confusing exit 127. */ { static char abspath[68][4096]; char cwd[2048]; int ai; if (getcwd(cwd, sizeof cwd) != NULL) { for (ai = 0; ai < target_argc; ai++) { struct stat st; if (target_argv[ai][0] == '-' || target_argv[ai][0] == '/') continue; /* readable regular files (lsz's data * arguments like test/4k.bin) and * executables (nested execs like * zmodemsnif lrz) are both anchored * to OUR cwd */ if (stat(target_argv[ai], &st) == 0 && S_ISREG(st.st_mode) && access(target_argv[ai], R_OK) == 0) ; /* fall through to rewrite */ else if (access(target_argv[ai], X_OK) != 0) continue; snprintf(abspath[ai], sizeof abspath[ai], "%s/%s", cwd, target_argv[ai]); target_argv[ai] = abspath[ai]; } } } if (mode_receive < 0) usage(); if (iterations < 0) { const char *e = getenv("FUZZITER"); iterations = e ? strtol(e, NULL, 0) : 200; } if (!seed) seed = (long)time(NULL) ^ ((long)getpid() << 16); rng_state = (unsigned long long)seed; if (!rng_state) rng_state = 88172645463325252ULL; fuzz_start = time(NULL); /* install on_alarm via sigaction WITHOUT SA_RESETHAND: signal() * here came up one-shot (SA_RESETHAND visible in strace), so the * SECOND alarm fired with SIG_DFL and killed the harness against * targets that outlive one deadline (zmtx-zmrx-1.02). The handler * must stay installed for the whole run. */ { struct sigaction sa; memset(&sa, 0, sizeof sa); sa.sa_handler = on_alarm; sigemptyset(&sa.sa_mask); sigaction(SIGALRM, &sa, NULL); } signal(SIGPIPE, SIG_IGN); tr_mark("# zmodemfuzz seed=%ld mode=%s iters=%ld target=%s", seed, mode_receive ? "receive" : "send", iterations, target_argv[0]); snprintf(fuzzdir, sizeof fuzzdir, "/tmp/zmodemfuzz-%ld", (long)getpid()); { long it; int failures = 0; if (start_iteration > 0) { if (start_iteration >= iterations) iterations = start_iteration + 1; fast_forward_rng(start_iteration); tr_mark("# fast-forwarded rng to iteration %ld", start_iteration); } for (it = start_iteration; it < iterations; it++) { int exitcode = 0; const char *bad = NULL; struct timespec ts_start; struct timespec ts_end; struct class_stats *st = NULL; int hang; long ms; current_iteration = it; setup_iteration(); build_payload(); clock_gettime(CLOCK_MONOTONIC, &ts_start); if (pipe(to_target) < 0 || pipe(from_target) < 0 || pipe(target_stderr) < 0) die("pipe: %s", strerror(errno)); spawn_target(); stderr_len = 0; rxbuf_reset(); /* a previous iteration's EPIPE may have poisoned the * write path: clear the flag and any bytes that were * buffered when the old target went away, so the new * target starts with a clean output stream */ target_dead = 0; to_target_buf.len = 0; iter_crc32 = 0; /* set by fuzz_receive_iter if CRC32 negotiated */ if (mode_receive) { if (do_selftest) { send_choice = -1; selftest_receive(it, &exitcode); } else { enum mclass mc = (enum mclass)(rng_below(N_MCLASS - 1) + 1); if (it % 17 == 0) mc = M_NONE; /* keep a clean baseline */ fuzz_receive_iter(it, mc, &exitcode); st = &rx_stats[mc]; /* the harness has finished its part * of the exchange; the target may * still linger (e.g. waiting for * the next ZRQINIT after a ZSKIP * or for a sender that never * resumes). Close the write end so * the target sees EOF and exits * instead of burning the alarm. */ if (to_target[1] >= 0) { close(to_target[1]); to_target[1] = -1; } } } else { fuzz_send_iter(); exitcode = 0; st = &tx_stats[send_choice >= 0 && send_choice < 13 ? send_choice : 0]; /* same as receive mode: the harness has finished * its part; close the write end so the target * (lsz) sees EOF and exits instead of burning * the alarm (e.g. inside saybibi()'s 60s read) */ if (to_target[1] >= 0) { close(to_target[1]); to_target[1] = -1; } } { int w = wait_target(&exitcode); int clean = (mode_receive && (it % 17 == 0 || do_selftest)); hang = (w < 0); if (hang) { /* hang: for mutation iterations an * exchange that deliberately breaks * mid-stream can leave the receiver * waiting for data that never comes - * that is the mutation working, not a * target bug. Only signal deaths, * canary violations and clean-exchange * failures are bugs. */ if (!clean) { tr_mark("# target waited: " "expected after a " "mid-stream mutation"); failures += 0; if (st) st->timeouts++; } else { fail("hang", it, exitcode); failures++; if (st) st->timeouts++; } } else { bad = check_invariants(exitcode, 0); if (bad && exitcode == -14) { /* the child's alarm fired: a * mutation (or, in send mode, * every iteration is one) * broke the exchange mid-stream * by design and the target * waited - expected */ bad = NULL; /* still bookkeep the budget burn */ if (st) st->timeouts++; } if (!bad && clean) bad = check_received(); if (!bad && !clean && longpkt_completed()) bad = check_received(); if (bad) { fail(bad, it, exitcode); failures++; if (st) note_fail_reason(bad, mode_receive, mode_receive ? (long)(st - rx_stats) : send_choice < 13 ? send_choice : 0); } } } close_pipes(); teardown_iteration(); clock_gettime(CLOCK_MONOTONIC, &ts_end); ms = (ts_end.tv_sec - ts_start.tv_sec) * 1000L + (ts_end.tv_nsec - ts_start.tv_nsec) / 1000000L; /* per-class statistics (selftest runs are skipped: * they have no class) */ if (st) { st->count++; st->total_ms += ms; if (ms > st->max_ms) st->max_ms = ms; if (hang) st->hangs++; if (bad) st->fails++; if (iter_crc32) st->crc32++; } if (show_progress) { fprintf(stderr, "zmodemfuzz: %ld/%ld iters, " "%d failures, %ld ms\n", it + 1, iterations, failures, ms); } else if ((it % 20) == 19) { fprintf(stderr, "zmodemfuzz: %ld/%ld iters, " "%d failures\n", it + 1, iterations, failures); } } fprintf(stderr, "zmodemfuzz: done, %ld iterations, %d failures\n", iterations - start_iteration, failures); /* per-class summary: one row per mutation class (receive * mode) or hostile choice (send mode) */ { const char *names[N_MCLASS] = { "NONE", "BYTEFLIP", "CRC16", "CRC32", "CRCMODE", "FRAMETYPE", "ZDLE_ILL", "POSITION", "FLAGS", "GARBAGE", "CANCAN", "TRUNC", "EOF", "NAME", "LONGPKT" }; const char *choice_names[13] = { "silence", "ZNAK", "ZSKIP", "ZABORT", "ZFERR", "ZCRC+skip", "ZCHALLENGE", "ZRPOS-max", "CAN*9", "ZRINIT-storm", "ZFIN", "ACK-loop", "ZRPOS-0+skip" }; long ci; fprintf(stderr, "zmodemfuzz: class summary " "(seed=%ld mode=%s t=%ds target=%s)\n", seed, mode_receive ? "receive" : "send", alarm_seconds, target_argv[0]); fprintf(stderr, "zmodemfuzz: " "(count, avg ms, max ms, hangs, timeouts" ", fails%s)\n", mode_receive ? ", crc32" : ""); if (mode_receive) { for (ci = 0; ci < N_MCLASS; ci++) { if (!rx_stats[ci].count) continue; fprintf(stderr, " %-9s %6ld %7ld %7ld" " %5ld %5ld %5ld %5ld\n", names[ci], rx_stats[ci].count, rx_stats[ci].total_ms / rx_stats[ci].count, rx_stats[ci].max_ms, rx_stats[ci].hangs, rx_stats[ci].timeouts, rx_stats[ci].fails, rx_stats[ci].crc32); { int r; for (r = 0; r < N_FAIL_REASONS && fail_reasons[ci][r].what; r++) fprintf(stderr, " ^ %ldx %s\n", fail_reasons[ci][r] .count, fail_reasons[ci][r] .what); } } } else { for (ci = 0; ci < n_tx_choices; ci++) { if (!tx_stats[ci].count) continue; fprintf(stderr, " choice %2ld %-15s" " %6ld %7ld %7ld" " %5ld %5ld %5ld\n", ci, choice_names[ci], tx_stats[ci].count, tx_stats[ci].total_ms / tx_stats[ci].count, tx_stats[ci].max_ms, tx_stats[ci].hangs, tx_stats[ci].timeouts, tx_stats[ci].fails); { int r; for (r = 0; r < N_FAIL_REASONS && fail_reasons_tx[ci][r].what; r++) fprintf(stderr, " ^ %ldx %s\n", fail_reasons_tx[ci][r] .count, fail_reasons_tx[ci][r] .what); } } } } return failures ? 1 : 0; } } lrzsz-0.13.1/src/Makefile.in0000664000175000017500000006414015260417112011303 # Makefile.in generated by automake 1.17 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2024 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = lrz$(EXEEXT) lsz$(EXEEXT) noinst_PROGRAMS = zmodemsnif$(EXEEXT) linesimulator$(EXEEXT) \ timestamp$(EXEEXT) zmodemfuzz$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/build-to-host.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) linesimulator_SOURCES = linesimulator.c linesimulator_OBJECTS = linesimulator.$(OBJEXT) linesimulator_LDADD = $(LDADD) linesimulator_DEPENDENCIES = am__objects_1 = timing.$(OBJEXT) zperr.$(OBJEXT) zreadline.$(OBJEXT) \ crctab.$(OBJEXT) rbsb.$(OBJEXT) zm.$(OBJEXT) \ protname.$(OBJEXT) lsyslog.$(OBJEXT) canit.$(OBJEXT) \ stats.$(OBJEXT) util.$(OBJEXT) am_lrz_OBJECTS = lrz.$(OBJEXT) $(am__objects_1) lrz_OBJECTS = $(am_lrz_OBJECTS) lrz_LDADD = $(LDADD) lrz_DEPENDENCIES = am_lsz_OBJECTS = lsz.$(OBJEXT) $(am__objects_1) lsz_OBJECTS = $(am_lsz_OBJECTS) lsz_LDADD = $(LDADD) lsz_DEPENDENCIES = timestamp_SOURCES = timestamp.c timestamp_OBJECTS = timestamp.$(OBJEXT) timestamp_LDADD = $(LDADD) timestamp_DEPENDENCIES = zmodemfuzz_SOURCES = zmodemfuzz.c zmodemfuzz_OBJECTS = zmodemfuzz.$(OBJEXT) zmodemfuzz_LDADD = $(LDADD) zmodemfuzz_DEPENDENCIES = zmodemsnif_SOURCES = zmodemsnif.c zmodemsnif_OBJECTS = zmodemsnif.$(OBJEXT) zmodemsnif_LDADD = $(LDADD) zmodemsnif_DEPENDENCIES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/canit.Po ./$(DEPDIR)/crctab.Po \ ./$(DEPDIR)/linesimulator.Po ./$(DEPDIR)/lrz.Po \ ./$(DEPDIR)/lsyslog.Po ./$(DEPDIR)/lsz.Po \ ./$(DEPDIR)/protname.Po ./$(DEPDIR)/rbsb.Po \ ./$(DEPDIR)/stats.Po ./$(DEPDIR)/timestamp.Po \ ./$(DEPDIR)/timing.Po ./$(DEPDIR)/util.Po ./$(DEPDIR)/zm.Po \ ./$(DEPDIR)/zmodemfuzz.Po ./$(DEPDIR)/zmodemsnif.Po \ ./$(DEPDIR)/zperr.Po ./$(DEPDIR)/zreadline.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = linesimulator.c $(lrz_SOURCES) $(lsz_SOURCES) timestamp.c \ zmodemfuzz.c zmodemsnif.c DIST_SOURCES = linesimulator.c $(lrz_SOURCES) $(lsz_SOURCES) \ timestamp.c zmodemfuzz.c zmodemsnif.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIST_TARBALL = @DIST_TARBALL@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LRZSZ_CFLAGS = @LRZSZ_CFLAGS@ LRZSZ_LDFLAGS = @LRZSZ_LDFLAGS@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MIN_POSIX_C_STD = @MIN_POSIX_C_STD@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUPPORTED_C_STDS = @SUPPORTED_C_STDS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localedir_c = @localedir_c@ localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ COMMON_SOURCES = timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c lsyslog.c canit.c stats.c util.c lrz_SOURCES = lrz.c $(COMMON_SOURCES) lsz_SOURCES = lsz.c $(COMMON_SOURCES) noinst_HEADERS = timing.h zglobal.h zmodem.h stats.h util.h crctab.h LDADD = @LIBINTL@ AM_CPPFLAGS = -I.. -I$(srcdir) -I$(top_srcdir)/src -DLOCALEDIR=\"$(localedir)\" -D_POSIX_C_SOURCE=@MIN_POSIX_C_STD@ AM_CFLAGS = @WARN_CFLAGS@ @LRZSZ_CFLAGS@ # clang development aid: to enable nearly every clang warning, move the # following line into AM_CFLAGS above (removing the leading '#'); the # -Wno-* list mutes the warnings that are pure noise for this code base. #-Weverything -Wno-disabled-macro-expansion -Wno-reserved-macro-identifier -Wno-used-but-marked-unused -Wno-padded -Wno-unsafe-buffer-usage -Wno-implicit-int-conversion -Wno-sign-conversion -Wno-implicit-fallthrough -Wno-unreachable-code-break -Wno-implicit-int-float-conversion -Wno-float-equal -Wno-covered-switch-default -Wno-unused-macros AM_LDFLAGS = @LRZSZ_LDFLAGS@ TIDY_FILES = $(COMMON_SOURCES) lrz.c lsz.c \ zmodemsnif.c linesimulator.c timestamp.c zmodemfuzz.c all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && $(am__rm_f) $$files clean-binPROGRAMS: -$(am__rm_f) $(bin_PROGRAMS) clean-noinstPROGRAMS: -$(am__rm_f) $(noinst_PROGRAMS) linesimulator$(EXEEXT): $(linesimulator_OBJECTS) $(linesimulator_DEPENDENCIES) $(EXTRA_linesimulator_DEPENDENCIES) @rm -f linesimulator$(EXEEXT) $(AM_V_CCLD)$(LINK) $(linesimulator_OBJECTS) $(linesimulator_LDADD) $(LIBS) lrz$(EXEEXT): $(lrz_OBJECTS) $(lrz_DEPENDENCIES) $(EXTRA_lrz_DEPENDENCIES) @rm -f lrz$(EXEEXT) $(AM_V_CCLD)$(LINK) $(lrz_OBJECTS) $(lrz_LDADD) $(LIBS) lsz$(EXEEXT): $(lsz_OBJECTS) $(lsz_DEPENDENCIES) $(EXTRA_lsz_DEPENDENCIES) @rm -f lsz$(EXEEXT) $(AM_V_CCLD)$(LINK) $(lsz_OBJECTS) $(lsz_LDADD) $(LIBS) timestamp$(EXEEXT): $(timestamp_OBJECTS) $(timestamp_DEPENDENCIES) $(EXTRA_timestamp_DEPENDENCIES) @rm -f timestamp$(EXEEXT) $(AM_V_CCLD)$(LINK) $(timestamp_OBJECTS) $(timestamp_LDADD) $(LIBS) zmodemfuzz$(EXEEXT): $(zmodemfuzz_OBJECTS) $(zmodemfuzz_DEPENDENCIES) $(EXTRA_zmodemfuzz_DEPENDENCIES) @rm -f zmodemfuzz$(EXEEXT) $(AM_V_CCLD)$(LINK) $(zmodemfuzz_OBJECTS) $(zmodemfuzz_LDADD) $(LIBS) zmodemsnif$(EXEEXT): $(zmodemsnif_OBJECTS) $(zmodemsnif_DEPENDENCIES) $(EXTRA_zmodemsnif_DEPENDENCIES) @rm -f zmodemsnif$(EXEEXT) $(AM_V_CCLD)$(LINK) $(zmodemsnif_OBJECTS) $(zmodemsnif_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/canit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crctab.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linesimulator.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lrz.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsyslog.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsz.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protname.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rbsb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stats.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timestamp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timing.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmodemfuzz.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmodemsnif.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zperr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zreadline.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @: >>$@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/canit.Po -rm -f ./$(DEPDIR)/crctab.Po -rm -f ./$(DEPDIR)/linesimulator.Po -rm -f ./$(DEPDIR)/lrz.Po -rm -f ./$(DEPDIR)/lsyslog.Po -rm -f ./$(DEPDIR)/lsz.Po -rm -f ./$(DEPDIR)/protname.Po -rm -f ./$(DEPDIR)/rbsb.Po -rm -f ./$(DEPDIR)/stats.Po -rm -f ./$(DEPDIR)/timestamp.Po -rm -f ./$(DEPDIR)/timing.Po -rm -f ./$(DEPDIR)/util.Po -rm -f ./$(DEPDIR)/zm.Po -rm -f ./$(DEPDIR)/zmodemfuzz.Po -rm -f ./$(DEPDIR)/zmodemsnif.Po -rm -f ./$(DEPDIR)/zperr.Po -rm -f ./$(DEPDIR)/zreadline.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-exec-local install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/canit.Po -rm -f ./$(DEPDIR)/crctab.Po -rm -f ./$(DEPDIR)/linesimulator.Po -rm -f ./$(DEPDIR)/lrz.Po -rm -f ./$(DEPDIR)/lsyslog.Po -rm -f ./$(DEPDIR)/lsz.Po -rm -f ./$(DEPDIR)/protname.Po -rm -f ./$(DEPDIR)/rbsb.Po -rm -f ./$(DEPDIR)/stats.Po -rm -f ./$(DEPDIR)/timestamp.Po -rm -f ./$(DEPDIR)/timing.Po -rm -f ./$(DEPDIR)/util.Po -rm -f ./$(DEPDIR)/zm.Po -rm -f ./$(DEPDIR)/zmodemfuzz.Po -rm -f ./$(DEPDIR)/zmodemsnif.Po -rm -f ./$(DEPDIR)/zperr.Po -rm -f ./$(DEPDIR)/zreadline.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-local .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-exec-local install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-local .PRECIOUS: Makefile # The hard links below point at the installed binaries, so those must exist # first. Order it explicitly, otherwise FTBFS with make --shuffle=reverse. install-exec-local: install-binPROGRAMS 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 $(DESTDIR)/$(bindir)/`echo lsx | sed -e '$(transform)'` ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \ $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'` rm -f $(DESTDIR)/$(bindir)/`echo lrb | sed -e '$(transform)'` ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \ $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'` rm -f $(DESTDIR)/$(bindir)/`echo lrx | sed -e '$(transform)'` ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \ $(DESTDIR)/$(bindir)/`echo lrx |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)'` tidy: $(TIDY_FILES) $(noinst_HEADERS) clang-tidy --checks='-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' $(TIDY_FILES) -- $(AM_CPPFLAGS) $(AM_CFLAGS) # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% lrzsz-0.13.1/src/protname.c0000664000175000017500000000212515255263431011231 /* 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; case ZM_ZMODEM: default: prot_name="ZMODEM"; break; } return prot_name; } lrzsz-0.13.1/src/lsz.c0000664000175000017500000022371115260420213010207 /* 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" #include #include #include #include #include #include #include #include #include "timing.h" #ifndef HAVE_GETOPT_LONG #define getopt_long(argc,argv,str,longopts,longind) getopt(argc,argv,str) #endif unsigned int Baudrate=2400; /* Default, should be set by first mode() call */ static unsigned int Txwindow; /* Control the size of the transmitted window */ static unsigned int Txwspac; /* Spacing between zcrcq requests */ static unsigned int Txwcnt; /* Counter used to space ack requests */ static size_t Lrxpos; /* Receiver's last reported offset */ int errors; enum zm_type_enum protocol; bool under_rsh=false; static int no_unixmode; static int Canseek=1; /* 1: can; 0: only rewind, -1: neither */ static int zsendfile (struct zm_fileinfo *zi, const char *buf, size_t blen); static int getnak (void); static int wctxpn (struct zm_fileinfo *); static int wcs (const char *oname, const char *remotename); static size_t zfilbuf (struct zm_fileinfo *zi); static size_t filbuf (char *buf, size_t count); static int getzrxinit (void); static int calc_blklen (long total_sent); static int sendzsinit (void); static int wctx (struct zm_fileinfo *); static int zsendfdata (struct zm_fileinfo *); static int ack_resync (struct zm_fileinfo *, int, bool, int *, int *); static int sigint_resync (struct zm_fileinfo *, int *, int *); static int getinsync (struct zm_fileinfo *, int flag); static void countem (int argc, char **argv); static void usage (int exitcode, const char *what); static int zsendcmd (const char *buf, size_t blen); static void saybibi (void); static int wcsend (int argc, char *argp[]); static int wcputsec (char *buf, int sectnum, size_t cseclen); /* DO_SYSLOG is replaced by the shared variadic macro (zglobal.h) plus * lrzsz_basename() (util.c) - same logged values, no `zi` coupling. */ #define ZSDATA(x,y,z) \ do { if (Crc32t) {zsda32(x,y,z); } else {zsdata(x,y,z);}} while(0) static int Filesleft; static long Totalleft; static size_t buffersize=16384; /* * 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. */ static char Myattn[] = { 0 }; /* alternative: char Myattn[] = { 03, 0336, 0 }; when READCHECK was not defined (but it always was under linux). */ static FILE *input_f; static char *txbuf; static long vpos = 0; /* Number of bytes read from file */ static char Lastrx; static char Crcflg; int Verbose=0; static int Restricted=0; /* restricted; no /.. or ../ in filenames */ static int Quiet=0; /* overrides logic that would otherwise set verbose */ static int Ascii=0; /* Add CR's for brain damaged programs */ static int Fullname=0; /* transmit full pathname */ static int Unlinkafter=0; /* Unlink file after it is sent */ static int firstsec; static int errcnt=0; /* number of files unreadable */ static size_t blklen=128; /* length of transmitted records */ static int Optiong; /* Let it rip no wait for sector ACK's */ static int Totsecs; /* total number of sectors this file */ static int Filcnt=0; /* count of number of files opened */ static int Lfseen=0; #define SAFETY_RXBUFLEN (128*1024) /* will be set one first error */ #define DEFAULT_RXBUFLEN (16*1024) static unsigned int Rxbuflen = DEFAULT_RXBUFLEN; /* Receiver's max buffer length */ static unsigned int Tframlen = 0; /* Override for tx frame length */ static unsigned int blkopt=0; /* Override value for zmodem blklen */ static int sync_transfer; /* ZCRCW after every data subpacket */ static int Rxflags = 0; static size_t bytcnt; static int Wantfcs32 = true; /* want to send 32 bit FCS */ static char Lzconv; /* Local ZMODEM file conversion request */ static char Lzmanag; /* Local ZMODEM file management request */ static int Lskipnocor; static char Lztrans; static int command_mode; /* Send a command, then exit. */ static int Cmdtries = 11; static int Cmdack1; /* Rx ACKs command, then do it */ static int Exitcode; static size_t Lastsync; /* Last offset to which we got a ZRPOS */ static int Beenhereb4; /* How many times we've been ZRPOS'd same place */ /* set when an abort arm has answered a receiver's ZABORT/ZFERR with the * spec-required ZFIN sequence (zmodem-wip.txt §4): the session is then * already ended cleanly, and main() must not append a cancel sequence */ static bool replied_abort=false; bool no_timeout=false; static size_t max_blklen=1024; static size_t start_blklen=0; bool zmodem_requested; static time_t stop_time=0; static int error_count; #define OVERHEAD 18 #define OVER_ERR 20 /* garbage tolerance for input that never becomes a recognizable prompt or * header. getnak() has no protocol-state retry budget of its own (only * TIMEOUT is bounded), so a line feeding continuous junk must give up * instead of waiting forever. */ #define MAX_GARBAGE 100 int enable_syslog=true; /* set by the SIGINT handler; zsendfdata() checks it at its loop * checkpoints and attempts a receiver resync. sig_atomic_t + volatile: * the only async-signal-safe way to communicate with the handler. */ static volatile sig_atomic_t sigint_seen = 0; 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; /* Signal handler for SIGINT/SIGTERM/SIGPIPE/SIGHUP. * This is not strictly async-signal safe, because of the tcsetattr and tcflush * calls in io_mode(), but these functions are, under linux at least, simple * syscall wrappers. * Leaving the terminal in raw mode would be worse. So we rely on undefined * behaviour here. Oh well. * _exit() skips atexit/stdio on purpose, exit() would risk stdio/malloc * re-entrancy from the handler. */ LRZSZ_NORETURN static void bibi_sighandler(int n) { int saved_errno = errno; canit(STDOUT_FILENO); io_mode(io_mode_fd, 0); errno = saved_errno; _exit(128 + n); } /* called from normal control flow (rbsb.c) to clean things up */ LRZSZ_NORETURN void bibi(int n) { canit(STDOUT_FILENO); fflush(stdout); io_mode(io_mode_fd, 0); lrzsz_warning(0, _("caught signal %d; exiting"), n); if (n == SIGQUIT) abort(); exit(128 + n); } /* the cancel-handler installer is shared: see lrzsz_install_signal() in * util.c; lsz installs its own bibi_sighandler with it. */ /* Called when ZMODEM gets an interrupt (^C): record the request; the * transfer loop checks sigint_seen at its (timeout-bounded) checkpoints * and resyncs with the receiver there. No longjmp: the handler only * touches a sig_atomic_t, so it is strictly async-signal-safe. */ static void onintr(int n) { (void) n; /* use it */ sigint_seen = 1; signal(SIGINT, onintr); } bool Zctlesc; /* Encode control characters */ unsigned int Zrwindow = 1400; /* RX window size (controls garbage count) */ #ifdef HAVE_GETOPT_LONG 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-tries", 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'}, /* removed, kept for the error message */ {"verbose", no_argument, NULL, 'v'}, {"version", no_argument, 0, 'V'}, {"windowsize", required_argument, NULL, 'w'}, {"xmodem", no_argument, NULL, 'X'}, {"ymodem", no_argument, NULL, 'g'}, {"zmodem", no_argument, NULL, 'Z'}, {"overwrite", no_argument, NULL, 'y'}, {"overwrite-or-skip", no_argument, NULL, 'Y'}, {"journal", required_argument, NULL, 'J'}, {"delay-startup", required_argument, NULL, 4}, {"no-unixmode", no_argument, NULL, 8}, {"debug", required_argument, NULL, 9}, {"sync-transfer", no_argument, NULL, 10}, {NULL, 0, NULL, 0} }; #endif LRZSZ_NORETURN static void show_version(void) { printf ("%s (%s) %s\n", lrzsz_progname, PACKAGE, VERSION); exit(0); } 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; const char *journal_filename; lrzsz_set_progname (argv[0], "lsz"); /* needed for the error handling => early */ if (((cp = getenv("ZNULLS")) != NULL) && *cp) Znulls = (int) lrzsz_strtoul("ZNULLS", cp, NULL, 0, 65535); if (((cp=getenv("SHELL"))!=NULL) && cp[0]) { const char *base = strrchr(cp, '/'); base = base ? base + 1 : cp; if (strcmp(base, "rsh") == 0 || strcmp(base, "rksh") == 0 || strcmp(base, "rbash") == 0 || strcmp(base, "rshell") == 0) { under_rsh=true; Restricted=1; } } if (getenv("ZMODEM_RESTRICTED")!=NULL) Restricted=1; from_cu(); chkinvok(argv[0], 's'); journal_filename=getenv("LSZ_JOURNAL"); if (!journal_filename || !*journal_filename) { journal_filename=getenv("LRZSZ_JOURNAL"); } if (journal_filename && *journal_filename) { stats_journal_open(journal_filename); } openlog(lrzsz_progname,LOG_PID,SYSLOG_FACILITY); setlocale (LC_ALL, ""); setlocale (LC_TIME, "C"); /* do not translate just the timestamp of a syslog message. uh. */ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); Rxtimeout = 600; while ((c = getopt_long (argc, argv, "2+4589aA:bB:C:c:dfeEghHi:J:kL:l:m:M:NnOop7Rrqs:St:TUuvVw:XYyZ", long_options, (int *) 0))!=EOF) { 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': /* deprecated: ZCNL is marked historic by the current * ZMODEM documentation; kept for old peers */ Lzconv = ZCNL; Ascii = true; break; case 'b': Lzconv = ZCBIN; break; case 'B': if (0==strcmp(optarg,"auto")) buffersize= (size_t) -1; else buffersize=(size_t) lrzsz_strtoul( "-B / --bufsize", optarg, "km", 0, 0); break; case 'C': Cmdtries = lrzsz_strtoul( "-C / --command-tries", optarg, NULL, 0, 0); break; case 'i': Cmdack1 = ZCACK1; command_mode = true; Cmdstr = optarg; break; case 'c': command_mode = true; Cmdstr = optarg; break; case 'd': fatal_error(1,0,_("this option has been removed; see the manual")); break; 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 'J': stats_journal_open(optarg); break; case 'k': start_blklen=1024; break; case 'L': blkopt = (unsigned int) lrzsz_strtoul( "-L / --packetlen", optarg, "ck", 24, LRZSZ_MAX_SUBPACKET_LEN); break; case 'l': Tframlen = (unsigned int) lrzsz_strtoul( "-l / --framelen", optarg, "ck", 32, LRZSZ_MAX_SUBPACKET_LEN); break; case 'm': min_bps = (unsigned int) lrzsz_strtoul( "-m / --min-bps", optarg, "km", 0, 0); break; case 'M': min_bps_time = (unsigned int) lrzsz_strtoul( "-M / --min-bps-time", optarg, "k", 1, 0); 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': stop_time = lrzsz_parse_stop_time(optarg, usage); break; case 'S': fprintf(stderr, _("this option has been removed. See the manual page for more information.\n")); exit(1); case 'T': turbo_escape=1; break; case 't': Rxtimeout = (unsigned int) lrzsz_strtoul( "-t / --timeout", optarg, NULL, 10, 1000); break; case 'u': ++Unlinkafter; break; case 'U': fprintf(stderr, _("this option has been removed. See the manual page for more information.\n")); exit(1); case 'v': ++Verbose; break; case 'V': show_version(); break; case 'w': Txwindow = (unsigned int) lrzsz_strtoul( "-w / --windowsize", optarg, NULL, 256, 0); Txwindow = (Txwindow/64) * 64; Txwspac = Txwindow/4; if (blkopt > Txwspac || (!blkopt && Txwspac < LRZSZ_MAX_SUBPACKET_LEN)) blkopt = Txwspac; break; case 'X': protocol=ZM_XMODEM; break; case 'g': protocol=ZM_YMODEM; break; case 'Z': protocol=ZM_ZMODEM; break; case 'Y': Lskipnocor = true; Lzmanag = ZF1_ZMCLOB; break; case 'y': Lzmanag = ZF1_ZMCLOB; break; case 2: if (optarg && (!strcmp(optarg,"off") || !strcmp(optarg,"no"))) { if (under_rsh) lrzsz_warning(0, _("cannot turnoff syslog")); else enable_syslog=false; } else enable_syslog=true; break; case 4: startup_delay = (unsigned int) lrzsz_strtoul( "--delay-startup", optarg, NULL, 1, 0); break; case 8: no_unixmode=1; break; case 9: if (!lrzsz_parse_debug(optarg)) usage(2, _("bad --debug argument")); break; case 10: sync_transfer = 1; break; default: usage (2,NULL); break; } } if (getuid()!=geteuid()) { fatal_error(1,0, _("this program was never intended to be used setuid\n")); } txbuf=xmalloc(LRZSZ_MAX_SUBPACKET_LEN); memset(txbuf,0, LRZSZ_MAX_SUBPACKET_LEN); 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); npats = argc - optind; patts=&argv[optind]; if (npats < 1 && !command_mode) usage(2,_("need at least one file to send")); if (command_mode && Restricted) { /* stderr, not stdout: stdout is the protocol stream. */ lrzsz_warning(0, _("can't send command in restricted mode")); exit(1); } if (Fromcu && !Quiet) { if (Verbose == 0) Verbose = 2; } DPRINTF(DEBUG_TRANSFER, "%s %s\n", lrzsz_progname, VERSION); { struct timespec start_timespec; int ret; ret=clock_gettime(CLOCK_MONOTONIC, &start_timespec); if (ret) { stat_for_all.start_time=0; } else { stat_for_all.start_time=start_timespec.tv_sec+((double)start_timespec.tv_nsec/1e9); } } stat_for_all.direction = 's'; stat_for_file.direction = 's'; { /* 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); } setvbuf(stdout,s,_IOFBF,max_blklen+1024); } blklen=start_blklen; for (i=optind,stdin_files=0;i1) { usage(1,_("can read only one file from stdin")); } else if (stdin_files==1) { io_mode_fd=1; } if (io_mode(io_mode_fd,1)) lrzsz_warning(0, _("cannot set transfer line mode; continuing")); readline_setup(io_mode_fd, 128, 256); if (lrzsz_install_signal(SIGINT, bibi_sighandler)) play_with_sigint=1; lrzsz_install_signal(SIGTERM, bibi_sighandler); lrzsz_install_signal(SIGPIPE, bibi_sighandler); lrzsz_install_signal(SIGHUP, bibi_sighandler); if ( protocol!=ZM_XMODEM) { 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 */ struct timeval t; unsigned char throwaway; fd_set f; purgeline(io_mode_fd); 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; } purgeline(io_mode_fd); stohdr(0L); if (command_mode) Txhdr[ZF0] = ZCOMMAND; zshhdr(ZRQINIT, Txhdr); zrqinits_sent++; } } fflush(stdout); /* the session is already over when a receiver's ZABORT/ZFERR was * answered with the ZFIN sequence (see replied_abort): appending a * cancel sequence there would contradict that reply */ #define END_WITH_CANCEL() do { Exitcode=0x80; \ if (!replied_abort) canit(STDOUT_FILENO); } while (0) if (Cmdstr) { if (getzrxinit()) { END_WITH_CANCEL(); } else if (zsendcmd(Cmdstr, strlen(Cmdstr)+1)) { END_WITH_CANCEL(); } } else if (wcsend(npats, patts)==ERROR) { END_WITH_CANCEL(); } #undef END_WITH_CANCEL 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); } stats_account_finalize_file(); stats_log(&stat_for_all,false); stats_journal_close(); exit(dm); } 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) { stats_account_one(); return ERROR; } stats_account_one(); } Totsecs = 0; if (Filcnt == 0) { /* bitch if we couldn't open ANY files */ 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_YMODEM) { struct zm_fileinfo zi; zi_init(&zi); zi.fname = xstrdup(""); /* empty filename packet signals end of batch */ wctxpn (&zi); free(zi.fname); } return OK; } static int wcs(const char *oname, const char *remotename) { struct stat f; static char *name=NULL; struct zm_fileinfo zi; const char *shortname; zi_init(&zi); shortname=strrchr(oname,'/'); if (shortname) shortname++; else shortname=oname; free(name); name=NULL; if (Restricted) { /* restrict pathnames to current tree */ if (lrzsz_path_component_violation(oname, Restricted)) goto violation; } if (0==strcmp(oname,"-")) { char *p=getenv("ONAME"); if (p) { name=xstrdup(p); } else { char tmp[64]; snprintf(tmp, sizeof tmp, "s%lu.lsz", (unsigned long) getpid()); name=xstrdup(tmp); } input_f=stdin; } else if ((input_f=fopen(oname, "r"))==NULL) { int e=errno; lrzsz_warning(e, _("cannot open %s"),oname); ++errcnt; stats_file_local_error(); return OK; /* pass over it, there may be others */ } else { name=xstrdup(oname); } { 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=xmalloc(last_length); } if (s) { setvbuf(input_f,s,_IOFBF,last_length); } } vpos = 0; /* fstat must succeed: its fields are transmitted below as the file's * metadata (mode/mtime/size). A failure used to send uninitialized * memory - a garbage size in particular can make the receiver * truncate the incoming stream to R_BYTESLEFT. Skip the file. */ if (fstat(fileno(input_f), &f) == -1) { int e = errno; lrzsz_warning(e, _("cannot stat %s"), name); fclose(input_f); ++errcnt; stats_file_local_error(); return OK; } /* Check for directory or block special files */ if (S_ISDIR(f.st_mode) || S_ISBLK(f.st_mode)) { lrzsz_warning(0, _("is not a file: %s"),name); fclose(input_f); stats_file_local_error(); 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; zi.bytes_total= (S_ISFIFO(f.st_mode)) ? DEFBYTL : f.st_size; timing_reset(); stats_set_filename(shortname); stats_start_one(); if (!Quiet && zi.bytes_total > 0x7FFFFFFFUL) lrzsz_warning(0, _("file %s is larger than 2 GiB; " "transfers may fail with older ZMODEM implementations"), name); ++Filcnt; switch (wctxpn(&zi)) { case ERROR: if (enable_syslog) lsyslog(LOG_INFO, _("%s/%s: error occured"),protname(),shortname); stats_file_error(); return ERROR; case ZSKIP: lrzsz_warning(0, _("skipped: %s"),name); stats_file_skipped(); if (enable_syslog) lsyslog(LOG_INFO, _("%s/%s: skipped"),protname(),shortname); return OK; default: ; } if (!zmodem_requested && wctx(&zi)==ERROR) { if (enable_syslog) lsyslog(LOG_INFO, _("%s/%s: error occured"),protname(),shortname); stats_file_error(); return ERROR; } if (Unlinkafter) unlink(oname); report_transfer_result(1, shortname, zi.fname, (long) zi.bytes_sent, 0, 0); stats_file_ok(); return 0; violation: stats_file_policy_reject(); stats_account_one(); stats_log(&stat_for_all, false); canit(STDOUT_FILENO); vchar('\r'); fatal_error(1,0, _("security violation: not allowed to upload from %s"),oname); } /* * 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) { char *p, *q; struct stat f; 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)); } if (Verbose) { vstringf(_("Give your local XMODEM receive command now.")); vstring("\r\n"); } return OK; } if (!zmodem_requested) if (getnak()) { DPRINTF(DEBUG_TRANSFER, "getnak failed\n"); DO_SYSLOG(LOG_INFO, "%s/%s: getnak failed", lrzsz_basename(zi->fname), protname()); return ERROR; } /* ZMODEM spec: file information subpacket must not exceed 1024 bytes. * YMODEM block 0 is 128 bytes. Both carry the same filename + metadata. * Reserve room for the metadata suffix (max ~64 bytes) and null. */ { size_t maxlen = zmodem_requested ? (1024 - 64) : (128 - 64); const char *base = zi->fname; if (!Fullname) { const char *slash = strrchr(zi->fname, '/'); if (slash) base = slash + 1; } if (strlen(base) >= maxlen) { lrzsz_warning(0, _("filename too long for %s subpacket: %s"), protname(), zi->fname); fclose(input_f); return OK; } for (p=zi->fname, q=txbuf ; *p; ) if ((*q++ = *p++) == '/' && !Fullname) q = txbuf; *q++ = 0; p=q; } /* zero the size in case the fstat below is skipped (stdin, ascii, * empty name) or fails: the batch-estimate arithmetic below * (Totalleft) uses f.st_size unconditionally. */ f.st_size=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) { /* cap the ZFILE data subpacket at 1024 bytes (zmodem-wip.txt * §4). snprintf truncates cleanly; a truncated metadata suffix * only loses trailing batch-estimate fields. */ size_t metasize = (size_t)(txbuf + 1024 - 1 - p); snprintf(p, metasize, "%lu %llo %o 0 %d %ld", (unsigned long) f.st_size, (unsigned long long) 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; if (zmodem_requested) return zsendfile(zi,txbuf, 1+strlen(p)+(p-txbuf)); if (wcputsec(txbuf, 0, 128)==ERROR) { DPRINTF(DEBUG_TRANSFER, "wcputsec failed\n"); DO_SYSLOG(LOG_INFO, "%s/%s: wcputsec failed", lrzsz_basename(zi->fname), protname()); return ERROR; } return OK; } static int getnak(void) { int firstch; int tries=0; int garbage=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: stats_timeout(); /* 30 seconds are enough */ if (tries==3) { zperr(_("Timeout on pathname")); return ERROR; } /* 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; Crcflg = true; return false; case WANTCRC: Crcflg = true; return false; case NAK: return false; case RCDO: /* line dead (peer closed): the receiver will never * answer - getnak's loop has no retry budget of its * own, so RCDO must terminate it (like CAN CAN). */ zperr(_("Line dropped")); return ERROR; case CAN: if ((firstch = READLINE_PF(20)) == CAN && Lastrx == CAN) return ERROR; if (++garbage > MAX_GARBAGE) { zperr(_("Too much garbage on line")); return ERROR; } break; default: /* unbounded if garbage never stops arriving: the TIMEOUT * budget above only runs while the line is quiet. */ if (++garbage > MAX_GARBAGE) { zperr(_("Too much garbage on line")); return ERROR; } break; } Lastrx = firstch; } } static int wctx(struct zm_fileinfo *zi) { size_t thisblklen; int sectnum, attempts, firstch; firstsec=true; thisblklen = blklen; DPRINTF(DEBUG_TRANSFER, "wctx:file length=%ld\n", (long) zi->bytes_total); while ((firstch=READLINE_PF(Rxtimeout))!=NAK && firstch != WANTCRC && firstch != WANTG && firstch!=TIMEOUT && firstch!=CAN && firstch!=ERROR && firstch!=RCDO) ; if (firstch==CAN) { zperr(_("Receiver Cancelled")); return ERROR; } if (firstch==ERROR || firstch==RCDO) { zperr(_("Line dropped")); 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; for (;;) { purgeline(io_mode_fd); sendline(EOT); flushmo(); ++attempts; firstch = READLINE_PF(Rxtimeout); if (firstch == ACK) return OK; if (firstch == ERROR || firstch == RCDO) { zperr(_("Line dropped")); return ERROR; } if (attempts >= RETRYMAX) break; } zperr(_("No ACK on EOT")); stats_too_many_errors(); return ERROR; } 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((0xff& *cp), oldcrc); checksum += *cp++; } stats_msg_bytes(cseclen); 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: stats_cancel(); zperr(_("Cancelled")); return ERROR; } break; case TIMEOUT: stats_timeout(); zperr(_("Timeout on sector ACK")); continue; case WANTCRC: if (firstsec) Crcflg = true; continue; case NAK: stats_msg_invalid(); zperr(_("NAK on sector")); continue; case ACK: firstsec=false; Totsecs += (cseclen>>7); stats_msg_valid(0); return OK; case ERROR: zperr(_("Got burst for sector ACK")); break; default: zperr(_("Got %02x for sector ACK"), (unsigned int) firstch); break; } for (;;) { Lastrx = firstch; if ((firstch = READLINE_PF(Rxtimeout)) == TIMEOUT) break; if (firstch == ERROR || firstch == RCDO) { zperr(_("Line dropped")); return ERROR; } if (firstch == NAK || firstch == WANTCRC) goto gotnak; if (firstch == CAN && Lastrx == CAN) { goto cancan; } } } zperr(_("Retry Count Exceeded")); stats_too_many_errors(); 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) { ssize_t r = read(fileno(input_f), buf, count); if (r < 0) { int er = errno; lrzsz_warning(0, _("read error: %s"), strerror(er)); stats_file_local_error(); return 0; } if (r == 0) return 0; m = (size_t)r; while (m < count) buf[m++] = CPMEOF; return count; } m=count; if (Lfseen) { *buf++ = '\n'; --m; Lfseen = 0; } while ((c=getc(input_f))!=EOF) { if (c == '\n') { *buf++ = '\r'; if (--m == 0) { Lfseen = true; break; } } *buf++ =c; if (--m == 0) break; } if (ferror(input_f)) { lrzsz_warning(0, _("read error: %s"), strerror(errno)); stats_file_local_error(); return 0; } 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) { if (ferror(input_f)) { int er = errno; lrzsz_warning(0, _("read error: %s"), strerror(er)); } 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; } LRZSZ_NORETURN static void usage(int exitcode, const char *what) { FILE *f=stdout; if (exitcode) { if (what) fprintf(stderr, "%s: %s\n",lrzsz_progname,what); fprintf (stderr, _("Try `%s -h' for more information.\n"), lrzsz_progname); exit(exitcode); } fprintf(f, _("%s version %s\n"), lrzsz_progname, VERSION); fprintf(f,_("Usage: %s [options] file ...\n"), lrzsz_progname); fprintf(f,_(" or: %s [options] -{c|i} COMMAND\n"),lrzsz_progname); 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 (Z)\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 (removed; use -f for full pathnames)\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" " -g, --ymodem use YMODEM protocol (Y)\n" " -h, --help print this usage message\n" " -H, --crc-check accept and transfer files if lengths/CRCs differ (Z)\n" " -i, --immediate-command CMD send remote CMD, return immediately (Z)\n" " -J, --journal FILE append transfer statistics to FILE\n" " --no-unixmode send mode 0 instead of Unix permission bits\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" /* -S was timesync */ " -u, --unlink unlink file after transmission\n" " -v, --verbose be verbose (twice: also show progress)\n" " --debug=MODULES comma separated list: protocol, readline,\n" " transfer, windowhandling, tty, all\n" " --sync-transfer force a ZCRCW after every data subpacket\n" " (integrity mode: slower and immune to loss of\n" " whole subframes)\n" " -V, --version show version 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" " -Z, --zmodem use ZMODEM protocol\n" "\n" "short options use the same arguments as the long ones\n" ),f); #ifndef HAVE_GETOPT_LONG fputs(_("The long options (--...) are not available on your system (getopt_long is not available)\n"), f); #endif 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; int gotblock; 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; gotblock = zgethdr(Rxhdr, 1,&rxpos); switch (gotblock) { 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 = 0xff & Rxhdr[ZF0]; Txfcs32 = (Wantfcs32 && (Rxflags & CANFC32)); { int old=Zctlesc; Zctlesc |= Rxflags & TESCCTL; /* update table - was initialised to not escape */ if (Zctlesc && !old) zsendline_init(); } Rxbuflen = (0xff & Rxhdr[ZP0])+((0xff & Rxhdr[ZP1])<<8); if ( !(Rxflags & CANFDX)) Txwindow = 0; DPRINTF(DEBUG_WINDOWHANDLING, "Rxbuflen=%u Tframlen=%u\n", Rxbuflen, Tframlen); if ( play_with_sigint) signal(SIGINT, SIG_IGN); io_mode(io_mode_fd,2); /* Set cbreak, XON/XOFF, etc. */ /* Override to force shorter frame length */ if (Tframlen && Rxbuflen > Tframlen) Rxbuflen = Tframlen; DPRINTF(DEBUG_WINDOWHANDLING, "Rxbuflen=%u\n", Rxbuflen); /* * 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 (!(S_ISREG(f.st_mode))) { Canseek = -1; /* return ERROR; */ } } /* for segmented streaming: */ if (start_blklen > Rxbuflen && Rxbuflen) { start_blklen = Rxbuflen; } if (max_blklen > Rxbuflen && Rxbuflen) { max_blklen = Rxbuflen; } /* 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; DPRINTF(DEBUG_WINDOWHANDLING, "Rxbuflen=%u blklen=%lu\n", Rxbuflen, blklen); DPRINTF(DEBUG_WINDOWHANDLING, "Txwindow = %u Txwspac = %u\n", Txwindow, Txwspac); Rxtimeout=old_timeout; if (debugmode & DEBUG_WINDOWHANDLING) { fprintf(stderr,"after ZRINIT: Rxbuflen=%u,Txwindow=%u,Txwspac=%u\n",Rxbuflen,Txwindow,Txwspac); } return (sendzsinit()); case ZCAN: case TIMEOUT: if (timeouts++==0) continue; /* force one other ZRQINIT to be sent */ return ERROR; case ZABORT: case ZFERR: /* the receiver aborted during the handshake; ZFERR is * spec'd as equivalent to ZABORT (§4). NAKing an * aborting receiver would loop forever here - reply * with the ZFIN sequence the spec requires (§4). */ if (gotblock == ZABORT) stats_cancel(); else stats_file_error(); replied_abort = true; saybibi(); return ERROR; case ZRQINIT: if (Rxhdr[ZF0] == ZCOMMAND) continue; stohdr(0); zshhdr(ZNAK, Txhdr); continue; default: stohdr(0); 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); /* send ZSINIT as a BINARY header, because it carries a data subpacket * (the attention string), and data subpackets after a hex header would * use a 16-bit CRC, which the current ZMODEM * documentation forbids * (zmodem-wip.txt §2.2). zsbhdr sets Crc32t per negotiation, so * the subpacket goes out with the negotiated CRC (normally CRC-32). */ if (Zctlesc) Txhdr[ZF0] |= TESCCTL; 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; int bad_acks = 0; /* we are going to send a ZFILE. There cannot be much useful * stuff in the line right now (*except* ZCAN?). */ 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 **** */ /* FALLTHROUGH */ default: /* e.g. ZNAK from a receiver that cannot cope with the * ZFILE subpacket. Resending identically a few times is * fine, but don't loop forever (zmodem-wip.txt §4: * the sender must be able to fall back - our subpacket * never exceeds 1024 bytes, so a receiver that keeps * ZNAKing won't be satisfied by resending). */ if (++bad_acks > 3) { zperr(_("receiver keeps rejecting the file header")); return ERROR; } continue; case ZACK: /* zmrx answers the ZCRCW for the ZFILE (filename etc) * with a ZACK; omen never did - it used the ZRPOS as * the ACK. A receiver that keeps ACKing must not make * us resend the ZFILE forever, so ZACK shares the * default branch's retry budget. */ if (++bad_acks > 3) { zperr(_("receiver keeps rejecting the file header")); return ERROR; } goto again; case ZRQINIT: /* remote site is sender! */ if (Verbose) vstringf(_("got ZRQINIT")); DO_SYSLOG(LOG_INFO, "%s/%s: got ZRQINIT - sz talks to sz", lrzsz_basename(zi->fname), protname()); return ERROR; case ZCAN: if (Verbose) vstringf(_("got ZCAN")); DO_SYSLOG(LOG_INFO, "%s/%s: got ZCAN - receiver canceled", lrzsz_basename(zi->fname), protname()); return ERROR; case TIMEOUT: DO_SYSLOG(LOG_INFO, "%s/%s: got TIMEOUT", lrzsz_basename(zi->fname), protname()); return ERROR; case RCDO: /* line dead (peer closed): retrying against it is * pointless - getinsync() treats RCDO like TIMEOUT, * and so must this phase. */ DO_SYSLOG(LOG_INFO, "%s/%s: got RCDO", lrzsz_basename(zi->fname), protname()); return ERROR; case ZABORT: case ZFERR: /* the receiver aborted during the file-header phase; * ZFERR is spec'd as equivalent to ZABORT * (zmodem-wip.txt §4). Don't resend the ZFILE * against a receiver that just gave up - reply with * the ZFIN sequence the spec requires (§4). */ if (gotblock == ZABORT) stats_cancel(); else stats_file_error(); DO_SYSLOG(LOG_INFO, "%s/%s: got %s - receiver aborted", lrzsz_basename(zi->fname), protname(), gotblock == ZABORT ? "ZABORT" : "ZFERR"); replied_abort = true; if (input_f) { fclose(input_f); input_f=NULL; } saybibi(); return ERROR; case ZFIN: DO_SYSLOG(LOG_INFO, "%s/%s: got ZFIN", lrzsz_basename(zi->fname), protname()); return ERROR; case ZCRC: crc = 0xFFFFFFFFL; if (Canseek >= 0) { /* the input_f check is for the static analyzer clang-tidy, * which doesn't catch the logic around input_f. */ if (input_f) { if (rxpos==0) { struct stat st; if (0==fstat(fileno(input_f),&st)) { rxpos=st.st_size; } else { int er=errno; lrzsz_warning(0, _("fstat failed: %s"), strerror(er)); rxpos=SIZE_MAX; } } while (rxpos-- && ((gotchar = getc(input_f)) != EOF)) crc = UPDC32(gotchar, crc); crc = ~crc; clearerr(input_f); /* Clear EOF */ fseeko(input_f, 0, 0); } } stohdr(crc); zsbhdr(ZCRC, Txhdr); goto again; case ZSKIP: if (input_f) { fclose(input_f); input_f=NULL; } DPRINTF(DEBUG_TRANSFER, "receiver skipped\n"); DO_SYSLOG(LOG_INFO, "%s/%s: receiver skipped", lrzsz_basename(zi->fname), protname()); return ZSKIP; case ZRPOS: /* * Suppress zcrcw request otherwise triggered by * lastsync==bytcnt */ if (rxpos && fseeko(input_f, (off_t) rxpos, 0)) { int er=errno; DPRINTF(DEBUG_TRANSFER, "fseeko failed: %s\n", strerror(er)); DO_SYSLOG(LOG_INFO, "%s/%s: fseeko failed: %s", lrzsz_basename(zi->fname), protname(), strerror(er)); return ERROR; } if (rxpos) zi->bytes_skipped=rxpos; bytcnt = zi->bytes_sent = rxpos; Lastsync = rxpos -1; return zsendfdata(zi); } } } /* The ACK/resync machinery of zsendfdata(): * - the decision (former gotack) to return ERROR, ZSKIP or 0/OK. * - the pending-input drain (the former waitack/gotack block). * sync_first: run getinsync(zi,0) first (the former waitack entry, used * after a ZCRCW subpacket and for the SIGINT resync); * c: caller's preset verdict byte (the former goto gotack sites). * Returns ERROR or ZSKIP for the caller to propagate, or 0/OK for * "synced, keep going". in the later case the caller re-sends the ZDATA * header (the old waitack fall-through to normal flow did exactly that). * Not a piece of beauty, but so much better than before. */ static int ack_resync (struct zm_fileinfo *zi, int c, bool sync_first, int *junkcountp, int *need_waitp) { for (;;) { if (sync_first) { /* the former waitack head: the receiver is asked for * its state before the verdict runs */ *junkcountp = 0; c = getinsync (zi, 0); sync_first = false; } switch (c) { default: if (input_f) { fclose (input_f); input_f=NULL; } DO_SYSLOG(LOG_INFO, "%s/%s: got %d", lrzsz_basename(zi->fname), protname(), c); return ERROR; case ZCAN: if (input_f) { fclose (input_f); input_f=NULL; } DO_SYSLOG(LOG_INFO, "%s/%s: got ZCAN", lrzsz_basename(zi->fname), protname()); return ERROR; case ZSKIP: if (input_f) { fclose (input_f); input_f=NULL; } DO_SYSLOG(LOG_INFO, "%s/%s: got ZSKIP", lrzsz_basename(zi->fname), protname()); return ZSKIP; case ZACK: break; case ZRPOS: /* a ZRPOS restart must resume with the first data * subpacket being ZCRCW (zmodem-wip.txt section 5). * need_wait was previously armed only on the CAN/ZPAD * drain path below; a verdict-here ZRPOS (the normal * error-recovery path) would otherwise resume with * ZCRCG. */ *need_waitp = 1; break; case ZRINIT: /* the receiver finished the file and closed our input * (getinsync): the data phase must terminate, never * re-enter it - zfilbuf() would fread() from NULL. * (OK would mean "resend ZDATA" to the callers.) */ return ZRINIT; } /* drain pending receiver input; CAN/ZPAD and read errors * escalate back to the verdict switch (the former goto * gotack), junk counts the rest */ { int reswitch = 0; while (fd_readable (io_mode_fd)) { c = READLINE_PF(1); if (TIMEOUT == c || ERROR == c || RCDO == c) { reswitch = 1; break; } switch (c) { case CAN: case ZPAD: c = getinsync (zi, 1); *need_waitp = 1; reswitch = 1; break; case XOFF: /* Wait a while for an XON */ case XOFF | 0x80: READLINE_PF (100); /* FALLTHROUGH */ default: ++*junkcountp; } if (reswitch) break; } if (reswitch) continue; return 0; } } } /* The SIGINT checkpoint (former onintr/intrjmp longjmp return path): the * receiver is asked for its state and the verdict handled. Called at the * data-loop checkpoints; every read in between is timeout-bounded, so the * resync happens within at most one read timeout of the ^C. */ static int sigint_resync (struct zm_fileinfo *zi, int *junkcountp, int *need_waitp) { return ack_resync (zi, 0, true, junkcountp, need_waitp); } /* Send the data in the file */ static int zsendfdata (struct zm_fileinfo *zi) { /* total_sent is the only state here that must persist across files: * it feeds calc_blklen()'s adaptive blocksize for the whole batch * (and must never shrink back for file 2). Everything below it is * per-file state. */ static long total_sent = 0; int c; int junkcount; /* Counts garbage chars received by TX */ size_t last_txpos = 0; long not_printed = 0; double low_bps = 0; int newcnt; int rc; time_t now = 0; /* wall clock: -s stop deadline */ /* the first data subpacket after a ZRPOS must be ZCRCW * (zmodem-wip.txt §5, sender-side error recovery). Without this * reset only the FIRST file of a batch started with ZCRCW (need_wait * was static and consumed by file 1); later files started with ZCRCG. */ int need_wait = 1; Lrxpos = 0; junkcount = 0; Beenhereb4 = 0; last_txpos = 0; low_bps = 0; not_printed = 0; /* the SIGINT handler is installed once, before the first data phase * (zsendfdata runs once per file); it only sets sigint_seen, and the * loop checkpoints below attempt the receiver resync when it is set. * The old longjmp-based version re-executed setjmp on the ZRPOS * restart and jumped out of stdio mid-read; both are gone. */ if (play_with_sigint) signal (SIGINT, onintr); /* the ZRPOS restart re-enters here (the former somemore label): the * ZDATA header is sent again, per-file counters keep their values * (resume-in-place). No setjmp remains - the SIGINT checkpoint in * the loop below handles the interrupt flag. */ restart_data: newcnt = Rxbuflen; Txwcnt = 0; stohdr (zi->bytes_sent); zsbhdr (ZDATA, Txhdr); do { size_t n; int e=0; unsigned long old = blklen; /* the SIGINT checkpoint (former longjmp return path): the * flag is set by the handler during any of the timeout- * bounded reads below; the resync attempt happens here */ if (sigint_seen) { sigint_seen = 0; rc = sigint_resync (zi, &junkcount, &need_wait); if (rc) return rc; goto restart_data; /* re-send ZDATA like the old waitack fall-through */ } blklen = calc_blklen (total_sent); total_sent += blklen + OVERHEAD; if (blklen != old) DPRINTF(DEBUG_WINDOWHANDLING, "zsendfdata: blklen changed %lu -> %lu\n", (unsigned long) old, (unsigned long) blklen); { n = zfilbuf (zi); } if (zi->eof_seen) { e = ZCRCE; DPRINTF(DEBUG_WINDOWHANDLING, "e=ZCRCE/eof seen\n"); } else if (sync_transfer) { /* integrity mode: wait for an ACK after every subpacket. * This detects the loss of complete subframes on unreliable * transport layers, which would be undetectable in the * streaming mode. */ e = ZCRCW; DPRINTF(DEBUG_WINDOWHANDLING, "e=ZCRCW/sync-transfer\n"); } else if (junkcount > 3) { e = ZCRCW; DPRINTF(DEBUG_WINDOWHANDLING, "e=ZCRCW/junkcount > 3\n"); } else if (bytcnt == Lastsync) { e = ZCRCW; DPRINTF(DEBUG_WINDOWHANDLING, "e=ZCRCW/bytcnt == Lastsync == %lu\n", (unsigned long) Lastsync); /* segmented streaming. note: newcnt is reset to Rxbuflen in the goto jungle. */ } else if (Rxbuflen && (newcnt -= n) <= 0) { e = ZCRCW; DPRINTF(DEBUG_WINDOWHANDLING, "e=ZCRCW/Rxbuflen(newcnt=%lu,n=%lu, Rxbuflen=%lu)\n", (unsigned long) newcnt,(unsigned long) n, (unsigned long) Rxbuflen); } else if (Txwindow && (Txwcnt += n) >= Txwspac) { Txwcnt = 0; e = ZCRCQ; DPRINTF(DEBUG_WINDOWHANDLING, "e=ZCRCQ/Window\n"); } else if (need_wait) { e = ZCRCW; need_wait = 0; DPRINTF(DEBUG_WINDOWHANDLING, "e=ZCRCW/need_wait\n"); } else { e = ZCRCG; DPRINTF(DEBUG_WINDOWHANDLING, "e=ZCRCG\n"); } now = time (NULL); /* wall clock: -s stop deadline */ if (stop_time && lrzsz_stop_time_reached ("zsendfdata", now, stop_time, zi->fname)) return ERROR; if (Verbose > 1 || min_bps) { long last_bps = 0; int minleft = 0; int secleft = 0; double d; d=timing_elapsed(); if (d == 0) d = 0.5; /* first call: zero elapsed */ last_bps = (long) ((zi->bytes_sent / d)); /* the bps watchdog needs regular sampling: it arms at * the first violation and fires after min_bps_time of * cumulative elapsed time below the limit. */ if (min_bps && lrzsz_bps_watchdog ("zsendfdata", last_bps, d, min_bps, min_bps_time, &low_bps, zi->fname)) return ERROR; if (Verbose > 1) { /* print throttling: only refresh the line at * most every (min_bps ? 3 : 7) unprinted * subpackets, or after half a cumulative-bps * worth of data */ if (not_printed > (min_bps ? 3 : 7) || zi->bytes_sent > last_bps / 2 + last_txpos) { lrzsz_eta (last_bps, zi->bytes_total - zi->bytes_sent, &minleft, &secleft); 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; not_printed = 0; } else not_printed++; } } ZSDATA (txbuf, n, e); bytcnt = zi->bytes_sent += n; if (e == ZCRCW) { /* the mandatory ACK wait (the former waitack entry) */ rc = ack_resync (zi, 0, true, &junkcount, &need_wait); if (rc) return rc; goto restart_data; } fflush (stdout); while (fd_readable (io_mode_fd)) { c=READLINE_PF(1); if (TIMEOUT == c || ERROR == c || RCDO == c) { /* escalate to the verdict switch; after the * verdict the ZDATA header is re-sent (the old * goto gotack fell through to Normal flow) */ rc = ack_resync (zi, c, false, &junkcount, &need_wait); if (rc) return rc; goto restart_data; } switch (c) { case CAN: case ZPAD: c = getinsync (zi, 1); if (c == ZACK) break; /* zcrce - dinna wanna starta ping-pong game */ ZSDATA (txbuf, 0, ZCRCE); { /* escalate to the verdict switch */ rc = ack_resync (zi, c, false, &junkcount, &need_wait); if (rc) return rc; goto restart_data; } break; case XOFF: /* Wait a while for an XON */ case XOFF | 0x80: READLINE_PF (100); /* FALLTHROUGH */ default: ++junkcount; } } /* the window might be full, but ZCRCE might have been sent because of EOF. Do not try to eat the ACK */ if (Txwindow && e != ZCRCE && e != ZCRCG) { size_t tcount = 0; int stuck_acks = 0; size_t prev_lrxpos = Lrxpos; while (zi->bytes_sent >= Lrxpos && (tcount = zi->bytes_sent - Lrxpos) >= Txwindow) { DPRINTF(DEBUG_WINDOWHANDLING, "%zu (%ld,%ld) window >= %u\n", 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); rc = ack_resync (zi, c, false, &junkcount, &need_wait); if (rc) return rc; goto restart_data; } if (Lrxpos == prev_lrxpos) { if (++stuck_acks > RETRYMAX) { lrzsz_warning(0, _("receiver not advancing after %d ACKs"), stuck_acks); ZSDATA (txbuf, 0, ZCRCE); c = ERROR; rc = ack_resync (zi, c, false, &junkcount, &need_wait); if (rc) return rc; goto restart_data; } } else { stuck_acks = 0; prev_lrxpos = Lrxpos; } } DPRINTF(DEBUG_WINDOWHANDLING, "window = %zu\n", tcount); } } while (!zi->eof_seen); if (play_with_sigint) signal (SIGINT, SIG_IGN); for (;;) { int got; stohdr (zi->bytes_sent); zsbhdr (ZEOF, Txhdr); got = getinsync (zi, 0); switch (got) { case ZACK: continue; case ZRPOS: goto restart_data; case ZRINIT: return OK; case ZSKIP: if (input_f) { fclose (input_f); input_f=NULL; } DO_SYSLOG(LOG_INFO, "%s/%s: got ZSKIP", lrzsz_basename(zi->fname), protname()); return ZSKIP; default: if (input_f) { fclose (input_f); input_f=NULL; } DO_SYSLOG(LOG_INFO, "%s/%s: got %d", lrzsz_basename(zi->fname), protname(), got); return ERROR; } } } static int calc_blklen_worker(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; static unsigned original_rxbuflen=0; unsigned int i; if (total_bytes==0) { /* called from countem */ total_bytes=total_sent; return 0; } /* * to avoid synchronization problems on faulty lines we limit the Rxbuflen and the window. * The problem to solve: * - on a high bandwidth pipe a mass of ZDATE data subpackets will be in flight. * - the receiver sends back an ZRPOS (#1) * - still datapackets will come in * - the receiver sends back an ZRPOS (#2) * - [still datapackets will come in, and new ZRPOS will be created] (#3) * - now the receiver sees a new ZDATA for ZPOS #1 * - and many data subpackets * - now the receiver sees a new ZDATA for ZPOS #2 * - and the many data subpackets again. * the critical point is #3. Repeat that often enough, and synchronization * will not happen. * * This will not happen with a "low" Rxbuflen, because then the sender waits * for a receivers ACK. * * Fun fact: this brute force solution is good for the performance. */ if (error_count) { unsigned int last_rxbuflen=Rxbuflen; if (!Rxbuflen) { Rxbuflen=SAFETY_RXBUFLEN; } if (!original_rxbuflen) { original_rxbuflen=Rxbuflen; } Rxbuflen=original_rxbuflen; if (last_bytes_per_error <= 512000 && Rxbuflen>65536) Rxbuflen=65536; if (last_bytes_per_error <= 256000 && Rxbuflen>32768) Rxbuflen=32768; if (last_bytes_per_error <= 128000 && Rxbuflen>16384) Rxbuflen=16384; if (last_bytes_per_error <= 64000 && Rxbuflen> 8192) Rxbuflen= 8192; if (last_bytes_per_error <= 32000 && Rxbuflen> 4096) Rxbuflen= 4096; Txwindow=(Rxbuflen)/2; Txwindow = (Rxbuflen/2/64) * 64; Txwspac = Txwindow/4; if (Rxbuflen != last_rxbuflen) { DPRINTF(DEBUG_WINDOWHANDLING, "calc_blklen: LPBE %lu => RXB %lu Txwindow %lu\n", last_bytes_per_error, (unsigned long) Rxbuflen, (unsigned long) Txwindow); } } /* it's not good to calc blklen too early */ if (calcs_done++ < 5) { if (error_count && start_blklen >1024) return last_blklen=1024; 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; DPRINTF(DEBUG_WINDOWHANDLING, "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) { DPRINTF(DEBUG_WINDOWHANDLING, "calc_blklen: returned old value %d due to low bpe diff\n", last_blklen); DPRINTF(DEBUG_WINDOWHANDLING, "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: DPRINTF(DEBUG_WINDOWHANDLING, "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); DPRINTF(DEBUG_WINDOWHANDLING, "calc_blklen: blklen %u, 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; DPRINTF(DEBUG_WINDOWHANDLING, "calc_blklen: returned %d as best\n", last_blklen); return last_blklen; } static int calc_blklen(long total_sent) { unsigned int old_Rxbuflen=Rxbuflen; unsigned int old_Txwindow=Txwindow; static int last_blklen; int ret=calc_blklen_worker(total_sent); if (debugmode & DEBUG_WINDOWHANDLING) { if (old_Rxbuflen!=Rxbuflen) { fprintf(stderr,"calc_blklen changed Rxbuflen from %u to %u\n",old_Rxbuflen,Rxbuflen); } if (old_Txwindow!=Txwindow) { fprintf(stderr,"calc_blklen changed Txwindow from %u to %u\n",old_Txwindow,Txwindow); } if (ret!=last_blklen && last_blklen) { fprintf(stderr,"calc_blklen changed blklen from %u to %u\n",last_blklen,ret); } } last_blklen=ret; return ret; } /* * Respond to receiver's complaint, get back in sync with receiver */ static int getinsync(struct zm_fileinfo *zi, int flag) { size_t rxpos; int gotblock; int garbage=0; /* consecutive garbled headers; bounds the ZNAK retry */ for (;;) { /* another stop_time checkpoint: a ZCRCW ack wait * blocks here up to the receiver's activity level, and the * per-subpacket check in zsendfdata does not run while we * are waiting here. So check. */ if (stop_time && lrzsz_stop_time_reached ("getinsync", time (NULL), stop_time, zi->fname)) return ERROR; gotblock = zgethdr(Rxhdr, 0, &rxpos); switch (gotblock) { case ZCAN: case ZFIN: case TIMEOUT: case RCDO: /* RCDO: the line is gone (peer closed, carrier lost). * Retrying (ZNAK etc.) is futile and unbounded against * a dead line - treat like TIMEOUT. */ return ERROR; case ZABORT: case ZFERR: /* the receiver reported a fatal file error (ZFERR is * spec'd as equivalent to ZABORT, zmodem-wip.txt * §4) and wants the transfer ended - reply with the * ZFIN sequence the spec requires (§4), not with * retries or a cancel sequence. ZABORT: user cancel; * ZFERR: receiver file error. */ if (gotblock == ZABORT) stats_cancel(); else stats_file_error(); replied_abort = true; if (input_f) { fclose (input_f); input_f=NULL; } saybibi(); return ERROR; case ZRPOS: /* If sending to a buffered modem, you * might send a break at this point to * dump the modem's buffer. */ /* purge pending output: bytes already written but not * yet transmitted would only be stale data the receiver * must discard (zmodem-wip.txt §5, sender-side * error recovery). No-op on pipes/ptys. */ tcflush(io_mode_fd, TCOFLUSH); if (input_f) clearerr(input_f); /* In case file EOF seen */ /* A ZRPOS is always honored as "resume at this offset", * including a same-position one (rxpos == bytes_sent): §5 * grants the receiver the right to force a fresh sync * point that way, and requires the first data subpacket * after a ZRPOS to be ZCRCW (ack_resync() re-arms * need_wait on this path). An earlier version used to * translate a same-position ZRPOS into a ZACK here - a * speed workaround for zmrx 1.02, which answers every * ZCRCW with exactly such a ZRPOS - deviating from §5 by * silently reinterpreting the frame type; removed. */ /* the input_f check is for the static analyzer clang-tidy, * which doesn't catch the logic around input_f. */ if (input_f) { /* §5: a ZRPOS with rxpos > 0 into a non-seekable input * (pipe, socket, char device) must not abort the * transfer; the spec lets the sender ignore it (or * restart - which on such input can only ever mean * restarting from 0, since that is the only position a * stream can still deliver). Ignore. */ struct stat fst; if (fstat(fileno(input_f), &fst) == 0) { if (!S_ISREG(fst.st_mode)) { if (rxpos > 0) continue; } else if ((unsigned long long)rxpos > (unsigned long long)fst.st_size) { /* resume beyond our EOF: attack, * receiver bug, or our file was * shortened since the receiver's * partial was made. No wire answer * serves the receiver (clamp -> * ZRPOS/ZEOF loop; ignore -> offset * desync loop; ZSKIP is sender-side * forbidden). Reject the frame (§5 * "implementation-defined") and end * the file locally, like fseeko * failure. Receiver keeps partial. */ DO_SYSLOG(LOG_INFO, "%s/%s: resume beyond EOF (%llu > %llu)", lrzsz_basename(zi->fname), protname(), (unsigned long long)rxpos, (unsigned long long)fst.st_size); return ERROR; } } if (fseeko(input_f, (off_t) rxpos, 0)) return ERROR; } zi->eof_seen = 0; bytcnt = Lrxpos = zi->bytes_sent = rxpos; /* every ZRPOS here is an error event: the receiver only * re-requests a position after a subpacket failed CRC or * was lost on the line (the initial ZRPOS after ZFILE is * handled in zsendfile(), not here). The old same-position * test undercounted on lines where every resync succeeded * first-try: error_count stayed 0, the adaptive blklen and * the Rxbuflen safety ladder never engaged, and the sender * kept 8k subpackets whose terminators sat behind holes - * each terminator-eating drop then cost a full 10s * Rxtimeout instead of a fast CRC verdict. */ error_count++; Lastsync = rxpos; return ZRPOS; case ZACK: Lrxpos = rxpos; if (flag || zi->bytes_sent == rxpos) return ZACK; garbage = 0; /* a parsed frame: not the loop we're bounding */ continue; case ZRINIT: /* The receiver got the file and is ready for the next. * return ZRINIT, not ZSKIP, for correct accounting. * It must be ZRINIT, not OK: ack_resync()'s verdict * switches on this value, and OK would mean "resend * ZDATA" there - with input_f closed, zfilbuf() * would fread() from NULL. * One day i'll possibly clean up the function exit * codes. */ if (input_f) { fclose (input_f); input_f=NULL; } return ZRINIT; case ZSKIP: if (input_f) { fclose (input_f); input_f=NULL; } return ZSKIP; case ERROR: default: error_count++; /* was unbounded: a peer (or a noisy line) that keeps * delivering garbled headers got a ZNAK for each, forever. * error_count only feeds the adaptive blocksize; nothing * ever stopped retrying. Give up after a bounded run. */ if (++garbage > 10) return ERROR; stohdr(0); zsbhdr(ZNAK, Txhdr); continue; } } } /* Say "bibi" to the receiver, try to do it cleanly. Two roles: the normal * end-of-batch close (zmodem_requested path), and the reply to a receiver * that aborted with ZABORT/ZFERR - the spec requires the sender to respond * with a ZFIN sequence there (zmodem-wip.txt §4, "The sender responds * with a ZFIN sequence"), the historical OMEN cancel reply deviated from * that. A receiver that has died answers with RCDO/nothing: bounded, so we * don't loop forever on a dead line. */ 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 RCDO: case TIMEOUT: return; default: ; } } } /* 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: return ERROR; case ZABORT: case ZFERR: /* ZFERR is specified as equivalent to ZABORT * (zmodem-wip.txt §4): the receiver reported a * fatal file error. Do not retry the command against * a dead filesystem. Reply with the ZFIN sequence the * spec requires for ZABORT (§4). */ stats_cancel(); replied_abort = true; saybibi(); return ERROR; case ZFIN: case ZSKIP: case ZRPOS: return ERROR; default: if (++errors > 20) return ERROR; continue; case ZCOMPL: Exitcode = rxpos; saybibi(); return OK; case ZRQINIT: DPRINTF(DEBUG_TRANSFER, _("got a ZRQINIT packet: the other side is trying to send, too\n")); if (++errors > 20) return ERROR; } } } /* chkinvok() lives in util.c (shared with lrz); called with 's' here. */ static void countem (int argc, char **argv) { struct stat f; for (Totalleft = 0, Filesleft = 0; --argc >= 0; ++argv) { f.st_size = -1; DPRINTF(DEBUG_TRANSFER, "\nCountem: %03d %s ", argc, *argv); if (access (*argv, R_OK) >= 0 && stat (*argv, &f) >= 0) { if (!S_ISDIR(f.st_mode) && !S_ISBLK(f.st_mode)) { ++Filesleft; Totalleft += f.st_size; } } else if (strcmp (*argv, "-") == 0) { ++Filesleft; Totalleft += DEFBYTL; } DPRINTF(DEBUG_TRANSFER, " %ld", (long) f.st_size); } DPRINTF(DEBUG_TRANSFER, "\ncountem: Total %d %ld\n", Filesleft, Totalleft); calc_blklen (Totalleft); } /* End of lsz.c */ lrzsz-0.13.1/src/timestamp.c0000664000175000017500000000052215255263431011406 #include #include /* this file is for the sake of the self test byte/second calc, * as `date + '%N'` is not portable. */ int main(void) { struct timespec ts; if (clock_gettime(CLOCK_REALTIME, &ts) != 0) { perror("clock_gettime"); return 1; } printf("%ld.%09ld\n", (long)ts.tv_sec, ts.tv_nsec); return 0; } lrzsz-0.13.1/src/zmodem.h0000664000175000017500000001314115260222644010701 #ifndef LRZSZ_ZMODEM_H #define LRZSZ_ZMODEM_H /* 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 24 /* Ctrl-X Zmodem escape - `ala BISYNC DLE */ #define ZDLEE (ZDLE^0x40) /* 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 0x0100 #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 ( CAN|GOTOR) /* 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 [DEPRECATED] */ /* Bit Masks for ZRINIT flags byze ZF1 */ #define ZF1_CANVHDR 0x01 /* Variable headers OK, unused in lrzsz */ /* Parameters for ZSINIT frame */ #define ZATTNLEN 32 /* Max length of attention string */ /* Bit Masks for ZSINIT flags byte ZF0 */ #define TESCCTL 0x40 /* Transmitter expects ctl chars to be escaped */ #define TESC8 0x80 /* Transmitter expects 8th bit to be escaped [DEPRECATED] */ /* 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 0x40 /* Encoding for sparse file operations */ /* Parameters for ZCOMMAND frame ZF0 (otherwise 0) */ #define ZCACK1 1 /* Acknowledge, then do command */ #define LRZSZ_MAX_SUBPACKET_LEN 8192 /* End of ZMODEM.H */ #endif lrzsz-0.13.1/src/zm.c0000664000175000017500000006006615260222632010034 /* zm.c - zmodem protocol handling lowlevelstuff Copyright (C) until 1988 Chuck Forsberg (OMEN Technology Inc) Copyright (C) 1996-1998,2026+ 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" #include unsigned int Rxtimeout = 100; /* Tenths of seconds to wait for something */ /* Globals used by ZMODEM functions */ static int Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */ static int Rxtype; /* Type of header received */ unsigned char Rxhdr[4]; /* Received header */ unsigned char Txhdr[4]; /* Transmitted header */ int Txfcs32; /* true means send binary frames with 32 bit FCS */ int Crc32t; /* Display flag indicating 32 bit CRC being sent */ static 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 */ bool turbo_escape; static const char *frametypes[] = { "Carrier Lost", /* -3 */ "TIMEOUT", /* -2 */ "ERROR", /* -1 */ "ZRQINIT", "ZRINIT", "ZSINIT", "ZACK", "ZFILE", "ZSKIP", "ZNAK", "ZABORT", "ZFIN", "ZRPOS", "ZDATA", "ZEOF", "ZFERR", "ZCRC", "ZCHALLENGE", "ZCOMPL", "ZCAN", "ZFREECNT", "ZCOMMAND", "ZSTDERR" }; #define FTOFFSET 3 #define FRMAX (sizeof(frametypes) / sizeof(frametypes[0])) const char * frametype_to_string(unsigned int type) { static char unknown[32]; unsigned int idx = (unsigned int)type + FTOFFSET; if (idx < FRMAX) return frametypes[idx]; snprintf(unknown, sizeof(unknown), "unknown frame type %x", type); return unknown; } #define badcrc _("Bad CRC") /* static char *badcrc = "Bad CRC"; */ static inline LRZSZ_ALWAYS_INLINE int noxrd7 (void); static inline LRZSZ_ALWAYS_INLINE int zdlread (void); static int zdlread2 (int); static inline LRZSZ_ALWAYS_INLINE int zgeth1 (void); static void zputhex (unsigned int c, unsigned char *pos); static int zgethex (void); static int zrbhdr (unsigned char *hdr); static int zrbhdr32 (unsigned char *hdr); static int zrhhdr (unsigned char *hdr); static unsigned char zsendline_tab[256]; static void zsbh32 (unsigned char *hdr, int type); static inline void zsendline_s (const char *s, size_t count); /* * Read a character from the modem line with timeout. * Eat parity, XON and XOFF characters. */ static inline int noxrd7(void) { int c; for (;;) { if ((c = READLINE_PF(Rxtimeout)) < 0) return c; switch (c &= 0x7f) { case XON: case XOFF: continue; default: if (Zctlesc && !(c & 0x60)) continue; return c; case '\r': case '\n': case ZDLE: return c; } } } static inline int zgeth1(void) { 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 int zgethex(void) { int c; c = zgeth1(); DPRINTF(DEBUG_PROTOCOL, "zgethex: %02X", (unsigned int) 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; if ((c = READLINE_PF(Rxtimeout)) < 0) return c; /* Quick check for non control characters */ if (c & 0x60) return c; return zdlread2(c); } static int zdlread2(int c) { bool have_byte = true; /* zdlread() passes the first byte in */ bool after_zdle = false; /* set once a ZDLE has been seen */ for (;;) { if (!after_zdle) { /* unescaped context: a plain byte passes through */ if (!have_byte) { if ((c = READLINE_PF(Rxtimeout)) < 0) return c; if (c & 0x60) return c; } have_byte = false; switch (c) { case ZDLE: after_zdle = true; continue; case XON: case (XON|0x80): case XOFF: case (XOFF|0x80): /* flow control: skipped */ continue; default: if (Zctlesc && !(c & 0x60)) continue; /* skip control garbage */ return c; } } /* escaped context: read + CAN*5 chain + escaped switch */ 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 0x7f; case ZRUB1: return 0xff; case XON: case (XON|0x80): case XOFF: case (XOFF|0x80): /* flow control: skipped, also in the escaped * context - the classic rule (see below) can * only be reached for encodings of controls. */ continue; default: if (Zctlesc && !(c & 0x60)) continue; /* skip and stay escaped */ break; } /* ZDLE-escaped data: the classic rule accepts the escape * encodings of 0x40-0x5f/0xc0-0xdf ((c & 0x60) == 0x40) - * the escapes of the always-escaped controls 0x00-0x1f * and 0x80-0x9f. Any other byte after ZDLE is a format * error (the ESC8 dialect, whose escape encodings * include 0xa0-0xbf/0xe0-0xff, is deprecated). */ if ((c & 0x60) == 0x40) return (c ^ 0x40); zperr(_("Bad escape sequence 0x%x"), (unsigned int) c); return ERROR; } } /* * Send character c with ZMODEM escape sequence encoding. * Escape XON, XOFF. Escape CR following @ (Telenet net escape) */ static inline void zsendline(int c) { switch(zsendline_tab[(unsigned) (c&=0xff)]) { default: /* can't happen */ case 0: xsendline(lastsent = c); break; case 1: xsendline(ZDLE); c ^= 0x40; xsendline(lastsent = c); break; case 2: if ((lastsent & 0x7f) != 0x40) { xsendline(lastsent = c); } else { xsendline(ZDLE); c ^= 0x40; xsendline(lastsent = c); } break; } } /* is this really still useful in 2026? */ 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) & 0xff)]; if (last_esc) break; t++; } if (t!=s) { fwrite(s,(size_t)(t-s),1,stdout); stats_net_write((size_t)(t-s)); lastsent=t[-1]; s=t; } if (last_esc) { int c=*s; switch(last_esc) { default: /* can't happen */ case 0: xsendline(lastsent = c); break; case 1: xsendline(ZDLE); c ^= 0x40; xsendline(lastsent = c); break; case 2: if ((lastsent & 0x7f) != 0x40) { xsendline(lastsent = c); } else { xsendline(ZDLE); c ^= 0x40; xsendline(lastsent = c); } break; } s++; } } } /* Send ZMODEM binary header hdr of type type */ void zsbhdr(int type, unsigned char *hdr) { int n; unsigned short crc; DPRINTF(DEBUG_PROTOCOL, "zsbhdr: %s %lx", frametype_to_string(type), 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((0xff& *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(unsigned char *hdr, int type) { int n; unsigned long crc; xsendline(ZBIN32); zsendline(type); crc = 0xFFFFFFFFL; crc = UPDC32(type, crc); for (n=4; --n >= 0; ++hdr) { crc = UPDC32((0xff & *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, unsigned char *hdr) { int n; unsigned short crc; unsigned char s[30]; size_t len; DPRINTF(DEBUG_PROTOCOL, "zshhdr: %s %lx", frametype_to_string(type & 0x7f), 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((0xff & *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++]='\r'; s[len++]='\n'|0x80; /* * Uncork the remote in case a fake XOFF has stopped data flow */ if (type != ZFIN && type != ZACK) { s[len++]=XON; } fwrite(s, 1, len, stdout); stats_net_write(len); flushmo(); } /* * Send binary array buf of length length, with ending ZDLE sequence frameend */ static const char *Zendnames[] = { "ZCRCE", "ZCRCG", "ZCRCQ", "ZCRCW"}; const char * frameend_to_string(unsigned int type) { switch(type) { case ZCRCE: return "ZCRCE"; case ZCRCG: return "ZCRCG"; case ZCRCQ: return "ZCRCQ"; case ZCRCW: return "ZCRCW"; default: return "unknown"; } } void zsdata(const char *buf, size_t length, int frameend) { unsigned short crc; DPRINTF(DEBUG_PROTOCOL, "zsdata: %lu %s", (unsigned long) length, Zendnames[(frameend-ZCRCE)&3]); crc = 0; stats_msg_valid(length); for( ; length; length--) { zsendline(*buf); crc = updcrc((0xff & *buf), crc); buf++; } 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; DPRINTF(DEBUG_PROTOCOL, "zsdat32: %lu %s", length, Zendnames[(frameend-ZCRCE)&3]); crc = 0xFFFFFFFFL; stats_msg_valid(length); zsendline_s(buf,length); for (; length; length--) { c = *buf & 0xff; 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 & 0x60) xsendline(lastsent = c); else zsendline(c); crc >>= 8; } if (frameend == ZCRCW) { xsendline(XON); flushmo(); } } /* * Receive array buf of max length with ending ZDLE sequence * and CRC. Returns the ending character or error code. * NB: on the too-long error path (a data byte arriving when the buffer * is already full) the offending byte is stored at buf[length] - buf * must provide length+1 bytes. Callers allocate exactly that (secbuf: * 1+LRZSZ_MAX_SUBPACKET_LEN; Attn: ZATTNLEN+1). * * zrdata1 is the shared body of the 16-bit and 32-bit CRC variants: the * two differ only in the CRC chain (init, update, byte count in the * frame-end cases, final compare) and the debug name. The 16-bit chain * is emulated bit-exactly: the original code stored each updcrc() result * into an unsigned short, truncating to 16 bits on every update, so the * merged function masks each update with 0xFFFF. CRC32 is loop-invariant, * so the per-byte branch costs nothing measurable. The GOTCAN/TIMEOUT/ * default verdict cases are shared; the only order change (stats call vs * zperr in the invalid-CRC and default cases) is unobservable outside a * STATS_TRACE build. */ static int zrdata1(char *buf, int length, size_t *bytes_received, bool crc32) { int c; unsigned long crc32v; unsigned short crc16; char *end; int d; unsigned int i; *bytes_received=0; if (crc32) crc32v = 0xFFFFFFFFL; else crc16 = 0; end = buf + length; while (buf <= end) { if ((c = zdlread()) & ~0xff) { crcfoo: switch (c) { case GOTCRCE: case GOTCRCG: case GOTCRCQ: case GOTCRCW: { d = c; c &= 0xff; if (crc32) crc32v = UPDC32(c, crc32v); else crc16 = updcrc(c, crc16) & 0xFFFF; for (i = 0; i < (crc32 ? 4 : 2); i++) { if ((c = zdlread()) & ~0xff) goto crcfoo; if (crc32) crc32v = UPDC32(c, crc32v); else crc16 = updcrc(c, crc16) & 0xFFFF; } stats_msg_bytes(length - (end - buf)); if (crc32) { if (crc32v != 0xDEBB20E3) { stats_msg_invalid(); zperr(badcrc); return ERROR; } } else if (crc16 != 0) { /* CRC-16/XMODEM: the sender sends * the ones-complement, so the * accumulator over data plus the * received CRC bytes ends at 0 for * good data; nonzero means corruption. */ stats_msg_invalid(); zperr(badcrc); return ERROR; } stats_msg_valid(0); *bytes_received = length - (end - buf); if (crc32) DPRINTF(DEBUG_PROTOCOL, "zrdat32: %lu %s", (unsigned long) *bytes_received, Zendnames[(d-GOTCRCE)&3]); else DPRINTF(DEBUG_PROTOCOL, "zrdata: %lu %s", (unsigned long) (*bytes_received), Zendnames[(d-GOTCRCE)&3]); return d; } case GOTCAN: zperr(_("Sender Canceled")); stats_cancel(); return ZCAN; case TIMEOUT: zperr(_("TIMEOUT")); stats_timeout(); return c; case RCDO: /* the line died (peer closed, carrier lost): * a net-death verdict, not protocol garbage */ zperr(_("Line dropped")); stats_net_error(); return c; default: zperr(_("Bad data subpacket")); stats_msg_format_error(); return c; } } if (buf == end) break; *buf++ = c; if (crc32) crc32v = UPDC32(c, crc32v); else crc16 = updcrc(c, crc16) & 0xFFFF; } zperr(_("Data subpacket too long")); stats_msg_format_error(); return ERROR; } int zrdata(char *buf, int length, size_t *bytes_received) { return zrdata1(buf, length, bytes_received, Rxframeind == ZBIN32); } /* * 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(unsigned char *hdr, int eflag, size_t *Rxpos) { /* The byte-level resync parser is a state machine, was a goto hell: * ST_GARBAGE - read + classify a byte (former startover/again/agn2) * ST_HUNT_CAN - CAN-hunt with eager 1-tenths-timeout reads (former gotcan) * ST_ZPADS - skip consecutive ZPADs via noxrd7() (former splat) * ST_FRAME - frame type read + ZBIN/ZBIN32/ZHEX dispatch * ST_TAIL - former fifi: common epilogue * reset_cancount: cancount resets only on the garbage-tail loop (the old * goto startover), not when the CAN-hunt returns to the scan via TIMEOUT * or more-CAN (the old goto again). * have_byte: the CAN-hunt's default * byte, the ST_ZPADS default and the ST_FRAME default flow directly into * the garbage block with the byte already read (the old goto agn2). * * rxpos/rclhdr and stats_msg_bytes(4) run only on the dispatched-header * arms (as in the original), NOT in the epilogue: error paths must leave * *Rxpos untouched and print rxpos=0. * * this is still not good, but much better. */ enum zgethdr_state { ST_GARBAGE, ST_HUNT_CAN, ST_ZPADS, ST_FRAME, ST_TAIL }; int state = ST_GARBAGE; bool have_byte = false; bool reset_cancount = true; int c, cancount; unsigned int max_garbage; /* Max bytes before start of frame */ size_t rxpos=0; /* keep gcc happy */ int garbage_count = 0; max_garbage = Zrwindow + Baudrate; Rxframeind = Rxtype = 0; while (state != ST_TAIL) { switch (state) { case ST_GARBAGE: if (reset_cancount) { cancount = 5; reset_cancount = false; } if (!have_byte) { /* Return immediate ERROR if ZCRCW sequence seen */ c = READLINE_PF(Rxtimeout); if (c == RCDO || c == TIMEOUT) state = ST_TAIL; if (state == ST_TAIL) continue; } have_byte = false; if (c == CAN) { state = ST_HUNT_CAN; continue; } if (c == ZPAD || c == (ZPAD|0x80)) { /* This is what we want. */ state = ST_ZPADS; continue; } /* garbage byte: count it, maybe display it */ garbage_count++; if ((debugmode & DEBUG_PROTOCOL) && (garbage_count <= 3 || garbage_count % 1000 == 0)) DPRINTF(DEBUG_PROTOCOL, "zgethdr: garbage[%d]=0x%02x, max_garbage_left=%u", garbage_count, (unsigned int) (c & 0xff), max_garbage); if ( --max_garbage == 0) { if (debugmode & DEBUG_PROTOCOL) DPRINTF(DEBUG_PROTOCOL, "zgethdr: garbage count exceeded after %d bytes", garbage_count); zperr(_("Garbage count exceeded")); return(ERROR); } if (eflag && ((c &= 0x7f) & 0x60) && (debugmode & DEBUG_PROTOCOL)) vchar(c); else if (eflag > 1 && (debugmode & DEBUG_PROTOCOL)) vchar(c); reset_cancount = true; /* the old goto startover */ continue; case ST_HUNT_CAN: if (--cancount <= 0) { c = ZCAN; state = ST_TAIL; continue; } c = READLINE_PF(1); if (c == TIMEOUT) { /* the old goto again: an Rxtimeout read next, no reset */ state = ST_GARBAGE; reset_cancount = false; continue; } if (c == ZCRCW) { /* fast error recovery */ c = ERROR; state = ST_TAIL; continue; } if (c == RCDO) { state = ST_TAIL; continue; } if (c == CAN) { if (--cancount <= 0) { c = ZCAN; state = ST_TAIL; continue; } /* the old goto again: back to the Rxtimeout read; * if that byte is a CAN too, we re-enter the hunt. * Reads alternate Rxtimeout/1 exactly as before. */ state = ST_GARBAGE; reset_cancount = false; continue; } /* the hunted byte is not a CAN: process it as garbage */ state = ST_GARBAGE; reset_cancount = false; have_byte = true; continue; case ST_ZPADS: c = noxrd7(); if (c == ZPAD) continue; /* skip more ZPADs */ if (c == RCDO || c == TIMEOUT) { state = ST_TAIL; continue; } if (c == ZDLE) { /* This is what we want. */ state = ST_FRAME; continue; } state = ST_GARBAGE; /* the old goto agn2 */ reset_cancount = false; have_byte = true; continue; case ST_FRAME: switch (c = noxrd7()) { case RCDO: case TIMEOUT: state = ST_TAIL; continue; case ZBIN: Rxframeind = ZBIN; Crc32 = false; c = zrbhdr(hdr); if (c==ERROR) { stats_msg_invalid(); } else { stats_msg_valid(0); } rxpos = rclhdr(hdr); if (Rxpos) *Rxpos = rxpos; stats_msg_bytes(4); state = ST_TAIL; continue; case ZBIN32: Rxframeind = ZBIN32; Crc32 = true; c = zrbhdr32(hdr); if (c==ERROR) { stats_msg_invalid(); } else { stats_msg_valid(0); } rxpos = rclhdr(hdr); if (Rxpos) *Rxpos = rxpos; stats_msg_bytes(4); state = ST_TAIL; continue; case ZHEX: Rxframeind = ZHEX; Crc32 = false; c = zrhhdr(hdr); if (c==ERROR) { stats_msg_invalid(); } else { stats_msg_valid(0); } rxpos = rclhdr(hdr); if (Rxpos) *Rxpos = rxpos; stats_msg_bytes(4); state = ST_TAIL; continue; case CAN: state = ST_HUNT_CAN; /* the old goto gotcan */ reset_cancount = false; continue; default: stats_msg_format_error(); state = ST_GARBAGE; /* the old goto agn2 */ reset_cancount = false; have_byte = true; continue; } default: /* unreachable: state always holds one of the enum values */ state = ST_TAIL; continue; } } /* ex fifi label: the common epilogue. rxpos is 0 here unless a header * was dispatched (the success arms set it above). */ DPRINTF(DEBUG_PROTOCOL, "zgethdr: returning %d (%s) after %d garbage bytes, rxpos=%lx, readline_left=%d", c, frametype_to_string(c), garbage_count, (unsigned long)rxpos, readline_left); /* error accounting */ switch (c) { case GOTCAN: case ZCAN: stats_cancel(); break; case TIMEOUT: stats_timeout(); break; default: /* nothing to do */ ; } switch (c) { case GOTCAN: c = ZCAN; /* FALLTHROUGH */ case ZNAK: case ZCAN: case ERROR: case TIMEOUT: case RCDO: zperr(_("Got %s"), frametype_to_string(c)); /* FALLTHROUGH */ default: DPRINTF(DEBUG_PROTOCOL, "zgethdr: %s %lx", frametype_to_string(c), (unsigned long) rxpos); } return c; } /* Receive a binary style header (type and position) */ static int zrbhdr(unsigned char *hdr) { int c, n; unsigned short crc; if ((c = zdlread()) & ~0xff) return c; Rxtype = c; crc = updcrc(c, 0); for (n=4; --n >= 0; ++hdr) { if ((c = zdlread()) & ~0xff) return c; crc = updcrc(c, crc); *hdr = c; } if ((c = zdlread()) & ~0xff) return c; crc = updcrc(c, crc); if ((c = zdlread()) & ~0xff) return c; crc = updcrc(c, crc); if (crc != 0) { 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(unsigned char *hdr) { int c, n; unsigned long crc; if ((c = zdlread()) & ~0xff) return c; Rxtype = c; crc = 0xFFFFFFFFL; crc = UPDC32(c, crc); for (n=4; --n >= 0; ++hdr) { if ((c = zdlread()) & ~0xff) return c; crc = UPDC32(c, crc); *hdr = c; } for (n=4; --n >= 0;) { if ((c = zdlread()) & ~0xff) return c; crc = UPDC32(c, crc); } 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(unsigned char *hdr) { int c; unsigned short crc; 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 != 0) { zperr(badcrc); return ERROR; } switch (READLINE_PF(1)) { case '\r'|0x80: /* **** FALL THRU TO **** */ case '\r': /* Throw away possible cr/lf */ READLINE_PF(1); break; default: ; } protocol = ZM_ZMODEM; zmodem_requested=true; return Rxtype; } /* Write a byte as two hex digits */ static void zputhex(unsigned int c, unsigned char *pos) { static char digits[] = "0123456789abcdef"; DPRINTF(DEBUG_PROTOCOL, "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 & 0x60) zsendline_tab[i]=0; else { switch(i) { case ZDLE: case XOFF: /* ^Q */ case XON: /* ^S */ case (XOFF | 0x80): case (XON | 0x80): zsendline_tab[i]=1; break; case 0x10: /* ^P */ case 0x10|0x80: if (turbo_escape) zsendline_tab[i]=0; else zsendline_tab[i]=1; break; case '\r': case '\r'|0x80: 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) { unsigned long lpos=(unsigned long) pos; Txhdr[ZP0] = lpos; Txhdr[ZP1] = lpos>>8; Txhdr[ZP2] = lpos>>16; Txhdr[ZP3] = lpos>>24; } /* Recover a long integer from a header */ unsigned long rclhdr(const unsigned char *hdr) { unsigned long l; l = (hdr[ZP3] & 0xff); l = (l << 8) | (hdr[ZP2] & 0xff); l = (l << 8) | (hdr[ZP1] & 0xff); l = (l << 8) | (hdr[ZP0] & 0xff); return l; } /* End of zm.c */ lrzsz-0.13.1/src/stats.h0000664000175000017500000000644315251332413010547 #ifndef LRZSZ_STATS_H #define LRZSZ_STATS_H #include /* size_t */ struct lrzsz_stat { char *filename; double start_time; /* a message is a sector/subframe/packet, something with an own checksum. */ unsigned long valid_messages; unsigned long invalid_messages; unsigned long out_of_sync_messages; /* a valid message out of sync */ /* we were reading a message, had identified it as such, but could not find its end */ unsigned long format_errors; /* what happened to files: */ unsigned long files_ok; unsigned long files_err; unsigned long local_errors; unsigned long policy_rejects; unsigned long skipped; unsigned long cancels; /* a transfer was cancelled after one side began to send data. */ /* general error handling */ unsigned long timeouts; /* timeout */ unsigned long too_many_errors; /* some operation failed because of that */ /* counters */ unsigned long long total_message_bytes; unsigned long long net_bytes_in; unsigned long net_read_ops; unsigned long long net_bytes_out; unsigned long net_write_ops; unsigned long net_errors; /* read errors and hangups on the transfer line */ char direction; /* 'r' = receive (lrz), 's' = send (lsz) */ }; extern struct lrzsz_stat stat_for_file; extern struct lrzsz_stat stat_for_all; void stats_account_one(void); void stats_account_finalize_file(void); void stats_start_one(void); void stats_log(struct lrzsz_stat *st, bool forone); void stats_set_filename(const char *); void stats_journal_open(const char *path); void stats_journal_close(void); /* * Event accounting helpers: the single write barrier for stat_for_file * counters, so protocol code states what happened without touching the * struct. One call per event; see the matching comments in struct * lrzsz_stat for the field semantics. * * All counters are per file (stat_for_file); stats_account_one() rolls * them into stat_for_all at batch boundaries. * * Debug aid: compile with -DSTATS_TRACE to log every accounting event to * stderr (useful for tracking where counters originate; far more readable * than a raw struct hexdump). */ void stats_msg_valid(size_t bytes); /* valid message carrying bytes payload */ void stats_msg_invalid(void); /* message failed its checksum */ void stats_msg_out_of_sync(void); /* valid message, but out of sync */ void stats_msg_format_error(void); /* message start seen, end not found */ void stats_msg_bytes(size_t bytes); /* message volume without a verdict */ void stats_file_ok(void); /* file transferred successfully */ void stats_file_error(void); /* file transfer failed */ void stats_file_local_error(void); /* local (non-protocol) problem */ void stats_file_policy_reject(void); /* refused by policy, not an error */ void stats_file_skipped(void); /* file skipped by sender or receiver */ void stats_cancel(void); /* a side sent ZCAN/CAN CAN */ void stats_timeout(void); /* a read timed out */ void stats_too_many_errors(void); /* giving up: retry budget exhausted */ void stats_net_read(long n); /* one read op; n < 0: failed read */ void stats_net_write(size_t bytes); /* bytes handed to the line */ void stats_net_error(void); /* read error or hangup on the line */ #endif lrzsz-0.13.1/src/Makefile.am0000664000175000017500000000477515256426345011317 bin_PROGRAMS=lrz lsz COMMON_SOURCES=timing.c zperr.c zreadline.c crctab.c rbsb.c zm.c protname.c lsyslog.c canit.c stats.c util.c lrz_SOURCES=lrz.c $(COMMON_SOURCES) lsz_SOURCES=lsz.c $(COMMON_SOURCES) noinst_HEADERS = timing.h zglobal.h zmodem.h stats.h util.h crctab.h noinst_PROGRAMS = zmodemsnif linesimulator timestamp zmodemfuzz LDADD = @LIBINTL@ AM_CPPFLAGS = -I.. -I$(srcdir) -I$(top_srcdir)/src -DLOCALEDIR=\"$(localedir)\" -D_POSIX_C_SOURCE=@MIN_POSIX_C_STD@ AM_CFLAGS = @WARN_CFLAGS@ @LRZSZ_CFLAGS@ # clang development aid: to enable nearly every clang warning, move the # following line into AM_CFLAGS above (removing the leading '#'); the # -Wno-* list mutes the warnings that are pure noise for this code base. #-Weverything -Wno-disabled-macro-expansion -Wno-reserved-macro-identifier -Wno-used-but-marked-unused -Wno-padded -Wno-unsafe-buffer-usage -Wno-implicit-int-conversion -Wno-sign-conversion -Wno-implicit-fallthrough -Wno-unreachable-code-break -Wno-implicit-int-float-conversion -Wno-float-equal -Wno-covered-switch-default -Wno-unused-macros AM_LDFLAGS = @LRZSZ_LDFLAGS@ # The hard links below point at the installed binaries, so those must exist # first. Order it explicitly, otherwise FTBFS with make --shuffle=reverse. install-exec-local: install-binPROGRAMS 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 $(DESTDIR)/$(bindir)/`echo lsx | sed -e '$(transform)'` ln $(DESTDIR)/$(bindir)/`echo lsz |sed -e '$(transform)'` \ $(DESTDIR)/$(bindir)/`echo lsx |sed -e '$(transform)'` rm -f $(DESTDIR)/$(bindir)/`echo lrb | sed -e '$(transform)'` ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \ $(DESTDIR)/$(bindir)/`echo lrb |sed -e '$(transform)'` rm -f $(DESTDIR)/$(bindir)/`echo lrx | sed -e '$(transform)'` ln $(DESTDIR)/$(bindir)/`echo lrz |sed -e '$(transform)'` \ $(DESTDIR)/$(bindir)/`echo lrx |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)'` TIDY_FILES = $(COMMON_SOURCES) lrz.c lsz.c \ zmodemsnif.c linesimulator.c timestamp.c zmodemfuzz.c tidy: $(TIDY_FILES) $(noinst_HEADERS) clang-tidy --checks='-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' $(TIDY_FILES) -- $(AM_CPPFLAGS) $(AM_CFLAGS) lrzsz-0.13.1/src/stats.c0000664000175000017500000002335015256242771010552 #include "config.h" #include "zglobal.h" #include #include #include #include #include struct lrzsz_stat stat_for_file; struct lrzsz_stat stat_for_all; static FILE *journal_fp = NULL; #define OUT(X,Y) do { if (st->X) fprintf(out, " %s=%lu",Y,(unsigned long) (st->X)); } while(0) #define OUTLL(X,Y) do { if (st->X) fprintf(out, " %s=%llu",Y,(unsigned long long) (st->X)); } while(0) /* Journal payload sanitizer: sanitize_bytes() one source byte at a time, * so the journal keeps its no-cap-on-source behavior. (The previous chunked * version advanced the source position by the sanitized OUTPUT length, which * diverges from the consumed input the moment an escape is emitted - 1 byte * becomes 4 - and mis-chunked any name containing a control character.) */ static void fprintf_sanitized(FILE *out, const char *s) { for (; *s; s++) { char scratch[4]; size_t n = sanitize_bytes(scratch, sizeof scratch, s); fwrite(scratch, 1, n, out); } } void stats_set_filename(const char *fn) { /* free a previous name, if any: the caller may set a new name without * accounting (stats_account_one frees it, but is not always called) */ if (stat_for_file.filename) { free(stat_for_file.filename); stat_for_file.filename=NULL; } stat_for_file.filename=xstrdup(fn); } static void write_stats_line(FILE *out, struct lrzsz_stat *st, bool forone) { struct termios tty; struct timespec end_timespec; struct timespec wall_timespec; double dur=-1; int ret; const char *dir; if (!out) { return; } ret=clock_gettime(CLOCK_MONOTONIC, &end_timespec); if (!ret) { double end; end=end_timespec.tv_sec+((double)end_timespec.tv_nsec/1e9); if (st->start_time>0) { dur=end-st->start_time; } } /* no summary for one file. */ if (!forone && st->files_ok+st->files_err+st->policy_rejects+st->skipped < 2) { return; } if (clock_gettime(CLOCK_REALTIME, &wall_timespec) == 0) fprintf(out,"ts=%ld.%03ld",(long)wall_timespec.tv_sec, wall_timespec.tv_nsec/1000000); else fprintf(out,"ts=%ld",(long)time(NULL)); fprintf(out," prog="); fprintf_sanitized(out, lrzsz_progname); dir = (st->direction == 's') ? "tx" : "rx"; fprintf(out," dir=%s", dir); fprintf(out," proto=%c", protocol == ZM_XMODEM ? 'x' : protocol == ZM_YMODEM ? 'y' : 'z'); if (forone) { fprintf(out," filename="); fprintf_sanitized(out, st->filename ? st->filename : "unknown"); /* unknown: coding error or out of memory. */ if (st->files_ok) { fprintf(out," status=ok"); } else if (st->files_err) { fprintf(out," status=failed"); } else if (st->local_errors) { fprintf(out," status=error"); } else if (st->policy_rejects) { fprintf(out," status=policy"); } else if (st->skipped) { fprintf(out," status=skipped"); } else { fprintf(out," status=unknown"); } } else { OUT(files_ok,"files_ok"); OUT(files_err,"files_err"); OUT(policy_rejects,"policy"); OUT(skipped,"skipped"); } OUT(valid_messages,"valid_msgs"); OUT(invalid_messages,"invalid_msgs"); fprintf(out," total_msg_bytes=%llu", st->total_message_bytes); if (st->valid_messages+st->invalid_messages) { fprintf(out," avg_msg_size=%llu", st->total_message_bytes/(st->valid_messages+st->invalid_messages)); } OUT(out_of_sync_messages,"out_of_sync_msgs"); OUT(local_errors,"local_errors"); OUT(cancels,"cancels"); OUT(timeouts,"timeouts"); OUT(too_many_errors,"too_many_errors"); OUT(format_errors,"format_errors"); OUTLL(net_bytes_in,"net_bytes_in"); OUT(net_read_ops,"net_read_ops"); OUTLL(net_bytes_out,"net_bytes_out"); OUT(net_write_ops,"net_write_ops"); OUT(net_errors,"net_errors"); if (dur>0) { fprintf(out," dur=%.3f",dur); fprintf(out," bps=%.3f",(8.0*st->total_message_bytes)/dur); } if (0==tcgetattr(0,&tty)) { int ibaud = getspeed(cfgetispeed(&tty)); if (0==tcgetattr(1,&tty)) { int obaud = getspeed(cfgetospeed(&tty)); if (ibaud==obaud) { fprintf(out," baud=%d",ibaud); } else { fprintf(out," ibaud=%d obaud=%d",ibaud,obaud); } } } fprintf(out,"\n"); } void stats_log(struct lrzsz_stat *st, bool forone) { setlocale(LC_NUMERIC,"C"); write_stats_line(journal_fp, st, forone); setlocale(LC_NUMERIC,""); } #define TRANSFER(X) do { \ stat_for_all.X += stat_for_file.X; \ stat_for_file.X = 0; \ } while(0) void stats_account_one(void) { #define debug_stats 0 #if debug_stats unsigned int i; unsigned char * todump = (unsigned char*)&stat_for_file; fprintf(stderr,"\nfile: "); for (i = 0; i < sizeof(stat_for_file); ++i) fprintf(stderr,"%02X ", todump[i]); todump = (unsigned char*)&stat_for_all; fprintf(stderr,"\nall0: "); for (i = 0; i < sizeof(stat_for_all); ++i) fprintf(stderr,"%02X ", todump[i]); fprintf(stderr,"\n"); #endif stats_log(&stat_for_file,true); if (stat_for_file.filename) { free(stat_for_file.filename); stat_for_file.filename=NULL; } TRANSFER(valid_messages); TRANSFER(invalid_messages); TRANSFER(out_of_sync_messages); TRANSFER(format_errors); TRANSFER(cancels); TRANSFER(timeouts); TRANSFER(too_many_errors); TRANSFER(files_ok); TRANSFER(files_err); TRANSFER(local_errors); TRANSFER(policy_rejects); TRANSFER(skipped); TRANSFER(total_message_bytes); TRANSFER(net_read_ops); TRANSFER(net_bytes_in); TRANSFER(net_write_ops); TRANSFER(net_bytes_out); TRANSFER(net_errors); #if debug_stats fprintf(stderr,"all1: "); for (i = 0; i < sizeof(stat_for_all); ++i) fprintf(stderr,"%02X ", todump[i]); fprintf(stderr,"\n"); #endif } void stats_account_finalize_file(void) { TRANSFER(valid_messages); TRANSFER(invalid_messages); TRANSFER(out_of_sync_messages); TRANSFER(format_errors); TRANSFER(cancels); TRANSFER(timeouts); TRANSFER(too_many_errors); TRANSFER(files_ok); TRANSFER(files_err); TRANSFER(local_errors); TRANSFER(policy_rejects); TRANSFER(skipped); TRANSFER(total_message_bytes); TRANSFER(net_read_ops); TRANSFER(net_bytes_in); TRANSFER(net_write_ops); TRANSFER(net_bytes_out); TRANSFER(net_errors); } void stats_start_one(void) { struct timespec start; int ret; ret=clock_gettime(CLOCK_MONOTONIC, &start); if (ret) { stat_for_file.start_time=0; } else { stat_for_file.start_time=start.tv_sec+((double)start.tv_nsec/1e9); } } void stats_journal_open(const char *path) { int fd; if (journal_fp) { fclose(journal_fp); journal_fp = NULL; } fd = open(path, O_WRONLY|O_CREAT|O_APPEND, 0600); if (fd < 0) { lrzsz_warning(errno,_("%s: cannot open journal file '%s'"), lrzsz_progname, path); return; } journal_fp = fdopen(fd, "a"); if (!journal_fp) { lrzsz_warning(errno,_("%s: cannot open journal file '%s'"), lrzsz_progname, path); close(fd); return; } setvbuf(journal_fp, NULL, _IOLBF, 0); } void stats_journal_close(void) { if (journal_fp) { fclose(journal_fp); journal_fp = NULL; } } /* * Event accounting helpers (see stats.h). Each updates exactly the fields * its event implies; STATS_TRACE builds additionally log the event. */ #ifdef STATS_TRACE #define STATS_TRACE_FMT(name) fprintf(stderr, "stats: " name "\n") #define STATS_TRACE_FMT1(name, fmt, val) fprintf(stderr, "stats: " name " " fmt "\n", (val)) #else #define STATS_TRACE_FMT(name) ((void) 0) #define STATS_TRACE_FMT1(name, fmt, val) ((void) 0) #endif void stats_msg_valid(size_t bytes) { stat_for_file.total_message_bytes += bytes; stat_for_file.valid_messages++; STATS_TRACE_FMT1("msg_valid", "%zu", bytes); } void stats_msg_invalid(void) { stat_for_file.invalid_messages++; STATS_TRACE_FMT("msg_invalid"); } void stats_msg_out_of_sync(void) { stat_for_file.out_of_sync_messages++; STATS_TRACE_FMT("msg_out_of_sync"); } void stats_msg_format_error(void) { stat_for_file.format_errors++; STATS_TRACE_FMT("msg_format_error"); } void stats_msg_bytes(size_t bytes) { stat_for_file.total_message_bytes += bytes; STATS_TRACE_FMT1("msg_bytes", "%zu", bytes); } void stats_file_ok(void) { stat_for_file.files_ok++; STATS_TRACE_FMT("file_ok"); } void stats_file_error(void) { stat_for_file.files_err++; STATS_TRACE_FMT("file_error"); } void stats_file_local_error(void) { stat_for_file.local_errors++; STATS_TRACE_FMT("file_local_error"); } void stats_file_policy_reject(void) { stat_for_file.policy_rejects++; STATS_TRACE_FMT("file_policy_reject"); } void stats_file_skipped(void) { stat_for_file.skipped++; STATS_TRACE_FMT("file_skipped"); } void stats_cancel(void) { stat_for_file.cancels++; STATS_TRACE_FMT("cancel"); } void stats_timeout(void) { stat_for_file.timeouts++; STATS_TRACE_FMT("timeout"); } void stats_too_many_errors(void) { stat_for_file.too_many_errors++; STATS_TRACE_FMT("too_many_errors"); } void stats_net_read(long n) { stat_for_file.net_read_ops++; if (n >= 0) stat_for_file.net_bytes_in += (unsigned long long) n; STATS_TRACE_FMT1("net_read", "%ld", n); } void stats_net_write(size_t bytes) { stat_for_file.net_bytes_out += bytes; STATS_TRACE_FMT1("net_write", "%zu", bytes); } void stats_net_error(void) { stat_for_file.net_errors++; STATS_TRACE_FMT("net_error"); } lrzsz-0.13.1/src/zglobal.h0000664000175000017500000001530715260222632011043 #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 #include /* putchar, fflush, stdout: sendline/flushmo helpers */ #include #include # include # include # include #include #include #include #include /* Take care of NLS matters. */ #include #ifdef ENABLE_NLS # include # define _(Text) gettext (Text) #else # define bindtextdomain(Domain, Directory) /* empty */ # define textdomain(Domain) /* empty */ # define _(Text) Text #endif #include extern int enable_syslog; #include #include #include "stats.h" #include "util.h" #define OK 0 #define ERROR (-1) /* Ward Christensen / CP/M parameters - Don't change these! */ #define ENQ 0x05 #define CAN ('X'&0x1f) #define XOFF ('s'&0x1f) #define XON ('q'&0x1f) #define SOH 0x01 #define STX 0x02 #define EOT 0x04 #define ACK 0x06 #define NAK 0x15 #define CPMEOF 0x1a #define WANTCRC 0x43 /* send C not NAK to get crc not checksum */ #define WANTG 0x47 /* Send G not NAK to get nonstop batch xmsn */ #define TIMEOUT (-2) #define RCDO (-3) #define WCEOT (-10) #define RETRYMAX 10 #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; }; /* zero every field (fname=NULL, counters 0, eof_seen=0) */ static inline void zi_init(struct zm_fileinfo *zi) { 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; } #define R_BYTESLEFT(x) ((x)->bytes_total-(x)->bytes_received) extern enum zm_type_enum protocol; extern int Verbose; extern int errors; extern bool no_timeout; extern bool Zctlesc; /* Encode control characters */ extern bool under_rsh; extern bool turbo_escape; extern bool zmodem_requested; void bibi (int n); /* Output primitives for the protocol stream, including stat-accounting */ static inline void sendline(int c) { putchar((c) & 0377); stat_for_file.net_bytes_out++; } static inline void xsendline(int c) { putchar(c); stat_for_file.net_bytes_out++; } static inline void flushmo(void) { fflush(stdout); stat_for_file.net_write_ops++; } /* zreadline.c */ extern unsigned 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 (unsigned int timeout); void readline_purge (void); void readline_setup (int fd, size_t readnum, size_t buffer_size); /* rbsb.c */ extern bool Fromcu; extern bool Twostop; extern unsigned int Baudrate; LRZSZ_FORMAT_PRINTF(1,2) void zperr (const char *fmt, ...); LRZSZ_FORMAT_PRINTF(1,2) void zpfatal (const char *fmt, ...); #define vchar(x) putc(x,stderr) #define vstring(x) fputs(x,stderr) LRZSZ_FORMAT_PRINTF(1,2) void vstringf (const char *format, ...); /* Debug modules, selected with --debug=NAME[,NAME...] (see util.c). * DPRINTF prints to stderr when any of the modules in mask is enabled. */ #define DEBUG_PROTOCOL 0x01 /* ZMODEM frame state machine (zm.c) */ #define DEBUG_READLINE 0x02 /* line reader: select/read/timeouts/hex (zreadline.c) */ #define DEBUG_TRANSFER 0x04 /* file transfer state machine (lrz.c/lsz.c) */ #define DEBUG_WINDOWHANDLING 0x08 /* adaptive blklen/window (lsz.c) */ #define DEBUG_TTY 0x10 /* tty setup (rbsb.c) */ #define DEBUG_ALL (DEBUG_PROTOCOL|DEBUG_READLINE|DEBUG_TRANSFER|DEBUG_WINDOWHANDLING|DEBUG_TTY) extern unsigned int debugmode; #define DPRINTF(mask, ...) do { if ((debugmode) & (mask)) \ vstringf(__VA_ARGS__); } while (0) /* rbsb.c */ int from_cu (void); int rdchk (int fd); /* io_mode returns OK or ERROR. ERROR means the line mode could not be * determined/changed; the next io_mode call with n != 0 retries. The * return value is advisory: most callers are best-effort cleanups, the * startup call sites warn on ERROR and continue. */ int io_mode (int fd, int n); void sendbrk (int fd); void purgeline (int fd); void canit (int fd); #include "crctab.h" /* zm.c */ #include "zmodem.h" extern unsigned int Rxtimeout; /* Tenths of seconds to wait for something */ /* Globals used by ZMODEM functions */ extern unsigned int Zrwindow; /* RX window size (controls garbage count) */ /* extern int Rxcount; */ /* Count of data bytes received */ extern unsigned char Rxhdr[4]; /* Received header */ extern unsigned char Txhdr[4]; /* Transmitted header */ 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 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_init (void); void zsbhdr (int type, unsigned char *hdr); void zshhdr (int type, unsigned char *hdr); void zsdata (const char *buf, size_t length, int frameend); void zsda32 (const char *buf, size_t length, int frameend); int zrdata (char *buf, int length, size_t *received); int zgethdr (unsigned char *hdr, int eflag, size_t *); void stohdr (size_t pos); unsigned long rclhdr (const unsigned char *hdr); const char * protname (void); LRZSZ_FORMAT_PRINTF(2,3) void lsyslog (int, const char *,...); /* gate + call lsyslog */ #define DO_SYSLOG(...) do { \ if (enable_syslog) lsyslog(__VA_ARGS__); \ } while (0) unsigned getspeed(speed_t code); const char * frameend_to_string(unsigned int type); const char * frametype_to_string(unsigned int type); #endif lrzsz-0.13.1/src/zreadline.c0000664000175000017500000000657515255263431011376 /* 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, 2026+ 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 #include #include /* Ward Christensen / CP/M parameters - Don't change these! */ #define TIMEOUT (-2) static size_t readline_readnum; static int readline_fd; static unsigned char *readline_buffer; int readline_left=0; unsigned char *readline_ptr; /* * This version of readline is reasonably well suited for * reading many characters. * * timeout is in tenths of seconds */ int readline_internal(unsigned int timeout) { fd_set fds; struct timeval tv; struct timeval *tvp; int rc; DPRINTF(DEBUG_READLINE, "Calling read: timeout=%u/10s readnum=%lu ", timeout, readline_readnum); if (no_timeout) { tvp = NULL; } else { tv.tv_sec = timeout / 10; tv.tv_usec = (long)(timeout % 10) * 100000L; tvp = &tv; } FD_ZERO(&fds); FD_SET(readline_fd, &fds); rc = select(readline_fd + 1, &fds, NULL, NULL, tvp); if (rc < 0) { if (errno == EINTR) return TIMEOUT; if (debugmode & DEBUG_READLINE) DPRINTF(DEBUG_READLINE, "select error: errno=%d:%s\n", errno, strerror(errno)); stats_net_error(); return ERROR; } if (rc == 0) return TIMEOUT; readline_ptr=readline_buffer; readline_left=read(readline_fd, readline_ptr, readline_readnum); stats_net_read(readline_left); if (debugmode & DEBUG_READLINE) { DPRINTF(DEBUG_READLINE, "Read returned %d bytes\n", readline_left); if (readline_left==-1) DPRINTF(DEBUG_READLINE, "errno=%d:%s\n", errno,strerror(errno)); if (readline_left>0) { int i,j; j=readline_left > 48 ? 48 : readline_left; vstring(" "); for (i=0;i readnum ? bufsize : readnum); if (!readline_buffer) fatal_error(1,0,_("out of memory")); } void readline_purge(void) { readline_left=0; } lrzsz-0.13.1/src/timing.h0000664000175000017500000000021415251332413010666 #ifndef LRZSZ_TIMING_H #define LRZSZ_TIMING_H void timing_reset(void); double timing_elapsed(void); long timing_bps(double bytes); #endif lrzsz-0.13.1/src/zperr.c0000664000175000017500000000275215255673662010567 /* 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 #include #include #include void zperr(const char *fmt, ...) { 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 zpfatal(const char *fmt, ...) { va_list ap; int err=errno; if (Verbose<=0) return; fprintf(stderr,"%s: ",lrzsz_progname); va_start(ap, fmt); vfprintf(stderr,fmt, ap); va_end(ap); fprintf(stderr,": %s\n",strerror(err)); } void vstringf(const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr,format, ap); va_end(ap); } lrzsz-0.13.1/src/lrz.c0000664000175000017500000021272715260420154010217 /* 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" #include #include #include #include #include #include #include #include #ifndef HAVE_GETOPT_LONG #define getopt_long(argc,argv,str,longopts,longind) getopt(argc,argv,str) #endif #include "timing.h" #ifndef HAVE_O_NOFOLLOW #define O_NOFOLLOW 0 #endif unsigned Baudrate = 2400; static FILE *fout; static int Lastrx; static int Crcflg; static int Firstsec; int errors; static int Restricted=1; /* restricted; no /.. or ../ in filenames */ static int skip_if_not_found; static unsigned int Segmentsize = 0; static char *Pathname; static int MakeLCPathname=true; /* make received pathname lower case */ int Verbose=0; static int Quiet=0; /* overrides logic that would otherwise set verbose */ static int Nflag = 0; /* Don't really transfer files */ static int Rxclob=false; /* Clobber existing file */ static int Rxbinary=false; /* receive all files in bin mode */ static int Rxascii=false; /* receive files in ascii (translate) mode */ static int Thisbinary; /* current file is to be received in bin mode */ static bool try_resume=false; static bool keep_incomplete=false; static bool junk_path=false; bool no_timeout=false; enum zm_type_enum protocol; bool under_rsh=false; bool zmodem_requested=false; static char *secbuf; #ifdef O_SYNC static int o_sync = 0; #endif static int rzfiles (struct zm_fileinfo *); static int tryz (void); static void checkpath (const char *name); static void report (int sct); static void uncaps (char *s); static int IsAnyLower (const char *s); static int putsec (struct zm_fileinfo *zi, char *buf, size_t n); enum safe_mkdir { MKDIR_NO, MKDIR_OK }; static FILE *safe_open (const char *path, const char *mode, enum safe_mkdir mkdir_ok); static int procheader (char *name, struct zm_fileinfo *); static int setup_output_buffer (struct zm_fileinfo *zi, FILE *fout); static int wcgetsec (size_t *Blklen, char *rxbuf, unsigned int maxtime); static int wcrx (struct zm_fileinfo *); static int wcrxpn (struct zm_fileinfo *, char *rpn); static int wcreceive (int argc, char **argp); static int rzfile (struct zm_fileinfo *); static void usage (int exitcode, const char *what); static int closeit (struct zm_fileinfo *); static void ackbibi (void); static void zmputs (const char *s); static mode_t lrz_umask = 0077; static long buffersize=32768; static unsigned long min_bps=0; static long min_bps_time=120; static char Lzmanag; /* Local file management request */ static char zconv; /* ZMODEM file conversion request */ static char zmanag; /* ZMODEM file management request */ static char ztrans; /* ZMODEM file transport request */ bool Zctlesc; /* Encode control characters */ unsigned int Zrwindow = 1400; /* RX window size (controls garbage count) */ static int tryzhdrtype=ZRINIT; /* Header type to send corresponding to Last rx close */ static time_t stop_time; int enable_syslog=true; /* DO_SYSLOG/DO_SYSLOG_FNAME are replaced by the shared variadic DO_SYSLOG * macro (zglobal.h) plus lrzsz_basename() (util.c) - same logged values, * no variable declarations or `zi` scope coupling inside a macro. */ /* Signal handler for SIGINT/SIGTERM/SIGPIPE. * This is not strictly async-signal safe, because of the tcsetattr and tcflush * calls in io_mode(), but these functions are, under linux at least, simple * syscall wrappers. * Leaving the terminal in raw mode would be worse. So we rely on undefined * behaviour here. Oh well. * _exit() skips atexit/stdio on purpose, exit() would risk stdio/malloc * re-entrancy from the handler. */ LRZSZ_NORETURN static void bibi_sighandler(int n) { int saved_errno = errno; if (zmodem_requested) zmputs(Attn); canit(STDOUT_FILENO); io_mode(0,0); errno = saved_errno; _exit(128+n); } /* called from normal control flow (checkpath, rbsb) to clean things up */ LRZSZ_NORETURN void bibi(int n) { /* The refusal (or session error) that leads here is fully * communicated: the cancel sequence was sent, the message printed. * The cancel burst inside this function is sent just in case; if the * sender already left because it saw the first burst and cancelled, * that write hits EPIPE and dying of SIGPIPE there would turn the * designed exit (127 for the refusals) into 141. Ignore SIGPIPE from * now on. write_all already ignores write errors, so the exit code * is deterministic. * Same behaviour and reason as ackbibi() below. */ signal(SIGPIPE, SIG_IGN); if (zmodem_requested) zmputs(Attn); canit(STDOUT_FILENO); io_mode(0,0); fatal_error(128+n,0,_("caught signal %d; exiting"), n); } /* the cancel-handler installer is shared: see lrzsz_install_signal() in * util.c; lrz installs its own bibi_sighandler with it. */ #ifdef HAVE_GETOPT_LONG static struct option const long_options[] = { {"append", no_argument, NULL, '+'}, {"ascii", no_argument, NULL, 'a'}, {"segmentsize", no_argument, NULL, 'A'}, {"binary", no_argument, NULL, 'b'}, {"bufsize", required_argument, NULL, 'B'}, {"allow-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, 'F'}, {"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'}, /* removed, kept for the error message */ {"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, 'g'}, {"zmodem", no_argument, NULL, 'Z'}, {"overwrite", no_argument, NULL, 'y'}, {"null", no_argument, NULL, 'D'}, {"version", no_argument, NULL, 'V'}, {"journal", required_argument, NULL, 'J'}, {"syslog", optional_argument, NULL , 2}, {"delay-startup", required_argument, NULL, 4}, {"o-sync", no_argument, NULL, 5}, {"o_sync", no_argument, NULL, 5}, {"keep-incomplete", no_argument, NULL, 6}, {"debug", required_argument, NULL, 7}, {NULL,0,NULL,0} }; #endif LRZSZ_NORETURN static void show_version(void) { printf ("%s (GNU %s) %s\n", lrzsz_progname, PACKAGE, VERSION); exit(0); } int main(int argc, char *argv[]) { char *cp; int npats; char **patts=NULL; /* keep compiler quiet */ int exitcode=0; int c; unsigned int startup_delay=0; const char *journal_filename; lrzsz_set_progname (argv[0], "lrz"); /* needed for the error handling => early */ Rxtimeout = 100; setbuf(stderr, NULL); if ((cp=getenv("SHELL")) && cp[0]) { const char *base = strrchr(cp, '/'); base = base ? base + 1 : cp; if (strcmp(base, "rsh") == 0 || strcmp(base, "rksh") == 0 || strcmp(base, "rbash") == 0 || strcmp(base, "rshell") == 0) under_rsh=true; } if ((getenv("ZMODEM_RESTRICTED"))!=NULL) Restricted=2; /* rights for temporary and unfinished files */ umask(lrz_umask); from_cu(); chkinvok(argv[0], 'r'); /* if called as [-]rzCOMMAND set flag */ journal_filename=getenv("LRZ_JOURNAL"); if (!journal_filename || !*journal_filename) { journal_filename=getenv("LRZSZ_JOURNAL"); } if (journal_filename && *journal_filename) { stats_journal_open(journal_filename); } openlog(lrzsz_progname,LOG_PID,SYSLOG_FACILITY); setlocale (LC_ALL, ""); setlocale (LC_TIME, "C"); /* do not translate just the timestamp of a syslog message. uh. */ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); while ((c = getopt_long (argc, argv, "A:a+bB:cCDeEgh7HJ:m:M:nNOprRqs:St:uUvVw:XZy", long_options, (int *) 0)) != EOF) { switch (c) { case 0: break; case '+': Lzmanag = ZF1_ZMAPND; break; case 'a': Rxascii=true; break; case 'A': Segmentsize = (unsigned int) lrzsz_strtoul( "-A / --segmentsize", optarg, NULL, 0, 65535); break; case 'b': Rxbinary=true; break; case 'B': if (strcmp(optarg,"auto")==0) fatal_error(1,0,_("the auto buffersize option has been removed; see the manual")); buffersize = lrzsz_strtoul( _("-B / --bufsize"), optarg, "km", 0, 0); break; case 'c': Crcflg=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 'J': stats_journal_open(optarg); break; case 'H': Lzmanag= ZF1_ZMCRC; break; case 'j': junk_path=true; break; case 'm': min_bps = lrzsz_strtoul( _("-m / --min-bps"), optarg, "km", 0, 0); break; case 'M': min_bps_time = lrzsz_strtoul( _("-M / --min-bps-time"), optarg, "k", 1, LONG_MAX); 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': stop_time = lrzsz_parse_stop_time(optarg, usage); break; case 'r': if (try_resume) Lzmanag= ZF1_ZMCRC; else try_resume=true; break; case 'R': if (Restricted < 2) Restricted=2; break; case 'C': case 'S': case 'U': fprintf(stderr, _("this option has been removed. See the manual page for more information.\n")); exit(1); case 't': Rxtimeout = (unsigned int) lrzsz_strtoul( "-t / --timeout", optarg, NULL, 10, 1000); break; case 'w': Zrwindow = (unsigned int) lrzsz_strtoul( "-w / --windowsize", optarg, NULL, 1, 8192); break; case 'u': MakeLCPathname=false; break; case 'v': ++Verbose; break; case 'V': show_version(); break; case 'X': protocol=ZM_XMODEM; break; case 'g': protocol=ZM_YMODEM; break; case 'Z': protocol=ZM_ZMODEM; break; case 'y': Rxclob=true; break; case 2: if (optarg && (!strcmp(optarg,"off") || !strcmp(optarg,"no"))) { if (under_rsh) lrzsz_warning(0, _("cannot turnoff syslog")); else enable_syslog=false; } else enable_syslog=true; break; case 4: startup_delay = (unsigned int) lrzsz_strtoul( "--delay-startup", optarg, NULL, 0, 0); break; case 5: #ifdef O_SYNC o_sync=1; #else lrzsz_warning(0, _("O_SYNC not supported by the kernel")); #endif break; case 6: keep_incomplete=true; break; case 7: if (!lrzsz_parse_debug(optarg)) usage(2, _("bad --debug argument")); break; default: usage(2,NULL); } } if (getuid()!=geteuid()) { fatal_error(1,0, _("this program was never intended to be used setuid\n")); } secbuf=xmalloc(1+LRZSZ_MAX_SUBPACKET_LEN); /* initialize zsendline tab */ zsendline_init(); 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 (Fromcu && !Quiet) { if (Verbose == 0) Verbose = 2; } DPRINTF(DEBUG_TRANSFER, "%s %s\n", lrzsz_progname, VERSION); { struct timespec start_timespec; int ret; ret=clock_gettime(CLOCK_MONOTONIC, &start_timespec); if (ret) { stat_for_all.start_time=0; } else { stat_for_all.start_time=start_timespec.tv_sec+((double)start_timespec.tv_nsec/1e9); } } stat_for_all.direction = 'r'; stat_for_file.direction = 'r'; if (io_mode(0,1)) lrzsz_warning(0, _("cannot set transfer line mode; continuing")); readline_setup(0, LRZSZ_MAX_SUBPACKET_LEN, LRZSZ_MAX_SUBPACKET_LEN*2); lrzsz_install_signal(SIGINT, bibi_sighandler); lrzsz_install_signal(SIGTERM, bibi_sighandler); lrzsz_install_signal(SIGPIPE, bibi_sighandler); if (wcreceive(npats, patts)==ERROR) { exitcode=0x80; 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); } stats_account_finalize_file(); stats_log(&stat_for_all,false); stats_journal_close(); exit(exitcode); } LRZSZ_NORETURN static void usage(int exitcode, const char *what) { FILE *f=stdout; if (exitcode) { if (what) fprintf(stderr, "%s: %s\n",lrzsz_progname,what); fprintf (stderr, _("Try `%s -h' for more information.\n"), lrzsz_progname); exit(exitcode); } fprintf(f, _("%s version %s\n"), lrzsz_progname, VERSION); fprintf(f,_("Usage: %s [options] [filename.if.xmodem]\n"), lrzsz_progname); 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" " -A, --segmentsize ask for an ACK every ... bytes\n" " -b, --binary binary transfer\n" " -B, --bufsize N buffer N bytes before writing to disk\n" " -c, --with-crc Use 16 bit CRC (X)\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" " -h, --help Help, print this usage message\n" " -H, --crc-check accept file if lengths and/or CRCs differ (Z)\n" " -J, --journal FILE append transfer statistics to FILE\n" " --keep-incomplete keep partially received files on error (default: delete)\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" " -n, --newer receive file if source newer (Z)\n" " -N, --newer-or-longer receive file if source newer or longer (Z)\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 was timesync */ " --syslog[=off] turn syslog on or off, if possible\n" " -t, --timeout N set timeout to N tenths of a second\n" " -u, --keep-uppercase keep upper case filenames\n" " -v, --verbose be verbose (twice: also show progress)\n" " --debug=MODULES comma separated list: protocol, readline,\n" " transfer, windowhandling, tty, all\n" " -V, --version show version\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" " -g, --ymodem use YMODEM protocol\n" " -Z, --zmodem use ZMODEM protocol\n" "\n" "short options use the same arguments as the long ones\n" ),f); #ifndef HAVE_GETOPT_LONG fputs(_("The long options (--...) are not available on your system (getopt_long is not available)\n"), f); #endif exit(exitcode); } /* * Let's receive something already. */ static int wcreceive(int argc, char **argp) { int c; struct zm_fileinfo zi; const char *shortname=NULL; zi_init(&zi); /* forward decl: fubar is reached before Pathname's declaration line * is ever executed (e.g. when the very first tryz() fails). */ Pathname=NULL; if (protocol!=ZM_XMODEM || argc==0) { Crcflg=1; if ( !Quiet) vstringf(_("%s waiting to receive."), lrzsz_progname); if ((c=tryz())!=0) { if (c == ZCOMPL) return OK; if (c == ERROR) goto fubar; c = rzfiles(&zi); shortname=NULL; if (c) goto fubar; } else { /* YMODEM path. */ for (;;) { if (Verbose > 1 || enable_syslog) timing_reset(); shortname=NULL; if (wcrxpn(&zi,secbuf)== ERROR) goto fubar; if (secbuf[0]==0) return OK; if (procheader(secbuf, &zi) == ERROR) goto fubar; stats_set_filename(zi.fname); shortname=strrchr(zi.fname,'/'); if (shortname) shortname++; else shortname=zi.fname; if (wcrx(&zi)==ERROR) goto fubar; report_transfer_result(0, shortname, zi.fname, (long) zi.bytes_received, (long) zi.bytes_total, (long) zi.bytes_skipped); /* stats_file_ok() already ran in wcrx(); don't count twice */ stats_account_one(); /* the file is complete; a later fubar must not delete it */ free(Pathname); Pathname=NULL; } } } else { char dummy[128] = ""; /* empty filename; procheader uses name + 1 + strlen(name) */ zi.bytes_total = DEFBYTL; if (Verbose > 1 || enable_syslog) timing_reset(); procheader(dummy, &zi); if (Pathname) free(Pathname); errno=0; /* argc may be 0 here (XMODEM with a bare -D; no filename on * the command line). *argp would be NULL - the transfer target * name is a mere placeholder in that case, and -D replaces it * with /dev/null right below anyway. */ Pathname=xstrdup(argc ? *argp : "stdin"); checkpath(Pathname); if (Nflag) { /* -D: write to /dev/null instead (as procheader() * does for ZMODEM/YMODEM) */ free(Pathname); Pathname=xstrdup("/dev/null"); } stats_set_filename(Pathname); shortname=strrchr(Pathname,'/'); if (shortname) shortname++; else shortname=Pathname; if (Verbose>1) { vchar('\n'); vstringf(_("%s: ready to receive %s"), lrzsz_progname, Pathname); vstring("\r\n"); } if ((fout=safe_open(Pathname, "w", MKDIR_NO)) == NULL) { DO_SYSLOG(LOG_ERR, "%s/%s: cannot open: %s", lrzsz_basename(shortname), protname(), strerror(errno)); return ERROR; } if (wcrx(&zi)==ERROR) { goto fubar; } /* stat_for_file.files_ok++; done by wcrx. */ stats_account_one(); report_transfer_result(0, shortname, zi.fname, (long) zi.bytes_received, (long) zi.bytes_total, (long) zi.bytes_skipped); /* the file is complete */ free(Pathname); Pathname=NULL; } return OK; fubar: DO_SYSLOG(LOG_ERR, "%s/%s: got error", lrzsz_basename(shortname), protname()); canit(STDOUT_FILENO); if (fout) { fclose(fout); fout = NULL; } if (Pathname && keep_incomplete) { /* the partial file is kept for later --resume; the message may * name a file never created (error before open) - harmless */ vstringf(_("\r\n%s: %s kept (incomplete).\r\n"), lrzsz_progname, Pathname); } else if (Pathname) { struct stat st; /* Never unlink anything but a regular file: -D sets the * pathname to /dev/null, and any similar special case added * later must not turn a failed transfer into the deletion of * a device, socket, or symlink. */ if (lstat(Pathname, &st) == 0 && S_ISREG(st.st_mode)) { unlink(Pathname); vstringf(_("\r\n%s: %s removed.\r\n"), lrzsz_progname, Pathname); } } stats_file_error(); stats_account_one(); return ERROR; } /* * this receives the YMODEM header. * * 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) { int c; size_t Blklen=0; /* record length of received packets */ READLINE_PF(1); for (;;) { bool got_wceot; Firstsec=true; zi->eof_seen=false; sendline(Crcflg?WANTCRC:NAK); flushmo(); purgeline(0); /* Do read next time ... */ got_wceot = false; while ((c = wcgetsec(&Blklen, rpn, 100)) != 0) { if (c != WCEOT) return ERROR; zperr( _("Pathname fetch returned EOT")); stats_msg_out_of_sync(); sendline(ACK); flushmo(); purgeline(0); /* Do read next time ... */ READLINE_PF(1); got_wceot = true; break; } if (got_wceot) continue; /* retry the pathname fetch */ sendline(ACK); flushmo(); return OK; } } /* * this is the XMODEM receiver. * this is the YMODEM body receiver. * * Historical note: * Adapted from CMODEM13.C, written by * Jack M. Wierda and Roderick W. Hart */ static int wcrx(struct zm_fileinfo *zi) { int sectnum, sectcurr; 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&0x7f) ? 50 : 130)); if (sectcurr==((sectnum+1) &0xff)) { sectnum++; /* report the real section/block number, not sectcurr * this is (a) more correct, and * (b) avoid overwriting 255 with 0 to create 055… */ report(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&0xff)) { zperr( _("Received dup Sector")); sendchar=ACK; stats_msg_out_of_sync(); } else if (sectcurr==WCEOT) { if (closeit(zi)) { stats_file_local_error(); return ERROR; } stats_file_ok(); sendline(ACK); flushmo(); purgeline(0); /* Do read next time ... */ return OK; } else if (sectcurr==ERROR) /* wcgetsec accounted for stats. */ return ERROR; else { zperr( _("Sync Error")); stats_msg_out_of_sync(); 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) { int checksum, wcj, firstch, c; char *p; int sectcurr; for (Lastrx=errors=0; errors=0; ) { if ((firstch=READLINE_PF(1)) < 0) { timed_out = true; break; } oldcrc=updcrc(firstch, oldcrc); checksum += (*p++ = firstch); } if (!timed_out) { if ((firstch=READLINE_PF(1)) < 0) timed_out = true; else if (Crcflg) { oldcrc=updcrc(firstch, oldcrc); stats_msg_bytes(*Blklen); if ((firstch=READLINE_PF(1)) < 0) timed_out = true; else { oldcrc=updcrc(firstch, oldcrc); if (oldcrc != 0) { stats_msg_invalid(); zperr( _("CRC")); } else { Firstsec=false; stats_msg_valid(0); return sectcurr; } } } else { stats_msg_bytes(*Blklen); if (((checksum-firstch)&0xff)==0) { Firstsec=false; stats_msg_valid(0); return sectcurr; } else { stats_msg_invalid(); zperr( _("Checksum")); } } } } else { stats_msg_format_error(); zperr(_("Sector number garbled")); } } /* make sure eot really is eot and not just mixmash */ else if (firstch==EOT && ((c = READLINE_PF(1)) == TIMEOUT || c == RCDO)) return WCEOT; else if (firstch==CAN) { if (Lastrx==CAN) { zperr( _("Sender Cancelled")); stats_cancel(); return ERROR; } else { Lastrx=CAN; continue; } } else if (firstch==TIMEOUT) { if (!Firstsec) timed_out = true; /* a timeout in the first sector is not counted */ } else if (firstch==RCDO) { /* the line died (peer closed, carrier lost): do not burn the * retry budget NAKing into the void */ zperr( _("Line dropped")); return ERROR; } else { zperr( _("Got 0x%x sector header"), (unsigned int) firstch); } if (timed_out) { stats_timeout(); zperr( _("TIMEOUT")); } Lastrx=0; { int cnt=1000; int dc; /* drain garbage, but give up immediately if the line is gone */ while(cnt-- && (dc=READLINE_PF(1))!=TIMEOUT && dc!=ERROR && dc!=RCDO) ; } 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); stats_too_many_errors(); 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)) { stats_file_local_error(); 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 */ fseeko(f, 0, 0); while (t1<3) { stohdr(check_bytes); zshhdr(ZCRC, Txhdr); t2=0; while(t2<3) { size_t tmp; c = zgethdr(Rxhdr, 0, &tmp); rcrc=(unsigned long) tmp; switch (c) { case TIMEOUT: stats_timeout(); break; case ERROR: default: /* ignore */ break; case ZFIN: stats_msg_out_of_sync(); return ERROR; case ZRINIT: stats_msg_out_of_sync(); return ERROR; case ZCAN: if (Verbose) vstringf(_("got ZCAN")); stats_cancel(); return ERROR; break; case ZCRC: if (crc!=rcrc) return ZCRC_DIFFERS; return ZCRC_EQUAL; break; } t2++; } t1++; } stats_too_many_errors(); return ERROR; } /* * Open a file w/o following symlinks, resolving relative to the CWD. * - O_NOFOLLOW prevents the final path component from being a symlink; * - every intermediate directory component is opened with O_DIRECTORY|O_NOFOLLOW, * so a symlinked directory component fails instead of being followed * - with mkdir_ok, missing intermediate directories are created via mkdirat(). * Maps fopen-style mode strings to open() flags. * This is complicated, but race free. * * @return FILE *|NULL */ /* * Map fopen-style mode strings to open() flags. */ static int fopen_mode_to_flags(const char *mode) { int flags = 0; const char *p; for (p = mode; *p; p++) { switch (*p) { case 'r': flags |= O_RDONLY; break; case 'w': flags |= O_WRONLY | O_CREAT | O_TRUNC; break; case 'a': flags |= O_WRONLY | O_CREAT | O_APPEND; break; case '+': flags &= ~(O_RDONLY | O_WRONLY); flags |= O_RDWR; break; default: break; } } return flags; } /* * Open path (relative to the CWD) without following symlinks. * Walks intermediate components with openat(); the final component * is opened with extra_flags ored in (caller supplies O_CREAT etc.). * Returns an fd, or -1 with errno set. * - O_NOFOLLOW prevents the final path component from being a symlink; * - every intermediate directory component is opened with O_DIRECTORY|O_NOFOLLOW, * so a symlinked directory component fails instead of being followed * - with mkdir_ok, missing intermediate directories are created via mkdirat(). * This is complicated, but race free. * * @return fd, -1 on error */ static int safe_open_fd(const char *path, int open_flags, enum safe_mkdir mkdir_ok) { int dirfd; int fd; int saved_errno; open_flags |= O_NOFOLLOW; if (path[0] == '/') { /* -D: /dev/null is the one absolute path we deliberately open * (a device node; open_flags already carry O_NOFOLLOW). Anything * else absolute is rejected by checkpath(). */ if (0 == strcmp(path, "/dev/null")) return open(path, open_flags, 0666); errno = EACCES; return -1; } dirfd = open(".", O_RDONLY | O_DIRECTORY | O_NOFOLLOW); if (dirfd < 0) return -1; { /* walk intermediate components with openat(), creating them if asked */ char *tmp = xstrdup(path); char *start = tmp; char *end = tmp + strlen(tmp); char *slash; const char *last; while ((slash = memchr(start, '/', (size_t) (end - start))) != NULL) { if (slash == start) { /* leading or doubled '/' */ start = slash + 1; continue; } *slash = '\0'; fd = openat(dirfd, start, O_RDONLY | O_DIRECTORY | O_NOFOLLOW); if (fd < 0 && errno == ENOENT && mkdir_ok == MKDIR_OK) { if (mkdirat(dirfd, start, 0700) == 0 || errno == EEXIST) fd = openat(dirfd, start, O_RDONLY | O_DIRECTORY | O_NOFOLLOW); } if (fd < 0) { close(dirfd); free(tmp); return -1; /* ELOOP: symlinked component; ENOENT; ... */ } close(dirfd); dirfd = fd; start = slash + 1; } last = start; /* final component, relative to dirfd */ if (*last == '\0') { /* path ended in '/', e.g. "sub/" */ close(dirfd); free(tmp); errno = EISDIR; return -1; } if (last[0] == '.' && (last[1] == '\0' || (last[1] == '.' && last[2] == '\0'))) { close(dirfd); free(tmp); errno = EACCES; return -1; } fd = openat(dirfd, last, open_flags, 0666); saved_errno = errno; close(dirfd); free(tmp); errno = saved_errno; return fd; } } static FILE * safe_open(const char *path, const char *mode, enum safe_mkdir mkdir_ok) { int fd; FILE *fp; fd = safe_open_fd(path, fopen_mode_to_flags(mode), mkdir_ok); if (fd < 0) return NULL; fp = fdopen(fd, mode); if (!fp) close(fd); return fp; } /* * Atomically claim a free "name.N" (N = 0..999) for ZMCHNG rename, * creating it with O_CREAT|O_EXCL (race free: no stat-then-use). * Returns a FILE* open for writing, and the claimed name in *claimed * (xmalloc'ed). On failure returns NULL: errno==EEXIST means all 1000 * names are taken (policy reject), anything else is a local error. */ static FILE * claim_rename_target(const char *name, char **claimed) { size_t newnamelen = strlen(name) + 5; char *tmpname = xmalloc(newnamelen); int i; int fd = -1; FILE *fp; for (i = 0; i < 1000; i++) { snprintf(tmpname, newnamelen, "%s.%d", name, i); fd = safe_open_fd(tmpname, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW, MKDIR_NO); if (fd >= 0) break; if (errno != EEXIST) break; /* EACCES, ELOOP (symlink game), ...: give up */ /* name.N taken, try the next suffix */ } if (i == 1000) { errno = EEXIST; /* exhausted all suffixes */ free(tmpname); return NULL; } if (fd < 0) { /* non-EEXIST error, errno preserved */ free(tmpname); return NULL; } fp = fdopen(fd, "w"); if (!fp) { int saved_errno = errno; close(fd); unlink(tmpname); errno = saved_errno; free(tmpname); return NULL; } *claimed = tmpname; return fp; } /* * Process incoming file information header * returns OK or ERROR. */ static int procheader(char *name, struct zm_fileinfo *zi) { const char *openmode; char *p; static char *name_static=NULL; char *nameend; stats_start_one(); 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); stats_file_policy_reject(); return ERROR; } name=p; } } name_static=xstrdup(name); zi->fname=name_static; DPRINTF(DEBUG_TRANSFER, "zmanag=%d, Lzmanag=%d\n", zmanag, Lzmanag); DPRINTF(DEBUG_TRANSFER, "zconv=%d\n", zconv); /* set default parameters and overrides */ openmode = "w"; Thisbinary = (!Rxascii) || Rxbinary; if (Lzmanag) zmanag = Lzmanag; /* * Process ZMODEM remote file management requests */ /* NOTE: zconv == ZCNL (2) is honored below for compatibility with * 40 year old peers, although the current ZMODEM documentation says * a receiver MUST assume ZCBIN for anything but ZCBIN/ZCRESUM. * See man page -a/--ascii: deprecated. */ 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+"; 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 */ unsigned long modtime = 0; long bytes_total = 0; unsigned long mode = 0; if (sscanf(nameend, "%ld%lo%lo", &bytes_total, &modtime, &mode) >= 1) { zi->modtime = (time_t) modtime; zi->bytes_total = (size_t) bytes_total; zi->mode = (mode_t) mode; /* NOTE: acting on the historical full-st_mode marker below is * a SHOULD NOT per doc/zmodem-wip.txt §4 ("file access * rights"), kept for compatibility with old peers. See also * the mode checks in closeit()/S1. */ if (zi->mode & S_IFMT) ++Thisbinary; } } /* Security: validate the sender-chosen name BEFORE any open of it. * safe_open_fd() deliberately allows interior ".." components, so a * pre-check open or the -H CRC probe below would otherwise probe and * read files outside the receive directory, leaking existence and * (via do_crc_check) content fingerprints to the peer. checkpath() * must run first. No-op for the empty XMODEM placeholder name. */ if (*name_static) checkpath(name_static); /* Check for existing file */ if (zconv != ZCRESUM && !Rxclob && (zmanag&ZF1_ZMMASK) != ZF1_ZMCLOB && (zmanag&ZF1_ZMMASK) != ZF1_ZMAPND && (fout=safe_open(name, "r", MKDIR_NO))) { struct stat sta; char *tmpname; if (zmanag == ZF1_ZMNEW || zmanag==ZF1_ZMNEWL) { if (-1==fstat(fileno(fout),&sta)) { int e=errno; if (Verbose) vstringf(_("file exists, skipped: %s\n"),name); DO_SYSLOG(LOG_ERR,"cannot fstat open file %s: %s", name,strerror(e)); stats_file_local_error(); fclose(fout); fout = NULL; return ERROR; } if (zmanag == ZF1_ZMNEW) { if (sta.st_mtime > zi->modtime) { DO_SYSLOG(LOG_INFO,"skipping %s: newer file exists", name); fclose(fout); fout = NULL; stats_file_skipped(); 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); fclose(fout); fout = NULL; stats_file_skipped(); return ERROR; /* skips file */ } } fclose(fout); fout = NULL; } else if (zmanag==ZF1_ZMCRC) { int r=do_crc_check(fout,zi->bytes_total,0); if (r==ERROR) { fclose(fout); fout = NULL; return ERROR; } if (r!=ZCRC_DIFFERS) { fclose(fout); fout = NULL; stats_file_skipped(); return ERROR; /* skips */ } fclose(fout); fout = NULL; } else { fclose(fout); fout = NULL; if ((zmanag & ZF1_ZMMASK)!=ZF1_ZMCHNG) { stats_file_skipped(); if (Verbose) vstringf(_("file exists, skipped: %s\n"),name); return ERROR; } /* try to rename: atomically claim "name.N" via O_CREAT|O_EXCL * (no stat-then-use race), keeping the claimed file open */ fout = claim_rename_target(name, &tmpname); if (!fout) { if (errno == EEXIST) { /* all 1000 names taken */ stats_file_policy_reject(); } else { stats_file_local_error(); if (Verbose) vstringf(_("cannot claim %s.N: %s\n"),name,strerror(errno)); } return ERROR; } free(name_static); name_static=tmpname; zi->fname=name_static; } } /* if a rename target was claimed, the final name is already fixed; * don't run the CP/M and lower-case transformations on it */ if (!fout) { if (!*nameend) { /* File coming from CP/M system */ for (p=name_static; *p; ++p) /* change / to _ */ if ( *p == '/') *p = '_'; if (p > name_static && *--p == '.') /* zap trailing period */ *p = 0; } /* NOTE: the S_IFMT check is the same legacy marker as above (V4): * a full st_mode from an old sender means "Unix peer, keep case". * Deprecated per doc/zmodem-wip.txt §4, kept for old peers. */ if (!zmodem_requested && MakeLCPathname && !IsAnyLower(name_static) && !(zi->mode&S_IFMT)) uncaps(name_static); } /* the received name is about to be replaced (or discarded for the * XMODEM dummy case); Pathname must not point at the previous file * from here on - a fubar between here and the new assignment below * would otherwise act on that older file's path. */ free(Pathname); Pathname=NULL; if (protocol==ZM_XMODEM) /* we don't have the filename yet */ return OK; /* dummy */ Pathname=xstrdup(name_static); if (Verbose) { /* overwrite the "waiting to receive" line */ vstring("\r \r"); vstringf(_("Receiving: %s\n"), name_static); } /* checkpath() already ran before any open (see above). */ if (Nflag) { /* write to /dev/null instead; if a rename target was claimed * already, discard it */ if (fout) { fclose(fout); fout=NULL; } free(name_static); name_static=xstrdup("/dev/null"); zi->fname=name_static; /* was left dangling at the freed name */ } if (!fout && Thisbinary && zconv==ZCRESUM) { struct stat st; fout = safe_open(name_static, "r+", MKDIR_NO); 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); fout=NULL; return ERROR; } 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 (fseeko(fout, (off_t) zi->bytes_skipped, SEEK_SET)) { stats_file_local_error(); fclose(fout); fout=NULL; return ERROR; } /* resume from the recorded offset; must not * run the bytes_skipped=0 reset below */ return setup_output_buffer(zi, fout); } else { /* resume impossible, file has changed: * fall through to the normal open below, which * truncates (openmode "w" -> O_TRUNC). * Overwriting the "r+" handle without * truncation would leave a stale tail of * the old file if the new one is shorter. */ fclose(fout); fout=NULL; } } zi->bytes_skipped=0; if (fout) { fclose(fout); fout=NULL; } } /* fout can already be open here: claim_rename_target() claimed * and created "name.N" atomically; reuse that file. */ #ifdef ENABLE_MKDIR if (!fout && Restricted < 2) fout = safe_open(name_static, openmode, MKDIR_OK); else #endif if (!fout) fout = safe_open(name_static, openmode, MKDIR_NO); if ( !fout) { int e=errno; stats_file_local_error(); zpfatal(_("cannot open %s"), name_static); DO_SYSLOG(LOG_ERR,"%s: cannot open: %s", protname(),strerror(e)); return ERROR; } return setup_output_buffer(zi, fout); } /* Apply o_sync and the (once-allocated) large stdio buffer to the output * file, and record the receive start offset. Called from both the normal * open path and the ZCRESUM resume path of procheader(); the statics * deliberately persist across files. The global fout is passed explicitly * (the new stream, already assigned) to keep this helper self-contained. */ static int setup_output_buffer(struct zm_fileinfo *zi, FILE *fp) { static char *s=NULL; static size_t last_length=0; #ifdef O_SYNC if (o_sync) { int oldflags; oldflags = fcntl (fileno(fp), F_GETFL, 0); if (oldflags>=0 && !(oldflags & O_SYNC)) { oldflags|=O_SYNC; fcntl (fileno(fp), F_SETFL, oldflags); /* errors don't matter */ } } #endif if (!s && buffersize) { last_length=buffersize; /* buffer `4096' bytes pages */ last_length=(last_length+4095)&0xfffff000; s=xmalloc(last_length); } if (s) { setvbuf(fp,s,_IOFBF,last_length); } zi->bytes_received=zi->bytes_skipped; return OK; } /* * 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) { 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((unsigned char)(*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'); } } /* chkinvok() lives in util.c (shared with lsz); called with 'r' here. */ static void checkpath(const char *name) { if (!Restricted) return; /* don't overwrite any file in very restricted mode. * don't overwrite hidden files in restricted mode */ { FILE *noleak = NULL; const char *bn; bn = strrchr(name, '/'); bn = bn ? bn + 1 : name; if ((Restricted == 2 || *bn == '.') && (noleak = safe_open(name, "r", MKDIR_NO)) != NULL) { fclose(noleak); canit(STDOUT_FILENO); vstring("\r\n"); vstringf(_("%s: %s exists\n"), lrzsz_progname, name); bibi(-1); } } if (lrzsz_path_component_violation(name, Restricted)) goto violation; return; violation: canit(STDOUT_FILENO); vstring("\r\n"); vstringf(_("%s:\tSecurity Violation"), lrzsz_progname); 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) { int c, n; 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 and capability flags */ stohdr(0L); if (tryzhdrtype==ZRINIT) { /* special short number */ Txhdr[ZP0] = Segmentsize & 0xff; Txhdr[ZP1] = (Segmentsize / 256) & 0xff; } /* advertise CANBRK only if the transfer line is a terminal: * a break is a termios concept, unavailable on pipes/sockets * (doc/zmodem-wip.txt §10.6: "if you have tcsendbreak and * send via a terminal, set this") */ if (isatty(0)) Txhdr[ZF0] = CANFC32|CANFDX|CANOVIO|CANBRK; else Txhdr[ZF0] = CANFC32|CANFDX|CANOVIO; 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 the sender has started before us * and sent ZRQINITs while waiting. */ zrqinits_received++; continue; case ZEOF: /* A ZEOF between files can only be a duplicate of the * just-completed file: the sender never saw our ZRINIT. * Answer at once instead of silently waiting for the * next header, so a sender stuck in a retransmit loop * (e.g. zmtx 1.02, which retransmits without pacing * while its input buffer holds queued frames) gets out * of its ZEOF wait one round earlier. */ zshhdr(ZRINIT, Txhdr); continue; case TIMEOUT: continue; case RCDO: /* the line is gone (peer closed, carrier lost). * Retrying into the void would burn the whole * n-budget and then return 0, which sends the caller * down the YMODEM path against a dead line. Also: * re-handshaking after a reconnect would be wrong - * the calling program (bbs, cu, ...) may have * authenticated the original peer, and whoever is on * the reconnected line may be someone different. */ DO_SYSLOG(LOG_INFO, "%s: RCDO during ZMODEM handshake", protname()); return ERROR; 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, LRZSZ_MAX_SUBPACKET_LEN, &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]; /* rebuild the send table on any flag change - lrz * sends headers/ACKs through zsendline, and a * stale table would send the bytes wrong. This * also fixes the long-standing staleness for * late-arriving ESCCTL (the table was only * initialized once at startup). */ zsendline_init(); if (zrdata(Attn, ZATTNLEN,&bytes_in_block) == GOTCRCW) { stohdr(0L); /* ZACK to a ZSINIT must carry 0 (see zmodem-wip.txt §4) */ zshhdr(ZACK, Txhdr); goto again; } zshhdr(ZNAK, Txhdr); goto again; case ZFREECNT: stohdr(0); zshhdr(ZACK, Txhdr); goto again; case ZCOMMAND: if (zrdata(secbuf, LRZSZ_MAX_SUBPACKET_LEN, &bytes_in_block) == GOTCRCW) { if (Verbose) { vstringf("%s: %s\n", lrzsz_progname, _("remote command execution denied")); vstringf("%s: %s\n", lrzsz_progname, secbuf); } stohdr(1L); /* be nice and tell the other side that the execution failed. */ zshhdr(ZCOMPL, Txhdr); DO_SYSLOG(LOG_INFO,"rexec denied: %s",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) { int c; for (;;) { timing_reset(); c = rzfile(zi); switch (c) { case ZEOF: report_transfer_result(0, NULL, zi->fname, (long) zi->bytes_received, (long) zi->bytes_total, (long) zi->bytes_skipped); stats_file_ok(); stats_account_one(); /* the file is complete; a later fubar must not delete it */ free(Pathname); Pathname=NULL; break; case ZSKIP: stats_file_skipped(); stats_account_one(); if (Verbose) vstringf(_("Skipped")); DO_SYSLOG(LOG_INFO, "%s/%s: skipped",lrzsz_basename(zi->fname),protname()); /* the file was skipped, not written; a later fubar must * not delete a pre-existing file */ free(Pathname); Pathname=NULL; break; default: case ERROR: stats_file_error(); stats_account_one(); DO_SYSLOG(LOG_INFO, "%s/%s: error",lrzsz_basename(zi->fname),protname()); return ERROR; } switch (tryz()) { case ZCOMPL: return OK; default: return ERROR; case ZFILE: break; } } } /* * Receive a file with ZMODEM protocol * Assumes file name frame is in secbuf * returns: ERROR ZSIKP ZEOF * * The control flow is an explicit three-state machine: * ST_ZRPOS - send ZRPOS (on entry and after every retry) * ST_HDR - wait for a header (former nxthdr label) * ST_DATA - receive data subpackets (former moredata label) */ enum rzfile_state { ST_ZRPOS, ST_HDR, ST_DATA }; static int rzfile(struct zm_fileinfo *zi) { int c, n; long last_rxbytes=0; unsigned long last_bps=0; long not_printed=0; double low_bps=0; size_t bytes_in_block=0; int state = ST_ZRPOS; unsigned int saved_rxtimeout = Rxtimeout; int pos_waits = 0; time_t now; zi->eof_seen=false; n = 20; if (procheader(secbuf,zi) == ERROR) { DO_SYSLOG(LOG_INFO, "%s/%s: procheader error", lrzsz_basename(zi->fname),protname()); return (tryzhdrtype = ZSKIP); } stats_set_filename(zi->fname); for (;;) { switch (state) { case ST_ZRPOS: stohdr(zi->bytes_received); zshhdr(ZRPOS, Txhdr); /* The ZDATA answering the ZRPOS is either already in * flight or was lost on the line. Waiting the full * Rxtimeout (by default 100 tenths of a second) for * a lost frame costs 10s per resync, during which the * the sender may wait. Therefore we shorten the first * few waits after a ZRPOS, with a fallback to the * full timeout for slow peers. pos_waits counts * consecutive short waits. */ pos_waits = 0; Rxtimeout = 10; /* fall through */ case ST_HDR: c = zgethdr(Rxhdr, 0, NULL); if (pos_waits < 4) pos_waits++; else Rxtimeout = saved_rxtimeout; switch (c) { default: Rxtimeout = saved_rxtimeout; DO_SYSLOG(LOG_INFO, "%s/%s: error: zgethdr returned %d", lrzsz_basename(zi->fname), protname(), c); DPRINTF(DEBUG_TRANSFER, "rzfile: zgethdr returned %d\n", c); return ERROR; case ZNAK: case TIMEOUT: if ( --n < 0) { Rxtimeout = saved_rxtimeout; DO_SYSLOG(LOG_INFO, "%s/%s: error: zgethdr returned %s", lrzsz_basename(zi->fname), protname(), c == ZNAK ? "ZNAK" : "TIMEOUT"); DPRINTF(DEBUG_TRANSFER, "rzfile: zgethdr returned %d\n", c); return ERROR; } /* traditionally we fell through to the ZFILE block and did an ZRDATA, * but that is wrong. */ state = ST_ZRPOS; continue; case ZFILE: Rxtimeout = saved_rxtimeout; zrdata(secbuf, LRZSZ_MAX_SUBPACKET_LEN, &bytes_in_block); state = ST_ZRPOS; continue; case ZEOF: Rxtimeout = saved_rxtimeout; if (rclhdr(Rxhdr) != (unsigned 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; state = ST_HDR; continue; } if (closeit(zi)) { tryzhdrtype = ZFERR; DO_SYSLOG(LOG_INFO, "%s/%s: error: closeit return <>0", lrzsz_basename(zi->fname), protname()); DPRINTF(DEBUG_TRANSFER, "rzfile: closeit returned <> 0\n"); return ERROR; } DPRINTF(DEBUG_TRANSFER, "rzfile: normal EOF\n"); return c; case ERROR: /* Too much garbage in header search error */ Rxtimeout = saved_rxtimeout; if ( --n < 0) { DO_SYSLOG(LOG_INFO, "%s/%s: error: zgethdr returned %d", lrzsz_basename(zi->fname), protname(), c); DPRINTF(DEBUG_TRANSFER, "rzfile: zgethdr returned %d\n", c); return ERROR; } zmputs(Attn); state = ST_ZRPOS; continue; case ZSKIP: Rxtimeout = saved_rxtimeout; closeit(zi); DO_SYSLOG(LOG_INFO, "%s/%s: error: sender skipped", lrzsz_basename(zi->fname), protname()); DPRINTF(DEBUG_TRANSFER, "rzfile: Sender SKIPPED file\n"); return c; case ZDATA: Rxtimeout = saved_rxtimeout; if (rclhdr(Rxhdr) != (unsigned long) zi->bytes_received) { if ( --n < 0) { DPRINTF(DEBUG_TRANSFER, "rzfile: out of sync\n"); DO_SYSLOG(LOG_INFO, "%s/%s: error: out of sync", lrzsz_basename(zi->fname), protname()); return ERROR; } /* this is a data block with subframes. if the sender streams * fast, this is a mass of data, which can easily overflow * the garbage max or the cancel max. * so we read and forget it. * But this *may* be a stale ZDATA (with a position behind * what we already have, an answer to a duplicate ZRPOS). * Reading it with the full Rxtimeout stalls the resync for * 10 seconds while the sender is waiting for us. * It may even be a series of subpackets missing a final * ZCRCx (garbled or dropped on the line). * We shorten our wait drastically here. * 0.1s per read still drains what is already in * flight, and the ZRPOS below goes out right away. */ Rxtimeout = 1; zrdata(secbuf, LRZSZ_MAX_SUBPACKET_LEN, &bytes_in_block); Rxtimeout = saved_rxtimeout; zmputs(Attn); state = ST_ZRPOS; continue; } state = ST_DATA; continue; } continue; case ST_DATA: now=time(NULL); /* wall clock: -s stop deadline */ if (stop_time) { if (lrzsz_stop_time_reached("rzfile", now, stop_time, zi->fname)) return ERROR; } if (Verbose>1 || min_bps) { int minleft = 0; int secleft = 0; double d; d=timing_elapsed(); if (d==0) d=0.5; /* first call: zero elapsed */ last_bps=(unsigned long) (zi->bytes_received/d); if (min_bps) { if (lrzsz_bps_watchdog("rzfile", (long) last_bps, d, min_bps, min_bps_time, &low_bps, zi->fname)) return ERROR; } if (Verbose > 1) { if (not_printed > (min_bps ? 3 : 7) || zi->bytes_received > last_bps / 2 + last_rxbytes) { lrzsz_eta(last_bps, (size_t) R_BYTESLEFT(zi), &minleft, &secleft); vstringf(_("\rBytes received: %7ld/%7ld BPS:%-6lu ETA %02d:%02d "), (long) zi->bytes_received, (long) zi->bytes_total, last_bps, minleft, secleft); last_rxbytes=zi->bytes_received; not_printed=0; } else { not_printed++; } } } switch (c = zrdata(secbuf, LRZSZ_MAX_SUBPACKET_LEN, &bytes_in_block)) { case ZCAN: DPRINTF(DEBUG_TRANSFER, "rzfile: zrdata returned %d\n", c); DO_SYSLOG(LOG_INFO, "%s/%s: zrdata returned ZCAN", lrzsz_basename(zi->fname), protname()); return ERROR; case ERROR: /* CRC error */ if ( --n < 0) { DPRINTF(DEBUG_TRANSFER, "rzfile: zgethdr returned %d\n", c); DO_SYSLOG(LOG_INFO, "%s/%s: zrdata returned ERROR", lrzsz_basename(zi->fname), protname()); return ERROR; } zmputs(Attn); state = ST_ZRPOS; continue; case TIMEOUT: if ( --n < 0) { DO_SYSLOG(LOG_INFO, "%s/%s: zrdata returned TIMEOUT", lrzsz_basename(zi->fname), protname()); DPRINTF(DEBUG_TRANSFER, "rzfile: zgethdr returned %d\n", c); return ERROR; } state = ST_ZRPOS; continue; case RCDO: /* the line died mid-file: no ZRPOS retry into * the void (see tryz() for why no reconnect * handshake either) */ DO_SYSLOG(LOG_INFO, "%s/%s: zrdata returned RCDO", lrzsz_basename(zi->fname), protname()); return ERROR; case GOTCRCW: n = 20; putsec(zi, secbuf, bytes_in_block); zi->bytes_received += bytes_in_block; DPRINTF(DEBUG_TRANSFER, "GOTCRCW: bytes_received=%ld, block=%zu, readline_left=%d\n", (long)zi->bytes_received, bytes_in_block, readline_left); stohdr(zi->bytes_received); zshhdr(ZACK, Txhdr); state = ST_HDR; continue; case GOTCRCQ: n = 20; putsec(zi, secbuf, bytes_in_block); zi->bytes_received += bytes_in_block; DPRINTF(DEBUG_TRANSFER, "GOTCRCQ: bytes_received=%ld, block=%zu, readline_left=%d\n", (long)zi->bytes_received, bytes_in_block, readline_left); stohdr(zi->bytes_received); zshhdr(ZACK, Txhdr); state = ST_DATA; continue; case GOTCRCG: n = 20; putsec(zi, secbuf, bytes_in_block); zi->bytes_received += bytes_in_block; state = ST_DATA; continue; case GOTCRCE: n = 20; putsec(zi, secbuf, bytes_in_block); zi->bytes_received += bytes_in_block; DPRINTF(DEBUG_TRANSFER, "GOTCRCE: bytes_received=%ld, block=%zu, readline_left=%d\n", (long)zi->bytes_received, bytes_in_block, readline_left); state = ST_HDR; continue; default: ; /* zrdata's remaining returns are handled above (GOT*, ERROR, TIMEOUT, RCDO, ZCAN) - anything else mirrors the original's fall out of the loop body: re-send ZRPOS */ state = ST_ZRPOS; continue; } continue; default: /* unreachable: state always holds one of the three enum * values; maps to the loop head like any retry */ state = ST_ZRPOS; continue; } } } /* * 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) { ssize_t off=0; size_t len=strlen(s); while ((size_t)off < len) { ssize_t n=write(1,s+off,len-off); if (n < 0) { if (errno == EINTR) continue; return; } off += n; } return; } if (p!=s) { ssize_t off=0; size_t len=(size_t) (p-s); while ((size_t)off < len) { ssize_t n=write(1,s+off,len-off); if (n < 0) { if (errno == EINTR) continue; return; } off += n; } 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; ret=fclose(fout); fout = NULL; if (ret) { zpfatal(_("file close error")); /* this may be any sort of error, including random data corruption */ if (!keep_incomplete) unlink(Pathname); return ERROR; } if (zi->modtime) { struct utimbuf timep; timep.actime = time(NULL); timep.modtime = zi->modtime; utime(Pathname, &timep); } if (S_ISREG(zi->mode)) { /* we must not make this program executable if running * under rsh, because the user might have uploaded an * unrestricted shell. */ /* sanity check: a sender-chosen mode without owner read/ * write (e.g. 0100006 = S_IFREG|0006) would leave the owner * locked out of their own uploaded file once the umask is * applied. Owner rw is therefore granted unconditionally; * the sender keeps influence over exec and group/other bits. */ if (under_rsh) chmod(Pathname, ((0666 & zi->mode) | 0600) & ~lrz_umask); else chmod(Pathname, ((0777 & zi->mode) | 0600) & ~lrz_umask); } return OK; } /* * Ack a ZFIN packet, let byegones be byegones */ static void ackbibi(void) { int n; struct sigaction sa; DPRINTF(DEBUG_TRANSFER, "ackbibi:"); /* Now the session is complete, every file has been received and * this ZFIN exchange is only the sender's farewell. * If the line destroys our ZFIN or the sender's "OO", we retransmit * - and if the sender already left (its OO was lost, it exited * after writing it), out retransmit would fail with EPIPE. Dying of * SIGPIPE there would turn the clean end into exit 141 even * though nothing was lost. The retransmit loop below handles * the silence (RCDO/TIMEOUT) and just gives up. So ignore * SIGPIPE for the remainder of the session. */ memset(&sa, 0, sizeof sa); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, &sa, NULL); stohdr(0L); for (n=3; --n>=0; ) { purgeline(0); zshhdr(ZFIN, Txhdr); switch (READLINE_PF(100)) { case 'O': READLINE_PF(1); /* Discard 2nd 'O' */ DPRINTF(DEBUG_TRANSFER, "ackbibi complete\n"); return; case RCDO: return; case TIMEOUT: default: break; } } } /* End of lrz.c */ lrzsz-0.13.1/src/linesimulator.c0000664000175000017500000007133315255263431012302 /* * linesimulator - rate-limiting and error-injecting relay for serial protocols. * * Starts a subprocess (SUB) connected via pipes. Relays stdin->SUB and * SUB->stdout, optionally rate-limiting throughput and/or injecting errors. * * Usage: linesimulator [OPTIONS] SUB [args...] * * Build: cc -o linesimulator linesimulator.c * * Deliberately independent of the lrzsz codebase, like zmodemsnif. */ #define _POSIX_C_SOURCE 200809L #include #include #include #include #include #include #include #include #include #include #include #include #define BUFSZ 16384 #define MAX_RANGES 32 /* ------------------------------------------------------------------ */ /* Byte ranges for error windowing */ /* ------------------------------------------------------------------ */ struct range { size_t lo; size_t hi; }; struct range_list { struct range ranges[MAX_RANGES]; int count; }; static int in_ranges(const struct range_list *rl, size_t pos) { int i; if (rl->count == 0) return 1; for (i = 0; i < rl->count; i++) { if (pos >= rl->ranges[i].lo && pos < rl->ranges[i].hi) return 1; } return 0; } /* Parse a size string like "128k", "1m", "4096" */ static size_t parse_size(const char *s, const char **endp) { char *ep; unsigned long long v = strtoull(s, &ep, 0); if (ep != s) { switch (*ep) { case 'k': case 'K': v <<= 10; ep++; break; case 'm': case 'M': v <<= 20; ep++; break; case 'g': case 'G': v <<= 30; ep++; break; default: break; } } if (endp) *endp = ep; return (size_t)v; } /* Parse a comma-separated list of ranges like "128k-256k,768k-1m" */ static int parse_ranges(const char *s, struct range_list *rl) { const char *p = s; rl->count = 0; while (*p && rl->count < MAX_RANGES) { const char *endp; size_t lo, hi; lo = parse_size(p, &endp); p = endp; if (*p == '-') { p++; hi = parse_size(p, &endp); p = endp; } else { hi = lo + 1; } if (lo >= hi) { fprintf(stderr, "linesimulator: bad range near '%s'\n", s); return -1; } rl->ranges[rl->count].lo = lo; rl->ranges[rl->count].hi = hi; rl->count++; if (*p == ',') p++; else if (*p != '\0') { fprintf(stderr, "linesimulator: bad range separator near '%s'\n", p); return -1; } } if (rl->count == 0) { fprintf(stderr, "linesimulator: no ranges parsed from '%s'\n", s); return -1; } return 0; } /* ------------------------------------------------------------------ */ /* RNG: xorshift64 */ /* ------------------------------------------------------------------ */ static unsigned long xorshift64(unsigned long *state) { unsigned long x = *state; if (x == 0) x = 0x9E3779B97F4A7C15UL; x ^= x << 13; x ^= x >> 7; x ^= x << 17; *state = x; return x; } /* ------------------------------------------------------------------ */ /* Buffer */ /* ------------------------------------------------------------------ */ struct buf { unsigned char data[BUFSZ]; size_t len; }; /* ------------------------------------------------------------------ */ /* Rate limiter */ /* ------------------------------------------------------------------ */ enum rl_mode { RL_NONE, RL_BITRATE, RL_BLOCK, }; struct rate_limit { enum rl_mode mode; long bps; /* bits per second (RL_BITRATE) */ long tokens; /* available tokens (in bits) */ struct timespec last_refill; /* block mode */ size_t block_size; /* bytes per block (RL_BLOCK) */ long delay_ms; /* delay between blocks (RL_BLOCK) */ size_t block_accum; /* bytes accumulated in current block */ struct timespec block_deadline; /* when current block can be sent */ int block_has_deadline; /* bit-rate mode latency */ long latency_ms; /* per-message latency (RL_BITRATE) */ }; static void rl_init(struct rate_limit *rl, enum rl_mode mode, long bps, size_t block_size, long delay_ms, long latency_ms) { memset(rl, 0, sizeof(*rl)); rl->mode = mode; rl->bps = bps; rl->tokens = 0; /* start empty: rate limit applies from the first byte */ rl->block_size = block_size; rl->delay_ms = delay_ms; rl->latency_ms = latency_ms; clock_gettime(CLOCK_MONOTONIC, &rl->last_refill); } static long ms_remaining(const struct timespec *deadline) { struct timespec now; long ms; clock_gettime(CLOCK_MONOTONIC, &now); ms = (deadline->tv_sec - now.tv_sec) * 1000 + (deadline->tv_nsec - now.tv_nsec) / 1000000; return ms < 0 ? 0 : ms; } /* Compute poll timeout (ms) for this rate limiter, or -1 if unlimited. */ static int rl_timeout(struct rate_limit *rl) { if (rl->mode == RL_BITRATE) { int lat_ms = 0; long ms, need; if (rl->block_has_deadline) { lat_ms = (int)ms_remaining(&rl->block_deadline); if (lat_ms > 0) return lat_ms; } if (rl->tokens >= 8) return 0; /* time to get at least 8 bits (1 byte) */ need = 8 - rl->tokens; ms = need * 1000 / rl->bps; return (int)(ms < 1 ? 1 : ms); } if (rl->mode == RL_BLOCK && rl->block_has_deadline) { return (int)ms_remaining(&rl->block_deadline); } return -1; } /* Refill token bucket based on elapsed time. */ static void rl_refill(struct rate_limit *rl) { struct timespec now; long elapsed_us, add; if (rl->mode != RL_BITRATE) return; clock_gettime(CLOCK_MONOTONIC, &now); elapsed_us = (now.tv_sec - rl->last_refill.tv_sec) * 1000000 + (now.tv_nsec - rl->last_refill.tv_nsec) / 1000; if (elapsed_us <= 0) return; add = elapsed_us * rl->bps / 1000000; if (add <= 0) return; rl->tokens += add; if (rl->tokens > rl->bps) rl->tokens = rl->bps; /* cap at 1 second worth */ rl->last_refill = now; } /* How many bytes can we write right now? */ static size_t rl_allow(struct rate_limit *rl, size_t want) { size_t avail; if (rl->mode == RL_NONE) return want; if (rl->mode == RL_BITRATE) { if (rl->block_has_deadline) { if (ms_remaining(&rl->block_deadline) > 0) return 0; rl->block_has_deadline = 0; } rl_refill(rl); avail = (size_t)(rl->tokens / 8); return avail < want ? avail : want; } /* RL_BLOCK */ if (rl->block_has_deadline) { if (ms_remaining(&rl->block_deadline) > 0) return 0; rl->block_has_deadline = 0; } return want; } /* Record that we wrote n bytes. */ static void rl_consumed(struct rate_limit *rl, size_t n) { struct timespec now; if (rl->mode == RL_BITRATE) { rl->tokens -= (long)n * 8; if (rl->tokens < 0) rl->tokens = 0; } else if (rl->mode == RL_BLOCK) { rl->block_accum += n; if (rl->block_accum >= rl->block_size) { rl->block_accum = 0; clock_gettime(CLOCK_MONOTONIC, &now); rl->block_deadline.tv_sec = now.tv_sec + (now.tv_nsec + rl->delay_ms * 1000000L) / 1000000000L; rl->block_deadline.tv_nsec = (now.tv_nsec + rl->delay_ms * 1000000L) % 1000000000L; rl->block_has_deadline = 1; } } } /* Set latency deadline for a newly arrived message (RL_BITRATE mode). */ static void rl_arrived(struct rate_limit *rl) { struct timespec now; if (rl->mode == RL_BITRATE && rl->latency_ms > 0) { clock_gettime(CLOCK_MONOTONIC, &now); rl->block_deadline.tv_sec = now.tv_sec + (now.tv_nsec + rl->latency_ms * 1000000L) / 1000000000L; rl->block_deadline.tv_nsec = (now.tv_nsec + rl->latency_ms * 1000000L) % 1000000000L; rl->block_has_deadline = 1; } } /* ------------------------------------------------------------------ */ /* Error injection */ /* ------------------------------------------------------------------ */ enum err_type { ERR_FLIP = 0, ERR_DROP, ERR_GARBLE, NERR, }; struct error_state { unsigned long rng; unsigned long seed; int flip_bits; /* max bits to flip per event (0=disabled) */ int drop_bytes; /* max bytes to drop per event (0=disabled) */ int garble_bytes; /* max bytes to garble per event (0=disabled) */ int drop_packet; /* drop exactly this many bytes per event (0=disabled) */ int strip_bit8; /* clear bit 7 of every byte */ int strip_ctrl; /* remove control chars */ size_t error_freq; /* nominal bytes between error events */ int deterministic; /* if true, errors at exact error_freq intervals */ size_t byte_count; /* bytes processed since last check */ size_t next_error[NERR]; /* jittered threshold per error type */ struct range_list ranges; /* byte ranges where errors are active */ }; static void es_init(struct error_state *es) { memset(es, 0, sizeof(*es)); es->error_freq = 1024; } static void es_seed(struct error_state *es, unsigned long seed) { es->seed = seed; es->rng = seed; if (es->rng == 0) es->rng = 0x9E3779B97F4A7C15UL; } static void es_schedule(struct error_state *es, enum err_type t) { if (es->deterministic) { es->next_error[t] = es->byte_count + es->error_freq; } else { unsigned long r = xorshift64(&es->rng); es->next_error[t] = es->byte_count + 1 + (size_t)(r % (2 * es->error_freq)); } } static void es_setup(struct error_state *es) { if (es->flip_bits > 0) es_schedule(es, ERR_FLIP); if (es->drop_bytes > 0 || es->drop_packet > 0) es_schedule(es, ERR_DROP); if (es->garble_bytes > 0) es_schedule(es, ERR_GARBLE); } /* Garble: flip all bits in up to n bytes at position pos in the buffer. */ static void do_garble(struct error_state *es, unsigned char *buf, size_t buflen, size_t pos) { int maxn = es->garble_bytes; unsigned long r = xorshift64(&es->rng); int n = 1 + (int)(r % (unsigned long)maxn); for (int i = 0; i < n && pos + i < buflen; i++) buf[pos + i] ^= 0xFF; } /* Flip: flip up to maxn random bits near position pos. */ static void do_flip(struct error_state *es, unsigned char *buf, size_t buflen, size_t pos) { int maxn = es->flip_bits; unsigned long r = xorshift64(&es->rng); int n = 1 + (int)(r % (unsigned long)maxn); for (int i = 0; i < n; i++) { unsigned long r2 = xorshift64(&es->rng); size_t byte_off = r2 % 8; /* spread within 8 bytes */ if (byte_off >= buflen - pos) byte_off = 0; /* clamp to current position if near end */ if (pos + byte_off < buflen) { unsigned char bit = 1 << (xorshift64(&es->rng) % 8); buf[pos + byte_off] ^= bit; } } } /* * Transform a buffer in-place. * Returns the new length (may be shorter due to byte drops or control-char * stripping). */ static size_t apply_transform(struct error_state *es, unsigned char *buf, size_t len) { if (len == 0) return 0; /* Phase 1: per-byte always-on transforms */ if (es->strip_bit8 || es->strip_ctrl) { size_t j = 0; for (size_t i = 0; i < len; i++) { unsigned char c = buf[i]; if (es->strip_bit8) c &= 0x7F; if (es->strip_ctrl) { if (c < 0x20 || c == 0x7F) continue; } buf[j++] = c; } len = j; } if (len == 0) return 0; /* Phase 2: error events */ if (es->flip_bits <= 0 && es->drop_bytes <= 0 && es->drop_packet <= 0 && es->garble_bytes <= 0) return len; { size_t pos = 0; while (pos < len) { es->byte_count++; if (!in_ranges(&es->ranges, es->byte_count)) { pos++; continue; } if (es->flip_bits > 0 && es->byte_count >= es->next_error[ERR_FLIP]) { do_flip(es, buf, len, pos); es_schedule(es, ERR_FLIP); } if (es->garble_bytes > 0 && es->byte_count >= es->next_error[ERR_GARBLE]) { do_garble(es, buf, len, pos); es_schedule(es, ERR_GARBLE); } if (es->drop_packet > 0 && es->byte_count >= es->next_error[ERR_DROP]) { /* silent packet drop: exactly drop_packet bytes at the event * position (packet boundaries are ours, not the protocol's) */ int n = es->drop_packet; if ((size_t)n > len - pos) n = (int)(len - pos); memmove(buf + pos, buf + pos + n, len - pos - n); len -= n; es_schedule(es, ERR_DROP); /* don't advance pos: next byte is now at pos */ continue; } if (es->drop_bytes > 0 && es->byte_count >= es->next_error[ERR_DROP]) { unsigned long r = xorshift64(&es->rng); int maxn = es->drop_bytes; int n = 1 + (int)(r % (unsigned long)maxn); if ((size_t)n > len - pos) n = (int)(len - pos); memmove(buf + pos, buf + pos + n, len - pos - n); len -= n; es_schedule(es, ERR_DROP); /* don't advance pos: next byte is now at pos */ continue; } pos++; } return len; } } /* ------------------------------------------------------------------ */ /* Direction */ /* ------------------------------------------------------------------ */ struct direction { struct buf to_buf; /* buffered data waiting to be written */ struct rate_limit rl; struct error_state es; int has_error; /* whether error injection is active */ int eof; /* input side reached EOF */ }; static void dir_init(struct direction *d) { memset(d, 0, sizeof(*d)); rl_init(&d->rl, RL_NONE, 0, 0, 0, 0); es_init(&d->es); } /* ------------------------------------------------------------------ */ /* Utility */ /* ------------------------------------------------------------------ */ static void set_nonblock(int fd) { int flags = fcntl(fd, F_GETFL, 0); if (flags >= 0) fcntl(fd, F_SETFL, flags | O_NONBLOCK); } static void usage(FILE *out) { fprintf(out, "Usage: linesimulator [OPTIONS] SUB [args...]\n" "\n" "Rate limiting (bit rate):\n" " -r BPS bits per second, both directions\n" " -R BPS bits per second, stdin->SUB only\n" " -T BPS bits per second, SUB->stdout only\n" " -L MS per-message latency in ms (both directions)\n" "\n" "Rate limiting (block mode):\n" " -b SIZE block size in bytes\n" " -p N blocks per second (both directions)\n" " -d MS delay in ms between blocks (both directions)\n" "\n" "Error injection (both directions unless noted):\n" " -7 strip bit 8 (zero the 8th bit of every byte)\n" " -c strip all ASCII control chars (< 0x20 and 0x7f)\n" " -e N flip up to N random bits per error event\n" " -x N drop up to N random bytes per error event\n" " -P N silently drop exactly N bytes (a packet) per event;\n" " overrides -x\n" " -g N garble up to N bytes (flip all bits) per error event\n" " -f N error frequency: ~1 event per N bytes (jittered 0..2N)\n" " (default: 1024)\n" " -F N error frequency: exactly 1 event per N bytes (no jitter)\n" " -w RANGES only inject errors within byte ranges, e.g.\n" " -w 128k-256k,768k-1m (default: all bytes)\n" " -s SEED random seed (default: random, printed to stderr)\n" " -1 apply errors only to stdin->SUB direction\n" " -2 apply errors only to SUB->stdout direction\n" " (default: both directions)\n" "\n" " -h print this help\n" "\n"); } /* ------------------------------------------------------------------ */ /* Main */ /* ------------------------------------------------------------------ */ int main(int argc, char **argv) { /* Defaults */ long bps_tx = 0, bps_rx = 0; /* 0 = unlimited */ long bps_both = 0; size_t block_size = 0; long block_delay_ms = 0; long latency_ms = 0; int blocks_per_sec = 0; int strip_bit8 = 0; int strip_ctrl = 0; int flip_bits = 0; int drop_bytes = 0; int drop_packet = 0; int garble_bytes = 0; int deterministic = 0; size_t error_freq = 1024; long seed = -1; /* -1 = random */ int err_dir = 3; /* 1=tx only, 2=rx only, 3=both */ struct range_list err_ranges; /* empty = all bytes */ /* Variables used later */ int c; char **sub_argv; enum rl_mode mode = RL_NONE; long rl_bps = 0; unsigned long actual_seed; struct direction dir[2]; int has_errors; int sub_stdin[2], sub_stdout[2]; pid_t pid; int stdin_eof = 0, sub_stdout_eof = 0; int d; long tx_bps, rx_bps; memset(&err_ranges, 0, sizeof(err_ranges)); while ((c = getopt(argc, argv, "r:R:T:b:p:d:L:7ce:x:P:g:f:F:w:s:12h")) != -1) { switch (c) { case 'r': bps_both = (long)parse_size(optarg, NULL); break; case 'R': bps_tx = (long)parse_size(optarg, NULL); break; case 'T': bps_rx = (long)parse_size(optarg, NULL); break; case 'b': block_size = parse_size(optarg, NULL); break; case 'p': blocks_per_sec = atoi(optarg); break; case 'd': block_delay_ms = atol(optarg); break; case 'L': latency_ms = atol(optarg); break; case '7': strip_bit8 = 1; break; case 'c': strip_ctrl = 1; break; case 'e': flip_bits = atoi(optarg); break; case 'x': drop_bytes = atoi(optarg); break; case 'P': drop_packet = atoi(optarg); break; case 'g': garble_bytes = atoi(optarg); break; case 'f': error_freq = (size_t)atol(optarg); break; case 'F': error_freq = (size_t)atol(optarg); deterministic = 1; break; case 'w': if (parse_ranges(optarg, &err_ranges) < 0) return 1; break; case 's': seed = atol(optarg); break; case '1': err_dir = 1; break; case '2': err_dir = 2; break; case 'h': usage(stdout); return 0; default: usage(stderr); return 1; } } if (optind >= argc) { fprintf(stderr, "linesimulator: no SUB command given\n"); usage(stderr); return 1; } sub_argv = &argv[optind]; /* Resolve rate-limit mode */ if (block_size > 0) { mode = RL_BLOCK; if (blocks_per_sec > 0) block_delay_ms = 1000 / blocks_per_sec; if (block_delay_ms <= 0) { fprintf(stderr, "linesimulator: block mode requires -p or -d\n"); return 1; } } else if (bps_both > 0 || bps_tx > 0 || bps_rx > 0) { mode = RL_BITRATE; if (bps_both > 0) { if (bps_tx == 0) bps_tx = bps_both; if (bps_rx == 0) bps_rx = bps_both; } rl_bps = bps_both; /* used as default if one dir is 0 */ } /* Seed RNG */ if (seed >= 0) { /* Reproducible Number Generator */ actual_seed = (unsigned long)seed; } else { /* Random Number Generator */ FILE *urand = fopen("/dev/urandom", "rb"); if (urand) { if (fread(&actual_seed, sizeof(actual_seed), 1, urand) != 1) actual_seed = (unsigned long)time(NULL); fclose(urand); } else { actual_seed = (unsigned long)time(NULL); } fprintf(stderr, "linesimulator: seed=%lu\n", actual_seed); } /* Directions: 0=stdin->SUB (tx), 1=SUB->stdout (rx) */ dir_init(&dir[0]); dir_init(&dir[1]); /* Configure rate limiters */ if (mode == RL_BITRATE) { tx_bps = bps_tx > 0 ? bps_tx : rl_bps; rx_bps = bps_rx > 0 ? bps_rx : rl_bps; if (tx_bps > 0) rl_init(&dir[0].rl, RL_BITRATE, tx_bps, 0, 0, latency_ms); if (rx_bps > 0) rl_init(&dir[1].rl, RL_BITRATE, rx_bps, 0, 0, latency_ms); } else if (mode == RL_BLOCK) { rl_init(&dir[0].rl, RL_BLOCK, 0, block_size, block_delay_ms, 0); rl_init(&dir[1].rl, RL_BLOCK, 0, block_size, block_delay_ms, 0); } /* Configure error injection */ has_errors = (strip_bit8 || strip_ctrl || flip_bits > 0 || drop_bytes > 0 || drop_packet > 0 || garble_bytes > 0); if (has_errors) { for (d = 0; d < 2; d++) { if (err_dir == 3 || err_dir == d + 1) { dir[d].has_error = 1; dir[d].es.strip_bit8 = strip_bit8; dir[d].es.strip_ctrl = strip_ctrl; dir[d].es.flip_bits = flip_bits; dir[d].es.drop_bytes = drop_bytes; dir[d].es.drop_packet = drop_packet; dir[d].es.garble_bytes = garble_bytes; dir[d].es.error_freq = error_freq; dir[d].es.deterministic = deterministic; dir[d].es.ranges = err_ranges; es_seed(&dir[d].es, actual_seed + (unsigned long)d); es_setup(&dir[d].es); } } } /* Create pipes and fork SUB aka lrz… most often. */ if (pipe(sub_stdin) < 0 || pipe(sub_stdout) < 0) { perror("pipe"); return 1; } pid = fork(); if (pid < 0) { perror("fork"); return 1; } if (pid == 0) { /* Child: exec SUB */ close(sub_stdin[1]); close(sub_stdout[0]); dup2(sub_stdin[0], STDIN_FILENO); dup2(sub_stdout[1], STDOUT_FILENO); close(sub_stdin[0]); close(sub_stdout[1]); execvp(sub_argv[0], sub_argv); perror("execvp"); _exit(127); } /* Parent: relay */ close(sub_stdin[0]); close(sub_stdout[1]); /* A peer going away (SUB exited, or the process feeding us) is a * normal end-of-session condition on a half-duplex teardown: the * last buffered frame may still be forwarded after the other side * already left. Dying of SIGPIPE there would abort this process * before waitpid() below can reap SUB, so the caller would see our * death (exit 141) instead of SUB's real exit status. Ignore * SIGPIPE and let the write errors unwind the loop. Do this AFTER * the fork: setting it before would leak SIG_IGN through execvp * into SUB, and lrzsz_install_signal() refuses to install a handler * when the signal is ignored, silently changing SUB's semantics. */ signal(SIGPIPE, SIG_IGN); set_nonblock(STDIN_FILENO); set_nonblock(STDOUT_FILENO); set_nonblock(sub_stdin[1]); set_nonblock(sub_stdout[0]); for (;;) { struct pollfd fds[4]; int nfds = 0; int pi_stdin = -1, pi_subin = -1, pi_subout = -1, pi_stdout = -1; int timeout, t, ret; ssize_t n; size_t avail, can; if (!stdin_eof && dir[0].to_buf.len < BUFSZ) { fds[nfds].fd = STDIN_FILENO; fds[nfds].events = POLLIN; fds[nfds].revents = 0; pi_stdin = nfds++; } if (dir[0].to_buf.len > 0) { fds[nfds].fd = sub_stdin[1]; fds[nfds].events = POLLOUT; fds[nfds].revents = 0; pi_subin = nfds++; } if (!sub_stdout_eof && dir[1].to_buf.len < BUFSZ) { fds[nfds].fd = sub_stdout[0]; fds[nfds].events = POLLIN; fds[nfds].revents = 0; pi_subout = nfds++; } if (dir[1].to_buf.len > 0) { fds[nfds].fd = STDOUT_FILENO; fds[nfds].events = POLLOUT; fds[nfds].revents = 0; pi_stdout = nfds++; } if (nfds == 0) break; /* Compute poll timeout from rate limiters */ timeout = -1; for (d = 0; d < 2; d++) { if (dir[d].to_buf.len > 0) { t = rl_timeout(&dir[d].rl); if (t >= 0) { if (timeout < 0 || t < timeout) timeout = t; } } } ret = poll(fds, nfds, timeout); if (ret < 0) { if (errno == EINTR) continue; perror("poll"); break; } /* stdin -> SUB (direction 0) */ if (pi_stdin >= 0 && (fds[pi_stdin].revents & (POLLIN | POLLHUP))) { unsigned char tmp[BUFSZ]; avail = BUFSZ - dir[0].to_buf.len; n = read(STDIN_FILENO, tmp, avail < sizeof(tmp) ? avail : sizeof(tmp)); if (n > 0) { if (dir[0].has_error) n = (ssize_t)apply_transform(&dir[0].es, tmp, (size_t)n); if (n > 0) { if (dir[0].to_buf.len == 0) rl_arrived(&dir[0].rl); memcpy(dir[0].to_buf.data + dir[0].to_buf.len, tmp, (size_t)n); dir[0].to_buf.len += (size_t)n; } } else if (n == 0 || (errno != EINTR && errno != EAGAIN)) { stdin_eof = 1; if (dir[0].to_buf.len == 0) close(sub_stdin[1]); } } /* Drain to SUB (direction 0) */ if (pi_subin >= 0 && (fds[pi_subin].revents & POLLOUT)) { can = rl_allow(&dir[0].rl, dir[0].to_buf.len); if (can > 0) { n = write(sub_stdin[1], dir[0].to_buf.data, can); if (n > 0) { rl_consumed(&dir[0].rl, (size_t)n); if ((size_t)n < dir[0].to_buf.len) { memmove(dir[0].to_buf.data, dir[0].to_buf.data + n, dir[0].to_buf.len - n); dir[0].to_buf.len -= n; } else { dir[0].to_buf.len = 0; } } else if (n < 0 && errno != EINTR && errno != EAGAIN) { close(sub_stdin[1]); dir[0].to_buf.len = 0; } } if (stdin_eof && dir[0].to_buf.len == 0) close(sub_stdin[1]); } /* SUB stdout -> stdout (direction 1) */ if (pi_subout >= 0 && (fds[pi_subout].revents & (POLLIN | POLLHUP))) { unsigned char tmp[BUFSZ]; avail = BUFSZ - dir[1].to_buf.len; n = read(sub_stdout[0], tmp, avail < sizeof(tmp) ? avail : sizeof(tmp)); if (n > 0) { if (dir[1].has_error) n = (ssize_t)apply_transform(&dir[1].es, tmp, (size_t)n); if (n > 0) { if (dir[1].to_buf.len == 0) rl_arrived(&dir[1].rl); memcpy(dir[1].to_buf.data + dir[1].to_buf.len, tmp, (size_t)n); dir[1].to_buf.len += (size_t)n; } } else if (n == 0 || (errno != EINTR && errno != EAGAIN)) { sub_stdout_eof = 1; close(sub_stdout[0]); } } /* Drain to stdout (direction 1) */ if (pi_stdout >= 0 && (fds[pi_stdout].revents & POLLOUT)) { can = rl_allow(&dir[1].rl, dir[1].to_buf.len); if (can > 0) { n = write(STDOUT_FILENO, dir[1].to_buf.data, can); if (n > 0) { rl_consumed(&dir[1].rl, (size_t)n); if ((size_t)n < dir[1].to_buf.len) { memmove(dir[1].to_buf.data, dir[1].to_buf.data + n, dir[1].to_buf.len - n); dir[1].to_buf.len -= n; } else { dir[1].to_buf.len = 0; } } else if (n < 0 && errno != EINTR && errno != EAGAIN) { dir[1].to_buf.len = 0; } } } if (sub_stdout_eof && dir[1].to_buf.len == 0) break; } /* Wait for SUB to exit */ { int status; waitpid(pid, &status, 0); if (WIFEXITED(status)) return WEXITSTATUS(status); return 1; } } lrzsz-0.13.1/src/rbsb.c0000664000175000017500000001526515255263431010345 /* 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 #include static const struct { unsigned baudr; speed_t speedcode; } speeds[] = { {110, B110}, {300, B300}, {600, B600}, {1200, B1200}, {2400, B2400}, {4800, B4800}, #ifdef B7200 {7200, B7200}, #endif {9600, B9600}, #ifdef B14400 {14400, B14400}, #endif #ifdef B19200 {19200, B19200}, #endif #ifdef B28800 {28800, B28800}, #endif #ifdef B38400 {38400, B38400}, #endif #ifdef B57600 {57600, B57600}, #endif #ifdef B76800 {76800, B76800}, #endif #ifdef B115200 {115200, B115200}, #endif #ifdef B230400 {230400, B230400}, #endif #ifdef B460800 {460800, B460800}, #endif #ifdef B500000 {500000, B500000}, #endif #ifdef B576000 {576000, B576000}, #endif #ifdef B921600 {921600, B921600}, #endif #ifdef B1000000 {1000000, B1000000}, #endif #ifdef B1152000 {1152000, B1152000}, #endif #ifdef B1500000 {1500000, B1500000}, #endif #ifdef B2000000 {2000000, B2000000}, #endif #ifdef EXTA {19200, EXTA}, #endif #ifdef EXTB {38400, EXTB}, #endif {0, 0} }; 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; /* fallback when the speed code is unknown */ } /* * return 1 if stdout and stderr are different devices * indicating this program operating with a modem on a * different line */ bool Fromcu; /* Were called from cu or yam */ int from_cu(void) { struct stat a, b; /* in case fstat fails */ a.st_rdev=b.st_rdev=a.st_dev=b.st_dev=0; fstat(1, &a); fstat(2, &b); /* check only for device equality only. decomposing into major/minor * like before seems useless. */ Fromcu = (a.st_rdev != b.st_rdev) || (a.st_dev != b.st_dev); return Fromcu; } bool Twostop; /* Use two stop bits */ static struct termios oldtty, tty; static int not_a_tty = false; /* tcgetattr can never succeed on this fd */ /* * 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 = 0; static int have_oldtty = false; DPRINTF(DEBUG_TTY, "mode:%d\n", n); if(!did0) { did0 = 1; if (tcgetattr(fd,&oldtty) == 0) have_oldtty = true; else if (errno == EINTR) { /* transient failure: don't latch did0 and don't * change the line now, so the next call can still * capture the UNMODIFIED state. (Setting a mode here * would make the later tcgetattr save the changed * settings, and the exit would "restore" those.) */ did0 = 0; return ERROR; } else { /* not a terminal (pipe, pty master...): tcgetattr can * never succeed on this fd. Whatever the errno is * (ENOTTY on Linux, EOPNOTSUPP on OpenBSD fifos), * don't retry it forever. */ did0 = 2; not_a_tty = true; DPRINTF(DEBUG_TTY, "tcgetattr failed: not a tty (errno %d)\n", errno); } } switch(n) { case 2: /* Un-raw mode used by sz, sb when -g detected */ if (!have_oldtty) return OK; /* not a tty: nothing to set */ tty = oldtty; tty.c_iflag = BRKINT|IXON; tty.c_oflag = 0; /* Transparent output */ tty.c_cflag &= ~ (unsigned int) PARENB; /* Disable parity */ tty.c_cflag |= CS8; /* Set character size = 8 */ if (Twostop) tty.c_cflag |= CSTOPB; /* Set two stop bits */ tty.c_lflag = protocol==ZM_ZMODEM ? 0 : ISIG; tty.c_cc[VINTR] = protocol==ZM_ZMODEM ? _POSIX_VDISABLE : CAN; /* Interrupt char */ tty.c_cc[VQUIT] = _POSIX_VDISABLE; /* Quit char */ tty.c_cc[VMIN] = 1; /* 1 char satisfied reads */ tty.c_cc[VTIME] = 1; /* or in this many tenths of seconds */ if (tcsetattr(fd,TCSADRAIN,&tty) < 0) DPRINTF(DEBUG_TTY, "tcsetattr failed: %s\n", strerror(errno)); return OK; case 1: case 3: if (!have_oldtty) { /* not a terminal (pipe etc.): there is nothing to set, * and cfgetospeed() on a zeroed struct would just hit * getspeed()'s fallback. Preserve that fallback's value * so pipe-based setups keep their block-size behavior. */ Baudrate = 38400; return OK; } 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 &= ~(unsigned int) (ECHO | ICANON | ISIG | IEXTEN); tty.c_oflag = 0; /* Transparent output */ tty.c_cflag &= ~((unsigned int) PARENB); /* Same baud rate, disable parity */ /* Set character size = 8 */ tty.c_cflag &= ~((unsigned int) CSIZE); tty.c_cflag |= CS8; if (Twostop) tty.c_cflag |= CSTOPB; /* Set two stop bits */ tty.c_cc[VMIN] = 1; /* This many chars satisfies reads */ tty.c_cc[VTIME] = 1; /* or in this many tenths of seconds */ if (tcsetattr(fd,TCSADRAIN,&tty) < 0) DPRINTF(DEBUG_TTY, "tcsetattr failed: %s\n", strerror(errno)); Baudrate = getspeed(cfgetospeed(&tty)); return OK; case 0: if(!did0) return ERROR; if (have_oldtty) { if (tcsetattr(fd,TCSANOW,&oldtty) < 0) lrzsz_warning(0, _("tcsetattr failed: %s"), strerror(errno)); } tcflush(fd,TCIOFLUSH); /* flush input queue */ tcflow(fd,TCOON); /* restart output */ return OK; default: return ERROR; } } void sendbrk(int fd) { /* remember that the fd cannot do breaks (e.g. ENOTTY on a pipe); * don't retry forever on a line that lies about it either */ static int nobreak; if (nobreak) return; if (not_a_tty) { nobreak = 1; return; } if (tcsendbreak(fd,0) < 0) { if (errno == ENOTTY) nobreak = 1; } } void purgeline(int fd) { readline_purge(); tcflush(fd, TCIFLUSH); } /* End of rbsb.c */ lrzsz-0.13.1/src/crctab.h0000664000175000017500000000061015242256042010640 #ifndef LRZSZ_CRCTAB_H #define LRZSZ_CRCTAB_H extern const unsigned short crctab[256]; /* updcrc macro derived from article Copyright (C) 1986 Stephen Satchell. */ #define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (( (unsigned int)(crc&0x00ffffff)) << 8) ^ cp) extern const unsigned long cr3tab[256]; #define UPDC32(b, c) (cr3tab[((int)c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF)) #endif lrzsz-0.13.1/src/util.h0000664000175000017500000001053215251525750010370 #ifndef LRZSZ_UTIL_H #define LRZSZ_UTIL_H #include "config.h" /* noreturn and format_printf */ #include /* time_t */ #include /* size_t */ #include #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L # define LRZSZ_NORETURN [[noreturn]] #elif defined(__GNUC__) || defined(__clang__) # define LRZSZ_NORETURN __attribute__((__noreturn__)) #else # define LRZSZ_NORETURN #endif #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L # define LRZSZ_FORMAT_PRINTF(fmtidx, argidx) [[gnu::format(printf, fmtidx, argidx)]] #elif defined(__GNUC__) || defined(__clang__) # define LRZSZ_FORMAT_PRINTF(fmtidx, argidx) __attribute__((format(printf, fmtidx, argidx))) #else # define LRZSZ_FORMAT_PRINTF(fmt, arg) #endif #if defined(__GNUC__) || defined(__clang__) # define LRZSZ_ALWAYS_INLINE __attribute__((always_inline)) #else # define LRZSZ_ALWAYS_INLINE #endif extern const char * lrzsz_progname; void lrzsz_set_progname (const char * str, const char *who); LRZSZ_FORMAT_PRINTF(2,3) void lrzsz_warning(int errnum, const char *format, ...); LRZSZ_NORETURN LRZSZ_FORMAT_PRINTF(3,4) void fatal_error (int status, int errnum, const char *message, ...); unsigned long lrzsz_strtoul(const char *name, const char *value, const char *valid_suffixes, unsigned long int min, unsigned long int max); char * xstrdup(const char *s); void * xmalloc(size_t size); size_t sanitize_bytes(char *dst, size_t dstcap, const char *src); void report_transfer_result (int sending, const char *shortname, const char *fname, long bytes, long total, long skipped); int fd_readable(int fd); /* Install a "cancel" handler for sig unless it is being ignored; returns 1 * if the handler was installed, 0 if the old disposition was SIG_IGN (and * was left alone). Shared by lrz.c and lsz.c; the handler itself is * program-specific. */ int lrzsz_install_signal (int sig, void (*handler)(int)); /* Derive the protocol (ZM_XMODEM/YMODEM/ZMODEM) and the initial Verbose * from the invoked name; DIR is 'r' (lrz: rx/rb/rz prefixes) or 's' * (lsz: sx/sb/sz). */ void chkinvok (const char *s, char dir); /* Parse the -s/--stop-at argument: "HH:MM" (wall clock, today or tomorrow, * must be at least 10 s away) or "+N" seconds. Calls DIE (a program's * usage(int, const char*)) on unparsable or too-small values. Returns the * absolute stop time, or 0 for the "no stop time" sentinel use of -s? no: * always a valid time. */ time_t lrzsz_parse_stop_time (const char *optarg, void (*die)(int, const char *)); /* Check a received/sent pathname for traversal components. Returns true if * NAME is absolute, contains a ".." component, or (when RESTRICTED_LEVEL > 1) * contains a component starting with '.'. The caller owns the reaction. */ bool lrzsz_path_component_violation (const char *name, int restricted_level); /* ETA arithmetic for the progress displays: BPS bytes/second, LEFT bytes * remaining. */ void lrzsz_eta (long bps, size_t left, int *minleft, int *secleft); /* Last path component of PATH, or "no.name" when PATH is NULL. The returned * pointer refers into PATH (no copy). Used for syslog lines, which lsyslog() * sanitizes. */ const char * lrzsz_basename (const char *path); /* min_bps watchdog returns true, if the transfer should be aborted (last bps * was below min for at least the min seconds). * returns false to keep going (and set or clear the low bps tracker). * dbgname is the callers name. * fname is the transferred file's name (both used in messages). * Displays at Verbose>=1. */ bool lrzsz_bps_watchdog (const char *dbgname, long last_bps, double d, long min_bps, double min_bps_time, double *low_bpsp, const char *fname); /* -s/--stop-at deadline check: true = abort the transfer (now has passed * stop_time; the deadline is specified in wall-clock terms). * dbgname / fname: see the watchdog above. * Displays at Verbose>=1. */ bool lrzsz_stop_time_reached (const char *dbgname, time_t now, time_t stop_time, const char *fname); /* Parse a --debug argument: a comma separated list of module names * (protocol, readline, transfer, windowhandling, tty) or "all"; the bits * are ORed into the global debugmode. Returns false for an unknown name * (after warning to stderr); the caller should exit with a usage error. */ bool lrzsz_parse_debug (const char *spec); #endif lrzsz-0.13.1/src/zmodemsnif.c0000664000175000017500000007477715256165646011617 /* * zmodemsnif - ZMODEM/XMODEM/YMODEM protocol sniffer/proxy/debugger/tracer. * * Calls a subprocess, relays stdin/stdout bidirectionally in nonblocking * mode, parses passing frames on both channels, and dumps info about them to stderr. * * Usage: zmodemsnif SUB [args...] * * Build: cc -o zmodemsnif zmodemsnif.c * * deliberately totally independent of the lrzsz code. * * in memoriam of recordxyz, a similar thing i wrote in the late 1990s * and rewrote in the early 200x years. */ /* #define _POSIX_C_SOURCE 200809L */ #include #include #include #include #include #include #include #include #include #include /* --- ZMODEM protocol constants (copied from zmodem.h) */ #define ZPAD '*' #define ZDLE 030 #define ZBIN 'A' #define ZHEX 'B' #define ZBIN32 'C' #define ZRQINIT 0 #define ZRINIT 1 #define ZSINIT 2 #define ZACK 3 #define ZFILE 4 #define ZSKIP 5 #define ZNAK 6 #define ZABORT 7 #define ZFIN 8 #define ZRPOS 9 #define ZDATA 10 #define ZEOF 11 #define ZFERR 12 #define ZCRC 13 #define ZCHALLENGE 14 #define ZCOMPL 15 #define ZCAN 16 #define ZFREECNT 17 #define ZCOMMAND 18 #define ZSTDERR 19 #define ZCRCE 'h' #define ZCRCG 'i' #define ZCRCQ 'j' #define ZCRCW 'k' #define ZF0 3 #define ZF1 2 #define ZF2 1 #define ZF3 0 #define ZP0 0 #define ZP1 1 #define ZP2 2 #define ZP3 3 #define CANFDX 0x01 #define CANOVIO 0x02 #define CANBRK 0x04 #define CANCRY 0x08 #define CANLZW 0x10 #define CANFC32 0x20 #define ESCCTL 0x40 #define ESC8 0x80 #define TESCCTL 0100 #define TESC8 0200 #define ZCBIN 1 #define ZCNL 2 #define ZCRESUM 3 #define ZF1_ZMNEWL 1 #define ZF1_ZMCRC 2 #define ZF1_ZMAPND 3 #define ZF1_ZMCLOB 4 #define ZF1_ZMNEW 5 #define ZF1_ZMDIFF 6 #define ZF1_ZMPROT 7 #define ZF1_ZMCHNG 8 /* XMODEM/YMODEM constants */ #define SOH 0x01 #define STX 0x02 #define EOT 0x04 #define ACK 0x06 #define NAK 0x15 #define CAN 0x18 #define CPMEOF 0x1a /* --- Frame type names --- */ static const char *frame_names[] = { "ZRQINIT", "ZRINIT", "ZSINIT", "ZACK", "ZFILE", "ZSKIP", "ZNAK", "ZABORT", "ZFIN", "ZRPOS", "ZDATA", "ZEOF", "ZFERR", "ZCRC", "ZCHALLENGE", "ZCOMPL", "ZCAN", "ZFREECNT", "ZCOMMAND", "ZSTDERR", }; static const char * frame_name(int type) { if (type >= 0 && type <= 19) return frame_names[type]; return "?UNKNOWN?"; } /* --- CRC tables */ static unsigned short crctab[256]; static unsigned long cr3tab[256]; static void init_crc_tables(void) { /* CRC-16: polynomial 0x1021 (CCITT) */ for (int i = 0; i < 256; i++) { unsigned short crc = i << 8; for (int j = 0; j < 8; j++) { if (crc & 0x8000) crc = (crc << 1) ^ 0x1021; else crc <<= 1; } crctab[i] = crc; } /* CRC-32: polynomial 0xedb88320 */ for (int i = 0; i < 256; i++) { unsigned long crc = i; for (int j = 0; j < 8; j++) { if (crc & 1) crc = (crc >> 1) ^ 0xedb88320UL; else crc >>= 1; } cr3tab[i] = crc; } } static unsigned short updcrc(unsigned char cp, unsigned short crc) { return (crctab[(crc >> 8) & 0xff] ^ (crc << 8) ^ cp); } static unsigned long updc32(unsigned char b, unsigned long c) { return (cr3tab[(c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF)); } /* --- Buffer sizes */ #define BUFSZ 65536 struct buf { unsigned char data[BUFSZ]; size_t len; }; /* --- Parser state machine */ enum pstate { PS_IDLE, PS_ZPAD, PS_ZDLE, PS_ZHEX, PS_ZBIN, PS_ZBIN32, PS_DATA, PS_DATA_CRC, PS_X_BLOCK, PS_X_BLOCK_CRC, }; struct parser { enum pstate state; int dir; /* 0 = stdin->SUB (tx), 1 = SUB->stdout (rx) */ unsigned char hdr[4]; int hdr_type; int frame_ind; /* ZBIN, ZBIN32, or ZHEX */ int byte_idx; int data_escaping; int crc_escaping; /* ZDLE-escaping flag for CRC bytes */ int data_term; /* ZCRCE/ZCRCG/ZCRCQ/ZCRCW */ int crc_len; /* 2 or 4 depending on ZBIN vs ZBIN32 */ size_t data_len; /* bytes of data in current subframe */ int x_block_num; int x_block_size; /* 128 or 1024 */ /* CRC tracking */ unsigned short crc16; /* running 16-bit CRC */ unsigned long crc32; /* running 32-bit CRC */ unsigned char crc_recv[4]; /* received CRC bytes */ int crc_recv_len; /* ZFILE subframe data capture */ int is_zfile; unsigned char data_buf[2048]; }; static void process_byte(struct parser *p, unsigned char c); /* --- Timestamp --- */ static void print_ts(void) { struct timespec ts; struct tm tm; clock_gettime(CLOCK_REALTIME, &ts); localtime_r(&ts.tv_sec, &tm); fprintf(stderr, "%02d:%02d:%02d.%03ld ", tm.tm_hour, tm.tm_min, tm.tm_sec, (long)(ts.tv_nsec / 1000000)); } static void print_dir(int dir) { fprintf(stderr, "%s ", dir == 0 ? "\xe2\x86\x92" : "\xe2\x86\x90"); } /* --- Flag decoding */ static void print_zrinit_flags(unsigned char f0, const unsigned char *hdr) { int first = 1; fprintf(stderr, "flags="); #define PF(flag, name) \ do { if (f0 & flag) { fprintf(stderr, "%s%s", first ? "" : "|", name); first = 0; } } while(0) PF(CANFDX, "CANFDX"); PF(CANOVIO, "CANOVIO"); PF(CANBRK, "CANBRK"); PF(CANCRY, "CANCRY"); PF(CANLZW, "CANLZW"); PF(CANFC32, "CANFC32"); PF(ESCCTL, "ESCCTL"); PF(ESC8, "ESC8"); #undef PF if (first) fprintf(stderr, "0x%02x", f0); { /* 9.5 Segmented Streaming If the receiver cannot overlap serial and disk I/O, it uses the ZRINIT frame to specify a buffer length which the sender will not overflow. 11.2 ZRINIT ZP0 and ZP1 contain the size of the receiver's buffer in bytes, or 0 if nonstop I/O is allowed. */ unsigned int buflen = ((unsigned int)(unsigned char)hdr[ZP0]) | ((unsigned int)(unsigned char)hdr[ZP1] << 8); fprintf(stderr, " Rxbuflen=%u %x", buflen, buflen); fprintf(stderr, " ZP[0-3]=[%x", (unsigned int) (unsigned char) hdr[ZP0]); fprintf(stderr, " ,%x", (unsigned int) (unsigned char) hdr[ZP1]); fprintf(stderr, " ,%x", (unsigned int) (unsigned char) hdr[ZP2]); fprintf(stderr, " ,%x]", (unsigned int) (unsigned char) hdr[ZP3]); } } static void print_zsinit_flags(unsigned char f0) { int first = 1; fprintf(stderr, "flags="); #define PF(flag, name) \ do { if (f0 & flag) { fprintf(stderr, "%s%s", first ? "" : "|", name); first = 0; } } while(0) PF(TESCCTL, "TESCCTL"); PF(TESC8, "TESC8"); #undef PF if (first) fprintf(stderr, "0x%02x", f0); } static void print_zfile_flags(unsigned char f0, unsigned char f1) { const char *conv = NULL; const char *mgmt = NULL; switch (f0) { case ZCBIN: conv = "BIN"; break; case ZCNL: conv = "CNL"; break; case ZCRESUM: conv = "RESUM"; break; default: conv = NULL; break; } if (conv) fprintf(stderr, "conv=%s ", conv); else fprintf(stderr, "conv=0x%02x ", f0); switch (f1 & 0x1f) { case ZF1_ZMNEWL: mgmt = "NEWL"; break; case ZF1_ZMCRC: mgmt = "CRC"; break; case ZF1_ZMAPND: mgmt = "APND"; break; case ZF1_ZMCLOB: mgmt = "CLOB"; break; case ZF1_ZMNEW: mgmt = "NEW"; break; case ZF1_ZMDIFF: mgmt = "DIFF"; break; case ZF1_ZMPROT: mgmt = "PROT"; break; case ZF1_ZMCHNG: mgmt = "CHNG"; break; default: mgmt = NULL; break; } if (mgmt) fprintf(stderr, "mgmt=%s", mgmt); else fprintf(stderr, "mgmt=0x%02x", f1); if (f1 & 0x80) fprintf(stderr, "|NOLOC"); } static unsigned long hdr_to_pos(const unsigned char *hdr) { return ((unsigned long)(unsigned char)hdr[ZP0]) | ((unsigned long)(unsigned char)hdr[ZP1] << 8) | ((unsigned long)(unsigned char)hdr[ZP2] << 16) | ((unsigned long)(unsigned char)hdr[ZP3] << 24); } static void print_header_fields(int type, const unsigned char *hdr) { switch (type) { case ZRINIT: print_zrinit_flags(hdr[ZF0], hdr); break; case ZSINIT: print_zsinit_flags(hdr[ZF0]); break; case ZFILE: print_zfile_flags(hdr[ZF0], hdr[ZF1]); break; case ZDATA: case ZEOF: case ZRPOS: case ZACK: case ZCRC: case ZCHALLENGE: case ZCOMPL: case ZFREECNT: fprintf(stderr, "offset=%lu", hdr_to_pos(hdr)); break; case ZCOMMAND: fprintf(stderr, "flags=0x%02x", hdr[ZF0]); break; default: fprintf(stderr, "hdr=%02x%02x%02x%02x", hdr[0], hdr[1], hdr[2], hdr[3]); break; } } static void parser_init(struct parser *p, int dir) { memset(p, 0, sizeof(*p)); p->state = PS_IDLE; p->dir = dir; } static void emit_frame(struct parser *p) { /* Verify header CRC */ int crc_bad = 0; if (p->frame_ind == ZBIN32) { unsigned long crc = 0xFFFFFFFFUL; unsigned long recv; crc = updc32((unsigned char)p->hdr_type, crc); for (int i = 0; i < 4; i++) crc = updc32(p->hdr[i], crc); crc = (~crc) & 0xFFFFFFFFUL; recv = (unsigned long)p->crc_recv[0] | ((unsigned long)p->crc_recv[1] << 8) | ((unsigned long)p->crc_recv[2] << 16) | ((unsigned long)p->crc_recv[3] << 24); if (crc != recv) { crc_bad = 1; print_ts(); print_dir(p->dir); fprintf(stderr, " (info) bad 32bit header CRC: received %lx, calculated %lx\n",recv,crc); } } else { unsigned long crc = updcrc((unsigned char)p->hdr_type, 0); unsigned long recv; for (int i = 0; i < 4; i++) crc = updcrc(p->hdr[i], crc); crc = updcrc(0, updcrc(0, crc)); recv = ((unsigned short)p->crc_recv[0] << 8) | p->crc_recv[1]; if (crc != recv) { crc_bad = 1; print_ts(); print_dir(p->dir); fprintf(stderr, " (info) bad 16bit header CRC: received %lx, calculated %lx\n",recv,crc); } } print_ts(); print_dir(p->dir); fprintf(stderr, "%s ", frame_name(p->hdr_type)); print_header_fields(p->hdr_type, p->hdr); if (crc_bad) fprintf(stderr, " [BAD CRC]"); fprintf(stderr, "\n"); if (p->hdr_type == ZDATA || p->hdr_type == ZFILE || p->hdr_type == ZSINIT || p->hdr_type == ZCOMMAND) { p->state = PS_DATA; p->data_escaping = 0; p->data_term = 0; p->data_len = 0; p->is_zfile = (p->hdr_type == ZFILE); p->crc_len = (p->frame_ind == ZBIN32) ? 4 : 2; /* Initialize data subframe CRC */ if (p->frame_ind == ZBIN32) p->crc32 = 0xFFFFFFFFUL; else p->crc16 = 0; } else { p->state = PS_IDLE; } } static void emit_xmodem_block(struct parser *p, int block_num, int block_size) { print_ts(); print_dir(p->dir); fprintf(stderr, "XMODEM: %s block=%d %d bytes\n", block_size == 128 ? "SOH" : "STX", block_num, block_size); p->state = PS_X_BLOCK_CRC; p->crc_len = 2; p->byte_idx = 0; } static void emit_xmodem_byte(struct parser *p, unsigned char c, const char *desc) { print_ts(); print_dir(p->dir); fprintf(stderr, "XMODEM: %s (0x%02x)\n", desc, c); } static void process_byte(struct parser *p, unsigned char c) { switch (p->state) { default: case PS_IDLE: if (c == ZPAD) { p->state = PS_ZPAD; } else if (c == SOH) { p->state = PS_X_BLOCK; p->x_block_size = 128; p->byte_idx = 0; } else if (c == STX) { p->state = PS_X_BLOCK; p->x_block_size = 1024; p->byte_idx = 0; } else if (c == EOT) { emit_xmodem_byte(p, c, "EOT"); } else if (c == ACK) { emit_xmodem_byte(p, c, "ACK"); } else if (c == NAK) { emit_xmodem_byte(p, c, "NAK"); } else if (c == CAN) { emit_xmodem_byte(p, c, "CAN"); } else if (c == 'r') { /* Could be start of "rz\r" trigger - pass through */ } break; case PS_ZPAD: if (c == ZPAD) { /* Stay in PS_ZPAD for repeated ZPADs */ } else if (c == ZDLE) { p->state = PS_ZDLE; } else { p->state = PS_IDLE; } break; case PS_ZDLE: if (c == ZBIN) { p->frame_ind = ZBIN; p->state = PS_ZBIN; p->byte_idx = 0; p->crc_escaping = 0; } else if (c == ZBIN32) { p->frame_ind = ZBIN32; p->state = PS_ZBIN32; p->byte_idx = 0; p->crc_escaping = 0; } else if (c == ZHEX) { p->frame_ind = ZHEX; p->state = PS_ZHEX; p->byte_idx = 0; } else { p->state = PS_IDLE; } break; case PS_ZHEX: { /* Hex frame: 2 hex digits for type, 8 for data, 4 for CRC * = 14 hex chars, then CR + 0x8a (and optional XON 0x11) */ static char hexbuf[16]; if (p->byte_idx < 14) { if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) { hexbuf[p->byte_idx++] = c; } else { p->state = PS_IDLE; break; } if (p->byte_idx == 14) { /* Parse: type(2) + data[0..3](8) + crc(4) = 14 hex chars */ unsigned int type, d0, d1, d2, d3, crc; sscanf(hexbuf, "%2x%2x%2x%2x%2x%4x", &type, &d0, &d1, &d2, &d3, &crc); p->hdr_type = type & 0xff; p->hdr[0] = d0 & 0xff; p->hdr[1] = d1 & 0xff; p->hdr[2] = d2 & 0xff; p->hdr[3] = d3 & 0xff; p->crc_recv[0] = (crc >> 8) & 0xff; p->crc_recv[1] = crc & 0xff; p->crc_recv_len = 2; /* Wait for line ending chars */ } } else { /* Skip CR(0x0d) + 0x8a + optional XON(0x11) after hex data. * Once we see a non-line-ending char or enough chars, emit. */ if (c == '\r' || c == 0x8a || c == 0x11 || c == '\n' || c == '\0') { /* Line ending bytes - keep skipping until we see 2 */ p->byte_idx++; if (p->byte_idx >= 16) { emit_frame(p); } } else { /* Something else - emit and reprocess in IDLE */ emit_frame(p); if (c == ZPAD) { p->state = PS_ZPAD; } else { p->state = PS_IDLE; } } } break; } case PS_ZBIN: /* Binary 16-bit CRC: type(1) + data(4) + crc(2) = 7 bytes. * All bytes except ZBIN itself are sent via zsendline() and * may be ZDLE-escaped. */ if (p->crc_escaping) { p->crc_escaping = 0; c = c ^ 0x40; } else if (c == ZDLE) { p->crc_escaping = 1; break; } if (p->byte_idx == 0) { p->hdr_type = c; p->byte_idx = 1; } else if (p->byte_idx <= 4) { p->hdr[p->byte_idx - 1] = c; p->byte_idx++; } else if (p->byte_idx <= 6) { p->crc_recv[p->byte_idx - 5] = c; p->byte_idx++; if (p->byte_idx == 7) { p->crc_recv_len = 2; emit_frame(p); } } break; case PS_ZBIN32: /* Binary 32-bit CRC: type(1) + data(4) + crc(4) = 9 bytes. * All bytes except ZBIN32 itself are sent via zsendline() and * may be ZDLE-escaped. */ if (p->crc_escaping) { p->crc_escaping = 0; c = c ^ 0x40; } else if (c == ZDLE) { p->crc_escaping = 1; break; } if (p->byte_idx == 0) { p->hdr_type = c; p->byte_idx = 1; } else if (p->byte_idx <= 4) { p->hdr[p->byte_idx - 1] = c; p->byte_idx++; } else if (p->byte_idx <= 8) { p->crc_recv[p->byte_idx - 5] = c; p->byte_idx++; if (p->byte_idx == 9) { p->crc_recv_len = 4; emit_frame(p); } } break; case PS_DATA: if (p->data_escaping) { p->data_escaping = 0; if (c == ZCRCE || c == ZCRCG || c == ZCRCQ || c == ZCRCW) { /* Terminator: update CRC with terminator byte */ if (p->frame_ind == ZBIN32) p->crc32 = updc32(c, p->crc32); else p->crc16 = updcrc(c, p->crc16); p->data_term = c; p->state = PS_DATA_CRC; p->byte_idx = 0; p->crc_escaping = 0; } else { /* Escaped data byte: decode and update CRC */ unsigned char raw = c ^ 0x40; if (p->frame_ind == ZBIN32) p->crc32 = updc32(raw, p->crc32); else p->crc16 = updcrc(raw, p->crc16); if (p->is_zfile && p->data_len < sizeof(p->data_buf)) p->data_buf[p->data_len] = raw; p->data_len++; } } else if (c == ZDLE) { p->data_escaping = 1; } else { /* Normal data byte */ if (p->frame_ind == ZBIN32) p->crc32 = updc32(c, p->crc32); else p->crc16 = updcrc(c, p->crc16); if (p->is_zfile && p->data_len < sizeof(p->data_buf)) p->data_buf[p->data_len] = c; p->data_len++; } break; case PS_DATA_CRC: { /* Collect CRC bytes after data subframe. * CRC bytes may be ZDLE-escaped by the sender. */ if (p->crc_escaping) { p->crc_escaping = 0; c = c ^ 0x40; } else if (c == ZDLE) { p->crc_escaping = 1; break; } p->crc_recv[p->byte_idx] = c; p->byte_idx++; if (p->byte_idx >= p->crc_len) { int crc_bad = 0; if (p->frame_ind == ZBIN32) { unsigned long crc = (~p->crc32) & 0xFFFFFFFFUL; unsigned long recv = (unsigned long)p->crc_recv[0] | ((unsigned long)p->crc_recv[1] << 8) | ((unsigned long)p->crc_recv[2] << 16) | ((unsigned long)p->crc_recv[3] << 24); if (crc != recv) { print_ts(); print_dir(p->dir); fprintf(stderr, " (info) bad 32bit data crc: received %lx, calculated %lx\n",recv,crc); crc_bad = 1; } } else { unsigned long crc = updcrc(0, updcrc(0, p->crc16)); unsigned long recv = ((unsigned short)p->crc_recv[0] << 8) | p->crc_recv[1]; if (crc != recv) { print_ts(); print_dir(p->dir); fprintf(stderr, " (info) bad 16bit data CRC: received %lx, calculated %lx\n",recv,crc); crc_bad = 1; } } print_ts(); print_dir(p->dir); fprintf(stderr, " data subframe %zu bytes (%s)%s\n", p->data_len, p->data_term == ZCRCE ? "ZCRCE" : p->data_term == ZCRCG ? "ZCRCG" : p->data_term == ZCRCQ ? "ZCRCQ" : p->data_term == ZCRCW ? "ZCRCW" : "?", crc_bad ? " [BAD CRC]" : ""); if (p->is_zfile && p->data_len > 0 && !crc_bad) { /* Parse ZFILE metadata: filename\0 size mtime mode ... */ size_t namelen = strnlen((char *)p->data_buf, p->data_len); const char *fname = (char *)p->data_buf; long size_val = 0; unsigned long mtime_val = 0, mode_val = 0; if (namelen < p->data_len) { const char *rest = (char *)p->data_buf + namelen + 1; sscanf(rest, "%ld %lo %lo", &size_val, &mtime_val, &mode_val); } print_ts(); print_dir(p->dir); fprintf(stderr, " file=\"%s\" size=%ld mtime=%lu mode=0%lo\n", fname, size_val, mtime_val, mode_val); } if (p->data_term == ZCRCE || p->data_term == ZCRCW) { p->state = PS_IDLE; } else { p->state = PS_DATA; p->data_escaping = 0; p->data_term = 0; p->data_len = 0; if (p->frame_ind == ZBIN32) p->crc32 = 0xFFFFFFFFUL; else p->crc16 = 0; } } break; } case PS_X_BLOCK: /* X/YMODEM: block_num(1) + ~block_num(1) + data + crc */ if (p->byte_idx == 0) { p->x_block_num = c; p->byte_idx = 1; } else if (p->byte_idx == 1) { /* ~block_num */ p->byte_idx = 2; p->crc16 = 0; p->crc32 = 0; /* reused as checksum accumulator */ } else if (p->byte_idx < p->x_block_size + 2) { /* Data bytes - accumulate CRC and checksum */ p->crc16 = updcrc(c, p->crc16); p->crc32 = (p->crc32 + c) & 0xff; p->byte_idx++; } else { /* Done with data - c is the first CRC/checksum byte */ emit_xmodem_block(p, p->x_block_num, p->x_block_size); p->crc_recv[0] = c; p->byte_idx = 1; } break; case PS_X_BLOCK_CRC: /* Collect 2 bytes after XMODEM block data. * Try both CRC-16 (2 bytes) and checksum (1 byte). * In checksum mode, the 2nd byte is the start of the * next frame and must be pushed back. */ p->crc_recv[p->byte_idx] = c; p->byte_idx++; if (p->byte_idx >= 2) { unsigned short crc16_val = updcrc(0, updcrc(0, p->crc16)); unsigned short recv16 = ((unsigned short)p->crc_recv[0] << 8) | p->crc_recv[1]; int crc16_ok = (crc16_val == recv16); int checksum_ok = (p->crc32 == p->crc_recv[0]); if (crc16_ok) { print_ts(); print_dir(p->dir); fprintf(stderr, " (CRC-16 ok)\n"); p->state = PS_IDLE; } else if (checksum_ok) { print_ts(); print_dir(p->dir); fprintf(stderr, " (checksum ok)\n"); /* byte 1 is the start of the next frame - process it now */ p->state = PS_IDLE; process_byte(p, p->crc_recv[1]); } else { print_ts(); print_dir(p->dir); fprintf(stderr, " [BAD CRC]\n"); p->state = PS_IDLE; } } break; } } static void parser_feed(struct parser *p, const unsigned char *buf, size_t len) { for (size_t i = 0; i < len; i++) { process_byte(p, buf[i]); } } /* --- Relay */ static int set_nonblock(int fd) { int flags = fcntl(fd, F_GETFL, 0); if (flags < 0) return -1; return fcntl(fd, F_SETFL, flags | O_NONBLOCK); } static void flush_buf(struct buf *b) { b->len = 0; } static ssize_t buf_write(int fd, struct buf *b) { ssize_t n; if (b->len == 0) return 0; n = write(fd, b->data, b->len); if (n > 0) { if ((size_t)n < b->len) memmove(b->data, b->data + n, b->len - n); b->len -= n; } return n; } int main(int argc, char *argv[]) { int status; int stdin_eof = 0; int sub_stdout_eof = 0; struct buf to_sub; /* data going to SUB's stdin */ struct buf to_stdout; /* data coming from SUB's stdout */ struct parser tx_parser, rx_parser; int sub_stdin[2], sub_stdout[2]; pid_t pid; init_crc_tables(); /* put here so i'll not have to do some preprocessor magic to compile it with compilers * insisting on noreturn */ if (argc < 2) { fprintf(stderr, "Usage: zmodemsnif SUB [args...]\n"); fprintf(stderr, " SUB typically is an (l)rz/sz/rb/sb/rx/sx command.\n"); fprintf(stderr, " zmodemsnif then will dump the protocol exchange to stderr\n"); exit(1); } /* Create pipes for SUB's stdin and stdout */ if (pipe(sub_stdin) < 0) { perror("pipe"); exit(1); } if (pipe(sub_stdout) < 0) { perror("pipe"); exit(1); } pid = fork(); if (pid < 0) { perror("fork"); exit(1); } if (pid == 0) { /* Child: exec SUB */ close(sub_stdin[1]); close(sub_stdout[0]); dup2(sub_stdin[0], STDIN_FILENO); dup2(sub_stdout[1], STDOUT_FILENO); close(sub_stdin[0]); close(sub_stdout[1]); execvp(argv[1], &argv[1]); perror("execvp"); _exit(127); } /* Parent: relay */ close(sub_stdin[0]); close(sub_stdout[1]); set_nonblock(STDIN_FILENO); set_nonblock(STDOUT_FILENO); set_nonblock(sub_stdin[1]); set_nonblock(sub_stdout[0]); parser_init(&tx_parser, 0); parser_init(&rx_parser, 1); flush_buf(&to_sub); flush_buf(&to_stdout); while (1) { int ret; struct pollfd fds[4]; int nfds = 0; int pi_stdin = -1, pi_subin = -1, pi_subout = -1, pi_stdout = -1; if (!stdin_eof && to_sub.len < BUFSZ) { fds[nfds].fd = STDIN_FILENO; fds[nfds].events = POLLIN; fds[nfds].revents = 0; pi_stdin = nfds; nfds++; } if (to_sub.len > 0) { fds[nfds].fd = sub_stdin[1]; fds[nfds].events = POLLOUT; fds[nfds].revents = 0; pi_subin = nfds; nfds++; } if (!sub_stdout_eof && to_stdout.len < BUFSZ) { fds[nfds].fd = sub_stdout[0]; fds[nfds].events = POLLIN; fds[nfds].revents = 0; pi_subout = nfds; nfds++; } if (to_stdout.len > 0) { fds[nfds].fd = STDOUT_FILENO; fds[nfds].events = POLLOUT; fds[nfds].revents = 0; pi_stdout = nfds; nfds++; } if (nfds == 0) break; ret = poll(fds, nfds, -1); if (ret < 0) { if (errno == EINTR) continue; perror("poll"); break; } /* stdin → SUB */ if (pi_stdin >= 0 && (fds[pi_stdin].revents & (POLLIN | POLLHUP))) { size_t avail = BUFSZ - to_sub.len; unsigned char tmp[BUFSZ]; ssize_t n = read(STDIN_FILENO, tmp, avail < sizeof(tmp) ? avail : sizeof(tmp)); if (n > 0) { parser_feed(&tx_parser, tmp, (size_t)n); memcpy(to_sub.data + to_sub.len, tmp, (size_t)n); to_sub.len += (size_t)n; } else if (n == 0 || (errno != EINTR && errno != EAGAIN)) { stdin_eof = 1; if (to_sub.len == 0) close(sub_stdin[1]); } } /* Drain to SUB */ if (pi_subin >= 0 && (fds[pi_subin].revents & POLLOUT)) { ssize_t n = buf_write(sub_stdin[1], &to_sub); if (n < 0 && errno != EINTR && errno != EAGAIN) { /* SUB stdin broken */ close(sub_stdin[1]); to_sub.len = 0; } if (stdin_eof && to_sub.len == 0) close(sub_stdin[1]); } /* SUB stdout → stdout */ if (pi_subout >= 0 && (fds[pi_subout].revents & (POLLIN | POLLHUP))) { size_t avail = BUFSZ - to_stdout.len; unsigned char tmp[BUFSZ]; ssize_t n = read(sub_stdout[0], tmp, avail < sizeof(tmp) ? avail : sizeof(tmp)); if (n > 0) { parser_feed(&rx_parser, tmp, (size_t)n); memcpy(to_stdout.data + to_stdout.len, tmp, (size_t)n); to_stdout.len += (size_t)n; } else if (n == 0 || (errno != EINTR && errno != EAGAIN)) { sub_stdout_eof = 1; close(sub_stdout[0]); } } /* Drain to stdout */ if (pi_stdout >= 0 && (fds[pi_stdout].revents & POLLOUT)) { ssize_t n = buf_write(STDOUT_FILENO, &to_stdout); if (n < 0 && errno != EINTR && errno != EAGAIN) { to_stdout.len = 0; } } if (sub_stdout_eof && to_stdout.len == 0) break; } /* Wait for SUB to exit */ waitpid(pid, &status, 0); if (WIFEXITED(status)) return WEXITSTATUS(status); return 1; } lrzsz-0.13.1/src/canit.c0000664000175000017500000000322415255263431010503 /* 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" #include /* send cancel string to get the other end to shut up */ static void write_all(int fd, const char *buf, size_t len) { size_t off; off = 0; while (off < len) { ssize_t n = write(fd, buf + off, len - off); if (n < 0) { if (errno == EINTR) continue; /* no much we can do: ignore and hope, or exit * in any other program i'd opt for exit, but serials * ports play strange games. */ return; } off += (size_t) n; /* n > 0: short writes are completed */ } } void canit (int fd) { static const char canistr[] = { 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 }; purgeline(fd); write_all(fd, canistr, sizeof canistr); if (fd==0) { purgeline(1); write_all(1, canistr, sizeof canistr); } } lrzsz-0.13.1/src/util.c0000664000175000017500000002757415257017131010374 #include #include #include #include #include #include #include #include #include #include "zglobal.h" #include "timing.h" #ifndef _ # define _(String) String #endif const char * lrzsz_progname; unsigned int debugmode=0; struct debug_name { const char *name; unsigned int mask; }; bool lrzsz_parse_debug (const char *spec) { static const struct debug_name names[] = { { "protocol", DEBUG_PROTOCOL }, { "readline", DEBUG_READLINE }, { "transfer", DEBUG_TRANSFER }, { "window", DEBUG_WINDOWHANDLING }, { "tty", DEBUG_TTY }, { "all", DEBUG_ALL }, }; const char *p = spec; if (!spec || !*spec) return false; while (*p) { const char *end = strchr(p, ','); size_t len = end ? (size_t)(end - p) : strlen(p); unsigned int i; while (*p == ' ') p++, len--; for (i = 0; i < sizeof(names) / sizeof(names[0]); i++) { if (strlen(names[i].name) == len && strncmp(p, names[i].name, len) == 0) break; } if (i == sizeof(names) / sizeof(names[0])) { lrzsz_warning(0, _("unknown debug module '%.*s'"), (int) len, p); return false; } debugmode |= names[i].mask; if (!end) break; p = end + 1; } return true; } void lrzsz_set_progname (const char * str, const char *who) { const char *known[]={"lrz","lsz","lrb","lsb","lrx","lsx"}; const char * p = strrchr(str,'/'); char *tmp; size_t len; if (!str) { lrzsz_progname=xstrdup(who); return; } if (p && p[1]) p=p+1; else if (!p) p=str; for (unsigned int i=0;i< sizeof(known) / sizeof (const char *);i++) { if (0==strcmp(known[i],p)) { lrzsz_progname=known[i]; return; } } /* asprintf is C11, over our baseline. Well. */ len=strlen(p)+strlen(who)+4; /* 4: space ( ) null */ tmp=malloc (len); if (!tmp) { fatal_error(1,0,"out of memory"); } (void) snprintf(tmp,len,"%s (%s)",p, who); lrzsz_progname = tmp; return; } /* 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. */ LRZSZ_FORMAT_PRINTF(2,0) static void lrzsz_vwarning (int errnum, const char *format, va_list ap) { fflush(stdout); /* Print program name (or fallback) and colon-space prefix */ fprintf(stderr, "%s: ", lrzsz_progname && *lrzsz_progname? lrzsz_progname : "lrzsz"); /* Format the error message with optional arguments */ vfprintf(stderr, format, ap); /* Add system error if errnum is nonzero */ if (errnum) fprintf(stderr, ": %s", strerror(errnum)); /* Print newline and flush */ putc ('\n', stderr); fflush(stderr); } void lrzsz_warning (int errnum, const char *format, ...) { va_list args; va_start(args, format); lrzsz_vwarning(errnum, format, args); va_end(args); } /* like lrzsz_warning(), but exit with status. */ LRZSZ_NORETURN void fatal_error (int status, int errnum, const char *message, ...) { va_list args; va_start(args, message); lrzsz_vwarning(errnum, message, args); va_end(args); exit(status); } /* End-of-transfer BPS summary shared by lrz and lsz. BYTES is the number * of bytes actually transferred; SKIPPED bytes (resume) are excluded * from the bps and syslog byte count. TOTAL is only printed for * receives (pass 0 when sending). */ void report_transfer_result (int sending, const char *shortname, const char *fname, long bytes, long total, long skipped) { long bps; if (!(Verbose > 1 || enable_syslog)) return; bps = timing_bps(sending ? bytes : bytes - skipped); if (Verbose) { if (sending) vchar('\r'); if (Verbose > 1) { if (sending) vstringf(_("Bytes Sent:%7ld BPS:%-8ld \n"), bytes, bps); else vstringf(_("\rBytes received: %7ld/%7ld BPS:%-6ld \r\n"), bytes, total, bps); } } if (enable_syslog) { const char *s = fname ? strrchr(fname, '/') : NULL; s = s ? s + 1 : (fname ? fname : shortname); lsyslog(LOG_INFO, "%s/%s: %ld Bytes, %ld BPS", s, protname(), sending ? bytes : bytes - skipped, bps); } } unsigned long lrzsz_strtoul(const char *name, const char *value, const char *valid_suffixes, unsigned long int min, unsigned long int max) { char *p; unsigned long int tmp; unsigned int factor; errno = 0; tmp = strtoul (value, &p, 10); if (errno != 0) fatal_error(2,0, _("%s `%s' is larger than maximum unsigned long int"), name,value); if (value[0] == '-') fatal_error(2,0, _("%s `%s' is negative"), name,value); if (p == value) fatal_error(2,0, _("%s `%s' is invalid"), name,value); if (*p) { unsigned char c; if (!valid_suffixes || p[1] || !strchr (valid_suffixes, *p)) { fatal_error (2,0, _("%s `%s' is followed by an invalid suffix"), name,value); } c=*p; switch (c) { case 'c': factor=1; break; case 'k': factor=1024; break; case 'm': factor=1024*1024; break; case 'g': factor=1024*1024*1024; break; default: fatal_error (2,0, _("%s `%s' is followed by an invalid suffix"), name,value); } if (tmp > ULONG_MAX / (unsigned long) factor) { fatal_error(2,0, _("%s `%s' is larger than maximum unsigned long int"), name,value); } tmp *= factor; } if (tmp < (unsigned long int) min) { fatal_error(2,0, _("%s `%s' is smaller than the allowed minimum of `%lu'"), name,value, min); } if (max && tmp > (unsigned long int) max) { fatal_error(2,0, _("%s `%s' is larger than the allowed maximum of `%lu'"), name,value, max); } return tmp; } char * xstrdup(const char *s) { char *tmp = strdup(s); if (!tmp) fatal_error(1,errno,"strdup"); return tmp; } void * xmalloc(size_t size) { char *tmp = malloc(size); if (!tmp) fatal_error(1,errno,"malloc"); return tmp; } int fd_readable(int fd) { fd_set fds; struct timeval tv; FD_ZERO(&fds); FD_SET(fd, &fds); tv.tv_sec = 0; tv.tv_usec = 0; return select(fd + 1, &fds, NULL, NULL, &tv); } /* Log-forging protection for syslog and the transfer journal: escape C0 * control characters (and DEL) as \xNN; printable ASCII and bytes >=0x80 * (multi-byte UTF-8 sequences, which live entirely in 0x80-0xff) pass * through verbatim. Stops cleanly at an escape boundary when dst runs * out; dst is always NUL-terminated. Returns the written length. */ size_t sanitize_bytes(char *dst, size_t dstcap, const char *src) { size_t o = 0, i; for (i = 0; src[i] && o + 4 < dstcap; i++) { unsigned char c = (unsigned char) src[i]; if (c >= 0x20 && c != 0x7f) { dst[o++] = (char) c; } else { snprintf(dst + o, 5, "\\x%02x", c); o += 4; } } dst[o] = '\0'; return o; } /* Install a "cancel" handler for SIG unless it is being ignored; see * util.h. The identical lrz/lsz logic, moved verbatim. */ int lrzsz_install_signal (int sig, void (*handler)(int)) { struct sigaction sa, old; sa.sa_handler = handler; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; if (sigaction(sig, &sa, &old) == 0) { if (old.sa_handler == SIG_IGN) { sigaction(sig, &old, NULL); return 0; } return 1; } return 0; } /* Derive protocol and initial Verbose from the invoked name; see util.h. * From lrz.c/lsz.c, parameterized by the direction letter. */ void chkinvok (const char *s, char dir) { const char *p; p = s; while (*p == '-') s = ++p; while (*p) if (*p++ == '/') s = p; if (*s == 'v') { Verbose = 1; ++s; } if (*s == 'l') s++; /* lrz/lsz -> rz/sz */ protocol = ZM_ZMODEM; if (s[0] == dir && s[1] == 'x') protocol = ZM_XMODEM; if (s[0] == dir && (s[1] == 'b' || s[1] == 'y')) protocol = ZM_YMODEM; } /* Parse the -s/--stop-at argument; see util.h. Both programs' copies were * identical except the +N upper bound (lrz capped at LONG_MAX, lsz was * unbounded); the cap wins - it protects the time_t cast below, and * LONG_MAX seconds is beyond any practical stop time. */ time_t lrzsz_parse_stop_time (const char *myarg, void (*die)(int, const char *)) { struct tm *tm; time_t t; int hh, mm; char *nex, *mstart; time_t stop_time; if (isdigit((unsigned char) (*myarg))) { hh = strtoul (myarg, &nex, 10); if (nex == myarg) die(2, _("unparsable stop time: empty hour")); if (hh > 23) die(2, _("hour too large (0..23)")); if (*nex != ':') die(2, _("unparsable stop time")); nex++; mstart = nex; mm = strtoul (nex, &nex, 10); if (nex == mstart) die(2, _("unparsable stop time: empty minute")); if (mm > 59) die(2, _("minute too large (0..59)")); t = time(NULL); tm = localtime(&t); tm->tm_hour = hh; tm->tm_min = mm; stop_time = mktime(tm); if (stop_time < t) stop_time += 86400L; /* one day more */ if (stop_time - t < 10) die(2, _("stop time too small")); } else { stop_time = time(0) + (time_t) lrzsz_strtoul(_("-s / --stop-at"), myarg, NULL, 1, LONG_MAX); } return stop_time; } /* Pathname traversal check; see util.h. The lrz checkpath() and lsz wcs() * walks, identical except lrz's very-restricted dotfile ban, which the * RESTRICTED_LEVEL parameter expresses. */ bool lrzsz_path_component_violation (const char *name, int restricted_level) { const char *cp; /* deny absolute paths */ if (name[0] == '/') return true; /* walk path components */ for (cp = name; *cp; ) { const char *slash = strchr(cp, '/'); size_t len = slash ? (size_t)(slash - cp) : strlen(cp); if (len > 0) { if (restricted_level > 1 && cp[0] == '.') return true; if (len == 2 && strncmp(cp, "..", 2) == 0) return true; } if (!slash) break; cp = slash + 1; } return false; } /* ETA arithmetic for the progress displays; see util.h. */ void lrzsz_eta (long bps, size_t left, int *minleft, int *secleft) { *minleft = 0; *secleft = 0; if (bps > 0) { *minleft = (int) (left / (unsigned long) bps / 60); *secleft = (int) ((left / (unsigned long) bps) % 60); } } /* Last path component of PATH, or "no.name" when PATH is NULL; see util.h. * This is the derivation the old DO_SYSLOG_FNAME/DO_SYSLOG macros performed * inline (including the "no.name" fallback for a missing filename). */ const char * lrzsz_basename (const char *path) { const char *s; if (!path) return "no.name"; s = strrchr(path, '/'); return s ? s + 1 : path; } /* min_bps watchdog; see util.h. The lrz/lsz copies were identical except * the debug name and cosmetic format drift (%lu vs %ld) - both unified * here: one display threshold (Verbose>=1), one type (long). */ bool lrzsz_bps_watchdog (const char *dbgname, long last_bps, double d, long min_bps, double min_bps_time, double *low_bpsp, const char *fname) { if (last_bps >= min_bps) { *low_bpsp = 0; /* recovered */ return false; } if (*low_bpsp == 0) { *low_bpsp = d; /* arm: first violation */ return false; } if (d - *low_bpsp < min_bps_time) return false; /* below min, but not yet for long enough */ if (Verbose) vstringf(_("%s: bps rate %ld below min %ld\n"), dbgname, last_bps, min_bps); DO_SYSLOG(LOG_INFO, "%s/%s: bps rate low: %ld < %ld", lrzsz_basename(fname), protname(), last_bps, min_bps); return true; } /* -s/--stop-at deadline check; see util.h. */ bool lrzsz_stop_time_reached (const char *dbgname, time_t now, time_t stop_time, const char *fname) { /* stop_time+1 because that might be based on a measurement at 0.99s */ if (!stop_time || now < stop_time+1) return false; if (Verbose) vstringf(_("%s: reached stop time\n"), dbgname); DO_SYSLOG(LOG_INFO, "%s/%s: reached stop time", lrzsz_basename(fname), protname()); return true; } lrzsz-0.13.1/remote-build-check.sh0000664000175000017500000000041215241623405012441 #! /bin/sh PATH=~/bin:"$PATH" # fucking stupid systems _everywhere_ echo $PATH tarfile="$1.tar.gz" rm -rf lrzsz-build mkdir "lrzsz-build" || exit 1 cd "lrzsz-build" || exit 1 tar xzf "../$tarfile" || exit 1 cd "$1" || exit 1 ./configure -q make -s V=0 buildcheck+ lrzsz-0.13.1/NEWS0000664000175000017500000007207515260416753007166 Version 0.13.1 - October 2026, Uwe Ohse This release only removes the ZMODEM 8th-bit escaping capability, which was recently implemented, and not part of any announced release, after Stephen Hurd alerted me to the fact that the implementation was incompatible with the (proprietary and undocumented) Omen implementation. The incompatibility would have made the session mutually undecodable in both directions. The option's practical benefit (escaping bytes >= 0x80, which keeps bit 7 set and thus cannot cross 7-bit links) is negligible: the historically problematic bytes (XON/XOFF lookalikes) are escaped by default, and transports that act on the remaining high bytes are practically extinct. Thank you, Stephen. Version 0.13.0 - September 2026, Uwe Ohse This release fixes a large number of security issues. Two of the changes warrant an immediate update if you use lrz to receive files from not perfectly trustworthy senders. Security fixes: * if PUBDIR support was NOT compiled in, the restricted mode path check of lrz did allow uploads to any directory the user has write access to. This was a security bug found by Tristan Madani (Talence Security). Likewise lsz did not correctly check paths in the restricted mode if PUBDIR support was not compiled in. * a buffer overflow was fixed in lrz, in which the attacker could quite easily cause an overflow in a malloc()ed buffer. This was a security bug found by Tristan Madani (Talence Security). Note: this stems from the original public domain rzsz suite (80s). * the lrz pipe execution feature was removed. feature: invoked as 'lrztar' lrz would have called tar through the shell with the (attacker controlled) filename as argument, without escaping it, allowing arbitrary command execution. This feature/insecurity was only accessible if the installer appended some string to the lrz (or rz) commands name. This was a security bug found by Tristan Madani (Talence Security). Note: this stems from the original public domain rzsz suite (80s). * CVE-2018-10195 fixed, in which lsz could leak information to the receiving attacker if that turned off crc32. Impact: low to medium. * Overlong pathnames (> 960 + X bytes, with X depending on metadata) might have caused a buffer overflow in the sending programs (Y- and ZMODEM), which could have leaked information to the receiver. Note: this stems from the original public domain rzsz suite (80s). * lsz now reads input files always via stdio instead of mmap(): a file truncated during the transfer fails with a read error instead of killing the sender with SIGBUS. Buffered I/O benchmarks at parity or better. Security: After removal of the mmap code, fuzzing showed that an illegal offset during a resumed transfer might have caused a remote denial of service (reliable, deterministic) and a potential out-of-bounds read within the 4 GiB following the start of the file. This could have caused an information leak. * an attacker could have created a setuid/setgid/sticky file when restricted mode was not used. Note: this stems from the original public domain rzsz suite (80s). * the lrz path name check would have allowed to create a filename `..`, which may or may not be a security problem with pre-created symlinks for `..`. Note: this stems from the original public domain rzsz suite (80s). * when the lrz -B / --bufsize "auto" option was used, an attacker could have wasted up to 2 GB of memory while keeping the connection open. This was a remotely triggered denial of service attack (in a rare configuration). * the lrz file CRC check could have run into an endless loop. This was a possible remotely triggered denial of service attack. * some denial of service possibilities were fixed: - a misbehaving receiver could cause an endless loop when the sender used a transmit window (80s). - a misbehaving receiver could cause an endless loop after causing a resynchronization (80s). - a misbehaving receiver could cause an endless loop during the YMODEM filename exchange (80s). * a number of possible security problems have been fixed: - double fclose in lrz. - a write before a buffer in lrz (80s). - a use of uninitialized memory in lsz (80s). Security related changes: * the lrz remote command execution feature (receiving remote commands) was removed. feature: a sender could have lrz execute that command through the shell (ZCOMMAND). This was a feature of the original public domain zmodem, and by default disabled in lrzsz since sometime in the 90s, by hiding it behind the -C or --allow-commands options. * the sending of remote commands (lsz -c / -i, "the fifth form") is deprecated and will be removed in a future release. The sending side is kept for compatibility with old ZMODEM implementations (OMEN zmodem and older lrz) that still execute received commands. New setups should not use these options. * lsz no longer sends the "rz\r" auto-download trigger. Modern practice is to watch the data stream for a ZRQINIT frame instead. This also stops lsz from writing protocol-unrelated bytes to the transfer line. * the PUBDIR feature was removed from lsz and lrz. This feature of the restricted mode allowed uploads not only from the current directory, but from the compiled in PUBDIR (/usr/spool/uucppublic, typically), and it allowed uploads into that, too. If you really need something like this, you can add a symlink to the current directory. * lrz in very restricted mode now disallows invisible leading directories, too (`dir/.subdir/filename` was allowed before). Note: this stems from the original public domain rzsz suite (80s). * the TCP mode was removed (no authentication, no encryption). * the -U/--unrestrict option has been removed from both lrz and lsz. Rationale: Security-relevant options cannot be turned off: whoever can add -U to a command line can equally well drop it, so the option provided no protection - only a trap. The one legitimate use, keeping partially received files on transfer error, lives on as lrz's new --keep-incomplete option (below). Other changes: * autotools updated. GNU automake 1.17, GNU Autoconf 2.72. * the timesync protocol support was removed. No other zmodem suite still in use implemented it, and the function to set the receivers time needed root rights - which, given the facts listed above, lrz should not have. * the `-d / --dot-to-slash` option (DOS 8.3 filename transformation) was removed (it collided with the now extended pathname checking). * the new option `--sync-transfer` forces a ZCRCW for every transmitted subpacket (cost: one round trip for each subpacket). It makes it possible to detect and recover if the transport layer silently drops a packet, which is undetectable in the (default) streaming mode. This works around a protocol limitation (neither does a subpacket have a position information nor is the position included in the CRC, so a silent loss is possible). This option is only needed on transports that can silently drop a packet, for example a packet radio or other datagram link that loses packets without retransmitting them, or a line that overruns its buffer when flow control fails. It is unnecessary on transports that retransmit internally, and on transports that only corrupt individual characters (noisy modem or serial lines). * on 32bit systems the programs are now able to transfer files with sizes in the range 2GB to just under 4GB (64bit systems did not have that limit). Note: lrzsz's 31-bit file-size limit stems from the original public domain rzsz suite (80s). The same limit existed in later published omen technology sources, and at least one independent implementation. Expect interoperability problems when transferring files of that size. * both main programs now can write a journal. * documented the scope of the file management options (-+, -E, -H, -n, -N, -p, -y): they apply to ZMODEM (partially to YMODEM) and are ignored in XMODEM mode, as they always were. The -D / --null option now also works in XMODEM mode. * the ASCII conversion option (-a / --ascii, ZMODEM ZCNL conversion) is deprecated, and kept for compatibility for now, but will be removed in a future release. The current ZMODEM documentation marks ZCNL as historic, because transfers using ASCII conversion cannot be resumed, and because the conversion is questionable (it removes every carriage return and cuts the file short at the first CPM EOF character / ^X). * likewise deprecated is the acting on the historical full st_mode in the file metadata. A sender transmitting file type bits (e.g. 0100644 instead of 0644) still makes lrz force binary transfer for that file (which overrides -a) and skip the lower-casing of the file name. The current ZMODEM documentation states this should neither be sent nor acted upon. lrzsz keeps it for compatibility and will likely remove it in a future release. The received mode is filtered as before (type bits stripped, umask applied). * the -f / --full-path option of lsz (transmit the path instead of the bare filename) is deprecated and will be tightened in a future release. The current ZMODEM documentation states that a sender must not transmit absolute pathnames or ".." components. The historical behavior (OMEN sz and derivatives) allowed both, so lsz still keeps it for compatibility. A future release will keep allowing relative paths but will reject absolute paths and ".." components with a fatal error. On the receiving side lrz confines received filenames to the receiving directory regardless of what the sender transmits. New setups should use plain relative filenames. * the ZMODEM 8th-bit escaping capability (ESC8/TESC8) is now implemented: the new option -7 / --escape-8bit makes lsz escape every byte >= 0x80 (as DLE plus the byte XORed with 0x40) and advertise the TESC8 flag in ZSINIT, and makes lrz advertise ESC8 in ZRINIT. A peer's request is always honored: lsz escapes high bytes when the receiver sets TESC8, and lrz escapes the bytes it transmits when the sender sets TESC8, even without -7. Previously such requests were silently ignored (lsz sent unescaped bytes the peer had explicitly asked to have escaped), and the receiver-side decoder rejected the escaped forms of data bytes >= 0xc0, so transfers with such peers could not work. The option is only needed on lines that corrupt the 8th bit, or to force the capability advertisement. * lrzsz now measures transfer durations (bps, ETA, the -m/--min-bps watchdog) with a monotonic clock instead of the wall clock. NTP steps or manual date changes during a transfer no longer produce absurd bps values or stall the min-bps abort. The -s/--stop-at deadline is intentionally still wall clock (it is specified in wall-clock terms). * lrz now reports the reason why a transfer was aborted at verbosity level 1, instead of 3. This now matches lsz. * ^C during a ZMODEM transfer no longer interrupts the sender in a read via longjmp. lsz notices the ^C at the next loop checkpoint and attempts the same resync as before. This removes one source of undefined behaviour. * lsz could crash (SIGSEGV) when the receiver's ZRINIT frame (the "file complete, next file please" answer) arrived during lsz's ACK wait on an error-prone line. Found by the test suite on Alpine Linux. * lrz no longer dies with SIGPIPE (exit 141) when the session is already over (lost final "OO", or a refusal whose sender left). * lrz has a new --keep-incomplete option: on a transfer error the partially received file is kept instead of deleted (the default), e.g. to resume the transfer later with -r. Interrupted transfers (Ctrl-C, hangup) always keep the partial file, as before. * lrz and lsz documentation now describes the restricted security model as named levels: "restricted" (lrz default. to bring lsz to this level use -R, ZMODEM_RESTRICTED or a restricted shell) and "very restricted" (lrz only, via -R or ZMODEM_RESTRICTED). Remote command execution is denied unconditionally in lrz, in every mode. With -U gone, restricted mode cannot be lowered by any option. * on error recovery (ZRPOS) lsz now flushes its pending output with tcflush(TCOFLUSH), as the current ZMODEM documentation recommends, so a buffered modem or serial driver does not keep delivering stale data the receiver must discard. This is a no-op on pipes and ptys. * lrz advertises the CANBRK capability in ZRINIT only when the transfer line is a terminal, as the current ZMODEM documentation recommends. Formerly it was advertised unconditionally. Attempts to send a break on a line that cannot do it (e.g. a pipe) are detected and skipped. * lrz has a new option -A --segmentsize NNN. This turns on `Segmented Streaming' if the sender supports it. This ZMODEM feature was originally intended to allow transfers to machines unable to do overlapping serial and disk I/O. Today it is useful to limit the damage caused by line errors when the sender streams without asking for an ACK. lsz, the original public domain zmodem sz and crzsz csz always enforced segmented streaming - which is why lrzsz and other zmodem implementations stemming from the same source usually behave much better on faulty lines than other implementations optimized for the perfect world. * syslog support is now always compiled in. Earlier releases had configure options to deselect it. * support for many old systems has been removed. The new support policy is this: - I aim for POSIX standards of the last 20 years. - I aim for the next older C standard. Currently: POSIX.1-2008, C99. * the german translation was removed, because it was seriously out of date. Translations are welcome, just my own ill-maintained one wasn't. I'm willing to work with translators, not only to include translations, but also to make your job easier - but I am not going to burden myself with doing translations. * the dejagnu testsuite was removed. An update broke it, and i decided to work on the older internal check script, because i found it easier to extend for the tracing i need. * the internal test suite, check.lrzsz, was extended. * speaking about tracing: included in the sources is zmodemsnif.c, a ZMODEM protocol sniffer / tracer. Documentation is in doc/zmodemsnif.txt. * lsz now answers a receiver's ZABORT frame (and ZFERR, which the ZMODEM documentation defines as equivalent) with the ZFIN sequence that the documentation requires, followed by the usual clean end-of-session handshake. Formerly lsz answered with the cancel sequence, as the OMEN ZMODEM implementations also did. The result is the same, but peers expecting the documented reply now get it. Also a receiver that dies instead of answering no longer stalls the closing handshake. * lsz now answers ZABORT/ZFERR in every phase of the session instead of retrying: during the handshake, during the file header exchange (where a retry against a receiver with a failing filesystem is pointless), during the data phase, and in remote command mode (where a receiver that aborted would previously have been sent the command up to 20 times). ZABORT is counted as a user cancel, ZFERR as a file error. * the --stop-at option only worked if verbose mode was active. The '-s +N' case did stop after less between N-1 and N seconds (due to integer calculation). It now stops between N+1 and N+2 seconds (the check compares integer seconds, so the deadline can fire slightly late rather than early). * interoperability with senders that do not pace their retransmissions (zmtx 1.02 and friends): lrz now answers a duplicate ZEOF between files with ZRINIT immediately, and lsz answers a receiver's ZRPOS for the position it has already sent with ZACK (the original specification never specified which answer a ZCRCW subpacket gets. zmrx 1.02 answers with a ZRPOS, which forced lsz into a slow recovery loop). * full compatibility tests were done against Synchronet sexyz v3.6, lrzsz-0.12.21rc, crzsz-1.13, rzsz-3.73 and zmtx-zmrx-2.06. * manual compatibility tests were done against DSZ in a dosbox. What was tested worked correctly. It is possible, though not likely, that a future release will expand upon that. * compile tested on Debian GNU/Linux, Alpine Linux and OpenBSD. * compile tested with gcc and clang. * included: ZMODEM specification / documentations. See doc/README * performance improvements and regressions: Generally performance on bad lines has improved, and transfers with lrzsz will succeed on faulty lines where other implementations give up. Performance on errorfree lines conditions may be worse than before, depending on the network buffering and delay, though the impact is limited. On a line with a high delay (ping time) the precautions against high packet loss rates result in a loss of performance. Fun fact: the same implementations leading the performance score on a 115200 bps line with a 20ms delay are the ones losing on the 1mbit line with 250ms delay line. * a personal note: I had abandoned the project for about 27 years, from 1999-08-22 to 2026-08-10, because the existing package was good enough and i had no use for lrzsz anymore after 2002 or so. Later I didn't even have a serial port to test on, i didn't even once use C after 2005, and additionally i'm not dealing with UNIX incompatibility issues anymore. I don't miss all that. Today i deal with PHP, HTML, CSS, Javascript, SQL, and go. The package refused to die. CVS-2018-10195 came, and i wondered for a while why nothing worse had been detected. But then i decided that lrzsz is not my problem anymore. It had to be the problem of someone else. Then Tristan contacted me on 2026-07-27, which was 8 days after i did a major screwup at https://naturfotografen-forum.de by updating the production system to a software version which should been tested and debugged for at least 2 or 3 additional weeks, and which contained one feature which made a rollback infeasible. I saw his mail, and thought 'Uh, uh… this is not a minor thing'. But i had no time, because the forum is more important to me. 14 days later i found the time, and the real fun started. I needed far less time to fix the three vulnerabilities Tristan reported than i needed to fix the autoconf stuff so i could compile the package. Updating the gettext stuff also took hours, and i wasted half an evening trying to update the dejagnu test suite (which i failed at). Then i sat back, looked at the code, decided what compatibility hacks to throw out, and started to clean up the mess. Then i asked qwen (coder next) to block my graphics card for a few days, i mean, i asked the LLM to review the code (the prompt was somewhat longer than that), which on my 4 GB graphics card took a long time. In the meantime i found the old recordxyz tool (a protocol tracer), and even the version 2 of it (a total rewrite which was much worse than the original, which wasn't very good to begin with), took some parts from them, and created zmodemsnif. When that was about ready, i gave up on the local qwen. It had produced some interesting findings, but my machine is too slow for that. I used a cloud kimi-k2.6 to do a review, and later used glm-5.2, kimi-k3, some qwen and glm-5.3-flash for the same. For all you LLM haters or sceptics: i get it. I hate these LLM companies with a passion. These people steal in the internet (and from my own server, too), and give nothing back, beyond nebulous claims and lies and server overloads. They spend billions to improve LLMs, which should be spend to improve people and society. The list of reasonable complaints is long. I get all that. But i've run out of people i can work with. The only programmer whom i could have relied on reviewing my code, and any changes, in time has died a few years ago (and i would have had to pay for by reviewing his code, which is something i tried to avoid, because his stuff was really complicated - lrzsz is quite simple compared to that). And i absolutely _needed_ some kind of review. I was out of practise with C and the toolchain, and given the sorry state of the C language (why, oh why, isn't '-Wturn-on-all -Werror' the default?) it would have been irresponsible to not use an LLM for that. This kind of review is something LLMs are good at, and they found more than a few security issues in the code (i also found some, but not that many), and quite a few bugs. The core code, any code in the installed programs, is 100% human written (i'm lazy and hate commenting, and copied some LLM generated comments, but no code). The code of the programs not installed by default (which are not very useful for anyone but the maintainer) is partially or mostly human written: - zmodemsniff.c is about 75% human written (maybe more, i don't care). - linesimulator.c is about 50% human written. [this tool is for the test suite, and simulates different line types with different error modes] - zmodemfuzz.c is about 15% human written, maybe a bit less. The reason the later has been written mostly by the LLMs is that i'm not feeling able to think as attacker and defender at the same time. Maybe i could - but i would never bet on it. I also would never bet on the fuzzer being able to detect all possible holes, but it did help me to fix many border cases. If you don't want to use lrzsz because of the LLM usage, you don't have to. I understand that. Maybe you can backport the security fixes to lrzsz-0.12.21rc - but i will not do that. This release did cost about 6 weeks of my spare time, including some extra time during my vacation. In addition i spent a few days rewriting the ZMODEM specification. If you feel that i should not have spent that much time on this old package: you are not alone. If you feel you should pay something for this: please consider donating to some international help organization, for example Amnesty International, International Red Cross and Red Crescent Movement, Médecins Sans Frontières (Doctors Without Borders) or UNICEF. Version 0.12.21rc - August 1999, Uwe Ohse * IEXTEN disabled ("Enable implementation-defined input processing."). * the tcp inband option (--tcp) was removed. * lsz crashed when trying to transfer 0 byte small files with ZMODEM. 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 ) * 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 ) * `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 ) 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). lrzsz-0.13.1/man/0000775000175000017500000000000015260431651007301 5lrzsz-0.13.1/man/lrz.10000664000175000017500000003755415260223006010121 '\" '\" 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 [\- "\ +abeOpqRtuUvy" ] .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. .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 (lsb .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). Deprecated: this uses the ZCNL file conversion option, which current ZMODEM documentation marks as historic and recommends against. ASCII conversion also makes a transfer impossible to resume. It is kept for compatibility with 40 year old peers, but new setups should transfer in binary mode and convert locally if needed. Note: for compatibility with old senders, a file mode sent with the file metadata that includes file type bits (the historical full .BR st_mode ) silently forces binary transfer for that file, overriding this option, and disables the lower-casing of received file names. This legacy behavior is deprecated as well and will likely be removed in a future release. .TP .B "-A, --segmentsize NNNN" Tell the sender to turn on `Segmented Streaming' with a buffer / window of NNNN bytes. If the sender supports it, it will ask for an ZACK packet every NNNN bytes. This somewhat limits throughput on perfect lines, and can vastly improve performance on faulty lines. NNNN can range from 0 to 65535 (this is a protocol limitation). '0', the default, tells the sender that the receiver does not wish to use segmentation. Note that `lsz', the sending program of this package, does then use its own default of 16kb. Support for segmented streaming is not universal. .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 is 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. .TP .B "-c, --with-crc" XMODEM only. Use 16 bit CRC (normally a one byte checksum is used). .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. (ZMODEM and YMODEM only) .TP .B "-h, --help" give help screen. .TP .B "-H, --crc-check" (ZMODEM only; not usable with YMODEM, which lacks the required protocol exchange) Accept and transfer files if the file lengths and/or the CRCs differ. .TP .B "-J FILE, --journal FILE" Append a transfer-statistics line to .B FILE for each file received. The line consists of key=value pairs including timestamp, direction (dir=rx), filename, status, byte counts, duration, and throughput. The file is created if it does not exist and appended to on each invocation. .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). The check is per file: the timer resets at the start of each file. .TP .B "-M N, --min-bps-time" Used together with --min-bps. Default is 120 (seconds). The timeout is per file: a slow transfer of one file does not count toward the next file's timeout. .TP .B "-n, --newer" (ZMODEM and YMODEM) Accept file if the destination file does not exist. Otherwise, accept the file, overwriting the destination, if the source file is newer than the destination file. .TP .B "-N, --newer-or-longer" (ZMODEM and YMODEM) Accept file if the destination file does not exist. Otherwise, accept the file, overwriting the destination, if the source file is newer or longer than the destination file. .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 the very restricted mode. lrz will not create directories or files with a leading dot, and will not overwrite any existing file. This option always enables the very restricted mode, even if it was downgraded before (e.g. by combining it with the .B ZMODEM_RESTRICTED environment variable). See .B SECURITY for the security model and the description of the restricted levels. .TP .B "--keep-incomplete" Keep partially received files when a transfer fails with an error. The default is to remove incomplete files; this option is the opt-in for keeping them, e.g. to .B --resume the transfer later, or when receiving on a private system where the partial data is worth more than the disk space. Interrupted transfers (Ctrl-C, modem hangup) always keep the partial 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. The deadline is tracked with a one-second granularity because of the way the check is implemented (the .B N argument is parsed before any data flows and compared against integer seconds afterwards); the transfer stops during the second after the deadline is reached, so a transfer stops within about .B N+1 to .B N+2 seconds. .TP .B "--syslog[=off]" turn syslogging on or off. Syslog is on by default. .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 "-U, --unrestrict" Removed. Security-relevant options cannot be turned off; see .B SECURITY and the .B HISTORICAL NOTES section. Use .B --keep-incomplete if you want failed transfers to leave the partial file in place. .TP .B "--version" prints out version number. .TP .B "-v, --verbose" Verbose output to stderr. With one .BR v , a summary (file names, transfer result, error events) is printed. With two .BR v s, progress reports are also shown. More .BR v s are accepted but have no effect. Since version 0.13 detailed protocol debugging is available with .B \-\-debug instead. .TP .B "\-\-debug=MODULES" Enable debug output for the comma separated list of MODULES on stderr. Known modules: "protocol" (ZMODEM frame state machine), "readline" (line reader: select/read calls, timeouts, hex dump), "transfer" (file transfer state machine), "windowhandling" (adaptive block length and window logic, ZMODEM sender only), "tty" (terminal mode changes). The special name "all" enables all. .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. (Ignored in XMODEM mode, where lrz always writes to the given pathname.) .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. Security-relevant options can be enabled but never disabled: restricted mode cannot be turned off, and the very restricted mode cannot be downgraded. Remote command execution is always denied, in every mode. lrz has two restricted levels: .TP .B restricted (the default) 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 (see .B --keep-incomplete for an exception). .TP .B very restricted Additionally disables creation of subdirectories and files with a leading dot, and refuses to overwrite existing files instead of skipping them. Entered by setting the environment variable .B ZMODEM_RESTRICTED or giving the .B R option — in either case, and regardless of the order in which options are given. .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 very restricted mode if the variable is set. Giving the .B R option also enables the very restricted mode. .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. 32 bit CRC code courtesy Gary S. Brown. Directory creation code from John Gilmore's PD TAR program. .SH BUGS Programs that do not properly implement the specified file transfer protocol may cause .I lrz to "hang" the port for a minute or two. Every reported instance of this problem has been corrected by using a 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 file management options (\-+, \-E, \-H, \-n, \-N, \-p, \-y) are ZMODEM features (with partial YMODEM support); they are ignored in XMODEM mode. XMODEM always writes to the pathname given on the command line \- the restricted mode checks still apply. The ASCII option\'s CR/LF to NL translation merely deletes CR\'s. .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 CAVEATS The ZMODEM protocol uses 32-bit fields for file positions, imposing a hard limit of 4 GiB on transfer size. Furthermore, many ZMODEM implementations derived from the original Omen Technology codebase (including .IR crzsz , .IR rzsz , .IR lrzsz older than version 0.13, and other 1990s variants) and also at least some independent implementation use signed .I long internally, which on 32-bit platforms limits correct operation to files below 2 GiB. .B lrz itself handles positions up to 4 GiB correctly, but interoperation with older or 32-bit senders may fail for files larger than 2 GiB. .SH "HISTORICAL NOTES" The following options have been removed and are no longer functional. Using them prints an error message and exits. .TP .B "-C, --allow-commands" Allowed remote command execution via ZMODEM. Removed because of weak security: it relied on the parent process to only set this option when the remote user is perfectly trustworthy. .TP .B "-S, --timesync" Time synchronization. Removed because no other still-available implementation supported it, and setting the local time would have required root privileges. .TP .B "-U, --unrestrict" Turned off restricted mode (impossible under a restricted shell). Removed because security-relevant options cannot be turned off: whoever can pass \-U can equally well drop it from the command line, so the option provided no protection — only a trap. The one legitimate use, keeping partially received files on error, lives on as the .B --keep-incomplete option. See .BR SECURITY . .TP .B PUBDIR The .B PUBDIR environment variable and the associated public directory feature (restricting file transfers to .IR PUBDIR , usually .IR /var/spool/uucppublic ) have been removed. .TP .B "-B auto" The .B auto argument to .B -B / --bufsize (formerly buffering the entire file in memory) has been removed. No performance benefit was observed on modern systems. lrzsz-0.13.1/man/Makefile.in0000664000175000017500000003741015260417112011267 # Makefile.in generated by automake 1.17 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2024 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) am__rm_f = rm -f $(am__rm_f_notfound) am__rm_rf = rm -rf $(am__rm_f_notfound) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_append_compile_flags.m4 \ $(top_srcdir)/m4/ax_append_flag.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_compiler_flags_cflags.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/build-to-host.m4 $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/lib-ld.m4 \ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(dist_man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \ $(top_srcdir)/mkinstalldirs DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DIST_TARBALL = @DIST_TARBALL@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LRZSZ_CFLAGS = @LRZSZ_CFLAGS@ LRZSZ_LDFLAGS = @LRZSZ_LDFLAGS@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MIN_POSIX_C_STD = @MIN_POSIX_C_STD@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUPPORTED_C_STDS = @SUPPORTED_C_STDS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WARN_CFLAGS = @WARN_CFLAGS@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__rm_f_notfound = @am__rm_f_notfound@ am__tar = @am__tar@ am__untar = @am__untar@ am__xargs_n = @am__xargs_n@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localedir_c = @localedir_c@ localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # dist_ prefix: man pages are NOT distributed automatically without the dist_ prefix (see automake manual). dist_man_MANS = lrz.1 lsz.1 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign man/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man1: $(dist_man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(dist_man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -$(am__rm_f) $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man1 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am uninstall-man \ uninstall-man1 .PRECIOUS: Makefile # 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: # Tell GNU make to disable its built-in pattern rules. %:: %,v %:: RCS/%,v %:: RCS/% %:: s.% %:: SCCS/s.% lrzsz-0.13.1/man/Makefile.am0000664000175000017500000000021115256505316011254 # dist_ prefix: man pages are NOT distributed automatically without the dist_ prefix (see automake manual). dist_man_MANS = lrz.1 lsz.1 lrzsz-0.13.1/man/lsz.10000664000175000017500000004655115260223012010114 '\" '\" 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" .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 multiple operating systems. .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). This increases throughput over error free channels (direct connection, X.PC, etc.) by not acknowledging each transmitted sector. The receiver included in this package does not request YMODEM-g. 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 if 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/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. This form (and thus the .BR \-c / \-i options) is deprecated and will be removed in a future release: it asks the receiving program to execute COMMAND, which only old ZMODEM implementations still do. 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 "-9" Short form of --start-8k. .TP .B "--start-8k" Start with 8KB blocksize. Like --try-8k. .TP .B "-4, --try-4k" Try to go up to 4KB blocksize. (ZMODEM only). .TP .B "-5" Short form of --start-4k. .TP .B "--start-4k" Start with 4KB blocksize. Like --try-4k. .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. Deprecated: for ZMODEM this requests the historic ZCNL conversion, which current ZMODEM documentation marks as deprecated. It is kept for compatibility with old peers; new setups should use binary transfer. .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. .TP .B "-c COMMAND, --command COMMAND" Send COMMAND to the receiver for execution, return with COMMAND\'s exit status. Deprecated: this asks the .B receiving program to execute COMMAND. It is kept for compatibility with old ZMODEM implementations (OMEN zmodem and older .BR lrz ) that still execute received commands, and will be removed in a future release. New setups should not use it; modern receivers (including lrz) never execute commands and answer with a failure status. .TP .B "-C N, --command-tries N" Retry to send command N times (default: 11). Only meaningful together with .BR \-c / \-i , which are deprecated. .TP .B "--delay-startup N" Wait .B N seconds before doing anything. .TP .B "--no-unixmode" Send a mode field of 0 in the ZMODEM file header instead of the file's Unix permission bits. By default, .B lsz transmits the full .I st_mode as returned by .BR fstat (2), including permission bits (rwx) and setuid, setgid, and sticky bits. The recipient may, and likely will, modify the mode before applying it \(em for example, .I lrz masks the received mode with .B 0777 in normal operation (stripping setuid, setgid, and sticky) and with .B 0666 under restricted shell (also stripping execute bits). Use .B --no-unixmode to leave permission selection entirely to the receiver's defaults (or to keep that information for yourself). .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. Deprecated: the current ZMODEM documentation states that a sender MUST NOT transmit absolute pathnames or .B .. components. This option is kept for compatibility with the historical behavior (OMEN .B sz and derivatives, and for mirroring directory trees with relative paths); a future release will continue to allow relative paths but will reject absolute paths and .B .. components with a fatal error. New setups should use plain relative filenames. .TP .B "-h, --help" give help. .TP .B "-H, --crc-check" (ZMODEM) Accept and transfer files if the file lengths and/or the CRCs differ. .TP .B "-i COMMAND, --immediate-command COMMAND" Send COMMAND to the receiver for execution, return immediately upon the receiving program's successful reception of the command. Deprecated: for the same reasons as .BR \-c ; kept for compatibility with old ZMODEM implementations that still execute received commands, will be removed in a future release. .TP .B "-J FILE, --journal FILE" Append a transfer-statistics line to .B FILE for each file sent. The line consists of key=value pairs including timestamp, direction (dir=tx), filename, status, byte counts, duration, and throughput. The file is created if it does not exist and appended to on each invocation. .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). The check is per file: the timer resets at the start of each file. .TP .B "-M N, --min-bps-time" Used together with --min-bps. Default is 120 (seconds). The timeout is per file: a slow transfer of one file does not count toward the next file's timeout. .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 "--sync-transfer" (ZMODEM) Integrity mode: wait for the receiver's acknowledgement after every data sub-packet (a ZCRCW round trip), instead of streaming. On a packetized transport an entire sub-packet together with its terminator and CRC can be silently swallowed, which plain streaming cannot detect (the CRC is position independent and the frame position is only checked at the start of a ZDATA frame). The cost is one round trip per sub-packet, causing a substantial throughput loss on slow or high-latency lines. This option is only needed on transports that can silently drop a contiguous chunk of the byte stream, for example a packet radio or other datagram link that loses packets without retransmitting them, or a line that overruns its buffer when flow control fails. It is pointless on transports that hide packet loss by retransmitting internally, so that no loss reaches the byte stream (TCP, ISDN, X.25), and wasteful on transports that only corrupt individual characters (noisy modem or serial lines): there the CRC catches the damage and the normal resync heals it, streaming is safe and faster. .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/or subdirectories thereof. See .BR SECURITY . .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. The deadline is tracked with a one-second granularity because of the way the check is implemented (the .B N argument is parsed before any data flows and compared against integer seconds afterwards); the transfer stops during the second after the deadline is reached, so a transfer stops within about .B N+1 to .B N+2 seconds. .TP .B "--syslog[=off]" turn syslogging on or off. Syslog is on by default. .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 "-u, --unlink" Unlink the file after successful transmission. .TP .B "-U, --unrestrict" Removed. See .BR SECURITY . .TP .B "-w N, --windowsize N" Limit the transmit window size to N bytes (ZMODEM). .TP .B "-v, --verbose" Verbose output to stderr. With one .BR v , a summary (file names, transfer result, error events) is printed. With two .BR v s, progress reports are also shown. More .BR v s are accepted but have no effect. Since version 0.13 detailed protocol debugging is available with .B \-\-debug instead. .TP .B "\-\-debug=MODULES" Enable debug output for the comma separated list of MODULES on stderr. Known modules: "protocol" (ZMODEM frame state machine), "readline" (line reader: select/read calls, timeouts, hex dump), "transfer" (file transfer state machine), "windowhandling" (adaptive block length and window logic, ZMODEM only), "tty" (terminal mode changes). The special name "all" enables all. .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 "-g, --ymodem" use ZMODEM protocol. .TP .B "-Z, --zmodem" use ZMODEM protocol. .PD .SH SECURITY Restricted mode restricts pathnames to the current directory and/or subdirectories thereof: absolute pathnames and references to a parent directory are not sent, and lsz refuses to send remote commands (the \-c/\-i options). 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 .B ZMODEM_RESTRICTED is set. Restricted mode cannot be turned off; the .B U option has been removed (see .BR "HISTORICAL NOTES" ). .SH ENVIRONMENT .TP .B ZNULLS may be used to specify the number of nulls to send before a ZDATA frame. This is a 1980s modem workaround and of questionable benefit today. It is kept for compatibility. .TP .B SHELL lsz recognizes a restricted shell if this variable includes .I "rsh" or .I "rksh" .TP .B ZMODEM_RESTRICTED lsz enters restricted mode if the variable is set. .SH EXAMPLES .ne 7 .B "ZMODEM File Transfer" .br .B "% sz \-a *.c" .br This single command transfers all .c files in the current directory with conversion .RB ( \-a ) to end of line conventions appropriate to the receiving environment. .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 if needed. .B "XMODEM File Transfer" .br % .B "sx \-a foo.c" .br .B "ESC" .br .B "rx foo.c" .br The above three commands transfer a single file from the local to the remote machine while .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 lrz, ZMODEM.DOC, YMODEM.DOC, Compile time options required for various operating systems are described in the source file. .SH BUGS 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. 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. .SH WORKAROUNDS A few high speed modems have (had?) a firmware bug that drops characters when the direction of high speed transmission 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 were typical. .SH CAVEATS The ZMODEM protocol uses 32-bit fields for file positions, imposing a hard limit of 4 GiB on transfer size. Furthermore, many ZMODEM implementations derived from the original Omen Technology codebase (including .IR crzsz , .IR rzsz , .IR lrzsz older than version 0.13, and other 1990s variants) and also at least some independent implementation use signed .I long internally, which on 32-bit platforms limits correct operation to files below 2 GiB. .B lsz itself handles positions up to 4 GiB correctly, but interoperability with older or 32-bit receivers may fail for files larger than 2 GiB. .B lsz prints a warning when sending files larger than 2 GiB; use .B -q to suppress it. .SH "HISTORICAL NOTES" When a receiver ends the session with a ZABORT frame (or ZFERR, which the ZMODEM documentation defines as equivalent), .B lsz replies with the ZFIN sequence the documentation requires and then ends the session cleanly. Older lsz versions, as well as OMEN-derived senders answered with the cancel sequence instead. The outcome (transfer aborted, exit status 0x80) is the same, so this only matters to peers that inspect the reply. .TP The following options and features have been removed and are no longer functional. Using the options prints an error message and exits. .TP .B "-S, --timesync" Time synchronization. Removed because no other still-available implementation supported it, and setting the local time would have required root privileges. .TP .B "-U, --unrestrict" Turned off restricted mode (impossible under a restricted shell). Removed because security-relevant options cannot be turned off: whoever can pass \-U can equally well drop it from the command line, so the option provided no protection — only a trap. See .BR SECURITY . .TP .B PUBDIR The .B PUBDIR environment variable and the associated public directory feature (restricting file transfers to .IR PUBDIR , usually .IR /var/spool/uucppublic ) have been removed. .TP .B "-d, --dot-to-slash" Converted dots to slashes in pathnames and truncated filenames to 8.3 format for MS-DOS / CP-M compatibility. Removed because these systems are obsolete. Use .B -f / --full-path to send full pathnames. lrzsz-0.13.1/COMPATABILITY0000664000175000017500000000253006607440600010371 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. lrzsz-0.13.1/ChangeLog0000644000175000017500000012207115260420621010214 2026-10-04 Uwe Ohse at akiar * src/lrz.c, src/lsz.c, src/timing.c: comment-only change: zmodem-current.txt to zmodem-wip.txt * doc/zmodem-wip.txt: updated the wip spec after Stephen Hurd told me about the ESC8 incompatibility. * TODO, check.lrzsz, man/lrz.1, man/lsz.1, src/lrz.c, src/lsz.c, src/zglobal.h, src/zm.c, src/zmodem.h: removed the ESC8 feature due to incompatibility with DSZ and zmtx- zmrx-2. 2026-10-01 Uwe Ohse at akiar * src/lsz.c: removed a dead assignment. 2026-09-30 Uwe Ohse * version number set to 0.13.0 * i touched almost everything in the last two months. 1998-06-15 Uwe Ohse * src/rbsb.c (io_mode), case 1: disable IEXTEN, from Usman Muzaffar . 1998-06-15 Uwe Ohse * src/lsz.c: Transfering 0 byte files with Zmodem made lsz crash. 1998-06-03 Uwe Ohse * 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 * 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 * debian/* * Makefile.am: * configure.in: removed support for debian, on mail from Josip Rodin . 1998-12-29 Uwe Ohse * 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 * 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 * 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 * 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 on BeOS to get fd_set. 1998-12-22 Uwe Ohse * 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 * configure.in: PUBDIR was handled incorrectly. Thanks to Stanislav Brabec . * 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 . * src/lrz.c (main): use umask(). 1998-10-22 Uwe Ohse * 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 * 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 * 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 * README.isdn4linux: new file. 1998-03-13 Uwe Ohse * src/tcp.c: #define INADDR_NONE if it is undefined 1998-01-18 Uwe Ohse * 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 * 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 * 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 , 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 * 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 * 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 * 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 * src/zm.c (zsda32): crashed if sending packet with 0 bytes data. 1997-11-07 Uwe Ohse * configure.in: changed version number to 0.12.18. * src/zm.c: remove #include (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", , , . (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 * 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 * 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 * 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 * 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 * 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 * 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 * src/zglobal.h (LONG_MAX): If everything else failed, include limits.h. * intl/l10nflist.c: * intl/explodename.c include Tue Jan 7 07:33:55 MET 1997 Uwe Ohse * 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 ) Sat Jan 4 10:12:56 1997 Uwe Ohse * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * src/lsz.c (wcs): #ifdef HAVE_MMAP around dont_mmap_this. Wed Sep 18 18:36:40 1996 Philippe De Muyter * 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 * src/lrz.c (main): enable SIGINT code. * src/lsz.c: whole file: enable SIGINT code. Sat Sep 14 10:02:41 1996 Uwe Ohse * 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 * 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 ) * configure.in: check for mode_t, replace strtoul if needed. (Philippe De Muyter ) * src/rbsb.c: Do not include fcntl.h twice. (Philippe De Muyter ) * src/lrz.c (long_options): * src/lsz.c (long_options): fix typo (restriced -> restricted) (Philippe De Muyter ) * 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 ) Wed Sep 4 20:21:56 1996 Uwe Ohse * src/zglobal.h: include if it exists. (Philippe De Muyter ) * configure.in: check for sys/select.h (Philippe De Muyter ) * src/lsz.c (getinsync): clearerr(input_f) is a bad idea if (input_f == NULL). Tue Sep 3 21:55:30 1996 Uwe Ohse * 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 * 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 * 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 * 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 * 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 * src/rbsb.c (from_cu): debug messages deleted. Fri Aug 23 14:32:51 1996 Uwe Ohse * 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 * Release 0.12.7 * configure.in (VERSION): changed to 0.12.7 Tue Aug 13 00:00:27 1996 Uwe Ohse * 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 * 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 * 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 * 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 * configure.in: AC_REPLACE_GNU_GETOPT missing. Tue Jul 23 16:20:06 1996 Uwe Ohse * src/rbsb.c (rdchk): f should have been fd. * src/zperr.c: include errno.h Fri Jul 5 15:51:51 1996 Uwe Ohse * configure.in: AC_DEFINE(HAVE_STRERROR,1) * acconfig.h: #undef HAVE_STRERROR Thu Jun 20 16:42:26 1996 Uwe Ohse * 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 * 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 * 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 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 * 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 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 - 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 lrzsz-0.13.1/config.guess0000755000175000017500000014306715256501374011004 #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2024 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2024-07-27' # 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 3 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system '$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still # use 'HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c17 c99 c89 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; 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 case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #if defined(__ANDROID__) LIBC=android #else #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #elif defined(__LLVM_LIBC__) LIBC=llvm #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case $UNAME_VERSION in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; 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. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; 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'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case `/bin/arch` in sun3) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:SerenityOS:*:*) GUESS=$UNAME_MACHINE-pc-serenity ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-pc-managarm-mlibc" ;; *:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __ARM_EABI__ #ifdef __ARM_PCS_VFP ABI=eabihf #else ABI=eabi #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; esac fi GUESS=$CPU-unknown-linux-$LIBCABI ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:cos:*:*) GUESS=$UNAME_MACHINE-unknown-cos ;; kvx:mbr:*:*) GUESS=$UNAME_MACHINE-unknown-mbr ;; loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __i386__ ABI=x86 #else #ifdef __ILP32__ ABI=x32 #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in x86) CPU=i686 ;; x32) LIBCABI=${LIBC}x32 ;; esac fi GUESS=$CPU-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. GUESS=i386-sequent-sysv4 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find 'uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; ppc:Haiku:*:*) # Haiku running on Apple PowerPC GUESS=powerpc-apple-haiku ;; *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) GUESS=$UNAME_MACHINE-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "${cputype-}" = 386; then UNAME_MACHINE=i386 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; i*86:Fiwix:*:*) GUESS=$UNAME_MACHINE-pc-fiwix ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; *:Ironclad:*:*) GUESS=$UNAME_MACHINE-unknown-ironclad ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif int 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 printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: lrzsz-0.13.1/po/0000775000175000017500000000000015260431651007144 5lrzsz-0.13.1/po/boldquot.sed0000644000175000017500000000131515236326254011415 # Sed script that converts quotations, by replacing ASCII quotation marks # with Unicode quotation marks and highlighting the quotations in bold face. # # Copyright (C) 2001 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This file is offered as-is, without any warranty. # # Written by Bruno Haible , 2001. # s/"\([^"]*\)"/“\1”/g s/`\([^`']*\)'/‘\1’/g s/ '\([^`']*\)' / ‘\1’ /g s/ '\([^`']*\)'$/ ‘\1’/g s/^'\([^`']*\)' /‘\1’ /g s/“”/""/g s/“/“/g s/”/”/g s/‘/‘/g s/’/’/g lrzsz-0.13.1/po/remove-potcdate.sed0000644000175000017500000000132015236326254012656 # Sed script that removes the POT-Creation-Date line in the header entry # from a POT file. # # Copyright (C) 2002 Free Software Foundation, Inc. # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. This file is offered as-is, # without any warranty. # # The distinction between the first and the following occurrences of the # pattern is achieved by looking at the hold space. /^"POT-Creation-Date: .*"$/{ x # Test if the hold space is empty. s/P/P/ ta # Yes it was empty. First occurrence. Remove the line. g d bb :a # The hold space was nonempty. Following occurrences. Do nothing. x :b } lrzsz-0.13.1/po/quot.sed0000644000175000017500000000114015236326254010550 # Sed script that converts quotations, by replacing ASCII quotation marks # with Unicode quotation marks. # # Copyright (C) 2001 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This file is offered as-is, without any warranty. # # Written by Bruno Haible , 2001. # s/"\([^"]*\)"/“\1”/g s/`\([^`']*\)'/‘\1’/g s/ '\([^`']*\)' / ‘\1’ /g s/ '\([^`']*\)'$/ ‘\1’/g s/^'\([^`']*\)' /‘\1’ /g s/“”/""/g lrzsz-0.13.1/po/insert-header.sed0000644000175000017500000000177315236326254012326 # Sed script that inserts the file called HEADER before the header entry. # # Copyright (C) 2001 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This file is offered as-is, without any warranty. # # Written by Bruno Haible , 2001. # # At each occurrence of a line starting with "msgid ", we execute the following # commands. At the first occurrence, insert the file. At the following # occurrences, do nothing. The distinction between the first and the following # occurrences is achieved by looking at the hold space. /^msgid /{ x # Test if the hold space is empty. s/m/m/ ta # Yes it was empty. First occurrence. Read the file. r HEADER # Output the file's contents by reading the next line. But don't lose the # current line while doing this. g N bb :a # The hold space was nonempty. Following occurrences. Do nothing. x :b } lrzsz-0.13.1/po/LINGUAS0000664000175000017500000000035615241631513010113 # Translations welcome — submit a .po file via pull request. # # I'm willing to work with translators, not only to include translations, # but also to make your job easier - but i am not going to burden me # with doing translations. lrzsz-0.13.1/po/en@boldquot.header0000644000175000017500000000335315236326254012521 %% A header that gets inserted into message catalogs named en@boldquot.po. %% %% Copyright (C) 2001 Free Software Foundation, Inc. %% This file is free software; the Free Software Foundation %% gives unlimited permission to copy and/or distribute it, %% with or without modifications, as long as this notice is preserved. %% This file is offered as-is, without any warranty. %% %% Written by Bruno Haible , 2001. %% # All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # # This catalog furthermore displays the text between the quotation marks in # bold face, assuming the VT100/XTerm escape sequences. # lrzsz-0.13.1/po/ChangeLog0000664000175000017500000001306115236322776010651 2026-08-10 gettextize * Makefile.in.in: Upgrade to gettext-0.23.1. * Rules-quot: New file, from gettext-0.23.1. * boldquot.sed: New file, from gettext-0.23.1. * en@boldquot.header: New file, from gettext-0.23.1. * en@quot.header: New file, from gettext-0.23.1. * insert-header.sed: New file, from gettext-0.23.1. * quot.sed: New file, from gettext-0.23.1. * remove-potcdate.sed: New file, from gettext-0.23.1. * cat-id-tbl.c: Remove file. * stamp-cat-id: Remove file. /* Automatically generated by po2tbl.sed from lrzsz.pot. */ #if HAVE_CONFIG_H # include #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; lrzsz-0.13.1/po/Makefile.in.in0000644000175000017500000004743215236361153011550 # Makefile for PO directory in any package using GNU gettext. # Copyright (C) 1995-2000 Ulrich Drepper # Copyright (C) 2000-2024 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. This file is offered as-is, # without any warranty. # # Origin: gettext-0.23 GETTEXT_MACRO_VERSION = 0.22 PACKAGE = @PACKAGE@ VERSION = @VERSION@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ SED = @SED@ SHELL = /bin/sh @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ datadir = @datadir@ localedir = @localedir@ gettextsrcdir = $(datadir)/gettext/po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, # @install_sh@ does not start with $(SHELL), so we add it. # In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. mkinstalldirs = $(SHELL) @install_sh@ -d install_sh = $(SHELL) @install_sh@ MKDIR_P = @MKDIR_P@ mkdir_p = @mkdir_p@ # When building gettext-tools, we prefer to use the built programs # rather than installed programs. However, we can't do that when we # are cross compiling. CROSS_COMPILING = @CROSS_COMPILING@ GMSGFMT_ = @GMSGFMT@ GMSGFMT_no = @GMSGFMT@ GMSGFMT_yes = @GMSGFMT_015@ GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) XGETTEXT_ = @XGETTEXT@ XGETTEXT_no = @XGETTEXT@ XGETTEXT_yes = @XGETTEXT_015@ XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) MSGMERGE = @MSGMERGE@ MSGMERGE_UPDATE = @MSGMERGE@ --update MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@ MSGINIT = msginit MSGCONV = msgconv MSGFILTER = msgfilter POFILES = @POFILES@ GMOFILES = @GMOFILES@ UPDATEPOFILES = @UPDATEPOFILES@ DUMMYPOFILES = @DUMMYPOFILES@ DISTFILES.common = Makefile.in.in remove-potcdate.sed \ $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ $(POFILES) $(GMOFILES) \ $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) POTFILES = \ CATALOGS = @CATALOGS@ POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot POFILESDEPS_yes = $(POFILESDEPS_) POFILESDEPS_no = POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT)) DISTFILESDEPS_ = update-po DISTFILESDEPS_yes = $(DISTFILESDEPS_) DISTFILESDEPS_no = DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO)) # Makevars gets inserted here. (Don't remove this line!) all: all-@USE_NLS@ .SUFFIXES: .SUFFIXES: .po .gmo .sed .nop .po-create .po-update # The .pot file, stamp-po, .po files, and .gmo files appear in release tarballs. # The GNU Coding Standards say in # : # "GNU distributions usually contain some files which are not source files # ... . Since these files normally appear in the source directory, they # should always appear in the source directory, not in the build directory. # So Makefile rules to update them should put the updated files in the # source directory." # Therefore we put these files in the source directory, not the build directory. # During .po -> .gmo conversion, take into account the most recent changes to # the .pot file. This eliminates the need to update the .po files when the # .pot file has changed, which would be troublesome if the .po files are put # under version control. $(GMOFILES): $(srcdir)/$(DOMAIN).pot .po.gmo: @lang=`echo $* | sed -e 's,.*/,,'`; \ if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}rm -f $${lang}.gmo && $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.1po && rm -f $${lang}.1po"; \ cd $(srcdir) && \ rm -f $${lang}.gmo && \ $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && \ $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.1po && \ mv t-$${lang}.gmo $${lang}.gmo && \ rm -f $${lang}.1po all-yes: $(srcdir)/stamp-po all-no: # Ensure that the gettext macros and this Makefile.in.in are in sync. CHECK_MACRO_VERSION = \ test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ exit 1; \ } # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because # we don't want to bother translators with empty POT files). We assume that # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. # In this case, $(srcdir)/stamp-po is a nop (i.e. a phony target). # $(srcdir)/stamp-po is a timestamp denoting the last time at which the CATALOGS # have been loosely updated. Its purpose is that when a developer or translator # checks out the package from a version control system, and the $(DOMAIN).pot # file is not under version control, "make" will update the $(DOMAIN).pot and # the $(CATALOGS), but subsequent invocations of "make" will do nothing. This # timestamp would not be necessary if updating the $(CATALOGS) would always # touch them; however, the rule for $(POFILES) has been designed to not touch # files that don't need to be changed. $(srcdir)/stamp-po: $(srcdir)/$(DOMAIN).pot @$(CHECK_MACRO_VERSION) test ! -f $(srcdir)/$(DOMAIN).pot || \ test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) @test ! -f $(srcdir)/$(DOMAIN).pot || { \ echo "touch $(srcdir)/stamp-po" && \ echo timestamp > $(srcdir)/stamp-poT && \ mv $(srcdir)/stamp-poT $(srcdir)/stamp-po; \ } # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', # otherwise packages like GCC can not be built if only parts of the source # have been downloaded. # This target rebuilds $(DOMAIN).pot; it is an expensive operation. # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. # The determination of whether the package xyz is a GNU one is based on the # heuristic whether some file in the top level directory mentions "GNU xyz". # If GNU 'find' is available, we avoid grepping through monster files. $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in package_gnu="$(PACKAGE_GNU)"; \ test -n "$$package_gnu" || { \ if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \ LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep -i 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \ else \ LC_ALL=C grep -i 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \ fi; \ } | grep -v 'libtool:' >/dev/null; then \ package_gnu=yes; \ else \ package_gnu=no; \ fi; \ }; \ if test "$$package_gnu" = "yes"; then \ package_prefix='GNU '; \ else \ package_prefix=''; \ fi; \ if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ else \ msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ fi; \ case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ --add-comments=TRANSLATORS: \ --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ --msgid-bugs-address="$$msgid_bugs_address" \ $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ ;; \ *) \ $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ --add-comments=TRANSLATORS: \ --files-from=$(srcdir)/POTFILES.in \ --copyright-holder='$(COPYRIGHT_HOLDER)' \ --package-name="$${package_prefix}@PACKAGE@" \ --package-version='@VERSION@' \ --msgid-bugs-address="$$msgid_bugs_address" \ $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ ;; \ esac test ! -f $(DOMAIN).po || { \ if test -f $(srcdir)/$(DOMAIN).pot-header; then \ sed -e '1,/^#$$/d' < $(DOMAIN).po > $(DOMAIN).1po && \ cat $(srcdir)/$(DOMAIN).pot-header $(DOMAIN).1po > $(DOMAIN).po && \ rm -f $(DOMAIN).1po \ || exit 1; \ fi; \ if test -f $(srcdir)/$(DOMAIN).pot; then \ sed -f $(srcdir)/remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ sed -f $(srcdir)/remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ else \ rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ fi; \ else \ mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ fi; \ } # This rule has no dependencies: we don't need to update $(DOMAIN).pot at # every "make" invocation, only create it when it is missing. # Only "make $(DOMAIN).pot-update" or "make dist" will force an update. $(srcdir)/$(DOMAIN).pot: $(MAKE) $(DOMAIN).pot-update # This target rebuilds a PO file if $(DOMAIN).pot has changed. # Note that a PO file is not touched if it doesn't need to be changed. $(POFILES): $(POFILESDEPS) @test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ if test -f "$(srcdir)/$${lang}.po"; then \ if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}$(MSGMERGE_UPDATE) --quiet $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot"; \ cd $(srcdir) \ && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ '' | 0.[0-9] | 0.[0-9].* | 0.10 | 0.10.*) \ $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \ 0.1[1-5] | 0.1[1-5].*) \ $(MSGMERGE_UPDATE) --quiet $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \ 0.1[6-7] | 0.1[6-7].*) \ $(MSGMERGE_UPDATE) --quiet $(MSGMERGE_OPTIONS) --previous $${lang}.po $(DOMAIN).pot;; \ *) \ $(MSGMERGE_UPDATE) --quiet $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot;; \ esac; \ }; \ else \ $(MAKE) $${lang}.po-create; \ fi install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ for file in $(DISTFILES.common) Makevars.template; do \ $(INSTALL_DATA) $(srcdir)/$$file \ $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ for file in Makevars; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi install-data-no: all install-data-yes: all @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $(DESTDIR)$$dir; \ if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ for file in *; do \ if test -f $$file; then \ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ fi; \ done); \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ :; \ else \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ fi; \ fi; \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ fi; \ done; \ done install-strip: install installdirs: installdirs-exec installdirs-data installdirs-exec: installdirs-data: installdirs-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ else \ : ; \ fi installdirs-data-no: installdirs-data-yes: @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ dir=$(localedir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $(DESTDIR)$$dir; \ for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ if test -n "$$lc"; then \ if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ for file in *; do \ if test -f $$file; then \ ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ fi; \ done); \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ else \ if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ :; \ else \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ fi; \ fi; \ fi; \ done; \ done # Define this as empty until I found a useful application. installcheck: uninstall: uninstall-exec uninstall-data uninstall-exec: uninstall-data: uninstall-data-@USE_NLS@ if test "$(PACKAGE)" = "gettext-tools"; then \ for file in $(DISTFILES.common) Makevars.template; do \ rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ done; \ else \ : ; \ fi uninstall-data-no: uninstall-data-yes: catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ done; \ done check: all info dvi ps pdf html tags TAGS ctags CTAGS ID: install-dvi install-ps install-pdf install-html: mostlyclean: rm -f $(srcdir)/stamp-poT rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po rm -fr *.o clean: mostlyclean distclean: clean rm -f Makefile Makefile.in POTFILES 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 $(srcdir)/$(DOMAIN).pot $(srcdir)/stamp-po $(GMOFILES) distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) dist distdir: test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS) @$(MAKE) dist2 # This is a separate target because 'update-po' must be executed before. dist2: $(srcdir)/stamp-po $(DISTFILES) @dists="$(DISTFILES)"; \ if test "$(PACKAGE)" = "gettext-tools"; then \ dists="$$dists Makevars.template"; \ fi; \ if test -f $(srcdir)/$(DOMAIN).pot; then \ dists="$$dists $(DOMAIN).pot stamp-po"; \ else \ case $(XGETTEXT) in \ :) echo "Warning: Creating a tarball without '$(DOMAIN).pot', because a suitable 'xgettext' program was not found in PATH." 1>&2;; \ *) echo "Warning: Creating a tarball without '$(DOMAIN).pot', because 'xgettext' found no strings to extract. Check the contents of the POTFILES.in file and the XGETTEXT_OPTIONS in the Makevars file." 1>&2;; \ esac; \ fi; \ if test -f $(srcdir)/ChangeLog; then \ dists="$$dists ChangeLog"; \ fi; \ for i in 0 1 2 3 4 5 6 7 8 9; do \ if test -f $(srcdir)/ChangeLog.$$i; then \ dists="$$dists ChangeLog.$$i"; \ fi; \ done; \ if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ for file in $$dists; do \ if test -f $$file; then \ cp -p $$file $(distdir) || exit 1; \ else \ cp -p $(srcdir)/$$file $(distdir) || exit 1; \ fi; \ done update-po: Makefile $(MAKE) $(DOMAIN).pot-update test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) $(MAKE) update-gmo # General rule for creating PO files. .nop.po-create: @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ exit 1 # General rule for updating PO files. .nop.po-update: @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ echo "$${cdcmd}$(MSGMERGE) --quiet $(MSGMERGE_OPTIONS) --lang=$$lang --previous $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ cd $(srcdir); \ if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ '' | 0.[0-9] | 0.[0-9].* | 0.10 | 0.10.*) \ $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ 0.1[1-5] | 0.1[1-5].*) \ $(MSGMERGE) --quiet $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ 0.1[6-7] | 0.1[6-7].*) \ $(MSGMERGE) --quiet $(MSGMERGE_OPTIONS) --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ *) \ $(MSGMERGE) --quiet $(MSGMERGE_OPTIONS) --lang=$$lang --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ esac; \ }; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$lang.po failed!" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ fi $(DUMMYPOFILES): update-gmo: Makefile $(GMOFILES) @: # Recreate Makefile by invoking config.status. Explicitly invoke the shell, # because execution permission bits may not work on the current file system. # Use @SHELL@, which is the shell determined by autoconf for the use by its # scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient. Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ cd $(top_builddir) \ && @SHELL@ ./config.status $(subdir)/$@.in po-directories force: # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: # This Makefile contains rules which don't work with parallel make, # namely dist2. # See . # So, turn off parallel execution in this Makefile. .NOTPARALLEL: lrzsz-0.13.1/po/Makevars0000664000175000017500000000546215236334612010571 # Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = $(PACKAGE) # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Uwe Ohse and the contributors # This tells whether or not to prepend "GNU " prefix to the package # name that gets inserted into the header of the $(DOMAIN).pot file. # Possible values are "yes", "no", or empty. If it is empty, try to # detect it automatically by scanning the files in $(top_srcdir) for # "GNU packagename" string. PACKAGE_GNU = # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = # This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' # context. Possible values are "yes" and "no". Set this to yes if the # package uses functions taking also a message context, like pgettext(), or # if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. USE_MSGCTXT = no # These options get passed to msgmerge. # Useful options are in particular: # --previous to keep previous msgids of translated messages, # --quiet to reduce the verbosity. MSGMERGE_OPTIONS = # These options get passed to msginit. # If you want to disable line wrapping when writing PO files, add # --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and # MSGINIT_OPTIONS. MSGINIT_OPTIONS = # This tells whether or not to regenerate a PO file when $(DOMAIN).pot # has changed. Possible values are "yes" and "no". Set this to no if # the POT file is checked in the repository and the version control # program ignores timestamps. PO_DEPENDS_ON_POT = yes # This tells whether or not to forcibly update $(DOMAIN).pot and # regenerate PO files on "make dist". Possible values are "yes" and # "no". Set this to no if the POT file and PO files are maintained # externally. DIST_DEPENDS_ON_UPDATE_PO = yes lrzsz-0.13.1/po/lrzsz.pot0000664000175000017500000003261015260431651010776 # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Uwe Ohse and the contributors # This file is distributed under the same license as the lrzsz package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: lrzsz 0.13.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-10-04 13:08+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: src/rbsb.c:250 #, c-format msgid "tcsetattr failed: %s" msgstr "" #: src/lsz.c:194 src/lrz.c:164 #, c-format msgid "caught signal %d; exiting" msgstr "" #: src/lsz.c:391 msgid "this option has been removed; see the manual" msgstr "" #: src/lsz.c:432 src/lsz.c:441 src/lrz.c:331 #, c-format msgid "" "this option has been removed. See the manual page for more information.\n" msgstr "" #: src/lsz.c:466 src/lrz.c:353 msgid "cannot turnoff syslog" msgstr "" #: src/lsz.c:479 src/lrz.c:375 msgid "bad --debug argument" msgstr "" #: src/lsz.c:490 src/lrz.c:385 msgid "this program was never intended to be used setuid\n" msgstr "" #: src/lsz.c:510 src/lsz.c:521 msgid "need at least one file to send" msgstr "" #: src/lsz.c:524 msgid "can't send command in restricted mode" msgstr "" #: src/lsz.c:556 src/zreadline.c:128 msgid "out of memory" msgstr "" #: src/lsz.c:569 msgid "can read only one file from stdin" msgstr "" #: src/lsz.c:574 src/lrz.c:423 msgid "cannot set transfer line mode; continuing" msgstr "" #: src/lsz.c:648 src/lrz.c:439 msgid "Transfer incomplete\n" msgstr "" #: src/lsz.c:650 src/lrz.c:441 msgid "Transfer complete\n" msgstr "" #: src/lsz.c:679 msgid "Can't open any requested files." msgstr "" #: src/lsz.c:730 src/lrz.c:1457 #, c-format msgid "cannot open %s" msgstr "" #: src/lsz.c:772 #, c-format msgid "cannot stat %s" msgstr "" #: src/lsz.c:780 #, c-format msgid "is not a file: %s" msgstr "" #: src/lsz.c:804 #, c-format msgid "" "file %s is larger than 2 GiB; transfers may fail with older ZMODEM " "implementations" msgstr "" #: src/lsz.c:812 src/lsz.c:827 #, c-format msgid "%s/%s: error occured" msgstr "" #: src/lsz.c:816 #, c-format msgid "skipped: %s" msgstr "" #: src/lsz.c:819 #, c-format msgid "%s/%s: skipped" msgstr "" #: src/lsz.c:846 #, c-format msgid "security violation: not allowed to upload from %s" msgstr "" #: src/lsz.c:864 #, c-format msgid "Sending %s, %ld blocks: " msgstr "" #: src/lsz.c:868 msgid "Give your local XMODEM receive command now." msgstr "" #: src/lsz.c:893 #, c-format msgid "filename too long for %s subpacket: %s" msgstr "" #: src/lsz.c:925 #, c-format msgid "Sending: %s\n" msgstr "" #: src/lsz.c:963 msgid "Timeout on pathname" msgstr "" #: src/lsz.c:993 src/lsz.c:1035 src/lsz.c:1063 src/lsz.c:1152 src/zm.c:603 #: src/lrz.c:867 msgid "Line dropped" msgstr "" #: src/lsz.c:999 src/lsz.c:1007 msgid "Too much garbage on line" msgstr "" #: src/lsz.c:1031 msgid "Receiver Cancelled" msgstr "" #: src/lsz.c:1069 msgid "No ACK on EOT" msgstr "" #: src/lsz.c:1088 #, c-format msgid "Xmodem sectors/kbytes sent: %3d/%2dk" msgstr "" #: src/lsz.c:1090 #, c-format msgid "Ymodem sectors/kbytes sent: %3d/%2dk" msgstr "" #: src/lsz.c:1124 msgid "Cancelled" msgstr "" #: src/lsz.c:1129 msgid "Timeout on sector ACK" msgstr "" #: src/lsz.c:1136 msgid "NAK on sector" msgstr "" #: src/lsz.c:1143 msgid "Got burst for sector ACK" msgstr "" #: src/lsz.c:1145 #, c-format msgid "Got %02x for sector ACK" msgstr "" #: src/lsz.c:1162 msgid "Retry Count Exceeded" msgstr "" #: src/lsz.c:1178 src/lsz.c:1205 src/lsz.c:1227 #, c-format msgid "read error: %s" msgstr "" #: src/lsz.c:1252 src/lrz.c:458 #, c-format msgid "Try `%s -h' for more information.\n" msgstr "" #: src/lsz.c:1257 src/lrz.c:463 #, c-format msgid "%s version %s\n" msgstr "" #: src/lsz.c:1260 #, c-format msgid "Usage: %s [options] file ...\n" msgstr "" #: src/lsz.c:1262 #, c-format msgid " or: %s [options] -{c|i} COMMAND\n" msgstr "" #: src/lsz.c:1263 msgid "Send file(s) with ZMODEM/YMODEM/XMODEM protocol\n" msgstr "" #: src/lsz.c:1265 src/lrz.c:469 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:1271 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 (Z)\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 (removed; use -f for full pathnames)\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" " -g, --ymodem use YMODEM protocol (Y)\n" " -h, --help print this usage message\n" " -H, --crc-check accept and transfer files if lengths/CRCs " "differ (Z)\n" " -i, --immediate-command CMD send remote CMD, return immediately (Z)\n" " -J, --journal FILE append transfer statistics to FILE\n" " --no-unixmode send mode 0 instead of Unix permission bits\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:1300 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" " -u, --unlink unlink file after transmission\n" " -v, --verbose be verbose (twice: also show progress)\n" " --debug=MODULES comma separated list: protocol, readline,\n" " transfer, windowhandling, tty, all\n" " --sync-transfer force a ZCRCW after every data subpacket\n" " (integrity mode: slower and immune to loss of\n" " whole subframes)\n" " -V, --version show version 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" " -Z, --zmodem use ZMODEM protocol\n" "\n" "short options use the same arguments as the long ones\n" msgstr "" #: src/lsz.c:1327 src/lrz.c:516 msgid "" "The long options (--...) are not available on your system (getopt_long is " "not available)\n" msgstr "" #: src/lsz.c:1545 src/lsz.c:1556 msgid "receiver keeps rejecting the file header" msgstr "" #: src/lsz.c:1562 msgid "got ZRQINIT" msgstr "" #: src/lsz.c:1568 src/lrz.c:959 src/lrz.c:1750 msgid "got ZCAN" msgstr "" #: src/lsz.c:1620 #, c-format msgid "fstat failed: %s" msgstr "" #: src/lsz.c:1920 #, c-format msgid "Bytes Sent:%7ld/%7ld BPS:%-8ld ETA %02d:%02d " msgstr "" #: src/lsz.c:2005 #, c-format msgid "receiver not advancing after %d ACKs" msgstr "" #: src/lsz.c:2491 msgid "got a ZRQINIT packet: the other side is trying to send, too\n" msgstr "" #: src/zm.c:83 msgid "Bad CRC" msgstr "" #: src/zm.c:249 #, c-format msgid "Bad escape sequence 0x%x" msgstr "" #: src/zm.c:593 msgid "Sender Canceled" msgstr "" #: src/zm.c:597 src/lrz.c:875 msgid "TIMEOUT" msgstr "" #: src/zm.c:607 msgid "Bad data subpacket" msgstr "" #: src/zm.c:619 msgid "Data subpacket too long" msgstr "" #: src/zm.c:712 msgid "Garbage count exceeded" msgstr "" #: src/zm.c:876 #, c-format msgid "Got %s" msgstr "" #: src/lrz.c:288 msgid "the auto buffersize option has been removed; see the manual" msgstr "" #: src/lrz.c:289 msgid "-B / --bufsize" msgstr "" #: src/lrz.c:302 msgid "-m / --min-bps" msgstr "" #: src/lrz.c:305 msgid "-M / --min-bps-time" msgstr "" #: src/lrz.c:367 msgid "O_SYNC not supported by the kernel" msgstr "" #: src/lrz.c:399 src/lrz.c:401 msgid "garbage on commandline" msgstr "" #: src/lrz.c:466 #, c-format msgid "Usage: %s [options] [filename.if.xmodem]\n" msgstr "" #: src/lrz.c:467 msgid "Receive files with ZMODEM/YMODEM/XMODEM protocol\n" msgstr "" #: src/lrz.c:474 msgid "" " -+, --append append to existing files\n" " -a, --ascii ASCII transfer (change CR/LF to LF)\n" " -A, --segmentsize ask for an ACK every ... bytes\n" " -b, --binary binary transfer\n" " -B, --bufsize N buffer N bytes before writing to disk\n" " -c, --with-crc Use 16 bit CRC (X)\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" " -h, --help Help, print this usage message\n" " -H, --crc-check accept file if lengths and/or CRCs differ (Z)\n" " -J, --journal FILE append transfer statistics to FILE\n" " --keep-incomplete keep partially received files on error " "(default: delete)\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" " -n, --newer receive file if source newer (Z)\n" " -N, --newer-or-longer receive file if source newer or longer (Z)\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" " --syslog[=off] turn syslog on or off, if possible\n" " -t, --timeout N set timeout to N tenths of a second\n" " -u, --keep-uppercase keep upper case filenames\n" " -v, --verbose be verbose (twice: also show progress)\n" " --debug=MODULES comma separated list: protocol, readline,\n" " transfer, windowhandling, tty, all\n" " -V, --version show version\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" " -g, --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:540 #, c-format msgid "%s waiting to receive." msgstr "" #: src/lrz.c:614 #, c-format msgid "%s: ready to receive %s" msgstr "" #: src/lrz.c:648 #, c-format msgid "" "\r\n" "%s: %s kept (incomplete).\r\n" msgstr "" #: src/lrz.c:658 #, c-format msgid "" "\r\n" "%s: %s removed.\r\n" msgstr "" #: src/lrz.c:693 msgid "Pathname fetch returned EOT" msgstr "" #: src/lrz.c:751 msgid "Received dup Sector" msgstr "" #: src/lrz.c:769 msgid "Sync Error" msgstr "" #: src/lrz.c:821 msgid "CRC" msgstr "" #: src/lrz.c:837 msgid "Checksum" msgstr "" #: src/lrz.c:844 msgid "Sector number garbled" msgstr "" #: src/lrz.c:853 msgid "Sender Cancelled" msgstr "" #: src/lrz.c:870 #, c-format msgid "Got 0x%x sector header" msgstr "" #: src/lrz.c:1190 #, c-format msgid "file name ends with a /, skipped: %s\n" msgstr "" #: src/lrz.c:1270 src/lrz.c:1320 #, c-format msgid "file exists, skipped: %s\n" msgstr "" #: src/lrz.c:1333 #, c-format msgid "cannot claim %s.N: %s\n" msgstr "" #: src/lrz.c:1377 #, c-format msgid "Receiving: %s\n" msgstr "" #: src/lrz.c:1558 #, c-format msgid "Blocks received: %d" msgstr "" #: src/lrz.c:1582 #, c-format msgid "%s: %s exists\n" msgstr "" #: src/lrz.c:1596 #, c-format msgid "%s:\tSecurity Violation" msgstr "" #: src/lrz.c:1727 msgid "remote command execution denied" msgstr "" #: src/lrz.c:1746 msgid "got ZRINIT" msgstr "" #: src/lrz.c:1784 msgid "Skipped" msgstr "" #: src/lrz.c:1992 #, c-format msgid "\rBytes received: %7ld/%7ld BPS:%-6lu ETA %02d:%02d " msgstr "" #: src/lrz.c:2148 msgid "file close error" msgstr "" lrzsz-0.13.1/po/en@quot.header0000644000175000017500000000314115236326254011653 %% A header that gets inserted into message catalogs named en@quot.po. %% %% Copyright (C) 2001 Free Software Foundation, Inc. %% This file is free software; the Free Software Foundation %% gives unlimited permission to copy and/or distribute it, %% with or without modifications, as long as this notice is preserved. %% This file is offered as-is, without any warranty. %% %% Written by Bruno Haible , 2001. %% # All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # lrzsz-0.13.1/po/POTFILES.in0000664000175000017500000000010406607440603010636 src/rbsb.c src/lsz.c src/zm.c src/zperr.c src/zreadline.c src/lrz.c lrzsz-0.13.1/po/Rules-quot0000644000175000017500000000466315236326254011103 # Special Makefile rules for English message catalogs with quotation marks. # # Copyright (C) 2001-2024 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This file is offered as-is, without any warranty. # # Written by Bruno Haible , 2001. DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sed Rules-quot .SUFFIXES: .insert-header .po-update-en en@quot.po-create: $(MAKE) en@quot.po-update en@boldquot.po-create: $(MAKE) en@boldquot.po-update en@quot.po-update: en@quot.po-update-en en@boldquot.po-update: en@boldquot.po-update-en .insert-header.po-update-en: @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ tmpdir=`pwd`; \ echo "$$lang:"; \ ll=`echo $$lang | sed -e 's/@.*//'`; \ LC_ALL=C; export LC_ALL; \ cd $(srcdir); \ if $(MSGINIT) $(MSGINIT_OPTIONS) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null \ | $(SED) -f $$tmpdir/$$lang.insert-header | $(SED) -e '/^%%/d' \ | $(MSGCONV) -t UTF-8 | \ { case `$(MSGFILTER) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-8] | 0.1[0-8].*) \ $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed \ ;; \ *) \ $(MSGFILTER) `echo $$lang | sed -e 's/.*@//'` \ ;; \ esac } 2>/dev/null > $$tmpdir/$$lang.new.po \ ; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ exit 1; \ fi; \ fi; \ else \ echo "creation of $$lang.po failed!" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ fi en@quot.insert-header: insert-header.sed sed -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sed > en@quot.insert-header en@boldquot.insert-header: insert-header.sed sed -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sed > en@boldquot.insert-header mostlyclean: mostlyclean-quot mostlyclean-quot: rm -f *.insert-header lrzsz-0.13.1/po/stamp-po0000664000175000017500000000001215260431651010540 timestamp lrzsz-0.13.1/doc/0000775000175000017500000000000015260431651007273 5lrzsz-0.13.1/doc/zmodemsnif.txt0000664000175000017500000000416315242354430012132 zmodemsnif is the newest incarnation of my x/y/zmodem protocol tracer, and the first to be included in the distribution. Compile with: gcc -D_POSIX_C_SOURCE=200809L src/zmodemsnif.c Run with: ./a.out src/lrz (usual options) It will output on stderr. Sample output: 21:13:17.111 → ZRQINIT hdr=00000000 21:13:17.111 → ZFILE conv=BIN mgmt=CRC 21:13:17.111 → data subframe 43 bytes (ZCRCW) 21:13:17.111 → file="all256.bin" size=256 mtime=1787339596 mode=00 21:13:17.111 ← ZRINIT flags=CANFDX|CANOVIO|CANBRK|CANFC32 Rxbuflen=0 0 ZP[0-3]=[0 ,0 ,0 ,27] 21:13:17.111 ← ZRPOS offset=0 21:13:17.111 → ZFILE conv=BIN mgmt=CRC 21:13:17.111 → data subframe 43 bytes (ZCRCW) 21:13:17.111 → file="all256.bin" size=256 mtime=1787339596 mode=00 21:13:17.111 ← ZRPOS offset=0 21:13:18.112 → ZDATA offset=0 21:13:18.112 → data subframe 256 bytes (ZCRCE) 21:13:18.112 → ZEOF offset=256 21:13:18.112 ← ZRINIT flags=CANFDX|CANOVIO|CANBRK|CANFC32 Rxbuflen=0 0 ZP[0-3]=[0 ,0 ,0 ,27] 21:13:18.112 → ZFILE conv=BIN mgmt=CRC 21:13:18.112 → data subframe 40 bytes (ZCRCW) 21:13:18.112 → file="4k.bin" size=4096 mtime=1787339596 mode=00 21:13:18.113 ← ZRPOS offset=0 Limits: - it does not understand ZMODEM RLE encoding. This was ever only implemented in some OMEN ZMODEM implementations, never in open source. It is also of questionable value: its only useful in the niche of transfering uncompressed files with long, repeated sequences of characters (like lines of stars in certain C code). - it does not understand ZMODEM variable length headers. This was ever only implemented in some OMEN ZMODEM implementations, never in open source. The variable length headers have been here for 30 years, and since then the only implementations of them have been in OMEN products (they are dead), and that shows that they haven't been attractive. - it does not understand the ZBIN64 frames of rzsz-nd (the magic conflicts with that of one the RLE frames). - it does not understand the 32k and 64k blocksizes of ADONTECs SUPERCOM. Generally speaking: it understands common, documented ZMODEM options. lrzsz-0.13.1/doc/zmodem-zmtx-zmrx.txt0000644000175000017500000011114215237114346013246 zmodem.doc !copyrighted by MCS 1994 use it anyway you like but don't complain this file should be accompanied by a readme which contains some background information on implementing zmodem. GENERAL ------- Documentation about the zmodem protocol internals; should be sufficient to implement a completely functional zmodem protocol suite. Zmodem is a file transfer protocol that attempts to maximize bandwidth and minimize transfer times. it is a unidirectional protocol; i.e. the return channel only transfers control information; no data. either side may initiate the transfer; but the downloading site may respond to an initialization frame by auto starting the download software. Schematically a zmodem file transfer in progress looks like this: |----------<< back channel <<-------------| ------+------- --------+------ | Sender | | Receiver | | (upload) | | (download) | -------------- --------+------ |---------->> data channel >>-------------| Multiple files may be transferred in one session. SAMPLE ------ all zmodem transactions are done using frames. a frame consists of a header followed by one or more data subpackets. a typical (simple) zmodem file transfer looks like this : sender receiver ZRQINIT(0) ZRINIT ZFILE ZRPOS ZDATA data ... ZEOF ZRINIT ZFIN ZFIN OO zmodem continuously transmits data unless the receiver interrupts the sender to request retransmission of garbled data. zmodem in effect uses the entire file as a window. REQUIREMENTS ------------ zmodem requires an 8 bit transfer medium; but allows encoded packets for less transparent media. zmodem escapes network control characters to allow operation with packet switched networks. To support full streaming, the transmission path should either assert flow control or pass full speed transmission without loss of data. Otherwise the zmodem sender must manage the window size. zmodem places no constraints on the content files. LINK ESCAPE ENCODING -------------------- zmodem achieves data transparency by extending the 8 bit character set (256 codes) with escape sequences based on the zmodem data link escape character ZDLE Link Escape coding permits variable length data subpackets without the overhead of a separate byte count. It allows the beginning of frames to be detected without special timing techniques, facilitating rapid error recovery. Link Escape coding does add some overhead. The worst case, a file consisting entirely of escaped characters, would incur a 50% overhead. The ZDLE character is special. ZDLE represents a control sequence of some sort. If a ZDLE character appears in binary data, it is prefixed with ZDLE, then sent as ZDLEE 5 consecutive CAN characters abort a zmodem session Since CAN is not used in normal terminal operations, interactive applications and communications programs can monitor the data flow for ZDLE. The following characters can be scanned to detect the ZRQINIT header, the invitation to automatically download commands or files. Receipt of five successive CAN characters will abort a zmodem session. Eight CAN characters are sent (just to be on the safe side) The receiving program decodes any sequence of ZDLE followed by a byte with bit 6 set and bit 5 reset (upper case letter, either parity) to the equivalent control character by inverting bit 6. This allows the transmitter to escape any control character that cannot be sent by the communications medium. In addition, the receiver recognizes escapes for 0x7f and 0xff should these characters need to be escaped. zmodem software escapes ZDLE (0x18), 0x10, 0x90, 0x11, 0x91, 0x13, and 0x93. If preceded by 0x40 or 0xc0 (@), 0x0d and 0x8d are also escaped to protect the Telenet command escape CR-@-CR. The receiver ignores 0x11, 0x91, 0x13, and 0x93 characters in the data stream. HEADERS ------- All zmodem frames begin with a header which may be sent in binary or HEX form. Either form of the header contains the same raw information: - A type byte - Four bytes of data indicating flags and/or numeric quantities depending on the frame type the maximum header information length is 16 bytes the data subpackets following the header are maximum 1024 bytes long. M L FTYPE F3 F2 F1 F0 (flags frame) L M FTYPE P0 P1 P2 P3 (numeric frame) Beware of the catch; flags and numbers are indexed the other way around ! 16 BIT CRC BINARY HEADER ------------------------ A binary header is sent by the sending program to the receiving program. All bytes in a binary header are ZDLE encoded. A binary header begins with the sequence ZPAD, ZDLE, ZBIN. 0 or more binary data subpackets with 16 bit CRC will follow depending on the frame type. * ZDLE A TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 32 BIT CRC BINARY HEADER ------------------------ A "32 bit CRC" Binary header is similar to a Binary Header, except the ZBIN (A) character is replaced by a ZBIN32 (C) character, and four characters of CRC are sent. 0 or more binary data subpackets with 32 bit CRC will follow depending on the frame type. * ZDLE C TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 CRC-3 CRC-4 HEX HEADER ---------- The receiver sends responses in hex headers. The sender also uses hex headers when they are not followed by binary data subpackets. Hex encoding protects the reverse channel from random control characters. The hex header receiving routine ignores parity. use of hex headers by the receiving program allows control characters to be used to interrupt the sender when errors are detected. A HEX header may be used in place of a binary header wherever convenient. If a data packet follows a HEX header, it is protected with CRC-16. A hex header begins with the sequence ZPAD, ZPAD, ZDLE, ZHEX. The extra ZPAD character allows the sending program to detect an asynchronous header (indicating an error condition) and then get the rest of the header with a non-error specific routine. The type byte, the four position/flag bytes, and the 16 bit CRC thereof are sent in hex using the character set 01234567890abcdef. Upper case hex digits are not allowed. Since this form of hex encoding detects many patterns of errors, especially missing characters, a hex header with 32 bit CRC has not been defined. A carriage return and line feed are sent with HEX headers. The receive routine expects to see at least one of these characters, two if the first is CR. An XON character is appended to all HEX packets except ZACK and ZFIN. The XON releases the sender from spurious XOFF flow control characters generated by line noise. XON is not sent after ZACK headers to protect flow control in streaming situations. XON is not sent after a ZFIN header to allow proper session cleanup. 0 or more data subpackets will follow depending on the frame type. * * ZDLE B TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 CR LF XON (TYPE, F3...F0, CRC-1, and CRC-2 are each sent as two hex digits.) BINARY DATA SUBPACKETS ---------------------- Binary data subpackets immediately follow the associated binary header packet. A binary data packet contains 0 to 1024 bytes of data. Recommended length values are 256 bytes below 2400 bps, 512 at 2400 bps, and 1024 above 4800 bps or when the data link is known to be relatively error free. No padding is used with binary data subpackets. The data bytes are ZDLE encoded and transmitted. A ZDLE and frameend are then sent, followed by two or four ZDLE encoded CRC bytes. The CRC accumulates the data bytes and frameend. PROTOCOL TRANSACTION OVERVIEW ----------------------------- zmodem timing is receiver driven. The transmitter should not time out at all, except to abort the program if no headers are received for an extended period of time, say one minute. SESSION STARTUP --------------- To start a zmodem file transfer session, the sending program is called with the names of the desired file(s) and option(s). Then the sender may send a ZRQINIT header. The ZRQINIT header causes a previously started receive program to send its ZRINIT header without delay. In an interactive or conversational mode, the receiving application may monitor the data stream for ZDLE. The following characters may be scanned for B00 indicating a ZRQINIT header, a command to download data. The sending program awaits a command from the receiving program to start file transfers. In case of garbled data, the sending program can repeat the invitation to receive a number of times until a session starts. When the zmodem receive program starts, it immediately sends a ZRINIT header to initiate zmodem file transfers, or a ZCHALLENGE header to verify the sending program. The receive program resends its header at response time (default 10 second) intervals for a suitable period of time (40 seconds total) before exitting. If the receiving program receives a ZRQINIT header, it resends the ZRINIT header. If the sending program receives the ZCHALLENGE header, it places the data in ZP0...ZP3 in an answering ZACK header. If the receiving program receives a ZRINIT header, it is an echo indicating that the sending program is not operational. Eventually the sending program correctly receives the ZRINIT header. The sender may then send an optional ZSINIT frame to define the receiving program's Attn sequence, or to specify complete control character escaping. if the receiver specifies the same or higher level of escaping the ZSINIT frame need not be sent unless an Attn sequence is needed. If the ZSINIT header specifies ESCCTL or ESC8, a HEX header is used, and the receiver activates the specified ESC modes before reading the following data subpacket. The receiver sends a ZACK header in response, containing 0. FILE TRANSMISSION ----------------- The sender then sends a ZFILE header with zmodem Conversion, Management, and Transport options (see ZFILE header type) followed by a ZCRCW data subpacket containing the file name, file length and modification date. The receiver examines the file name, length, and date information provided by the sender in the context of the specified transfer options, the current state of its file system(s), and local security requirements. The receiving program should insure the pathname and options are compatible with its operating environment and local security requirements. The receiver may respond with a ZSKIP header, which makes the sender proceed to the next file (if any) in the batch. The receiver has a file with the same name and length, may respond with a ZCRC header with a byte count, which requires the sender to perform a 32 bit CRC on the specified number of bytes in the file and transmit the complement of the CRC in an answering ZCRC header.the crc is initialised to 0xfffffff; a byte count of 0 implies the entire file the receiver uses this information to determine whether to accept the file or skip it. This sequence may be triggered by the ZMCRC Management Option. A ZRPOS header from the receiver initiates transmission of the file data starting at the offset in the file specified in the ZRPOS header. Normally the receiver specifies the data transfer to begin begin at offset 0 in the file. The receiver may start the transfer further down in the file. This allows a file transfer interrupted by a loss of carrier or system crash to be completed on the next connection without requiring the entire file to be retransmitted. If downloading a file from a timesharing system that becomes sluggish, the transfer can be interrupted and resumed later with no loss of data. The sender sends a ZDATA binary header (with file position) followed by one or more data subpackets. The receiver compares the file position in the ZDATA header with the number of characters successfully received to the file. If they do not agree, a ZRPOS error response is generated to force the sender to the right position within the file. (if the ZMSPARS option is used the receiver instead seeks to the position given in the ZDATA header) A data subpacket terminated by ZCRCG and CRC does not elicit a response unless an error is detected; more data subpacket(s) follow immediately. ZCRCQ data subpackets expect a ZACK response with the receiver's file offset if no error, otherwise a ZRPOS response with the last good file offset. Another data subpacket continues immediately. ZCRCQ subpackets are not used if the receiver does not indicate full duplex ability with the CANFDX bit. ZCRCW data subpackets expect a response before the next frame is sent. If the receiver does not indicate overlapped I/O capability with the CANOVIO bit, or sets a buffer size, the sender uses the ZCRCW to allow the receiver to write its buffer before sending more data. A zero length data frame may be used as an idle subpacket to prevent the receiver from timing out in case data is not immediately available to the sender. In the absence of fatal error, the sender eventually encounters end of file. If the end of file is encountered within a frame, the frame is closed with a ZCRCE data subpacket which does not elicit a response except in case of error. The sender sends a ZEOF header with the file ending offset equal to the number of characters in the file. The receiver compares this number with the number of characters received. If the receiver has received all of the file, it closes the file. If the file close was satisfactory, the receiver responds with ZRINIT. If the receiver has not received all the bytes of the file, the receiver ignores the ZEOF because a new ZDATA is coming. If the receiver cannot properly close the file, a ZFERR header is sent. After all files are processed, any further protocol errors should not prevent the sending program from returning with a success status. SESSION CLEANUP --------------- The sender closes the session with a ZFIN header. The receiver acknowledges this with its own ZFIN header. When the sender receives the acknowledging header, it sends two characters, "OO" (Over and Out) and exits. The receiver waits briefly for the "O" characters, then exits whether they were received or not. SESSION ABORT SEQUENCE ---------------------- If the receiver is receiving data in streaming mode, the Attn sequence is executed to interrupt data transmission before the Cancel sequence is sent. The Cancel sequence consists of eight CAN characters and ten backspace characters. zmodem only requires five Cancel characters, the other three are "insurance". The trailing backspace characters attempt to erase the effects of the CAN characters if they are received by a command interpreter. char ses_abort_seq[] = { 24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0 }; ATTENTION SEQUENCE ------------------ The receiving program sends the Attn sequence whenever it detects an error and needs to interrupt the sending program. The default Attn string value is empty (no Attn sequence). The receiving program resets Attn to the empty default before each transfer session. The sender specifies the Attn sequence in its optional ZSINIT frame. The Attn string is terminated with a null. FRAME TYPES ----------- The numeric values are listed at the end of this file. Unused bits and unused bytes in the header (ZP0...ZP3) are set to 0. ZRQINIT ------- Sent by the sending program, to trigger the receiving program to send its ZRINIT header. The sending program may repeat the receive invitation (including ZRQINIT) if a response is not obtained at first. ZF0 contains ZCOMMAND if the program is attempting to send a command, 0 otherwise. ZRINIT ------ Sent by the receiving program. ZF0 and ZF1 contain the bitwise or of the receiver capability flags: CANCRY receiver can decrypt CANFDX receiver can send and receive true full duplex CANOVIO receiver can receive data during disk I/O CANBRK receiver can send a break signal CANCRY receiver can decrypt CANLZW receiver can uncompress CANFC32 receiver can use 32 bit Frame Check ESCCTL receiver expects ctl chars to be escaped ESC8 receiver expects 8th bit to be escaped ZP0 and ZP1 contain the size of the receiver's buffer in bytes, or 0 if nonstop I/O is allowed. while all these capabilities are nice in theory most zmodem implem- tations balk at anything other than 0,0. i.e. telix starts sending 35 byte packets when CANFC32 is on. ZSINIT ------ The Sender sends flags followed by a binary data subpacket terminated with ZCRCW. TESCCTL Transmitter expects ctl chars to be escaped TESC8 Transmitter expects 8th bit to be escaped The data subpacket contains the null terminated Attn sequence, maximum length 32 bytes including the terminating null. ZACK ---- Acknowledgment to a ZSINIT frame, ZCHALLENGE header, ZCRCQ or ZCRCW data subpacket. ZP0 to ZP3 contain file offset. The response to ZCHALLENGE contains the same 32 bit number received in the ZCHALLENGE header. ZFILE ----- This frame denotes the beginning of a file transmission attempt. ZF0, ZF1, and ZF2 may contain options. A value of 0 in each of these bytes implies no special treatment. Options specified to the receiver override options specified to the sender with the exception of ZCBIN. A ZCBIN from the sender overrides any other Conversion Option given to the receiver except ZCRESUM. A ZCBIN from the receiver overrides any other Conversion Option sent by the sender. ZF0: CONVERSION OPTION ---------------------- If the receiver does not recognize the Conversion Option, an application dependent default conversion may apply. ZCBIN "Binary" transfer - inhibit conversion unconditionally ZCNL Convert received end of line to local end of line convention. The supported end of line conventions are CR/LF (most ASCII based operating systems except Unix and Macintosh), and NL (Unix). Either of these two end of line conventions meet the permissible ASCII definitions for Carriage Return and Line Feed/New Line. Neither the ASCII code nor zmodem ZCNL encompass lines separated only by carriage returns. Other processing appropriate to ASCII text files and the local operating system may also be applied by the receiver. (filtering RUBOUT NULL Ctrl-Z etc) ZCRECOV Recover/Resume interrupted file transfer. ZCREVOV is also useful for updating a remote copy of a file that grows without resending of old data. If the destination file exists and is no longer than the source, append to the destination file and start transfer at the offset corresponding to the receiver's end of file. This option does not apply if the source file is shorter. Files that have been converted (e.g., ZCNL) or subject to a single ended Transport Option cannot have their transfers recovered. ZF1: Management Option ---------------------- If the receiver does not recognize the Management Option, the file should be transferred normally. The ZMSKNOLOC bit instructs the receiver to bypass the current file if the receiver does not have a file with the same name. Five bits (defined by ZMMASK) define the following set of mutually exclusive management options. ZMNEWL Transfer file if destination file absent. Otherwise, transfer file overwriting destination if the source file is newer or longer. ZMCRC Compare the source and destination files. Transfer if file lengths or file polynomials differ. ZMAPND Append source file contents to the end of the existing destination file (if any). ZMCLOB Replace existing destination file (if any). ZMDIFF Transfer file if destination file absent. Otherwise, transfer file overwriting destination if files have different lengths or dates. ZMPROT Protect destination file by transferring file only if the destination file is absent. ZMNEW Transfer file if destination file absent. Otherwise, transfer file overwriting destination if the source file is newer. ZF2: TRANSPORT OPTION --------------------- If the receiver does not implement the particular transport option, the file is copied without conversion for later processing. better not to use these; see readme ZTLZW Lempel-Ziv compression. Transmitted data will be identical to that produced by compress 4.0 operating on a computer with VAX byte ordering, using 12 bit encoding. ZTCRYPT Encryption. An initial null terminated string identifies the key. Details to be determined. ZTRLE Run Length encoding, Details to be determined. A ZCRCW data subpacket follows with file name, file length, modification date, and other information described in a later chapter. ZF3: EXTENDED OPTIONS --------------------- The Extended Options are bit encoded. ZTSPARS Special processing for sparse files, or sender managed selective retransmission. Each file segment is transmitted as a separate frame, where the frames are not necessarily contiguous. The sender should end each segment with a ZCRCW data subpacket and process the expected ZACK to insure no data is lost. ZTSPARS cannot be used with ZCNL. ZSKIP ----- Sent by the receiver in response to ZFILE, makes the sender skip to the next file. ZNAK ---- Indicates last header was garbled. (See also ZRPOS). ZABORT ------ Sent by receiver to terminate batch file transfers when requested by the user. Sender responds with a ZFIN sequence. (or ZCOMPL in case of server mode). ZFIN ---- Sent by sending program to terminate a zmodem session. Receiver responds with its own ZFIN. ZRPOS ----- Sent by receiver to force file transfer to resume at file offset given in ZP0...ZP3. ZDATA ----- ZP0...ZP3 contain file offset. One or more data subpackets follow. ZEOF ---- Sender reports End of File. ZP0...ZP3 contain the ending file offset. ZFERR ----- Error in reading or writing file, protocol equivalent to ZABORT. ZCRC ---- Request (receiver) and response (sender) for file polynomial. ZP0...ZP3 contain file polynomial. ZCHALLENGE ---------- Request sender to echo a random number in ZP0...ZP3 in a ZACK frame. Sent by the receiving program to the sending program to verify that it is connected to an operating program, and was not activated by spurious data or a Trojan Horse message. this is the most simply defeated security system ever invented. don't rely on it and better still don't use or implement it. build your security measures around starting the download at all and disallow explicit path names. ZCOMPL ------ Request now completed. ZCAN ---- This is a pseudo frame type in response to a Session Abort sequence. ZFREECNT -------- Sending program requests a ZACK frame with ZP0...ZP3 containing the number of free bytes on the current file system. A value of 0 represents an indefinite amount of free space. ZCOMMAND -------- ZCOMMAND is sent in a binary frame. ZF0 contains 0 or ZCACK1 (see below). A ZCRCW data subpacket follows, with the ASCII text command string terminated with a NULL character. If the command is intended to be executed by the operating system hosting the receiving program (e.g., "shell escape"), it must have "!" as the first character. Otherwise the command is meant to be executed by the application program which receives the command. If the receiver detects an illegal or badly formed command, the receiver immediately responds with a ZCOMPL header with an error code in ZP0...ZP3. If ZF0 contained ZCACK1, the receiver immediately responds with a ZCOMPL header with 0 status. Otherwise, the receiver responds with a ZCOMPL header when the operation is completed. The exit status of the completed command is stored in ZP0...ZP3. A 0 exit status implies nominal completion of the command. If the command causes a file to be transmitted, the command sender will see a ZRQINIT frame from the other computer attempting to send data. The sender examines ZF0 of the received ZRQINIT header to verify it is not an echo of its own ZRQINIT header. It is illegal for the sending program to command the receiving program to send a command. If the receiver program does not implement command downloading, it may display the command to the standard error output, then return a ZCOMPL header. ZFILE FRAME FILE INFORMATION SUBPACKET -------------------------------------- zmodem sends the same file information with the ZFILE frame data The pathname (file name) field is mandatory. each field after pathname is optional and separated from the previous one by a space. fields may not be skipped. the use of the optional fields is (by definition) optional to the receiver. PATHNAME -------- The pathname (conventionally, the file name) is sent as a null terminated ASCII string. No spaces are included in the pathname. Filename Considerations - File names should be translated to lower case unless the sending system supports upper/lower case file names. This is a convenience for users of systems (such as Unix) which store filenames in upper and lower case. - The receiver should accommodate file names in lower and upper case. - When transmitting files between different operating systems, file names must be acceptable to both the sender and receiving operating systems. If not, transformations should be applied to make the file names acceptable. If the transformations are unsuccessful, a new file name may be invented be the receiving program. - If directories are included, they are delimited by /; i.e., "subdir/foo" is acceptable, "subdir\foo" is not. LENGTH ------ The length field is stored as a decimal string counting the number of data bytes in the file. The zmodem receiver uses the file length as an estimate only. It may be used to display an estimate of the transmission time, and may be compared with the amount of free disk space. The actual length of the received file is determined by the data transfer. A file may grow after transmission commences, and all the data will be sent. MODIFICATION DATE ----------------- The mod date is sent as an octal number giving the time the contents of the file were last changed measured in seconds from Jan 1 1970 Universal Coordinated Time (GMT). A date of 0 implies the modification date is unknown and should be left as the date the file is received. This standard format was chosen to eliminate ambiguities arising from transfers between different time zones. FILE MODE --------- The file mode is stored as an octal string. Unless the file originated from a Unix system, the file mode is set to 0. SERIAL NUMBER ------------- set this field to 0. NUMBER OF FILES REMAINING ------------------------- This field is coded as a decimal number, and includes the current file. This field is an estimate, and incorrect values must not be allowed to cause loss of data. NUMBER OF BYTES REMAINING ------------------------- This field is coded as a decimal number, and includes the current file. This field is an estimate, and incorrect values must not be allowed to cause loss of data. FILE TYPE --------- set this field to 0. The file information is terminated by a null. If only the pathname is sent, the pathname is terminated with two nulls. The length of the file information subpacket, including the trailing null, must not exceed 1024 bytes; a typical length is less than 64 bytes. STREAMING TECHNIQUES / ERROR RECOVERY ------------------------------------- zmodem provides several data streaming methods selected according to the limitations of the sending environment, receiving environment, and transmission channel(s). WINDOW MANAGEMENT ----------------- When sending data through a network, some nodes of the network store data while it is transferred to the receiver. 7000 bytes and more of transient storage have been observed. Such a large amount of storage causes the transmitter to "get ahead" of the receiver. This condition is not fatal but it does slow error recovery. To manage the window size, the sending program uses ZCRCQ data subpackets to trigger ZACK headers from the receiver. The returning ZACK headers inform the sender of the receiver's progress. When the window size (current transmitter file offset - last reported receiver file offset) exceeds a specified value, the sender waits for a ZACK packet with a receiver file offset that reduces the window size. ZRPOS and other error packets are handled normally. FULL STREAMING WITH SAMPLING ---------------------------- If the receiver can overlap serial I/O with disk I/O, and if the sender can sample the reverse channel for the presence of data without having to wait, full streaming can be used with no Attn sequence required. The sender begins data transmission with a ZDATA header and continuous ZCRCG data subpackets. When the receiver detects an error, it executes the Attn sequence and then sends a ZRPOS header with the correct position within the file. At the end of each transmitted data subpacket, the sender checks for the presence of an error header from the receiver. To do this, the sender samples the reverse data stream for the presence of either a ZPAD or CAN character (using rdchk() or a similar mechanism) . Flow control characters (if present) are acted upon. Other characters (indicating line noise) increment a counter which is reset whenever the sender waits for a header from the receiver. If the counter overflows, the sender sends the next data subpacket as ZCRCW, and waits for a response. ZPAD indicates some sort of error header from the receiver. A CAN suggests the user is attempting to "stop the bubble machine" by keyboarding CAN characters. If one of these characters is seen, an empty ZCRCE data subpacket is sent. Normally, the receiver will have sent an ZRPOS or other error header, which will force the sender to resume transmission at a different address, or take other action. In the unlikely event the ZPAD or CAN character was spurious, the receiver will time out and send a ZRPOS header. The obvious choice of ZCRCW packet, which would trigger an ZACK from the receiver, is not used because multiple in transit frames could result if the channel has a long propagation delay. Then the receiver's response header is read and acted upon; starting with a resinchronize. A ZRPOS header resets the sender's file offset to the correct position. If possible, the sender should purge its output buffers and/or networks of all unprocessed output data, to minimize the amount of unwanted data the receiver must discard before receiving data starting at the correct file offset. The next transmitted data frame should be a ZCRCW frame followed by a wait to guarantee complete flushing of the network's memory. If the receiver gets a ZACK header with an address that disagrees with the sender address, it is ignored, and the sender waits for another header. A ZFIN, ZABORT, or TIMEOUT terminates the session; a ZSKIP terminates the processing of this file. The reverse channel is then sampled for the presence of another header from the receiver (if sampling is possible). if one is detected another error header is read. Otherwise, transmission resumes at the (possibly reset) file offset with a ZDATA header followed by data subpackets. FULL STREAMING WITH REVERSE INTERRUPT ------------------------------------- The above method cannot be used if the reverse data stream cannot be sampled without entering an I/O wait. An alternate method is to instruct the receiver to interrupt the sending program when an error is detected. The receiver can interrupt the sender with a control character, break signal, or combination thereof, as specified in the Attn sequence. After executing the Attn sequence, the receiver sends a hex ZRPOS header to force the sender to resend the lost data. When the sending program responds to this interrupt, it reads a HEX header (normally ZRPOS) from the receiver and takes the action described in the previous section. FULL STREAMING WITH SLIDING WINDOW ---------------------------------- If none of the above methods is applicable, hope is not yet lost. If the sender can buffer responses from the receiver, the sender can use ZCRCQ data subpackets to get ACKs from the receiver without interrupting the transmission of data. After a sufficient number of ZCRCQ data subpackets have been sent, the sender can read one of the headers that should have arrived in its receive interrupt buffer. A problem with this method is the possibility of wasting an excessive amount of time responding to the receiver's error header. It may be possible to program the receiver's Attn sequence to flush the sender's interrupt buffer before sending the ZRPOS header. SEGMENTED STREAMING ------------------- If the receiver cannot overlap serial and disk I/O, it uses the ZRINIT frame to specify a buffer length which the sender will not overflow. The sending program sends a ZCRCW data subpacket and waits for a ZACK header before sending the next segment of the file. A sufficiently large receiving buffer allows throughput to closely approach that of full streaming. For example, 16kb segmented streaming adds about 3 per cent to full streaming zmodem file transfer times when the round trip delay is five seconds. CONSTANTS --------- ASCII ----- SOH 0x01 STX 0x02 EOT 0x04 ENQ 0x05 ACK 0x06 LF 0x0a CR 0x0d XON 0x11 XOFF 0x13 NAK 0x15 CAN 0x18 ZMODEM ------ ZPAD 0x2a /* pad character; begins frames */ ZDLE 0x18 /* ctrl-x zmodem escape */ ZDLEE 0x58 /* escaped ZDLE */ ZBIN 0x41 /* binary frame indicator (CRC16) */ ZHEX 0x42 /* hex frame indicator */ ZBIN32 0x43 /* binary frame indicator (CRC32) */ ZBINR32 0x44 /* run length encoded binary frame (CRC32) */ ZVBIN 0x61 /* binary frame indicator (CRC16) */ ZVHEX 0x62 /* hex frame indicator */ ZVBIN32 0x63 /* binary frame indicator (CRC32) */ ZVBINR32 0x64 /* run length encoded binary frame (CRC32) */ ZRESC 0x7e /* run length encoding flag / escape character */ FRAME TYPES ----------- ZRQINIT 0x00 /* request receive init (s->r) */ ZRINIT 0x01 /* receive init (r->s) */ ZSINIT 0x02 /* send init sequence (optional) (s->r) */ ZACK 0x03 /* ack to ZRQINIT ZRINIT or ZSINIT (s<->r) */ ZFILE 0x04 /* file name (s->r) */ ZSKIP 0x05 /* skip this file (r->s) */ ZNAK 0x06 /* last packet was corrupted (?) */ ZABORT 0x07 /* abort batch transfers (?) */ ZFIN 0x08 /* finish session (s<->r) */ ZRPOS 0x09 /* resume data transmission here (r->s) */ ZDATA 0x0a /* data packet(s) follow (s->r) */ ZEOF 0x0b /* end of file reached (s->r) */ ZFERR 0x0c /* fatal read or write error detected (?) */ ZCRC 0x0d /* request for file CRC and response (?) */ ZCHALLENGE 0x0e /* security challenge (r->s) */ ZCOMPL 0x0f /* request is complete (?) */ ZCAN 0x10 /* pseudo frame; other end cancelled session with 5* CAN */ ZFREECNT 0x11 /* request free bytes on file system (s->r) */ ZCOMMAND 0x12 /* issue command (s->r) */ ZSTDERR 0x13 /* output data to stderr (??) */ ZDLE SEQUENCES -------------- ZCRCE 0x68 /* CRC next, frame ends, header packet follows */ ZCRCG 0x69 /* CRC next, frame continues nonstop */ ZCRCQ 0x6a /* CRC next, frame continuous, ZACK expected */ ZCRCW 0x6b /* CRC next, ZACK expected, end of frame */ ZRUB0 0x6c /* translate to rubout 0x7f */ ZRUB1 0x6d /* translate to rubout 0xff */ RECEIVER CAPABILITY FLAGS ------------------------- CANFDX 0x01 /* Rx can send and receive true full duplex */ CANOVIO 0x02 /* Rx can receive data during disk I/O */ CANBRK 0x04 /* Rx can send a break signal */ CANCRY 0x08 /* Receiver can decrypt */ CANLZW 0x10 /* Receiver can uncompress */ CANFC32 0x20 /* Receiver can use 32 bit Frame Check */ ESCCTL 0x40 /* Receiver expects ctl chars to be escaped ESC8 0x80 /* Receiver expects 8th bit to be escaped */ lrzsz-0.13.1/doc/zmodem-forsberg.txt0000664000175000017500000031315705747145232013076 The ZMODEM Inter Application File Transfer Protocol Chuck Forsberg Omen Technology Inc A overview of this document is available as ZMODEM.OV (in ZMDMOV.ARC) This file may be redistributed without restriction provided the text is not altered. Please distribute as widely as possible. Omen Technology Incorporated The High Reliability Software 17505-V Northwest Sauvie Island Road Portland Oregon 97231 VOICE: 503-621-3406 :VOICE Modem: 503-621-3746 Speed 1200,2400,19200(Telebit PEP) Compuserve:70007,2304 GEnie:CAF UUCP: ...!tektronix!reed!omen!caf Chapter 0 Rev Oct-14-88 Typeset 10-14-88 1 Chapter 0 ZMODEM Protocol 2 1. INTENDED AUDIENCE This document is intended for telecommunications managers, systems programmers, and others who choose and implement asynchronous file transfer protocols over dial-up networks and related environments. 2. WHY DEVELOP ZMODEM? Since its development half a decade ago, the Ward Christensen MODEM protocol has enabled a wide variety of computer systems to interchange data. There is hardly a communications program that doesn't at least claim to support this protocol, now called XMODEM. Advances in computing, modems and networking have spread the XMODEM protocol far beyond the micro to micro environment for which it was designed. These application have exposed some weaknesses: + The awkward user interface is suitable for computer hobbyists. Multiple commands must be keyboarded to transfer each file. + Since commands must be given to both programs, simple menu selections are not possible. + The short block length causes throughput to suffer when used with timesharing systems, packet switched networks, satellite circuits, and buffered (error correcting) modems. + The 8 bit checksum and unprotected supervison allow undetected errors and disrupted file transfers. + Only one file can be sent per command. The file name has to be given twice, first to the sending program and then again to the receiving program. + The transmitted file accumulates as many as 127 bytes of garbage. + The modification date and other file attributes are lost. + XMODEM requires complete 8 bit transparency, all 256 codes. XMODEM will not operate over some networks that use ASCII flow control or escape codes. Setting network transparency disables important control functions for the duration of the call. A number of other protocols have been developed over the years, but none have proven satisfactory. + Lack of public domain documentation and example programs have kept proprietary protocols such as Relay, Blast, DART, and others tightly bound to the fortunes of their suppliers. These protocols have not benefited from public scrutiny of their design features. Chapter 2 Rev Oct-14-88 Typeset 10-14-88 2 Chapter 2 ZMODEM Protocol 3 + Link level protocols such as X.25, X.PC, and MNP do not manage application to application file transfers. + Link Level protocols do not eliminate end-to-end errors. Interfaces between error-free networks are not necessarily error-free. Sometimes, error-free networks aren't. + The Kermit protocol was developed to allow file transfers in environments hostile to XMODEM. The performance compromises necessary to accommodate traditional mainframe environments limit Kermit's efficiency. Even with completely transparent channels, Kermit control character quoting limits the efficiency of binary file transfers to about 75 per cent.[1] A number of submodes are used in various Kermit programs, including different methods of transferring binary files. Two Kermit programs will mysteriously fail to operate with each other if the user has not correctly specified these submodes. Kermit Sliding Windows ("SuperKermit") improves throughput over networks at the cost of increased complexity. SuperKermit requires full duplex communications and the ability to check for the presence of characters in the input queue, precluding its implementation on some operating systems. SuperKermit state transitions are encoded in a special language "wart" which requires a C compiler. SuperKermit sends an ACK packet for each data packet of 96 bytes (fewer if control characters are present). This reduces throughput on high speed modems, from 1350 to 177 characters per second in one test. A number of extensions to the XMODEM protocol have been made to improve performance and (in some cases) the user interface. They provide useful improvements in some applications but not in others. XMODEM's unprotected control messages compromise their reliability. Complex proprietary techniques such as Cybernetic Data Recovery(TM)[2] improve reliability, but are not universally available. Some of the XMODEM mutant protocols have significant design flaws of their own. + XMODEM-k uses 1024 byte blocks to reduce the overhead from transmission delays by 87 per cent compared to XMODEM, but network delays still __________ 1. Some Kermit programs support run length encoding. 2. Unique to DSZ, ZCOMM, Professional-YAM and PowerCom Chapter 2 Rev Oct-14-88 Typeset 10-14-88 3 Chapter 2 ZMODEM Protocol 4 degrade performance. Some networks cannot transmit 1024 byte packets without flow control, which is difficult to apply without impairing the perfect transparency required by XMODEM. XMODEM-k adds garbage to received files. + YMODEM sends the file name, file length, and creation date at the beginning of each file, and allows optional 1024 byte blocks for improved throughput. The handling of files that are not a multiple of 1024 or 128 bytes is awkward, especially if the file length is not known in advance, or changes during transmission. The large number of non conforming and substandard programs claiming to support YMODEM further complicates its use. + YMODEM-g provides efficient batch file transfers, preserving exact file length and file modification date. YMODEM-g is a modification to YMODEM wherein ACKs for data blocks are not used. YMODEM-g is essentially insensitive to network delays. Because it does not support error recovery, YMODEM-g must be used hard wired or with a reliable link level protocol. Successful application at high speed requires cafeful attention to transparent flow control. When YMODEM-g detects a CRC error, data transfers are aborted. YMODEM-g is easy to implement because it closely resembles standard YMODEM-1k. + WXMODEM, SEAlink, and MEGAlink have applied a subset of ZMODEM's techniques to "Classic XMODEM" to improve upon their suppliers' previous offerings. They provide good performance under ideal conditions. Another XMODEM "extension" is protocol cheating, such as Omen Technology's OverThruster(TM) and OverThruster II(TM). These improve XMODEM throughput under some conditions by compromising error recovery. The ZMODEM Protocol corrects the weaknesses described above while maintaining as much of XMODEM/CRC's simplicity and prior art as possible. 3. ZMODEM Protocol Design Criteria The design of a file transfer protocol is an engineering compromise between conflicting requirements: 3.1 Ease of Use + ZMODEM allows either program to initiate file transfers. + The sender can pass commands and/or modifiers to the receiving program. + File names need be entered only once. Chapter 3 Rev Oct-14-88 Typeset 10-14-88 4 Chapter 3 ZMODEM Protocol 5 + Menu selections are supported. + Wild Card names may be used with batch transfers. + Minimum keystrokes required to initiate transfers. + ZRQINIT frame sent by sending program can trigger automatic downloads. + ZMODEM can optionally step down to YMODEM if the other end does not support ZMODEM.[1] 3.2 Throughput All file transfer protocols make tradeoffs between throughput, reliability, universality, and complexity according to the technology and knowledge base available to their designers. In the design of ZMODEM, three applications deserve special attention. + Network applications with significant delays (relative to character transmission time) and low error rate + Timesharing and buffered modem applications with significant delays and throughput that is quickly degraded by reverse channel traffic. ZMODEM's economy of reverse channel bandwidth allows modems that dynamically partition bandwidth between the two directions to operate at optimal speeds. Special ZMODEM features allow simple, efficient implementation on a wide variety of timesharing hosts. + Traditional direct modem to modem communications with high error rate Unlike Sliding Windows Kermit, ZMODEM is not optimized for optimum throughput when error rate and delays are both high. This tradeoff markedly reduces code complexity and memory requirements. ZMODEM generally provides faster error recovery than network compatible XMODEM implementations. In the absence of network delays, rapid error recovery is possible, much faster than MEGAlink and network compatible versions of YMODEM and XMODEM. File transfers begin immediately regardless of which program is started first, without the 10 second delay associated with XMODEM. __________ 1. Provided the transmission medium accommodates X/YMODEM. Chapter 3 Rev Oct-14-88 Typeset 10-14-88 5 Chapter 3 ZMODEM Protocol 6 3.3 Integrity and Robustness Once a ZMODEM session is begun, all transactions are protected with 16 or 32 bit CRC.[2] Complex proprietary techniques such as Omen Technology's Cybernetic Data Recovery(TM)[3] are not needed for reliable transfers. This complete protection of data and supervisory information accounts for most of ZMODEM's high reliability compared to XMODEM derived protocols including WXMODEM, SEAlink, MEGAlink, etc. An optional 32-bit CRC used as the frame check sequence in ADCCP (ANSI X3.66, also known as FIPS PUB 71 and FED-STD-1003, the U.S. versions of CCITT's X.25) is available. The 32 bit CRC reduces undetected errors by at least five orders of magnitude when properly applied (-1 preset, inversion). A security challenge mechanism guards against "Trojan Horse" messages written to mimic legitimate command or file downloads. 3.4 Ease of Implementation ZMODEM accommodates a wide variety of systems: + Microcomputers that cannot overlap disk and serial i/o + Microcomputers that cannot overlap serial send and receive + Computers and/or networks requiring XON/XOFF flow control + Computers that cannot check the serial input queue for the presence of data without having to wait for the data to arrive. Although ZMODEM provides "hooks" for multiple "threads", ZMODEM is not intended to replace link level protocols such as X.25. ZMODEM accommodates network and timesharing system delays by continuously transmitting data unless the receiver interrupts the sender to request retransmission of garbled data. ZMODEM in effect uses the entire file as a window.[4] Using the entire file as a window simplifies buffer management, avoiding the window overrun failure modes that affect MEGAlink, SuperKermit, and others. __________ 2. Except for the CAN-CAN-CAN-CAN-CAN abort sequence which requires five successive CAN characters. 3. Unique to Professional-YAM, ZCOMM, and PowerCom 4. Streaming strategies are discussed in coming chapters. Chapter 3 Rev Oct-14-88 Typeset 10-14-88 6 Chapter 3 ZMODEM Protocol 7 ZMODEM provides a general purpose application to application file transfer protocol which may be used directly or with with reliable link level protocols such as X.25, MNP, Fastlink, etc. When used with X.25, MNP, Fastlink, etc., ZMODEM detects and corrects errors in the interfaces between error controlled media and the remainder of the communications link. ZMODEM was developed for the public domain under a Telenet contract. The ZMODEM protocol descriptions and the Unix rz/sz program source code are public domain. No licensing, trademark, or copyright restrictions apply to the use of the protocol, the Unix rz/sz source code and the ZMODEM name. 4. EVOLUTION OF ZMODEM In early 1986, Telenet funded a project to develop an improved public domain application to application file transfer protocol. This protocol would alleviate the throughput problems network customers were experiencing with XMODEM and Kermit file transfers. In the beginning, we thought a few modifications to XMODEM would allow high performance over packet switched networks while preserving XMODEM's simplicity. The initial concept would add a block number to the ACK and NAK characters used by XMODEM. The resultant protocol would allow the sender to send more than one block before waiting for a response. But how to add the block number to XMODEM's ACK and NAK? WXMODEM, SEAlink, MEGAlink and some other protocols add binary byte(s) to indicate the block number. Pure binary was unsuitable for ZMODEM because binary code combinations won't pass bidirectionally through some modems, networks and operating systems. Other operating systems may not be able to recognize something coming back[1] unless a break signal or a system dependent code or sequence is present. By the time all this and other problems with the simple ACK/NAK sequences mentioned above were corrected, XMODEM's simple ACK and NACK characters had evolved into a real packet. The Frog was riveting. Managing the window[2] was another problem. Experience gained in __________ 1. Without stopping for a response 2. The WINDOW is the data in transit between sender and receiver. Chapter 4 Rev Oct-14-88 Typeset 10-14-88 7 Chapter 4 ZMODEM Protocol 8 debugging The Source's SuperKermit protocol indicated a window size of about 1000 characters was needed at 1200 bps. High speed modems require a window of 20000 or more characters for full throughput. Much of the SuperKermit's inefficiency, complexity and debugging time centered around its ring buffering and window management. There had to be a better way to get the job done. A sore point with XMODEM and its progeny is error recovery. More to the point, how can the receiver determine whether the sender has responded, or is ready to respond, to a retransmission request? XMODEM attacks the problem by throwing away characters until a certain period of silence. Too short a time allows a spurious pause in output (network or timesharing congestion) to masquerade as error recovery. Too long a timeout devastates throughput, and allows a noisy line to lock up the protocol. SuperKermit solves the problem with a distinct start of packet character (SOH). WXMODEM and ZMODEM use unique character sequences to delineate the start of frames. SEAlink and MEGAlink do not address this problem. A further error recovery problem arises in streaming protocols. How does the receiver know when (or if) the sender has recognized its error signal? Is the next packet the correct response to the error signal? Is it something left over "in the queue"? Or is this new subpacket one of many that will have to be discarded because the sender did not receive the error signal? How long should this continue before sending another error signal? How can the protocol prevent this from degenerating into an argument about mixed signals? SuperKermit uses selective retransmission, so it can accept any good packet it receives. Each time the SuperKermit receiver gets a data packet, it must decide which outstanding packet (if any) it "wants most" to receive, and asks for that one. In practice, complex software "hacks" are needed to attain acceptable robustness.[3] For ZMODEM, we decided to forgo the complexity of SuperKermit's packet assembly scheme and its associated buffer management logic and memory requirements. Another sore point with XMODEM and WXMODEM is the garbage added to files. This was acceptable with the old CP/M files which had no exact length, but not with newer systems such as PC-DOS and Unix. YMODEM uses file length information transmitted in the header block to trim the output file, but this causes data loss when transferring files that grow during a transfer. __________ 3. For example, when SuperKermit encounters certain errors, the wndesr function is called to determine the next block to request. A burst of errors generates several wasteful requests to retransmit the same block. Chapter 4 Rev Oct-14-88 Typeset 10-14-88 8 Chapter 4 ZMODEM Protocol 9 In some cases, the file length may be unknown, as when data is obtained from a process. Variable length data subpackets solve both of these problems. Since some characters had to be escaped anyway, there wasn't any point wasting bytes to fill out a fixed packet length or to specify a variable packet length. In ZMODEM, the length of data subpackets is denoted by ending each subpacket with an escape sequence similar to BISYNC and HDLC. The end result is a ZMOEM header containing a "frame type", four bytes of supervisory information, and its own CRC. Data frames consist of a header followed by 1 or more data subpackets. In the absence of transmission errors, an entire file can be sent in one data frame. Since the sending system may be sensitive to numerous control characters or strip parity in the reverse data path, all of the headers sent by the receiver are sent in hex. A common lower level routine receives all headers, allowing the main program logic to deal with headers and data subpackets as objects. With equivalent binary (efficient) and hex (application friendly) frames, the sending program can send an "invitation to receive" sequence to activate the receiver without crashing the remote application with unexpected control characters. Going "back to scratch" in the protocol design presents an opportunity to steal good ideas from many sources and to add a few new ones. From Kermit and UUCP comes the concept of an initial dialog to exchange system parameters. ZMODEM generalizes Compuserve B Protocol's host controlled transfers to single command AutoDownload and command downloading. A Security Challenge discourages password hackers and Trojan Horse authors from abusing ZMODEM's power. We were also keen to the pain and $uffering of legions of telecommunicators whose file transfers have been ruined by communications and timesharing faults. ZMODEM's file transfer recovery and advanced file management are dedicated to these kindred comrades. After ZMODEM had been operational a short time, Earl Hall pointed out the obvious: ZMODEM's user friendly AutoDownload was almost useless if the user must assign transfer options to each of the sending and receiving programs. Now, transfer options may be specified to/by the sending program, which passes them to the receiving program in the ZFILE header. Chapter 5 Rev Oct-14-88 Typeset 10-14-88 9 Chapter 5 ZMODEM Protocol 10 5. ROSETTA STONE Here are some definitions which reflect current vernacular in the computer media. The attempt here is identify the file transfer protocol rather than specific programs. FRAME A ZMODEM frame consists of a header and 0 or more data subpackets. XMODEM refers to the original 1977 file transfer etiquette introduced by Ward Christensen's MODEM2 program. It's also called the MODEM or MODEM2 protocol. Some who are unaware of MODEM7's unusual batch file mode call it MODEM7. Other aliases include "CP/M Users's Group" and "TERM II FTP 3". This protocol is supported by most communications programs because it is easy to implement. XMODEM/CRC replaces XMODEM's 1 byte checksum with a two byte Cyclical Redundancy Check (CRC-16), improving error detection. XMODEM-1k Refers to XMODEM-CRC with optional 1024 byte blocks. YMODEM refers to the XMODEM/CRC protocol with batch transmission and optional 1024 byte blocks as described in YMODEM.DOC.[1] 6. ZMODEM REQUIREMENTS ZMODEM requires an 8 bit transfer medium.[1] ZMODEM escapes network control characters to allow operation with packet switched networks. In general, ZMODEM operates over any path that supports XMODEM, and over many that don't. To support full streaming,[2] the transmission path should either assert flow control or pass full speed transmission without loss of data. Otherwise the ZMODEM sender must manage the window size. 6.1 File Contents 6.1.1 Binary Files ZMODEM places no constraints on the information content of binary files, except that the number of bits in the file must be a multiple of 8. __________ 1. Available on TeleGodzilla as part of YZMODEM.ZOO 1. The ZMODEM design allows encoded packets for less transparent media. 2. With XOFF and XON, or out of band flow control such as X.25 or CTS Chapter 6 Rev Oct-14-88 Typeset 10-14-88 10 Chapter 6 ZMODEM Protocol 11 6.1.2 Text Files Since ZMODEM is used to transfer files between different types of computer systems, text files must meet minimum requirements if they are to be readable on a wide variety of systems and environments. Text lines consist of printing ASCII characters, spaces, tabs, and backspaces. 6.1.2.1 ASCII End of Line The ASCII code definition allows text lines terminated by a CR/LF (015, 012) sequence, or by a NL (012) character. Lines logically terminated by a lone CR (013) are not ASCII text. A CR (013) without a linefeed implies overprinting, and is not acceptable as a logical line separator. Overprinted lines should print all important characters in the last pass to allow CRT displays to display meaningful text. Overstruck characters may be generated by backspacing or by overprinting the line with CR (015) not followed by LF. Overstruck characters generated with backspaces should be sent with the most important character last to accommodate CRT displays that cannot overstrike. The sending program may use the ZCNL bit to force the receiving program to convert the received end of line to its local end of line convention.[3] __________ 3. Files that have been translated in such a way as to modify their length cannot be updated with the ZCRECOV Conversion Option. Chapter 6 Rev Oct-14-88 Typeset 10-14-88 11 Chapter 6 ZMODEM Protocol 12 7. ZMODEM BASICS 7.1 Packetization ZMODEM frames differ somewhat from XMODEM blocks. XMODEM blocks are not used for the following reasons: + Block numbers are limited to 256 + No provision for variable length blocks + Line hits corrupt protocol signals, causing failed file transfers. In particular, modem errors sometimes generate false block numbers, false EOTs and false ACKs. False ACKs are the most troublesome as they cause the sender to lose synchronization with the receiver. State of the art programs such as Professional-YAM and ZCOMM overcome some of these weaknesses with clever proprietary code, but a stronger protocol is desired. + It is difficult to determine the beginning and ends of XMODEM blocks when line hits cause a loss of synchronization. This precludes rapid error recovery. 7.2 Link Escape Encoding ZMODEM achieves data transparency by extending the 8 bit character set (256 codes) with escape sequences based on the ZMODEM data link escape character ZDLE.[1] Link Escape coding permits variable length data subpackets without the overhead of a separate byte count. It allows the beginning of frames to be detected without special timing techniques, facilitating rapid error recovery. Link Escape coding does add some overhead. The worst case, a file consisting entirely of escaped characters, would incur a 50% overhead. The ZDLE character is special. ZDLE represents a control sequence of some sort. If a ZDLE character appears in binary data, it is prefixed with ZDLE, then sent as ZDLEE. The value for ZDLE is octal 030 (ASCII CAN). This particular value was chosen to allow a string of 5 consecutive CAN characters to abort a ZMODEM __________ 1. This and other constants are defined in the zmodem.h include file. Please note that constants with a leading 0 are octal constants in C. Chapter 7 Rev Oct-14-88 Typeset 10-14-88 12 Chapter 7 ZMODEM Protocol 13 session, compatible with YMODEM session abort. Since CAN is not used in normal terminal operations, interactive applications and communications programs can monitor the data flow for ZDLE. The following characters can be scanned to detect the ZRQINIT header, the invitation to automatically download commands or files. Receipt of five successive CAN characters will abort a ZMODEM session. Eight CAN characters are sent. The receiving program decodes any sequence of ZDLE followed by a byte with bit 6 set and bit 5 reset (upper case letter, either parity) to the equivalent control character by inverting bit 6. This allows the transmitter to escape any control character that cannot be sent by the communications medium. In addition, the receiver recognizes escapes for 0177 and 0377 should these characters need to be escaped. ZMODEM software escapes ZDLE, 020, 0220, 021, 0221, 023, and 0223. If preceded by 0100 or 0300 (@), 015 and 0215 are also escaped to protect the Telenet command escape CR-@-CR. The receiver ignores 021, 0221, 023, and 0223 characters in the data stream. The ZMODEM routines in zm.c accept an option to escape all control characters, to allow operation with less transparent networks. This option can be given to either the sending or receiving program. 7.3 Header All ZMODEM frames begin with a header which may be sent in binary or HEX form. ZMODEM uses a single routine to recognize binary and hex headers. Either form of the header contains the same raw information: + A type byte[2] [3] + Four bytes of data indicating flags and/or numeric quantities depending on the frame type __________ 2. The frame types are cardinal numbers beginning with 0 to minimize state transition table memory requirements. 3. Future extensions to ZMODEM may use the high order bits of the type byte to indicate thread selection. Chapter 7 Rev Oct-14-88 Typeset 10-14-88 13 Chapter 7 ZMODEM Protocol 14 Figure 1. Order of Bytes in Header TYPE: frame type F0: Flags least significant byte P0: file Position least significant P3: file Position most significant TYPE F3 F2 F1 F0 ------------------- TYPE P0 P1 P2 P3 7.3.1 16 Bit CRC Binary Header A binary header is sent by the sending program to the receiving program. ZDLE encoding accommodates XON/XOFF flow control. A binary header begins with the sequence ZPAD, ZDLE, ZBIN. The frame type byte is ZDLE encoded. The four position/flags bytes are ZDLE encoded. A two byte CRC of the frame type and position/flag bytes is ZDLE encoded. 0 or more binary data subpackets with 16 bit CRC will follow depending on the frame type. The function zsbhdr transmits a binary header. The function zgethdr receives a binary or hex header. Figure 2. 16 Bit CRC Binary Header * ZDLE A TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 7.3.2 32 Bit CRC Binary Header A "32 bit CRC" Binary header is similar to a Binary Header, except the ZBIN (A) character is replaced by a ZBIN32 (C) character, and four characters of CRC are sent. 0 or more binary data subpackets with 32 bit CRC will follow depending on the frame type. The common variable Txfcs32 may be set TRUE for 32 bit CRC iff the receiver indicates the capability with the CANFC32 bit. The zgethdr, zsdata and zrdata functions automatically adjust to the type of Frame Check Sequence being used. Figure 3. 32 Bit CRC Binary Header * ZDLE C TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 CRC-3 CRC-4 7.3.3 HEX Header The receiver sends responses in hex headers. The sender also uses hex headers when they are not followed by binary data subpackets. Chapter 7 Rev Oct-14-88 Typeset 10-14-88 14 Chapter 7 ZMODEM Protocol 15 Hex encoding protects the reverse channel from random control characters. The hex header receiving routine ignores parity. Use of Kermit style encoding for control and paritied characters was considered and rejected because of increased possibility of interacting with some timesharing systems' line edit functions. Use of HEX headers from the receiving program allows control characters to be used to interrupt the sender when errors are detected. A HEX header may be used in place of a binary header wherever convenient. If a data packet follows a HEX header, it is protected with CRC-16. A hex header begins with the sequence ZPAD, ZPAD, ZDLE, ZHEX. The zgethdr routine synchronizes with the ZPAD-ZDLE sequence. The extra ZPAD character allows the sending program to detect an asynchronous header (indicating an error condition) and then call zgethdr to receive the header. The type byte, the four position/flag bytes, and the 16 bit CRC thereof are sent in hex using the character set 01234567890abcdef. Upper case hex digits are not allowed; they false trigger XMODEM and YMODEM programs. Since this form of hex encoding detects many patterns of errors, especially missing characters, a hex header with 32 bit CRC has not been defined. A carriage return and line feed are sent with HEX headers. The receive routine expects to see at least one of these characters, two if the first is CR. The CR/LF aids debugging from printouts, and helps overcome certain operating system related problems. An XON character is appended to all HEX packets except ZACK and ZFIN. The XON releases the sender from spurious XOFF flow control characters generated by line noise, a common occurrence. XON is not sent after ZACK headers to protect flow control in streaming situations. XON is not sent after a ZFIN header to allow clean session cleanup. 0 or more data subpackets will follow depending on the frame type. The function zshhdr sends a hex header. Figure 4. HEX Header * * ZDLE B TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 CR LF XON (TYPE, F3...F0, CRC-1, and CRC-2 are each sent as two hex digits.) Chapter 7 Rev Oct-14-88 Typeset 10-14-88 15 Chapter 7 ZMODEM Protocol 16 7.4 Binary Data Subpackets Binary data subpackets immediately follow the associated binary header packet. A binary data packet contains 0 to 1024 bytes of data. Recommended length values are 256 bytes below 2400 bps, 512 at 2400 bps, and 1024 above 4800 bps or when the data link is known to be relatively error free.[4] No padding is used with binary data subpackets. The data bytes are ZDLE encoded and transmitted. A ZDLE and frameend are then sent, followed by two or four ZDLE encoded CRC bytes. The CRC accumulates the data bytes and frameend. The function zsdata sends a data subpacket. The function zrdata receives a data subpacket. 7.5 ASCII Encoded Data Subpacket The format of ASCII Encoded data subpackets is not currently specified. These could be used for server commands, or main transfers in 7 bit environments. 8. PROTOCOL TRANSACTION OVERVIEW As with the XMODEM recommendation, ZMODEM timing is receiver driven. The transmitter should not time out at all, except to abort the program if no headers are received for an extended period of time, say one minute.[1] 8.1 Session Startup To start a ZMODEM file transfer session, the sending program is called with the names of the desired file(s) and option(s). The sending program may send the string "rz\r" to invoke the receiving program from a possible command mode. The "rz" followed by carriage return activates a ZMODEM receive program or command if it were not already active. The sender may then display a message intended for human consumption, such __________ 4. Strategies for adjusting the subpacket length for optimal results based on real time error rates are still evolving. Shorter subpackets speed error detection but increase protocol overhead slightly. 1. Special considerations apply when sending commands. Chapter 8 Rev Oct-14-88 Typeset 10-14-88 16 Chapter 8 ZMODEM Protocol 17 as a list of the files requested, etc. Then the sender may send a ZRQINIT header. The ZRQINIT header causes a previously started receive program to send its ZRINIT header without delay. In an interactive or conversational mode, the receiving application may monitor the data stream for ZDLE. The following characters may be scanned for B00 indicating a ZRQINIT header, a command to download a command or data. The sending program awaits a command from the receiving program to start file transfers. If a "C", "G", or NAK is received, an XMODEM or YMODEM file transfer is indicated, and file transfer(s) use the YMODEM protocol. Note: With ZMODEM and YMODEM, the sending program provides the file name, but not with XMODEM. In case of garbled data, the sending program can repeat the invitation to receive a number of times until a session starts. When the ZMODEM receive program starts, it immediately sends a ZRINIT header to initiate ZMODEM file transfers, or a ZCHALLENGE header to verify the sending program. The receive program resends its header at response time (default 10 second) intervals for a suitable period of time (40 seconds total) before falling back to YMODEM protocol. If the receiving program receives a ZRQINIT header, it resends the ZRINIT header. If the sending program receives the ZCHALLENGE header, it places the data in ZP0...ZP3 in an answering ZACK header. If the receiving program receives a ZRINIT header, it is an echo indicating that the sending program is not operational. Eventually the sending program correctly receives the ZRINIT header. The sender may then send an optional ZSINIT frame to define the receiving program's Attn sequence, or to specify complete control character escaping.[2] If the ZSINIT header specifies ESCCTL or ESC8, a HEX header is used, and the receiver activates the specified ESC modes before reading the following data subpacket. The receiver sends a ZACK header in response, containing either the serial __________ 2. If the receiver specifies the same or higher level of escaping, the ZSINIT frame need not be sent unless an Attn sequence is needed. Chapter 8 Rev Oct-14-88 Typeset 10-14-88 17 Chapter 8 ZMODEM Protocol 18 number of the receiving program, or 0. 8.2 File Transmission The sender then sends a ZFILE header with ZMODEM Conversion, Management, and Transport options[3] followed by a ZCRCW data subpacket containing the file name, file length, modification date, and other information identical to that used by YMODEM Batch. The receiver examines the file name, length, and date information provided by the sender in the context of the specified transfer options, the current state of its file system(s), and local security requirements. The receiving program should insure the pathname and options are compatible with its operating environment and local security requirements. The receiver may respond with a ZSKIP header, which makes the sender proceed to the next file (if any) in the batch. The receiver has a file with the same name and length, may respond with a ZCRC header with a byte count, which requires the sender to perform a 32 bit CRC on the specified number of bytes in the file and transmit the complement of the CRC in an answering ZCRC header.[4] The receiver uses this information to determine whether to accept the file or skip it. This sequence may be triggered by the ZMCRC Management Option. A ZRPOS header from the receiver initiates transmission of the file data starting at the offset in the file specified in the ZRPOS header. Normally the receiver specifies the data transfer to begin begin at offset 0 in the file. The receiver may start the transfer further down in the file. This allows a file transfer interrupted by a loss or carrier or system crash to be completed on the next connection without requiring the entire file to be retransmitted.[5] If downloading a file from a timesharing system that becomes sluggish, the transfer can be interrupted and resumed later with no loss of data. The sender sends a ZDATA binary header (with file position) followed by __________ 3. See below, under ZFILE header type. 4. The crc is initialized to 0xFFFFFFFF. A byte count of 0 implies the entire file. 5. This does not apply to files that have been translated. Chapter 8 Rev Oct-14-88 Typeset 10-14-88 18 Chapter 8 ZMODEM Protocol 19 one or more data subpackets. The receiver compares the file position in the ZDATA header with the number of characters successfully received to the file. If they do not agree, a ZRPOS error response is generated to force the sender to the right position within the file.[6] A data subpacket terminated by ZCRCG and CRC does not elicit a response unless an error is detected; more data subpacket(s) follow immediately. ZCRCQ data subpackets expect a ZACK response with the receiver's file offset if no error, otherwise a ZRPOS response with the last good file offset. Another data subpacket continues immediately. ZCRCQ subpackets are not used if the receiver does not indicate FDX ability with the CANFDX bit. ZCRCW data subpackets expect a response before the next frame is sent. If the receiver does not indicate overlapped I/O capability with the CANOVIO bit, or sets a buffer size, the sender uses the ZCRCW to allow the receiver to write its buffer before sending more data. A zero length data frame may be used as an idle subpacket to prevent the receiver from timing out in case data is not immediately available to the sender. In the absence of fatal error, the sender eventually encounters end of file. If the end of file is encountered within a frame, the frame is closed with a ZCRCE data subpacket which does not elicit a response except in case of error. The sender sends a ZEOF header with the file ending offset equal to the number of characters in the file. The receiver compares this number with the number of characters received. If the receiver has received all of the file, it closes the file. If the file close was satisfactory, the receiver responds with ZRINIT. If the receiver has not received all the bytes of the file, the receiver ignores the ZEOF because a new ZDATA is coming. If the receiver cannot properly close the file, a ZFERR header is sent. __________ 6. If the ZMSPARS option is used, the receiver instead seeks to the position given in the ZDATA header. Chapter 8 Rev Oct-14-88 Typeset 10-14-88 19 Chapter 8 ZMODEM Protocol 20 After all files are processed, any further protocol errors should not prevent the sending program from returning with a success status. 8.3 Session Cleanup The sender closes the session with a ZFIN header. The receiver acknowledges this with its own ZFIN header. When the sender receives the acknowledging header, it sends two characters, "OO" (Over and Out) and exits to the operating system or application that invoked it. The receiver waits briefly for the "O" characters, then exits whether they were received or not. 8.4 Session Abort Sequence If the receiver is receiving data in streaming mode, the Attn sequence is executed to interrupt data transmission before the Cancel sequence is sent. The Cancel sequence consists of eight CAN characters and ten backspace characters. ZMODEM only requires five Cancel characters, the other three are "insurance". The trailing backspace characters attempt to erase the effects of the CAN characters if they are received by a command interpreter. static char canistr[] = { 24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0 }; Chapter 8 Rev Oct-14-88 Typeset 10-14-88 20 Chapter 8 ZMODEM Protocol 21 9. STREAMING TECHNIQUES / ERROR RECOVERY It is a fact of life that no single method of streaming is applicable to a majority of today's computing and telecommunications environments. ZMODEM provides several data streaming methods selected according to the limitations of the sending environment, receiving environment, and transmission channel(s). 9.1 Full Streaming with Sampling If the receiver can overlap serial I/O with disk I/O, and if the sender can sample the reverse channel for the presence of data without having to wait, full streaming can be used with no Attn sequence required. The sender begins data transmission with a ZDATA header and continuous ZCRCG data subpackets. When the receiver detects an error, it executes the Attn sequence and then sends a ZRPOS header with the correct position within the file. At the end of each transmitted data subpacket, the sender checks for the presence of an error header from the receiver. To do this, the sender samples the reverse data stream for the presence of either a ZPAD or CAN character.[1] Flow control characters (if present) are acted upon. Other characters (indicating line noise) increment a counter which is reset whenever the sender waits for a header from the receiver. If the counter overflows, the sender sends the next data subpacket as ZCRCW, and waits for a response. ZPAD indicates some sort of error header from the receiver. A CAN suggests the user is attempting to "stop the bubble machine" by keyboarding CAN characters. If one of these characters is seen, an empty ZCRCE data subpacket is sent. Normally, the receiver will have sent an ZRPOS or other error header, which will force the sender to resume transmission at a different address, or take other action. In the unlikely event the ZPAD or CAN character was spurious, the receiver will time out and send a ZRPOS header.[2] Then the receiver's response header is read and acted upon.[3] __________ 1. The call to rdchk() in sz.c performs this function. 2. The obvious choice of ZCRCW packet, which would trigger an ZACK from the receiver, is not used because multiple in transit frames could result if the channel has a long propagation delay. 3. The call to getinsync() in sz.c performs this function. Chapter 9 Rev Oct-14-88 Typeset 10-14-88 21 Chapter 9 ZMODEM Protocol 22 A ZRPOS header resets the sender's file offset to the correct position. If possible, the sender should purge its output buffers and/or networks of all unprocessed output data, to minimize the amount of unwanted data the receiver must discard before receiving data starting at the correct file offset. The next transmitted data frame should be a ZCRCW frame followed by a wait to guarantee complete flushing of the network's memory. If the receiver gets a ZACK header with an address that disagrees with the sender address, it is ignored, and the sender waits for another header. A ZFIN, ZABORT, or TIMEOUT terminates the session; a ZSKIP terminates the processing of this file. The reverse channel is then sampled for the presence of another header from the receiver.[4] if one is detected, the getinsync() function is again called to read another error header. Otherwise, transmission resumes at the (possibly reset) file offset with a ZDATA header followed by data subpackets. 9.1.1 Window Management When sending data through a network, some nodes of the network store data while it is transferred to the receiver. 7000 bytes and more of transient storage have been observed. Such a large amount of storage causes the transmitter to "get ahead" of the reciever. This can be fatal with MEGAlink and other protocols that depend on timely notification of errors from the receiver. This condition is not fatal with ZMODEM, but it does slow error recovery. To manage the window size, the sending program uses ZCRCQ data subpackets to trigger ZACK headers from the receiver. The returning ZACK headers inform the sender of the receiver's progress. When the window size (current transmitter file offset - last reported receiver file offset) exceeds a specified value, the sender waits for a ZACK[5] packet with a receiver file offset that reduces the window size. Unix sz versions beginning with May 9 1987 control the window size with the "-w N" option, where N is the maximum window size. Pro-YAM, ZCOMM and DSZ versions beginning with May 9 1987 control the window size with "zmodem pwN". This is compatible with previous versions of these programs.[6] __________ 4. If sampling is possible. 5. ZRPOS and other error packets are handled normally. 6. When used with modems or networks that simultaneously assert flow Chapter 9 Rev Oct-14-88 Typeset 10-14-88 22 Chapter 9 ZMODEM Protocol 23 9.2 Full Streaming with Reverse Interrupt The above method cannot be used if the reverse data stream cannot be sampled without entering an I/O wait. An alternate method is to instruct the receiver to interrupt the sending program when an error is detected. The receiver can interrupt the sender with a control character, break signal, or combination thereof, as specified in the Attn sequence. After executing the Attn sequence, the receiver sends a hex ZRPOS header to force the sender to resend the lost data. When the sending program responds to this interrupt, it reads a HEX header (normally ZRPOS) from the receiver and takes the action described in the previous section. The Unix sz.c program uses a setjmp/longjmp call to catch the interrupt generated by the Attn sequence. Catching the interrupt activates the getinsync() function to read the receiver's error header and take appropriate action. When compiled for standard SYSTEM III/V Unix, sz.c uses an Attn sequence of Ctrl-C followed by a 1 second pause to interrupt the sender, then give the sender (Unix) time to prepare for the receiver's error header. 9.3 Full Streaming with Sliding Window If none of the above methods is applicable, hope is not yet lost. If the sender can buffer responses from the receiver, the sender can use ZCRCQ data subpackets to get ACKs from the receiver without interrupting the transmission of data. After a sufficient number of ZCRCQ data subpackets have been sent, the sender can read one of the headers that should have arrived in its receive interrupt buffer. A problem with this method is the possibility of wasting an excessive amount of time responding to the receiver's error header. It may be possible to program the receiver's Attn sequence to flush the sender's interrupt buffer before sending the ZRPOS header. __________________________________________________________________________ control with XON and XOFF characters and pass XON characters that violate flow control, the receiving program should have a revision date of May 9 or later. Chapter 9 Rev Oct-14-88 Typeset 10-14-88 23 Chapter 9 ZMODEM Protocol 24 9.4 Full Streaming over Error Free Channels File transfer protocols predicated on the existence of an error free end to end communications channel have been proposed from time to time. Such channels have proven to be more readily available in theory than in actuality. The frequency of undetected errors increases when modem scramblers have more bits than the error detecting CRC. A ZMODEM sender assuming an error free channel with end to end flow control can send the entire file in one frame without any checking of the reverse stream. If this channel is completely transparent, only ZDLE need be escaped. The resulting protocol overhead for average long files is less than one per cent.[7] 9.5 Segmented Streaming If the receiver cannot overlap serial and disk I/O, it uses the ZRINIT frame to specify a buffer length which the sender will not overflow. The sending program sends a ZCRCW data subpacket and waits for a ZACK header before sending the next segment of the file. If the sending program supports reverse data stream sampling or interrupt, error recovery will be faster (on average) than a protocol (such as YMODEM) that sends large blocks. A sufficiently large receiving buffer allows throughput to closely approach that of full streaming. For example, 16kb segmented streaming adds about 3 per cent to full streaming ZMODEM file transfer times when the round trip delay is five seconds. 10. ATTENTION SEQUENCE The receiving program sends the Attn sequence whenever it detects an error and needs to interrupt the sending program. The default Attn string value is empty (no Attn sequence). The receiving program resets Attn to the empty default before each transfer session. The sender specifies the Attn sequence in its optional ZSINIT frame. The Attn string is terminated with a null. __________ 7. One in 256 for escaping ZDLE, about two (four if 32 bit CRC is used) in 1024 for data subpacket CRC's Chapter 10 Rev Oct-14-88 Typeset 10-14-88 24 Chapter 10 ZMODEM Protocol 25 Two meta-characters perform special functions: + \335 (octal) Send a break signal + \336 (octal) Pause one second 11. FRAME TYPES The numeric values for the values shown in boldface are given in zmodem.h. Unused bits and unused bytes in the header (ZP0...ZP3) are set to 0. 11.1 ZRQINIT Sent by the sending program, to trigger the receiving program to send its ZRINIT header. This avoids the aggravating startup delay associated with XMODEM and Kermit transfers. The sending program may repeat the receive invitation (including ZRQINIT) if a response is not obtained at first. ZF0 contains ZCOMMAND if the program is attempting to send a command, 0 otherwise. 11.2 ZRINIT Sent by the receiving program. ZF0 and ZF1 contain the bitwise or of the receiver capability flags: #define CANCRY 8 /* Receiver can decrypt */ #define CANFDX 01 /* Rx can send and receive true FDX */ #define CANOVIO 02 /* Rx can receive data during disk I/O */ #define CANBRK 04 /* Rx can send a break signal */ #define CANCRY 010 /* Receiver can decrypt */ #define CANLZW 020 /* Receiver can uncompress */ #define CANFC32 040 /* Receiver can use 32 bit Frame Check */ #define ESCCTL 0100 /* Receiver expects ctl chars to be escaped */ #define ESC8 0200 /* Receiver expects 8th bit to be escaped */ ZP0 and ZP1 contain the size of the receiver's buffer in bytes, or 0 if nonstop I/O is allowed. 11.3 ZSINIT The Sender sends flags followed by a binary data subpacket terminated with ZCRCW. /* 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 Chapter 11 Rev Oct-14-88 Typeset 10-14-88 25 Chapter 11 ZMODEM Protocol 26 */ The data subpacket contains the null terminated Attn sequence, maximum length 32 bytes including the terminating null. 11.4 ZACK Acknowledgment to a ZSINIT frame, ZCHALLENGE header, ZCRCQ or ZCRCW data subpacket. ZP0 to ZP3 contain file offset. The response to ZCHALLENGE contains the same 32 bit number received in the ZCHALLENGE header. 11.5 ZFILE This frame denotes the beginning of a file transmission attempt. ZF0, ZF1, and ZF2 may contain options. A value of 0 in each of these bytes implies no special treatment. Options specified to the receiver override options specified to the sender with the exception of ZCBIN. A ZCBIN from the sender overrides any other Conversion Option given to the receiver except ZCRESUM. A ZCBIN from the receiver overrides any other Conversion Option sent by the sender. 11.5.1 ZF0: Conversion Option If the receiver does not recognize the Conversion Option, an application dependent default conversion may apply. ZCBIN "Binary" transfer - inhibit conversion unconditionally ZCNL Convert received end of line to local end of line convention. The supported end of line conventions are CR/LF (most ASCII based operating systems except Unix and Macintosh), and NL (Unix). Either of these two end of line conventions meet the permissible ASCII definitions for Carriage Return and Line Feed/New Line. Neither the ASCII code nor ZMODEM ZCNL encompass lines separated only by carriage returns. Other processing appropriate to ASCII text files and the local operating system may also be applied by the receiver.[1] ZCRECOV Recover/Resume interrupted file transfer. ZCREVOV is also useful for updating a remote copy of a file that grows without resending of old data. If the destination file exists and is no longer than the source, append to the destination file and start transfer at the offset __________ 1. Filtering RUBOUT, NULL, Ctrl-Z, etc. Chapter 11 Rev Oct-14-88 Typeset 10-14-88 26 Chapter 11 ZMODEM Protocol 27 corresponding to the receiver's end of file. This option does not apply if the source file is shorter. Files that have been converted (e.g., ZCNL) or subject to a single ended Transport Option cannot have their transfers recovered. 11.5.2 ZF1: Management Option If the receiver does not recognize the Management Option, the file should be transferred normally. The ZMSKNOLOC bit instructs the receiver to bypass the current file if the receiver does not have a file with the same name. Five bits (defined by ZMMASK) define the following set of mutually exclusive management options. ZMNEWL Transfer file if destination file absent. Otherwise, transfer file overwriting destination if the source file is newer or longer. ZMCRC Compare the source and destination files. Transfer if file lengths or file polynomials differ. ZMAPND Append source file contents to the end of the existing destination file (if any). ZMCLOB Replace existing destination file (if any). ZMDIFF Transfer file if destination file absent. Otherwise, transfer file overwriting destination if files have different lengths or dates. ZMPROT Protect destination file by transferring file only if the destination file is absent. ZMNEW Transfer file if destination file absent. Otherwise, transfer file overwriting destination if the source file is newer. 11.5.3 ZF2: Transport Option If the receiver does not implement the particular transport option, the file is copied without conversion for later processing. ZTLZW Lempel-Ziv compression. Transmitted data will be identical to that produced by compress 4.0 operating on a computer with VAX byte ordering, using 12 bit encoding. Chapter 11 Rev Oct-14-88 Typeset 10-14-88 27 Chapter 11 ZMODEM Protocol 28 ZTCRYPT Encryption. An initial null terminated string identifies the key. Details to be determined. ZTRLE Run Length encoding, Details to be determined. A ZCRCW data subpacket follows with file name, file length, modification date, and other information described in a later chapter. 11.5.4 ZF3: Extended Options The Extended Options are bit encoded. ZTSPARS Special processing for sparse files, or sender managed selective retransmission. Each file segment is transmitted as a separate frame, where the frames are not necessarily contiguous. The sender should end each segment with a ZCRCW data subpacket and process the expected ZACK to insure no data is lost. ZTSPARS cannot be used with ZCNL. 11.6 ZSKIP Sent by the receiver in response to ZFILE, makes the sender skip to the next file. 11.7 ZNAK Indicates last header was garbled. (See also ZRPOS). 11.8 ZABORT Sent by receiver to terminate batch file transfers when requested by the user. Sender responds with a ZFIN sequence.[2] 11.9 ZFIN Sent by sending program to terminate a ZMODEM session. Receiver responds with its own ZFIN. 11.10 ZRPOS Sent by receiver to force file transfer to resume at file offset given in ZP0...ZP3. __________ 2. Or ZCOMPL in case of server mode. Chapter 11 Rev Oct-14-88 Typeset 10-14-88 28 Chapter 11 ZMODEM Protocol 29 11.11 ZDATA ZP0...ZP3 contain file offset. One or more data subpackets follow. 11.12 ZEOF Sender reports End of File. ZP0...ZP3 contain the ending file offset. 11.13 ZFERR Error in reading or writing file, protocol equivalent to ZABORT. 11.14 ZCRC Request (receiver) and response (sender) for file polynomial. ZP0...ZP3 contain file polynomial. 11.15 ZCHALLENGE Request sender to echo a random number in ZP0...ZP3 in a ZACK frame. Sent by the receiving program to the sending program to verify that it is connected to an operating program, and was not activated by spurious data or a Trojan Horse message. 11.16 ZCOMPL Request now completed. 11.17 ZCAN This is a pseudo frame type returned by gethdr() in response to a Session Abort sequence. 11.18 ZFREECNT Sending program requests a ZACK frame with ZP0...ZP3 containing the number of free bytes on the current file system. A value of 0 represents an indefinite amount of free space. 11.19 ZCOMMAND ZCOMMAND is sent in a binary frame. ZF0 contains 0 or ZCACK1 (see below). A ZCRCW data subpacket follows, with the ASCII text command string terminated with a NULL character. If the command is intended to be executed by the operating system hosting the receiving program (e.g., "shell escape"), it must have "!" as the first character. Otherwise the command is meant to be executed by the application program which receives the command. Chapter 11 Rev Oct-14-88 Typeset 10-14-88 29 Chapter 11 ZMODEM Protocol 30 If the receiver detects an illegal or badly formed command, the receiver immediately responds with a ZCOMPL header with an error code in ZP0...ZP3. If ZF0 contained ZCACK1, the receiver immediately responds with a ZCOMPL header with 0 status. Otherwise, the receiver responds with a ZCOMPL header when the operation is completed. The exit status of the completed command is stored in ZP0...ZP3. A 0 exit status implies nominal completion of the command. If the command causes a file to be transmitted, the command sender will see a ZRQINIT frame from the other computer attempting to send data. The sender examines ZF0 of the received ZRQINIT header to verify it is not an echo of its own ZRQINIT header. It is illegal for the sending program to command the receiving program to send a command. If the receiver program does not implement command downloading, it may display the command to the standard error output, then return a ZCOMPL header. 12. SESSION TRANSACTION EXAMPLES 12.1 A simple file transfer A simple transaction, one file, no errors, no CHALLENGE, overlapped I/O: Sender Receiver "rz\r" ZRQINIT(0) ZRINIT ZFILE ZRPOS ZDATA data ... ZEOF ZRINIT ZFIN ZFIN OO Chapter 12 Rev Oct-14-88 Typeset 10-14-88 30 Chapter 12 ZMODEM Protocol 31 12.2 Challenge and Command Download Sender Receiver "rz\r" ZRQINIT(ZCOMMAND) ZCHALLENGE(random-number) ZACK(same-number) ZRINIT ZCOMMAND, ZDATA (Performs Command) ZCOMPL ZFIN ZFIN OO 13. ZFILE FRAME FILE INFORMATION ZMODEM sends the same file information with the ZFILE frame data that YMODEM Batch sends in its block 0. N.B.: The pathname (file name) field is mandatory. Pathname The pathname (conventionally, the file name) is sent as a null terminated ASCII string. This is the filename format used by the handle oriented MSDOS(TM) functions and C library fopen functions. An assembly language example follows: DB 'foo.bar',0 No spaces are included in the pathname. Normally only the file name stem (no directory prefix) is transmitted unless the sender has selected YAM's f option to send the full absolute or relative pathname. The source drive designator (A:, B:, etc.) usually is not sent. Filename Considerations + File names should be translated to lower case unless the sending system supports upper/lower case file names. This is a convenience for users of systems (such as Unix) which store filenames in upper and lower case. + The receiver should accommodate file names in lower and upper case. + When transmitting files between different operating systems, file names must be acceptable to both the sender and receiving operating systems. If not, transformations should be applied to make the file names acceptable. If the transformations are unsuccessful, a new file name may Chapter 13 Rev Oct-14-88 Typeset 10-14-88 31 Chapter 13 ZMODEM Protocol 32 be invented be the receiving program. If directories are included, they are delimited by /; i.e., "subdir/foo" is acceptable, "subdir\foo" is not. Length The file length and each of the succeeding fields are optional.[1] The length field is stored as a decimal string counting the number of data bytes in the file. The ZMODEM receiver uses the file length as an estimate only. It may be used to display an estimate of the transmission time, and may be compared with the amount of free disk space. The actual length of the received file is determined by the data transfer. A file may grow after transmission commences, and all the data will be sent. Modification Date A single space separates the modification date from the file length. The mod date is optional, and the filename and length may be sent without requiring the mod date to be sent. The mod date is sent as an octal number giving the time the contents of the file were last changed measured in seconds from Jan 1 1970 Universal Coordinated Time (GMT). A date of 0 implies the modification date is unknown and should be left as the date the file is received. This standard format was chosen to eliminate ambiguities arising from transfers between different time zones. File Mode A single space separates the file mode from the modification date. The file mode is stored as an octal string. Unless the file originated from a Unix system, the file mode is set to 0. rz(1) checks the file mode for the 0x8000 bit which indicates a Unix type regular file. Files with the 0x8000 bit set are assumed to have been sent from another Unix (or similar) system which uses the same file conventions. Such files are not translated in any way. Serial Number A single space separates the serial number from the file mode. The serial number of the transmitting program is stored as an octal string. Programs which do not have a serial __________ 1. Fields may not be skipped. Chapter 13 Rev Oct-14-88 Typeset 10-14-88 32 Chapter 13 ZMODEM Protocol 33 number should omit this field, or set it to 0. The receiver's use of this field is optional. Number of Files Remaining Iff the number of files remaining is sent, a single space separates this field from the previous field. This field is coded as a decimal number, and includes the current file. This field is an estimate, and incorrect values must not be allowed to cause loss of data. The receiver's use of this field is optional. Number of Bytes Remaining Iff the number of bytes remaining is sent, a single space separates this field from the previous field. This field is coded as a decimal number, and includes the current file. This field is an estimate, and incorrect values must not be allowed to cause loss of data. The receiver's use of this field is optional. File Type Iff the file type is sent, a single space separates this field from the previous field. This field is coded as a decimal number. Currently defined values are: 0 Sequential file - no special type 1 Other types to be defined. The receiver's use of this field is optional. The file information is terminated by a null. If only the pathname is sent, the pathname is terminated with two nulls. The length of the file information subpacket, including the trailing null, must not exceed 1024 bytes; a typical length is less than 64 bytes. 14. PERFORMANCE RESULTS 14.1 Compatibility Extensive testing has demonstrated ZMODEM to be compatible with satellite links, packet switched networks, microcomputers, minicomputers, regular and error correcting buffered modems at 75 to 19200 bps. ZMODEM's economy of reverse channel bandwidth allows modems that dynamically partition bandwidth between the two directions to operate at optimal speeds. Chapter 14 Rev Oct-14-88 Typeset 10-14-88 33 Chapter 14 ZMODEM Protocol 34 14.2 Throughput Between two single task PC-XT computers sending a program image on an in house Telenet link, SuperKermit provided 72 ch/sec throughput at 1200 baud. YMODEM-k yielded 85 chars/sec, and ZMODEM provided 113 chars/sec. XMODEM was not measured, but would have been much slower based on observed network propagation delays. Recent tests downloading large binary files to an IBM PC (4.7 mHz V20) running YAMK 16.30 with table driven 32 bit CRC calculation yielded a throughput of 1870 cps on a 19200 bps direct connection. Tests with TELEBIT TrailBlazer modems have shown transfer rates approaching 1400 characters per second for long files. When files are compressed, effective transfer rates of 2000 characters per second are possible. 14.3 Error Recovery Some tests of ZMODEM protocol error recovery performance have been made. A PC-AT with SCO SYS V Xenix or DOS 3.1 was connected to a PC with DOS 2.1 either directly at 9600 bps or with unbuffered dial-up 1200 bps modems. The ZMODEM software was configured to use 1024 byte data subpacket lengths above 2400 bps, 256 otherwise. Because no time delays are necessary in normal file transfers, per file negotiations are much faster than with YMODEM, the only observed delay being the time required by the program(s) to update logging files. During a file transfer, a short line hit seen by the receiver usually induces a CRC error. The interrupt sequence is usually seen by the sender before the next data subpacket is completely sent, and the resultant loss of data throughput averages about half a data subpacket per line hit. At 1200 bps this is would be about .75 second lost per hit. At 10-5 error rate, this would degrade throughput by about 9 per cent. The throughput degradation increases with increasing channel delay, as more data subpackets in transit through the channel are discarded when an error is detected. A longer noise burst that affects both the receiver and the sender's reception of the interrupt sequence usually causes the sender to remain silent until the receiver times out in 10 seconds. If the round trip channel delay exceeds the receiver's 10 second timeout, recovery from this type of error may become difficult. Noise affecting only the sender is usually ignored, with one common exception. Spurious XOFF characters generated by noise stop the Chapter 14 Rev Oct-14-88 Typeset 10-14-88 34 Chapter 14 ZMODEM Protocol 35 sender until the receiver times out and sends an interrupt sequence which concludes with an XON. In summation, ZMODEM performance in the presence of errors resembles that of X.PC and SuperKermit. Short bursts cause minimal data retransmission. Long bursts (such as pulse dialing noises) often require a timeout error to restore the flow of data. 15. PACKET SWITCHED NETWORK CONSIDERATIONS Flow control is necessary for printing messages and directories, and for streaming file transfer protocols. A non transparent flow control is incompatible with XMODEM and YMODEM transfers. XMODEM and YMODEM protocols require complete transparency of all 256 8 bit codes to operate properly. The "best" flow control (when X.25 or hardware CTS is unavailable) would not "eat" any characters at all. When the PAD's buffer almost fills up, an XOFF should be emitted. When the buffer is no longer nearly full, send an XON. Otherwise, the network should neither generate nor eat XON or XOFF control characters. On Telenet, this can be met by setting CCIT X3 5:1 and 12:0 at both ends of the network. For best throughput, parameter 64 (advance ACK) should be set to something like 4. Packets should be forwarded when the packet is a full 128 bytes, or after a moderate delay (3:0,4:10,6:0). With PC-Pursuit, it is sufficient to set parameter 5 to 1 at both ends after one is connected to the remote modem. @ set 5:1 rst? 5:1 cont Unfortunately, many PADs do not accept the "rst?" command. For YMODEM, PAD buffering should guarantee that a minimum of 1040 characters can be sent in a burst without loss of data or generation of flow control characters. Failure to provide this buffering will generate excessive retries with YMODEM. Chapter 15 Rev Oct-14-88 Typeset 10-14-88 35 Chapter 15 ZMODEM Protocol 36 TABLE 1. Network and Flow Control Compatibility ______________________________________________________________________________ | Connectivity | Interactive| XMODEM| WXMODEM| SUPERKERMIT| ZMODEM | ______________________________________________________________________________ |___________________|_____________|________|_________|_____________|_________| |Direct Connect | YES | YES | YES | YES | YES | |___________________|_____________|________|_________|_____________|_________| |Network, no FC | no | YES | (4) | (6) | YES (1)| |___________________|_____________|________|_________|_____________|_________| |Net, transparent FC| YES | YES | YES | YES | YES | |___________________|_____________|________|_________|_____________|_________| |Net, non-trans. FC | YES | no | no (5) | YES | YES | |___________________|_____________|________|_________|_____________|_________| |Network, 7 bit | YES | no | no | YES (2) | YES (3)| |___________________|_____________|________|_________|_____________|_________| (1) ZMODEM can optimize window size or burst length for fastest transfers. (2) Parity bits must be encoded, slowing binary transfers. (3) Natural protocol extension possible for encoding data to 7 bits. (4) Small WXMODEM window size may may allow operation. (5) Some flow control codes are not escaped in WXMODEM. (6) Kermit window size must be reduced to avoid buffer overrun. 16. PERFORMANCE COMPARISON TABLES "Round Trip Delay Time" includes the time for the last byte in a packet to propagate through the operating systems and network to the receiver, plus the time for the receiver's response to that packet to propagate back to the sender. The figures shown below are calculated for round trip delay times of 40 milliseconds and 5 seconds. Shift registers in the two computers and a pair of 212 modems generate a round trip delay time on the order of 40 milliseconds. Operation with busy timesharing computers and networks can easily generate round trip delays of five seconds. Because the round trip delays cause visible interruptions of data transfer when using XMODEM protocol, the subjective effect of these delays is greatly exaggerated, especially when the user is paying for connect time. A 102400 byte binary file with randomly distributed codes is sent at 1200 bps 8 data bits, 1 stop bit. The calculations assume no transmission errors. For each of the protocols, only the per file functions are considered. Processor and I/O overhead are not included. YM-k refers to YMODEM with 1024 byte data packets. YM-g refers to the YMODEM "g" option. ZMODEM uses 256 byte data subpackets for this example. SuperKermit uses maximum standard Chapter 16 Rev Oct-14-88 Typeset 10-14-88 36 Chapter 16 ZMODEM Protocol 37 packet size, 8 bit transparent transmission, no run length compression. The 4 block WXMODEM window is too small to span the 5 second delay in this example; the resulting thoughput degradation is ignored. For comparison, a straight "dump" of the file contents with no file management or error checking takes 853 seconds. TABLE 2. Protocol Overhead Information (102400 byte binary file, 5 Second Round Trip) ____________________________________________________________________________ | Protocol | XMODEM| YM-k | YM-g| ZMODEM| SKermit| WXMODEM| ____________________________________________________________________________ |_____________________|________|_______|______|________|_________|_________| |Protocol Round Trips | 804 | 104 | 5 | 5 | 5 | 4 | |_____________________|________|_______|______|________|_________|_________| |Trip Time at 40ms | 32s | 4s | 0 | 0 | 0 | 0 | |_____________________|________|_______|______|________|_________|_________| |Trip Time at 5s | 4020s | 520s | 25s | 25s | 25 | 20 | ____________________________________________________________________________ |_____________________|________|_______|______|________|_________|_________| |Overhead Characters | 4803 | 603 | 503 | 3600 | 38280 | 8000 | ____________________________________________________________________________ |_____________________|________|_______|______|________|_________|_________| |Line Turnarounds | 1602 | 204 | 5 | 5 | 2560 | 1602 | ____________________________________________________________________________ |_____________________|________|_______|______|________|_________|_________| |Transfer Time at 0s | 893s | 858s | 857s| 883s | 1172s | 916s | |_____________________|________|_______|______|________|_________|_________| |Transfer Time at 40ms| 925s | 862s | 857s| 883s | 1172s | 916s | |_____________________|________|_______|______|________|_________|_________| |Transfer Time at 5s | 5766s | 1378s| 882s| 918s | 1197s | 936s | |_____________________|________|_______|______|________|_________|_________| Figure 5. Transmission Time Comparison (102400 byte binary file, 5 Second Round Trip) ************************************************** XMODEM ************ YMODEM-K ********** SuperKermit (Sliding Windows) ******* ZMODEM 16kb Segmented Streaming ******* ZMODEM Full Streaming ******* YMODEM-G Chapter 16 Rev Oct-14-88 Typeset 10-14-88 37 Chapter 16 ZMODEM Protocol 38 TABLE 3. Local Timesharing Computer Download Performance __________________________________________________________________________ | Command | Protocol| Time/HD| Time/FD| Throughput| Efficiency| __________________________________________________________________________ |_______________|__________|_________|_________|____________|____________| |kermit -x | Kermit | 1:49 | 2:03 | 327 | 34% | |_______________|__________|_________|_________|____________|____________| |sz -Xa phones.t| XMODEM | 1:20 | 1:44 | 343 | 36% | |_______________|__________|_________|_________|____________|____________| |sz -a phones.t | ZMODEM | :39 | :48 | 915 | 95% | |_______________|__________|_________|_________|____________|____________| Times were measured downloading a 35721 character text file at 9600 bps, from Santa Cruz SysV 2.1.2 Xenix on a 9 mHz IBM PC-AT to DOS 2.1 on an IBM PC. Xenix was in multiuser mode but otherwise idle. Transfer times to PC hard disk and floppy disk destinations are shown. C-Kermit 4.2(030) used server mode and file compression, sending to Pro-YAM 15.52 using 0 delay and a "get phones.t" command. Crosstalk XVI 3.6 used XMODEM 8 bit checksum (CRC not available) and an "ESC rx phones.t" command. The Crosstalk time does not include the time needed to enter the extra commands not needed by Kermit and ZMODEM. Professional-YAM used ZMODEM AutoDownload. ZMODEM times included a security challenge to the sending program. Chapter 16 Rev Oct-14-88 Typeset 10-14-88 38 Chapter 16 ZMODEM Protocol 39 TABLE 4. File Transfer Speeds ______________________________________________________________________________ | Prot file bytes bps ch/sec Notes | ______________________________________________________________________________ |X jancol.c 18237 2400 53 Tymnet PTL 5/3/87 | |X source.xxx 6143 2400 56 Source PTL 5/29/87 | |X jancol.c 18237 2400 64 Tymnet PTL | |XN tsrmaker.arc 25088 1200 94 GEnie PTL | |B/ovth emaibm.arc 51200 1200 101 CIS PTL MNP | |UUCP 74 files, each >7000 1200 102 (Average) | |ZM jancol.c 18237 1200 112 DataPac (604-687-7144)| |X/ovth emaibm.arc 51200 1200 114 CIS PTL MNP | |ZM emaibm.arc 51200 1200 114 CIS PTL MNP | |ZM frombyte87.txt 62506 1200 117 BIX | |SK source.xxx 6143 2400 170 Source PTL 5/29/87 | |ZM jancol.c 18237 2400 221 Tymnet PTL upl/dl | |B/ovth destro.gif 33613 2400 223 CIS/PTL 9-12-87 | |ZM jancol.c 18237 2400 224 Tymnet PTL | |ZM tp40kerm.arc 112640 2400 224 BIX 6/88 | |ZM readme.lis 9466 2400 231 BIX 6/88 | |ZM jancol.c 18237 2400 226/218 TeleGodzilla upl | |ZM jancol.c 18237 2400 226 Tymnet PTL 5/3/87 | |ZM zmodem.ov 35855 2400 227 CIS PTL node | |C jancol.c 18237 2400 229 Tymnet PTL 5/3/87 | |ZM jancol.c 18237 2400 229/221 TeleGodzilla | |ZM zmodem.ov 35855 2400 229 CIS PTL node upl | |ZM jancol.c 18237 2400 232 CIS PTL node | |QB gifeof.arc 32187 2400 232 CIS PTL node | |ZM pcpbbs.txt 38423 2400 534 MNP Level 5 | |ZM mbox 473104 9600 948/942 TeleGodzilla upl | |ZM zmodem.arc 318826 14k 1357/1345 TeleGodzilla | |ZM mbox 473104 14k 1367/1356 TeleGodzilla upl | |ZM c2.doc 218823 38k 3473 Xenix 386 TK upl | |ZM mbox -a 511893 38k 3860 386 Xenix 2.2 Beta | |ZM c.doc 218823 57k 5611 AT Clone & 386 | |____________________________________________________________________________| Times are for downloads unless noted. Where two speeds are noted, the faster speed is reported by the receiver because its transfer time calculation excludes the security check and transaction log file processing. The TeleGodzilla computer is a 4.77 mHz IBM PC with a 10 MB hard disk. The 386 computer uses an Intel motherboard at 18 mHz 1ws. The AT Clone (QIC) runs at 8 mHz 0ws. Abbreviations: B Compuserve B Protocol QB Compuserve Quick-B/B+ Protocol B/ovth CIS B with Omen Technology OverThruster(TM) C Capture DC2/DC4 (no protocol) K Kermit MNP Microcom MNP error correcting SX/1200 modem Chapter 16 Rev Oct-14-88 Typeset 10-14-88 39 Chapter 16 ZMODEM Protocol 40 PTL Portland Oregon network node SK Sliding Window Kermit (SuperKermit) w=15 X XMODEM XN XMODEM protocol implemented in network modes X/ovth XMODEM, Omen Technology OverThruster(TM) ZM ZMODEM Chapter 16 Rev Oct-14-88 Typeset 10-14-88 40 Chapter 16 ZMODEM Protocol 41 TABLE 5. Protocol Checklist Etc: Relay, BLAST, DART _________________________________________________________________________ |Item XMODEM YMDM-k YMDM-g ZMODEM SK Etc.| _________________________________________________________________________ |IN SERVICE | 1977 | 1982 | 1985 | 1986 | 1985 | ? | |VENDORS | ?? | ?? | >20 | >20 | ?? | 1 | _________________________________________________________________________ |HOST AVAILABILITY | | | | | | | |Compuserve | YES | - | - | YES | - | - | |BIX | YES | - | - | YES | YES | - | |Portal | | | YES | - | - | SOON| |The Source | YES | - | - | - | YES | - | |_______________________|________|________|_______|_______|_______|_____| |USER FEATURES | | | | | | | |User Friendly | - | - | - | YES | (10) | - | |Commands/batch | 2*N | 2 | 2 | 1 | 1(1) | | |Commands/file | 2 | 0 | 0 | 0 | 0 | | |Command Download | - | - | - | YES | YES(6)| - | |Menu Compatible | - | - | - | YES | - | - | |Crash Recovery | - | - | - | YES | - | ?? | |File Management | - | - | - | YES | - | some| |Security Check | - | - | - | YES | - | - | |_______________________|________|________|_______|_______|_______|_____| |COMPATIBILITY | | | | | | | |Dynamic Files | YES | - | - | YES | YES | ? | |Packet SW NETS | - | - | - | YES | YES | ? | |7 bit PS NETS | - | - | - | (3) | YES | ? | |Old Mainframes | - | - | - | (3) | YES | ? | |_______________________|________|________|_______|_______|_______|_____| |ATTRIBUTES | | | | | | | |Reliability(5) | fair | fair(5)| none | BEST | good | ? | |Streaming | - | - | YES | YES | YES | | |Overhead(2) | 7% | 1% | 1% | 4%(8) | 30% | | |Faithful Xfers | - | YES(7) | YES(7)| YES | YES | ? | |Preserve Date | - | YES | YES | YES | - | ? | |_______________________|________|________|_______|_______|_______|_____| |COMPLEXITY | | | | | | | |No-Wait Sample | - | - | - | opt | REQD | REQD| |Ring Buffers | - | - | - | opt | REQD | REQD| |Complexity | LOW(5)| LOW(5) | LOW | MED | HIGH | ? | |_______________________|________|________|_______|_______|_______|_____| |EXTENSIONS | | | | | | | |Server Operation | - | - | - | YES(4)| YES | ? | |Multiple Threads | - | - | - | future| - | - | _________________________________________________________________________ NOTES: (1) Server mode or Omen Technology Kermit AutoDownload (2) Character count, binary file, transparent channel Chapter 16 Rev Oct-14-88 Typeset 10-14-88 41 Chapter 16 ZMODEM Protocol 42 (3) Future enhancement provided for (4) AutoDownload operation (5) Omen Technology's Cybernetic Data Recovery(TM) improves XMODEM and YMODEM reliability with complex proprietary logic. (6) Server commands only (7) Only with True YMODEM(TM) (8) More then 3% from protected network control characters (9) With Segmented Streaming (10) With Pro-YAM extensions Chapter 16 Rev Oct-14-88 Typeset 10-14-88 42 Chapter 16 ZMODEM Protocol 43 17. FUTURE EXTENSIONS Future extensions include: + Compatibility with 7 bit networks + Server/Link Level operation: An END-TO-END error corrected program to program session is required for financial and other sensitive applications. + Multiple independent threads + Bidirectional transfers (STEREO ZMODEM) + Encryption + Compression + File Comparison + Selective transfer within a file (e.g., modified segments of a database file) + Selective Retransmission for error correction 18. REVISIONS 10-14-88 Pascal source code now available in Phil Burn's PibTerm v4.2. 6-24-88 An exception to the previously unconditional ZCBIN override: a ZCRESUM specified by the receiver need not be overridden by the sender's ZCBIN. 11-18-87 Editorial improvements 10-27-87 Optional fields added for number of files remaining to be sent and total number of bytes remaining to be sent. 07-31-1987 The receiver should ignore a ZEOF with an offset that does not match the current file length. The previous action of responding with ZRPOS caused transfers to fail if a CRC error occurred immediately before end of file, because two retransmission requests were being sent for each error. This has been observed under exceptional conditions, such as data transmission at speeds greater than the receiving computer's interrupt response capabilitiy or gross misapplication of flow control. Discussion of the Tx backchannel garbage count and ZCRCW after error ZRPOS was added. Many revisions for clarity. 07-09-87 Corrected XMODEM's development date, incorrectly stated as Chapter 18 Rev Oct-14-88 Typeset 10-14-88 43 Chapter 18 ZMODEM Protocol 44 1979 instead of the actual August 1977. More performance data was added. 05-30-87 Added ZMNEW and ZMSKNOLOC 05-14-87 Window management, ZACK zshhdr XON removed, control character escaping, ZMSPARS changed to ZXPARS, editorial changes. 04-13-87 The ZMODEM file transfer protocol's public domain status is emphasized. 04-04-87: minor editorial changes, added conditionals for overview version. 03-15-87: 32 bit CRC added. 12-19-86: 0 Length ZCRCW data subpacket sent in response to ZPAD or ZDELE detected on reverse channel has been changed to ZCRCE. The reverse channel is now checked for activity before sending each ZDATA header. 11-08-86: Minor changes for clarity. 10-2-86: ZCNL definition expanded. 9-11-86: ZMPROT file management option added. 8-20-86: More performance data included. 8-4-86: ASCII DLE (Ctrl-P, 020) now escaped; compatible with previous versions. More document revisions for clarity. 7-15-86: This document was extensively edited to improve clarity and correct small errors. The definition of the ZMNEW management option was modified, and the ZMDIFF management option was added. The cancel sequence was changed from two to five CAN characters after spurious two character cancel sequences were detected. 19. MORE INFORMATION Please contact Omen Technology for troff source files and typeset copies of this document. 19.1 TeleGodzilla Bulletin Board More information may be obtained by calling the TeleGodzilla bulletin board at 503-621-3746. TeleGodzilla supports 19200 (Telebit PEP), 2400 and 1200 bps callers with automatic speed recognition. Chapter 19 Rev Oct-14-88 Typeset 10-14-88 44 Chapter 19 ZMODEM Protocol 45 Relevant files include YZMODEM.ZOO, YAMDEMO.ZOO, YAMHELP.ZOO, ZCOMMEXE.ARC, ZCOMMDOC.ARC, ZCOMMHLP.ARC. Useful commands for TeleGodzilla include "menu", "dir", "sx file (XMODEM)", "kermit sb file ...", and "sz file ...". 19.2 Unix UUCP Access UUCP sites can obtain the current version of this file with uucp omen!/u/caf/public/zmodem.doc /tmp A continually updated list of available files is stored in /usr/spool/uucppublic/FILES. uucp omen!~uucp/FILES /usr/spool/uucppublic The following L.sys line allows UUCP to call site "omen" via Omen's bulletin board system "TeleGodzilla". TeleGodzilla is an instance of Omen Technology's Professional-YAM in host operation, acting as a bulletin board and front ending a Xenix system. In response to TeleGodzilla's "Name Please:" (e:--e:), uucico gives the Pro-YAM "link" command as a user name. Telegodzilla then asks for a link password (d:). The password (Giznoid) controls access to the Xenix system connected to the IBM PC's other serial port. Communications between Pro-YAM and Xenix use 9600 bps; YAM converts this to the caller's speed. Finally, the calling uucico sees the Xenix "Login:" message (n:-- n:), and logs in as "uucp". No password is used for the uucp account. omen Any ACU 2400 1-503-621-3746 e:--e: link d: Giznoid n:--n: uucp 20. ZMODEM PROGRAMS A copy of this document, a demonstration version of Professional-YAM, a flash-up tree structured help file and processor, are available in YZMODEM.ZOO on TeleGodzilla and other bulletin boards. This file must be unpacked with LOOZ.EXE, also available on TeleGodzilla. YZMODEM.ZOO may be distributed provided none of the files are deleted or modified without the written consent of Omen Technology. TeleGodzilla and other bulletin boards also feature ZCOMM, a shareware communications program. ZCOMM includes Omen Technology's TurboLearn(TM) Script Writer, ZMODEM, Omen's highly acclaimed XMODEM and YMODEM protocol support, Sliding Windows Kermit, several traditional protocols, a powerful script language, and the most accurate VT100/102 emulation available in a usr supported program. The ZCOMM files include: Chapter 20 Rev Oct-14-88 Typeset 10-14-88 45 Chapter 20 ZMODEM Protocol 46 + ZCOMMEXE.ARC Executable files and beginner's telephone directory + ZCOMMDOC.ARC "Universal Line Printer Edition" Manual + ZCOMMHLP.ARC Tree structured Flash-UP help processor and database C source code and manual pages for the Unix/Xenix rz and sz programs are available on TeleGodzilla in RZSZ.ZOO. This ZOO archive may be unpacked with LOOZ.EXE, also available on TeleGodzilla. Most Unix like systems are supported, including V7, Sys III, 4.x BSD, SYS V, Idris, Coherent, and Regulus. RZSZ.ZOO includes a ZCOMM/Pro-YAM/PowerCom script ZUPL.T to upload the small (178 lines) YMODEM bootstrap program MINIRB.C without a file transfer protocol. MINIRB uses the Unix stty(1) program to set the required raw tty modes, and compiles without special flags on virtually all Unix and Xenix systems. ZUPL.T directs the Unix system to compile MINIRB, then uses it as a bootstrap to upload the rz/sz source and manual files. Pascal source code for ZMODEM support is available in PibTerm v4.2 written by Phil Burns. The PC-DOS EXEC-PC, QuickBBS, Opus and Nochange bulletin boards support ZMODEM. Integrated ZMODEM support for the Collie bulletin board program is planned. Most of the PC-DOS bulletin board programs that lack integrated ZMODEM support ZMODEM with external modules (DSZ, etc.). The BinkleyTerm, Dutchie and D'Bridge email systems support ZMODEM as their primary protocol. The IN-SYNCH PC-DOS Teleconferencing system uses ZMODEM. The LAN modem sharing program Line Plus has announced ZMODEM support. Many programs have added direct ZMODEM support, including Crosstalk Mark IV, and Telix 3. Most other PC-DOS communications programs support external ZMODEM via Omen Technology's DSZ, including PibTerm, Qmodem SST and BOYAN. The ZMDM communications program by Jwahar Bammi runs on Atari ST machines. The Online! and A-Talk Gold programs for the Amiga support ZMODEM. The Byte Information eXchange supports ZMODEM. The Compuserve Information Service has ported the Unix rz/sz ZMODEM programs to Chapter 20 Rev Oct-14-88 Typeset 10-14-88 46 Chapter 20 ZMODEM Protocol 47 DECSYSTEM 20 assembler, and has announced future support for ZMODEM. 20.1 Adding ZMODEM to DOS Programs DSZ is a small shareware program that supports XMODEM, YMODEM, and ZMODEM file transfers. DSZ is designed to be called from a bulletin board program or another communications program. It may be called as dsz port 2 sz file1 file2 to send files, or as dsz port 2 rz to receive zero or more file(s), or as dsz port 2 rz filea fileb to receive two files, the first to filea and the second (if sent) to fileb. This form of dsz may be used to control the pathname of incoming file(s). In this example, if the sending program attempted to send a third file, the transfer would be terminated. Dsz uses DOS stdout for messages (no direct CRT access), acquires the COMM port vectors with standard DOS calls, and restores the COMM port's interrupt vector and registers upon exit. Further information on dsz may be found in dsz.doc and the ZCOMM or Pro-YAM user manuals. 21. YMODEM PROGRAMS The Unix rz/sz programs support YMODEM as well as ZMODEM. Most Unix like systems are supported, including V7, Sys III, 4.2 BSD, SYS V, Idris, Coherent, and Regulus. A version for VAX-VMS is available in VRBSB.SHQ, in the same directory. Irv Hoff has added 1k packets and YMODEM transfers to the KMD and IMP series programs, which replace the XMODEM and MODEM7/MDM7xx series respectively. Overlays are available for a wide variety of CP/M systems. Many other programs, including MEX-PLUS and Crosstalk Mark IV also support some of YMODEM's features. Chapter 21 Rev Oct-14-88 Typeset 10-14-88 47 Chapter 21 ZMODEM Protocol 48 Questions about YMODEM, the Professional-YAM communications program, and requests for evaluation copies may be directed to: Chuck Forsberg Omen Technology Inc 17505-V Sauvie Island Road Portland Oregon 97231 VOICE: 503-621-3406 :VOICE Modem (TeleGodzilla): 503-621-3746 Usenet: ...!tektronix!reed!omen!caf Compuserve: 70007,2304 Source: TCE022 22. ACKNOWLEDGMENTS The High Reliability Software(TM), TurboLearn Script Writer(TM), Cybernetic Data Recovery(TM), AutoDownload(TM), Intelligent Crash Recovery(TM), Error Containment(TM), Full Time Capture(TM), True YMODEM(TM), OverThruster(TM), Password Guardian(TM), CryptoScript(TM), and TurboDial(TM) are Omen Technology trademarks. ZMODEM was developed for the public domain under a Telenet contract. The ZMODEM protocol descriptions and the Unix rz/sz program source code are public domain. No licensing, trademark, or copyright restrictions apply to the use of the protocol, the Unix rz/sz source code and the ZMODEM name. Encouragement and suggestions by Thomas Buck, Ward Christensen, Earl Hall, Irv Hoff, Stuart Mathison, and John Wales, are gratefully acknowledged. 32 bit CRC code courtesy Gary S. Brown. 23. RELATED FILES The following files may be useful while studying this document: YMODEM.DOC Describes the XMODEM, XMODEM-1k, and YMODEM batch file transfer protocols. This file is available on TeleGodzilla as YMODEM.DQC. zmodem.h Definitions for ZMODEM manifest constants rz.c, sz.c, rbsb.c Unix source code for operating ZMODEM programs. rz.1, sz.1 Manual pages for rz and sz (Troff sources). zm.c Operating system independent low level ZMODEM subroutines. minirb.c A YMODEM bootstrap program, 178 lines. Chapter 23 Rev Oct-14-88 Typeset 10-14-88 48 Chapter 23 ZMODEM Protocol 49 RZSZ.ZOO,rzsz.arc Contain the C source code and manual pages listed above, plus a ZCOMM script to upload minirb.c to a Unix or Xenix system, compile it, and use the program to upload the ZMODEM source files with error checking. DSZ.ZOO,dsz.arc Contains DSZ.COM, a shareware X/Y/ZMODEM subprogram, DESQview "pif" files for background operation in minimum memory, and DSZ.DOC. ZCOMM*.ARC Archive files for ZCOMM, a powerful shareware communications program. Chapter 23 Rev Oct-14-88 Typeset 10-14-88 49 CONTENTS 1. INTENDED AUDIENCE................................................ 2 2. WHY DEVELOP ZMODEM?.............................................. 2 3. ZMODEM Protocol Design Criteria.................................. 4 3.1 Ease of Use............................................... 4 3.2 Throughput................................................ 5 3.3 Integrity and Robustness.................................. 6 3.4 Ease of Implementation.................................... 6 4. EVOLUTION OF ZMODEM.............................................. 7 5. ROSETTA STONE.................................................... 10 6. ZMODEM REQUIREMENTS.............................................. 10 6.1 File Contents............................................. 10 7. ZMODEM BASICS.................................................... 12 7.1 Packetization............................................. 12 7.2 Link Escape Encoding...................................... 12 7.3 Header.................................................... 13 7.4 Binary Data Subpackets.................................... 16 7.5 ASCII Encoded Data Subpacket.............................. 16 8. PROTOCOL TRANSACTION OVERVIEW.................................... 16 8.1 Session Startup........................................... 16 8.2 File Transmission......................................... 18 8.3 Session Cleanup........................................... 20 8.4 Session Abort Sequence.................................... 20 9. STREAMING TECHNIQUES / ERROR RECOVERY............................ 21 9.1 Full Streaming with Sampling.............................. 21 9.2 Full Streaming with Reverse Interrupt..................... 23 9.3 Full Streaming with Sliding Window........................ 23 9.4 Full Streaming over Error Free Channels................... 24 9.5 Segmented Streaming....................................... 24 10. ATTENTION SEQUENCE............................................... 24 11. FRAME TYPES...................................................... 25 11.1 ZRQINIT................................................... 25 11.2 ZRINIT.................................................... 25 11.3 ZSINIT.................................................... 25 11.4 ZACK...................................................... 26 11.5 ZFILE..................................................... 26 11.6 ZSKIP..................................................... 28 11.7 ZNAK...................................................... 28 11.8 ZABORT.................................................... 28 - i - 11.9 ZFIN...................................................... 28 11.10 ZRPOS..................................................... 28 11.11 ZDATA..................................................... 29 11.12 ZEOF...................................................... 29 11.13 ZFERR..................................................... 29 11.14 ZCRC...................................................... 29 11.15 ZCHALLENGE................................................ 29 11.16 ZCOMPL.................................................... 29 11.17 ZCAN...................................................... 29 11.18 ZFREECNT.................................................. 29 11.19 ZCOMMAND.................................................. 29 12. SESSION TRANSACTION EXAMPLES..................................... 30 12.1 A simple file transfer.................................... 30 12.2 Challenge and Command Download............................ 31 13. ZFILE FRAME FILE INFORMATION..................................... 31 14. PERFORMANCE RESULTS.............................................. 33 14.1 Compatibility............................................. 33 14.2 Throughput................................................ 34 14.3 Error Recovery............................................ 34 15. PACKET SWITCHED NETWORK CONSIDERATIONS........................... 35 16. PERFORMANCE COMPARISON TABLES.................................... 36 17. FUTURE EXTENSIONS................................................ 43 18. REVISIONS........................................................ 43 19. MORE INFORMATION................................................. 44 19.1 TeleGodzilla Bulletin Board............................... 44 19.2 Unix UUCP Access.......................................... 45 20. ZMODEM PROGRAMS.................................................. 45 20.1 Adding ZMODEM to DOS Programs............................. 47 21. YMODEM PROGRAMS.................................................. 47 22. ACKNOWLEDGMENTS.................................................. 48 23. RELATED FILES.................................................... 48 LIST OF FIGURES Figure 1. Order of Bytes in Header................................... 14 Figure 2. 16 Bit CRC Binary Header................................... 14 - ii - Figure 3. 32 Bit CRC Binary Header................................... 14 Figure 4. HEX Header................................................. 15 Figure 5. Transmission Time Comparison............................... 37 LIST OF TABLES TABLE 1. Network and Flow Control Compatibility...................... 36 TABLE 2. Protocol Overhead Information............................... 37 TABLE 3. Local Timesharing Computer Download Performance............. 38 TABLE 4. File Transfer Speeds........................................ 39 TABLE 5. Protocol Checklist.......................................... 41 - iii - The ZMODEM Inter Application File Transfer Protocol Chuck Forsberg Omen Technology Inc ABSTRACT The ZMODEM file transfer protocol provides reliable file and command transfers with complete END-TO-END data integrity between application programs. ZMODEM's 32 bit CRC protects against errors that continue to sneak into even the most advanced networks. Unlike traditional and many recently introduced protocols, ZMODEM safeguards all data and supervisory information with effective error detection. ZMODEM rapidly transfers files, particularly with buffered (error correcting) modems, timesharing systems, satellite relays, and wide area packet switched networks. User Friendliness is an important ZMODEM feature. ZMODEM AutoDownload (Automatic file Download initiated without user intervention) greatly simplifies file transfers compared to the traditional protocols. ZMODEM provides advanced file management features including Crash Recovery, flexible control of selective file transfers, and security verified command downloading. ZMODEM protocol features allow implementation on a wide variety of systems operating in a wide variety of environments. A choice of buffering and windowing modes allows ZMODEM to operate on systems that cannot support other streaming protocols. Finely tuned control character escaping allows operation with real world networks without Kermit's high overhead. ZMODEM is the only high performance high reliability public protocol that does not require large buffer allocations for normal file transfers. Although ZMODEM software is more complex than unreliable XMODEM routines, a comphrensive protocol description and actual C source code to production programs have allowed dozens of developers to upgrade their applications with efficient, reliable ZMODEM file transfers with a minimum of effort. ZMODEM was developed for the public domain under a Telenet contract. The ZMODEM protocol descriptions and the Unix rz/sz program source code are public domain. No licensing, trademark, or copyright restrictions apply to the use of the protocol, the Unix rz/sz source code and the ZMODEM name. lrzsz-0.13.1/doc/zmodem-wip.txt0000664000175000017500000016677715260412751012074 ZMODEM — the current state of things. September 2026. =========================================================================== This document is a rewrite of the original ZMODEM specification. The goal was to tighten security and improve interoperability. Where the original documentation left behaviour open, it is now pinned down, and features that never interoperated are explicitly deprecated. No new features have been introduced. # 1. Protocol overview ZMODEM is a unidirectional file transfer protocol: the sender sends files, the receiver receives files, and the back channel is only used to transfer protocol information, never file data. A ZMODEM session typically has three phases: - synchronization - transfer of one or more files - finalizing The first two are the essential ones; the third is trivial. The byte stream is subject to ZDLE encoding (section 2.1.1), which makes it possible to use ZMODEM over many types of networks unable to deal with certain characters or that (ab)use them for other purposes. All frames (think of them as messages) transferred over a ZMODEM session are CRC protected. ZMODEM allows the sender to define an attention sequence, which the receiver sends before its error responses (in practice: before the ZRPOS of error recovery, see section 5). This is an optional mechanism for interrupt-based error recovery on systems that cannot sample the reverse channel. It is rarely needed on modern systems. See the error recovery section for details. ## 1.1 Example sessions The following three example sessions — a complete transfer, a minimal one, and one with error recovery — illustrate the message flow. They are illustrative, not normative; the details are described in the Wire format, Stream control, Frame types, and Error recovery sections. Shown from the sender's perspective: S-->R ZRQINIT [until the sender receives a valid ZRINIT] S<--R ZRINIT [synchronization ends] S-->R ZFILE S-->R [data subpacket with file metadata] S<--R ZRPOS 0 S-->R ZDATA 0 S-->R [1024 byte data subpacket with ZCRCW] S<--R ZACK 1024 S-->R [1024 byte data subpacket with ZCRCG] S-->R [1024 byte data subpacket with ZCRCG] S-->R [1024 byte data subpacket with ZCRCQ] << ZCRCQ! S-->R [1024 byte data subpacket with ZCRCG] S<--R ZACK 4096 [R's answer to the ZCRCQ; the ZCRCG sent after it had not yet reached R] S-->R [1024 byte data subpacket with ZCRCG] S-->R [1024 byte data subpacket with ZCRCE] S-->R ZEOF 7168 S<--R ZRINIT S-->R ZFIN S<--R ZFIN S-->R OO ("Over and Out" — cosmetic for the sender) Often things are simpler: S-->R ZRQINIT [until the sender receives a valid ZRINIT] S<--R ZRINIT S-->R ZFILE S-->R [data subpacket with file metadata] S<--R ZRPOS 0 S-->R ZDATA 0 S-->R [1024 byte data subpacket with ZCRCG] [repeat ...] S-->R [1024 byte data subpacket with ZCRCE] S-->R ZEOF some number S<--R ZRINIT S-->R ZFIN S<--R ZFIN S-->R OO ("Over and Out" — cosmetic for the sender) And sometimes things go wrong: S-->R ZDATA 4096 S-->R [1024 byte data subpacket with ZCRCG] S-->R [1024 byte data subpacket with ZCRCG] << this one has a CRC error S-->R [1024 byte data subpacket with ZCRCG] S<--R ZRPOS 5120 [receiver: "resend from here"] [sender discards the subpackets it already sent after 5120 - but if it cannot do that, for example because the data already is in the network, the receiver will have to do it] S-->R ZDATA 5120 S-->R [1024 byte data subpacket with ZCRCW] << first block after error: wait S<--R ZACK 6144 S-->R [1024 byte data subpacket with ZCRCG] [streaming resumes ...] As you can see, there is a kind of stream control involved. The "fire as much as you can and hope for the best" approach yields the best performance on perfect connections. It is a recipe for disaster on slow, fat and buggy lines (that is: high ping times, high bandwidth, high error rate). The details of each frame type are described in section 4. The error recovery flow is described in section 5. # 2. Wire format ## 2.1 ZDLE encoding and decoding ZMODEM escapes certain control characters by sending a ZDLE character followed by the character to send, XOR'd with 0x40. ZDLE is otherwise known as CAN or ^X (0x18). This value was chosen so that a sequence of 5 consecutive CAN characters can serve as a session abort signal, compatible with YMODEM session abort. ZMODEM escapes ZDLE (0x18), 0x10, 0x90, 0x11, 0x91, 0x13, and 0x93. 0x0d and 0x8d are also escaped if they are preceded by 0x40 or 0xC0, to protect the Telenet command escape CR-@-CR. (Not telnet, but Telenet. See https://archive.org/download/howtouse-telenet/howtouse-telenet.pdf.) All ZMODEM implementations MUST, either by default or by an option, be able to escape and un-escape the full list of characters listed in the paragraph above. If the ESCCTL (ZRINIT) or TESCCTL (ZSINIT) flag is set, all bytes < 0x20 (and their 0x80-0x9f high-bit forms) are escaped via ZDLE encoding, not just the default minimal set. 0x7f is not escaped by common implementations, but the receiver must be able to decode its escape sequence should a peer send it. A common extension or optimization is to not escape 0x10, 0x90, 0x0d and 0x8d (this is often called turbo escaping). Another common extension is to escape additional characters, for example the ssh escape char. ### 2.1.1 ZDLE decoding The receiver decodes any sequence of ZDLE followed by a byte with bit 6 set and bit 5 reset to the original value by inverting bit 6 (XOR by 0x40). The receiver also recognizes escapes for 0x7f and 0xff should these characters need to be escaped. The receiver ignores 0x11, 0x91, 0x13, and 0x93 characters it receives in the raw (unescaped) data stream. These are XON (0x11) and XOFF (0x13) and their high-bit variants — flow control characters that may be generated by the transport. This does not mean that the receiver ignores the ZDLE-escaped versions of these characters. The same rule applies after a ZDLE character: 0x11, 0x91, 0x13, and 0x93 are ignored there, too, in every mode. ### 2.1.2 The ESC8/TESC8 flags are deprecated The ESC8 (ZRINIT ZF0) and TESC8 (ZSINIT ZF0) flags (both 0x80) were never publicly documented. Two interpretations and implementations exist which are mutually incompatible on the wire, when one side turns on the ESC8 feature. The flags are therefore deprecated: - A receiver MUST NOT set ESC8 (ZRINIT), and a sender MUST NOT set TESC8 (ZSINIT). - The reader of each flag MUST ignore it: a sender ignores ESC8 in a received ZRINIT, a receiver ignores TESC8 in a received ZSINIT. Neither side may derive 8th-bit escaping behavior from the flag bits, because the flag is ambiguous between the two dialects. - Both sides MUST still decode ZDLE-escaped bytes with bit 7 set (the classic escaped forms); such pairs can occur in traffic from old implementations, and decoding them is unambiguous. This applies to header decoding as well. Note that the plain escaping of section 2.1.1 is not affected: ESCCTL and TESCCTL share their meaning across all known implementations and remain fully supported (see section 10.6 and 10.9). Also note that neither interpretation was ever widely implemented. ## 2.2 Headers All ZMODEM frames begin with a header which may be sent in hex or in one of two binary forms. A header has a type byte that selects the header format (A, B, or C), followed by the frame's type byte and four position/flag bytes, in this order: F3/P0 F2/P1 F1/P2 F0/P3 The flag and position bytes are interleaved: the flag bytes are called ZF0..ZF3, the position bytes ZP0..ZP3. ZF0/ZP0 is the least significant byte, ZF3/ZP3 the most significant. ### Hex headers: ZHEX ('B' type header) A hex header begins with the sequence ZPAD, ZPAD, ZDLE, ZHEX. Compared to the binary headers it has an extra ZPAD character which allows the receiving program to detect an asynchronous header (indicating an error condition) and then get the rest of the header with a non-error-specific routine. The type byte, four position/flag bytes, and the 16-bit CRC follow, and are sent in hex using the character set 0123456789abcdef (upper-case hex digits are not allowed). Each byte is transferred as two hex characters. A CR and LF pair follows. Some programs only send LF. The LF has sometimes been sent as 0x8a (LF with the highest bit set). Implementation MUST sent CR and LF, and MUST NOT depend on incoming CR LF. The CRC is a 16-bit CRC, calculated over the type byte and the four position/flag bytes. All hex headers except ZACK and ZFIN are followed by an XON character. XON is omitted after ZACK to protect flow control in streaming situations, and after ZFIN to allow clean session cleanup. A hex header therefore looks like this: * * ZDLE B TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 CR LF XON * * ZDLE B 00 01 02 03 04 fe dc \r \n XON Hex headers exist because the receiver sends headers back to the sender, and the reverse channel may strip, mangle, or interpret binary bytes. Hex encoding ensures the header payload consists only of hex digits (0–9, a–f), which are printable ASCII. The framing characters (ZDLE, CR, LF, XON) are control characters but are widely handled correctly by terminal and network systems. The sender can also use hex headers when not sending binary data subpackets, for the same reason. In theory, data subpackets with a 16-bit CRC can follow a ZHEX frame sent from the sender to the receiver. This should not be done. The 16-bit CRC is adequate for headers but weak for data packets. ### Binary headers with 16-bit CRC: ZBIN ('A' type header) A binary header is sent by the sending program to the receiving program, and begins with the sequence ZPAD, ZDLE, ZBIN. They are followed by: - the frame type byte (ZDLE encoded). - four position/flag bytes (ZDLE encoded). - two bytes of CRC of the frame type and position/flag bytes. The CRC is calculated over the type byte and the four position/flag bytes (in their unencoded state). Zero or more binary data subpackets with 16-bit CRC may follow (but see section 2.4 for when sending data with CRC-16 is allowed). A ZBIN header therefore looks like this: * ZDLE A TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 Some old advice suggests always using ZBIN because it needs less space than ZHEX. This MUST NOT be done. The CRC-16 polynomial is weak — very weak compared to CRC-32, and weak compared to better CRC-16 polynomials. This will rarely matter over error-free channels, but it will matter as soon as data is sent over faulty lines. ### Binary headers with 32-bit CRC: ZBIN32 ('C' type header) A ZBIN32 header MUST ONLY be sent after a ZRINIT frame with the CANFC32 bit set has been received. This negotiation is required because a receiver that does not understand ZBIN32 would interpret the 4-byte CRC as a 2-byte CRC plus two data bytes, corrupting the frame parsing and desynchronizing the protocol stream. A binary header with CRC32 begins with the sequence ZPAD, ZDLE, ZBIN32. They are followed by: - the frame type byte (ZDLE encoded). - four position/flag bytes (ZDLE encoded). - four bytes of CRC of the frame type and position/flag bytes. The CRC is calculated over the type byte and the four position/flag bytes (in their unencoded state). Zero or more binary data subpackets with 32-bit CRC may follow. A ZBIN32 header therefore looks like this: * ZDLE C TYPE F3/P0 F2/P1 F1/P2 F0/P3 CRC-1 CRC-2 CRC-3 CRC-4 ### Unknown flags The flags bytes ZF0..ZF3 of all frames are extension points: every flag in them was introduced at some point in ZMODEM's history, and several were never implemented anywhere. Therefore: - A sender MUST send all unused/unknown flag bits as 0. - A receiver MUST ignore all flag bits it does not know, and SHOULD ignore flag bits it knows but does not support (unless the flag's documentation says otherwise). This applies to the position bytes ZP0..ZP3 as well, except where a frame documents a specific meaning for them. ## 2.3 Data subpackets A data subpacket is a stream of bytes, followed by a frameend byte and a CRC. The data subpacket is ZDLE encoded. Variable-length subpackets are used instead of fixed-size blocks — this avoids padding overhead and eliminates the block-number limitations of XMODEM-style protocols. A data subpacket always uses the CRC type (16- or 32-bit) of the header frame it follows (see section 2.4). ### Subpacket sizes The original ZMODEM documentation specifies a maximum data subpacket size of 1024 bytes, with recommended sizes of 256 bytes below 2400 bps, 512 bytes at 2400 bps, and 1024 above 4800 bps or on relatively error-free links. 1024 bytes remains the safest choice: all ZMODEM implementations support it, and some only support 1024. Attempts to use larger subpackets with these implementations will fail. Larger subpacket sizes (4096, 8192 bytes) are common extensions that reduce per-subpacket overhead. They are widely used on modern implementations (lrzsz, sexyz, and others). lrzsz uses 1024 bytes by default; the user can select 4096 (`-4, --try-4k`) or 8192 (`-8, --try-8k`) if the receiver supports it. The receiver may specify a segment length in the ZRINIT frame (ZP0/ZP1, little-endian); 0 means unlimited (see section 3). If a segment length was specified, the subpacket size MUST NOT exceed it. A larger subpacket size reduces per-subpacket overhead (CRC, frameend, ZDLE escaping) but increases the amount of data that must be retransmitted on error. On error-free connections, larger subpackets improve throughput; on noisy connections, smaller subpackets reduce retransmission cost. Note the flip side (see section 3, "Subpacket loss undetectability"): the smaller the subpacket, the likelier that a silently dropped contiguous run of bytes covers a whole subpacket including frameend and CRC, which is a damage no checksum can detect and that only non-streaming mode fully protects against. ### Frameend The frameend byte terminates a data subpacket and may also end a frame. There are four different frameend values, which control streaming: - ZCRCG: the sender does not expect a response and continues to stream. If the receiver detects an error, it sends the attention sequence before the ZRPOS. 'G' like 'go go go'. - ZCRCW: the sender expects a response before it sends the next frame. 'W' like 'wait'. - ZCRCQ: the sender expects a response but continues to stream. 'Q' like 'Query'. - ZCRCE: the sender does not expect a response, and the stream ends. This is sent when the sender detected end of file within the data subpacket. 'E' like 'end'. The final subpacket may also be a ZCRCW instead (the frame then ends and the sender waits for the ZACK); this is a sender's choice, and some implementations use it to make the receiver's end-of-file processing synchronous. The general logic is: - if the receiver detects an error (CRC, format, unexpected frame), it sends the attention sequence (if any) and a ZRPOS frame with the last known good position. - otherwise it sends a ZACK with the last known position, if and only if the sender expects an answer (ZCRCW or ZCRCQ). ## 2.4 CRC ### CRC implementation details For CRC-16, the CCITT polynomial 0x1021 is used. For CRC-32, the 0xEDB88320 (reversed) polynomial is used. Both are used with standard init/finalize: CRC-16 init 0, CRC-32 init 0xFFFFFFFF, invert the result. The CRCs cover: - the data bytes and the frameend byte in data subpackets. - the type byte and the position/flag bytes in headers. ### CRC policy The following rules apply: - You MUST implement CRC-16 for hex headers. There is no way around it, and the CCITT-1021 polynomial is adequate for that purpose. - You MUST be able to handle incoming CRC-16 binary headers. - You MUST implement CRC-32. - A receiver MUST advertise CANFC32 in its ZRINIT frames (section 4). - You MAY reject file transfer with CRC-16. - You MAY send CRC-16 binary headers when NOT sending data subpackets. - You MUST send CRC-32 binary headers when sending data subpackets over a connection where the receiver advertised CANFC32; without CANFC32 you MUST use CRC-16 (see section 2.2). The reason for this is that the CCITT CRC-16 polynomial is weak even for a 16-bit CRC. It is adequate for headers (which are short and sent rarely), but for data subpackets (which are large and numerous), the collision probability accumulates: after ~1000 blocks with random errors, there is a ~1.5% chance of at least one undetected corruption. CRC-32 reduces this to negligible levels even for terabyte-scale transfers. The ZMODEM CRC-32 polynomial is relatively strong compared to other CRC-32 polynomials. There are better ones, but it is good enough. # 3. Stream control The sender controls the stream with the frameend bytes (see section 2.3). The three streaming modes below can be combined (see Mixed modes). ## Segmented streaming Segmented streaming was originally introduced to support receivers unable to do overlapping serial and disk I/O (rarely a problem today). In this mode the sender sends a ZCRCW subpacket after approximately the segment length, and then waits for a status update from the receiver. Traditionally, Omen software sz and lsz default to a 16 KB segment length. The receiver can specify a segment length in the ZRINIT frame bytes ZP0 and ZP1 (little-endian). The range of possible values is 0 to 65535 bytes, where 0 means unlimited. Segmented streaming is the safe approach for faulty lines. ## Window streaming In this mode the sender uses ZCRCQ data subpackets to trigger ZACK responses from the receiver, in which the receiver reports its current position. The sender typically triggers a ZCRCQ when the window size — the distance between the sender's current position and the last reported receiver position — exceeds some limit. The sender continues streaming while waiting for the ZACK. Some implementations use an unlimited window. This is fine on error-free lines but not recommended if the line generates errors. The entire file can be used as the window. This simplifies buffer management and avoids the window-overrun failure modes that affect fixed-window protocols. ## Non-streaming mode In this mode the sender waits (ZCRCW) for a response after every subpacket. This can be slow, especially over high-latency connections, but it is the safest approach when the connection is really bad. ## Subpacket loss undetectability (why non-streaming exists) In both streaming modes (segmented streaming and window streaming, at any segment length or window size) and in plain streaming without sync points at all, the loss of an entire subpacket together with its frameend and CRC is undetectable: - every surviving subpacket still carries a valid CRC (the CRC is position independent), - the position is only anchored at the ZDATA header, - and the receiver writes the following subpackets at its current file offset. The transferred file is then silently corrupted. This is a protocol-inherent blind spot, not an implementation bug. Senders can manage it in one of two ways: - Size the subpackets so that the transport's plausible loss window (the longest continuous span it can silently remove) is smaller than a subpacket: every loss then damages at least one CRC and is detected and healed as usual. Note: - on transports that always retransmit lost packets on layers below the byte stream (TCP, ISDN, X.25), no loss window exists and any subpacket size is safe. - on transports that only corrupt individual bytes (noise on modem or serial lines), the loss window is zero. - resync points already built into the modes mentioned above (a ZCRCW at the end of a segment, a ZACK inside a window) shrink but do not close this window: a loss between two sync points still swallows a whole subpacket. - If the loss window cannot be bounded with any confidence, use non-streaming mode (ZCRCW after every data subpacket). In this mode only one subpacket is in flight, a loss will be detected, and the protocol resync retransmits exactly the lost subpacket. This recovery (see section 5) is immune to losses of any size, at the cost of one round trip per subpacket. ## Mixed modes Segment length of 32 KB with a window of 4 KB? Why not. The modes can be combined as needed. # 4. Frame types Frame types are grouped by direction. Constants are shown next to each flag/option. ## Sender to receiver (S-->R) ### ZRQINIT (S-->R) Sent by the sender to request a ZRINIT from the receiver. The sender may repeat ZRQINIT if no response is received. ZF0 has one known flag bit: ZCOMMAND (0x01), which indicated that the sender wanted to send a command. This feature is purely historical and MUST NOT be implemented. ### ZSINIT (S-->R) With this frame the sender sends flags to the receiver, followed by a data subpacket with ZCRCW. Flags (ZF0): - TESCCTL (0x40): the sender expects control chars to be escaped. - TESC8 (0x80): the sender expects the 8th bit to be escaped. (TESC8 is DEPRECATED: see section 2.1.2.) The ESCCTL mode must be activated by the receiver before reading the data subpacket. The data subpacket contains the null-terminated attention sequence, limited to 32 bytes including the final null. The receiver must answer with ZACK and 0 in the position/flag bytes, or ZNAK if the ZSINIT frame was garbled. A garbled attention-sequence subpacket is answered with ZNAK, too: the receiver re-enables the previous escape settings and awaits a fresh ZSINIT. Note: the resetting of the escape setting is important. The sender might retry the ZSINIT with a different escape setting. ### ZFILE (S-->R) The ZFILE frame begins a file transmission attempt. The ZFILE header is followed by a ZCRCW data subpacket containing the file metadata. Note: the ZCRCW here is special — normally ZCRCW means "wait for a response before sending the next frame." In this case, the expected response is ZRPOS (or ZSKIP), not ZACK. The sender SHOULD wait for the receiver's ZRPOS/ZSKIP/ZNAK response rather than interpreting the ZCRCW as expecting a ZACK. Some implementations stemming from the Omen Technology code line do not handle a ZACK received here well and run into a timeout; a receiver MUST NOT send a ZACK in response to the ZFILE data subpacket. ZF0..ZF3 contain options. #### ZF0 — conversion options The sender MUST use one of the two following options: - ZCBIN (1) — "Binary" transfer. - ZCRESUM (3) — "Resume" transfer. There was a historic third option, ZCNL (2), to convert newlines. It is deprecated; see section 9. The receiver MUST assume ZCBIN if it encounters any value other than ZCBIN and ZCRESUM. The ZCRESUM option may be used to restart a failed transfer, or even to update a remote copy of a growing file (but do not try the latter with rotating log files). This option causes the receiver to check the local file. If it exists and is shorter than the source file, the transfer may resume. The receiver MAY request a CRC check (via ZCRC), and MAY also check file times for this decision. If it determines that a resume shall be done, it sends a ZRPOS to continue at the end of the local file. Otherwise it continues without resume (it may still reject the file for policy reasons). Override rules: - A sender's ZCBIN does NOT override the receiver's local ZCRESUM policy (but did override ZCNL). - The receiver's local choice of ZCBIN DOES override the sender's ZCRESUM (and did override ZCNL). #### ZF1 — management options If the receiver does not recognize the management option, the file should be transferred normally. - ZMSKNOLOC (0x80): instructs the receiver to bypass the file if it does not have a file with the same name. - ZF1_ZMMASK (0x1f) masks the five lower bits; the resulting value should be one of these mutually exclusive options: - ZF1_ZMNEWL (1): transfer if source is newer or longer. - ZF1_ZMCRC (2): transfer if different file CRC or length. - ZF1_ZMAPND (3): append contents to existing file (if any). - ZF1_ZMCLOB (4): replace existing file. - ZF1_ZMNEW (5): transfer if source is newer. - ZF1_ZMDIFF (6): transfer if dates or lengths differ. - ZF1_ZMPROT (7): protect destination file. - ZF1_ZMCHNG (8): change filename if destination exists. #### ZF2 — transport options All transport options are deprecated: run-length encoding, LZW compression, encryption. See section 9. #### ZF3 — extended options - ZCANVHDR (0x01): "Variable headers OK" Deprecated. See section 9. - MOBYTURBO (0x04): "Mobyturbo escaping offered" Deprecated. See section 9. - ZXSPARS (0x40): Encoding for sparse file operations. Deprecated. See section 9. #### The ZFILE data subpacket The length of the file information subpacket, including the trailing null, SHOULD NOT exceed 1024 bytes. Many implementations offer larger data subpacket sizes, but these SHOULD NOT be used for the ZFILE data subpacket. If longer subpackets are used here, the sender MUST be able to fall back to 1024-byte packets if it receives a ZNAK from the receiver. That is, the sender MUST be able to send a 1024-byte ZFILE data subpacket on the second attempt. ZMODEM sends the file metadata with the ZFILE frame data. It consists of the pathname field (mandatory) and optional further fields. The pathname is separated from the optional fields with a NUL character. The other fields are separated by a space character. No field may be skipped. The block of optional fields is followed by a NUL character. If the optional fields are missing, that NUL character is still mandatory. The fields: - Pathname (mandatory). The pathname (the file name) is sent as a null-terminated ASCII string. If the directory name is included, it is delimited by '/'. 'subdir/foo' is acceptable, 'subdir\foo' is not. The pathname SHOULD be the file name stem (no directory prefix). A relative directory prefix (e.g. 'subdir/foo') MAY be included if needed. The pathname MUST NOT be an absolute path (must not start with '/'). The pathname MUST NOT contain '..' path components. The pathname MUST NOT contain drive designators (e.g. 'C:'). The receiver MUST protect against path traversal regardless, as a defense-in-depth measure. ZMODEM software MUST be able to deal with spaces in the pathname. File names MUST NOT be translated to lower case. When transmitting files between different operating systems, file names should be acceptable to both the sender and receiving operating systems. If they are not, the receiving program MAY apply transformations to make the file names acceptable, MAY invent new file names, or MAY reject the file with a ZSKIP. - Length. The length field is stored as a decimal string counting the number of data bytes in the file. - Modification date. Sent as an octal number giving the time the contents of the file were last changed, measured in seconds from Jan 1 1970 UTC. A date of 0 implies the modification date is unknown and should be left as the date the file is received. - File access rights. The file access rights are stored as an octal number (e.g. 0644). Some historical implementations sent the full file mode (the st_mode field from stat(2)). The receiving programs of the same historical implementations checked the incoming mode for the 0x8000 bit, and decided to disable the ZCNL mode (newline translation) if this was found. You SHOULD NOT send this. You SHOULD NOT act upon it. The receiver MUST either (a) discard the file access rights, or (b) filter them so that they do not cause security problems and do not cause non-regular files to be created. The sender MUST either (a) send 0 as access rights, or (b) filter the access rights so that they do not disclose possibly sensitive information. 0440 is definitively safer than 06555. - Serial number. Set this field to 0. See section 9 for rationale. - Number of files remaining in the batch. Sent as a decimal number. The count includes the current file. It is an estimate, intended for use in the user interface. - Number of bytes remaining in the batch. Sent as a decimal number. The count includes the current file. It is an estimate, intended for use in the user interface. - File type. You may receive a data subpacket containing a file type (a decimal number). You MUST ignore this field. You MUST NOT send it. This is the only optional field which may (and should) be missing. Even its preceding space is optional. Examples: - NAME\0\0 A file with the name NAME, and no further metadata. - all256.bin\0256 15242643773 100664 0 3 10496\0 A file with the name all256.bin, a length of 256 bytes, an octal timestamp relatively near the time of writing, and access rights of 100664 (which means the sender doesn't adhere to this documentation, otherwise it would be 0664). The file has the serial number 0, and is part of the last three files in the batch, which together are 10496 bytes large. ### ZDATA (S-->R) ZP0...ZP3 contain the file offset. One or more data subpackets follow. Zero-length data subpackets may be used as an idle subpacket to prevent the receiver from timing out in case data is not immediately available to the sender. The sender is free to choose frameend types, except that the first subpacket after a ZRPOS — the initial one as well as one during error recovery — MUST be ZCRCW (see section 5). The receiver compares the file position in the ZDATA header with the position it expects. If they differ, it sends a ZRPOS response with the correct position. #### ZDATA data subpackets The data subpackets must be ZDLE encoded (their CRC type follows the header, per section 2.3). At the end of each transmitted data subpacket, the sender SHOULD check for the presence of a header from the receiver. If it detects that input is available, the sender samples the reverse data stream for the presence of either a ZPAD or CAN character. It SHOULD act on flow control characters it receives. Other characters indicate line noise and cause the sender to increment a counter which is reset whenever the sender waits for a header from the receiver. If the counter overflows an implementation-defined limit, the sender sends the next data subpacket as ZCRCW and waits for a response. The sender MUST act upon a complete received frame as soon as possible. ### ZEOF (S-->R) With this frame the sender reports the end of the file. ZP0...ZP3 contain the ending file offset. If this position does not match the receiver's state, the receiver SHOULD ignore the ZEOF and wait, because it might have arrived before a pending ZRPOS. (The sender may have sent ZEOF before receiving the receiver's ZRPOS error response.) ### ZFREECNT (S-->R) [half deprecated: sending it is forbidden, answering it is still required] The sender requests a ZACK frame with ZP0...ZP3 containing the number of free bytes on the current file system. A value of 0 represents an indefinite amount of free space. This command MUST NOT be sent, and MUST be answered with 0 in case some ZMODEM application asks for free space before a transfer. See Note 9.2. A future update of this documentation is likely to deprecate this feature entirely. ## Receiver to sender (S<--R) ### ZRINIT (S<--R) Sent by the receiver to inform the sender about the receiver's capabilities and to synchronize the session. ZF0 contains a bitwise OR of the receiver's capabilities: Useful flags: - CANFDX (0x01): the receiver can send and receive true full duplex. (This will be true for most current hardware.) - CANOVIO (0x02): the receiver can receive data during disk I/O. (Most likely you can.) - CANBRK (0x04): the receiver can send a break signal. (If you have tcsendbreak and send via a terminal, set this.) - CANFC32 (0x20): the receiver can use 32-bit CRC. (A receiver MUST set this; see section 2.4.) - ESCCTL (0x40): the receiver expects control chars to be escaped. Deprecated ZF0 flags: - ESC8 (0x80): the receiver expects the 8th bit to be escaped. (ESC8 is DEPRECATED: see section 2.1.2.) - CANCRY (0x08): the receiver can decrypt. Never implemented anywhere. - CANRLE (0x08): the receiver can decode ZMODEM run-length encoding. Only implemented in Omen software. - CANLZW (0x10): the receiver can uncompress. Never implemented anywhere. Note: CANCRY and CANRLE share the same bit. The bit is meaningless today: a receiver receiving it set SHOULD ignore it, and MUST NOT interpret it as RLE or encryption capability. ZF1 is another bitwise OR mask of the receiver's capabilities. All deprecated: - CANVHDR (0x01): the receiver understands variable headers. - ZRRQWN (0x08): the receiver specified window size in ZRPXWN. - ZRRQQQ (0x10): the receiver specified additional chars to escape. These three are historic. There is currently no ZMODEM software implementing variable headers, and the other two depended on them. See section 9. ZP0 and ZP1 contain the receiver's segment length in bytes (little-endian), or 0 if nonstop I/O is allowed (see section 3). Recommendation: a typical ZRINIT sets CANFC32|CANFDX|CANOVIO, and maybe |CANBRK. ### ZSKIP (S<--R) The receiver sends this in response to ZFILE to make the sender skip to the next file. ### ZABORT (S<--R) The receiver sends this to terminate file transfers. The original documentation stated this was to be done when requested by the user. The sender responds with a ZFIN sequence. ### ZRPOS (S<--R) Sent by the receiver to force file transfer to resume at the file offset given in ZP0...ZP3. This is part of the error recovery flow; see section 5. The offset is attacker-controlled from the sender's point of view; it MUST be validated before use (see section 5). ### ZFERR (S<--R) The receiver detected an error when reading from or writing to a file. The protocol treats this as equivalent to ZABORT. ### ZCHALLENGE (S<--R) [half deprecated] The receiver requests the sender to echo the number in ZP0...ZP3 in a ZACK frame. A receiver MUST NOT send a ZCHALLENGE frame. A sender MAY answer it with a ZACK frame containing the number in ZP0...ZP3. A sender might opt to do so for maximum compatibility, but it is unlikely this will ever be needed. The few implementations supporting it only answer a ZCHALLENGE; not one of them sends it. A future update of this documentation is likely to deprecate this feature entirely. See Note 9.3. ### ZCOMPL (S<--R) The request was completed. This was used as a response to the deprecated ZCOMMAND frame, and possibly in the so-called server mode of Omen Technology software. Sending this frame is DEPRECATED. ZMODEM implementations receiving a ZCOMPL SHOULD treat it as any other unknown or out-of-sync frame. Receivers wishing to ensure maximum compatibility with old ZMODEM implementations MAY send a ZCOMPL with a value of 1 in response to a ZCOMMAND request, thereby informing the sender that the command failed. ## Bidirectional (S<->R) ### ZACK (S<->R) An acknowledgment, sent as an answer to a ZSINIT or ZCHALLENGE frame, or to a ZCRCQ or ZCRCW data subpacket — except the ZFILE metadata subpacket, which expects ZRPOS/ZSKIP and MUST NOT be answered with a ZACK (see the ZFILE frame description). The payload depends on what is being acknowledged: the current file offset for a ZCRCQ/ZCRCW subpacket, 0 for a ZSINIT, and the echoed number for a ZCHALLENGE. ### ZNAK (S<->R) The receiver sends this if the last header received was garbled. The sender sends this if it received a valid header that is not allowed at that point, or is of an unknown frame type. For example, the sender sends ZNAK when it is waiting for ZRINIT and receives something other than ZRINIT, ZCOMMAND, or ZCHALLENGE. The sender also sends ZNAK when it receives an unexpected frame while waiting for ZRPOS after sending ZFILE. ### ZFIN (S<->R) The sender sends this to terminate the session. The receiver answers with its own ZFIN. A receiver that cannot continue MAY send ZFIN on its own. A sender receiving ZFIN mid-session SHOULD treat it as a session end request and exit; completing the ZFIN/"OO" handshake is a courtesy, not a requirement. ### ZCRC (S<->R) The receiver requests a CRC for the number of bytes given in ZP0..ZP3. The sender computes a 32-bit CRC (the ZMODEM CRC-32 of section 2.4) over the requested bytes, initialized to 0xFFFFFFFF, and responds with the one's complement (bitwise inversion) of that CRC in ZP0..ZP3. This is why it occupies all four position/flag bytes; the frame itself is sent in whatever header format the negotiation dictates (section 2.2). A ZP0..ZP3 value of 0 in the request means "the CRC of the entire file". ## Pseudo frame ### ZCAN The original Omen ZMODEM implementations internally translated the session abort sequence into this pseudo frame, which was never sent over the wire. # 5. Error recovery When dealing with the possibility of errors (i.e. when you need to re-synchronize with the other side), expect that messages may arrive in seemingly impossible order. What your software just received may not be the answer to the last message you sent. ## Receiver-side error detection The receiver detects errors in three ways: 1. CRC mismatch in a data subpacket. 2. Position mismatch in a ZDATA header (ZDATA offset != bytes_received). 3. Unexpected frame (a frame that is not valid at the current point in the protocol state machine). On detecting any of these, the receiver: 1. Sends the attention sequence (if one was defined via ZSINIT). 2. Sends a ZRPOS frame with the last known good position. 3. Discards all data subpackets that arrive until a ZDATA frame with the correct position is received. ## Sender-side error recovery When the sender receives a ZRPOS: 1. It SHOULD purge its output buffers and/or network of unprocessed output data, to minimize the amount of stale data the receiver must discard. 2. It seeks to the position given in the ZRPOS. The position MUST be validated first: it MUST NOT exceed the size of the input file (or be negative, or otherwise nonsensical). The response to an invalid position (rejecting the frame, or clamping it to the file size) is implementation-defined. A sender that cannot seek (pipe, non-seekable input) MUST NOT resume to a foreign offset; it either ignores the ZRPOS position or restarts the transfer. 3. It sends a ZDATA frame at that position. 4. The first data subpacket MUST be ZCRCW (wait for ACK) to ensure both sides are synchronized before resuming streaming. ## Messages crossing in flight On buffered connections (networks, buffered modems, PTY pairs), by the time the sender receives a ZRPOS, it may have already sent many more data subpackets that are still in transit. These are not errors — the receiver must simply discard them. Conversely, the sender may receive a stale ZACK (acknowledging a position before the rewind) after it has already started resending from the ZRPOS position. The sender SHOULD ignore ZACKs with positions that do not match its current state. Similarly, the receiver may receive a ZEOF that was sent before the sender received the receiver's ZRPOS. The receiver SHOULD ignore such a ZEOF and wait for the sender's ZDATA resync. ## Retry limits Both sides should implement retry limits. After a configurable number of consecutive errors (typical: 10–20), the transfer should be aborted with a cancel sequence or a ZABORT frame. # 6. Session lifecycle ## 6.1 Startup The sender sends ZRQINIT to request the receiver's ZRINIT. The receiver responds with ZRINIT, advertising its capabilities (CANFDX, CANFC32, etc.) and segment length. The sender may optionally send ZSINIT to define an attention sequence or request control-character escaping. The receiver responds with ZACK. Once synchronization is complete, the sender proceeds to file transfer. ## 6.2 File transfer For each file: 1. The sender sends ZFILE with file metadata (name, length, date, etc.). 2. The receiver examines the metadata and responds with: - ZRPOS (begin transfer at the given offset, normally 0) - ZSKIP (skip this file) - ZCRC (request a CRC check before deciding) - ZNAK (the ZFILE frame was garbled; the sender retries) - ZABORT or ZFERR (terminate the batch; see section 4) 3. The sender sends ZDATA at the requested offset, followed by data subpackets. 4. The sender sends ZEOF when the file is complete. 5. The receiver verifies the ZEOF offset matches its received byte count, then closes the file and responds with ZRINIT (ready for next file). If errors occur during step 3, see section 5 (error recovery). ## 6.3 Cleanup After all files are transferred: 1. The sender sends ZFIN. 2. The receiver responds with ZFIN. 3. The sender sends "OO" (Over and Out) and exits. 4. The receiver waits briefly for "OO", then exits whether or not it was received. ## 6.4 Cancel sequence ZMODEM recognizes a cancel sequence: a sequence of 5 ^X (ZDLE aka CAN, 0x18) characters will terminate a session. All ZMODEM implementations MUST recognize 5 CAN characters as a session cancel sequence. They MAY send 8 to 10 CAN characters (the extra ones being insurance), optionally followed by an equal number of backspace characters (in an attempt to erase the effect of the CAN characters if they were received by a command interpreter or shell). They MAY also choose not to implement sending the cancel sequence. After sending or receiving the cancel sequence, the ZMODEM session MUST be terminated. No further communication will be successful. # 7. Auto download Some 'sz' implementations upon start send a 'rz\r' (r z CR) to the receiving side. This was always a hack, but has long been used to trigger auto download. DO NOT send this. Interactive applications can monitor the data stream for ZDLE, then scan for "B00" indicating a ZRQINIT hex header, and start the receiver. This is the proper auto-download mechanism — it only triggers on actual ZMODEM frames and does not crash remote applications with unexpected control characters. # 8. Historical and deprecated features ## Variable headers There has never been an open documentation of variable headers. You MUST NOT implement them. ## Run-length encoding Only Omen ZMODEMs ever implemented RLE. It is not complicated, but it is only useful with files containing lots of repeated characters and very few RLE escape characters. It is practically useless, and worse than every other available compression. You MUST NOT implement RLE. ## LZW compression Hasn't even been implemented in Omen software. ## Sparse file handling (ZFILE ZF2 ZXSPARS option) If you want to implement sparse file handling on the receiving side, feel free to do so. But you MUST NOT implement the ZXSPARS option. The sender cannot know enough about the receiver's filesystem to drive that, and in cases where retransmissions and smaller subpacket sizes are needed, the sender's logic can only fail. Without the option, a receiver can only guess; the pragmatic approach is to detect sparse-friendly (highly repetitive) content after transfer and to punch holes then, or not to bother at all. ## Serial number transfer Do not send the serial number in the ZFILE frame. You would transfer it in the open, for anyone to reuse. ## File type transfer Do not send the file type in the ZFILE frame. This is neither useful nor has it ever been implemented. ## File translation — ZFILE ZF0 flag ZCNL (2) ZCNL was supposed to translate line ends to the local convention, and also allowed "other processing appropriate to ASCII text files and the local operating system." Under UNIX, it deleted every carriage return (CR) and cut the file short at the first CP/M End of File character (^Z). CP/M EOF handling is a thing of the past, and even Windows editors can deal with or without CR. A ZMODEM file transfer using this option CANNOT be resumed in case of trouble. This option MUST NOT be used. ## Historical frame types ### ZCOMMAND (S-->R) The sender requests the receiver to execute a command in a ZCRCW- terminated data subpacket. The only secure implementation is to answer with a ZCOMPL with an exit status of 1 (as a position). You MUST NOT implement this in any other way. ### ZSTDERR (S-->R) The sender requests the receiver to output the data in a ZCRCW- terminated data subpacket to stderr. This is, and was, the whole documentation. You MUST NOT implement this. # 9. Notes and commentary ## 9.1 Notes for the pathname section The original ZMODEM documentation stated: - `No spaces are included in the pathname` This requirement has been removed. Nowadays spaces are common in filenames. - `File names should be translated to lower case unless the sending system supports upper/lower case file names.` This has been explicitly forbidden. Today practically all systems support file names in different cases, even though they might also support filesystems enforcing a single case. ## 9.2 Rationale for the half deprecation of ZFREECNT ZFREECNT allowed the sender to inquire about the receiver's free space. This documentation deprecates the inquiry, and enforces the answer 0, aka 'indefinite'. Why? You may ask which filesystem the receiver should report, since the sender's pathname is unknown at that point? Good question, the answer is 0. You may ask how to represent N terabytes of free space in 4 bytes? Good question, the answer is 0. You may ask why the sender even wants to know this? Good question, the answer is 0. We have a safe answer here. Forbidding answers to a ZFREECNT would be more risky. ## 9.3 ZCHALLENGE half deprecation Historical information: the ZCHALLENGE frame was sent by the receiving program to the sending program to verify that it is connected to an operating program, and was not activated by spurious data or a Trojan Horse message. As a security measure it is extremely weak, and 'spurious data' could be detected by simpler means. ## 9.4 Variable header deprecation The variable length headers have been around for 30 years, and since then the only implementations of them have been in Omen software - but all of these are dead. V-Headers are just longer headers (with a maximum of 16 bytes payload instead of 4), with more information. Let's see what is known: #define ZRPXWN 8 /* 9th byte in header contains window size/256 */ #define ZRPXQQ 9 /* 10th to 14th bytes contain quote mask */ #define ZRRQWN 8 /* Receiver specified window size in ZRPXWN */ #define ZRRQQQ 16 /* Additional control chars to quote in ZRPXQQ */ Summary: - the receiver can influence the sender's window size (still useful) - and it can set the control escaping per character (may still be useful). But it also leaves some open questions: a) Why 5 bytes (40 bits) for 32 control chars? (csz really uses 4 bytes) b) What is in bytes 5 to 8? I wouldn't want to implement anything on a documentation so spotty, even if the features are somewhat attractive. ## 9.5 MobyTurbo, Pack-7, and RLE/ESC8 escaping None of this was ever documented publicly. We know about the details because DSZ was disassembled (see doc/disassembly.txt). The Omen "ESC8" is a mechanism different from and incompatible with the classic ZDLE+XOR-0x40 reading of the ESC8/TESC8 flags. Both interpretations share the flag bits, which is why those are deprecated (section 2.1.2). # 10 Constants ## 10.1 characters - CAN 0x18 /* ^X, same as ZDLE */ - XOFF 0x13 /* ^S, 19 */ - XON 0x11 /* ^Q, 17 */ - ZPAD '*' /* 0x2a Padding character begins frames */ - ZDLE 0x18 /* ^X Zmodem escape - same as CAN */ - ZRESC 0x7e /* RLE flag/escape character [DEPRECATED] */ ## 10.2 header types - ZBIN 'A' /* Binary frame indicator */ - ZHEX 'B' /* HEX frame indicator */ - ZBIN32 'C' /* Binary frame with 32 bit FCS */ - ZBINR32 'D' /* RLE packed Binary frame with 32 bit FCS [DEPRECATED] */ - ZVBIN 'a' /* Binary frame indicator (CRC-16) [DEPRECATED: variable headers] */ - ZVHEX 'b' /* HEX frame indicator [DEPRECATED: variable headers] */ - ZVBIN32 'c' /* Binary frame with 32 bit FCS [DEPRECATED: variable headers] */ - ZVBINR32 'd' /* RLE packed Binary frame with 32 bit FCS [DEPRECATED] */ - 0x31 '1' /* Omen ZMODEM-90 header: RLE + CRC32 + 8th-bit quoting [DEPRECATED: variable headers, proprietary, undocumented, CRC32 salted with a copyright notice; see section 9.5 and doc/disassembly.txt] */ - 0x32 '2' /* Omen ZMODEM-90 header: "Pack-7", payload as base-88 digits 0x22-0x79 [DEPRECATED: same reasons as '1'] */ - 0x33 '3' /* Omen ZMODEM-90 header: "MobyTurbo", only ZDLE escaped [DEPRECATED: same reasons as '1'] */ ## 10.3 byte positions within the header payload array - ZF0 3 /* First flags byte */ - ZF1 2 - ZF2 1 - ZF3 0 - ZP0 0 /* Low order 8 bits of position */ - ZP1 1 - ZP2 2 - ZP3 3 /* High order 8 bits of file position */ ## 10.4 frame types - ZRQINIT 0 /* Request receive init */ - ZRINIT 1 /* Receive init */ - ZSINIT 2 /* Send init sequence (optional) */ - ZACK 3 /* ACK to above */ - ZFILE 4 /* File name from sender */ - ZSKIP 5 /* To sender: skip this file */ - ZNAK 6 /* Last packet was garbled */ - ZABORT 7 /* Abort batch transfers */ - ZFIN 8 /* Finish session */ - ZRPOS 9 /* Resume data trans at this position */ - ZDATA 10 /* Data packet(s) follow */ - ZEOF 11 /* End of file */ - ZFERR 12 /* Fatal Read or Write error Detected */ - ZCRC 13 /* Request for file CRC and response */ - ZCHALLENGE 14 /* Receiver's Challenge [DEPRECATED] */ - ZCOMPL 15 /* Request is complete [DEPRECATED] */ - ZCAN 16 /* Other end canned session with CAN*5 */ - ZFREECNT 17 /* Request for free bytes on filesystem [likely future DEPRECATION] */ - ZCOMMAND 18 /* Command from sending program [DEPRECATED] */ - ZSTDERR 19 /* Output to standard error, data follows [DEPRECATED] */ ## 10.5 frameends - ZCRCE 'h' /* CRC next, frame ends, header packet follows */ - ZCRCG 'i' /* CRC next, frame continues nonstop */ - ZCRCQ 'j' /* CRC next, frame continues, ZACK expected */ - ZCRCW 'k' /* CRC next, ZACK expected, end of frame */ ## 10.6 ZRINIT byte ZF0 - CANFDX 0x01 /* Rx can send and receive true FDX */ - CANOVIO 0x02 /* Rx can receive data during disk I/O */ - CANBRK 0x04 /* Rx can send a break signal */ - CANCRY 0x08 /* Receiver can decrypt [DEPRECATED] (yes, same as RLE) */ - CANRLE 0x08 /* Receiver can decode run-length encoding [DEPRECATED] (yes, same as CRY) */ - CANLZW 0x10 /* Receiver can uncompress [DEPRECATED] */ - CANFC32 0x20 /* Receiver can use 32 bit Frame Check */ - ESCCTL 0x40 /* Receiver expects ctl chars to be escaped */ - ESC8 0x80 /* Receiver expects 8th bit to be escaped [DEPRECATED: see section 2.1.2] */ ## 10.7 ZRINIT byte ZF1 - CANVHDR 0x01 /* Variable headers OK [DEPRECATED] */ - ZRRQWN 0x08 /* Receiver specified window size in ZRPXWN [DEPRECATED] */ - ZRRQQQ 0x10 /* Additional control chars to quote in ZRPXQQ [DEPRECATED] */ ## 10.8 ZSINIT params - ZATTNLEN 32 /* Max length of attention string */ - ALTCOFF ZF1 /* Offset to alternate canit string, 0 if not used */ This is all which is known about the alternate cancel string. ## 10.9 ZSINIT byte ZF0 - TESCCTL 0x40 /* Transmitter expects ctl chars to be escaped */ - TESC8 0x80 /* Transmitter expects 8th bit to be escaped [DEPRECATED: see section 2.1.2] */ ## 10.10 ZFILE byte ZF0: - ZCBIN 1 /* Binary transfer - inhibit conversion */ - ZCNL 2 /* Convert NL to local end of line convention [DEPRECATED] */ - ZCRESUM 3 /* Resume interrupted file transfer */ ## 10.11 ZFILE byte ZF1 - ZF1_ZMSKNOLOC 0x80 /* Skip file if not present at rx */ - ZF1_ZMMASK 0x1f /* Mask for the choices below */ - ZF1_ZMNEWL 1 /* Transfer if source newer or longer */ - ZF1_ZMCRC 2 /* Transfer if different file CRC or length */ - ZF1_ZMAPND 3 /* Append contents to existing file (if any) */ - ZF1_ZMCLOB 4 /* Replace existing file */ - ZF1_ZMNEW 5 /* Transfer if source newer */ - ZF1_ZMDIFF 6 /* Transfer if dates or lengths different */ - ZF1_ZMPROT 7 /* Protect destination file */ - ZF1_ZMCHNG 8 /* Change filename if destination exists */ ## 10.12 ZFILE byte ZF2 - ZTLZW 1 /* Lempel-Ziv compression [DEPRECATED] */ - ZTCRYPT 2 /* Encryption [DEPRECATED] */ - ZTRLE 3 /* Run Length encoding [DEPRECATED] */ ## 10.13 ZFILE byte ZF3: - ZCANVHDR 0x01 /* Variable headers OK [DEPRECATED] */ To the best of my knowledge this was used to signal the receiver to ignore non-vhdr headers, and to turn off the 'unregistered copy' message. - MOBYTURBO 0x04 /* Real constant name unknown [DEPRECATED] */ This was used, in the proprietary DSZ.EXE, to signal the senders ability to use MobyTurbo escaping (only ZDLE is escaped in that mode). - ZXSPARS 0x40 /* Encoding for sparse file operations [DEPRECATED] */ ## 10.14 Receiver window size override - ZRWOVR 4 /* byte position for receive window override/256 [DEPRECATED: undocumented] */ (how this was meant or used is totally unknown) ## 10.15 ZCOMMAND byte ZF0 - ZCACK1 1 /* Acknowledge, then do command [DEPRECATED: ZCOMMAND is deprecated] */ # 11. Differences from the original protocol descriptions ## 11.1 Auto-download "rz\r" hack This has been deprecated, in favor of scanning for ZDLE + "B00". ## 11.2 ZSINIT The sending of a serial number has been deprecated (send a zero). ## 11.3 ZRQINIT ZF0 flag ZCOMMAND ZCOMMAND is deprecated. Senders MUST NOT send it. Receivers MUST NOT execute a ZCOMMAND request, and MAY answer it with a ZCOMPL with the value of 1. ## 11.4 ZFILE ZF0 conversion options: renaming and semantics ZCNL has been deprecated. Receivers MUST assume ZCBIN if they encounter unknown ZF0 values. Override rules clarified: sender's ZCBIN does NOT override the receiver's local ZCRESUM policy. ## 11.5 ZFILE ZF1 management option ZMCHNG documented it. Its been there forever. ## 11.6 ZFILE ZF2 transport / ZF3 extended options Deprecated all transport options (LZW, RLE, CRYPT). Deprecated all known extended options (VHDR, MOBYTURBO, SPARSE). ## 11.7 ZRINIT capability flags Deprecated CANCRY, CANRLE, CANLZW. Documented the ZF1 bits: CANVHDR, ZRRQWN, ZRRQQQ (and deprecated them). CANFC32 is now mandatory. ## 11.8 32-bit CRC negotiation and usage rules (§2.2 and §2.4) Documented rules for ZHEX, ZBIN and ZBIN32 headers (2.4), and the polynomial used and their init details. Receivers MUST implement CRC-32 and send CANFC32. Added the rationale for the enforcing of CRC-32 for data. ## 11.9 Header/packet size limits Documented the widely used 4096/8192-byte extensions (lrzsz -4/-8, sexyz), capped to the receiver's ZRINIT segment length. ## 11.10 The ZFILE metadata subpacket acknowledgement exception The ZFILE frame is followed by a ZCRCW data subpacket, which is NOT to be answered with a ZACK header, but ZRPOS, ZSKIP or ZNAK. Receivers MUST NOT answer the ZFILE data subpacket with ZACK. This is established behavior of the Omen programs. ## 11.11 ZNAK semantics Documented that ZNAK is not only sent from the receiver to the sender, but vice versa. Documented that the sender also sends ZNAK when it receives a valid, but out of order, or an frame of unknown type. ## 11.12 ZFIN Document that the receiver MAY also send ZFIN on its own to end the session mid-stream. ## 11.13 ZCHALLENGE half-deprecated: - a receiver MUST NOT send it - a sender MAY still answer for compatibility full deprecation planned. ## 11.14 ZFREECNT half-deprecated: - a sender MUST NOT send it - a receiver MUST answer with a forced 0 ("indefinite"). ## 11.15 ZCOMMAND / ZSTDERR / ZCOMPL - ZCOMMAND MUST NOT be implemented except to answer with ZCOMPL/exit-status-1 - ZSTDERR MUST NOT be implemented - ZCOMPL itself MAY be implemented to answer ZCOMMAND with the exit status 1. - the historic ZRQINIT-ZCOMMAND echo-check rule is dropped. ## 11.16 Header-type constants (variable headers, RLE) deprecated ZBINR32 ('D'), ZVBIN/ZVHEX/ZVBIN32/ZVBINR32 ('a'–'d'), and ZRESC (0x7e), because they never were publicly documented. ## 11.17 Cancel sequence details - 5 CAN characters MUST terminate the session. - implementations MAY send 8-10 with optional backspaces - implementations MAY omit sending the cancel sequence entirely - after a cancel sequence no further communication will be successful. ## 11.18 ZFILE pathname rules - spaces allowed in filenames - lower-case translation explicitly forbidden - added security rules: file names MUST NOT be absolute paths, MUST NOT contain "..", MUST NOT contain drive designators, and receiver MUST defend against path traversal regardless. ## 11.19 File-mode metadata semantics - deprecated the 0x8000/st_mode behavior as historical (detection of a regular Unix file), forbade to send it, forbade to act upon it. - sender/receiver filtering requirements for security ## 11.20 Streaming strategies The five original streaming strategies were shaped by 1980s paths: serial port, modem, mostly unbuffered copper or a small-buffering packet network, modem, serial port. Over today's internet hundreds of kilobytes may be in flight, and the old taxonomy no longer matches practice: - sampling is an implementation detail, not a strategy (section 3), - reverse interrupts cannot be relied upon end-to-end; the attention mechanism remains optional (ZSINIT, section 5), - "error free channel" streaming was an illusion then and is one now; links may correct errors, but packet loss happens. Normative today: the three modes of section 3, combinable, with recovery per section 5. Documented the subpacket-loss undetectability that all streaming modes share (section 3) when using transports able to lose continuous byte streams or packets: a loss window covering a whole subpacket including frameend and CRC breaks no checksum, and only non-streaming mode (ZCRCW per subpacket) protects against losses of arbitrary size. ## 11.21 ZRPXWN/ZRRQWN/ZRWOVR - deprecated ZRPXWN - deprecated ZRRQWN - deprecated ZRWOVR ## 11.22 Documented escaping exception / extensions - "turbo escaping" (not escaping 0x10/0x90/0x0d/0x8d), - mention often implemented additional escapes (ssh escape char) - the receiver ignores raw 0x11/0x91/0x13/0x93; since the ESC8/TESC8 deprecation (11.28) this rule applies regardless of the flags. ## 11.23 Flag-byte discipline - senders MUST zero unused bits, - receivers MUST ignore unknown bits ## 11.24 Hex-header trailing - specified the 'variations' of the CR LF seen in the wild. - Implementations MUST NOT depend on incoming CR and LF. ## 11.25 Answers to ZFILE §6.2's enumerates the possible responses to ZFILE (ZRPOS/ZSKIP/ZCRC/ZNAK/ZABORT/ZFERR). ## 11.26 YMODEM fallback Gone. There is no good reason to fall back to YMODEM if a ZMODEM connection cannot be established. ## 11.27 Meta-characters in the Attn string The original ZMODEM specification documented two meta-characters for attention string: - \335 (octal) to send a break, - \336 to pause one second. Implementing such features can be helpful in many situations, but these are on a level below the ZMODEM protocol and therefore out of scope. ## 11.28 ESC8/TESC8 deprecated The ESC8 (ZRINIT) and TESC8 (ZSINIT) flags were never publicly documented, and the two known readings of the 0x80 flag bits are incompatible wire formats: the classic ZDLE+XOR-0x40 8th-bit escaping, and the proprietary Omen ZMODEM-90 formats (headers 0x31/0x32/0x33, see 9.5 and doc/disassembly.txt) which the Omen implementations and the current reimplementation (zmtx-zmrx) select when they see the flag. A session using the flags between two sides with different readings is mutually undecodable in both directions. Both flags are deprecated: senders MUST NOT set them, and the reader of each flag MUST ignore it. Both sides MUST still decode ZDLE-escaped bytes with bit 7 set. See section 2.1.2. lrzsz-0.13.1/doc/README0000664000175000017500000000220315257302034010066 Included in this directory are: - the original ZMODEM documentation: zmodem-forsberg.txt It was written by the protocols inventor Chuck Forsberg, and last changed in 1988. It is partially out of date, but contains a wealth of historical information, for example the considerations leading to the protocol. - a shorter ZMODEM documentation: zmodem-zmtx-zmrx.txt Written by Jacques Mattheij, the author of the zmtx-zmrx suite. It was written in 1994, and is also out of date. - my own ZMODEM work-in-progress documentation: zmodem-wip.txt It was written in 2026. I marked many features as deprecated, because they are either obsolete or should not be used in todays environment. I also documented common extensions. - my work-in-progress ZMODEM64 proposal, to add large file support, larger and more precise time stamps, receiver originated window, rxbuf and subpacket sizes and receivers originated escapes to the protocol. - zmodemsnif.txt, the only documentation of the ZMODEM sniffer i use. This is a rework of my old recordxyz, but the options are incompatible, and the 'feature' of crashing randomly is gone. lrzsz-0.13.1/depcomp0000755000175000017500000005621715256501374010041 #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2024-06-19.01; # UTC # Copyright (C) 1999-2024 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . GNU Automake home page: . General help using GNU software: . EOF exit $? ;; -v | --v*) echo "depcomp (GNU Automake) $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interference from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsolete pre-3.x GCC compilers. ## but also to in-use compilers like IBM xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: lrzsz-0.13.1/README.cvs0000644000175000017500000000120706642657325010132 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. lrzsz-0.13.1/configure.ac0000664000175000017500000002137415260416765010754 dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.72]) AC_INIT([lrzsz],[0.13.1]) AC_CONFIG_SRCDIR([src/crctab.c]) AM_INIT_AUTOMAKE(foreign) AC_CONFIG_HEADERS(config.h) AC_USE_SYSTEM_EXTENSIONS dnl Enable 64-bit file offsets on 32-bit platforms (noop if off_t is already 64-bit) AC_SYS_LARGEFILE dnl Policy: about 20 years. Rounded to the nearest _POSIX_C_SOURCE. Not below 15 years. supported_c_stds="c23 c17 c11 c99" AC_SUBST(MIN_POSIX_C_STD, "200809L") AC_SUBST(SUPPORTED_C_STDS, "$supported_c_stds") dnl AM_INIT_AUTOMAKE AC_DEFINEs and AC_SUBSTs PACKAGE and VERSION. dnl Tarball name (Specfile.in); must not shadow autoconf's plain PACKAGE_VERSION. AC_SUBST([DIST_TARBALL], ["$PACKAGE-$VERSION"]) AC_ARG_ENABLE([mkdir], AS_HELP_STRING([--disable-mkdir], [disable support for creating directories (lrz)])) AS_IF([test "x$enable_mkdir" != xno], [AC_DEFINE([ENABLE_MKDIR], [1], [Define to 1 if lrz shall create directories if needed.])]) AC_ARG_WITH([syslog-facility], AS_HELP_STRING([--with-syslog-facility=FACILITY], [syslog facility (default: LOG_UUCP)]), [AS_CASE([$withval], [yes|no|""], [syslog_facility=LOG_UUCP], [syslog_facility=$withval])], [syslog_facility=LOG_UUCP]) AC_DEFINE_UNQUOTED([SYSLOG_FACILITY], [$syslog_facility], [Define to the syslog facility constant to use for openlog().]) have_std= AC_ARG_ENABLE([std], AS_HELP_STRING([--enable-std=STD], [use a specific C std (c23 c17 c11 c99)]), [have_std=$enableval], [have_std="no"]) AC_ARG_ENABLE([asan], AS_HELP_STRING([--enable-asan], [enable the address sanitizer (if available)]), [want_asan=$enableval], [want_asan="no"]) AC_ARG_ENABLE([lsan], AS_HELP_STRING([--enable-lsan], [enable the leak sanitizer (if available)]), [want_lsan=$enableval], [want_lsan="no"]) AC_ARG_ENABLE([msan], AS_HELP_STRING([--enable-msan], [enable the memory sanitizer (if available)]), [want_msan=$enableval], [want_msan="no"]) AC_ARG_ENABLE([ubsan], AS_HELP_STRING([--enable-ubsan], [enable the undefined behavior sanitizer (if available)]), [want_ubsan=$enableval], [want_ubsan="no"]) AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [compile with coverage information]), [want_coverage=$enableval], [want_coverage="no"]) dnl Checks for programs. AC_PROG_CC dnl AX_COMPILER_FLAGS_CFLAGS() is called below, together with the manual dnl WARN_CFLAGS list, inside the gcc-family gate. dnl explicit std: must be on the list AND probe clean; anything else is a dnl user error (the compiler may accept flags like -std=c89 for code that dnl does not build under it). dnl default (no/empty): probe down the list, first match wins. AS_CASE([$enable_std], [yes|no|""], [], [AS_CASE([" $supported_c_stds "], [*" $enable_std "*], [], [AC_MSG_ERROR([--enable-std=$enable_std: not supported (try: $supported_c_stds)])]) AX_CHECK_COMPILE_FLAG(-std=$enable_std, [have_std=$enable_std], [AC_MSG_ERROR([--enable-std=$enable_std: not supported by $CC])])]) for i in $supported_c_stds ; do if test "$have_std" = "no" ; then AX_CHECK_COMPILE_FLAG(-std=$i, [have_std=$i]) fi done if test "$have_std" != "no" ; then AX_APPEND_COMPILE_FLAGS(-std=$have_std, [LRZSZ_CFLAGS]) fi AX_APPEND_COMPILE_FLAGS([ -g3], [LRZSZ_CFLAGS]) dnl Default to glibc buffer-overflow checks (autoconf turns on -O2, so the dnl build satisfies the optimization requirement of FORTIFY_SOURCE). dnl This probe allows to default to an environments -D_FORTIFY_SOURCE, and dnl avoids a glibc redefinition error. dnl The msan block below appends -U_FORTIFY_SOURCE after this, so the dnl ordering matters; keep the two in this order or MSan breaks. AX_APPEND_COMPILE_FLAGS([ -D_FORTIFY_SOURCE=2], [LRZSZ_CFLAGS]) dnl -Werror is a development default; release builds may pass --disable-Werror. dnl The option is registered unconditionally; the flag is appended inside dnl the gcc-family gate below (so --disable-Werror keeps working everywhere dnl and non-gcc builds never see -Werror at all). AC_ARG_ENABLE([Werror], AS_HELP_STRING([--disable-Werror], [do not turn compiler warnings into errors]), [], [enable_Werror=yes]) dnl The warning machinery (AX_COMPILER_FLAGS_CFLAGS plus the manual dnl WARN_CFLAGS list) is tuned for gcc and clang; autoconf reports every dnl compiler defining __GNUC__ as $GCC (gcc, clang, icc, ...). Compilers dnl outside that family either reject the probed -W flags one by one dnl (noisy but harmless) or - worse - accept unknown -W options silently dnl and would then fail the -Werror default on warnings never vetted for dnl them. Give them a quiet build without -W flags instead. The dnl functional probes (-std, -g3, -D_FORTIFY_SOURCE, sanitizers) stay dnl outside the gate: they are probed individually and must apply to dnl every compiler. WARN_CFLAGS="" AS_IF([test "x$GCC" = "xyes"], [ AX_COMPILER_FLAGS_CFLAGS() AX_APPEND_COMPILE_FLAGS([ -Wunused-result -Wpedantic -Wcast-qual -Wmissing-braces -Wcomments -Wformat], [WARN_CFLAGS]) dnl that one does not take #ifdefs into account. clang-only warning family. dnl probe the positive form: gcc errors on unknown positive -W flags immediately, dnl but silently accepts unknown -Wno-* forms and then prints a per-file dnl "unrecognized command-line option" note on every file / translation unit dnl that has any diagnostic. AX_CHECK_COMPILE_FLAG([-Wpre-c23-compat], [AX_APPEND_COMPILE_FLAGS([ -Wno-pre-c23-compat], [WARN_CFLAGS])]) AS_IF([test "x$enable_Werror" = xyes], [AX_APPEND_COMPILE_FLAGS([ -Werror ], [WARN_CFLAGS])]) ]) if test "$want_coverage" != "no" ; then AX_APPEND_COMPILE_FLAGS([ --coverage ], [LRZSZ_CFLAGS]) AX_APPEND_COMPILE_FLAGS([ --coverage], [LRZSZ_LDFLAGS]) fi if test "$want_asan" != "no" ; then AX_APPEND_COMPILE_FLAGS([ -fsanitize=address ], [LRZSZ_CFLAGS]) AX_APPEND_COMPILE_FLAGS([ -fsanitize=address ], [LRZSZ_LDFLAGS]) fi if test "$want_lsan" != "no" ; then AX_APPEND_COMPILE_FLAGS([ -fsanitize=leak ], [LRZSZ_CFLAGS]) AX_APPEND_COMPILE_FLAGS([ -fsanitize=leak ], [LRZSZ_LDFLAGS]) fi if test "$want_msan" != "no" ; then AX_APPEND_COMPILE_FLAGS([ -fsanitize=memory ], [LRZSZ_CFLAGS]) AX_APPEND_COMPILE_FLAGS([ -fsanitize=memory ], [LRZSZ_LDFLAGS]) AX_APPEND_COMPILE_FLAGS([ -U_FORTIFY_SOURCE ], [LRZSZ_CFLAGS]) fi if test "$want_ubsan" != "no" ; then AX_APPEND_COMPILE_FLAGS([ -fsanitize=undefined ], [LRZSZ_CFLAGS]) AX_APPEND_COMPILE_FLAGS([ -fsanitize=undefined ], [LRZSZ_LDFLAGS]) fi # coverage and the sanitizers instrument every operation, which inflates # inline function bodies past gcc's inline budget (--param # max-inline-insns-single); gcc then refuses to inline functions declared # inline, and -Winline turns that into an error under -Werror. Keep # -Werror strict for everything else in plain builds. LRZSZ_CFLAGS is # appended after WARN_CFLAGS in AM_CFLAGS, so this overrides -Werror. if test "$want_coverage" != "no" -o "$want_asan" != "no" \ -o "$want_lsan" != "no" -o "$want_msan" != "no" \ -o "$want_ubsan" != "no" ; then AX_APPEND_COMPILE_FLAGS([ -Wno-error=inline ], [LRZSZ_CFLAGS]) fi dnl Checks for libraries. AC_CHECK_INCLUDES_DEFAULT dnl No AC_CHECK_HEADERS: with _POSIX_C_SOURCE >= 200809L (MIN_POSIX_C_STD dnl above) all headers formerly checked here (fcntl.h limits.h sys/select.h sys/time.h dnl sys/times.h termios.h unistd.h utime.h syslog.h locale.h) are mandatory. dnl The former checks for sys/ioctl.h sys/termios.h sys/syslog.h sys/param.h dnl strings.h arpa/inet.h are gone: nothing includes them any more. dnl Checks for typedefs, structures, and compiler characteristics. dnl sigaction and fseeko are mandatory under POSIX.1-2008 (MIN_POSIX_C_STD dnl above) and used unconditionally. getopt_long is a GNU extension: the dnl sources fall back to plain getopt without it. AC_CHECK_FUNCS(getopt_long) dnl O_NOFOLLOW is POSIX.1-2008; this is to provide fallback for ancient systems. AH_TEMPLATE([HAVE_O_NOFOLLOW], [Define to 1 if your fcntl.h defines O_NOFOLLOW.]) AC_MSG_CHECKING([for O_NOFOLLOW]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[int x = O_NOFOLLOW; return x;]])], [AC_DEFINE([HAVE_O_NOFOLLOW], [1]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_SUBST(LRZSZ_CFLAGS) AC_SUBST(LRZSZ_LDFLAGS) AC_SUBST([WARN_CFLAGS]) dnl gettext infrastructure is vendored (m4/, po/, config.rpath); do not add dnl AM_GNU_GETTEXT_VERSION / AM_GNU_GETTEXT_REQUIRE_VERSION here — autoreconf -fi dnl would try to run autopoint (target version would be 0.23). AM_GNU_GETTEXT(external) dnl AC_DEFINE_UNQUOTED(LOCALEDIR,"$prefix/$DATADIRNAME","Description… autoheader wants this") AC_CONFIG_FILES([Makefile man/Makefile po/Makefile.in src/Makefile Specfile]) AC_OUTPUT lrzsz-0.13.1/README0000644000175000017500000000127715243561474007343 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 large parts of this package. 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.tests for information about how to do a self test Uwe Ohse lrzsz-0.13.1/Specfile.in0000664000175000017500000000462215251332404010530 Summary: lzrz - sz, rz, and friends Name: @PACKAGE@ Version: @VERSION@ Release: 0 Copyright: GPL Group: Applications/Communications Source: ftp://ftp.ohse.de/uwe/releases/@DIST_TARBALL@.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 - 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 - build root * Thu May 07 1998 Prospector System - translations modified for de, fr, tr * Tue Oct 21 1997 Donnie Barnes - spec file cleanups * Thu Jul 10 1997 Erik Troan - built against glibc * Wed Mar 5 1997 msf@redhat.com - Upgraded to 0.12.14 and changed makefiles so gettext isnt built. lrzsz-0.13.1/aclocal.m40000664000175000017500000014001715260417112010305 # generated automatically by aclocal 1.17 -*- Autoconf -*- # Copyright (C) 1996-2024 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],, [m4_warning([this file was generated for autoconf 2.72. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # Copyright (C) 2002-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.17' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.17], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.17])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thus: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl m4_ifdef([_$0_ALREADY_INIT], [m4_fatal([$0 expanded multiple times ]m4_defn([_$0_ALREADY_INIT]))], [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) # Variables for tags utilities; see am/tags.am if test -z "$CTAGS"; then CTAGS=ctags fi AC_SUBST([CTAGS]) if test -z "$ETAGS"; then ETAGS=etags fi AC_SUBST([ETAGS]) if test -z "$CSCOPE"; then CSCOPE=cscope fi AC_SUBST([CSCOPE]) AC_REQUIRE([_AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl AC_REQUIRE([_AM_PROG_RM_F]) AC_REQUIRE([_AM_PROG_XARGS_N]) dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2022-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_RM_F # --------------- # Check whether 'rm -f' without any arguments works. # https://bugs.gnu.org/10828 AC_DEFUN([_AM_PROG_RM_F], [am__rm_f_notfound= AS_IF([(rm -f && rm -fr && rm -rf) 2>/dev/null], [], [am__rm_f_notfound='""']) AC_SUBST(am__rm_f_notfound) ]) # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SLEEP_FRACTIONAL_SECONDS # ---------------------------- AC_DEFUN([_AM_SLEEP_FRACTIONAL_SECONDS], [dnl AC_CACHE_CHECK([whether sleep supports fractional seconds], am_cv_sleep_fractional_seconds, [dnl AS_IF([sleep 0.001 2>/dev/null], [am_cv_sleep_fractional_seconds=yes], [am_cv_sleep_fractional_seconds=no]) ])]) # _AM_FILESYSTEM_TIMESTAMP_RESOLUTION # ----------------------------------- # Determine the filesystem's resolution for file modification # timestamps. The coarsest we know of is FAT, with a resolution # of only two seconds, even with the most recent "exFAT" extensions. # The finest (e.g. ext4 with large inodes, XFS, ZFS) is one # nanosecond, matching clock_gettime. However, it is probably not # possible to delay execution of a shell script for less than one # millisecond, due to process creation overhead and scheduling # granularity, so we don't check for anything finer than that. (See below.) AC_DEFUN([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION], [dnl AC_REQUIRE([_AM_SLEEP_FRACTIONAL_SECONDS]) AC_CACHE_CHECK([filesystem timestamp resolution], am_cv_filesystem_timestamp_resolution, [dnl # Default to the worst case. am_cv_filesystem_timestamp_resolution=2 # Only try to go finer than 1 sec if sleep can do it. # Don't try 1 sec, because if 0.01 sec and 0.1 sec don't work, # - 1 sec is not much of a win compared to 2 sec, and # - it takes 2 seconds to perform the test whether 1 sec works. # # Instead, just use the default 2s on platforms that have 1s resolution, # accept the extra 1s delay when using $sleep in the Automake tests, in # exchange for not incurring the 2s delay for running the test for all # packages. # am_try_resolutions= if test "$am_cv_sleep_fractional_seconds" = yes; then # Even a millisecond often causes a bunch of false positives, # so just try a hundredth of a second. The time saved between .001 and # .01 is not terribly consequential. am_try_resolutions="0.01 0.1 $am_try_resolutions" fi # In order to catch current-generation FAT out, we must *modify* files # that already exist; the *creation* timestamp is finer. Use names # that make ls -t sort them differently when they have equal # timestamps than when they have distinct timestamps, keeping # in mind that ls -t prints the *newest* file first. rm -f conftest.ts? : > conftest.ts1 : > conftest.ts2 : > conftest.ts3 # Make sure ls -t actually works. Do 'set' in a subshell so we don't # clobber the current shell's arguments. (Outer-level square brackets # are removed by m4; they're present so that m4 does not expand # ; be careful, easy to get confused.) if ( set X `[ls -t conftest.ts[12]]` && { test "$[]*" != "X conftest.ts1 conftest.ts2" || test "$[]*" != "X conftest.ts2 conftest.ts1"; } ); then :; else # 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". _AS_ECHO_UNQUOTED( ["Bad output from ls -t: \"`[ls -t conftest.ts[12]]`\""], [AS_MESSAGE_LOG_FD]) AC_MSG_FAILURE([ls -t produces unexpected output. Make sure there is not a broken ls alias in your environment.]) fi for am_try_res in $am_try_resolutions; do # Any one fine-grained sleep might happen to cross the boundary # between two values of a coarser actual resolution, but if we do # two fine-grained sleeps in a row, at least one of them will fall # entirely within a coarse interval. echo alpha > conftest.ts1 sleep $am_try_res echo beta > conftest.ts2 sleep $am_try_res echo gamma > conftest.ts3 # We assume that 'ls -t' will make use of high-resolution # timestamps if the operating system supports them at all. if (set X `ls -t conftest.ts?` && test "$[]2" = conftest.ts3 && test "$[]3" = conftest.ts2 && test "$[]4" = conftest.ts1); then # # Ok, ls -t worked. If we're at a resolution of 1 second, we're done, # because we don't need to test make. make_ok=true if test $am_try_res != 1; then # But if we've succeeded so far with a subsecond resolution, we # have one more thing to check: make. It can happen that # everything else supports the subsecond mtimes, but make doesn't; # notably on macOS, which ships make 3.81 from 2006 (the last one # released under GPLv2). https://bugs.gnu.org/68808 # # We test $MAKE if it is defined in the environment, else "make". # It might get overridden later, but our hope is that in practice # it does not matter: it is the system "make" which is (by far) # the most likely to be broken, whereas if the user overrides it, # probably they did so with a better, or at least not worse, make. # https://lists.gnu.org/archive/html/automake/2024-06/msg00051.html # # Create a Makefile (real tab character here): rm -f conftest.mk echo 'conftest.ts1: conftest.ts2' >conftest.mk echo ' touch conftest.ts2' >>conftest.mk # # Now, running # touch conftest.ts1; touch conftest.ts2; make # should touch ts1 because ts2 is newer. This could happen by luck, # but most often, it will fail if make's support is insufficient. So # test for several consecutive successes. # # (We reuse conftest.ts[12] because we still want to modify existing # files, not create new ones, per above.) n=0 make=${MAKE-make} until test $n -eq 3; do echo one > conftest.ts1 sleep $am_try_res echo two > conftest.ts2 # ts2 should now be newer than ts1 if $make -f conftest.mk | grep 'up to date' >/dev/null; then make_ok=false break # out of $n loop fi n=`expr $n + 1` done fi # if $make_ok; then # Everything we know to check worked out, so call this resolution good. am_cv_filesystem_timestamp_resolution=$am_try_res break # out of $am_try_res loop fi # Otherwise, we'll go on to check the next resolution. fi done rm -f conftest.ts? # (end _am_filesystem_timestamp_resolution) ])]) # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_REQUIRE([_AM_FILESYSTEM_TIMESTAMP_RESOLUTION]) # This check should not be cached, as it may vary across builds of # different projects. AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # 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). am_build_env_is_sane=no am_has_slept=no rm -f conftest.file for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[]*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi test "$[]2" = conftest.file ); then am_build_env_is_sane=yes break fi # Just in case. sleep "$am_cv_filesystem_timestamp_resolution" am_has_slept=yes done AC_MSG_RESULT([$am_build_env_is_sane]) if test "$am_build_env_is_sane" = no; then AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= AS_IF([test -e conftest.file || grep 'slept: no' conftest.file >/dev/null 2>&1],, [dnl ( sleep "$am_cv_filesystem_timestamp_resolution" ) & am_sleep_pid=$! ]) AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SILENT_RULES # ---------------- # Enable less verbose build rules support. AC_DEFUN([_AM_SILENT_RULES], [AM_DEFAULT_VERBOSITY=1 AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls dnl to AM_SILENT_RULES to change the default value. AC_CONFIG_COMMANDS_PRE([dnl case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; esac if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi ])dnl ]) # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or # empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_REQUIRE([_AM_SILENT_RULES]) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])]) # Copyright (C) 2001-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test x$am_uid = xunknown; then AC_MSG_WARN([ancient id detected; assuming current UID is ok, but dist-ustar might not work]) elif test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test x$gm_gid = xunknown; then AC_MSG_WARN([ancient id detected; assuming current GID is ok, but dist-ustar might not work]) elif test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR # Copyright (C) 2022-2024 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_XARGS_N # ---------------- # Check whether 'xargs -n' works. It should work everywhere, so the fallback # is not optimized at all as we never expect to use it. AC_DEFUN([_AM_PROG_XARGS_N], [AC_CACHE_CHECK([xargs -n works], am_cv_xargs_n_works, [dnl AS_IF([test "`echo 1 2 3 | xargs -n2 echo`" = "1 2 3"], [am_cv_xargs_n_works=yes], [am_cv_xargs_n_works=no])]) AS_IF([test "$am_cv_xargs_n_works" = yes], [am__xargs_n='xargs -n'], [dnl am__xargs_n='am__xargs_n () { shift; sed "s/ /\\n/g" | while read am__xargs_n_arg; do "$@" "$am__xargs_n_arg"; done; }' ])dnl AC_SUBST(am__xargs_n) ]) m4_include([m4/ax_append_compile_flags.m4]) m4_include([m4/ax_append_flag.m4]) m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_compiler_flags_cflags.m4]) m4_include([m4/ax_require_defined.m4]) m4_include([m4/build-to-host.m4]) m4_include([m4/gettext.m4]) m4_include([m4/host-cpu-c-abi.m4]) m4_include([m4/iconv.m4]) m4_include([m4/intlmacosx.m4]) m4_include([m4/lib-ld.m4]) m4_include([m4/lib-link.m4]) m4_include([m4/lib-prefix.m4]) m4_include([m4/nls.m4]) m4_include([m4/po.m4]) m4_include([m4/progtest.m4]) lrzsz-0.13.1/config.h.in0000664000175000017500000001366015260417117010500 /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if lrz shall create directories if needed. */ #undef ENABLE_MKDIR /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS /* Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */ #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES /* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ #undef HAVE_CFPREFERENCESCOPYAPPVALUE /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the 'getopt_long' function. */ #undef HAVE_GETOPT_LONG /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MINIX_CONFIG_H /* Define to 1 if your fcntl.h defines O_NOFOLLOW. */ #undef HAVE_O_NOFOLLOW /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if all of the C89 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define to the syslog facility constant to use for openlog(). */ #undef SYSLOG_FACILITY /* Enable extensions on AIX, Interix, z/OS. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable general extensions on macOS. */ #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable X/Open compliant socket functions that do not require linking with -lxnet on HP-UX 11.11. */ #ifndef _HPUX_ALT_XOPEN_SOCKET_API # undef _HPUX_ALT_XOPEN_SOCKET_API #endif /* Identify the host operating system as Minix. This macro does not affect the system headers' behavior. A future release of Autoconf may stop defining this macro. */ #ifndef _MINIX # undef _MINIX #endif /* Enable general extensions on NetBSD. Enable NetBSD compatibility extensions on Minix. */ #ifndef _NETBSD_SOURCE # undef _NETBSD_SOURCE #endif /* Enable OpenBSD compatibility extensions on NetBSD. Oddly enough, this does nothing on OpenBSD. */ #ifndef _OPENBSD_SOURCE # undef _OPENBSD_SOURCE #endif /* Define to 1 if needed for POSIX-compatible behavior. */ #ifndef _POSIX_SOURCE # undef _POSIX_SOURCE #endif /* Define to 2 if needed for POSIX-compatible behavior. */ #ifndef _POSIX_1_SOURCE # undef _POSIX_1_SOURCE #endif /* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ #ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ # undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ # undef __STDC_WANT_IEC_60559_BFP_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ #ifndef __STDC_WANT_IEC_60559_DFP_EXT__ # undef __STDC_WANT_IEC_60559_DFP_EXT__ #endif /* Enable extensions specified by C23 Annex F. */ #ifndef __STDC_WANT_IEC_60559_EXT__ # undef __STDC_WANT_IEC_60559_EXT__ #endif /* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ #ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ # undef __STDC_WANT_IEC_60559_FUNCS_EXT__ #endif /* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */ #ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ # undef __STDC_WANT_IEC_60559_TYPES_EXT__ #endif /* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ #ifndef __STDC_WANT_LIB_EXT2__ # undef __STDC_WANT_LIB_EXT2__ #endif /* Enable extensions specified by ISO/IEC 24747:2009. */ #ifndef __STDC_WANT_MATH_SPEC_FUNCS__ # undef __STDC_WANT_MATH_SPEC_FUNCS__ #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable X/Open extensions. Define to 500 only if necessary to make mbstate_t available. */ #ifndef _XOPEN_SOURCE # undef _XOPEN_SOURCE #endif /* Version number of package */ #undef VERSION /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define to 1 on platforms where this makes off_t a 64-bit type. */ #undef _LARGE_FILES /* Number of bits in time_t, on hosts where this is settable. */ #undef _TIME_BITS /* Define to 1 on platforms where this makes time_t a 64-bit type. */ #undef __MINGW_USE_VC2005_COMPAT lrzsz-0.13.1/mkinstalldirs0000755000175000017500000000711415256501374011262 #! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2024-06-19.01; # UTC # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' IFS=" "" $nl" errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to . GNU Automake home page: . General help using GNU software: ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 (GNU Automake) $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else # On NextStep and OpenStep, the 'mkdir' command does not # recognize any option. It will interpret all options as # directories to create, and then abort because '.' already # exists. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "umask 22" umask 22 echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac echo "umask 22" umask 22 for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp=$pathcomp/ done if test ! -z "$dirmode"; then echo "chmod $dirmode $file" chmod "$dirmode" "$file" || errstatus=$? fi done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: lrzsz-0.13.1/README.isdn4linux0000664000175000017500000000140115255145330011422 [Historical. isdn4linux's tty emulation was removed from Linux in kernel 5.15 (2021), so this problem can no longer occur there; the general failure class - packetized lines silently losing whole packets - is regression-tested by "make vcheck" suite "packetloss" (zmodem-lsz-lrz-packetdrop*, using src/linesimulator -P).] 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 and Frank Thieme . lrzsz-0.13.1/compile0000755000175000017500000001670515256501374010040 #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2024-06-19.01; # UTC # Copyright (C) 1999-2024 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.lo | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . GNU Automake home page: . General help using GNU software: . EOF exit $? ;; -v | --v*) echo "compile (GNU Automake) $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ clang-cl | *[/\\]clang-cl | clang-cl.exe | *[/\\]clang-cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: lrzsz-0.13.1/TODO0000644000175000017500000001617215260222632007140 - make argv[0]-recognition of X/YModem work with program_name_transform. (or not? does anyone use that feature?) - add a stronger turbo escaping, only escaping ZDLE. - 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 systems), 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). - lsz: adaptive send window (dynamic Txwindow/Txwspac) instead of unbounded streaming when the receiver advertises Rxbuflen=0. The problem: lsz sends MANY data subframes, until the network is saturated. if the receiver is slow (behind a serial port, for example), it will drain the net slowly. Example: lsz sends a 64k file, with a final ZRCRE. The receiver (in a dosbox) reads one 1024 byte packet per second, answers the ZCRCE after 64 seconds. Result: timeout, transmission failed. This depends on the receiver announced Rxbuflen (usually 0, meaning unlimited), and the window size, which can cause ZCRCW packets and this force answers from the receiver. Secondary effect of the unbounded streaming: on flaky lines the in-flight backlog before the FIRST error is the whole file. That means after an error most of the transfer is thrown away. Not the smart thing to do. Current workaround: lsz -w N sets Txwindow manually (e.g. -w 65536 or -w 16384); then ZCRCQ pings/ACKs pace the stream and the endgame wait only has to cover the last window. Slow receivers and flaky lines work. Ideas: 1. simple: treat an incoming Rxbuflen==0 as 65536 in the ZRINIT handler (lsz.c:1353 ff.). Bounds the backlog and fixes the endgame threshold to "window/60s" (~1.1 kcps), independent of file size. Costs one ZCRCW+ZACK round trip per 64k on clean links (<0.1% ?). 2. better: use a dynamic window size. Start conservatively (e.g. Txwindow=4096, Txwspac=1024) whenever Rxbuflen==0 && CANFDX, then re-estimate drain rate after each ACK in the window loop (zsendfdata) and adapt Txwspac ~= rate*1s ("one ZACK per second" or so), Txwindow = 4*Txwspac, clamped to [1k..64k] and to the advertised Rxbuflen (though we might want to not do a dynamic window if Rxbuflen is > 0). Scales with measured drain, not file size. Almost not overhead on fast links. Caveats to resolve before implementing: - calc_blklen (see below) overwrites Txwindow from Rxbuflen after errors. need to decide if adaptive values survive error recovery (maybe not, safety first). - -w must keep working as manual override (adaptive only when -w was not given). - only do it when Rxbuflen==0 && CANFDX (ZCRCQ needs a receiver that ACKs while streaming; CANOVIO peers are the ones that can tolerate unbounded backlog). - lsz: calc_blklen is a mess. is does not only calculate the data subframe length, but also the window size. - zmodemsnif: PS_DATA parser hardening (cosmetic, no protocol impact). Found during the zmtx-zmrx-1.02 MSan investigation: once the parser desyncs (e.g. it swallows a data subpacket whose byte stream it was not aligned with), two defects surface: 1. data_len is not bounded against data_buf[2048] - a desynced length byte can read beyond the buffer. 2. crc_recv is not reset on resync, so after a desync the sniffer emits repeated identical "received 2375eb0b / calculated aaf75693" lines where the "received" CRC is stale state from a previous (corrupt) frame, not from the current one - phantom BAD CRC reports that can mislead an investigation. Fix: bound data_len, reset crc_recv/parser state when a frame header is (re)acquired. Optional, the sniffer is a diagnostic tool; its frame log remains trustworthy up to the first desync. [i needed an AI to find that. i myself totally overlooked that angle] - B38 (from audit.md, reduced scope): remaining unbounded protocol loops. Most loops gained escape hatches since the audit (rzfile's n=20 budget, wcgetsec RETRYMAX, getnak tries==3, wcputsec/EOT RETRYMAX, getinsync stuck_acks from B37), but these paths still rely on the peer behaving - all require an ACTIVE misbehaving peer sending valid, CRC-correct frames (garbage/timeout paths are all bounded already): 1. lsz getinsync() case ERROR/default (lsz.c:~2300): sends ZNAK and continues without any counter; a peer that keeps sending decodable-but-unexpected headers (e.g. ZSINIT/ZFREECNT spam) keeps the loop alive forever. 2. lsz getinsync() case ZACK with flag==0 (lsz.c:~2286): a peer answering every ZCRCW with ZACKs whose position never equals bytes_sent loops forever (window loop uses flag=1, but ack_resync() uses flag==0). 3. lsz saybibi() default case (lsz.c:~2340): loops re-sending ZFIN while the peer answers with anything else than ZFIN/ZCAN/RCDO/TIMEOUT. 4. lsz zsendcmd() case ZRINIT -> goto listen (lsz.c:~2364): re-sends ZCOMMAND on every ZRINIT, unbounded (ERROR/TIMEOUT are bounded by Cmdtries, ZRINIT is not). 5. lrz wcrx() duplicate-sector branch (lrz.c:~737, and the same pattern in wcrxpn): a peer that replays the same valid sector forever gets ACK + NAK + re-receive in an unbounded loop; wcgetsec's RETRYMAX only bounds garbage, not valid dupes. Fix direction: per-call retry counters (RETRYMAX-style) on each of these; the counters must reset on protocol progress (offset advancing / new sector number), not on every received frame. - A1 scopes 2+3 (from review.md, deferred to after the next release by maintainer decision 2026-09-10): the zglobal.h global monolith. Full scope plan lives in review.md A1; here just the pointer so it does not get lost: (2) stat_for_file -> zi-> (~50 sites, mechanical thanks to A10's helper barrier; A2's inline send primitives need a zi parameter + fresh gcc -S hot-path proof), (3) zm.c engine state (Rxhdr/Txhdr/Txfcs32/Crc32t/Znulls/ Attn/Rxtimeout/Zrwindow/protocol/errors/Zctlesc) into zi (~18 signature changes, ~250-350 sites, re-touches the I4/I5 machines - highest regression risk). Scope (4) (full context struct incl. Verbose/Baudrate) was explicitly recommended against. Methodology: journal-baseline comparison, one commit per phase. - A9 (from review.md): magic numbers - name them: 896L endgame margin (lsz.c:1014), 0xfffff000 page/buffer rounding (lrz.c:1450, lsz.c:751), zmodem_requested?15:5 ZRQINIT retry counts (lrz.c:1577), st.st_size & ~(1023) resume offset rounding (lrz.c:1375). - V7/V8 future work (from review.md, both documented as deferred removals with deprecation warnings shipped; decision recorded there): remove the ZCOMMAND sender (lsz -c/-i/-C) and the ZRQINIT ZF0=ZCOMMAND bit (V7), and make absolute paths / .. components in lsz -f a fatal sender-side error (V8) - the latter will break the MGMT-traversal-dotdot test's sender, which would need a hand-crafted-protocol sender to keep receiver-side traversal coverage. Timeline at maintainer discretion (~6-12 months). - add another tool to check safe_open_fd for races? That might be total overkill. lrzsz-0.13.1/README.tests0000644000175000017500000001011515257170127010467 "make vcheck" will do many tests. this test suite is moderately complete. There are still some options without tests, but all crucial ones are covered. "make qa" will run something similar to configure && make clean && make && make vcheck multiple times: - gcc and/and clang, if available, multiplied with - ASan, MSan und UBSan. and a final coverage run. If this runs through, a final configure && make clean && make is run. The checks will ./tests, and this directory will not be removed after the check. In it you will find, among things i didn't clean up: - passfail.log (shows all tests run with PASSED/FAILED info) - failures.log (shows all failed tests) - perf.log (performance data) - journal.log Note that the tests are run over a pipe and a named pipe. The performance values are in no way comparable to a real serial interface (or even a network connection). Having said that: in real life the number will change, but what is faster in the benchmark will most likely be faster over a real serial line. If you want to do compatibility checks, note this: available="lrzsz" if test -x ~/bin/lrzsz-0.12.21rc/lrz -a -x ~/bin/lrzsz-0.12.21rc/lsz ; then available="$available lrzsz_old" fi if test -x ~/bin/crzsz/crz -a -x ~/bin/crzsz/csz ; then available="$available crzsz" fi if test -x ~/bin/rzsz373/rz -a -x ~/bin/rzsz373/sz ; then available="$available rzsz373" fi if test -x ~/bin/zmtx-zmrx-2.06/zmtx -a -x ~/bin/zmtx-zmrx-2.06/zmrx ; then available="$available zmtxzmrx2" fi if test -x ~/bin/sexyz-3.6 ; then available="$available sexyz" fi zmtx-zmrx-2.06 is easy to compile. sexyz is easy to compile. The other are mostly historic, anyway. oh, yes… "make vcheck-zbenchmark" runs a benchmark. "make buildcheck-remote" unpacks the distribution tarball on one or more remote machines (after an scp) and runs "make buildcheck+" there — a clean configure/compile plus the test suite, on systems this tree does not build on locally. The host list is kept in a local, non-distributed cfg.mk, e.g.: REMOTE_HOSTS = uwe@openbsd uwe@dev and can be overridden per run: make buildcheck-remote REMOTE_HOSTS=uwe@openbsd "make fuzz" runs the ZMODEM protocol fuzzing (src/zmodemfuzz.c). default: 25 iterations per mode (override with FUZZITER=NNN, for example: FUZZITER=200 make fuzz): - "-m receive": a faked sender talks to ./src/lrz with mutated byte streams (CRC corruption, illegal ZDLE escapes, frame type roulette, garbage floods, CAN bursts, truncated streams, hostile file names). - "-m send": a faked receiver answers ./src/lsz with hostile frame sequences (silence, ZNAK loops, ZSKIP, ZABORT, ZFERR, ZCHALLENGE, absurd ZRPOS positions, cancel bursts). The fuzzer checks that the target terminates in a bounded time, dies by no signal, writes nothing outside the receiving directory, and (clean baseline exchanges, every 17th iteration) that the received content matches what was sent. Every failure leaves /tmp/zmodemfuzz-fail-seedNNN-itNNN.log with the complete byte transcript; reproduce any run exactly with the printed seed: src/zmodemfuzz -s SEED -m receive -- ./src/lrz -q -Z The end-of-run class summary columns are count, avg ms, max ms, hangs, timeouts, fails [, crc32] where "timeouts" counts iterations that burned the harness alarm budget (hang, or the target was still stuck in a bounded retry loop when the alarm fired) - expected after mid-stream mutations and the hostile ACK-loop choice, NOT a target bug; and "fails" counts real invariant violations (crash, signal death, canary escape, content mismatch). A run is healthy when the trailing "done, N iterations, F failures" line reports F=0. The per-row "fails" is redundant with F: fail() prints a FAIL line for every counted failure, so a row with fails>0 without FAIL lines cannot happen. lrzsz-0.13.1/ABOUT-NLS0000644000175000017500000000010315236326254007672 lrzsz-0.13.1/THANKS0000664000175000017500000000026206607440600007360 There are undoubtly more people to thank, but here's a start: Philippe De Muyter Glenn Burkhardt Philip Cox lrzsz-0.13.1/INSTALL0000644000175000017500000002372106703467636007520 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.